DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v1] net/ice: refactor input set fields for switch filter
@ 2021-04-22 10:05 Yuying Zhang
  2021-04-23  7:42 ` [dpdk-dev] [PATCH v2 1/2] " Yuying Zhang
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Yuying Zhang @ 2021-04-22 10:05 UTC (permalink / raw)
  To: dev, qi.z.zhang, haiyue.wang; +Cc: Zhirun.Yan, junfeng.guo, Yuying Zhang

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 distingush inner and outer
input set in the same way as other filters. Clean ICE_INSET_TUN_* codes
since they are redundant.

Signed-off-by: Yuying Zhang <yuying.zhang@intel.com>
---
 drivers/net/ice/ice_fdir_filter.c   |  22 +-
 drivers/net/ice/ice_generic_flow.h  |  61 +--
 drivers/net/ice/ice_switch_filter.c | 782 ++++++++++++----------------
 3 files changed, 355 insertions(+), 510 deletions(-)

diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c
index 3b8ea32b1a..ad2dc40815 100644
--- a/drivers/net/ice/ice_fdir_filter.c
+++ b/drivers/net/ice/ice_fdir_filter.c
@@ -72,7 +72,7 @@
 
 #define ICE_FDIR_INSET_ETH_IPV4_VXLAN (\
 	ICE_FDIR_INSET_ETH | ICE_FDIR_INSET_ETH_IPV4 | \
-	ICE_INSET_TUN_VXLAN_VNI)
+	ICE_INSET_VXLAN_VNI)
 
 #define ICE_FDIR_INSET_IPV4_GTPU (\
 	ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST | ICE_INSET_GTPU_TEID)
@@ -893,17 +893,17 @@ ice_fdir_input_set_parse(uint64_t inset, enum ice_flow_field *field)
 		{ICE_INSET_UDP_DST_PORT, ICE_FLOW_FIELD_IDX_UDP_DST_PORT},
 		{ICE_INSET_SCTP_SRC_PORT, ICE_FLOW_FIELD_IDX_SCTP_SRC_PORT},
 		{ICE_INSET_SCTP_DST_PORT, ICE_FLOW_FIELD_IDX_SCTP_DST_PORT},
-		{ICE_INSET_TUN_IPV4_SRC, ICE_FLOW_FIELD_IDX_IPV4_SA},
-		{ICE_INSET_TUN_IPV4_DST, ICE_FLOW_FIELD_IDX_IPV4_DA},
-		{ICE_INSET_TUN_TCP_SRC_PORT, ICE_FLOW_FIELD_IDX_TCP_SRC_PORT},
-		{ICE_INSET_TUN_TCP_DST_PORT, ICE_FLOW_FIELD_IDX_TCP_DST_PORT},
-		{ICE_INSET_TUN_UDP_SRC_PORT, ICE_FLOW_FIELD_IDX_UDP_SRC_PORT},
-		{ICE_INSET_TUN_UDP_DST_PORT, ICE_FLOW_FIELD_IDX_UDP_DST_PORT},
-		{ICE_INSET_TUN_SCTP_SRC_PORT, ICE_FLOW_FIELD_IDX_SCTP_SRC_PORT},
-		{ICE_INSET_TUN_SCTP_DST_PORT, ICE_FLOW_FIELD_IDX_SCTP_DST_PORT},
+		{ICE_INSET_IPV4_SRC, ICE_FLOW_FIELD_IDX_IPV4_SA},
+		{ICE_INSET_IPV4_DST, ICE_FLOW_FIELD_IDX_IPV4_DA},
+		{ICE_INSET_TCP_SRC_PORT, ICE_FLOW_FIELD_IDX_TCP_SRC_PORT},
+		{ICE_INSET_TCP_DST_PORT, ICE_FLOW_FIELD_IDX_TCP_DST_PORT},
+		{ICE_INSET_UDP_SRC_PORT, ICE_FLOW_FIELD_IDX_UDP_SRC_PORT},
+		{ICE_INSET_UDP_DST_PORT, ICE_FLOW_FIELD_IDX_UDP_DST_PORT},
+		{ICE_INSET_SCTP_SRC_PORT, ICE_FLOW_FIELD_IDX_SCTP_SRC_PORT},
+		{ICE_INSET_SCTP_DST_PORT, ICE_FLOW_FIELD_IDX_SCTP_DST_PORT},
 		{ICE_INSET_GTPU_TEID, ICE_FLOW_FIELD_IDX_GTPU_IP_TEID},
 		{ICE_INSET_GTPU_QFI, ICE_FLOW_FIELD_IDX_GTPU_EH_QFI},
-		{ICE_INSET_TUN_VXLAN_VNI, ICE_FLOW_FIELD_IDX_VXLAN_VNI},
+		{ICE_INSET_VXLAN_VNI, ICE_FLOW_FIELD_IDX_VXLAN_VNI},
 	};
 
 	for (i = 0, j = 0; i < RTE_DIM(ice_inset_map); i++) {
@@ -1916,7 +1916,7 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
 			}
 
 			if (vxlan_mask->hdr.vx_vni)
-				*input_set |= ICE_INSET_TUN_VXLAN_VNI;
+				*input_set |= ICE_INSET_VXLAN_VNI;
 
 			filter->input.vxlan_data.vni = vxlan_spec->hdr.vx_vni;
 
diff --git a/drivers/net/ice/ice_generic_flow.h b/drivers/net/ice/ice_generic_flow.h
index a4d0b6671d..b7634b9662 100644
--- a/drivers/net/ice/ice_generic_flow.h
+++ b/drivers/net/ice/ice_generic_flow.h
@@ -92,64 +92,9 @@
 
 /* tunnel */
 
-#define ICE_INSET_TUN_SMAC \
-	(ICE_PROT_MAC | ICE_SMAC)
-#define ICE_INSET_TUN_DMAC \
-	(ICE_PROT_MAC | ICE_DMAC)
-
-#define ICE_INSET_TUN_IPV4_SRC \
-	(ICE_PROT_IPV4 | ICE_IP_SRC)
-#define ICE_INSET_TUN_IPV4_DST \
-	(ICE_PROT_IPV4 | ICE_IP_DST)
-#define ICE_INSET_TUN_IPV4_TTL \
-	(ICE_PROT_IPV4 | ICE_IP_TTL)
-#define ICE_INSET_TUN_IPV4_PROTO \
-	(ICE_PROT_IPV4 | ICE_IP_PROTO)
-#define ICE_INSET_TUN_IPV4_TOS \
-	(ICE_PROT_IPV4 | ICE_IP_TOS)
-#define ICE_INSET_TUN_IPV6_SRC \
-	(ICE_PROT_IPV6 | ICE_IP_SRC)
-#define ICE_INSET_TUN_IPV6_DST \
-	(ICE_PROT_IPV6 | ICE_IP_DST)
-#define ICE_INSET_TUN_IPV6_HOP_LIMIT \
-	(ICE_PROT_IPV6 | ICE_IP_TTL)
-#define ICE_INSET_TUN_IPV6_NEXT_HDR \
-	(ICE_PROT_IPV6 | ICE_IP_PROTO)
-#define ICE_INSET_TUN_IPV6_TC \
-	(ICE_PROT_IPV6 | ICE_IP_TOS)
-
-#define ICE_INSET_TUN_TCP_SRC_PORT \
-	(ICE_PROT_TCP | ICE_SPORT)
-#define ICE_INSET_TUN_TCP_DST_PORT \
-	(ICE_PROT_TCP | ICE_DPORT)
-#define ICE_INSET_TUN_UDP_SRC_PORT \
-	(ICE_PROT_UDP | ICE_SPORT)
-#define ICE_INSET_TUN_UDP_DST_PORT \
-	(ICE_PROT_UDP | ICE_DPORT)
-#define ICE_INSET_TUN_SCTP_SRC_PORT \
-	(ICE_PROT_SCTP | ICE_SPORT)
-#define ICE_INSET_TUN_SCTP_DST_PORT \
-	(ICE_PROT_SCTP | ICE_DPORT)
-#define ICE_INSET_TUN_ICMP4_SRC_PORT \
-	(ICE_PROT_ICMP4 | ICE_SPORT)
-#define ICE_INSET_TUN_ICMP4_DST_PORT \
-	(ICE_PROT_ICMP4 | ICE_DPORT)
-#define ICE_INSET_TUN_ICMP6_SRC_PORT \
-	(ICE_PROT_ICMP6 | ICE_SPORT)
-#define ICE_INSET_TUN_ICMP6_DST_PORT \
-	(ICE_PROT_ICMP6 | ICE_DPORT)
-#define ICE_INSET_TUN_ICMP4_TYPE \
-	(ICE_PROT_ICMP4 | ICE_ICMP_TYPE)
-#define ICE_INSET_TUN_ICMP4_CODE \
-	(ICE_PROT_ICMP4 | ICE_ICMP_CODE)
-#define ICE_INSET_TUN_ICMP6_TYPE \
-	(ICE_PROT_ICMP6 | ICE_ICMP_TYPE)
-#define ICE_INSET_TUN_ICMP6_CODE \
-	(ICE_PROT_ICMP6 | ICE_ICMP_CODE)
-
-#define ICE_INSET_TUN_VXLAN_VNI \
+#define ICE_INSET_VXLAN_VNI \
 	(ICE_PROT_VXLAN | ICE_VXLAN_VNI)
-#define ICE_INSET_TUN_NVGRE_TNI \
+#define ICE_INSET_NVGRE_TNI \
 	(ICE_PROT_NVGRE | ICE_NVGRE_TNI)
 #define ICE_INSET_GTPU_TEID \
 	(ICE_PROT_GTPU | ICE_GTPU_TEID)
@@ -473,8 +418,8 @@ enum ice_flow_classification_stage {
 /* pattern structure */
 struct ice_pattern_match_item {
 	enum rte_flow_item_type *pattern_list;
-	uint64_t input_set_mask_o; /* used for tunnel outer or non tunnel fields */
 	/* pattern_list must end with RTE_FLOW_ITEM_TYPE_END */
+	uint64_t input_set_mask_o; /* used for tunnel outer or non tunnel fields */
 	uint64_t input_set_mask_i; /* only used for tunnel inner fields */
 	void *meta;
 };
diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c
index 0493e4dee2..9603103b88 100644
--- a/drivers/net/ice/ice_switch_filter.c
+++ b/drivers/net/ice/ice_switch_filter.c
@@ -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)
@@ -68,38 +67,38 @@
 	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_TUN_IPV4_SRC | ICE_INSET_TUN_IPV4_DST | \
-	ICE_INSET_TUN_DMAC | ICE_INSET_TUN_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_TUN_IPV4_SRC | ICE_INSET_TUN_IPV4_DST | \
-	ICE_INSET_TUN_DMAC | ICE_INSET_TUN_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_TUN_IPV4_SRC | ICE_INSET_TUN_IPV4_DST | \
-	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT | \
-	ICE_INSET_TUN_DMAC | ICE_INSET_TUN_NVGRE_TNI | ICE_INSET_IPV4_DST)
+	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)
 #define ICE_SW_INSET_DIST_NVGRE_IPV4_UDP ( \
-	ICE_INSET_TUN_IPV4_SRC | ICE_INSET_TUN_IPV4_DST | \
-	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT | \
-	ICE_INSET_TUN_DMAC | ICE_INSET_TUN_NVGRE_TNI | ICE_INSET_IPV4_DST)
+	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)
 #define ICE_SW_INSET_DIST_VXLAN_IPV4_TCP ( \
-	ICE_INSET_TUN_IPV4_SRC | ICE_INSET_TUN_IPV4_DST | \
-	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT | \
-	ICE_INSET_TUN_DMAC | ICE_INSET_TUN_VXLAN_VNI | ICE_INSET_IPV4_DST)
+	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)
 #define ICE_SW_INSET_DIST_VXLAN_IPV4_UDP ( \
-	ICE_INSET_TUN_IPV4_SRC | ICE_INSET_TUN_IPV4_DST | \
-	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT | \
-	ICE_INSET_TUN_DMAC | ICE_INSET_TUN_VXLAN_VNI | ICE_INSET_IPV4_DST)
+	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)
 #define ICE_SW_INSET_PERM_TUNNEL_IPV4 ( \
-	ICE_INSET_TUN_IPV4_SRC | ICE_INSET_TUN_IPV4_DST | \
-	ICE_INSET_TUN_IPV4_PROTO | ICE_INSET_TUN_IPV4_TOS)
+	ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST | \
+	ICE_INSET_IPV4_PROTO | ICE_INSET_IPV4_TOS)
 #define ICE_SW_INSET_PERM_TUNNEL_IPV4_TCP ( \
-	ICE_INSET_TUN_IPV4_SRC | ICE_INSET_TUN_IPV4_DST | \
-	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT | \
-	ICE_INSET_TUN_IPV4_TOS)
+	ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST | \
+	ICE_INSET_TCP_SRC_PORT | ICE_INSET_TCP_DST_PORT | \
+	ICE_INSET_IPV4_TOS)
 #define ICE_SW_INSET_PERM_TUNNEL_IPV4_UDP ( \
-	ICE_INSET_TUN_IPV4_SRC | ICE_INSET_TUN_IPV4_DST | \
-	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT | \
-	ICE_INSET_TUN_IPV4_TOS)
+	ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST | \
+	ICE_INSET_UDP_SRC_PORT | ICE_INSET_UDP_DST_PORT | \
+	ICE_INSET_IPV4_TOS)
 #define ICE_SW_INSET_MAC_PPPOE  ( \
 	ICE_INSET_VLAN_OUTER | ICE_INSET_VLAN_INNER | \
 	ICE_INSET_DMAC | ICE_INSET_ETHERTYPE | ICE_INSET_PPPOE_SESSION)
@@ -141,74 +140,26 @@
 	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_TUN_IPV4_SRC | ICE_INSET_TUN_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_TUN_IPV6_SRC | ICE_INSET_TUN_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 | \
-	ICE_INSET_TUN_IPV4_SRC | ICE_INSET_TUN_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 | \
-	ICE_INSET_TUN_IPV6_SRC | ICE_INSET_TUN_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_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT)
-#define ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4_UDP ( \
-	ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4 | \
-	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT)
-#define ICE_SW_INSET_MAC_IPV4_GTPU_IPV4_TCP ( \
-	ICE_SW_INSET_MAC_IPV4_GTPU_IPV4 | \
-	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT)
-#define ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4_TCP ( \
-	ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4 | \
-	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT)
-#define ICE_SW_INSET_MAC_IPV4_GTPU_IPV6_UDP ( \
-	ICE_SW_INSET_MAC_IPV4_GTPU_IPV6 | \
-	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT)
-#define ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6_UDP ( \
-	ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6 | \
-	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT)
-#define ICE_SW_INSET_MAC_IPV4_GTPU_IPV6_TCP ( \
-	ICE_SW_INSET_MAC_IPV4_GTPU_IPV6 | \
-	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT)
-#define ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6_TCP ( \
-	ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6 | \
-	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT)
-#define ICE_SW_INSET_MAC_IPV6_GTPU_IPV4_UDP ( \
-	ICE_SW_INSET_MAC_IPV6_GTPU_IPV4 | \
-	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT)
-#define ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4_UDP ( \
-	ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4 | \
-	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT)
-#define ICE_SW_INSET_MAC_IPV6_GTPU_IPV4_TCP ( \
-	ICE_SW_INSET_MAC_IPV6_GTPU_IPV4 | \
-	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT)
-#define ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4_TCP ( \
-	ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4 | \
-	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT)
-#define ICE_SW_INSET_MAC_IPV6_GTPU_IPV6_UDP ( \
-	ICE_SW_INSET_MAC_IPV6_GTPU_IPV6 | \
-	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT)
-#define ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6_UDP ( \
-	ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6 | \
-	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT)
-#define ICE_SW_INSET_MAC_IPV6_GTPU_IPV6_TCP ( \
-	ICE_SW_INSET_MAC_IPV6_GTPU_IPV6 | \
-	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT)
-#define ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6_TCP ( \
-	ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6 | \
-	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT)
+#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_GTPU_IPV6 ( \
+	ICE_INSET_IPV6_SRC | ICE_INSET_IPV6_DST)
+#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_TUN_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_TUN_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_TUN_IPV4_TOS;
-					if (ipv4_mask->hdr.src_addr)
-						input_set |=
-							ICE_INSET_TUN_IPV4_SRC;
-					if (ipv4_mask->hdr.dst_addr)
-						input_set |=
-							ICE_INSET_TUN_IPV4_DST;
-					if (ipv4_mask->hdr.time_to_live)
-						input_set |=
-							ICE_INSET_TUN_IPV4_TTL;
-					if (ipv4_mask->hdr.next_proto_id)
-						input_set |=
-						ICE_INSET_TUN_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_TUN_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_TUN_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_TUN_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_TUN_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_TUN_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_TUN_UDP_SRC_PORT;
-					if (udp_mask->hdr.dst_port)
-						input_set |=
-						ICE_INSET_TUN_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_TUN_TCP_SRC_PORT;
-					if (tcp_mask->hdr.dst_port)
-						input_set |=
-						ICE_INSET_TUN_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_TUN_SCTP_SRC_PORT;
-					if (sctp_mask->hdr.dst_port)
-						input_set |=
-						ICE_INSET_TUN_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_TUN_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_TUN_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) == false) {
 		rte_flow_error_set(error, EINVAL,
 				   RTE_FLOW_ERROR_TYPE_ITEM_SPEC,
 				   pattern,
-- 
2.25.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-04-26  8:05 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-22 10:05 [dpdk-dev] [PATCH v1] net/ice: refactor input set fields for switch filter Yuying Zhang
2021-04-23  7:42 ` [dpdk-dev] [PATCH v2 1/2] " Yuying Zhang
2021-04-23  7:42   ` [dpdk-dev] [PATCH v2 2/2] net/ice: clean redundant macro definition of filters Yuying Zhang
2021-04-25 13:29 ` [dpdk-dev] [PATCH v3 1/2] " Yuying Zhang
2021-04-25 13:29   ` [dpdk-dev] [PATCH v3 2/2] net/ice: refactor input set fields for switch filter Yuying Zhang
2021-04-26  1:47     ` Zhang, Qi Z
2021-04-26  3:09       ` Zhang, Yuying
2021-04-26  5:38 ` [dpdk-dev] [PATCH v4 1/2] net/ice: clean redundant macro definition of filters Yuying Zhang
2021-04-26  5:38   ` [dpdk-dev] [PATCH v4 2/2] net/ice: refactor input set fields for switch filter Yuying Zhang
2021-04-26  8:05     ` Zhang, Qi Z
2021-04-26  8:04   ` [dpdk-dev] [PATCH v4 1/2] net/ice: clean redundant macro definition of filters Zhang, Qi Z

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).