net/ice/base: fix return value
[dpdk.git] / drivers / net / ice / base / ice_switch.c
index 7e7d748..5c53b9e 100644 (file)
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2020
+ * Copyright(c) 2001-2020 Intel Corporation
  */
 
 #include "ice_switch.h"
@@ -446,7 +446,7 @@ static const u8 dummy_udp_ipv6_packet[] = {
        0x86, 0xDD,             /* ICE_ETYPE_OL 12 */
 
        0x60, 0x00, 0x00, 0x00, /* ICE_IPV6_OFOS 40 */
-       0x00, 0x08, 0x11, 0x00, /* Next header UDP*/
+       0x00, 0x10, 0x11, 0x00, /* Next header UDP */
        0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00,
@@ -457,7 +457,10 @@ static const u8 dummy_udp_ipv6_packet[] = {
        0x00, 0x00, 0x00, 0x00,
 
        0x00, 0x00, 0x00, 0x00, /* ICE_UDP_ILOS 54 */
-       0x00, 0x08, 0x00, 0x00,
+       0x00, 0x10, 0x00, 0x00,
+
+       0x00, 0x00, 0x00, 0x00, /* needed for ESP packets */
+       0x00, 0x00, 0x00, 0x00,
 
        0x00, 0x00, /* 2 bytes for 4 byte alignment */
 };
@@ -516,68 +519,472 @@ static const u8 dummy_udp_gtp_packet[] = {
 
        0x45, 0x00, 0x00, 0x30, /* ICE_IPV4_OFOS 14 */
        0x00, 0x00, 0x00, 0x00,
-       0x00, 0x11, 0x00, 0x00,
+       0x00, 0x11, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+
+       0x00, 0x00, 0x08, 0x68, /* ICE_UDP_OF 34 */
+       0x00, 0x1c, 0x00, 0x00,
+
+       0x34, 0xff, 0x00, 0x0c, /* ICE_GTP 42 */
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x85,
+
+       0x02, 0x00, 0x00, 0x00, /* PDU Session extension header */
+       0x00, 0x00, 0x00, 0x00,
+};
+
+static const struct ice_dummy_pkt_offsets dummy_pppoe_packet_offsets[] = {
+       { ICE_MAC_OFOS,         0 },
+       { ICE_ETYPE_OL,         12 },
+       { ICE_VLAN_OFOS,        14},
+       { ICE_PPPOE,            18 },
+       { ICE_PROTOCOL_LAST,    0 },
+};
+
+static const struct ice_dummy_pkt_offsets dummy_pppoe_packet_ipv4_offsets[] = {
+       { ICE_MAC_OFOS,         0 },
+       { ICE_ETYPE_OL,         12 },
+       { ICE_VLAN_OFOS,        14},
+       { ICE_PPPOE,            18 },
+       { ICE_IPV4_OFOS,        26 },
+       { ICE_PROTOCOL_LAST,    0 },
+};
+
+static const u8 dummy_pppoe_ipv4_packet[] = {
+       0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+
+       0x81, 0x00,             /* ICE_ETYPE_OL 12 */
+
+       0x00, 0x00, 0x88, 0x64, /* ICE_VLAN_OFOS 14 */
+
+       0x11, 0x00, 0x00, 0x00, /* ICE_PPPOE 18 */
+       0x00, 0x16,
+
+       0x00, 0x21,             /* PPP Link Layer 24 */
+
+       0x45, 0x00, 0x00, 0x14, /* ICE_IPV4_IL 26 */
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+
+       0x00, 0x00,             /* 2 bytes for 4 bytes alignment */
+};
+
+static const
+struct ice_dummy_pkt_offsets dummy_pppoe_ipv4_tcp_packet_offsets[] = {
+       { ICE_MAC_OFOS,         0 },
+       { ICE_ETYPE_OL,         12 },
+       { ICE_VLAN_OFOS,        14},
+       { ICE_PPPOE,            18 },
+       { ICE_IPV4_OFOS,        26 },
+       { ICE_TCP_IL,           46 },
+       { ICE_PROTOCOL_LAST,    0 },
+};
+
+static const u8 dummy_pppoe_ipv4_tcp_packet[] = {
+       0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+
+       0x81, 0x00,             /* ICE_ETYPE_OL 12 */
+
+       0x00, 0x00, 0x88, 0x64, /* ICE_VLAN_OFOS 14 */
+
+       0x11, 0x00, 0x00, 0x00, /* ICE_PPPOE 18 */
+       0x00, 0x16,
+
+       0x00, 0x21,             /* PPP Link Layer 24 */
+
+       0x45, 0x00, 0x00, 0x28, /* ICE_IPV4_OFOS 26 */
+       0x00, 0x01, 0x00, 0x00,
+       0x00, 0x06, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+
+       0x00, 0x00, 0x00, 0x00, /* ICE_TCP_IL 46 */
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x50, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+
+       0x00, 0x00,             /* 2 bytes for 4 bytes alignment */
+};
+
+static const
+struct ice_dummy_pkt_offsets dummy_pppoe_ipv4_udp_packet_offsets[] = {
+       { ICE_MAC_OFOS,         0 },
+       { ICE_ETYPE_OL,         12 },
+       { ICE_VLAN_OFOS,        14},
+       { ICE_PPPOE,            18 },
+       { ICE_IPV4_OFOS,        26 },
+       { ICE_UDP_ILOS,         46 },
+       { ICE_PROTOCOL_LAST,    0 },
+};
+
+static const u8 dummy_pppoe_ipv4_udp_packet[] = {
+       0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+
+       0x81, 0x00,             /* ICE_ETYPE_OL 12 */
+
+       0x00, 0x00, 0x88, 0x64, /* ICE_VLAN_OFOS 14 */
+
+       0x11, 0x00, 0x00, 0x00, /* ICE_PPPOE 18 */
+       0x00, 0x16,
+
+       0x00, 0x21,             /* PPP Link Layer 24 */
+
+       0x45, 0x00, 0x00, 0x1c, /* ICE_IPV4_OFOS 26 */
+       0x00, 0x01, 0x00, 0x00,
+       0x00, 0x11, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+
+       0x00, 0x00, 0x00, 0x00, /* ICE_UDP_ILOS 46 */
+       0x00, 0x08, 0x00, 0x00,
+
+       0x00, 0x00,             /* 2 bytes for 4 bytes alignment */
+};
+
+static const struct ice_dummy_pkt_offsets dummy_pppoe_packet_ipv6_offsets[] = {
+       { ICE_MAC_OFOS,         0 },
+       { ICE_ETYPE_OL,         12 },
+       { ICE_VLAN_OFOS,        14},
+       { ICE_PPPOE,            18 },
+       { ICE_IPV6_OFOS,        26 },
+       { ICE_PROTOCOL_LAST,    0 },
+};
+
+static const u8 dummy_pppoe_ipv6_packet[] = {
+       0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+
+       0x81, 0x00,             /* ICE_ETYPE_OL 12 */
+
+       0x00, 0x00, 0x88, 0x64, /* ICE_VLAN_OFOS 14 */
+
+       0x11, 0x00, 0x00, 0x00, /* ICE_PPPOE 18 */
+       0x00, 0x2a,
+
+       0x00, 0x57,             /* PPP Link Layer 24 */
+
+       0x60, 0x00, 0x00, 0x00, /* ICE_IPV6_OFOS 26 */
+       0x00, 0x00, 0x3b, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+
+       0x00, 0x00,             /* 2 bytes for 4 bytes alignment */
+};
+
+static const
+struct ice_dummy_pkt_offsets dummy_pppoe_packet_ipv6_tcp_offsets[] = {
+       { ICE_MAC_OFOS,         0 },
+       { ICE_ETYPE_OL,         12 },
+       { ICE_VLAN_OFOS,        14},
+       { ICE_PPPOE,            18 },
+       { ICE_IPV6_OFOS,        26 },
+       { ICE_TCP_IL,           66 },
+       { ICE_PROTOCOL_LAST,    0 },
+};
+
+static const u8 dummy_pppoe_ipv6_tcp_packet[] = {
+       0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+
+       0x81, 0x00,             /* ICE_ETYPE_OL 12 */
+
+       0x00, 0x00, 0x88, 0x64, /* ICE_VLAN_OFOS 14 */
+
+       0x11, 0x00, 0x00, 0x00, /* ICE_PPPOE 18 */
+       0x00, 0x2a,
+
+       0x00, 0x57,             /* PPP Link Layer 24 */
+
+       0x60, 0x00, 0x00, 0x00, /* ICE_IPV6_OFOS 26 */
+       0x00, 0x14, 0x06, 0x00, /* Next header is TCP */
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+
+       0x00, 0x00, 0x00, 0x00, /* ICE_TCP_IL 66 */
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x50, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+
+       0x00, 0x00,             /* 2 bytes for 4 bytes alignment */
+};
+
+static const
+struct ice_dummy_pkt_offsets dummy_pppoe_packet_ipv6_udp_offsets[] = {
+       { ICE_MAC_OFOS,         0 },
+       { ICE_ETYPE_OL,         12 },
+       { ICE_VLAN_OFOS,        14},
+       { ICE_PPPOE,            18 },
+       { ICE_IPV6_OFOS,        26 },
+       { ICE_UDP_ILOS,         66 },
+       { ICE_PROTOCOL_LAST,    0 },
+};
+
+static const u8 dummy_pppoe_ipv6_udp_packet[] = {
+       0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+
+       0x81, 0x00,             /* ICE_ETYPE_OL 12 */
+
+       0x00, 0x00, 0x88, 0x64, /* ICE_VLAN_OFOS 14 */
+
+       0x11, 0x00, 0x00, 0x00, /* ICE_PPPOE 18 */
+       0x00, 0x2a,
+
+       0x00, 0x57,             /* PPP Link Layer 24 */
+
+       0x60, 0x00, 0x00, 0x00, /* ICE_IPV6_OFOS 26 */
+       0x00, 0x08, 0x11, 0x00, /* Next header UDP*/
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+
+       0x00, 0x00, 0x00, 0x00, /* ICE_UDP_ILOS 66 */
+       0x00, 0x08, 0x00, 0x00,
+
+       0x00, 0x00,             /* 2 bytes for 4 bytes alignment */
+};
+
+static const struct ice_dummy_pkt_offsets dummy_ipv4_esp_packet_offsets[] = {
+       { ICE_MAC_OFOS,         0 },
+       { ICE_IPV4_OFOS,        14 },
+       { ICE_ESP,                      34 },
+       { ICE_PROTOCOL_LAST,    0 },
+};
+
+static const u8 dummy_ipv4_esp_pkt[] = {
+       0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x08, 0x00,
+
+       0x45, 0x00, 0x00, 0x1c, /* ICE_IPV4_IL 14 */
+       0x00, 0x00, 0x40, 0x00,
+       0x40, 0x32, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+
+       0x00, 0x00, 0x00, 0x00, /* ICE_ESP 34 */
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00,             /* 2 bytes for 4 bytes alignment */
+};
+
+static const struct ice_dummy_pkt_offsets dummy_ipv6_esp_packet_offsets[] = {
+       { ICE_MAC_OFOS,         0 },
+       { ICE_IPV6_OFOS,        14 },
+       { ICE_ESP,                      54 },
+       { ICE_PROTOCOL_LAST,    0 },
+};
+
+static const u8 dummy_ipv6_esp_pkt[] = {
+       0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x86, 0xDD,
+
+       0x60, 0x00, 0x00, 0x00, /* ICE_IPV6_OFOS 14 */
+       0x00, 0x08, 0x32, 0x00, /* Next header ESP */
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+
+       0x00, 0x00, 0x00, 0x00, /* ICE_ESP 54 */
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00,             /* 2 bytes for 4 bytes alignment */
+};
+
+static const struct ice_dummy_pkt_offsets dummy_ipv4_ah_packet_offsets[] = {
+       { ICE_MAC_OFOS,         0 },
+       { ICE_IPV4_OFOS,        14 },
+       { ICE_AH,                       34 },
+       { ICE_PROTOCOL_LAST,    0 },
+};
+
+static const u8 dummy_ipv4_ah_pkt[] = {
+       0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x08, 0x00,
+
+       0x45, 0x00, 0x00, 0x20, /* ICE_IPV4_IL 14 */
+       0x00, 0x00, 0x40, 0x00,
+       0x40, 0x33, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+
+       0x00, 0x00, 0x00, 0x00, /* ICE_AH 34 */
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00,             /* 2 bytes for 4 bytes alignment */
+};
+
+static const struct ice_dummy_pkt_offsets dummy_ipv6_ah_packet_offsets[] = {
+       { ICE_MAC_OFOS,         0 },
+       { ICE_IPV6_OFOS,        14 },
+       { ICE_AH,                       54 },
+       { ICE_PROTOCOL_LAST,    0 },
+};
+
+static const u8 dummy_ipv6_ah_pkt[] = {
+       0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x86, 0xDD,
+
+       0x60, 0x00, 0x00, 0x00, /* ICE_IPV6_OFOS 14 */
+       0x00, 0x0c, 0x33, 0x00, /* Next header AH */
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+
+       0x00, 0x00, 0x00, 0x00, /* ICE_AH 54 */
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00,             /* 2 bytes for 4 bytes alignment */
+};
+
+static const struct ice_dummy_pkt_offsets dummy_ipv4_nat_packet_offsets[] = {
+       { ICE_MAC_OFOS,         0 },
+       { ICE_IPV4_OFOS,        14 },
+       { ICE_UDP_ILOS,         34 },
+       { ICE_NAT_T,            42 },
+       { ICE_PROTOCOL_LAST,    0 },
+};
+
+static const u8 dummy_ipv4_nat_pkt[] = {
+       0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x08, 0x00,
+
+       0x45, 0x00, 0x00, 0x24, /* ICE_IPV4_IL 14 */
+       0x00, 0x00, 0x40, 0x00,
+       0x40, 0x11, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+
+       0x00, 0x00, 0x11, 0x94, /* ICE_NAT_T 34 */
+       0x00, 0x00, 0x00, 0x00,
+
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00,             /* 2 bytes for 4 bytes alignment */
+};
+
+static const struct ice_dummy_pkt_offsets dummy_ipv6_nat_packet_offsets[] = {
+       { ICE_MAC_OFOS,         0 },
+       { ICE_IPV6_OFOS,        14 },
+       { ICE_UDP_ILOS,         54 },
+       { ICE_NAT_T,            62 },
+       { ICE_PROTOCOL_LAST,    0 },
+};
+
+static const u8 dummy_ipv6_nat_pkt[] = {
+       0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x86, 0xDD,
+
+       0x60, 0x00, 0x00, 0x00, /* ICE_IPV6_OFOS 14 */
+       0x00, 0x10, 0x11, 0x00, /* Next header NAT_T */
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00,
 
-       0x00, 0x00, 0x08, 0x68, /* ICE_UDP_OF 34 */
-       0x00, 0x1c, 0x00, 0x00,
-
-       0x34, 0xff, 0x00, 0x0c, /* ICE_GTP 42 */
+       0x00, 0x00, 0x11, 0x94, /* ICE_NAT_T 54 */
        0x00, 0x00, 0x00, 0x00,
-       0x00, 0x00, 0x00, 0x85,
 
-       0x02, 0x00, 0x00, 0x00, /* PDU Session extension header */
        0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00,             /* 2 bytes for 4 bytes alignment */
+
 };
 
-static const struct ice_dummy_pkt_offsets dummy_pppoe_packet_offsets[] = {
+static const struct ice_dummy_pkt_offsets dummy_ipv4_l2tpv3_packet_offsets[] = {
        { ICE_MAC_OFOS,         0 },
-       { ICE_ETYPE_OL,         12 },
-       { ICE_VLAN_OFOS,        14},
-       { ICE_PPPOE,            18 },
+       { ICE_IPV4_OFOS,        14 },
+       { ICE_L2TPV3,           34 },
        { ICE_PROTOCOL_LAST,    0 },
 };
 
-static const u8 dummy_pppoe_ipv4_packet[] = {
+static const u8 dummy_ipv4_l2tpv3_pkt[] = {
        0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
        0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00,
+       0x08, 0x00,
 
-       0x81, 0x00,             /* ICE_ETYPE_OL 12 */
-
-       0x00, 0x00, 0x88, 0x64, /* ICE_VLAN_OFOS 14 */
-
-       0x11, 0x00, 0x00, 0x00, /* ICE_PPPOE 18 */
-       0x00, 0x16,
-
-       0x00, 0x21,             /* PPP Link Layer 24 */
-
-       0x45, 0x00, 0x00, 0x14, /* ICE_IPV4_IL 26 */
+       0x45, 0x00, 0x00, 0x20, /* ICE_IPV4_IL 14 */
+       0x00, 0x00, 0x40, 0x00,
+       0x40, 0x73, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00,
+
+       0x00, 0x00, 0x00, 0x00, /* ICE_L2TPV3 34 */
        0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00,
-
        0x00, 0x00,             /* 2 bytes for 4 bytes alignment */
 };
 
-static const u8 dummy_pppoe_ipv6_packet[] = {
+static const struct ice_dummy_pkt_offsets dummy_ipv6_l2tpv3_packet_offsets[] = {
+       { ICE_MAC_OFOS,         0 },
+       { ICE_IPV6_OFOS,        14 },
+       { ICE_L2TPV3,           54 },
+       { ICE_PROTOCOL_LAST,    0 },
+};
+
+static const u8 dummy_ipv6_l2tpv3_pkt[] = {
        0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
        0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00,
+       0x86, 0xDD,
 
-       0x81, 0x00,             /* ICE_ETYPE_OL 12 */
-
-       0x00, 0x00, 0x88, 0x64, /* ICE_VLAN_OFOS 14 */
-
-       0x11, 0x00, 0x00, 0x00, /* ICE_PPPOE 18 */
-       0x00, 0x2a,
-
-       0x00, 0x57,             /* PPP Link Layer 24 */
-
-       0x60, 0x00, 0x00, 0x00, /* ICE_IPV6_OFOS 26 */
-       0x00, 0x00, 0x00, 0x00,
+       0x60, 0x00, 0x00, 0x00, /* ICE_IPV6_IL 14 */
+       0x00, 0x0c, 0x73, 0x40,
        0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00,
@@ -587,6 +994,9 @@ static const u8 dummy_pppoe_ipv6_packet[] = {
        0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00,
 
+       0x00, 0x00, 0x00, 0x00, /* ICE_L2TPV3 54 */
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
        0x00, 0x00,             /* 2 bytes for 4 bytes alignment */
 };
 
@@ -720,6 +1130,8 @@ ice_get_recp_frm_fw(struct ice_hw *hw, struct ice_sw_recipe *recps, u8 rid,
                                          rg_entry->fv_idx[i], &prot, &off);
                        lkup_exts->fv_words[fv_word_idx].prot_id = prot;
                        lkup_exts->fv_words[fv_word_idx].off = off;
+                       lkup_exts->field_mask[fv_word_idx] =
+                               rg_entry->fv_mask[i];
                        fv_word_idx++;
                }
                /* populate rg_list with the data from the child entry of this
@@ -777,8 +1189,7 @@ err_unroll:
  * this array is the recipe ID and the element is the mapping of which profiles
  * is this recipe mapped to.
  */
-static void
-ice_get_recp_to_prof_map(struct ice_hw *hw)
+static void ice_get_recp_to_prof_map(struct ice_hw *hw)
 {
        ice_declare_bitmap(r_bitmap, ICE_MAX_NUM_RECIPES);
        u16 i;
@@ -1639,6 +2050,7 @@ ice_aq_sw_rules(struct ice_hw *hw, void *rule_list, u16 rule_list_sz,
                u8 num_rules, enum ice_adminq_opc opc, struct ice_sq_cd *cd)
 {
        struct ice_aq_desc desc;
+       enum ice_status status;
 
        ice_debug(hw, ICE_DBG_TRACE, "%s\n", __func__);
 
@@ -1652,7 +2064,12 @@ ice_aq_sw_rules(struct ice_hw *hw, void *rule_list, u16 rule_list_sz,
        desc.flags |= CPU_TO_LE16(ICE_AQ_FLAG_RD);
        desc.params.sw_rules.num_rules_fltr_entry_index =
                CPU_TO_LE16(num_rules);
-       return ice_aq_send_cmd(hw, &desc, rule_list, rule_list_sz, cd);
+       status = ice_aq_send_cmd(hw, &desc, rule_list, rule_list_sz, cd);
+       if (opc != ice_aqc_opc_add_sw_rules &&
+           hw->adminq.sq_last_status == ICE_AQ_RC_ENOENT)
+               status = ICE_ERR_DOES_NOT_EXIST;
+
+       return status;
 }
 
 /**
@@ -1936,6 +2353,11 @@ out:
  */
 static void ice_fill_sw_info(struct ice_hw *hw, struct ice_fltr_info *fi)
 {
+       if ((fi->flag & ICE_FLTR_RX) &&
+           (fi->fltr_act == ICE_FWD_TO_VSI ||
+            fi->fltr_act == ICE_FWD_TO_VSI_LIST) &&
+           fi->lkup_type == ICE_SW_LKUP_LAST)
+               fi->lan_en = true;
        fi->lb_en = false;
        fi->lan_en = false;
        if ((fi->flag & ICE_FLTR_TX) &&
@@ -3276,8 +3698,7 @@ ice_add_mac_exit:
  *
  * Function add MAC rule for logical port from HW struct
  */
-enum ice_status
-ice_add_mac(struct ice_hw *hw, struct LIST_HEAD_TYPE *m_list)
+enum ice_status ice_add_mac(struct ice_hw *hw, struct LIST_HEAD_TYPE *m_list)
 {
        if (!m_list || !hw)
                return ICE_ERR_PARAM;
@@ -3475,8 +3896,7 @@ ice_add_vlan_rule(struct ice_hw *hw, struct LIST_HEAD_TYPE *v_list,
  *
  * Function add VLAN rule for logical port from HW struct
  */
-enum ice_status
-ice_add_vlan(struct ice_hw *hw, struct LIST_HEAD_TYPE *v_list)
+enum ice_status ice_add_vlan(struct ice_hw *hw, struct LIST_HEAD_TYPE *v_list)
 {
        if (!v_list || !hw)
                return ICE_ERR_PARAM;
@@ -3579,7 +3999,6 @@ ice_add_eth_mac_rule(struct ice_hw *hw, struct LIST_HEAD_TYPE *em_list,
        return ICE_SUCCESS;
 }
 
-enum ice_status
 /**
  * ice_add_eth_mac - Add a ethertype based filter rule
  * @hw: pointer to the hardware structure
@@ -3587,6 +4006,7 @@ enum ice_status
  *
  * Function add ethertype rule for logical port from HW struct
  */
+enum ice_status
 ice_add_eth_mac(struct ice_hw *hw, struct LIST_HEAD_TYPE *em_list)
 {
        if (!em_list || !hw)
@@ -3702,6 +4122,9 @@ void ice_rem_all_sw_rules_info(struct ice_hw *hw)
                        ice_rem_sw_rule_info(hw, rule_head);
                else
                        ice_rem_adv_rule_info(hw, rule_head);
+               if (sw->recp_list[i].adv_rule &&
+                   LIST_EMPTY(&sw->recp_list[i].filt_rules))
+                       sw->recp_list[i].adv_rule = false;
        }
 }
 
@@ -3889,8 +4312,7 @@ ice_remove_mac_rule(struct ice_hw *hw, struct LIST_HEAD_TYPE *m_list,
  * @m_list: list of MAC addresses and forwarding information
  *
  */
-enum ice_status
-ice_remove_mac(struct ice_hw *hw, struct LIST_HEAD_TYPE *m_list)
+enum ice_status ice_remove_mac(struct ice_hw *hw, struct LIST_HEAD_TYPE *m_list)
 {
        struct ice_sw_recipe *recp_list;
 
@@ -4120,17 +4542,17 @@ static u8 ice_determine_promisc_mask(struct ice_fltr_info *fi)
 }
 
 /**
- * ice_get_vsi_promisc - get promiscuous mode of given VSI
+ * _ice_get_vsi_promisc - get promiscuous mode of given VSI
  * @hw: pointer to the hardware structure
  * @vsi_handle: VSI handle to retrieve info from
  * @promisc_mask: pointer to mask to be filled in
  * @vid: VLAN ID of promisc VLAN VSI
+ * @sw: pointer to switch info struct for which function add rule
  */
-enum ice_status
-ice_get_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask,
-                   u16 *vid)
+static enum ice_status
+_ice_get_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask,
+                    u16 *vid, struct ice_switch_info *sw)
 {
-       struct ice_switch_info *sw = hw->switch_info;
        struct ice_fltr_mgmt_list_entry *itr;
        struct LIST_HEAD_TYPE *rule_head;
        struct ice_lock *rule_lock;     /* Lock to protect filter rule list */
@@ -4160,17 +4582,32 @@ ice_get_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask,
 }
 
 /**
- * ice_get_vsi_vlan_promisc - get VLAN promiscuous mode of given VSI
+ * ice_get_vsi_promisc - get promiscuous mode of given VSI
  * @hw: pointer to the hardware structure
  * @vsi_handle: VSI handle to retrieve info from
  * @promisc_mask: pointer to mask to be filled in
  * @vid: VLAN ID of promisc VLAN VSI
  */
 enum ice_status
-ice_get_vsi_vlan_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask,
-                        u16 *vid)
+ice_get_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask,
+                   u16 *vid)
+{
+       return _ice_get_vsi_promisc(hw, vsi_handle, promisc_mask,
+                                   vid, hw->switch_info);
+}
+
+/**
+ * ice_get_vsi_vlan_promisc - get VLAN promiscuous mode of given VSI
+ * @hw: pointer to the hardware structure
+ * @vsi_handle: VSI handle to retrieve info from
+ * @promisc_mask: pointer to mask to be filled in
+ * @vid: VLAN ID of promisc VLAN VSI
+ * @sw: pointer to switch info struct for which function add rule
+ */
+static enum ice_status
+_ice_get_vsi_vlan_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask,
+                         u16 *vid, struct ice_switch_info *sw)
 {
-       struct ice_switch_info *sw = hw->switch_info;
        struct ice_fltr_mgmt_list_entry *itr;
        struct LIST_HEAD_TYPE *rule_head;
        struct ice_lock *rule_lock;     /* Lock to protect filter rule list */
@@ -4199,6 +4636,21 @@ ice_get_vsi_vlan_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask,
        return ICE_SUCCESS;
 }
 
+/**
+ * ice_get_vsi_vlan_promisc - get VLAN promiscuous mode of given VSI
+ * @hw: pointer to the hardware structure
+ * @vsi_handle: VSI handle to retrieve info from
+ * @promisc_mask: pointer to mask to be filled in
+ * @vid: VLAN ID of promisc VLAN VSI
+ */
+enum ice_status
+ice_get_vsi_vlan_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask,
+                        u16 *vid)
+{
+       return _ice_get_vsi_vlan_promisc(hw, vsi_handle, promisc_mask,
+                                        vid, hw->switch_info);
+}
+
 /**
  * ice_remove_promisc - Remove promisc based filter rules
  * @hw: pointer to the hardware structure
@@ -4224,17 +4676,17 @@ ice_remove_promisc(struct ice_hw *hw, u8 recp_id,
 }
 
 /**
- * ice_clear_vsi_promisc - clear specified promiscuous mode(s) for given VSI
+ * _ice_clear_vsi_promisc - clear specified promiscuous mode(s)
  * @hw: pointer to the hardware structure
  * @vsi_handle: VSI handle to clear mode
  * @promisc_mask: mask of promiscuous config bits to clear
  * @vid: VLAN ID to clear VLAN promiscuous
+ * @sw: pointer to switch info struct for which function add rule
  */
-enum ice_status
-ice_clear_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask,
-                     u16 vid)
+static enum ice_status
+_ice_clear_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask,
+                      u16 vid, struct ice_switch_info *sw)
 {
-       struct ice_switch_info *sw = hw->switch_info;
        struct ice_fltr_list_entry *fm_entry, *tmp;
        struct LIST_HEAD_TYPE remove_list_head;
        struct ice_fltr_mgmt_list_entry *itr;
@@ -4299,14 +4751,32 @@ free_fltr_list:
 }
 
 /**
- * ice_set_vsi_promisc - set given VSI to given promiscuous mode(s)
+ * ice_clear_vsi_promisc - clear specified promiscuous mode(s) for given VSI
+ * @hw: pointer to the hardware structure
+ * @vsi_handle: VSI handle to clear mode
+ * @promisc_mask: mask of promiscuous config bits to clear
+ * @vid: VLAN ID to clear VLAN promiscuous
+ */
+enum ice_status
+ice_clear_vsi_promisc(struct ice_hw *hw, u16 vsi_handle,
+                     u8 promisc_mask, u16 vid)
+{
+       return _ice_clear_vsi_promisc(hw, vsi_handle, promisc_mask,
+                                     vid, hw->switch_info);
+}
+
+/**
+ * _ice_set_vsi_promisc - set given VSI to given promiscuous mode(s)
  * @hw: pointer to the hardware structure
  * @vsi_handle: VSI handle to configure
  * @promisc_mask: mask of promiscuous config bits
  * @vid: VLAN ID to set VLAN promiscuous
+ * @lport: logical port number to configure promisc mode
+ * @sw: pointer to switch info struct for which function add rule
  */
-enum ice_status
-ice_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask, u16 vid)
+static enum ice_status
+_ice_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask,
+                    u16 vid, u8 lport, struct ice_switch_info *sw)
 {
        enum { UCAST_FLTR = 1, MCAST_FLTR, BCAST_FLTR };
        struct ice_fltr_list_entry f_list_entry;
@@ -4397,17 +4867,16 @@ ice_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask, u16 vid)
                        new_fltr.src = hw_vsi_id;
                } else {
                        new_fltr.flag |= ICE_FLTR_RX;
-                       new_fltr.src = hw->port_info->lport;
+                       new_fltr.src = lport;
                }
 
                new_fltr.fltr_act = ICE_FWD_TO_VSI;
                new_fltr.vsi_handle = vsi_handle;
                new_fltr.fwd_id.hw_vsi_id = hw_vsi_id;
                f_list_entry.fltr_info = new_fltr;
-               recp_list = &hw->switch_info->recp_list[recipe_id];
+               recp_list = &sw->recp_list[recipe_id];
 
-               status = ice_add_rule_internal(hw, recp_list,
-                                              hw->port_info->lport,
+               status = ice_add_rule_internal(hw, recp_list, lport,
                                               &f_list_entry);
                if (status != ICE_SUCCESS)
                        goto set_promisc_exit;
@@ -4418,19 +4887,37 @@ set_promisc_exit:
 }
 
 /**
- * ice_set_vlan_vsi_promisc
+ * ice_set_vsi_promisc - set given VSI to given promiscuous mode(s)
+ * @hw: pointer to the hardware structure
+ * @vsi_handle: VSI handle to configure
+ * @promisc_mask: mask of promiscuous config bits
+ * @vid: VLAN ID to set VLAN promiscuous
+ */
+enum ice_status
+ice_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask,
+                   u16 vid)
+{
+       return _ice_set_vsi_promisc(hw, vsi_handle, promisc_mask, vid,
+                                   hw->port_info->lport,
+                                   hw->switch_info);
+}
+
+/**
+ * _ice_set_vlan_vsi_promisc
  * @hw: pointer to the hardware structure
  * @vsi_handle: VSI handle to configure
  * @promisc_mask: mask of promiscuous config bits
  * @rm_vlan_promisc: Clear VLANs VSI promisc mode
+ * @lport: logical port number to configure promisc mode
+ * @sw: pointer to switch info struct for which function add rule
  *
  * Configure VSI with all associated VLANs to given promiscuous mode(s)
  */
-enum ice_status
-ice_set_vlan_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask,
-                        bool rm_vlan_promisc)
+static enum ice_status
+_ice_set_vlan_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask,
+                         bool rm_vlan_promisc, u8 lport,
+                         struct ice_switch_info *sw)
 {
-       struct ice_switch_info *sw = hw->switch_info;
        struct ice_fltr_list_entry *list_itr, *tmp;
        struct LIST_HEAD_TYPE vsi_list_head;
        struct LIST_HEAD_TYPE *vlan_head;
@@ -4452,11 +4939,13 @@ ice_set_vlan_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask,
                            list_entry) {
                vlan_id = list_itr->fltr_info.l_data.vlan.vlan_id;
                if (rm_vlan_promisc)
-                       status = ice_clear_vsi_promisc(hw, vsi_handle,
-                                                      promisc_mask, vlan_id);
+                       status =  _ice_clear_vsi_promisc(hw, vsi_handle,
+                                                        promisc_mask,
+                                                        vlan_id, sw);
                else
-                       status = ice_set_vsi_promisc(hw, vsi_handle,
-                                                    promisc_mask, vlan_id);
+                       status =  _ice_set_vsi_promisc(hw, vsi_handle,
+                                                      promisc_mask, vlan_id,
+                                                      lport, sw);
                if (status)
                        break;
        }
@@ -4470,6 +4959,24 @@ free_fltr_list:
        return status;
 }
 
+/**
+ * ice_set_vlan_vsi_promisc
+ * @hw: pointer to the hardware structure
+ * @vsi_handle: VSI handle to configure
+ * @promisc_mask: mask of promiscuous config bits
+ * @rm_vlan_promisc: Clear VLANs VSI promisc mode
+ *
+ * Configure VSI with all associated VLANs to given promiscuous mode(s)
+ */
+enum ice_status
+ice_set_vlan_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask,
+                        bool rm_vlan_promisc)
+{
+       return _ice_set_vlan_vsi_promisc(hw, vsi_handle, promisc_mask,
+                                        rm_vlan_promisc, hw->port_info->lport,
+                                        hw->switch_info);
+}
+
 /**
  * ice_remove_vsi_lkup_fltr - Remove lookup type filters for a VSI
  * @hw: pointer to the hardware structure
@@ -4947,6 +5454,11 @@ static const struct ice_prot_ext_tbl_entry ice_prot_ext[ICE_PROTOCOL_LAST] = {
        { ICE_NVGRE,            { 0, 2, 4, 6 } },
        { ICE_GTP,              { 8, 10, 12, 14, 16, 18, 20 } },
        { ICE_PPPOE,            { 0, 2, 4, 6 } },
+       { ICE_PFCP,             { 8, 10, 12, 14, 16, 18, 20, 22 } },
+       { ICE_L2TPV3,           { 0, 2, 4, 6, 8, 10 } },
+       { ICE_ESP,              { 0, 2, 4, 6 } },
+       { ICE_AH,               { 0, 2, 4, 6, 8, 10 } },
+       { ICE_NAT_T,            { 8, 10, 12, 14 } },
 };
 
 /* The following table describes preferred grouping of recipes.
@@ -4974,6 +5486,11 @@ static const struct ice_protocol_entry ice_prot_id_tbl[ICE_PROTOCOL_LAST] = {
        { ICE_NVGRE,            ICE_GRE_OF_HW },
        { ICE_GTP,              ICE_UDP_OF_HW },
        { ICE_PPPOE,            ICE_PPPOE_HW },
+       { ICE_PFCP,             ICE_UDP_ILOS_HW },
+       { ICE_L2TPV3,           ICE_L2TPV3_HW },
+       { ICE_ESP,              ICE_ESP_HW },
+       { ICE_AH,               ICE_AH_HW },
+       { ICE_NAT_T,            ICE_UDP_ILOS_HW },
 };
 
 /**
@@ -4983,7 +5500,8 @@ static const struct ice_protocol_entry ice_prot_id_tbl[ICE_PROTOCOL_LAST] = {
  *
  * Returns index of matching recipe, or ICE_MAX_NUM_RECIPES if not found.
  */
-static u16 ice_find_recp(struct ice_hw *hw, struct ice_prot_lkup_ext *lkup_exts)
+static u16 ice_find_recp(struct ice_hw *hw, struct ice_prot_lkup_ext *lkup_exts,
+                        enum ice_sw_tunnel_type tun_type)
 {
        bool refresh_required = true;
        struct ice_sw_recipe *recp;
@@ -5010,17 +5528,23 @@ static u16 ice_find_recp(struct ice_hw *hw, struct ice_prot_lkup_ext *lkup_exts)
 
                /* if number of words we are looking for match */
                if (lkup_exts->n_val_words == recp[i].lkup_exts.n_val_words) {
-                       struct ice_fv_word *a = lkup_exts->fv_words;
-                       struct ice_fv_word *b = recp[i].lkup_exts.fv_words;
+                       struct ice_fv_word *ar = recp[i].lkup_exts.fv_words;
+                       struct ice_fv_word *be = lkup_exts->fv_words;
+                       u16 *cr = recp[i].lkup_exts.field_mask;
+                       u16 *de = lkup_exts->field_mask;
                        bool found = true;
-                       u8 p, q;
-
-                       for (p = 0; p < lkup_exts->n_val_words; p++) {
-                               for (q = 0; q < recp[i].lkup_exts.n_val_words;
-                                    q++) {
-                                       if (a[p].off == b[q].off &&
-                                           a[p].prot_id == b[q].prot_id)
-                                               /* Found the "p"th word in the
+                       u8 pe, qr;
+
+                       /* ar, cr, and qr are related to the recipe words, while
+                        * be, de, and pe are related to the lookup words
+                        */
+                       for (pe = 0; pe < lkup_exts->n_val_words; pe++) {
+                               for (qr = 0; qr < recp[i].lkup_exts.n_val_words;
+                                    qr++) {
+                                       if (ar[qr].off == be[pe].off &&
+                                           ar[qr].prot_id == be[pe].prot_id &&
+                                           cr[qr] == de[pe])
+                                               /* Found the "pe"th word in the
                                                 * given recipe
                                                 */
                                                break;
@@ -5031,7 +5555,7 @@ static u16 ice_find_recp(struct ice_hw *hw, struct ice_prot_lkup_ext *lkup_exts)
                                 * So break out from this loop and try the next
                                 * recipe
                                 */
-                               if (q >= recp[i].lkup_exts.n_val_words) {
+                               if (qr >= recp[i].lkup_exts.n_val_words) {
                                        found = false;
                                        break;
                                }
@@ -5039,7 +5563,8 @@ static u16 ice_find_recp(struct ice_hw *hw, struct ice_prot_lkup_ext *lkup_exts)
                        /* If for "i"th recipe the found was never set to false
                         * then it means we found our match
                         */
-                       if (found)
+                       if ((tun_type == recp[i].tun_type ||
+                            tun_type == ICE_SW_TUN_AND_NON_TUN) && found)
                                return i; /* Return the recipe ID */
                }
        }
@@ -5093,7 +5618,8 @@ ice_fill_valid_words(struct ice_adv_lkup_elem *rule,
                                ice_prot_ext[rule->type].offs[j];
                        lkup_exts->fv_words[word].prot_id =
                                ice_prot_id_tbl[rule->type].protocol_id;
-                       lkup_exts->field_mask[word] = ((u16 *)&rule->m_u)[j];
+                       lkup_exts->field_mask[word] =
+                               BE16_TO_CPU(((__be16 *)&rule->m_u)[j]);
                        word++;
                }
 
@@ -5209,11 +5735,7 @@ ice_fill_fv_word_index(struct ice_hw *hw, struct LIST_HEAD_TYPE *fv_list,
 
                                        /* Store index of field vector */
                                        rg->fv_idx[i] = j;
-                                       /* Mask is given by caller as big
-                                        * endian, but sent to FW as little
-                                        * endian
-                                        */
-                                       rg->fv_mask[i] = mask << 8 | mask >> 8;
+                                       rg->fv_mask[i] = mask;
                                        break;
                                }
 
@@ -5316,12 +5838,12 @@ ice_find_free_recp_res_idx(struct ice_hw *hw, const ice_bitmap_t *profiles,
  * ice_add_sw_recipe - function to call AQ calls to create switch recipe
  * @hw: pointer to hardware structure
  * @rm: recipe management list entry
- * @match_tun: if field vector index for tunnel needs to be programmed
- * @profiles: bitmap of profiles that will be assocated.
+ * @match_tun_mask: tunnel mask that needs to be programmed
+ * @profiles: bitmap of profiles that will be associated.
  */
 static enum ice_status
 ice_add_sw_recipe(struct ice_hw *hw, struct ice_sw_recipe *rm,
-                 bool match_tun, ice_bitmap_t *profiles)
+                 u16 match_tun_mask, ice_bitmap_t *profiles)
 {
        ice_declare_bitmap(result_idx_bm, ICE_MAX_FV_WORDS);
        struct ice_aqc_recipe_data_elem *tmp;
@@ -5539,10 +6061,10 @@ ice_add_sw_recipe(struct ice_hw *hw, struct ice_sw_recipe *rm,
                /* To differentiate among different UDP tunnels, a meta data ID
                 * flag is used.
                 */
-               if (match_tun) {
+               if (match_tun_mask) {
                        buf[recps].content.lkup_indx[i] = ICE_TUN_FLAG_FV_IND;
                        buf[recps].content.mask[i] =
-                               CPU_TO_LE16(ICE_TUN_FLAG_MASK);
+                               CPU_TO_LE16(match_tun_mask);
                }
 
                recps++;
@@ -5611,7 +6133,6 @@ ice_add_sw_recipe(struct ice_hw *hw, struct ice_sw_recipe *rm,
                recp->n_grp_count = rm->n_grp_count;
                recp->tun_type = rm->tun_type;
                recp->recp_created = true;
-               recp->adv_rule = 1;
        }
        rm->root_buf = buf;
        ice_free(hw, tmp);
@@ -5694,6 +6215,34 @@ free_mem:
        return status;
 }
 
+/**
+ * ice_tun_type_match_mask - determine if tun type needs a match mask
+ * @tun_type: tunnel type
+ * @mask: mask to be used for the tunnel
+ */
+static bool ice_tun_type_match_word(enum ice_sw_tunnel_type tun_type, u16 *mask)
+{
+       switch (tun_type) {
+       case ICE_SW_TUN_VXLAN_GPE:
+       case ICE_SW_TUN_GENEVE:
+       case ICE_SW_TUN_VXLAN:
+       case ICE_SW_TUN_NVGRE:
+       case ICE_SW_TUN_UDP:
+       case ICE_ALL_TUNNELS:
+               *mask = ICE_TUN_FLAG_MASK;
+               return true;
+
+       case ICE_SW_TUN_GENEVE_VLAN:
+       case ICE_SW_TUN_VXLAN_VLAN:
+               *mask = ICE_TUN_FLAG_MASK & ~ICE_TUN_FLAG_VLAN_MASK;
+               return true;
+
+       default:
+               *mask = 0;
+               return false;
+       }
+}
+
 /**
  * ice_add_special_words - Add words that are not protocols, such as metadata
  * @rinfo: other information regarding the rule e.g. priority and action info
@@ -5703,17 +6252,18 @@ static enum ice_status
 ice_add_special_words(struct ice_adv_rule_info *rinfo,
                      struct ice_prot_lkup_ext *lkup_exts)
 {
+       u16 mask;
+
        /* If this is a tunneled packet, then add recipe index to match the
         * tunnel bit in the packet metadata flags.
         */
-       if (rinfo->tun_type != ICE_NON_TUN) {
+       if (ice_tun_type_match_word(rinfo->tun_type, &mask)) {
                if (lkup_exts->n_val_words < ICE_MAX_CHAIN_WORDS) {
                        u8 word = lkup_exts->n_val_words++;
 
                        lkup_exts->fv_words[word].prot_id = ICE_META_DATA_ID_HW;
-                       lkup_exts->fv_words[word].off = ICE_TUN_FLAG_MDID *
-                               ICE_MDID_SIZE;
-                       lkup_exts->field_mask[word] = ICE_TUN_FLAG_MASK;
+                       lkup_exts->fv_words[word].off = ICE_TUN_FLAG_MDID_OFF;
+                       lkup_exts->field_mask[word] = mask;
                } else {
                        return ICE_ERR_MAX_LIMIT;
                }
@@ -5744,7 +6294,9 @@ ice_get_compat_fv_bitmap(struct ice_hw *hw, struct ice_adv_rule_info *rinfo,
                break;
        case ICE_SW_TUN_VXLAN_GPE:
        case ICE_SW_TUN_GENEVE:
+       case ICE_SW_TUN_GENEVE_VLAN:
        case ICE_SW_TUN_VXLAN:
+       case ICE_SW_TUN_VXLAN_VLAN:
        case ICE_SW_TUN_UDP:
        case ICE_SW_TUN_GTP:
                prof_type = ICE_PROF_TUN_UDP;
@@ -5755,16 +6307,45 @@ ice_get_compat_fv_bitmap(struct ice_hw *hw, struct ice_adv_rule_info *rinfo,
        case ICE_SW_TUN_PPPOE:
                prof_type = ICE_PROF_TUN_PPPOE;
                break;
+       case ICE_SW_TUN_PPPOE_PAY:
+               ice_set_bit(ICE_PROFID_PPPOE_PAY, bm);
+               return;
+       case ICE_SW_TUN_PPPOE_IPV4:
+               ice_set_bit(ICE_PROFID_PPPOE_IPV4_OTHER, bm);
+               ice_set_bit(ICE_PROFID_PPPOE_IPV4_UDP, bm);
+               ice_set_bit(ICE_PROFID_PPPOE_IPV4_TCP, bm);
+               return;
+       case ICE_SW_TUN_PPPOE_IPV4_TCP:
+               ice_set_bit(ICE_PROFID_PPPOE_IPV4_TCP, bm);
+               return;
+       case ICE_SW_TUN_PPPOE_IPV4_UDP:
+               ice_set_bit(ICE_PROFID_PPPOE_IPV4_UDP, bm);
+               return;
+       case ICE_SW_TUN_PPPOE_IPV6:
+               ice_set_bit(ICE_PROFID_PPPOE_IPV6_OTHER, bm);
+               ice_set_bit(ICE_PROFID_PPPOE_IPV6_UDP, bm);
+               ice_set_bit(ICE_PROFID_PPPOE_IPV6_TCP, bm);
+               return;
+       case ICE_SW_TUN_PPPOE_IPV6_TCP:
+               ice_set_bit(ICE_PROFID_PPPOE_IPV6_TCP, bm);
+               return;
+       case ICE_SW_TUN_PPPOE_IPV6_UDP:
+               ice_set_bit(ICE_PROFID_PPPOE_IPV6_UDP, bm);
+               return;
        case ICE_SW_TUN_PROFID_IPV6_ESP:
+       case ICE_SW_TUN_IPV6_ESP:
                ice_set_bit(ICE_PROFID_IPV6_ESP, bm);
                return;
        case ICE_SW_TUN_PROFID_IPV6_AH:
+       case ICE_SW_TUN_IPV6_AH:
                ice_set_bit(ICE_PROFID_IPV6_AH, bm);
                return;
        case ICE_SW_TUN_PROFID_MAC_IPV6_L2TPV3:
+       case ICE_SW_TUN_IPV6_L2TPV3:
                ice_set_bit(ICE_PROFID_MAC_IPV6_L2TPV3, bm);
                return;
        case ICE_SW_TUN_PROFID_IPV6_NAT_T:
+       case ICE_SW_TUN_IPV6_NAT_T:
                ice_set_bit(ICE_PROFID_IPV6_NAT_T, bm);
                return;
        case ICE_SW_TUN_PROFID_IPV4_PFCP_NODE:
@@ -5779,6 +6360,18 @@ ice_get_compat_fv_bitmap(struct ice_hw *hw, struct ice_adv_rule_info *rinfo,
        case ICE_SW_TUN_PROFID_IPV6_PFCP_SESSION:
                ice_set_bit(ICE_PROFID_IPV6_PFCP_SESSION, bm);
                return;
+       case ICE_SW_TUN_IPV4_NAT_T:
+               ice_set_bit(ICE_PROFID_IPV4_NAT_T, bm);
+               return;
+       case ICE_SW_TUN_IPV4_L2TPV3:
+               ice_set_bit(ICE_PROFID_MAC_IPV4_L2TPV3, bm);
+               return;
+       case ICE_SW_TUN_IPV4_ESP:
+               ice_set_bit(ICE_PROFID_IPV4_ESP, bm);
+               return;
+       case ICE_SW_TUN_IPV4_AH:
+               ice_set_bit(ICE_PROFID_IPV4_AH, bm);
+               return;
        case ICE_SW_TUN_AND_NON_TUN:
        default:
                prof_type = ICE_PROF_ALL;
@@ -5795,7 +6388,7 @@ ice_get_compat_fv_bitmap(struct ice_hw *hw, struct ice_adv_rule_info *rinfo,
  * if the rule type is a profile rule, that means that there no field value
  * match required, in this case just a profile hit is required.
  */
-static bool ice_is_prof_rule(enum ice_sw_tunnel_type type)
+bool ice_is_prof_rule(enum ice_sw_tunnel_type type)
 {
        switch (type) {
        case ICE_SW_TUN_PROFID_IPV6_ESP:
@@ -5836,7 +6429,8 @@ ice_add_adv_recipe(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
        struct ice_sw_fv_list_entry *tmp;
        enum ice_status status = ICE_SUCCESS;
        struct ice_sw_recipe *rm;
-       bool match_tun = false;
+       u16 match_tun_mask = 0;
+       u16 mask;
        u8 i;
 
        if (!ice_is_prof_rule(rinfo->tun_type) && !lkups_cnt)
@@ -5894,14 +6488,13 @@ ice_add_adv_recipe(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
        if (status)
                goto err_unroll;
 
-       /* There is only profile for UDP tunnels. So, it is necessary to use a
-        * metadata ID flag to differentiate different tunnel types. A separate
-        * recipe needs to be used for the metadata.
+       /* For certain tunnel types it is necessary to use a metadata ID flag to
+        * differentiate different tunnel types. A separate recipe needs to be
+        * used for the metadata.
         */
-       if ((rinfo->tun_type == ICE_SW_TUN_VXLAN_GPE ||
-            rinfo->tun_type == ICE_SW_TUN_GENEVE ||
-            rinfo->tun_type == ICE_SW_TUN_VXLAN) && rm->n_grp_count > 1)
-               match_tun = true;
+       if (ice_tun_type_match_word(rinfo->tun_type, &mask) &&
+           rm->n_grp_count > 1)
+               match_tun_mask = mask;
 
        /* set the recipe priority if specified */
        rm->priority = (u8)rinfo->priority;
@@ -5949,13 +6542,14 @@ ice_add_adv_recipe(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
                goto err_free_lkup_exts;
 
        /* Look for a recipe which matches our requested fv / mask list */
-       *rid = ice_find_recp(hw, lkup_exts);
+       *rid = ice_find_recp(hw, lkup_exts, rinfo->tun_type);
        if (*rid < ICE_MAX_NUM_RECIPES)
                /* Success if found a recipe that match the existing criteria */
                goto err_unroll;
 
+       rm->tun_type = rinfo->tun_type;
        /* Recipe we need does not exist, add a recipe */
-       status = ice_add_sw_recipe(hw, rm, match_tun, profiles);
+       status = ice_add_sw_recipe(hw, rm, match_tun_mask, profiles);
        if (status)
                goto err_unroll;
 
@@ -6074,24 +6668,124 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,
                        ipv6 = true;
        }
 
+       if (tun_type == ICE_SW_TUN_IPV4_ESP) {
+               *pkt = dummy_ipv4_esp_pkt;
+               *pkt_len = sizeof(dummy_ipv4_esp_pkt);
+               *offsets = dummy_ipv4_esp_packet_offsets;
+               return;
+       }
+
+       if (tun_type == ICE_SW_TUN_IPV6_ESP) {
+               *pkt = dummy_ipv6_esp_pkt;
+               *pkt_len = sizeof(dummy_ipv6_esp_pkt);
+               *offsets = dummy_ipv6_esp_packet_offsets;
+               return;
+       }
+
+       if (tun_type == ICE_SW_TUN_IPV4_AH) {
+               *pkt = dummy_ipv4_ah_pkt;
+               *pkt_len = sizeof(dummy_ipv4_ah_pkt);
+               *offsets = dummy_ipv4_ah_packet_offsets;
+               return;
+       }
+
+       if (tun_type == ICE_SW_TUN_IPV6_AH) {
+               *pkt = dummy_ipv6_ah_pkt;
+               *pkt_len = sizeof(dummy_ipv6_ah_pkt);
+               *offsets = dummy_ipv6_ah_packet_offsets;
+               return;
+       }
+
+       if (tun_type == ICE_SW_TUN_IPV4_NAT_T) {
+               *pkt = dummy_ipv4_nat_pkt;
+               *pkt_len = sizeof(dummy_ipv4_nat_pkt);
+               *offsets = dummy_ipv4_nat_packet_offsets;
+               return;
+       }
+
+       if (tun_type == ICE_SW_TUN_IPV6_NAT_T) {
+               *pkt = dummy_ipv6_nat_pkt;
+               *pkt_len = sizeof(dummy_ipv6_nat_pkt);
+               *offsets = dummy_ipv6_nat_packet_offsets;
+               return;
+       }
+
+       if (tun_type == ICE_SW_TUN_IPV4_L2TPV3) {
+               *pkt = dummy_ipv4_l2tpv3_pkt;
+               *pkt_len = sizeof(dummy_ipv4_l2tpv3_pkt);
+               *offsets = dummy_ipv4_l2tpv3_packet_offsets;
+               return;
+       }
+
+       if (tun_type == ICE_SW_TUN_IPV6_L2TPV3) {
+               *pkt = dummy_ipv6_l2tpv3_pkt;
+               *pkt_len = sizeof(dummy_ipv6_l2tpv3_pkt);
+               *offsets = dummy_ipv6_l2tpv3_packet_offsets;
+               return;
+       }
+
        if (tun_type == ICE_SW_TUN_GTP) {
                *pkt = dummy_udp_gtp_packet;
                *pkt_len = sizeof(dummy_udp_gtp_packet);
                *offsets = dummy_udp_gtp_packet_offsets;
                return;
        }
+
        if (tun_type == ICE_SW_TUN_PPPOE && ipv6) {
                *pkt = dummy_pppoe_ipv6_packet;
                *pkt_len = sizeof(dummy_pppoe_ipv6_packet);
                *offsets = dummy_pppoe_packet_offsets;
                return;
-       } else if (tun_type == ICE_SW_TUN_PPPOE) {
+       } else if (tun_type == ICE_SW_TUN_PPPOE ||
+               tun_type == ICE_SW_TUN_PPPOE_PAY) {
                *pkt = dummy_pppoe_ipv4_packet;
                *pkt_len = sizeof(dummy_pppoe_ipv4_packet);
                *offsets = dummy_pppoe_packet_offsets;
                return;
        }
 
+       if (tun_type == ICE_SW_TUN_PPPOE_IPV4) {
+               *pkt = dummy_pppoe_ipv4_packet;
+               *pkt_len = sizeof(dummy_pppoe_ipv4_packet);
+               *offsets = dummy_pppoe_packet_ipv4_offsets;
+               return;
+       }
+
+       if (tun_type == ICE_SW_TUN_PPPOE_IPV4_TCP) {
+               *pkt = dummy_pppoe_ipv4_tcp_packet;
+               *pkt_len = sizeof(dummy_pppoe_ipv4_tcp_packet);
+               *offsets = dummy_pppoe_ipv4_tcp_packet_offsets;
+               return;
+       }
+
+       if (tun_type == ICE_SW_TUN_PPPOE_IPV4_UDP) {
+               *pkt = dummy_pppoe_ipv4_udp_packet;
+               *pkt_len = sizeof(dummy_pppoe_ipv4_udp_packet);
+               *offsets = dummy_pppoe_ipv4_udp_packet_offsets;
+               return;
+       }
+
+       if (tun_type == ICE_SW_TUN_PPPOE_IPV6) {
+               *pkt = dummy_pppoe_ipv6_packet;
+               *pkt_len = sizeof(dummy_pppoe_ipv6_packet);
+               *offsets = dummy_pppoe_packet_ipv6_offsets;
+               return;
+       }
+
+       if (tun_type == ICE_SW_TUN_PPPOE_IPV6_TCP) {
+               *pkt = dummy_pppoe_ipv6_tcp_packet;
+               *pkt_len = sizeof(dummy_pppoe_ipv6_tcp_packet);
+               *offsets = dummy_pppoe_packet_ipv6_tcp_offsets;
+               return;
+       }
+
+       if (tun_type == ICE_SW_TUN_PPPOE_IPV6_UDP) {
+               *pkt = dummy_pppoe_ipv6_udp_packet;
+               *pkt_len = sizeof(dummy_pppoe_ipv6_udp_packet);
+               *offsets = dummy_pppoe_packet_ipv6_udp_offsets;
+               return;
+       }
+
        if (tun_type == ICE_ALL_TUNNELS) {
                *pkt = dummy_gre_udp_packet;
                *pkt_len = sizeof(dummy_gre_udp_packet);
@@ -6114,7 +6808,9 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,
        }
 
        if (tun_type == ICE_SW_TUN_VXLAN || tun_type == ICE_SW_TUN_GENEVE ||
-           tun_type == ICE_SW_TUN_VXLAN_GPE || tun_type == ICE_SW_TUN_UDP) {
+           tun_type == ICE_SW_TUN_VXLAN_GPE || tun_type == ICE_SW_TUN_UDP ||
+           tun_type == ICE_SW_TUN_GENEVE_VLAN ||
+           tun_type == ICE_SW_TUN_VXLAN_VLAN) {
                if (tcp) {
                        *pkt = dummy_udp_tun_tcp_packet;
                        *pkt_len = sizeof(dummy_udp_tun_tcp_packet);
@@ -6263,6 +6959,18 @@ ice_fill_adv_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,
                case ICE_PPPOE:
                        len = sizeof(struct ice_pppoe_hdr);
                        break;
+               case ICE_ESP:
+                       len = sizeof(struct ice_esp_hdr);
+                       break;
+               case ICE_NAT_T:
+                       len = sizeof(struct ice_nat_t_hdr);
+                       break;
+               case ICE_AH:
+                       len = sizeof(struct ice_ah_hdr);
+                       break;
+               case ICE_L2TPV3:
+                       len = sizeof(struct ice_l2tpv3_sess_hdr);
+                       break;
                default:
                        return ICE_ERR_PARAM;
                }
@@ -6309,12 +7017,14 @@ ice_fill_adv_packet_tun(struct ice_hw *hw, enum ice_sw_tunnel_type tun_type,
        case ICE_SW_TUN_AND_NON_TUN:
        case ICE_SW_TUN_VXLAN_GPE:
        case ICE_SW_TUN_VXLAN:
+       case ICE_SW_TUN_VXLAN_VLAN:
        case ICE_SW_TUN_UDP:
                if (!ice_get_open_tunnel_port(hw, TNL_VXLAN, &open_port))
                        return ICE_ERR_CFG;
                break;
 
        case ICE_SW_TUN_GENEVE:
+       case ICE_SW_TUN_GENEVE_VLAN:
                if (!ice_get_open_tunnel_port(hw, TNL_GENEVE, &open_port))
                        return ICE_ERR_CFG;
                break;
@@ -6445,6 +7155,7 @@ ice_adv_add_update_vsi_list(struct ice_hw *hw,
                        return status;
 
                ice_memset(&tmp_fltr, 0, sizeof(tmp_fltr), ICE_NONDMA_MEM);
+               tmp_fltr.flag = m_entry->rule_info.sw_act.flag;
                tmp_fltr.fltr_rule_id = cur_fltr->fltr_rule_id;
                tmp_fltr.fltr_act = ICE_FWD_TO_VSI_LIST;
                tmp_fltr.fwd_id.vsi_list_id = vsi_list_id;
@@ -6607,7 +7318,7 @@ ice_add_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
        s_rule = (struct ice_aqc_sw_rules_elem *)ice_malloc(hw, rule_buf_sz);
        if (!s_rule)
                return ICE_ERR_NO_MEMORY;
-       act |= ICE_SINGLE_ACT_LB_ENABLE | ICE_SINGLE_ACT_LAN_ENABLE;
+       act |= ICE_SINGLE_ACT_LAN_ENABLE;
        switch (rinfo->sw_act.fltr_act) {
        case ICE_FWD_TO_VSI:
                act |= (rinfo->sw_act.fwd_id.hw_vsi_id <<
@@ -6772,6 +7483,7 @@ ice_adv_rem_update_vsi_list(struct ice_hw *hw, u16 vsi_handle,
                        return status;
 
                ice_memset(&tmp_fltr, 0, sizeof(tmp_fltr), ICE_NONDMA_MEM);
+               tmp_fltr.flag = fm_list->rule_info.sw_act.flag;
                tmp_fltr.fltr_rule_id = fm_list->rule_info.fltr_rule_id;
                fm_list->rule_info.sw_act.fltr_act = ICE_FWD_TO_VSI;
                tmp_fltr.fltr_act = ICE_FWD_TO_VSI;
@@ -6779,6 +7491,7 @@ ice_adv_rem_update_vsi_list(struct ice_hw *hw, u16 vsi_handle,
                        ice_get_hw_vsi_num(hw, rem_vsi_handle);
                fm_list->rule_info.sw_act.fwd_id.hw_vsi_id =
                        ice_get_hw_vsi_num(hw, rem_vsi_handle);
+               fm_list->rule_info.sw_act.vsi_handle = rem_vsi_handle;
 
                /* Update the previous switch rule of "MAC forward to VSI" to
                 * "MAC fwd to VSI list"
@@ -6854,7 +7567,7 @@ ice_rem_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
        if (status)
                return status;
 
-       rid = ice_find_recp(hw, &lkup_exts);
+       rid = ice_find_recp(hw, &lkup_exts, rinfo->tun_type);
        /* If did not find a recipe that match the existing criteria */
        if (rid == ICE_MAX_NUM_RECIPES)
                return ICE_ERR_PARAM;
@@ -6900,12 +7613,16 @@ ice_rem_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
                status = ice_aq_sw_rules(hw, (struct ice_aqc_sw_rules *)s_rule,
                                         rule_buf_sz, 1,
                                         ice_aqc_opc_remove_sw_rules, NULL);
-               if (status == ICE_SUCCESS) {
+               if (status == ICE_SUCCESS || status == ICE_ERR_DOES_NOT_EXIST) {
+                       struct ice_switch_info *sw = hw->switch_info;
+
                        ice_acquire_lock(rule_lock);
                        LIST_DEL(&list_elem->list_entry);
                        ice_free(hw, list_elem->lkups);
                        ice_free(hw, list_elem);
                        ice_release_lock(rule_lock);
+                       if (LIST_EMPTY(&sw->recp_list[rid].filt_rules))
+                               sw->recp_list[rid].adv_rule = false;
                }
                ice_free(hw, s_rule);
        }
@@ -6944,7 +7661,8 @@ ice_rem_adv_rule_by_id(struct ice_hw *hw,
                                                list_itr->lkups_cnt, &rinfo);
                }
        }
-       return ICE_ERR_PARAM;
+       /* either list is empty or unable to find rule */
+       return ICE_ERR_DOES_NOT_EXIST;
 }
 
 /**
@@ -6957,8 +7675,7 @@ ice_rem_adv_rule_by_id(struct ice_hw *hw,
  * as removing a rule fails, it will return immediately with the error code,
  * else it will return ICE_SUCCESS
  */
-enum ice_status
-ice_rem_adv_rule_for_vsi(struct ice_hw *hw, u16 vsi_handle)
+enum ice_status ice_rem_adv_rule_for_vsi(struct ice_hw *hw, u16 vsi_handle)
 {
        struct ice_adv_fltr_mgmt_list_entry *list_itr;
        struct ice_vsi_list_map_info *map_info;
@@ -7095,6 +7812,8 @@ enum ice_status ice_replay_all_fltr(struct ice_hw *hw)
 /**
  * ice_replay_vsi_fltr - Replay filters for requested VSI
  * @hw: pointer to the hardware structure
+ * @pi: pointer to port information structure
+ * @sw: pointer to switch info struct for which function replays filters
  * @vsi_handle: driver VSI handle
  * @recp_id: Recipe ID for which rules need to be replayed
  * @list_head: list for which filters need to be replayed
@@ -7103,7 +7822,8 @@ enum ice_status ice_replay_all_fltr(struct ice_hw *hw)
  * It is required to pass valid VSI handle.
  */
 static enum ice_status
-ice_replay_vsi_fltr(struct ice_hw *hw, u16 vsi_handle, u8 recp_id,
+ice_replay_vsi_fltr(struct ice_hw *hw, struct ice_port_info *pi,
+                   struct ice_switch_info *sw, u16 vsi_handle, u8 recp_id,
                    struct LIST_HEAD_TYPE *list_head)
 {
        struct ice_fltr_mgmt_list_entry *itr;
@@ -7113,7 +7833,7 @@ ice_replay_vsi_fltr(struct ice_hw *hw, u16 vsi_handle, u8 recp_id,
 
        if (LIST_EMPTY(list_head))
                return status;
-       recp_list = &hw->switch_info->recp_list[recp_id];
+       recp_list = &sw->recp_list[recp_id];
        hw_vsi_id = ice_get_hw_vsi_num(hw, vsi_handle);
 
        LIST_FOR_EACH_ENTRY(itr, list_head, ice_fltr_mgmt_list_entry,
@@ -7127,7 +7847,7 @@ ice_replay_vsi_fltr(struct ice_hw *hw, u16 vsi_handle, u8 recp_id,
                        if (f_entry.fltr_info.src_id == ICE_SRC_ID_VSI)
                                f_entry.fltr_info.src = hw_vsi_id;
                        status = ice_add_rule_internal(hw, recp_list,
-                                                      hw->port_info->lport,
+                                                      pi->lport,
                                                       &f_entry);
                        if (status != ICE_SUCCESS)
                                goto end;
@@ -7147,7 +7867,7 @@ ice_replay_vsi_fltr(struct ice_hw *hw, u16 vsi_handle, u8 recp_id,
                        status = ice_add_vlan_internal(hw, recp_list, &f_entry);
                else
                        status = ice_add_rule_internal(hw, recp_list,
-                                                      hw->port_info->lport,
+                                                      pi->lport,
                                                       &f_entry);
                if (status != ICE_SUCCESS)
                        goto end;
@@ -7192,11 +7912,14 @@ ice_replay_vsi_adv_rule(struct ice_hw *hw, u16 vsi_handle,
 /**
  * ice_replay_vsi_all_fltr - replay all filters stored in bookkeeping lists
  * @hw: pointer to the hardware structure
+ * @pi: pointer to port information structure
  * @vsi_handle: driver VSI handle
  *
  * Replays filters for requested VSI via vsi_handle.
  */
-enum ice_status ice_replay_vsi_all_fltr(struct ice_hw *hw, u16 vsi_handle)
+enum ice_status
+ice_replay_vsi_all_fltr(struct ice_hw *hw, struct ice_port_info *pi,
+                       u16 vsi_handle)
 {
        struct ice_switch_info *sw = hw->switch_info;
        enum ice_status status;
@@ -7208,7 +7931,8 @@ enum ice_status ice_replay_vsi_all_fltr(struct ice_hw *hw, u16 vsi_handle)
 
                head = &sw->recp_list[i].filt_replay_rules;
                if (!sw->recp_list[i].adv_rule)
-                       status = ice_replay_vsi_fltr(hw, vsi_handle, i, head);
+                       status = ice_replay_vsi_fltr(hw, pi, sw, vsi_handle, i,
+                                                    head);
                else
                        status = ice_replay_vsi_adv_rule(hw, vsi_handle, head);
                if (status != ICE_SUCCESS)
@@ -7219,14 +7943,14 @@ enum ice_status ice_replay_vsi_all_fltr(struct ice_hw *hw, u16 vsi_handle)
 }
 
 /**
- * ice_rm_all_sw_replay_rule_info - deletes filter replay rules
+ * ice_rm_all_sw_replay_rule - helper function to delete filter replay rules
  * @hw: pointer to the HW struct
+ * @sw: pointer to switch info struct for which function removes filters
  *
- * Deletes the filter replay rules.
+ * Deletes the filter replay rules for given switch
  */
-void ice_rm_all_sw_replay_rule_info(struct ice_hw *hw)
+void ice_rm_sw_replay_rule_info(struct ice_hw *hw, struct ice_switch_info *sw)
 {
-       struct ice_switch_info *sw = hw->switch_info;
        u8 i;
 
        if (!sw)
@@ -7244,3 +7968,14 @@ void ice_rm_all_sw_replay_rule_info(struct ice_hw *hw)
                }
        }
 }
+
+/**
+ * ice_rm_all_sw_replay_rule_info - deletes filter replay rules
+ * @hw: pointer to the HW struct
+ *
+ * Deletes the filter replay rules.
+ */
+void ice_rm_all_sw_replay_rule_info(struct ice_hw *hw)
+{
+       ice_rm_sw_replay_rule_info(hw, hw->switch_info);
+}