net/ice: refactor input set fields for switch filter
authorYuying Zhang <yuying.zhang@intel.com>
Mon, 26 Apr 2021 05:38:14 +0000 (05:38 +0000)
committerQi Zhang <qi.z.zhang@intel.com>
Mon, 26 Apr 2021 08:01:48 +0000 (10:01 +0200)
Input set has been divided into inner and outer part to distinguish
different fields. However, the parse method of switch filter doesn't
match this update. Refactor switch filter to distinguish inner and outer
input set in the same way as other filters.

Signed-off-by: Yuying Zhang <yuying.zhang@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
drivers/net/ice/ice_switch_filter.c

index aa39509..4a64db5 100644 (file)
@@ -35,8 +35,7 @@
 #define ICE_SW_INSET_ETHER ( \
        ICE_INSET_DMAC | ICE_INSET_SMAC | ICE_INSET_ETHERTYPE)
 #define ICE_SW_INSET_MAC_VLAN ( \
-       ICE_INSET_DMAC | ICE_INSET_SMAC | ICE_INSET_ETHERTYPE | \
-       ICE_INSET_VLAN_INNER)
+       ICE_SW_INSET_ETHER | ICE_INSET_VLAN_INNER)
 #define ICE_SW_INSET_MAC_QINQ  ( \
        ICE_INSET_DMAC | ICE_INSET_SMAC | ICE_INSET_VLAN_INNER | \
        ICE_INSET_VLAN_OUTER)
        ICE_INSET_IPV6_HOP_LIMIT | ICE_INSET_IPV6_TC | \
        ICE_INSET_UDP_DST_PORT | ICE_INSET_UDP_SRC_PORT)
 #define ICE_SW_INSET_DIST_NVGRE_IPV4 ( \
-       ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST | \
-       ICE_INSET_DMAC | ICE_INSET_NVGRE_TNI | ICE_INSET_IPV4_DST)
+       ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST | ICE_INSET_DMAC | \
+       ICE_INSET_NVGRE_TNI)
 #define ICE_SW_INSET_DIST_VXLAN_IPV4 ( \
-       ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST | \
-       ICE_INSET_DMAC | ICE_INSET_VXLAN_VNI | ICE_INSET_IPV4_DST)
+       ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST | ICE_INSET_DMAC | \
+       ICE_INSET_VXLAN_VNI)
 #define ICE_SW_INSET_DIST_NVGRE_IPV4_TCP ( \
        ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST | \
        ICE_INSET_TCP_SRC_PORT | ICE_INSET_TCP_DST_PORT | \
-       ICE_INSET_DMAC | ICE_INSET_NVGRE_TNI | ICE_INSET_IPV4_DST)
+       ICE_INSET_DMAC | ICE_INSET_NVGRE_TNI)
 #define ICE_SW_INSET_DIST_NVGRE_IPV4_UDP ( \
        ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST | \
        ICE_INSET_UDP_SRC_PORT | ICE_INSET_UDP_DST_PORT | \
-       ICE_INSET_DMAC | ICE_INSET_NVGRE_TNI | ICE_INSET_IPV4_DST)
+       ICE_INSET_DMAC | ICE_INSET_NVGRE_TNI)
 #define ICE_SW_INSET_DIST_VXLAN_IPV4_TCP ( \
        ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST | \
        ICE_INSET_TCP_SRC_PORT | ICE_INSET_TCP_DST_PORT | \
-       ICE_INSET_DMAC | ICE_INSET_VXLAN_VNI | ICE_INSET_IPV4_DST)
+       ICE_INSET_DMAC | ICE_INSET_VXLAN_VNI)
 #define ICE_SW_INSET_DIST_VXLAN_IPV4_UDP ( \
        ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST | \
        ICE_INSET_UDP_SRC_PORT | ICE_INSET_UDP_DST_PORT | \
-       ICE_INSET_DMAC | ICE_INSET_VXLAN_VNI | ICE_INSET_IPV4_DST)
+       ICE_INSET_DMAC | ICE_INSET_VXLAN_VNI)
 #define ICE_SW_INSET_PERM_TUNNEL_IPV4 ( \
        ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST | \
        ICE_INSET_IPV4_PROTO | ICE_INSET_IPV4_TOS)
        ICE_SW_INSET_MAC_IPV4 | ICE_INSET_GTPU_TEID)
 #define ICE_SW_INSET_MAC_IPV6_GTPU ( \
        ICE_SW_INSET_MAC_IPV6 | ICE_INSET_GTPU_TEID)
-#define ICE_SW_INSET_MAC_IPV4_GTPU_IPV4 ( \
-       ICE_INSET_DMAC | ICE_INSET_GTPU_TEID | \
-       ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST)
-#define ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4 ( \
-       ICE_SW_INSET_MAC_IPV4_GTPU_IPV4 | ICE_INSET_GTPU_QFI)
-#define ICE_SW_INSET_MAC_IPV4_GTPU_IPV6 ( \
-       ICE_INSET_DMAC | ICE_INSET_GTPU_TEID | \
-       ICE_INSET_IPV6_SRC | ICE_INSET_IPV6_DST)
-#define ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6 ( \
-       ICE_SW_INSET_MAC_IPV4_GTPU_IPV6 | ICE_INSET_GTPU_QFI)
-#define ICE_SW_INSET_MAC_IPV6_GTPU_IPV4 ( \
-       ICE_INSET_DMAC | ICE_INSET_GTPU_TEID | \
+#define ICE_SW_INSET_MAC_GTPU_OUTER ( \
+       ICE_INSET_DMAC | ICE_INSET_GTPU_TEID)
+#define ICE_SW_INSET_MAC_GTPU_EH_OUTER ( \
+       ICE_SW_INSET_MAC_GTPU_OUTER | ICE_INSET_GTPU_QFI)
+#define ICE_SW_INSET_GTPU_IPV4 ( \
        ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST)
-#define ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4 ( \
-       ICE_SW_INSET_MAC_IPV6_GTPU_IPV4 | ICE_INSET_GTPU_QFI)
-#define ICE_SW_INSET_MAC_IPV6_GTPU_IPV6 ( \
-       ICE_INSET_DMAC | ICE_INSET_GTPU_TEID | \
+#define ICE_SW_INSET_GTPU_IPV6 ( \
        ICE_INSET_IPV6_SRC | ICE_INSET_IPV6_DST)
-#define ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6 ( \
-       ICE_SW_INSET_MAC_IPV6_GTPU_IPV6 | ICE_INSET_GTPU_QFI)
-#define ICE_SW_INSET_MAC_IPV4_GTPU_IPV4_UDP ( \
-       ICE_SW_INSET_MAC_IPV4_GTPU_IPV4 | \
-       ICE_INSET_UDP_SRC_PORT | ICE_INSET_UDP_DST_PORT)
-#define ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4_UDP ( \
-       ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4 | \
-       ICE_INSET_UDP_SRC_PORT | ICE_INSET_UDP_DST_PORT)
-#define ICE_SW_INSET_MAC_IPV4_GTPU_IPV4_TCP ( \
-       ICE_SW_INSET_MAC_IPV4_GTPU_IPV4 | \
-       ICE_INSET_TCP_SRC_PORT | ICE_INSET_TCP_DST_PORT)
-#define ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4_TCP ( \
-       ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4 | \
-       ICE_INSET_TCP_SRC_PORT | ICE_INSET_TCP_DST_PORT)
-#define ICE_SW_INSET_MAC_IPV4_GTPU_IPV6_UDP ( \
-       ICE_SW_INSET_MAC_IPV4_GTPU_IPV6 | \
-       ICE_INSET_UDP_SRC_PORT | ICE_INSET_UDP_DST_PORT)
-#define ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6_UDP ( \
-       ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6 | \
-       ICE_INSET_UDP_SRC_PORT | ICE_INSET_UDP_DST_PORT)
-#define ICE_SW_INSET_MAC_IPV4_GTPU_IPV6_TCP ( \
-       ICE_SW_INSET_MAC_IPV4_GTPU_IPV6 | \
-       ICE_INSET_TCP_SRC_PORT | ICE_INSET_TCP_DST_PORT)
-#define ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6_TCP ( \
-       ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6 | \
-       ICE_INSET_TCP_SRC_PORT | ICE_INSET_TCP_DST_PORT)
-#define ICE_SW_INSET_MAC_IPV6_GTPU_IPV4_UDP ( \
-       ICE_SW_INSET_MAC_IPV6_GTPU_IPV4 | \
-       ICE_INSET_UDP_SRC_PORT | ICE_INSET_UDP_DST_PORT)
-#define ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4_UDP ( \
-       ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4 | \
-       ICE_INSET_UDP_SRC_PORT | ICE_INSET_UDP_DST_PORT)
-#define ICE_SW_INSET_MAC_IPV6_GTPU_IPV4_TCP ( \
-       ICE_SW_INSET_MAC_IPV6_GTPU_IPV4 | \
-       ICE_INSET_TCP_SRC_PORT | ICE_INSET_TCP_DST_PORT)
-#define ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4_TCP ( \
-       ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4 | \
-       ICE_INSET_TCP_SRC_PORT | ICE_INSET_TCP_DST_PORT)
-#define ICE_SW_INSET_MAC_IPV6_GTPU_IPV6_UDP ( \
-       ICE_SW_INSET_MAC_IPV6_GTPU_IPV6 | \
-       ICE_INSET_UDP_SRC_PORT | ICE_INSET_UDP_DST_PORT)
-#define ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6_UDP ( \
-       ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6 | \
-       ICE_INSET_UDP_SRC_PORT | ICE_INSET_UDP_DST_PORT)
-#define ICE_SW_INSET_MAC_IPV6_GTPU_IPV6_TCP ( \
-       ICE_SW_INSET_MAC_IPV6_GTPU_IPV6 | \
-       ICE_INSET_TCP_SRC_PORT | ICE_INSET_TCP_DST_PORT)
-#define ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6_TCP ( \
-       ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6 | \
-       ICE_INSET_TCP_SRC_PORT | ICE_INSET_TCP_DST_PORT)
+#define ICE_SW_INSET_GTPU_IPV4_UDP ( \
+       ICE_SW_INSET_GTPU_IPV4 | ICE_INSET_UDP_SRC_PORT | \
+       ICE_INSET_UDP_DST_PORT)
+#define ICE_SW_INSET_GTPU_IPV4_TCP ( \
+       ICE_SW_INSET_GTPU_IPV4 | ICE_INSET_TCP_SRC_PORT | \
+       ICE_INSET_TCP_DST_PORT)
+#define ICE_SW_INSET_GTPU_IPV6_UDP ( \
+       ICE_SW_INSET_GTPU_IPV6 | ICE_INSET_UDP_SRC_PORT | \
+       ICE_INSET_UDP_DST_PORT)
+#define ICE_SW_INSET_GTPU_IPV6_TCP ( \
+       ICE_SW_INSET_GTPU_IPV6 | ICE_INSET_TCP_SRC_PORT | \
+       ICE_INSET_TCP_DST_PORT)
 
 struct sw_meta {
        struct ice_adv_lkup_elem *list;
@@ -221,160 +172,160 @@ static struct ice_flow_parser ice_switch_perm_parser;
 
 static struct
 ice_pattern_match_item ice_switch_pattern_dist_list[] = {
-       {pattern_ethertype,                             ICE_SW_INSET_ETHER,                     ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_ethertype_vlan,                        ICE_SW_INSET_MAC_VLAN,                  ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_ethertype_qinq,                        ICE_SW_INSET_MAC_QINQ,                  ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_arp,                               ICE_INSET_NONE,                         ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4,                              ICE_SW_INSET_MAC_IPV4,                  ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4_udp,                          ICE_SW_INSET_MAC_IPV4_UDP,              ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4_tcp,                          ICE_SW_INSET_MAC_IPV4_TCP,              ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv6,                              ICE_SW_INSET_MAC_IPV6,                  ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv6_udp,                          ICE_SW_INSET_MAC_IPV6_UDP,              ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv6_tcp,                          ICE_SW_INSET_MAC_IPV6_TCP,              ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4_udp_vxlan_eth_ipv4,           ICE_SW_INSET_DIST_VXLAN_IPV4,           ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4_udp_vxlan_eth_ipv4_udp,       ICE_SW_INSET_DIST_VXLAN_IPV4_UDP,       ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4_udp_vxlan_eth_ipv4_tcp,       ICE_SW_INSET_DIST_VXLAN_IPV4_TCP,       ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4_nvgre_eth_ipv4,               ICE_SW_INSET_DIST_NVGRE_IPV4,           ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4_nvgre_eth_ipv4_udp,           ICE_SW_INSET_DIST_NVGRE_IPV4_UDP,       ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4_nvgre_eth_ipv4_tcp,           ICE_SW_INSET_DIST_NVGRE_IPV4_TCP,       ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_pppoes,                            ICE_SW_INSET_MAC_PPPOE,                 ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_vlan_pppoes,                       ICE_SW_INSET_MAC_PPPOE,                 ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_pppoes_proto,                      ICE_SW_INSET_MAC_PPPOE_PROTO,           ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_vlan_pppoes_proto,                 ICE_SW_INSET_MAC_PPPOE_PROTO,           ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_pppoes_ipv4,                       ICE_SW_INSET_MAC_PPPOE_IPV4,            ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_pppoes_ipv4_tcp,                   ICE_SW_INSET_MAC_PPPOE_IPV4_TCP,        ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_pppoes_ipv4_udp,                   ICE_SW_INSET_MAC_PPPOE_IPV4_UDP,        ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_pppoes_ipv6,                       ICE_SW_INSET_MAC_PPPOE_IPV6,            ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_pppoes_ipv6_tcp,                   ICE_SW_INSET_MAC_PPPOE_IPV6_TCP,        ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_pppoes_ipv6_udp,                   ICE_SW_INSET_MAC_PPPOE_IPV6_UDP,        ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_vlan_pppoes_ipv4,                  ICE_SW_INSET_MAC_PPPOE_IPV4,            ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_vlan_pppoes_ipv4_tcp,              ICE_SW_INSET_MAC_PPPOE_IPV4_TCP,        ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_vlan_pppoes_ipv4_udp,              ICE_SW_INSET_MAC_PPPOE_IPV4_UDP,        ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_vlan_pppoes_ipv6,                  ICE_SW_INSET_MAC_PPPOE_IPV6,            ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_vlan_pppoes_ipv6_tcp,              ICE_SW_INSET_MAC_PPPOE_IPV6_TCP,        ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_vlan_pppoes_ipv6_udp,              ICE_SW_INSET_MAC_PPPOE_IPV6_UDP,        ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4_esp,                          ICE_SW_INSET_MAC_IPV4_ESP,              ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4_udp_esp,                      ICE_SW_INSET_MAC_IPV4_ESP,              ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv6_esp,                          ICE_SW_INSET_MAC_IPV6_ESP,              ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv6_udp_esp,                      ICE_SW_INSET_MAC_IPV6_ESP,              ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4_ah,                           ICE_SW_INSET_MAC_IPV4_AH,               ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv6_ah,                           ICE_SW_INSET_MAC_IPV6_AH,               ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv6_udp_ah,                       ICE_INSET_NONE,                         ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4_l2tp,                         ICE_SW_INSET_MAC_IPV4_L2TP,             ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv6_l2tp,                         ICE_SW_INSET_MAC_IPV6_L2TP,             ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4_pfcp,                         ICE_INSET_NONE,                         ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv6_pfcp,                         ICE_INSET_NONE,                         ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_qinq_ipv4,                         ICE_SW_INSET_MAC_QINQ_IPV4,             ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_qinq_ipv6,                         ICE_SW_INSET_MAC_QINQ_IPV6,             ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_qinq_pppoes,                       ICE_SW_INSET_MAC_PPPOE,                 ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_qinq_pppoes_proto,                 ICE_SW_INSET_MAC_PPPOE_PROTO,           ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_qinq_pppoes_ipv4,                  ICE_SW_INSET_MAC_PPPOE_IPV4,            ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_qinq_pppoes_ipv6,                  ICE_SW_INSET_MAC_PPPOE_IPV6,            ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4_gtpu,                         ICE_SW_INSET_MAC_IPV4_GTPU,             ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv6_gtpu,                         ICE_SW_INSET_MAC_IPV6_GTPU,             ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4_gtpu_ipv4,                    ICE_SW_INSET_MAC_IPV4_GTPU_IPV4,        ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4_gtpu_eh_ipv4,                 ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4,     ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4_gtpu_ipv4_udp,                ICE_SW_INSET_MAC_IPV4_GTPU_IPV4_UDP,    ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4_gtpu_eh_ipv4_udp,             ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4_UDP, ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4_gtpu_ipv4_tcp,                ICE_SW_INSET_MAC_IPV4_GTPU_IPV4_TCP,    ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4_gtpu_eh_ipv4_tcp,             ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4_TCP, ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4_gtpu_ipv6,                    ICE_SW_INSET_MAC_IPV4_GTPU_IPV6,        ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4_gtpu_eh_ipv6,                 ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6,     ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4_gtpu_ipv6_udp,                ICE_SW_INSET_MAC_IPV4_GTPU_IPV6_UDP,    ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4_gtpu_eh_ipv6_udp,             ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6_UDP, ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4_gtpu_ipv6_tcp,                ICE_SW_INSET_MAC_IPV4_GTPU_IPV6_TCP,    ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4_gtpu_eh_ipv6_tcp,             ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6_TCP, ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv6_gtpu_ipv4,                    ICE_SW_INSET_MAC_IPV6_GTPU_IPV4,        ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv6_gtpu_eh_ipv4,                 ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4,     ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv6_gtpu_ipv4_udp,                ICE_SW_INSET_MAC_IPV6_GTPU_IPV4_UDP,    ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv6_gtpu_eh_ipv4_udp,             ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4_UDP, ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv6_gtpu_ipv4_tcp,                ICE_SW_INSET_MAC_IPV6_GTPU_IPV4_TCP,    ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv6_gtpu_eh_ipv4_tcp,             ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4_TCP, ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv6_gtpu_ipv6,                    ICE_SW_INSET_MAC_IPV6_GTPU_IPV6,        ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv6_gtpu_eh_ipv6,                 ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6,     ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv6_gtpu_ipv6_udp,                ICE_SW_INSET_MAC_IPV6_GTPU_IPV6_UDP,    ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv6_gtpu_eh_ipv6_udp,             ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6_UDP, ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv6_gtpu_ipv6_tcp,                ICE_SW_INSET_MAC_IPV6_GTPU_IPV6_UDP,    ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv6_gtpu_eh_ipv6_tcp,             ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6_TCP, ICE_INSET_NONE, ICE_INSET_NONE},
+       {pattern_ethertype,                             ICE_SW_INSET_ETHER,                     ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_ethertype_vlan,                        ICE_SW_INSET_MAC_VLAN,                  ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_ethertype_qinq,                        ICE_SW_INSET_MAC_QINQ,                  ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_arp,                               ICE_INSET_NONE,                         ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_ipv4,                              ICE_SW_INSET_MAC_IPV4,                  ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_ipv4_udp,                          ICE_SW_INSET_MAC_IPV4_UDP,              ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_ipv4_tcp,                          ICE_SW_INSET_MAC_IPV4_TCP,              ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_ipv6,                              ICE_SW_INSET_MAC_IPV6,                  ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_ipv6_udp,                          ICE_SW_INSET_MAC_IPV6_UDP,              ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_ipv6_tcp,                          ICE_SW_INSET_MAC_IPV6_TCP,              ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_ipv4_udp_vxlan_eth_ipv4,           ICE_INSET_IPV4_DST,                     ICE_SW_INSET_DIST_VXLAN_IPV4,           ICE_INSET_NONE},
+       {pattern_eth_ipv4_udp_vxlan_eth_ipv4_udp,       ICE_INSET_IPV4_DST,                     ICE_SW_INSET_DIST_VXLAN_IPV4_UDP,       ICE_INSET_NONE},
+       {pattern_eth_ipv4_udp_vxlan_eth_ipv4_tcp,       ICE_INSET_IPV4_DST,                     ICE_SW_INSET_DIST_VXLAN_IPV4_TCP,       ICE_INSET_NONE},
+       {pattern_eth_ipv4_nvgre_eth_ipv4,               ICE_INSET_IPV4_DST,                     ICE_SW_INSET_DIST_NVGRE_IPV4,           ICE_INSET_NONE},
+       {pattern_eth_ipv4_nvgre_eth_ipv4_udp,           ICE_INSET_IPV4_DST,                     ICE_SW_INSET_DIST_NVGRE_IPV4_UDP,       ICE_INSET_NONE},
+       {pattern_eth_ipv4_nvgre_eth_ipv4_tcp,           ICE_INSET_IPV4_DST,                     ICE_SW_INSET_DIST_NVGRE_IPV4_TCP,       ICE_INSET_NONE},
+       {pattern_eth_pppoes,                            ICE_SW_INSET_MAC_PPPOE,                 ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_vlan_pppoes,                       ICE_SW_INSET_MAC_PPPOE,                 ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_pppoes_proto,                      ICE_SW_INSET_MAC_PPPOE_PROTO,           ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_vlan_pppoes_proto,                 ICE_SW_INSET_MAC_PPPOE_PROTO,           ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_pppoes_ipv4,                       ICE_SW_INSET_MAC_PPPOE_IPV4,            ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_pppoes_ipv4_tcp,                   ICE_SW_INSET_MAC_PPPOE_IPV4_TCP,        ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_pppoes_ipv4_udp,                   ICE_SW_INSET_MAC_PPPOE_IPV4_UDP,        ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_pppoes_ipv6,                       ICE_SW_INSET_MAC_PPPOE_IPV6,            ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_pppoes_ipv6_tcp,                   ICE_SW_INSET_MAC_PPPOE_IPV6_TCP,        ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_pppoes_ipv6_udp,                   ICE_SW_INSET_MAC_PPPOE_IPV6_UDP,        ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_vlan_pppoes_ipv4,                  ICE_SW_INSET_MAC_PPPOE_IPV4,            ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_vlan_pppoes_ipv4_tcp,              ICE_SW_INSET_MAC_PPPOE_IPV4_TCP,        ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_vlan_pppoes_ipv4_udp,              ICE_SW_INSET_MAC_PPPOE_IPV4_UDP,        ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_vlan_pppoes_ipv6,                  ICE_SW_INSET_MAC_PPPOE_IPV6,            ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_vlan_pppoes_ipv6_tcp,              ICE_SW_INSET_MAC_PPPOE_IPV6_TCP,        ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_vlan_pppoes_ipv6_udp,              ICE_SW_INSET_MAC_PPPOE_IPV6_UDP,        ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_ipv4_esp,                          ICE_SW_INSET_MAC_IPV4_ESP,              ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_ipv4_udp_esp,                      ICE_SW_INSET_MAC_IPV4_ESP,              ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_ipv6_esp,                          ICE_SW_INSET_MAC_IPV6_ESP,              ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_ipv6_udp_esp,                      ICE_SW_INSET_MAC_IPV6_ESP,              ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_ipv4_ah,                           ICE_SW_INSET_MAC_IPV4_AH,               ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_ipv6_ah,                           ICE_SW_INSET_MAC_IPV6_AH,               ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_ipv6_udp_ah,                       ICE_INSET_NONE,                         ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_ipv4_l2tp,                         ICE_SW_INSET_MAC_IPV4_L2TP,             ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_ipv6_l2tp,                         ICE_SW_INSET_MAC_IPV6_L2TP,             ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_ipv4_pfcp,                         ICE_INSET_NONE,                         ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_ipv6_pfcp,                         ICE_INSET_NONE,                         ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_qinq_ipv4,                         ICE_SW_INSET_MAC_QINQ_IPV4,             ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_qinq_ipv6,                         ICE_SW_INSET_MAC_QINQ_IPV6,             ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_qinq_pppoes,                       ICE_SW_INSET_MAC_PPPOE,                 ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_qinq_pppoes_proto,                 ICE_SW_INSET_MAC_PPPOE_PROTO,           ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_qinq_pppoes_ipv4,                  ICE_SW_INSET_MAC_PPPOE_IPV4,            ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_qinq_pppoes_ipv6,                  ICE_SW_INSET_MAC_PPPOE_IPV6,            ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_ipv4_gtpu,                         ICE_SW_INSET_MAC_IPV4_GTPU,             ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_ipv6_gtpu,                         ICE_SW_INSET_MAC_IPV6_GTPU,             ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_ipv4_gtpu_ipv4,                    ICE_SW_INSET_MAC_GTPU_OUTER,            ICE_SW_INSET_GTPU_IPV4,                 ICE_INSET_NONE},
+       {pattern_eth_ipv4_gtpu_eh_ipv4,                 ICE_SW_INSET_MAC_GTPU_EH_OUTER,         ICE_SW_INSET_GTPU_IPV4,                 ICE_INSET_NONE},
+       {pattern_eth_ipv4_gtpu_ipv4_udp,                ICE_SW_INSET_MAC_GTPU_OUTER,            ICE_SW_INSET_GTPU_IPV4_UDP,             ICE_INSET_NONE},
+       {pattern_eth_ipv4_gtpu_eh_ipv4_udp,             ICE_SW_INSET_MAC_GTPU_EH_OUTER,         ICE_SW_INSET_GTPU_IPV4_UDP,             ICE_INSET_NONE},
+       {pattern_eth_ipv4_gtpu_ipv4_tcp,                ICE_SW_INSET_MAC_GTPU_OUTER,            ICE_SW_INSET_GTPU_IPV4_TCP,             ICE_INSET_NONE},
+       {pattern_eth_ipv4_gtpu_eh_ipv4_tcp,             ICE_SW_INSET_MAC_GTPU_EH_OUTER,         ICE_SW_INSET_GTPU_IPV4_TCP,             ICE_INSET_NONE},
+       {pattern_eth_ipv4_gtpu_ipv6,                    ICE_SW_INSET_MAC_GTPU_OUTER,            ICE_SW_INSET_GTPU_IPV6,                 ICE_INSET_NONE},
+       {pattern_eth_ipv4_gtpu_eh_ipv6,                 ICE_SW_INSET_MAC_GTPU_EH_OUTER,         ICE_SW_INSET_GTPU_IPV6,                 ICE_INSET_NONE},
+       {pattern_eth_ipv4_gtpu_ipv6_udp,                ICE_SW_INSET_MAC_GTPU_OUTER,            ICE_SW_INSET_GTPU_IPV6_UDP,             ICE_INSET_NONE},
+       {pattern_eth_ipv4_gtpu_eh_ipv6_udp,             ICE_SW_INSET_MAC_GTPU_EH_OUTER,         ICE_SW_INSET_GTPU_IPV6_UDP,             ICE_INSET_NONE},
+       {pattern_eth_ipv4_gtpu_ipv6_tcp,                ICE_SW_INSET_MAC_GTPU_OUTER,            ICE_SW_INSET_GTPU_IPV6_TCP,             ICE_INSET_NONE},
+       {pattern_eth_ipv4_gtpu_eh_ipv6_tcp,             ICE_SW_INSET_MAC_GTPU_EH_OUTER,         ICE_SW_INSET_GTPU_IPV6_TCP,             ICE_INSET_NONE},
+       {pattern_eth_ipv6_gtpu_ipv4,                    ICE_SW_INSET_MAC_GTPU_OUTER,            ICE_SW_INSET_GTPU_IPV4,                 ICE_INSET_NONE},
+       {pattern_eth_ipv6_gtpu_eh_ipv4,                 ICE_SW_INSET_MAC_GTPU_EH_OUTER,         ICE_SW_INSET_GTPU_IPV4,                 ICE_INSET_NONE},
+       {pattern_eth_ipv6_gtpu_ipv4_udp,                ICE_SW_INSET_MAC_GTPU_OUTER,            ICE_SW_INSET_GTPU_IPV4_UDP,             ICE_INSET_NONE},
+       {pattern_eth_ipv6_gtpu_eh_ipv4_udp,             ICE_SW_INSET_MAC_GTPU_EH_OUTER,         ICE_SW_INSET_GTPU_IPV4_UDP,             ICE_INSET_NONE},
+       {pattern_eth_ipv6_gtpu_ipv4_tcp,                ICE_SW_INSET_MAC_GTPU_OUTER,            ICE_SW_INSET_GTPU_IPV4_TCP,             ICE_INSET_NONE},
+       {pattern_eth_ipv6_gtpu_eh_ipv4_tcp,             ICE_SW_INSET_MAC_GTPU_EH_OUTER,         ICE_SW_INSET_GTPU_IPV4_TCP,             ICE_INSET_NONE},
+       {pattern_eth_ipv6_gtpu_ipv6,                    ICE_SW_INSET_MAC_GTPU_OUTER,            ICE_SW_INSET_GTPU_IPV6,                 ICE_INSET_NONE},
+       {pattern_eth_ipv6_gtpu_eh_ipv6,                 ICE_SW_INSET_MAC_GTPU_EH_OUTER,         ICE_SW_INSET_GTPU_IPV6,                 ICE_INSET_NONE},
+       {pattern_eth_ipv6_gtpu_ipv6_udp,                ICE_SW_INSET_MAC_GTPU_OUTER,            ICE_SW_INSET_GTPU_IPV6_UDP,             ICE_INSET_NONE},
+       {pattern_eth_ipv6_gtpu_eh_ipv6_udp,             ICE_SW_INSET_MAC_GTPU_EH_OUTER,         ICE_SW_INSET_GTPU_IPV6_UDP,             ICE_INSET_NONE},
+       {pattern_eth_ipv6_gtpu_ipv6_tcp,                ICE_SW_INSET_MAC_GTPU_OUTER,            ICE_SW_INSET_GTPU_IPV6_TCP,             ICE_INSET_NONE},
+       {pattern_eth_ipv6_gtpu_eh_ipv6_tcp,             ICE_SW_INSET_MAC_GTPU_EH_OUTER,         ICE_SW_INSET_GTPU_IPV6_TCP,             ICE_INSET_NONE},
 };
 
 static struct
 ice_pattern_match_item ice_switch_pattern_perm_list[] = {
-       {pattern_ethertype,                             ICE_SW_INSET_ETHER,                     ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_ethertype_vlan,                        ICE_SW_INSET_MAC_VLAN,                  ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_ethertype_qinq,                        ICE_SW_INSET_MAC_QINQ,                  ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_arp,                               ICE_INSET_NONE,                         ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4,                              ICE_SW_INSET_MAC_IPV4,                  ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4_udp,                          ICE_SW_INSET_MAC_IPV4_UDP,              ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4_tcp,                          ICE_SW_INSET_MAC_IPV4_TCP,              ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv6,                              ICE_SW_INSET_MAC_IPV6,                  ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv6_udp,                          ICE_SW_INSET_MAC_IPV6_UDP,              ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv6_tcp,                          ICE_SW_INSET_MAC_IPV6_TCP,              ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4_udp_vxlan_eth_ipv4,           ICE_SW_INSET_PERM_TUNNEL_IPV4,          ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4_udp_vxlan_eth_ipv4_udp,       ICE_SW_INSET_PERM_TUNNEL_IPV4_UDP,      ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4_udp_vxlan_eth_ipv4_tcp,       ICE_SW_INSET_PERM_TUNNEL_IPV4_TCP,      ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4_nvgre_eth_ipv4,               ICE_SW_INSET_PERM_TUNNEL_IPV4,          ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4_nvgre_eth_ipv4_udp,           ICE_SW_INSET_PERM_TUNNEL_IPV4_UDP,      ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4_nvgre_eth_ipv4_tcp,           ICE_SW_INSET_PERM_TUNNEL_IPV4_TCP,      ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_pppoes,                            ICE_SW_INSET_MAC_PPPOE,                 ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_vlan_pppoes,                       ICE_SW_INSET_MAC_PPPOE,                 ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_pppoes_proto,                      ICE_SW_INSET_MAC_PPPOE_PROTO,           ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_vlan_pppoes_proto,                 ICE_SW_INSET_MAC_PPPOE_PROTO,           ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_pppoes_ipv4,                       ICE_SW_INSET_MAC_PPPOE_IPV4,            ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_pppoes_ipv4_tcp,                   ICE_SW_INSET_MAC_PPPOE_IPV4_TCP,        ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_pppoes_ipv4_udp,                   ICE_SW_INSET_MAC_PPPOE_IPV4_UDP,        ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_pppoes_ipv6,                       ICE_SW_INSET_MAC_PPPOE_IPV6,            ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_pppoes_ipv6_tcp,                   ICE_SW_INSET_MAC_PPPOE_IPV6_TCP,        ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_pppoes_ipv6_udp,                   ICE_SW_INSET_MAC_PPPOE_IPV6_UDP,        ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_vlan_pppoes_ipv4,                  ICE_SW_INSET_MAC_PPPOE_IPV4,            ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_vlan_pppoes_ipv4_tcp,              ICE_SW_INSET_MAC_PPPOE_IPV4_TCP,        ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_vlan_pppoes_ipv4_udp,              ICE_SW_INSET_MAC_PPPOE_IPV4_UDP,        ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_vlan_pppoes_ipv6,                  ICE_SW_INSET_MAC_PPPOE_IPV6,            ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_vlan_pppoes_ipv6_tcp,              ICE_SW_INSET_MAC_PPPOE_IPV6_TCP,        ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_vlan_pppoes_ipv6_udp,              ICE_SW_INSET_MAC_PPPOE_IPV6_UDP,        ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4_esp,                          ICE_SW_INSET_MAC_IPV4_ESP,              ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4_udp_esp,                      ICE_SW_INSET_MAC_IPV4_ESP,              ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv6_esp,                          ICE_SW_INSET_MAC_IPV6_ESP,              ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv6_udp_esp,                      ICE_SW_INSET_MAC_IPV6_ESP,              ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4_ah,                           ICE_SW_INSET_MAC_IPV4_AH,               ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv6_ah,                           ICE_SW_INSET_MAC_IPV6_AH,               ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv6_udp_ah,                       ICE_INSET_NONE,                         ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4_l2tp,                         ICE_SW_INSET_MAC_IPV4_L2TP,             ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv6_l2tp,                         ICE_SW_INSET_MAC_IPV6_L2TP,             ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4_pfcp,                         ICE_INSET_NONE,                         ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv6_pfcp,                         ICE_INSET_NONE,                         ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_qinq_ipv4,                         ICE_SW_INSET_MAC_QINQ_IPV4,             ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_qinq_ipv6,                         ICE_SW_INSET_MAC_QINQ_IPV6,             ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_qinq_pppoes,                       ICE_SW_INSET_MAC_PPPOE,                 ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_qinq_pppoes_proto,                 ICE_SW_INSET_MAC_PPPOE_PROTO,           ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_qinq_pppoes_ipv4,                  ICE_SW_INSET_MAC_PPPOE_IPV4,            ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_qinq_pppoes_ipv6,                  ICE_SW_INSET_MAC_PPPOE_IPV6,            ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4_gtpu,                         ICE_SW_INSET_MAC_IPV4_GTPU,             ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv6_gtpu,                         ICE_SW_INSET_MAC_IPV6_GTPU,             ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4_gtpu_ipv4,                    ICE_SW_INSET_MAC_IPV4_GTPU_IPV4,        ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4_gtpu_eh_ipv4,                 ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4,     ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4_gtpu_ipv4_udp,                ICE_SW_INSET_MAC_IPV4_GTPU_IPV4_UDP,    ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4_gtpu_eh_ipv4_udp,             ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4_UDP, ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4_gtpu_ipv4_tcp,                ICE_SW_INSET_MAC_IPV4_GTPU_IPV4_TCP,    ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4_gtpu_eh_ipv4_tcp,             ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4_TCP, ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4_gtpu_ipv6,                    ICE_SW_INSET_MAC_IPV4_GTPU_IPV6,        ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4_gtpu_eh_ipv6,                 ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6,     ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4_gtpu_ipv6_udp,                ICE_SW_INSET_MAC_IPV4_GTPU_IPV6_UDP,    ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4_gtpu_eh_ipv6_udp,             ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6_UDP, ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4_gtpu_ipv6_tcp,                ICE_SW_INSET_MAC_IPV4_GTPU_IPV6_TCP,    ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv4_gtpu_eh_ipv6_tcp,             ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6_TCP, ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv6_gtpu_ipv4,                    ICE_SW_INSET_MAC_IPV6_GTPU_IPV4,        ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv6_gtpu_eh_ipv4,                 ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4,     ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv6_gtpu_ipv4_udp,                ICE_SW_INSET_MAC_IPV6_GTPU_IPV4_UDP,    ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv6_gtpu_eh_ipv4_udp,             ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4_UDP, ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv6_gtpu_ipv4_tcp,                ICE_SW_INSET_MAC_IPV6_GTPU_IPV4_TCP,    ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv6_gtpu_eh_ipv4_tcp,             ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4_TCP, ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv6_gtpu_ipv6,                    ICE_SW_INSET_MAC_IPV6_GTPU_IPV6,        ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv6_gtpu_eh_ipv6,                 ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6,     ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv6_gtpu_ipv6_udp,                ICE_SW_INSET_MAC_IPV6_GTPU_IPV6_UDP,    ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv6_gtpu_eh_ipv6_udp,             ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6_UDP, ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv6_gtpu_ipv6_tcp,                ICE_SW_INSET_MAC_IPV6_GTPU_IPV6_UDP,    ICE_INSET_NONE, ICE_INSET_NONE},
-       {pattern_eth_ipv6_gtpu_eh_ipv6_tcp,             ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6_TCP, ICE_INSET_NONE, ICE_INSET_NONE},
+       {pattern_ethertype,                             ICE_SW_INSET_ETHER,                     ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_ethertype_vlan,                        ICE_SW_INSET_MAC_VLAN,                  ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_ethertype_qinq,                        ICE_SW_INSET_MAC_QINQ,                  ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_arp,                               ICE_INSET_NONE,                         ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_ipv4,                              ICE_SW_INSET_MAC_IPV4,                  ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_ipv4_udp,                          ICE_SW_INSET_MAC_IPV4_UDP,              ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_ipv4_tcp,                          ICE_SW_INSET_MAC_IPV4_TCP,              ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_ipv6,                              ICE_SW_INSET_MAC_IPV6,                  ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_ipv6_udp,                          ICE_SW_INSET_MAC_IPV6_UDP,              ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_ipv6_tcp,                          ICE_SW_INSET_MAC_IPV6_TCP,              ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_ipv4_udp_vxlan_eth_ipv4,           ICE_INSET_NONE,                         ICE_SW_INSET_PERM_TUNNEL_IPV4,          ICE_INSET_NONE},
+       {pattern_eth_ipv4_udp_vxlan_eth_ipv4_udp,       ICE_INSET_NONE,                         ICE_SW_INSET_PERM_TUNNEL_IPV4_UDP,      ICE_INSET_NONE},
+       {pattern_eth_ipv4_udp_vxlan_eth_ipv4_tcp,       ICE_INSET_NONE,                         ICE_SW_INSET_PERM_TUNNEL_IPV4_TCP,      ICE_INSET_NONE},
+       {pattern_eth_ipv4_nvgre_eth_ipv4,               ICE_INSET_NONE,                         ICE_SW_INSET_PERM_TUNNEL_IPV4,          ICE_INSET_NONE},
+       {pattern_eth_ipv4_nvgre_eth_ipv4_udp,           ICE_INSET_NONE,                         ICE_SW_INSET_PERM_TUNNEL_IPV4_UDP,      ICE_INSET_NONE},
+       {pattern_eth_ipv4_nvgre_eth_ipv4_tcp,           ICE_INSET_NONE,                         ICE_SW_INSET_PERM_TUNNEL_IPV4_TCP,      ICE_INSET_NONE},
+       {pattern_eth_pppoes,                            ICE_SW_INSET_MAC_PPPOE,                 ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_vlan_pppoes,                       ICE_SW_INSET_MAC_PPPOE,                 ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_pppoes_proto,                      ICE_SW_INSET_MAC_PPPOE_PROTO,           ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_vlan_pppoes_proto,                 ICE_SW_INSET_MAC_PPPOE_PROTO,           ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_pppoes_ipv4,                       ICE_SW_INSET_MAC_PPPOE_IPV4,            ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_pppoes_ipv4_tcp,                   ICE_SW_INSET_MAC_PPPOE_IPV4_TCP,        ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_pppoes_ipv4_udp,                   ICE_SW_INSET_MAC_PPPOE_IPV4_UDP,        ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_pppoes_ipv6,                       ICE_SW_INSET_MAC_PPPOE_IPV6,            ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_pppoes_ipv6_tcp,                   ICE_SW_INSET_MAC_PPPOE_IPV6_TCP,        ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_pppoes_ipv6_udp,                   ICE_SW_INSET_MAC_PPPOE_IPV6_UDP,        ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_vlan_pppoes_ipv4,                  ICE_SW_INSET_MAC_PPPOE_IPV4,            ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_vlan_pppoes_ipv4_tcp,              ICE_SW_INSET_MAC_PPPOE_IPV4_TCP,        ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_vlan_pppoes_ipv4_udp,              ICE_SW_INSET_MAC_PPPOE_IPV4_UDP,        ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_vlan_pppoes_ipv6,                  ICE_SW_INSET_MAC_PPPOE_IPV6,            ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_vlan_pppoes_ipv6_tcp,              ICE_SW_INSET_MAC_PPPOE_IPV6_TCP,        ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_vlan_pppoes_ipv6_udp,              ICE_SW_INSET_MAC_PPPOE_IPV6_UDP,        ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_ipv4_esp,                          ICE_SW_INSET_MAC_IPV4_ESP,              ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_ipv4_udp_esp,                      ICE_SW_INSET_MAC_IPV4_ESP,              ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_ipv6_esp,                          ICE_SW_INSET_MAC_IPV6_ESP,              ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_ipv6_udp_esp,                      ICE_SW_INSET_MAC_IPV6_ESP,              ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_ipv4_ah,                           ICE_SW_INSET_MAC_IPV4_AH,               ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_ipv6_ah,                           ICE_SW_INSET_MAC_IPV6_AH,               ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_ipv6_udp_ah,                       ICE_INSET_NONE,                         ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_ipv4_l2tp,                         ICE_SW_INSET_MAC_IPV4_L2TP,             ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_ipv6_l2tp,                         ICE_SW_INSET_MAC_IPV6_L2TP,             ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_ipv4_pfcp,                         ICE_INSET_NONE,                         ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_ipv6_pfcp,                         ICE_INSET_NONE,                         ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_qinq_ipv4,                         ICE_SW_INSET_MAC_QINQ_IPV4,             ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_qinq_ipv6,                         ICE_SW_INSET_MAC_QINQ_IPV6,             ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_qinq_pppoes,                       ICE_SW_INSET_MAC_PPPOE,                 ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_qinq_pppoes_proto,                 ICE_SW_INSET_MAC_PPPOE_PROTO,           ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_qinq_pppoes_ipv4,                  ICE_SW_INSET_MAC_PPPOE_IPV4,            ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_qinq_pppoes_ipv6,                  ICE_SW_INSET_MAC_PPPOE_IPV6,            ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_ipv4_gtpu,                         ICE_SW_INSET_MAC_IPV4_GTPU,             ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_ipv6_gtpu,                         ICE_SW_INSET_MAC_IPV6_GTPU,             ICE_INSET_NONE,                         ICE_INSET_NONE},
+       {pattern_eth_ipv4_gtpu_ipv4,                    ICE_SW_INSET_MAC_GTPU_OUTER,            ICE_SW_INSET_GTPU_IPV4,                 ICE_INSET_NONE},
+       {pattern_eth_ipv4_gtpu_eh_ipv4,                 ICE_SW_INSET_MAC_GTPU_EH_OUTER,         ICE_SW_INSET_GTPU_IPV4,                 ICE_INSET_NONE},
+       {pattern_eth_ipv4_gtpu_ipv4_udp,                ICE_SW_INSET_MAC_GTPU_OUTER,            ICE_SW_INSET_GTPU_IPV4_UDP,             ICE_INSET_NONE},
+       {pattern_eth_ipv4_gtpu_eh_ipv4_udp,             ICE_SW_INSET_MAC_GTPU_EH_OUTER,         ICE_SW_INSET_GTPU_IPV4_UDP,             ICE_INSET_NONE},
+       {pattern_eth_ipv4_gtpu_ipv4_tcp,                ICE_SW_INSET_MAC_GTPU_OUTER,            ICE_SW_INSET_GTPU_IPV4_TCP,             ICE_INSET_NONE},
+       {pattern_eth_ipv4_gtpu_eh_ipv4_tcp,             ICE_SW_INSET_MAC_GTPU_EH_OUTER,         ICE_SW_INSET_GTPU_IPV4_TCP,             ICE_INSET_NONE},
+       {pattern_eth_ipv4_gtpu_ipv6,                    ICE_SW_INSET_MAC_GTPU_OUTER,            ICE_SW_INSET_GTPU_IPV6,                 ICE_INSET_NONE},
+       {pattern_eth_ipv4_gtpu_eh_ipv6,                 ICE_SW_INSET_MAC_GTPU_EH_OUTER,         ICE_SW_INSET_GTPU_IPV6,                 ICE_INSET_NONE},
+       {pattern_eth_ipv4_gtpu_ipv6_udp,                ICE_SW_INSET_MAC_GTPU_OUTER,            ICE_SW_INSET_GTPU_IPV6_UDP,             ICE_INSET_NONE},
+       {pattern_eth_ipv4_gtpu_eh_ipv6_udp,             ICE_SW_INSET_MAC_GTPU_EH_OUTER,         ICE_SW_INSET_GTPU_IPV6_UDP,             ICE_INSET_NONE},
+       {pattern_eth_ipv4_gtpu_ipv6_tcp,                ICE_SW_INSET_MAC_GTPU_OUTER,            ICE_SW_INSET_GTPU_IPV6_TCP,             ICE_INSET_NONE},
+       {pattern_eth_ipv4_gtpu_eh_ipv6_tcp,             ICE_SW_INSET_MAC_GTPU_EH_OUTER,         ICE_SW_INSET_GTPU_IPV6_TCP,             ICE_INSET_NONE},
+       {pattern_eth_ipv6_gtpu_ipv4,                    ICE_SW_INSET_MAC_GTPU_OUTER,            ICE_SW_INSET_GTPU_IPV4,                 ICE_INSET_NONE},
+       {pattern_eth_ipv6_gtpu_eh_ipv4,                 ICE_SW_INSET_MAC_GTPU_EH_OUTER,         ICE_SW_INSET_GTPU_IPV4,                 ICE_INSET_NONE},
+       {pattern_eth_ipv6_gtpu_ipv4_udp,                ICE_SW_INSET_MAC_GTPU_OUTER,            ICE_SW_INSET_GTPU_IPV4_UDP,             ICE_INSET_NONE},
+       {pattern_eth_ipv6_gtpu_eh_ipv4_udp,             ICE_SW_INSET_MAC_GTPU_EH_OUTER,         ICE_SW_INSET_GTPU_IPV4_UDP,             ICE_INSET_NONE},
+       {pattern_eth_ipv6_gtpu_ipv4_tcp,                ICE_SW_INSET_MAC_GTPU_OUTER,            ICE_SW_INSET_GTPU_IPV4_TCP,             ICE_INSET_NONE},
+       {pattern_eth_ipv6_gtpu_eh_ipv4_tcp,             ICE_SW_INSET_MAC_GTPU_EH_OUTER,         ICE_SW_INSET_GTPU_IPV4_TCP,             ICE_INSET_NONE},
+       {pattern_eth_ipv6_gtpu_ipv6,                    ICE_SW_INSET_MAC_GTPU_OUTER,            ICE_SW_INSET_GTPU_IPV6,                 ICE_INSET_NONE},
+       {pattern_eth_ipv6_gtpu_eh_ipv6,                 ICE_SW_INSET_MAC_GTPU_EH_OUTER,         ICE_SW_INSET_GTPU_IPV6,                 ICE_INSET_NONE},
+       {pattern_eth_ipv6_gtpu_ipv6_udp,                ICE_SW_INSET_MAC_GTPU_OUTER,            ICE_SW_INSET_GTPU_IPV6_UDP,             ICE_INSET_NONE},
+       {pattern_eth_ipv6_gtpu_eh_ipv6_udp,             ICE_SW_INSET_MAC_GTPU_EH_OUTER,         ICE_SW_INSET_GTPU_IPV6_UDP,             ICE_INSET_NONE},
+       {pattern_eth_ipv6_gtpu_ipv6_tcp,                ICE_SW_INSET_MAC_GTPU_OUTER,            ICE_SW_INSET_GTPU_IPV6_TCP,             ICE_INSET_NONE},
+       {pattern_eth_ipv6_gtpu_eh_ipv6_tcp,             ICE_SW_INSET_MAC_GTPU_EH_OUTER,         ICE_SW_INSET_GTPU_IPV6_TCP,             ICE_INSET_NONE},
 };
 
 static int
@@ -477,12 +428,13 @@ ice_switch_filter_rule_free(struct rte_flow *flow)
        rte_free(flow->rule);
 }
 
-static uint64_t
-ice_switch_inset_get(const struct rte_flow_item pattern[],
+static bool
+ice_switch_parse_pattern(const struct rte_flow_item pattern[],
                struct rte_flow_error *error,
                struct ice_adv_lkup_elem *list,
                uint16_t *lkups_num,
-               enum ice_sw_tunnel_type *tun_type)
+               enum ice_sw_tunnel_type *tun_type,
+               const struct ice_pattern_match_item *pattern_match_item)
 {
        const struct rte_flow_item *item = pattern;
        enum rte_flow_item_type item_type;
@@ -504,7 +456,9 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
        const struct rte_flow_item_pfcp *pfcp_spec, *pfcp_mask;
        const struct rte_flow_item_gtp *gtp_spec, *gtp_mask;
        const struct rte_flow_item_gtp_psc *gtp_psc_spec, *gtp_psc_mask;
-       uint64_t input_set = ICE_INSET_NONE;
+       uint64_t outer_input_set = ICE_INSET_NONE;
+       uint64_t inner_input_set = ICE_INSET_NONE;
+       uint64_t *input = NULL;
        uint16_t input_set_byte = 0;
        bool pppoe_elem_valid = 0;
        bool pppoe_patt_valid = 0;
@@ -539,7 +493,7 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
                                        RTE_FLOW_ERROR_TYPE_ITEM,
                                        item,
                                        "Not support range");
-                       return 0;
+                       return false;
                }
                item_type = item->type;
 
@@ -550,30 +504,24 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
                        if (eth_spec && eth_mask) {
                                const uint8_t *a = eth_mask->src.addr_bytes;
                                const uint8_t *b = eth_mask->dst.addr_bytes;
+                               if (tunnel_valid)
+                                       input = &inner_input_set;
+                               else
+                                       input = &outer_input_set;
                                for (j = 0; j < RTE_ETHER_ADDR_LEN; j++) {
-                                       if (a[j] && tunnel_valid) {
-                                               input_set |=
-                                                       ICE_INSET_SMAC;
-                                               break;
-                                       } else if (a[j]) {
-                                               input_set |=
-                                                       ICE_INSET_SMAC;
+                                       if (a[j]) {
+                                               *input |= ICE_INSET_SMAC;
                                                break;
                                        }
                                }
                                for (j = 0; j < RTE_ETHER_ADDR_LEN; j++) {
-                                       if (b[j] && tunnel_valid) {
-                                               input_set |=
-                                                       ICE_INSET_DMAC;
-                                               break;
-                                       } else if (b[j]) {
-                                               input_set |=
-                                                       ICE_INSET_DMAC;
+                                       if (b[j]) {
+                                               *input |= ICE_INSET_DMAC;
                                                break;
                                        }
                                }
                                if (eth_mask->type)
-                                       input_set |= ICE_INSET_ETHERTYPE;
+                                       *input |= ICE_INSET_ETHERTYPE;
                                list[t].type = (tunnel_valid  == 0) ?
                                        ICE_MAC_OFOS : ICE_MAC_IL;
                                struct ice_ether_hdr *h;
@@ -616,10 +564,13 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
                case RTE_FLOW_ITEM_TYPE_IPV4:
                        ipv4_spec = item->spec;
                        ipv4_mask = item->mask;
-                       if (tunnel_valid)
+                       if (tunnel_valid) {
                                inner_ipv4_valid = 1;
-                       else
+                               input = &inner_input_set;
+                       } else {
                                ipv4_valid = 1;
+                               input = &outer_input_set;
+                       }
 
                        if (ipv4_spec && ipv4_mask) {
                                /* Check IPv4 mask and update input set */
@@ -631,39 +582,20 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
                                                   RTE_FLOW_ERROR_TYPE_ITEM,
                                                   item,
                                                   "Invalid IPv4 mask.");
-                                       return 0;
+                                       return false;
                                }
 
-                               if (tunnel_valid) {
-                                       if (ipv4_mask->hdr.type_of_service)
-                                               input_set |=
-                                                       ICE_INSET_IPV4_TOS;
-                                       if (ipv4_mask->hdr.src_addr)
-                                               input_set |=
-                                                       ICE_INSET_IPV4_SRC;
-                                       if (ipv4_mask->hdr.dst_addr)
-                                               input_set |=
-                                                       ICE_INSET_IPV4_DST;
-                                       if (ipv4_mask->hdr.time_to_live)
-                                               input_set |=
-                                                       ICE_INSET_IPV4_TTL;
-                                       if (ipv4_mask->hdr.next_proto_id)
-                                               input_set |=
-                                               ICE_INSET_IPV4_PROTO;
-                               } else {
-                                       if (ipv4_mask->hdr.src_addr)
-                                               input_set |= ICE_INSET_IPV4_SRC;
-                                       if (ipv4_mask->hdr.dst_addr)
-                                               input_set |= ICE_INSET_IPV4_DST;
-                                       if (ipv4_mask->hdr.time_to_live)
-                                               input_set |= ICE_INSET_IPV4_TTL;
-                                       if (ipv4_mask->hdr.next_proto_id)
-                                               input_set |=
-                                               ICE_INSET_IPV4_PROTO;
-                                       if (ipv4_mask->hdr.type_of_service)
-                                               input_set |=
-                                                       ICE_INSET_IPV4_TOS;
-                               }
+                               if (ipv4_mask->hdr.src_addr)
+                                       *input |= ICE_INSET_IPV4_SRC;
+                               if (ipv4_mask->hdr.dst_addr)
+                                       *input |= ICE_INSET_IPV4_DST;
+                               if (ipv4_mask->hdr.time_to_live)
+                                       *input |= ICE_INSET_IPV4_TTL;
+                               if (ipv4_mask->hdr.next_proto_id)
+                                       *input |= ICE_INSET_IPV4_PROTO;
+                               if (ipv4_mask->hdr.type_of_service)
+                                       *input |= ICE_INSET_IPV4_TOS;
+
                                list[t].type = (tunnel_valid  == 0) ?
                                        ICE_IPV4_OFOS : ICE_IPV4_IL;
                                if (ipv4_mask->hdr.src_addr) {
@@ -712,65 +644,42 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
                case RTE_FLOW_ITEM_TYPE_IPV6:
                        ipv6_spec = item->spec;
                        ipv6_mask = item->mask;
-                       if (tunnel_valid)
+                       if (tunnel_valid) {
                                inner_ipv6_valid = 1;
-                       else
+                               input = &inner_input_set;
+                       } else {
                                ipv6_valid = 1;
+                               input = &outer_input_set;
+                       }
+
                        if (ipv6_spec && ipv6_mask) {
                                if (ipv6_mask->hdr.payload_len) {
                                        rte_flow_error_set(error, EINVAL,
                                           RTE_FLOW_ERROR_TYPE_ITEM,
                                           item,
                                           "Invalid IPv6 mask");
-                                       return 0;
+                                       return false;
                                }
 
                                for (j = 0; j < ICE_IPV6_ADDR_LENGTH; j++) {
-                                       if (ipv6_mask->hdr.src_addr[j] &&
-                                               tunnel_valid) {
-                                               input_set |=
-                                               ICE_INSET_IPV6_SRC;
-                                               break;
-                                       } else if (ipv6_mask->hdr.src_addr[j]) {
-                                               input_set |= ICE_INSET_IPV6_SRC;
+                                       if (ipv6_mask->hdr.src_addr[j]) {
+                                               *input |= ICE_INSET_IPV6_SRC;
                                                break;
                                        }
                                }
                                for (j = 0; j < ICE_IPV6_ADDR_LENGTH; j++) {
-                                       if (ipv6_mask->hdr.dst_addr[j] &&
-                                               tunnel_valid) {
-                                               input_set |=
-                                               ICE_INSET_IPV6_DST;
-                                               break;
-                                       } else if (ipv6_mask->hdr.dst_addr[j]) {
-                                               input_set |= ICE_INSET_IPV6_DST;
+                                       if (ipv6_mask->hdr.dst_addr[j]) {
+                                               *input |= ICE_INSET_IPV6_DST;
                                                break;
                                        }
                                }
-                               if (ipv6_mask->hdr.proto &&
-                                       tunnel_valid)
-                                       input_set |=
-                                               ICE_INSET_IPV6_NEXT_HDR;
-                               else if (ipv6_mask->hdr.proto)
-                                       input_set |=
-                                               ICE_INSET_IPV6_NEXT_HDR;
-                               if (ipv6_mask->hdr.hop_limits &&
-                                       tunnel_valid)
-                                       input_set |=
-                                               ICE_INSET_IPV6_HOP_LIMIT;
-                               else if (ipv6_mask->hdr.hop_limits)
-                                       input_set |=
-                                               ICE_INSET_IPV6_HOP_LIMIT;
-                               if ((ipv6_mask->hdr.vtc_flow &
-                                               rte_cpu_to_be_32
-                                               (RTE_IPV6_HDR_TC_MASK)) &&
-                                       tunnel_valid)
-                                       input_set |=
-                                                       ICE_INSET_IPV6_TC;
-                               else if (ipv6_mask->hdr.vtc_flow &
-                                               rte_cpu_to_be_32
-                                               (RTE_IPV6_HDR_TC_MASK))
-                                       input_set |= ICE_INSET_IPV6_TC;
+                               if (ipv6_mask->hdr.proto)
+                                       *input |= ICE_INSET_IPV6_NEXT_HDR;
+                               if (ipv6_mask->hdr.hop_limits)
+                                       *input |= ICE_INSET_IPV6_HOP_LIMIT;
+                               if (ipv6_mask->hdr.vtc_flow &
+                                   rte_cpu_to_be_32(RTE_IPV6_HDR_TC_MASK))
+                                       *input |= ICE_INSET_IPV6_TC;
 
                                list[t].type = (tunnel_valid  == 0) ?
                                        ICE_IPV6_OFOS : ICE_IPV6_IL;
@@ -833,10 +742,14 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
                case RTE_FLOW_ITEM_TYPE_UDP:
                        udp_spec = item->spec;
                        udp_mask = item->mask;
-                       if (tunnel_valid)
+                       if (tunnel_valid) {
                                inner_udp_valid = 1;
-                       else
+                               input = &inner_input_set;
+                       } else {
                                udp_valid = 1;
+                               input = &outer_input_set;
+                       }
+
                        if (udp_spec && udp_mask) {
                                /* Check UDP mask and update input set*/
                                if (udp_mask->hdr.dgram_len ||
@@ -845,24 +758,14 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
                                                   RTE_FLOW_ERROR_TYPE_ITEM,
                                                   item,
                                                   "Invalid UDP mask");
-                                       return 0;
+                                       return false;
                                }
 
-                               if (tunnel_valid) {
-                                       if (udp_mask->hdr.src_port)
-                                               input_set |=
-                                               ICE_INSET_UDP_SRC_PORT;
-                                       if (udp_mask->hdr.dst_port)
-                                               input_set |=
-                                               ICE_INSET_UDP_DST_PORT;
-                               } else {
-                                       if (udp_mask->hdr.src_port)
-                                               input_set |=
-                                               ICE_INSET_UDP_SRC_PORT;
-                                       if (udp_mask->hdr.dst_port)
-                                               input_set |=
-                                               ICE_INSET_UDP_DST_PORT;
-                               }
+                               if (udp_mask->hdr.src_port)
+                                       *input |= ICE_INSET_UDP_SRC_PORT;
+                               if (udp_mask->hdr.dst_port)
+                                       *input |= ICE_INSET_UDP_DST_PORT;
+
                                if (*tun_type == ICE_SW_TUN_VXLAN &&
                                                tunnel_valid == 0)
                                        list[t].type = ICE_UDP_OF;
@@ -889,10 +792,14 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
                case RTE_FLOW_ITEM_TYPE_TCP:
                        tcp_spec = item->spec;
                        tcp_mask = item->mask;
-                       if (tunnel_valid)
+                       if (tunnel_valid) {
                                inner_tcp_valid = 1;
-                       else
+                               input = &inner_input_set;
+                       } else {
                                tcp_valid = 1;
+                               input = &outer_input_set;
+                       }
+
                        if (tcp_spec && tcp_mask) {
                                /* Check TCP mask and update input set */
                                if (tcp_mask->hdr.sent_seq ||
@@ -906,24 +813,13 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
                                           RTE_FLOW_ERROR_TYPE_ITEM,
                                           item,
                                           "Invalid TCP mask");
-                                       return 0;
+                                       return false;
                                }
 
-                               if (tunnel_valid) {
-                                       if (tcp_mask->hdr.src_port)
-                                               input_set |=
-                                               ICE_INSET_TCP_SRC_PORT;
-                                       if (tcp_mask->hdr.dst_port)
-                                               input_set |=
-                                               ICE_INSET_TCP_DST_PORT;
-                               } else {
-                                       if (tcp_mask->hdr.src_port)
-                                               input_set |=
-                                               ICE_INSET_TCP_SRC_PORT;
-                                       if (tcp_mask->hdr.dst_port)
-                                               input_set |=
-                                               ICE_INSET_TCP_DST_PORT;
-                               }
+                               if (tcp_mask->hdr.src_port)
+                                       *input |= ICE_INSET_TCP_SRC_PORT;
+                               if (tcp_mask->hdr.dst_port)
+                                       *input |= ICE_INSET_TCP_DST_PORT;
                                list[t].type = ICE_TCP_IL;
                                if (tcp_mask->hdr.src_port) {
                                        list[t].h_u.l4_hdr.src_port =
@@ -953,24 +849,18 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
                                           RTE_FLOW_ERROR_TYPE_ITEM,
                                           item,
                                           "Invalid SCTP mask");
-                                       return 0;
+                                       return false;
                                }
+                               if (tunnel_valid)
+                                       input = &inner_input_set;
+                               else
+                                       input = &outer_input_set;
+
+                               if (sctp_mask->hdr.src_port)
+                                       *input |= ICE_INSET_SCTP_SRC_PORT;
+                               if (sctp_mask->hdr.dst_port)
+                                       *input |= ICE_INSET_SCTP_DST_PORT;
 
-                               if (tunnel_valid) {
-                                       if (sctp_mask->hdr.src_port)
-                                               input_set |=
-                                               ICE_INSET_SCTP_SRC_PORT;
-                                       if (sctp_mask->hdr.dst_port)
-                                               input_set |=
-                                               ICE_INSET_SCTP_DST_PORT;
-                               } else {
-                                       if (sctp_mask->hdr.src_port)
-                                               input_set |=
-                                               ICE_INSET_SCTP_SRC_PORT;
-                                       if (sctp_mask->hdr.dst_port)
-                                               input_set |=
-                                               ICE_INSET_SCTP_DST_PORT;
-                               }
                                list[t].type = ICE_SCTP_IL;
                                if (sctp_mask->hdr.src_port) {
                                        list[t].h_u.sctp_hdr.src_port =
@@ -1003,10 +893,11 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
                                           RTE_FLOW_ERROR_TYPE_ITEM,
                                           item,
                                           "Invalid VXLAN item");
-                               return 0;
+                               return false;
                        }
                        vxlan_valid = 1;
                        tunnel_valid = 1;
+                       input = &inner_input_set;
                        if (vxlan_spec && vxlan_mask) {
                                list[t].type = ICE_VXLAN;
                                if (vxlan_mask->vni[0] ||
@@ -1020,8 +911,7 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
                                                (vxlan_mask->vni[2] << 16) |
                                                (vxlan_mask->vni[1] << 8) |
                                                vxlan_mask->vni[0];
-                                       input_set |=
-                                               ICE_INSET_VXLAN_VNI;
+                                       *input |= ICE_INSET_VXLAN_VNI;
                                        input_set_byte += 2;
                                }
                                t++;
@@ -1041,10 +931,11 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
                                           RTE_FLOW_ERROR_TYPE_ITEM,
                                           item,
                                           "Invalid NVGRE item");
-                               return 0;
+                               return false;
                        }
                        nvgre_valid = 1;
                        tunnel_valid = 1;
+                       input = &inner_input_set;
                        if (nvgre_spec && nvgre_mask) {
                                list[t].type = ICE_NVGRE;
                                if (nvgre_mask->tni[0] ||
@@ -1058,8 +949,7 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
                                                (nvgre_mask->tni[2] << 16) |
                                                (nvgre_mask->tni[1] << 8) |
                                                nvgre_mask->tni[0];
-                                       input_set |=
-                                               ICE_INSET_NVGRE_TNI;
+                                       *input |= ICE_INSET_NVGRE_TNI;
                                        input_set_byte += 2;
                                }
                                t++;
@@ -1079,7 +969,7 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
                                           RTE_FLOW_ERROR_TYPE_ITEM,
                                           item,
                                           "Invalid VLAN item");
-                               return 0;
+                               return false;
                        }
 
                        if (qinq_valid) {
@@ -1089,20 +979,22 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
                                        inner_vlan_valid = 1;
                        }
 
+                       input = &outer_input_set;
+
                        if (vlan_spec && vlan_mask) {
                                if (qinq_valid) {
                                        if (!inner_vlan_valid) {
                                                list[t].type = ICE_VLAN_EX;
-                                               input_set |=
+                                               *input |=
                                                        ICE_INSET_VLAN_OUTER;
                                        } else {
                                                list[t].type = ICE_VLAN_IN;
-                                               input_set |=
+                                               *input |=
                                                        ICE_INSET_VLAN_INNER;
                                        }
                                } else {
                                        list[t].type = ICE_VLAN_OFOS;
-                                       input_set |= ICE_INSET_VLAN_INNER;
+                                       *input |= ICE_INSET_VLAN_INNER;
                                }
 
                                if (vlan_mask->tci) {
@@ -1117,7 +1009,7 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
                                                RTE_FLOW_ERROR_TYPE_ITEM,
                                                item,
                                                "Invalid VLAN input set.");
-                                       return 0;
+                                       return false;
                                }
                                t++;
                        }
@@ -1137,9 +1029,10 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
                                        RTE_FLOW_ERROR_TYPE_ITEM,
                                        item,
                                        "Invalid pppoe item");
-                               return 0;
+                               return false;
                        }
                        pppoe_patt_valid = 1;
+                       input = &outer_input_set;
                        if (pppoe_spec && pppoe_mask) {
                                /* Check pppoe mask and update input set */
                                if (pppoe_mask->length ||
@@ -1149,7 +1042,7 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
                                                RTE_FLOW_ERROR_TYPE_ITEM,
                                                item,
                                                "Invalid pppoe mask");
-                                       return 0;
+                                       return false;
                                }
                                list[t].type = ICE_PPPOE;
                                if (pppoe_mask->session_id) {
@@ -1157,7 +1050,7 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
                                                pppoe_spec->session_id;
                                        list[t].m_u.pppoe_hdr.session_id =
                                                pppoe_mask->session_id;
-                                       input_set |= ICE_INSET_PPPOE_SESSION;
+                                       *input |= ICE_INSET_PPPOE_SESSION;
                                        input_set_byte += 2;
                                }
                                t++;
@@ -1179,8 +1072,9 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
                                        RTE_FLOW_ERROR_TYPE_ITEM,
                                        item,
                                        "Invalid pppoe proto item");
-                               return 0;
+                               return false;
                        }
+                       input = &outer_input_set;
                        if (pppoe_proto_spec && pppoe_proto_mask) {
                                if (pppoe_elem_valid)
                                        t--;
@@ -1190,7 +1084,7 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
                                                pppoe_proto_spec->proto_id;
                                        list[t].m_u.pppoe_hdr.ppp_prot_id =
                                                pppoe_proto_mask->proto_id;
-                                       input_set |= ICE_INSET_PPPOE_PROTO;
+                                       *input |= ICE_INSET_PPPOE_PROTO;
                                        input_set_byte += 2;
                                        pppoe_prot_valid = 1;
                                }
@@ -1217,7 +1111,7 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
                                           RTE_FLOW_ERROR_TYPE_ITEM,
                                           item,
                                           "Invalid esp item");
-                               return 0;
+                               return false;
                        }
                        /* Check esp mask and update input set */
                        if (esp_mask && esp_mask->hdr.seq) {
@@ -1225,10 +1119,10 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
                                                RTE_FLOW_ERROR_TYPE_ITEM,
                                                item,
                                                "Invalid esp mask");
-                               return 0;
+                               return false;
                        }
-
-                       if (!esp_spec && !esp_mask && !input_set) {
+                       input = &outer_input_set;
+                       if (!esp_spec && !esp_mask && !(*input)) {
                                profile_rule = 1;
                                if (ipv6_valid && udp_valid)
                                        *tun_type =
@@ -1236,7 +1130,7 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
                                else if (ipv6_valid)
                                        *tun_type = ICE_SW_TUN_PROFID_IPV6_ESP;
                                else if (ipv4_valid)
-                                       return 0;
+                                       goto inset_check;
                        } else if (esp_spec && esp_mask &&
                                                esp_mask->hdr.spi){
                                if (udp_valid)
@@ -1247,7 +1141,7 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
                                        esp_spec->hdr.spi;
                                list[t].m_u.esp_hdr.spi =
                                        esp_mask->hdr.spi;
-                               input_set |= ICE_INSET_ESP_SPI;
+                               *input |= ICE_INSET_ESP_SPI;
                                input_set_byte += 4;
                                t++;
                        }
@@ -1273,7 +1167,7 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
                                           RTE_FLOW_ERROR_TYPE_ITEM,
                                           item,
                                           "Invalid ah item");
-                               return 0;
+                               return false;
                        }
                        /* Check ah mask and update input set */
                        if (ah_mask &&
@@ -1285,10 +1179,11 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
                                                RTE_FLOW_ERROR_TYPE_ITEM,
                                                item,
                                                "Invalid ah mask");
-                               return 0;
+                               return false;
                        }
 
-                       if (!ah_spec && !ah_mask && !input_set) {
+                       input = &outer_input_set;
+                       if (!ah_spec && !ah_mask && !(*input)) {
                                profile_rule = 1;
                                if (ipv6_valid && udp_valid)
                                        *tun_type =
@@ -1296,7 +1191,7 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
                                else if (ipv6_valid)
                                        *tun_type = ICE_SW_TUN_PROFID_IPV6_AH;
                                else if (ipv4_valid)
-                                       return 0;
+                                       goto inset_check;
                        } else if (ah_spec && ah_mask &&
                                                ah_mask->spi){
                                list[t].type = ICE_AH;
@@ -1304,14 +1199,14 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
                                        ah_spec->spi;
                                list[t].m_u.ah_hdr.spi =
                                        ah_mask->spi;
-                               input_set |= ICE_INSET_AH_SPI;
+                               *input |= ICE_INSET_AH_SPI;
                                input_set_byte += 4;
                                t++;
                        }
 
                        if (!profile_rule) {
                                if (udp_valid)
-                                       return 0;
+                                       goto inset_check;
                                else if (ipv6_valid)
                                        *tun_type = ICE_SW_TUN_IPV6_AH;
                                else if (ipv4_valid)
@@ -1328,15 +1223,16 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
                                           RTE_FLOW_ERROR_TYPE_ITEM,
                                           item,
                                           "Invalid l2tp item");
-                               return 0;
+                               return false;
                        }
 
-                       if (!l2tp_spec && !l2tp_mask && !input_set) {
+                       input = &outer_input_set;
+                       if (!l2tp_spec && !l2tp_mask && !(*input)) {
                                if (ipv6_valid)
                                        *tun_type =
                                        ICE_SW_TUN_PROFID_MAC_IPV6_L2TPV3;
                                else if (ipv4_valid)
-                                       return 0;
+                                       goto inset_check;
                        } else if (l2tp_spec && l2tp_mask &&
                                                l2tp_mask->session_id){
                                list[t].type = ICE_L2TPV3;
@@ -1344,7 +1240,7 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
                                        l2tp_spec->session_id;
                                list[t].m_u.l2tpv3_sess_hdr.session_id =
                                        l2tp_mask->session_id;
-                               input_set |= ICE_INSET_L2TPV3OIP_SESSION_ID;
+                               *input |= ICE_INSET_L2TPV3OIP_SESSION_ID;
                                input_set_byte += 4;
                                t++;
                        }
@@ -1372,7 +1268,7 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
                                           RTE_FLOW_ERROR_TYPE_ITEM,
                                           item,
                                           "Invalid PFCP item");
-                               return -ENOTSUP;
+                               return false;
                        }
                        if (pfcp_spec && pfcp_mask) {
                                /* Check pfcp mask and update input set */
@@ -1383,7 +1279,7 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
                                                RTE_FLOW_ERROR_TYPE_ITEM,
                                                item,
                                                "Invalid pfcp mask");
-                                       return -ENOTSUP;
+                                       return false;
                                }
                                if (pfcp_mask->s_field &&
                                        pfcp_spec->s_field == 0x01 &&
@@ -1404,7 +1300,7 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
                                        *tun_type =
                                        ICE_SW_TUN_PROFID_IPV4_PFCP_NODE;
                                else
-                                       return -ENOTSUP;
+                                       return false;
                        }
                        break;
 
@@ -1416,7 +1312,7 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
                                        RTE_FLOW_ERROR_TYPE_ITEM,
                                        item,
                                        "Invalid GTP item");
-                               return 0;
+                               return false;
                        }
                        if (gtp_spec && gtp_mask) {
                                if (gtp_mask->v_pt_rsv_flags ||
@@ -1426,10 +1322,11 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
                                                RTE_FLOW_ERROR_TYPE_ITEM,
                                                item,
                                                "Invalid GTP mask");
-                                       return 0;
+                                       return false;
                                }
+                               input = &outer_input_set;
                                if (gtp_mask->teid)
-                                       input_set |= ICE_INSET_GTPU_TEID;
+                                       *input |= ICE_INSET_GTPU_TEID;
                                list[t].type = ICE_GTP;
                                list[t].h_u.gtp_hdr.teid =
                                        gtp_spec->teid;
@@ -1450,7 +1347,7 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
                                        RTE_FLOW_ERROR_TYPE_ITEM,
                                        item,
                                        "Invalid GTPU_EH item");
-                               return 0;
+                               return false;
                        }
                        if (gtp_psc_spec && gtp_psc_mask) {
                                if (gtp_psc_mask->pdu_type) {
@@ -1458,10 +1355,11 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
                                                RTE_FLOW_ERROR_TYPE_ITEM,
                                                item,
                                                "Invalid GTPU_EH mask");
-                                       return 0;
+                                       return false;
                                }
+                               input = &outer_input_set;
                                if (gtp_psc_mask->qfi)
-                                       input_set |= ICE_INSET_GTPU_QFI;
+                                       *input |= ICE_INSET_GTPU_QFI;
                                list[t].type = ICE_GTP;
                                list[t].h_u.gtp_hdr.qfi =
                                        gtp_psc_spec->qfi;
@@ -1480,7 +1378,7 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
                        rte_flow_error_set(error, EINVAL,
                                   RTE_FLOW_ERROR_TYPE_ITEM, pattern,
                                   "Invalid pattern item.");
-                       goto out;
+                       return false;
                }
        }
 
@@ -1608,14 +1506,19 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
                        RTE_FLOW_ERROR_TYPE_ITEM,
                        item,
                        "too much input set");
-               return -ENOTSUP;
+               return false;
        }
 
        *lkups_num = t;
 
-       return input_set;
-out:
-       return 0;
+inset_check:
+       if ((!outer_input_set && !inner_input_set &&
+           !ice_is_prof_rule(*tun_type)) || (outer_input_set &
+           ~pattern_match_item->input_set_mask_o) ||
+           (inner_input_set & ~pattern_match_item->input_set_mask_i))
+               return false;
+
+       return true;
 }
 
 static int
@@ -1825,7 +1728,6 @@ ice_switch_parse_pattern_action(struct ice_adapter *ad,
                struct rte_flow_error *error)
 {
        struct ice_pf *pf = &ad->pf;
-       uint64_t inputset = 0;
        int ret = 0;
        struct sw_meta *sw_meta_ptr = NULL;
        struct ice_adv_rule_info rule_info;
@@ -1892,10 +1794,8 @@ ice_switch_parse_pattern_action(struct ice_adapter *ad,
                goto error;
        }
 
-       inputset = ice_switch_inset_get
-               (pattern, error, list, &lkups_num, &tun_type);
-       if ((!inputset && !ice_is_prof_rule(tun_type)) ||
-               (inputset & ~pattern_match_item->input_set_mask_o)) {
+       if (!ice_switch_parse_pattern(pattern, error, list, &lkups_num,
+                                  &tun_type, pattern_match_item)) {
                rte_flow_error_set(error, EINVAL,
                                   RTE_FLOW_ERROR_TYPE_ITEM_SPEC,
                                   pattern,