DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v1 0/5] Refactor FDIR pattern parser
@ 2020-12-21  6:51 Zhirun Yan
  2020-12-21  6:51 ` [dpdk-dev] [PATCH v1 1/5] net/ice: clean input set macro definition Zhirun Yan
                   ` (5 more replies)
  0 siblings, 6 replies; 24+ messages in thread
From: Zhirun Yan @ 2020-12-21  6:51 UTC (permalink / raw)
  To: dev, qi.z.zhang, yahui.cao, xiao.w.wang, junfeng.guo
  Cc: simei.su, ting.xu, yuying.zhang, Zhirun Yan

This patch set refactor FDIR pattern parser.

Redefine input set. Ignore the redundant inner/outer info.
Align the parser action with hardware, using input_set_f for outer,
input_set_l for inner or non-tunnel fields.
Adjust indentation for easy review.
Enable VXLAN inner/outer fields.


Zhirun Yan (5):
  net/ice: clean input set macro definition
  net/ice: refactor flow pattern parser
  net/ice: add outer input set mask to distinguish outer fields
  net/ice: add outer input set mask check
  net/ice: enable FDIR outer/inner fields for VXLAN

 drivers/net/ice/ice_fdir_filter.c   | 593 ++++++++++++++--------------
 drivers/net/ice/ice_generic_flow.c  |   2 +
 drivers/net/ice/ice_generic_flow.h  | 235 +++++------
 drivers/net/ice/ice_hash.c          | 192 ++++-----
 drivers/net/ice/ice_switch_filter.c | 348 ++++++----------
 5 files changed, 573 insertions(+), 797 deletions(-)

-- 
2.25.1


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

* [dpdk-dev] [PATCH v1 1/5] net/ice: clean input set macro definition
  2020-12-21  6:51 [dpdk-dev] [PATCH v1 0/5] Refactor FDIR pattern parser Zhirun Yan
@ 2020-12-21  6:51 ` Zhirun Yan
  2020-12-21  6:51 ` [dpdk-dev] [PATCH v1 2/5] net/ice: refactor flow pattern parser Zhirun Yan
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 24+ messages in thread
From: Zhirun Yan @ 2020-12-21  6:51 UTC (permalink / raw)
  To: dev, qi.z.zhang, yahui.cao, xiao.w.wang, junfeng.guo
  Cc: simei.su, ting.xu, yuying.zhang, Zhirun Yan

Currently, the macro of input set use 2 bits, one bit for protocol and
inner/outer, another bit for src/dst field. But this could not distinguish
a rule with inner and outer fields for tunnel packet.
Redefine input set macro to make it clear. Only use these two bits for
protocol and field. Ignore the redundant inner/outer info.

ICE_INSET_TUN_* is used by switch module, should be removed after
switch refactor.

Signed-off-by: Zhirun Yan <zhirun.yan@intel.com>
---
 drivers/net/ice/ice_fdir_filter.c  |   8 +-
 drivers/net/ice/ice_generic_flow.h | 234 ++++++++++++-----------------
 2 files changed, 104 insertions(+), 138 deletions(-)

diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c
index 175abcdd5c..92b8a7e6ad 100644
--- a/drivers/net/ice/ice_fdir_filter.c
+++ b/drivers/net/ice/ice_fdir_filter.c
@@ -56,19 +56,19 @@
 	ICE_INSET_SCTP_SRC_PORT | ICE_INSET_SCTP_DST_PORT)
 
 #define ICE_FDIR_INSET_VXLAN_IPV4 (\
-	ICE_INSET_TUN_IPV4_SRC | ICE_INSET_TUN_IPV4_DST)
+	ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST)
 
 #define ICE_FDIR_INSET_VXLAN_IPV4_TCP (\
 	ICE_FDIR_INSET_VXLAN_IPV4 | \
-	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT)
+	ICE_INSET_TCP_SRC_PORT | ICE_INSET_TCP_DST_PORT)
 
 #define ICE_FDIR_INSET_VXLAN_IPV4_UDP (\
 	ICE_FDIR_INSET_VXLAN_IPV4 | \
-	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT)
+	ICE_INSET_UDP_SRC_PORT | ICE_INSET_UDP_DST_PORT)
 
 #define ICE_FDIR_INSET_VXLAN_IPV4_SCTP (\
 	ICE_FDIR_INSET_VXLAN_IPV4 | \
-	ICE_INSET_TUN_SCTP_SRC_PORT | ICE_INSET_TUN_SCTP_DST_PORT)
+	ICE_INSET_SCTP_SRC_PORT | ICE_INSET_SCTP_DST_PORT)
 
 #define ICE_FDIR_INSET_IPV4_GTPU (\
 	ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST | ICE_INSET_GTPU_TEID)
diff --git a/drivers/net/ice/ice_generic_flow.h b/drivers/net/ice/ice_generic_flow.h
index 434d2f425d..a03b2fc21d 100644
--- a/drivers/net/ice/ice_generic_flow.h
+++ b/drivers/net/ice/ice_generic_flow.h
@@ -9,177 +9,143 @@
 
 /* protocol */
 
-#define ICE_PROT_MAC_INNER         (1ULL << 1)
-#define ICE_PROT_MAC_OUTER         (1ULL << 2)
-#define ICE_PROT_VLAN_INNER        (1ULL << 3)
-#define ICE_PROT_VLAN_OUTER        (1ULL << 4)
-#define ICE_PROT_IPV4_INNER        (1ULL << 5)
-#define ICE_PROT_IPV4_OUTER        (1ULL << 6)
-#define ICE_PROT_IPV6_INNER        (1ULL << 7)
-#define ICE_PROT_IPV6_OUTER        (1ULL << 8)
-#define ICE_PROT_TCP_INNER         (1ULL << 9)
-#define ICE_PROT_TCP_OUTER         (1ULL << 10)
-#define ICE_PROT_UDP_INNER         (1ULL << 11)
-#define ICE_PROT_UDP_OUTER         (1ULL << 12)
-#define ICE_PROT_SCTP_INNER        (1ULL << 13)
-#define ICE_PROT_SCTP_OUTER        (1ULL << 14)
-#define ICE_PROT_ICMP4_INNER       (1ULL << 15)
-#define ICE_PROT_ICMP4_OUTER       (1ULL << 16)
-#define ICE_PROT_ICMP6_INNER       (1ULL << 17)
-#define ICE_PROT_ICMP6_OUTER       (1ULL << 18)
-#define ICE_PROT_VXLAN             (1ULL << 19)
-#define ICE_PROT_NVGRE             (1ULL << 20)
-#define ICE_PROT_GTPU              (1ULL << 21)
-#define ICE_PROT_PPPOE_S           (1ULL << 22)
-#define ICE_PROT_ESP               (1ULL << 23)
-#define ICE_PROT_AH                (1ULL << 24)
-#define ICE_PROT_L2TPV3OIP         (1ULL << 25)
-#define ICE_PROT_PFCP              (1ULL << 26)
+#define ICE_PROT_MAC			BIT_ULL(1)
+#define ICE_PROT_VLAN			BIT_ULL(2)
+#define ICE_PROT_IPV4			BIT_ULL(3)
+#define ICE_PROT_IPV6			BIT_ULL(4)
+#define ICE_PROT_TCP			BIT_ULL(5)
+#define ICE_PROT_UDP			BIT_ULL(6)
+#define ICE_PROT_SCTP			BIT_ULL(7)
+#define ICE_PROT_ICMP4			BIT_ULL(8)
+#define ICE_PROT_ICMP6			BIT_ULL(9)
+#define ICE_PROT_VXLAN			BIT_ULL(10)
+#define ICE_PROT_NVGRE			BIT_ULL(11)
+#define ICE_PROT_GTPU			BIT_ULL(12)
+#define ICE_PROT_PPPOE_S		BIT_ULL(13)
+#define ICE_PROT_ESP			BIT_ULL(14)
+#define ICE_PROT_AH			BIT_ULL(15)
+#define ICE_PROT_L2TPV3OIP		BIT_ULL(16)
+#define ICE_PROT_PFCP			BIT_ULL(17)
 
 /* field */
 
-#define ICE_SMAC                   (1ULL << 63)
-#define ICE_DMAC                   (1ULL << 62)
-#define ICE_ETHERTYPE              (1ULL << 61)
-#define ICE_IP_SRC                 (1ULL << 60)
-#define ICE_IP_DST                 (1ULL << 59)
-#define ICE_IP_PROTO               (1ULL << 58)
-#define ICE_IP_TTL                 (1ULL << 57)
-#define ICE_IP_TOS                 (1ULL << 56)
-#define ICE_SPORT                  (1ULL << 55)
-#define ICE_DPORT                  (1ULL << 54)
-#define ICE_ICMP_TYPE              (1ULL << 53)
-#define ICE_ICMP_CODE              (1ULL << 52)
-#define ICE_VXLAN_VNI              (1ULL << 51)
-#define ICE_NVGRE_TNI              (1ULL << 50)
-#define ICE_GTPU_TEID              (1ULL << 49)
-#define ICE_GTPU_QFI               (1ULL << 48)
-#define ICE_PPPOE_SESSION          (1ULL << 47)
-#define ICE_PPPOE_PROTO            (1ULL << 46)
-#define ICE_ESP_SPI                (1ULL << 45)
-#define ICE_AH_SPI                 (1ULL << 44)
-#define ICE_L2TPV3OIP_SESSION_ID   (1ULL << 43)
-#define ICE_PFCP_SEID              (1ULL << 42)
-#define ICE_PFCP_S_FIELD           (1ULL << 41)
+#define ICE_SMAC			BIT_ULL(63)
+#define ICE_DMAC			BIT_ULL(62)
+#define ICE_ETHERTYPE			BIT_ULL(61)
+#define ICE_IP_SRC			BIT_ULL(60)
+#define ICE_IP_DST			BIT_ULL(59)
+#define ICE_IP_PROTO			BIT_ULL(58)
+#define ICE_IP_TTL			BIT_ULL(57)
+#define ICE_IP_TOS			BIT_ULL(56)
+#define ICE_SPORT			BIT_ULL(55)
+#define ICE_DPORT			BIT_ULL(54)
+#define ICE_ICMP_TYPE			BIT_ULL(53)
+#define ICE_ICMP_CODE			BIT_ULL(52)
+#define ICE_VXLAN_VNI			BIT_ULL(51)
+#define ICE_NVGRE_TNI			BIT_ULL(50)
+#define ICE_GTPU_TEID			BIT_ULL(49)
+#define ICE_GTPU_QFI			BIT_ULL(48)
+#define ICE_PPPOE_SESSION		BIT_ULL(47)
+#define ICE_PPPOE_PROTO			BIT_ULL(46)
+#define ICE_ESP_SPI			BIT_ULL(45)
+#define ICE_AH_SPI			BIT_ULL(44)
+#define ICE_L2TPV3OIP_SESSION_ID	BIT_ULL(43)
+#define ICE_PFCP_SEID			BIT_ULL(42)
+#define ICE_PFCP_S_FIELD		BIT_ULL(41)
 
 /* input set */
 
-#define ICE_INSET_NONE             0ULL
-
-/* non-tunnel */
-
-#define ICE_INSET_SMAC         (ICE_PROT_MAC_OUTER | ICE_SMAC)
-#define ICE_INSET_DMAC         (ICE_PROT_MAC_OUTER | ICE_DMAC)
-#define ICE_INSET_VLAN_INNER   (ICE_PROT_VLAN_INNER)
-#define ICE_INSET_VLAN_OUTER   (ICE_PROT_VLAN_OUTER)
-#define ICE_INSET_ETHERTYPE    (ICE_ETHERTYPE)
-
-#define ICE_INSET_IPV4_SRC \
-	(ICE_PROT_IPV4_OUTER | ICE_IP_SRC)
-#define ICE_INSET_IPV4_DST \
-	(ICE_PROT_IPV4_OUTER | ICE_IP_DST)
-#define ICE_INSET_IPV4_TOS \
-	(ICE_PROT_IPV4_OUTER | ICE_IP_TOS)
-#define ICE_INSET_IPV4_PROTO \
-	(ICE_PROT_IPV4_OUTER | ICE_IP_PROTO)
-#define ICE_INSET_IPV4_TTL \
-	(ICE_PROT_IPV4_OUTER | ICE_IP_TTL)
-#define ICE_INSET_IPV6_SRC \
-	(ICE_PROT_IPV6_OUTER | ICE_IP_SRC)
-#define ICE_INSET_IPV6_DST \
-	(ICE_PROT_IPV6_OUTER | ICE_IP_DST)
-#define ICE_INSET_IPV6_NEXT_HDR \
-	(ICE_PROT_IPV6_OUTER | ICE_IP_PROTO)
-#define ICE_INSET_IPV6_HOP_LIMIT \
-	(ICE_PROT_IPV6_OUTER | ICE_IP_TTL)
-#define ICE_INSET_IPV6_TC \
-	(ICE_PROT_IPV6_OUTER | ICE_IP_TOS)
-
-#define ICE_INSET_TCP_SRC_PORT \
-	(ICE_PROT_TCP_OUTER | ICE_SPORT)
-#define ICE_INSET_TCP_DST_PORT \
-	(ICE_PROT_TCP_OUTER | ICE_DPORT)
-#define ICE_INSET_UDP_SRC_PORT \
-	(ICE_PROT_UDP_OUTER | ICE_SPORT)
-#define ICE_INSET_UDP_DST_PORT \
-	(ICE_PROT_UDP_OUTER | ICE_DPORT)
-#define ICE_INSET_SCTP_SRC_PORT \
-	(ICE_PROT_SCTP_OUTER | ICE_SPORT)
-#define ICE_INSET_SCTP_DST_PORT \
-	(ICE_PROT_SCTP_OUTER | ICE_DPORT)
-#define ICE_INSET_ICMP4_SRC_PORT \
-	(ICE_PROT_ICMP4_OUTER | ICE_SPORT)
-#define ICE_INSET_ICMP4_DST_PORT \
-	(ICE_PROT_ICMP4_OUTER | ICE_DPORT)
-#define ICE_INSET_ICMP6_SRC_PORT \
-	(ICE_PROT_ICMP6_OUTER | ICE_SPORT)
-#define ICE_INSET_ICMP6_DST_PORT \
-	(ICE_PROT_ICMP6_OUTER | ICE_DPORT)
-#define ICE_INSET_ICMP4_TYPE \
-	(ICE_PROT_ICMP4_OUTER | ICE_ICMP_TYPE)
-#define ICE_INSET_ICMP4_CODE \
-	(ICE_PROT_ICMP4_OUTER | ICE_ICMP_CODE)
-#define ICE_INSET_ICMP6_TYPE \
-	(ICE_PROT_ICMP6_OUTER | ICE_ICMP_TYPE)
-#define ICE_INSET_ICMP6_CODE \
-	(ICE_PROT_ICMP6_OUTER | ICE_ICMP_CODE)
+#define ICE_INSET_NONE			0ULL
+
+#define ICE_INSET_SMAC			(ICE_SMAC)
+#define ICE_INSET_DMAC			(ICE_DMAC)
+#define ICE_INSET_VLAN			(ICE_PROT_VLAN)
+#define ICE_INSET_VLAN_INNER		(ICE_PROT_VLAN)
+#define ICE_INSET_VLAN_OUTER		(ICE_PROT_VLAN)
+#define ICE_INSET_ETHERTYPE		(ICE_ETHERTYPE)
+
+#define ICE_INSET_IPV4_SRC		(ICE_PROT_IPV4 | ICE_IP_SRC)
+#define ICE_INSET_IPV4_DST		(ICE_PROT_IPV4 | ICE_IP_DST)
+#define ICE_INSET_IPV4_TOS		(ICE_PROT_IPV4 | ICE_IP_TOS)
+#define ICE_INSET_IPV4_PROTO		(ICE_PROT_IPV4 | ICE_IP_PROTO)
+#define ICE_INSET_IPV4_TTL		(ICE_PROT_IPV4 | ICE_IP_TTL)
+#define ICE_INSET_IPV6_SRC		(ICE_PROT_IPV6 | ICE_IP_SRC)
+#define ICE_INSET_IPV6_DST		(ICE_PROT_IPV6 | ICE_IP_DST)
+#define ICE_INSET_IPV6_NEXT_HDR		(ICE_PROT_IPV6 | ICE_IP_PROTO)
+#define ICE_INSET_IPV6_HOP_LIMIT	(ICE_PROT_IPV6 | ICE_IP_TTL)
+#define ICE_INSET_IPV6_TC		(ICE_PROT_IPV6 | ICE_IP_TOS)
+
+#define ICE_INSET_TCP_SRC_PORT		(ICE_PROT_TCP | ICE_SPORT)
+#define ICE_INSET_TCP_DST_PORT		(ICE_PROT_TCP | ICE_DPORT)
+#define ICE_INSET_UDP_SRC_PORT		(ICE_PROT_UDP | ICE_SPORT)
+#define ICE_INSET_UDP_DST_PORT		(ICE_PROT_UDP | ICE_DPORT)
+#define ICE_INSET_SCTP_SRC_PORT		(ICE_PROT_SCTP | ICE_SPORT)
+#define ICE_INSET_SCTP_DST_PORT		(ICE_PROT_SCTP | ICE_DPORT)
+#define ICE_INSET_ICMP4_SRC_PORT	(ICE_PROT_ICMP4 | ICE_SPORT)
+#define ICE_INSET_ICMP4_DST_PORT	(ICE_PROT_ICMP4 | ICE_DPORT)
+#define ICE_INSET_ICMP6_SRC_PORT	(ICE_PROT_ICMP6 | ICE_SPORT)
+#define ICE_INSET_ICMP6_DST_PORT	(ICE_PROT_ICMP6 | ICE_DPORT)
+#define ICE_INSET_ICMP4_TYPE		(ICE_PROT_ICMP4 | ICE_ICMP_TYPE)
+#define ICE_INSET_ICMP4_CODE		(ICE_PROT_ICMP4 | ICE_ICMP_CODE)
+#define ICE_INSET_ICMP6_TYPE		(ICE_PROT_ICMP6 | ICE_ICMP_TYPE)
+#define ICE_INSET_ICMP6_CODE		(ICE_PROT_ICMP6 | ICE_ICMP_CODE)
 
 /* tunnel */
 
 #define ICE_INSET_TUN_SMAC \
-	(ICE_PROT_MAC_INNER | ICE_SMAC)
+	(ICE_PROT_MAC | ICE_SMAC)
 #define ICE_INSET_TUN_DMAC \
-	(ICE_PROT_MAC_INNER | ICE_DMAC)
+	(ICE_PROT_MAC | ICE_DMAC)
 
 #define ICE_INSET_TUN_IPV4_SRC \
-	(ICE_PROT_IPV4_INNER | ICE_IP_SRC)
+	(ICE_PROT_IPV4 | ICE_IP_SRC)
 #define ICE_INSET_TUN_IPV4_DST \
-	(ICE_PROT_IPV4_INNER | ICE_IP_DST)
+	(ICE_PROT_IPV4 | ICE_IP_DST)
 #define ICE_INSET_TUN_IPV4_TTL \
-	(ICE_PROT_IPV4_INNER | ICE_IP_TTL)
+	(ICE_PROT_IPV4 | ICE_IP_TTL)
 #define ICE_INSET_TUN_IPV4_PROTO \
-	(ICE_PROT_IPV4_INNER | ICE_IP_PROTO)
+	(ICE_PROT_IPV4 | ICE_IP_PROTO)
 #define ICE_INSET_TUN_IPV4_TOS \
-	(ICE_PROT_IPV4_INNER | ICE_IP_TOS)
+	(ICE_PROT_IPV4 | ICE_IP_TOS)
 #define ICE_INSET_TUN_IPV6_SRC \
-	(ICE_PROT_IPV6_INNER | ICE_IP_SRC)
+	(ICE_PROT_IPV6 | ICE_IP_SRC)
 #define ICE_INSET_TUN_IPV6_DST \
-	(ICE_PROT_IPV6_INNER | ICE_IP_DST)
+	(ICE_PROT_IPV6 | ICE_IP_DST)
 #define ICE_INSET_TUN_IPV6_HOP_LIMIT \
-	(ICE_PROT_IPV6_INNER | ICE_IP_TTL)
+	(ICE_PROT_IPV6 | ICE_IP_TTL)
 #define ICE_INSET_TUN_IPV6_NEXT_HDR \
-	(ICE_PROT_IPV6_INNER | ICE_IP_PROTO)
+	(ICE_PROT_IPV6 | ICE_IP_PROTO)
 #define ICE_INSET_TUN_IPV6_TC \
-	(ICE_PROT_IPV6_INNER | ICE_IP_TOS)
+	(ICE_PROT_IPV6 | ICE_IP_TOS)
 
 #define ICE_INSET_TUN_TCP_SRC_PORT \
-	(ICE_PROT_TCP_INNER | ICE_SPORT)
+	(ICE_PROT_TCP | ICE_SPORT)
 #define ICE_INSET_TUN_TCP_DST_PORT \
-	(ICE_PROT_TCP_INNER | ICE_DPORT)
+	(ICE_PROT_TCP | ICE_DPORT)
 #define ICE_INSET_TUN_UDP_SRC_PORT \
-	(ICE_PROT_UDP_INNER | ICE_SPORT)
+	(ICE_PROT_UDP | ICE_SPORT)
 #define ICE_INSET_TUN_UDP_DST_PORT \
-	(ICE_PROT_UDP_INNER | ICE_DPORT)
+	(ICE_PROT_UDP | ICE_DPORT)
 #define ICE_INSET_TUN_SCTP_SRC_PORT \
-	(ICE_PROT_SCTP_INNER | ICE_SPORT)
+	(ICE_PROT_SCTP | ICE_SPORT)
 #define ICE_INSET_TUN_SCTP_DST_PORT \
-	(ICE_PROT_SCTP_INNER | ICE_DPORT)
+	(ICE_PROT_SCTP | ICE_DPORT)
 #define ICE_INSET_TUN_ICMP4_SRC_PORT \
-	(ICE_PROT_ICMP4_INNER | ICE_SPORT)
+	(ICE_PROT_ICMP4 | ICE_SPORT)
 #define ICE_INSET_TUN_ICMP4_DST_PORT \
-	(ICE_PROT_ICMP4_INNER | ICE_DPORT)
+	(ICE_PROT_ICMP4 | ICE_DPORT)
 #define ICE_INSET_TUN_ICMP6_SRC_PORT \
-	(ICE_PROT_ICMP6_INNER | ICE_SPORT)
+	(ICE_PROT_ICMP6 | ICE_SPORT)
 #define ICE_INSET_TUN_ICMP6_DST_PORT \
-	(ICE_PROT_ICMP6_INNER | ICE_DPORT)
+	(ICE_PROT_ICMP6 | ICE_DPORT)
 #define ICE_INSET_TUN_ICMP4_TYPE \
-	(ICE_PROT_ICMP4_INNER | ICE_ICMP_TYPE)
+	(ICE_PROT_ICMP4 | ICE_ICMP_TYPE)
 #define ICE_INSET_TUN_ICMP4_CODE \
-	(ICE_PROT_ICMP4_INNER | ICE_ICMP_CODE)
+	(ICE_PROT_ICMP4 | ICE_ICMP_CODE)
 #define ICE_INSET_TUN_ICMP6_TYPE \
-	(ICE_PROT_ICMP6_INNER | ICE_ICMP_TYPE)
+	(ICE_PROT_ICMP6 | ICE_ICMP_TYPE)
 #define ICE_INSET_TUN_ICMP6_CODE \
-	(ICE_PROT_ICMP6_INNER | ICE_ICMP_CODE)
+	(ICE_PROT_ICMP6 | ICE_ICMP_CODE)
 
 #define ICE_INSET_TUN_VXLAN_VNI \
 	(ICE_PROT_VXLAN | ICE_VXLAN_VNI)
-- 
2.25.1


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

* [dpdk-dev] [PATCH v1 2/5] net/ice: refactor flow pattern parser
  2020-12-21  6:51 [dpdk-dev] [PATCH v1 0/5] Refactor FDIR pattern parser Zhirun Yan
  2020-12-21  6:51 ` [dpdk-dev] [PATCH v1 1/5] net/ice: clean input set macro definition Zhirun Yan
@ 2020-12-21  6:51 ` Zhirun Yan
  2020-12-25  5:21   ` Cao, Yahui
  2020-12-21  6:51 ` [dpdk-dev] [PATCH v1 3/5] net/ice: add outer input set mask to distinguish outer fields Zhirun Yan
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 24+ messages in thread
From: Zhirun Yan @ 2020-12-21  6:51 UTC (permalink / raw)
  To: dev, qi.z.zhang, yahui.cao, xiao.w.wang, junfeng.guo
  Cc: simei.su, ting.xu, yuying.zhang, Zhirun Yan

Distinguish inner/outer input set. And avoid too many nested
conditionals in each type's parser. input_set_f is used for
outer fields, input_set_l is used for inner or non-tunnel
fields.

Signed-off-by: Zhirun Yan <zhirun.yan@intel.com>
---
 drivers/net/ice/ice_fdir_filter.c | 467 +++++++++++++++---------------
 1 file changed, 229 insertions(+), 238 deletions(-)

diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c
index 92b8a7e6ad..1f2576a444 100644
--- a/drivers/net/ice/ice_fdir_filter.c
+++ b/drivers/net/ice/ice_fdir_filter.c
@@ -1646,7 +1646,9 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
 	const struct rte_flow_item_vxlan *vxlan_spec, *vxlan_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 input_set_l = ICE_INSET_NONE;
+	uint64_t input_set_f = ICE_INSET_NONE;
+	uint64_t *input_set;
 	uint8_t flow_type = ICE_FLTR_PTYPE_NONF_NONE;
 	uint8_t  ipv6_addr_mask[16] = {
 		0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
@@ -1655,289 +1657,276 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
 	uint32_t vtc_flow_cpu;
 	uint16_t ether_type;
 	enum rte_flow_item_type next_type;
+	bool is_outer = true;
+	struct ice_fdir_extra *p_ext_data;
+	struct ice_fdir_v4 *p_v4;
+	struct ice_fdir_v6 *p_v6;
 
+	for (item = pattern; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {
+		if (item->type == RTE_FLOW_ITEM_TYPE_VXLAN)
+			tunnel_type = ICE_FDIR_TUNNEL_TYPE_VXLAN;
+		if (item->type == RTE_FLOW_ITEM_TYPE_GTPU)
+			tunnel_type = ICE_FDIR_TUNNEL_TYPE_GTPU;
+		if (item->type == RTE_FLOW_ITEM_TYPE_GTP_PSC)
+			tunnel_type = ICE_FDIR_TUNNEL_TYPE_GTPU_EH;
+	}
+
+	/* This loop parse flow pattern and distinguish Non-tunnel and tunnel
+	 * flow. input_set_l is used for non-tunnel and tunnel inner part.
+	 */
 	for (item = pattern; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {
 		if (item->last) {
 			rte_flow_error_set(error, EINVAL,
-					RTE_FLOW_ERROR_TYPE_ITEM,
-					item,
-					"Not support range");
+					   RTE_FLOW_ERROR_TYPE_ITEM,
+					   item,
+					   "Not support range");
 			return -rte_errno;
 		}
 		item_type = item->type;
 
+		input_set = (tunnel_type && is_outer) ?
+			    &input_set_f : &input_set_l;
+
+		if (l3 == RTE_FLOW_ITEM_TYPE_IPV4)
+			p_v4 = (tunnel_type && is_outer) ?
+			       &filter->input.ip_outer.v4 :
+			       &filter->input.ip.v4;
+		if (l3 == RTE_FLOW_ITEM_TYPE_IPV6)
+			p_v6 = (tunnel_type && is_outer) ?
+			       &filter->input.ip_outer.v6 :
+			       &filter->input.ip.v6;
+
 		switch (item_type) {
 		case RTE_FLOW_ITEM_TYPE_ETH:
+			flow_type = ICE_FLTR_PTYPE_NON_IP_L2;
 			eth_spec = item->spec;
 			eth_mask = item->mask;
-			next_type = (item + 1)->type;
 
-			if (eth_spec && eth_mask) {
-				if (!rte_is_zero_ether_addr(&eth_mask->dst)) {
-					input_set |= ICE_INSET_DMAC;
-					rte_memcpy(&filter->input.ext_data.dst_mac,
-						   &eth_spec->dst,
-						   RTE_ETHER_ADDR_LEN);
-				}
+			if (!(eth_spec && eth_mask))
+				break;
 
-				if (!rte_is_zero_ether_addr(&eth_mask->src)) {
-					input_set |= ICE_INSET_SMAC;
-					rte_memcpy(&filter->input.ext_data.src_mac,
-						   &eth_spec->src,
-						   RTE_ETHER_ADDR_LEN);
-				}
+			if (!rte_is_zero_ether_addr(&eth_mask->dst))
+				*input_set |= ICE_INSET_DMAC;
+			if (!rte_is_zero_ether_addr(&eth_mask->src))
+				*input_set |= ICE_INSET_SMAC;
 
-				/* Ignore this field except for ICE_FLTR_PTYPE_NON_IP_L2 */
-				if (eth_mask->type == RTE_BE16(0xffff) &&
-				    next_type == RTE_FLOW_ITEM_TYPE_END) {
-					input_set |= ICE_INSET_ETHERTYPE;
-					ether_type = rte_be_to_cpu_16(eth_spec->type);
-
-					if (ether_type == RTE_ETHER_TYPE_IPV4 ||
-					    ether_type == RTE_ETHER_TYPE_IPV6) {
-						rte_flow_error_set(error, EINVAL,
-								   RTE_FLOW_ERROR_TYPE_ITEM,
-								   item,
-								   "Unsupported ether_type.");
-						return -rte_errno;
-					}
-
-					rte_memcpy(&filter->input.ext_data.ether_type,
-						   &eth_spec->type,
-						   sizeof(eth_spec->type));
-					flow_type = ICE_FLTR_PTYPE_NON_IP_L2;
+			next_type = (item + 1)->type;
+			/* Ignore this field except for ICE_FLTR_PTYPE_NON_IP_L2 */
+			if (eth_mask->type == RTE_BE16(0xffff) &&
+			    next_type == RTE_FLOW_ITEM_TYPE_END) {
+				*input_set |= ICE_INSET_ETHERTYPE;
+				ether_type = rte_be_to_cpu_16(eth_spec->type);
+
+				if (ether_type == RTE_ETHER_TYPE_IPV4 ||
+				    ether_type == RTE_ETHER_TYPE_IPV6) {
+					rte_flow_error_set(error, EINVAL,
+							   RTE_FLOW_ERROR_TYPE_ITEM,
+							   item,
+							   "Unsupported ether_type.");
+					return -rte_errno;
 				}
 			}
+
+			p_ext_data = (tunnel_type && is_outer) ?
+				     &filter->input.ext_data_outer :
+				     &filter->input.ext_data;
+			rte_memcpy(&p_ext_data->src_mac,
+				   &eth_spec->src, RTE_ETHER_ADDR_LEN);
+			rte_memcpy(&p_ext_data->dst_mac,
+				   &eth_spec->dst, RTE_ETHER_ADDR_LEN);
+			rte_memcpy(&p_ext_data->ether_type,
+				   &eth_spec->type, sizeof(eth_spec->type));
 			break;
 		case RTE_FLOW_ITEM_TYPE_IPV4:
+			flow_type = ICE_FLTR_PTYPE_NONF_IPV4_OTHER;
 			l3 = RTE_FLOW_ITEM_TYPE_IPV4;
 			ipv4_spec = item->spec;
 			ipv4_mask = item->mask;
 
-			if (ipv4_spec && ipv4_mask) {
-				/* Check IPv4 mask and update input set */
-				if (ipv4_mask->hdr.version_ihl ||
-				    ipv4_mask->hdr.total_length ||
-				    ipv4_mask->hdr.packet_id ||
-				    ipv4_mask->hdr.fragment_offset ||
-				    ipv4_mask->hdr.hdr_checksum) {
-					rte_flow_error_set(error, EINVAL,
+			if (!(ipv4_spec && ipv4_mask))
+				break;
+
+			/* Check IPv4 mask and update input set */
+			if (ipv4_mask->hdr.version_ihl ||
+			    ipv4_mask->hdr.total_length ||
+			    ipv4_mask->hdr.packet_id ||
+			    ipv4_mask->hdr.fragment_offset ||
+			    ipv4_mask->hdr.hdr_checksum) {
+				rte_flow_error_set(error, EINVAL,
 						   RTE_FLOW_ERROR_TYPE_ITEM,
 						   item,
 						   "Invalid IPv4 mask.");
-					return -rte_errno;
-				}
-				if (ipv4_mask->hdr.src_addr == UINT32_MAX)
-					input_set |= tunnel_type ?
-						     ICE_INSET_TUN_IPV4_SRC :
-						     ICE_INSET_IPV4_SRC;
-				if (ipv4_mask->hdr.dst_addr == UINT32_MAX)
-					input_set |= tunnel_type ?
-						     ICE_INSET_TUN_IPV4_DST :
-						     ICE_INSET_IPV4_DST;
-				if (ipv4_mask->hdr.type_of_service == UINT8_MAX)
-					input_set |= ICE_INSET_IPV4_TOS;
-				if (ipv4_mask->hdr.time_to_live == UINT8_MAX)
-					input_set |= ICE_INSET_IPV4_TTL;
-				if (ipv4_mask->hdr.next_proto_id == UINT8_MAX)
-					input_set |= ICE_INSET_IPV4_PROTO;
-
-				filter->input.ip.v4.dst_ip =
-					ipv4_spec->hdr.dst_addr;
-				filter->input.ip.v4.src_ip =
-					ipv4_spec->hdr.src_addr;
-				filter->input.ip.v4.tos =
-					ipv4_spec->hdr.type_of_service;
-				filter->input.ip.v4.ttl =
-					ipv4_spec->hdr.time_to_live;
-				filter->input.ip.v4.proto =
-					ipv4_spec->hdr.next_proto_id;
+				return -rte_errno;
 			}
 
-			flow_type = ICE_FLTR_PTYPE_NONF_IPV4_OTHER;
+			if (ipv4_mask->hdr.dst_addr == UINT32_MAX)
+				*input_set |= ICE_INSET_IPV4_DST;
+			if (ipv4_mask->hdr.src_addr == UINT32_MAX)
+				*input_set |= ICE_INSET_IPV4_SRC;
+			if (ipv4_mask->hdr.type_of_service == UINT8_MAX)
+				*input_set |= ICE_INSET_IPV4_TOS;
+
+			p_v4 = (tunnel_type && is_outer) ?
+			       &filter->input.ip_outer.v4 :
+			       &filter->input.ip.v4;
+			p_v4->dst_ip = ipv4_spec->hdr.dst_addr;
+			p_v4->src_ip = ipv4_spec->hdr.src_addr;
+			p_v4->tos = ipv4_spec->hdr.type_of_service;
 			break;
 		case RTE_FLOW_ITEM_TYPE_IPV6:
+			flow_type = ICE_FLTR_PTYPE_NONF_IPV6_OTHER;
 			l3 = RTE_FLOW_ITEM_TYPE_IPV6;
 			ipv6_spec = item->spec;
 			ipv6_mask = item->mask;
 
-			if (ipv6_spec && ipv6_mask) {
-				/* Check IPv6 mask and update input set */
-				if (ipv6_mask->hdr.payload_len) {
-					rte_flow_error_set(error, EINVAL,
+			if (!(ipv6_spec && ipv6_mask))
+				break;
+
+			/* Check IPv6 mask and update input set */
+			if (ipv6_mask->hdr.payload_len) {
+				rte_flow_error_set(error, EINVAL,
 						   RTE_FLOW_ERROR_TYPE_ITEM,
 						   item,
 						   "Invalid IPv6 mask");
-					return -rte_errno;
-				}
-
-				if (!memcmp(ipv6_mask->hdr.src_addr,
-					    ipv6_addr_mask,
-					    RTE_DIM(ipv6_mask->hdr.src_addr)))
-					input_set |= ICE_INSET_IPV6_SRC;
-				if (!memcmp(ipv6_mask->hdr.dst_addr,
-					    ipv6_addr_mask,
-					    RTE_DIM(ipv6_mask->hdr.dst_addr)))
-					input_set |= ICE_INSET_IPV6_DST;
-
-				if ((ipv6_mask->hdr.vtc_flow &
-				     rte_cpu_to_be_32(ICE_IPV6_TC_MASK))
-				    == rte_cpu_to_be_32(ICE_IPV6_TC_MASK))
-					input_set |= ICE_INSET_IPV6_TC;
-				if (ipv6_mask->hdr.proto == UINT8_MAX)
-					input_set |= ICE_INSET_IPV6_NEXT_HDR;
-				if (ipv6_mask->hdr.hop_limits == UINT8_MAX)
-					input_set |= ICE_INSET_IPV6_HOP_LIMIT;
-
-				rte_memcpy(filter->input.ip.v6.dst_ip,
-					   ipv6_spec->hdr.dst_addr, 16);
-				rte_memcpy(filter->input.ip.v6.src_ip,
-					   ipv6_spec->hdr.src_addr, 16);
-
-				vtc_flow_cpu =
-				      rte_be_to_cpu_32(ipv6_spec->hdr.vtc_flow);
-				filter->input.ip.v6.tc =
-					(uint8_t)(vtc_flow_cpu >>
-						  ICE_FDIR_IPV6_TC_OFFSET);
-				filter->input.ip.v6.proto =
-					ipv6_spec->hdr.proto;
-				filter->input.ip.v6.hlim =
-					ipv6_spec->hdr.hop_limits;
+				return -rte_errno;
 			}
 
-			flow_type = ICE_FLTR_PTYPE_NONF_IPV6_OTHER;
+			if (!memcmp(ipv6_mask->hdr.src_addr, ipv6_addr_mask,
+				    RTE_DIM(ipv6_mask->hdr.src_addr)))
+				*input_set |= ICE_INSET_IPV6_SRC;
+			if (!memcmp(ipv6_mask->hdr.dst_addr, ipv6_addr_mask,
+				    RTE_DIM(ipv6_mask->hdr.dst_addr)))
+				*input_set |= ICE_INSET_IPV6_DST;
+
+			if ((ipv6_mask->hdr.vtc_flow &
+			     rte_cpu_to_be_32(ICE_IPV6_TC_MASK))
+			    == rte_cpu_to_be_32(ICE_IPV6_TC_MASK))
+				*input_set |= ICE_INSET_IPV6_TC;
+			if (ipv6_mask->hdr.proto == UINT8_MAX)
+				*input_set |= ICE_INSET_IPV6_NEXT_HDR;
+			if (ipv6_mask->hdr.hop_limits == UINT8_MAX)
+				*input_set |= ICE_INSET_IPV6_HOP_LIMIT;
+
+			p_v6 = (tunnel_type && is_outer) ?
+			       &filter->input.ip_outer.v6 :
+			       &filter->input.ip.v6;
+			rte_memcpy(&p_v6->dst_ip, ipv6_spec->hdr.dst_addr, 16);
+			rte_memcpy(&p_v6->src_ip, ipv6_spec->hdr.src_addr, 16);
+			vtc_flow_cpu = rte_be_to_cpu_32(ipv6_spec->hdr.vtc_flow);
+			p_v6->tc = (uint8_t)(vtc_flow_cpu >> ICE_FDIR_IPV6_TC_OFFSET);
+			p_v6->proto = ipv6_spec->hdr.proto;
+			p_v6->hlim = ipv6_spec->hdr.hop_limits;
 			break;
 		case RTE_FLOW_ITEM_TYPE_TCP:
-			tcp_spec = item->spec;
-			tcp_mask = item->mask;
-
 			if (l3 == RTE_FLOW_ITEM_TYPE_IPV4)
 				flow_type = ICE_FLTR_PTYPE_NONF_IPV4_TCP;
-			else if (l3 == RTE_FLOW_ITEM_TYPE_IPV6)
+			if (l3 == RTE_FLOW_ITEM_TYPE_IPV6)
 				flow_type = ICE_FLTR_PTYPE_NONF_IPV6_TCP;
 
-			if (tcp_spec && tcp_mask) {
-				/* Check TCP mask and update input set */
-				if (tcp_mask->hdr.sent_seq ||
-				    tcp_mask->hdr.recv_ack ||
-				    tcp_mask->hdr.data_off ||
-				    tcp_mask->hdr.tcp_flags ||
-				    tcp_mask->hdr.rx_win ||
-				    tcp_mask->hdr.cksum ||
-				    tcp_mask->hdr.tcp_urp) {
-					rte_flow_error_set(error, EINVAL,
+			tcp_spec = item->spec;
+			tcp_mask = item->mask;
+
+			if (!(tcp_spec && tcp_mask))
+				break;
+
+			/* Check TCP mask and update input set */
+			if (tcp_mask->hdr.sent_seq ||
+			    tcp_mask->hdr.recv_ack ||
+			    tcp_mask->hdr.data_off ||
+			    tcp_mask->hdr.tcp_flags ||
+			    tcp_mask->hdr.rx_win ||
+			    tcp_mask->hdr.cksum ||
+			    tcp_mask->hdr.tcp_urp) {
+				rte_flow_error_set(error, EINVAL,
 						   RTE_FLOW_ERROR_TYPE_ITEM,
 						   item,
 						   "Invalid TCP mask");
-					return -rte_errno;
-				}
+				return -rte_errno;
+			}
 
-				if (tcp_mask->hdr.src_port == UINT16_MAX)
-					input_set |= tunnel_type ?
-						     ICE_INSET_TUN_TCP_SRC_PORT :
-						     ICE_INSET_TCP_SRC_PORT;
-				if (tcp_mask->hdr.dst_port == UINT16_MAX)
-					input_set |= tunnel_type ?
-						     ICE_INSET_TUN_TCP_DST_PORT :
-						     ICE_INSET_TCP_DST_PORT;
-
-				/* Get filter info */
-				if (l3 == RTE_FLOW_ITEM_TYPE_IPV4) {
-					filter->input.ip.v4.dst_port =
-						tcp_spec->hdr.dst_port;
-					filter->input.ip.v4.src_port =
-						tcp_spec->hdr.src_port;
-				} else if (l3 == RTE_FLOW_ITEM_TYPE_IPV6) {
-					filter->input.ip.v6.dst_port =
-						tcp_spec->hdr.dst_port;
-					filter->input.ip.v6.src_port =
-						tcp_spec->hdr.src_port;
-				}
+			if (tcp_mask->hdr.src_port == UINT16_MAX)
+				*input_set |= ICE_INSET_TCP_SRC_PORT;
+			if (tcp_mask->hdr.dst_port == UINT16_MAX)
+				*input_set |= ICE_INSET_TCP_DST_PORT;
+
+			/* Get filter info */
+			if (l3 == RTE_FLOW_ITEM_TYPE_IPV4) {
+				p_v4->dst_port = tcp_spec->hdr.dst_port;
+				p_v4->src_port = tcp_spec->hdr.src_port;
+			} else if (l3 == RTE_FLOW_ITEM_TYPE_IPV6) {
+				p_v6->dst_port = tcp_spec->hdr.dst_port;
+				p_v6->src_port = tcp_spec->hdr.src_port;
 			}
 			break;
 		case RTE_FLOW_ITEM_TYPE_UDP:
-			udp_spec = item->spec;
-			udp_mask = item->mask;
-
 			if (l3 == RTE_FLOW_ITEM_TYPE_IPV4)
 				flow_type = ICE_FLTR_PTYPE_NONF_IPV4_UDP;
-			else if (l3 == RTE_FLOW_ITEM_TYPE_IPV6)
+			if (l3 == RTE_FLOW_ITEM_TYPE_IPV6)
 				flow_type = ICE_FLTR_PTYPE_NONF_IPV6_UDP;
 
-			if (udp_spec && udp_mask) {
-				/* Check UDP mask and update input set*/
-				if (udp_mask->hdr.dgram_len ||
-				    udp_mask->hdr.dgram_cksum) {
-					rte_flow_error_set(error, EINVAL,
+			udp_spec = item->spec;
+			udp_mask = item->mask;
+
+			if (!(udp_spec && udp_mask))
+				break;
+
+			/* Check UDP mask and update input set*/
+			if (udp_mask->hdr.dgram_len ||
+			    udp_mask->hdr.dgram_cksum) {
+				rte_flow_error_set(error, EINVAL,
 						   RTE_FLOW_ERROR_TYPE_ITEM,
 						   item,
 						   "Invalid UDP mask");
-					return -rte_errno;
-				}
+				return -rte_errno;
+			}
 
-				if (udp_mask->hdr.src_port == UINT16_MAX)
-					input_set |= tunnel_type ?
-						     ICE_INSET_TUN_UDP_SRC_PORT :
-						     ICE_INSET_UDP_SRC_PORT;
-				if (udp_mask->hdr.dst_port == UINT16_MAX)
-					input_set |= tunnel_type ?
-						     ICE_INSET_TUN_UDP_DST_PORT :
-						     ICE_INSET_UDP_DST_PORT;
-
-				/* Get filter info */
-				if (l3 == RTE_FLOW_ITEM_TYPE_IPV4) {
-					filter->input.ip.v4.dst_port =
-						udp_spec->hdr.dst_port;
-					filter->input.ip.v4.src_port =
-						udp_spec->hdr.src_port;
-				} else if (l3 == RTE_FLOW_ITEM_TYPE_IPV6) {
-					filter->input.ip.v6.src_port =
-						udp_spec->hdr.src_port;
-					filter->input.ip.v6.dst_port =
-						udp_spec->hdr.dst_port;
-				}
+			if (udp_mask->hdr.src_port == UINT16_MAX)
+				*input_set |= ICE_INSET_UDP_SRC_PORT;
+			if (udp_mask->hdr.dst_port == UINT16_MAX)
+				*input_set |= ICE_INSET_UDP_DST_PORT;
+
+			/* Get filter info */
+			if (l3 == RTE_FLOW_ITEM_TYPE_IPV4) {
+				p_v4->dst_port = udp_spec->hdr.dst_port;
+				p_v4->src_port = udp_spec->hdr.src_port;
+			} else if (l3 == RTE_FLOW_ITEM_TYPE_IPV6) {
+				p_v6->src_port = udp_spec->hdr.src_port;
+				p_v6->dst_port = udp_spec->hdr.dst_port;
 			}
 			break;
 		case RTE_FLOW_ITEM_TYPE_SCTP:
-			sctp_spec = item->spec;
-			sctp_mask = item->mask;
-
 			if (l3 == RTE_FLOW_ITEM_TYPE_IPV4)
 				flow_type = ICE_FLTR_PTYPE_NONF_IPV4_SCTP;
-			else if (l3 == RTE_FLOW_ITEM_TYPE_IPV6)
+			if (l3 == RTE_FLOW_ITEM_TYPE_IPV6)
 				flow_type = ICE_FLTR_PTYPE_NONF_IPV6_SCTP;
 
-			if (sctp_spec && sctp_mask) {
-				/* Check SCTP mask and update input set */
-				if (sctp_mask->hdr.cksum) {
-					rte_flow_error_set(error, EINVAL,
+			sctp_spec = item->spec;
+			sctp_mask = item->mask;
+
+			if (!(sctp_spec && sctp_mask))
+				break;
+
+			/* Check SCTP mask and update input set */
+			if (sctp_mask->hdr.cksum) {
+				rte_flow_error_set(error, EINVAL,
 						   RTE_FLOW_ERROR_TYPE_ITEM,
 						   item,
 						   "Invalid UDP mask");
-					return -rte_errno;
-				}
+				return -rte_errno;
+			}
 
-				if (sctp_mask->hdr.src_port == UINT16_MAX)
-					input_set |= tunnel_type ?
-						     ICE_INSET_TUN_SCTP_SRC_PORT :
-						     ICE_INSET_SCTP_SRC_PORT;
-				if (sctp_mask->hdr.dst_port == UINT16_MAX)
-					input_set |= tunnel_type ?
-						     ICE_INSET_TUN_SCTP_DST_PORT :
-						     ICE_INSET_SCTP_DST_PORT;
-
-				/* Get filter info */
-				if (l3 == RTE_FLOW_ITEM_TYPE_IPV4) {
-					filter->input.ip.v4.dst_port =
-						sctp_spec->hdr.dst_port;
-					filter->input.ip.v4.src_port =
-						sctp_spec->hdr.src_port;
-				} else if (l3 == RTE_FLOW_ITEM_TYPE_IPV6) {
-					filter->input.ip.v6.dst_port =
-						sctp_spec->hdr.dst_port;
-					filter->input.ip.v6.src_port =
-						sctp_spec->hdr.src_port;
-				}
+			if (sctp_mask->hdr.src_port == UINT16_MAX)
+				*input_set |= ICE_INSET_SCTP_SRC_PORT;
+			if (sctp_mask->hdr.dst_port == UINT16_MAX)
+				*input_set |= ICE_INSET_SCTP_DST_PORT;
+
+			/* Get filter info */
+			if (l3 == RTE_FLOW_ITEM_TYPE_IPV4) {
+				p_v4->dst_port = sctp_spec->hdr.dst_port;
+				p_v4->src_port = sctp_spec->hdr.src_port;
+			} else if (l3 == RTE_FLOW_ITEM_TYPE_IPV6) {
+				p_v6->dst_port = sctp_spec->hdr.dst_port;
+				p_v6->src_port = sctp_spec->hdr.src_port;
 			}
 			break;
 		case RTE_FLOW_ITEM_TYPE_VOID:
@@ -1946,6 +1935,7 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
 			l3 = RTE_FLOW_ITEM_TYPE_END;
 			vxlan_spec = item->spec;
 			vxlan_mask = item->mask;
+			is_outer = false;
 
 			if (vxlan_spec || vxlan_mask) {
 				rte_flow_error_set(error, EINVAL,
@@ -1955,50 +1945,50 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
 				return -rte_errno;
 			}
 
-			tunnel_type = ICE_FDIR_TUNNEL_TYPE_VXLAN;
 			break;
 		case RTE_FLOW_ITEM_TYPE_GTPU:
 			l3 = RTE_FLOW_ITEM_TYPE_END;
 			gtp_spec = item->spec;
 			gtp_mask = item->mask;
+			is_outer = false;
 
-			if (gtp_spec && gtp_mask) {
-				if (gtp_mask->v_pt_rsv_flags ||
-				    gtp_mask->msg_type ||
-				    gtp_mask->msg_len) {
-					rte_flow_error_set(error, EINVAL,
+			if (!(gtp_spec && gtp_mask))
+				break;
+
+			if (gtp_mask->v_pt_rsv_flags ||
+			    gtp_mask->msg_type ||
+			    gtp_mask->msg_len) {
+				rte_flow_error_set(error, EINVAL,
 						   RTE_FLOW_ERROR_TYPE_ITEM,
 						   item,
 						   "Invalid GTP mask");
-					return -rte_errno;
-				}
-
-				if (gtp_mask->teid == UINT32_MAX)
-					input_set |= ICE_INSET_GTPU_TEID;
-
-				filter->input.gtpu_data.teid = gtp_spec->teid;
+				return -rte_errno;
 			}
 
-			tunnel_type = ICE_FDIR_TUNNEL_TYPE_GTPU;
+			if (gtp_mask->teid == UINT32_MAX)
+				*input_set |= ICE_INSET_GTPU_TEID;
+
+			filter->input.gtpu_data.teid = gtp_spec->teid;
 			break;
 		case RTE_FLOW_ITEM_TYPE_GTP_PSC:
 			gtp_psc_spec = item->spec;
 			gtp_psc_mask = item->mask;
+			is_outer = false;
 
-			if (gtp_psc_spec && gtp_psc_mask) {
-				if (gtp_psc_mask->qfi == UINT8_MAX)
-					input_set |= ICE_INSET_GTPU_QFI;
+			if (!(gtp_psc_spec && gtp_psc_mask))
+				break;
 
-				filter->input.gtpu_data.qfi =
-					gtp_psc_spec->qfi;
-			}
-			tunnel_type = ICE_FDIR_TUNNEL_TYPE_GTPU_EH;
+			if (gtp_psc_mask->qfi == UINT8_MAX)
+				*input_set |= ICE_INSET_GTPU_QFI;
+
+			filter->input.gtpu_data.qfi =
+				gtp_psc_spec->qfi;
 			break;
 		default:
 			rte_flow_error_set(error, EINVAL,
-				   RTE_FLOW_ERROR_TYPE_ITEM,
-				   item,
-				   "Invalid pattern item.");
+					   RTE_FLOW_ERROR_TYPE_ITEM,
+					   item,
+					   "Invalid pattern item.");
 			return -rte_errno;
 		}
 	}
@@ -2018,7 +2008,8 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
 
 	filter->tunnel_type = tunnel_type;
 	filter->input.flow_type = flow_type;
-	filter->input_set = input_set;
+	filter->input_set = input_set_l;
+	filter->outer_input_set = input_set_f;
 
 	return 0;
 }
-- 
2.25.1


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

* [dpdk-dev] [PATCH v1 3/5] net/ice: add outer input set mask to distinguish outer fields
  2020-12-21  6:51 [dpdk-dev] [PATCH v1 0/5] Refactor FDIR pattern parser Zhirun Yan
  2020-12-21  6:51 ` [dpdk-dev] [PATCH v1 1/5] net/ice: clean input set macro definition Zhirun Yan
  2020-12-21  6:51 ` [dpdk-dev] [PATCH v1 2/5] net/ice: refactor flow pattern parser Zhirun Yan
@ 2020-12-21  6:51 ` Zhirun Yan
  2020-12-25  5:27   ` Cao, Yahui
  2020-12-21  6:51 ` [dpdk-dev] [PATCH v1 4/5] net/ice: add outer input set mask check Zhirun Yan
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 24+ messages in thread
From: Zhirun Yan @ 2020-12-21  6:51 UTC (permalink / raw)
  To: dev, qi.z.zhang, yahui.cao, xiao.w.wang, junfeng.guo
  Cc: simei.su, ting.xu, yuying.zhang, Zhirun Yan

Add 64-bit input_set_mask_f for outer input set. input_set_mask_f is
used for inner fields or non-tunnel fields. Adjust indentation of
ice_pattern_match_item list in switch, RSS and FDIR for easy
review. For fields in tunnel layer, like GTPU TEID, put them in
outer part.

Signed-off-by: Zhirun Yan <zhirun.yan@intel.com>
---
 drivers/net/ice/ice_fdir_filter.c   | 110 ++++-----
 drivers/net/ice/ice_generic_flow.h  |   1 +
 drivers/net/ice/ice_hash.c          | 192 ++++++---------
 drivers/net/ice/ice_switch_filter.c | 348 ++++++++++------------------
 4 files changed, 231 insertions(+), 420 deletions(-)

diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c
index 1f2576a444..76e0a8df38 100644
--- a/drivers/net/ice/ice_fdir_filter.c
+++ b/drivers/net/ice/ice_fdir_filter.c
@@ -55,92 +55,74 @@
 	ICE_FDIR_INSET_ETH_IPV6 | \
 	ICE_INSET_SCTP_SRC_PORT | ICE_INSET_SCTP_DST_PORT)
 
-#define ICE_FDIR_INSET_VXLAN_IPV4 (\
+#define ICE_FDIR_INSET_VXLAN_IPV4_L (\
 	ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST)
 
-#define ICE_FDIR_INSET_VXLAN_IPV4_TCP (\
-	ICE_FDIR_INSET_VXLAN_IPV4 | \
+#define ICE_FDIR_INSET_VXLAN_IPV4_TCP_L (\
+	ICE_FDIR_INSET_VXLAN_IPV4_L | \
 	ICE_INSET_TCP_SRC_PORT | ICE_INSET_TCP_DST_PORT)
 
-#define ICE_FDIR_INSET_VXLAN_IPV4_UDP (\
-	ICE_FDIR_INSET_VXLAN_IPV4 | \
+#define ICE_FDIR_INSET_VXLAN_IPV4_UDP_L (\
+	ICE_FDIR_INSET_VXLAN_IPV4_L | \
 	ICE_INSET_UDP_SRC_PORT | ICE_INSET_UDP_DST_PORT)
 
-#define ICE_FDIR_INSET_VXLAN_IPV4_SCTP (\
-	ICE_FDIR_INSET_VXLAN_IPV4 | \
+#define ICE_FDIR_INSET_VXLAN_IPV4_SCTP_L (\
+	ICE_FDIR_INSET_VXLAN_IPV4_L | \
 	ICE_INSET_SCTP_SRC_PORT | ICE_INSET_SCTP_DST_PORT)
 
-#define ICE_FDIR_INSET_IPV4_GTPU (\
+#define ICE_FDIR_INSET_IPV4_GTPU_F (\
 	ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST | ICE_INSET_GTPU_TEID)
 
-#define ICE_FDIR_INSET_IPV4_GTPU_EH (\
+#define ICE_FDIR_INSET_IPV4_GTPU_EH_F (\
 	ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST | \
 	ICE_INSET_GTPU_TEID | ICE_INSET_GTPU_QFI)
 
-#define ICE_FDIR_INSET_IPV6_GTPU (\
+#define ICE_FDIR_INSET_IPV6_GTPU_F (\
 	ICE_INSET_IPV6_SRC | ICE_INSET_IPV6_DST | ICE_INSET_GTPU_TEID)
 
-#define ICE_FDIR_INSET_IPV6_GTPU_EH (\
+#define ICE_FDIR_INSET_IPV6_GTPU_EH_F (\
 	ICE_INSET_IPV6_SRC | ICE_INSET_IPV6_DST | \
 	ICE_INSET_GTPU_TEID | ICE_INSET_GTPU_QFI)
 
 static struct ice_pattern_match_item ice_fdir_pattern_os[] = {
-	{pattern_eth_ipv4,             ICE_FDIR_INSET_ETH_IPV4,              ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp,         ICE_FDIR_INSET_ETH_IPV4_UDP,          ICE_INSET_NONE},
-	{pattern_eth_ipv4_tcp,         ICE_FDIR_INSET_ETH_IPV4_TCP,          ICE_INSET_NONE},
-	{pattern_eth_ipv4_sctp,        ICE_FDIR_INSET_ETH_IPV4_SCTP,         ICE_INSET_NONE},
-	{pattern_eth_ipv6,             ICE_FDIR_INSET_ETH_IPV6,              ICE_INSET_NONE},
-	{pattern_eth_ipv6_udp,         ICE_FDIR_INSET_ETH_IPV6_UDP,          ICE_INSET_NONE},
-	{pattern_eth_ipv6_tcp,         ICE_FDIR_INSET_ETH_IPV6_TCP,          ICE_INSET_NONE},
-	{pattern_eth_ipv6_sctp,        ICE_FDIR_INSET_ETH_IPV6_SCTP,         ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_ipv4,
-				       ICE_FDIR_INSET_VXLAN_IPV4,            ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_ipv4_udp,
-				       ICE_FDIR_INSET_VXLAN_IPV4_UDP,        ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_ipv4_tcp,
-				       ICE_FDIR_INSET_VXLAN_IPV4_TCP,        ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_ipv4_sctp,
-				       ICE_FDIR_INSET_VXLAN_IPV4_SCTP,       ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_eth_ipv4,
-				       ICE_FDIR_INSET_VXLAN_IPV4,            ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_udp,
-				       ICE_FDIR_INSET_VXLAN_IPV4_UDP,        ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_tcp,
-				       ICE_FDIR_INSET_VXLAN_IPV4_TCP,        ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_sctp,
-				       ICE_FDIR_INSET_VXLAN_IPV4_SCTP,       ICE_INSET_NONE},
+	{pattern_eth_ipv4,				ICE_INSET_NONE,			ICE_FDIR_INSET_ETH_IPV4,		ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp,				ICE_INSET_NONE,			ICE_FDIR_INSET_ETH_IPV4_UDP,		ICE_INSET_NONE},
+	{pattern_eth_ipv4_tcp,				ICE_INSET_NONE,			ICE_FDIR_INSET_ETH_IPV4_TCP,		ICE_INSET_NONE},
+	{pattern_eth_ipv4_sctp,				ICE_INSET_NONE,			ICE_FDIR_INSET_ETH_IPV4_SCTP,		ICE_INSET_NONE},
+	{pattern_eth_ipv6,				ICE_INSET_NONE,			ICE_FDIR_INSET_ETH_IPV6,		ICE_INSET_NONE},
+	{pattern_eth_ipv6_udp,				ICE_INSET_NONE,			ICE_FDIR_INSET_ETH_IPV6_UDP,		ICE_INSET_NONE},
+	{pattern_eth_ipv6_tcp,				ICE_INSET_NONE,			ICE_FDIR_INSET_ETH_IPV6_TCP,		ICE_INSET_NONE},
+	{pattern_eth_ipv6_sctp,				ICE_INSET_NONE,			ICE_FDIR_INSET_ETH_IPV6_SCTP,		ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_ipv4,		ICE_INSET_NONE,			ICE_FDIR_INSET_VXLAN_IPV4_L,		ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_ipv4_udp,		ICE_INSET_NONE,			ICE_FDIR_INSET_VXLAN_IPV4_UDP_L,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_ipv4_tcp,		ICE_INSET_NONE,			ICE_FDIR_INSET_VXLAN_IPV4_TCP_L,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_ipv4_sctp,		ICE_INSET_NONE,			ICE_FDIR_INSET_VXLAN_IPV4_SCTP_L,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_eth_ipv4,		ICE_INSET_NONE,			ICE_FDIR_INSET_VXLAN_IPV4_L,		ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_udp,	ICE_INSET_NONE,			ICE_FDIR_INSET_VXLAN_IPV4_UDP_L,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_tcp,	ICE_INSET_NONE,			ICE_FDIR_INSET_VXLAN_IPV4_TCP_L,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_sctp,	ICE_INSET_NONE,			ICE_FDIR_INSET_VXLAN_IPV4_SCTP_L,	ICE_INSET_NONE},
 };
 
 static struct ice_pattern_match_item ice_fdir_pattern_comms[] = {
-	{pattern_ethertype,	       ICE_FDIR_INSET_ETH,		     ICE_INSET_NONE},
-	{pattern_eth_ipv4,             ICE_FDIR_INSET_ETH_IPV4,              ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp,         ICE_FDIR_INSET_ETH_IPV4_UDP,          ICE_INSET_NONE},
-	{pattern_eth_ipv4_tcp,         ICE_FDIR_INSET_ETH_IPV4_TCP,          ICE_INSET_NONE},
-	{pattern_eth_ipv4_sctp,        ICE_FDIR_INSET_ETH_IPV4_SCTP,         ICE_INSET_NONE},
-	{pattern_eth_ipv6,             ICE_FDIR_INSET_ETH_IPV6,              ICE_INSET_NONE},
-	{pattern_eth_ipv6_udp,         ICE_FDIR_INSET_ETH_IPV6_UDP,          ICE_INSET_NONE},
-	{pattern_eth_ipv6_tcp,         ICE_FDIR_INSET_ETH_IPV6_TCP,          ICE_INSET_NONE},
-	{pattern_eth_ipv6_sctp,        ICE_FDIR_INSET_ETH_IPV6_SCTP,         ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_ipv4,
-				       ICE_FDIR_INSET_VXLAN_IPV4,            ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_ipv4_udp,
-				       ICE_FDIR_INSET_VXLAN_IPV4_UDP,        ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_ipv4_tcp,
-				       ICE_FDIR_INSET_VXLAN_IPV4_TCP,        ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_ipv4_sctp,
-				       ICE_FDIR_INSET_VXLAN_IPV4_SCTP,       ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_eth_ipv4,
-				       ICE_FDIR_INSET_VXLAN_IPV4,            ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_udp,
-				       ICE_FDIR_INSET_VXLAN_IPV4_UDP,        ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_tcp,
-				       ICE_FDIR_INSET_VXLAN_IPV4_TCP,        ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_sctp,
-				       ICE_FDIR_INSET_VXLAN_IPV4_SCTP,       ICE_INSET_NONE},
-	{pattern_eth_ipv4_gtpu,	       ICE_FDIR_INSET_IPV4_GTPU,             ICE_INSET_NONE},
-	{pattern_eth_ipv4_gtpu_eh,     ICE_FDIR_INSET_IPV4_GTPU_EH,          ICE_INSET_NONE},
-	{pattern_eth_ipv6_gtpu,	       ICE_FDIR_INSET_IPV6_GTPU,             ICE_INSET_NONE},
-	{pattern_eth_ipv6_gtpu_eh,     ICE_FDIR_INSET_IPV6_GTPU_EH,          ICE_INSET_NONE},
+	{pattern_ethertype,				ICE_INSET_NONE,			ICE_FDIR_INSET_ETH,			ICE_INSET_NONE},
+	{pattern_eth_ipv4,				ICE_INSET_NONE,			ICE_FDIR_INSET_ETH_IPV4,		ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp,				ICE_INSET_NONE,			ICE_FDIR_INSET_ETH_IPV4_UDP,		ICE_INSET_NONE},
+	{pattern_eth_ipv4_tcp,				ICE_INSET_NONE,			ICE_FDIR_INSET_ETH_IPV4_TCP,		ICE_INSET_NONE},
+	{pattern_eth_ipv4_sctp,				ICE_INSET_NONE,			ICE_FDIR_INSET_ETH_IPV4_SCTP,		ICE_INSET_NONE},
+	{pattern_eth_ipv6,				ICE_INSET_NONE,			ICE_FDIR_INSET_ETH_IPV6,		ICE_INSET_NONE},
+	{pattern_eth_ipv6_udp,				ICE_INSET_NONE,			ICE_FDIR_INSET_ETH_IPV6_UDP,		ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_ipv4,		ICE_INSET_NONE,			ICE_FDIR_INSET_VXLAN_IPV4_L,		ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_ipv4_udp,		ICE_INSET_NONE,			ICE_FDIR_INSET_VXLAN_IPV4_UDP_L,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_ipv4_tcp,		ICE_INSET_NONE,			ICE_FDIR_INSET_VXLAN_IPV4_TCP_L,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_ipv4_sctp,		ICE_INSET_NONE,			ICE_FDIR_INSET_VXLAN_IPV4_SCTP_L,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_eth_ipv4,		ICE_INSET_NONE,			ICE_FDIR_INSET_VXLAN_IPV4_L,		ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_udp,	ICE_INSET_NONE,			ICE_FDIR_INSET_VXLAN_IPV4_UDP_L,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_tcp,	ICE_INSET_NONE,			ICE_FDIR_INSET_VXLAN_IPV4_TCP_L,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_sctp,	ICE_INSET_NONE,			ICE_FDIR_INSET_VXLAN_IPV4_SCTP_L,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu,				ICE_FDIR_INSET_IPV4_GTPU_F,	ICE_INSET_NONE,				ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh,			ICE_FDIR_INSET_IPV4_GTPU_EH_F,	ICE_INSET_NONE,				ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu,				ICE_FDIR_INSET_IPV6_GTPU_F,	ICE_INSET_NONE,				ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh,			ICE_FDIR_INSET_IPV6_GTPU_EH_F,	ICE_INSET_NONE,				ICE_INSET_NONE},
 };
 
 static struct ice_flow_parser ice_fdir_parser_os;
diff --git a/drivers/net/ice/ice_generic_flow.h b/drivers/net/ice/ice_generic_flow.h
index a03b2fc21d..f15c262625 100644
--- a/drivers/net/ice/ice_generic_flow.h
+++ b/drivers/net/ice/ice_generic_flow.h
@@ -473,6 +473,7 @@ enum ice_flow_classification_stage {
 struct ice_pattern_match_item {
 	enum rte_flow_item_type *pattern_list;
 	/* pattern_list must end with RTE_FLOW_ITEM_TYPE_END */
+	uint64_t input_set_mask_f;
 	uint64_t input_set_mask;
 	void *meta;
 };
diff --git a/drivers/net/ice/ice_hash.c b/drivers/net/ice/ice_hash.c
index fe3e06c579..72558161bf 100644
--- a/drivers/net/ice/ice_hash.c
+++ b/drivers/net/ice/ice_hash.c
@@ -315,135 +315,77 @@ struct rss_type_match_hdr hint_eth_pppoes = {
 
 /* Supported pattern for os default package. */
 static struct ice_pattern_match_item ice_hash_pattern_list_os[] = {
-	{pattern_eth_ipv4,	ICE_INSET_NONE,	&hint_eth_ipv4},
-	{pattern_eth_ipv4_udp,	ICE_INSET_NONE,	&hint_eth_ipv4_udp},
-	{pattern_eth_ipv4_tcp,	ICE_INSET_NONE,	&hint_eth_ipv4_tcp},
-	{pattern_eth_ipv4_sctp,	ICE_INSET_NONE,	&hint_eth_ipv4_sctp},
-	{pattern_eth_ipv6,	ICE_INSET_NONE,	&hint_eth_ipv6},
-	{pattern_eth_ipv6_udp,	ICE_INSET_NONE,	&hint_eth_ipv6_udp},
-	{pattern_eth_ipv6_tcp,	ICE_INSET_NONE,	&hint_eth_ipv6_tcp},
-	{pattern_eth_ipv6_sctp,	ICE_INSET_NONE,	&hint_eth_ipv6_sctp},
-	{pattern_empty,		ICE_INSET_NONE,	&hint_empty},
+	{pattern_eth_ipv4,	ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_ipv4},
+	{pattern_eth_ipv4_udp,	ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_ipv4_udp},
+	{pattern_eth_ipv4_tcp,	ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_ipv4_tcp},
+	{pattern_eth_ipv4_sctp,	ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_ipv4_sctp},
+	{pattern_eth_ipv6,	ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_ipv6},
+	{pattern_eth_ipv6_udp,	ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_ipv6_udp},
+	{pattern_eth_ipv6_tcp,	ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_ipv6_tcp},
+	{pattern_eth_ipv6_sctp,	ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_ipv6_sctp},
+	{pattern_empty,		ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_empty},
 };
 
 /* Supported pattern for comms package. */
 static struct ice_pattern_match_item ice_hash_pattern_list_comms[] = {
-	{pattern_empty,			    ICE_INSET_NONE,
-		&hint_empty},
-	{pattern_eth_ipv4,		    ICE_INSET_NONE,
-		&hint_eth_ipv4},
-	{pattern_eth_ipv4_udp,		    ICE_INSET_NONE,
-		&hint_eth_ipv4_udp},
-	{pattern_eth_ipv4_tcp,		    ICE_INSET_NONE,
-		&hint_eth_ipv4_tcp},
-	{pattern_eth_ipv4_sctp,		    ICE_INSET_NONE,
-		&hint_eth_ipv4_sctp},
-	{pattern_eth_ipv4_gtpu_ipv4,	    ICE_INSET_NONE,
-		&hint_eth_ipv4_gtpu_ipv4},
-	{pattern_eth_ipv4_gtpu_ipv4_udp,    ICE_INSET_NONE,
-		&hint_eth_ipv4_gtpu_ipv4_udp},
-	{pattern_eth_ipv4_gtpu_ipv4_tcp,    ICE_INSET_NONE,
-		&hint_eth_ipv4_gtpu_ipv4_tcp},
-	{pattern_eth_ipv4_gtpu_ipv6,	    ICE_INSET_NONE,
-		&hint_eth_ipv4_gtpu_ipv6},
-	{pattern_eth_ipv4_gtpu_ipv6_udp,    ICE_INSET_NONE,
-		&hint_eth_ipv4_gtpu_ipv6_udp},
-	{pattern_eth_ipv4_gtpu_ipv6_tcp,    ICE_INSET_NONE,
-		&hint_eth_ipv4_gtpu_ipv6_tcp},
-	{pattern_eth_ipv6_gtpu_ipv4,	    ICE_INSET_NONE,
-		&hint_eth_ipv6_gtpu_ipv4},
-	{pattern_eth_ipv6_gtpu_ipv4_udp,    ICE_INSET_NONE,
-		&hint_eth_ipv6_gtpu_ipv4_udp},
-	{pattern_eth_ipv6_gtpu_ipv4_tcp,    ICE_INSET_NONE,
-		&hint_eth_ipv6_gtpu_ipv4_tcp},
-	{pattern_eth_ipv6_gtpu_ipv6,	    ICE_INSET_NONE,
-		&hint_eth_ipv6_gtpu_ipv6},
-	{pattern_eth_ipv6_gtpu_ipv6_udp,    ICE_INSET_NONE,
-		&hint_eth_ipv6_gtpu_ipv6_udp},
-	{pattern_eth_ipv6_gtpu_ipv6_tcp,    ICE_INSET_NONE,
-		&hint_eth_ipv6_gtpu_ipv6_tcp},
-	{pattern_eth_ipv4_gtpu_eh_ipv4,	    ICE_INSET_NONE,
-		&hint_eth_ipv4_gtpu_eh_ipv4},
-	{pattern_eth_ipv4_gtpu_eh_ipv4_udp, ICE_INSET_NONE,
-		&hint_eth_ipv4_gtpu_eh_ipv4_udp},
-	{pattern_eth_ipv4_gtpu_eh_ipv4_tcp, ICE_INSET_NONE,
-		&hint_eth_ipv4_gtpu_eh_ipv4_tcp},
-	{pattern_eth_ipv4_gtpu_eh_ipv6,	    ICE_INSET_NONE,
-		&hint_eth_ipv4_gtpu_eh_ipv6},
-	{pattern_eth_ipv4_gtpu_eh_ipv6_udp, ICE_INSET_NONE,
-		&hint_eth_ipv4_gtpu_eh_ipv6_udp},
-	{pattern_eth_ipv4_gtpu_eh_ipv6_tcp, ICE_INSET_NONE,
-		&hint_eth_ipv4_gtpu_eh_ipv6_tcp},
-	{pattern_eth_ipv6_gtpu_eh_ipv4,	    ICE_INSET_NONE,
-		&hint_eth_ipv6_gtpu_eh_ipv4},
-	{pattern_eth_ipv6_gtpu_eh_ipv4_udp, ICE_INSET_NONE,
-		&hint_eth_ipv6_gtpu_eh_ipv4_udp},
-	{pattern_eth_ipv6_gtpu_eh_ipv4_tcp, ICE_INSET_NONE,
-		&hint_eth_ipv6_gtpu_eh_ipv4_tcp},
-	{pattern_eth_ipv6_gtpu_eh_ipv6,	    ICE_INSET_NONE,
-		&hint_eth_ipv6_gtpu_eh_ipv6},
-	{pattern_eth_ipv6_gtpu_eh_ipv6_udp, ICE_INSET_NONE,
-		&hint_eth_ipv6_gtpu_eh_ipv6_udp},
-	{pattern_eth_ipv6_gtpu_eh_ipv6_tcp, ICE_INSET_NONE,
-		&hint_eth_ipv6_gtpu_eh_ipv6_tcp},
-	{pattern_eth_pppoes_ipv4,	    ICE_INSET_NONE,
-		&hint_eth_pppoes_ipv4},
-	{pattern_eth_pppoes_ipv4_udp,	    ICE_INSET_NONE,
-		&hint_eth_pppoes_ipv4_udp},
-	{pattern_eth_pppoes_ipv4_tcp,	    ICE_INSET_NONE,
-		&hint_eth_pppoes_ipv4_tcp},
-	{pattern_eth_ipv4_esp,		    ICE_INSET_NONE,
-		&hint_eth_ipv4_esp},
-	{pattern_eth_ipv4_udp_esp,	    ICE_INSET_NONE,
-		&hint_eth_ipv4_udp_esp},
-	{pattern_eth_ipv4_ah,		    ICE_INSET_NONE,
-		&hint_eth_ipv4_ah},
-	{pattern_eth_ipv4_l2tp,		    ICE_INSET_NONE,
-		&hint_eth_ipv4_l2tpv3},
-	{pattern_eth_ipv4_pfcp,		    ICE_INSET_NONE,
-		&hint_eth_ipv4_pfcp},
-	{pattern_eth_vlan_ipv4,		    ICE_INSET_NONE,
-		&hint_eth_vlan_ipv4},
-	{pattern_eth_vlan_ipv4_udp,	    ICE_INSET_NONE,
-		&hint_eth_vlan_ipv4_udp},
-	{pattern_eth_vlan_ipv4_tcp,	    ICE_INSET_NONE,
-		&hint_eth_vlan_ipv4_tcp},
-	{pattern_eth_vlan_ipv4_sctp,	    ICE_INSET_NONE,
-		&hint_eth_vlan_ipv4_sctp},
-	{pattern_eth_ipv6,		    ICE_INSET_NONE,
-		&hint_eth_ipv6},
-	{pattern_eth_ipv6_udp,		    ICE_INSET_NONE,
-		&hint_eth_ipv6_udp},
-	{pattern_eth_ipv6_tcp,		    ICE_INSET_NONE,
-		&hint_eth_ipv6_tcp},
-	{pattern_eth_ipv6_sctp,		    ICE_INSET_NONE,
-		&hint_eth_ipv6_sctp},
-	{pattern_eth_ipv6_esp,		    ICE_INSET_NONE,
-		&hint_eth_ipv6_esp},
-	{pattern_eth_ipv6_udp_esp,	    ICE_INSET_NONE,
-		&hint_eth_ipv6_udp_esp},
-	{pattern_eth_ipv6_ah,		    ICE_INSET_NONE,
-		&hint_eth_ipv6_ah},
-	{pattern_eth_ipv6_l2tp,		    ICE_INSET_NONE,
-		&hint_eth_ipv6_l2tpv3},
-	{pattern_eth_ipv6_pfcp,		    ICE_INSET_NONE,
-		&hint_eth_ipv6_pfcp},
-	{pattern_eth_vlan_ipv6,		    ICE_INSET_NONE,
-		&hint_eth_vlan_ipv6},
-	{pattern_eth_vlan_ipv6_udp,	    ICE_INSET_NONE,
-		&hint_eth_vlan_ipv6_udp},
-	{pattern_eth_vlan_ipv6_tcp,	    ICE_INSET_NONE,
-		&hint_eth_vlan_ipv6_tcp},
-	{pattern_eth_vlan_ipv6_sctp,	    ICE_INSET_NONE,
-		&hint_eth_vlan_ipv6_sctp},
-	{pattern_eth_pppoes_ipv6,	    ICE_INSET_NONE,
-		&hint_eth_pppoes_ipv6},
-	{pattern_eth_pppoes_ipv6_udp,	    ICE_INSET_NONE,
-		&hint_eth_pppoes_ipv6_udp},
-	{pattern_eth_pppoes_ipv6_tcp,	    ICE_INSET_NONE,
-		&hint_eth_pppoes_ipv6_tcp},
-	{pattern_eth_pppoes,		    ICE_INSET_NONE,
-		&hint_eth_pppoes},
+	{pattern_empty,				ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_empty},
+	{pattern_eth_ipv4,			ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_ipv4},
+	{pattern_eth_ipv4_udp,			ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_ipv4_udp},
+	{pattern_eth_ipv4_tcp,			ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_ipv4_tcp},
+	{pattern_eth_ipv4_sctp,			ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_ipv4_sctp},
+	{pattern_eth_ipv4_gtpu_ipv4,		ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_ipv4_gtpu_ipv4},
+	{pattern_eth_ipv4_gtpu_ipv4_udp,	ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_ipv4_gtpu_ipv4_udp},
+	{pattern_eth_ipv4_gtpu_ipv4_tcp,	ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_ipv4_gtpu_ipv4_tcp},
+	{pattern_eth_ipv4_gtpu_ipv6,		ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_ipv4_gtpu_ipv6},
+	{pattern_eth_ipv4_gtpu_ipv6_udp,	ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_ipv4_gtpu_ipv6_udp},
+	{pattern_eth_ipv4_gtpu_ipv6_tcp,	ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_ipv4_gtpu_ipv6_tcp},
+	{pattern_eth_ipv6_gtpu_ipv4,		ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_ipv6_gtpu_ipv4},
+	{pattern_eth_ipv6_gtpu_ipv4_udp,	ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_ipv6_gtpu_ipv4_udp},
+	{pattern_eth_ipv6_gtpu_ipv4_tcp,	ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_ipv6_gtpu_ipv4_tcp},
+	{pattern_eth_ipv6_gtpu_ipv6,		ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_ipv6_gtpu_ipv6},
+	{pattern_eth_ipv6_gtpu_ipv6_udp,	ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_ipv6_gtpu_ipv6_udp},
+	{pattern_eth_ipv6_gtpu_ipv6_tcp,	ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_ipv6_gtpu_ipv6_tcp},
+	{pattern_eth_ipv4_gtpu_eh_ipv4,		ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_ipv4_gtpu_eh_ipv4},
+	{pattern_eth_ipv4_gtpu_eh_ipv4_udp,	ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_ipv4_gtpu_eh_ipv4_udp},
+	{pattern_eth_ipv4_gtpu_eh_ipv4_tcp,	ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_ipv4_gtpu_eh_ipv4_tcp},
+	{pattern_eth_ipv4_gtpu_eh_ipv6,		ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_ipv4_gtpu_eh_ipv6},
+	{pattern_eth_ipv4_gtpu_eh_ipv6_udp,	ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_ipv4_gtpu_eh_ipv6_udp},
+	{pattern_eth_ipv4_gtpu_eh_ipv6_tcp,	ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_ipv4_gtpu_eh_ipv6_tcp},
+	{pattern_eth_ipv6_gtpu_eh_ipv4,		ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_ipv6_gtpu_eh_ipv4},
+	{pattern_eth_ipv6_gtpu_eh_ipv4_udp,	ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_ipv6_gtpu_eh_ipv4_udp},
+	{pattern_eth_ipv6_gtpu_eh_ipv4_tcp,	ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_ipv6_gtpu_eh_ipv4_tcp},
+	{pattern_eth_ipv6_gtpu_eh_ipv6,		ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_ipv6_gtpu_eh_ipv6},
+	{pattern_eth_ipv6_gtpu_eh_ipv6_udp,	ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_ipv6_gtpu_eh_ipv6_udp},
+	{pattern_eth_ipv6_gtpu_eh_ipv6_tcp,	ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_ipv6_gtpu_eh_ipv6_tcp},
+	{pattern_eth_pppoes_ipv4,		ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_pppoes_ipv4},
+	{pattern_eth_pppoes_ipv4_udp,		ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_pppoes_ipv4_udp},
+	{pattern_eth_pppoes_ipv4_tcp,		ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_pppoes_ipv4_tcp},
+	{pattern_eth_ipv4_esp,			ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_ipv4_esp},
+	{pattern_eth_ipv4_udp_esp,		ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_ipv4_udp_esp},
+	{pattern_eth_ipv4_ah,			ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_ipv4_ah},
+	{pattern_eth_ipv4_l2tp,			ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_ipv4_l2tpv3},
+	{pattern_eth_ipv4_pfcp,			ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_ipv4_pfcp},
+	{pattern_eth_vlan_ipv4,			ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_vlan_ipv4},
+	{pattern_eth_vlan_ipv4_udp,		ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_vlan_ipv4_udp},
+	{pattern_eth_vlan_ipv4_tcp,		ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_vlan_ipv4_tcp},
+	{pattern_eth_vlan_ipv4_sctp,		ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_vlan_ipv4_sctp},
+	{pattern_eth_ipv6,			ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_ipv6},
+	{pattern_eth_ipv6_udp,			ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_ipv6_udp},
+	{pattern_eth_ipv6_tcp,			ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_ipv6_tcp},
+	{pattern_eth_ipv6_sctp,			ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_ipv6_sctp},
+	{pattern_eth_ipv6_esp,			ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_ipv6_esp},
+	{pattern_eth_ipv6_udp_esp,		ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_ipv6_udp_esp},
+	{pattern_eth_ipv6_ah,			ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_ipv6_ah},
+	{pattern_eth_ipv6_l2tp,			ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_ipv6_l2tpv3},
+	{pattern_eth_ipv6_pfcp,			ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_ipv6_pfcp},
+	{pattern_eth_vlan_ipv6,			ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_vlan_ipv6},
+	{pattern_eth_vlan_ipv6_udp,		ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_vlan_ipv6_udp},
+	{pattern_eth_vlan_ipv6_tcp,		ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_vlan_ipv6_tcp},
+	{pattern_eth_vlan_ipv6_sctp,		ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_vlan_ipv6_sctp},
+	{pattern_eth_pppoes_ipv6,		ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_pppoes_ipv6},
+	{pattern_eth_pppoes_ipv6_udp,		ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_pppoes_ipv6_udp},
+	{pattern_eth_pppoes_ipv6_tcp,		ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_pppoes_ipv6_tcp},
+	{pattern_eth_pppoes,			ICE_INSET_NONE,	ICE_INSET_NONE,	&hint_eth_pppoes},
 };
 
 /**
diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c
index 8cba6eb7b1..48e1c69756 100644
--- a/drivers/net/ice/ice_switch_filter.c
+++ b/drivers/net/ice/ice_switch_filter.c
@@ -35,8 +35,8 @@
 #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_OUTER)
+	ICE_INSET_DMAC | ICE_INSET_SMAC | ICE_INSET_ETHERTYPE | \
+	ICE_INSET_VLAN_OUTER)
 #define ICE_SW_INSET_MAC_IPV4 ( \
 	ICE_INSET_DMAC | ICE_INSET_IPV4_DST | ICE_INSET_IPV4_SRC | \
 	ICE_INSET_IPV4_PROTO | ICE_INSET_IPV4_TTL | ICE_INSET_IPV4_TOS)
@@ -93,7 +93,7 @@
 	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)
-#define ICE_SW_INSET_MAC_PPPOE  ( \
+#define ICE_SW_INSET_MAC_PPPOE ( \
 	ICE_INSET_VLAN_OUTER | ICE_INSET_VLAN_INNER | \
 	ICE_INSET_DMAC | ICE_INSET_ETHERTYPE | ICE_INSET_PPPOE_SESSION)
 #define ICE_SW_INSET_MAC_PPPOE_PROTO  ( \
@@ -144,246 +144,132 @@ static struct ice_flow_parser ice_switch_perm_parser_comms;
 
 static struct
 ice_pattern_match_item ice_switch_pattern_dist_os[] = {
-	{pattern_ethertype,
-			ICE_SW_INSET_ETHER, ICE_INSET_NONE},
-	{pattern_ethertype_vlan,
-			ICE_SW_INSET_MAC_VLAN, ICE_INSET_NONE},
-	{pattern_eth_arp,
-			ICE_INSET_NONE, ICE_INSET_NONE},
-	{pattern_eth_ipv4,
-			ICE_SW_INSET_MAC_IPV4, ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp,
-			ICE_SW_INSET_MAC_IPV4_UDP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_tcp,
-			ICE_SW_INSET_MAC_IPV4_TCP, ICE_INSET_NONE},
-	{pattern_eth_ipv6,
-			ICE_SW_INSET_MAC_IPV6, ICE_INSET_NONE},
-	{pattern_eth_ipv6_udp,
-			ICE_SW_INSET_MAC_IPV6_UDP, ICE_INSET_NONE},
-	{pattern_eth_ipv6_tcp,
-			ICE_SW_INSET_MAC_IPV6_TCP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_eth_ipv4,
-			ICE_SW_INSET_DIST_VXLAN_IPV4, ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_udp,
-			ICE_SW_INSET_DIST_VXLAN_IPV4_UDP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_tcp,
-			ICE_SW_INSET_DIST_VXLAN_IPV4_TCP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_nvgre_eth_ipv4,
-			ICE_SW_INSET_DIST_NVGRE_IPV4, ICE_INSET_NONE},
-	{pattern_eth_ipv4_nvgre_eth_ipv4_udp,
-			ICE_SW_INSET_DIST_NVGRE_IPV4_UDP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_nvgre_eth_ipv4_tcp,
-			ICE_SW_INSET_DIST_NVGRE_IPV4_TCP, ICE_INSET_NONE},
+	{pattern_ethertype,				ICE_INSET_NONE,		ICE_SW_INSET_ETHER,			ICE_INSET_NONE},
+	{pattern_ethertype_vlan,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_VLAN,			ICE_INSET_NONE},
+	{pattern_eth_arp,				ICE_INSET_NONE,		ICE_INSET_NONE,				ICE_INSET_NONE},
+	{pattern_eth_ipv4,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV4,			ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV4_UDP,		ICE_INSET_NONE},
+	{pattern_eth_ipv4_tcp,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV4_TCP,		ICE_INSET_NONE},
+	{pattern_eth_ipv6,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV6,			ICE_INSET_NONE},
+	{pattern_eth_ipv6_udp,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV6_UDP,		ICE_INSET_NONE},
+	{pattern_eth_ipv6_tcp,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV6_TCP,		ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_eth_ipv4,		ICE_INSET_NONE,		ICE_SW_INSET_DIST_VXLAN_IPV4,		ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_udp,	ICE_INSET_NONE,		ICE_SW_INSET_DIST_VXLAN_IPV4_UDP,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_tcp,	ICE_INSET_NONE,		ICE_SW_INSET_DIST_VXLAN_IPV4_TCP,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_nvgre_eth_ipv4,		ICE_INSET_NONE,		ICE_SW_INSET_DIST_NVGRE_IPV4,		ICE_INSET_NONE},
+	{pattern_eth_ipv4_nvgre_eth_ipv4_udp,		ICE_INSET_NONE,		ICE_SW_INSET_DIST_NVGRE_IPV4_UDP,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_nvgre_eth_ipv4_tcp,		ICE_INSET_NONE,		ICE_SW_INSET_DIST_NVGRE_IPV4_TCP,	ICE_INSET_NONE},
 };
 
 static struct
 ice_pattern_match_item ice_switch_pattern_dist_comms[] = {
-	{pattern_ethertype,
-			ICE_SW_INSET_ETHER, ICE_INSET_NONE},
-	{pattern_ethertype_vlan,
-			ICE_SW_INSET_MAC_VLAN, ICE_INSET_NONE},
-	{pattern_eth_arp,
-			ICE_INSET_NONE, ICE_INSET_NONE},
-	{pattern_eth_ipv4,
-			ICE_SW_INSET_MAC_IPV4, ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp,
-			ICE_SW_INSET_MAC_IPV4_UDP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_tcp,
-			ICE_SW_INSET_MAC_IPV4_TCP, ICE_INSET_NONE},
-	{pattern_eth_ipv6,
-			ICE_SW_INSET_MAC_IPV6, ICE_INSET_NONE},
-	{pattern_eth_ipv6_udp,
-			ICE_SW_INSET_MAC_IPV6_UDP, ICE_INSET_NONE},
-	{pattern_eth_ipv6_tcp,
-			ICE_SW_INSET_MAC_IPV6_TCP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_eth_ipv4,
-			ICE_SW_INSET_DIST_VXLAN_IPV4, ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_udp,
-			ICE_SW_INSET_DIST_VXLAN_IPV4_UDP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_tcp,
-			ICE_SW_INSET_DIST_VXLAN_IPV4_TCP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_nvgre_eth_ipv4,
-			ICE_SW_INSET_DIST_NVGRE_IPV4, ICE_INSET_NONE},
-	{pattern_eth_ipv4_nvgre_eth_ipv4_udp,
-			ICE_SW_INSET_DIST_NVGRE_IPV4_UDP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_nvgre_eth_ipv4_tcp,
-			ICE_SW_INSET_DIST_NVGRE_IPV4_TCP, ICE_INSET_NONE},
-	{pattern_eth_pppoes,
-			ICE_SW_INSET_MAC_PPPOE, ICE_INSET_NONE},
-	{pattern_eth_vlan_pppoes,
-			ICE_SW_INSET_MAC_PPPOE, ICE_INSET_NONE},
-	{pattern_eth_pppoes_proto,
-			ICE_SW_INSET_MAC_PPPOE_PROTO, ICE_INSET_NONE},
-	{pattern_eth_vlan_pppoes_proto,
-			ICE_SW_INSET_MAC_PPPOE_PROTO, ICE_INSET_NONE},
-	{pattern_eth_pppoes_ipv4,
-			ICE_SW_INSET_MAC_PPPOE_IPV4, ICE_INSET_NONE},
-	{pattern_eth_pppoes_ipv4_tcp,
-			ICE_SW_INSET_MAC_PPPOE_IPV4_TCP, ICE_INSET_NONE},
-	{pattern_eth_pppoes_ipv4_udp,
-			ICE_SW_INSET_MAC_PPPOE_IPV4_UDP, ICE_INSET_NONE},
-	{pattern_eth_pppoes_ipv6,
-			ICE_SW_INSET_MAC_PPPOE_IPV6, ICE_INSET_NONE},
-	{pattern_eth_pppoes_ipv6_tcp,
-			ICE_SW_INSET_MAC_PPPOE_IPV6_TCP, ICE_INSET_NONE},
-	{pattern_eth_pppoes_ipv6_udp,
-			ICE_SW_INSET_MAC_PPPOE_IPV6_UDP, ICE_INSET_NONE},
-	{pattern_eth_vlan_pppoes_ipv4,
-			ICE_SW_INSET_MAC_PPPOE_IPV4, ICE_INSET_NONE},
-	{pattern_eth_vlan_pppoes_ipv4_tcp,
-			ICE_SW_INSET_MAC_PPPOE_IPV4_TCP, ICE_INSET_NONE},
-	{pattern_eth_vlan_pppoes_ipv4_udp,
-			ICE_SW_INSET_MAC_PPPOE_IPV4_UDP, ICE_INSET_NONE},
-	{pattern_eth_vlan_pppoes_ipv6,
-			ICE_SW_INSET_MAC_PPPOE_IPV6, ICE_INSET_NONE},
-	{pattern_eth_vlan_pppoes_ipv6_tcp,
-			ICE_SW_INSET_MAC_PPPOE_IPV6_TCP, ICE_INSET_NONE},
-	{pattern_eth_vlan_pppoes_ipv6_udp,
-			ICE_SW_INSET_MAC_PPPOE_IPV6_UDP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_esp,
-			ICE_SW_INSET_MAC_IPV4_ESP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_esp,
-			ICE_SW_INSET_MAC_IPV4_ESP, ICE_INSET_NONE},
-	{pattern_eth_ipv6_esp,
-			ICE_SW_INSET_MAC_IPV6_ESP, ICE_INSET_NONE},
-	{pattern_eth_ipv6_udp_esp,
-			ICE_SW_INSET_MAC_IPV6_ESP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_ah,
-			ICE_SW_INSET_MAC_IPV4_AH, ICE_INSET_NONE},
-	{pattern_eth_ipv6_ah,
-			ICE_SW_INSET_MAC_IPV6_AH, ICE_INSET_NONE},
-	{pattern_eth_ipv6_udp_ah,
-			ICE_INSET_NONE, ICE_INSET_NONE},
-	{pattern_eth_ipv4_l2tp,
-			ICE_SW_INSET_MAC_IPV4_L2TP, ICE_INSET_NONE},
-	{pattern_eth_ipv6_l2tp,
-			ICE_SW_INSET_MAC_IPV6_L2TP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_pfcp,
-			ICE_INSET_NONE, ICE_INSET_NONE},
-	{pattern_eth_ipv6_pfcp,
-			ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_ethertype,				ICE_INSET_NONE,		ICE_SW_INSET_ETHER,			ICE_INSET_NONE},
+	{pattern_ethertype_vlan,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_VLAN,			ICE_INSET_NONE},
+	{pattern_eth_arp,				ICE_INSET_NONE,		ICE_INSET_NONE,				ICE_INSET_NONE},
+	{pattern_eth_ipv4,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV4,			ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV4_UDP,		ICE_INSET_NONE},
+	{pattern_eth_ipv4_tcp,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV4_TCP,		ICE_INSET_NONE},
+	{pattern_eth_ipv6,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV6,			ICE_INSET_NONE},
+	{pattern_eth_ipv6_udp,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV6_UDP,		ICE_INSET_NONE},
+	{pattern_eth_ipv6_tcp,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV6_TCP,		ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_eth_ipv4,		ICE_INSET_NONE,		ICE_SW_INSET_DIST_VXLAN_IPV4,		ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_udp,	ICE_INSET_NONE,		ICE_SW_INSET_DIST_VXLAN_IPV4_UDP,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_tcp,	ICE_INSET_NONE,		ICE_SW_INSET_DIST_VXLAN_IPV4_TCP,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_nvgre_eth_ipv4,		ICE_INSET_NONE,		ICE_SW_INSET_DIST_NVGRE_IPV4,		ICE_INSET_NONE},
+	{pattern_eth_ipv4_nvgre_eth_ipv4_udp,		ICE_INSET_NONE,		ICE_SW_INSET_DIST_NVGRE_IPV4_UDP,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_nvgre_eth_ipv4_tcp,		ICE_INSET_NONE,		ICE_SW_INSET_DIST_NVGRE_IPV4_TCP,	ICE_INSET_NONE},
+	{pattern_eth_pppoes,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE,			ICE_INSET_NONE},
+	{pattern_eth_vlan_pppoes,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE,			ICE_INSET_NONE},
+	{pattern_eth_pppoes_proto,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_PROTO,		ICE_INSET_NONE},
+	{pattern_eth_vlan_pppoes_proto,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_PROTO,		ICE_INSET_NONE},
+	{pattern_eth_pppoes_ipv4,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_IPV4,		ICE_INSET_NONE},
+	{pattern_eth_pppoes_ipv4_tcp,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_IPV4_TCP,	ICE_INSET_NONE},
+	{pattern_eth_pppoes_ipv4_udp,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_IPV4_UDP,	ICE_INSET_NONE},
+	{pattern_eth_pppoes_ipv6,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_IPV6,		ICE_INSET_NONE},
+	{pattern_eth_pppoes_ipv6_tcp,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_IPV6_TCP,	ICE_INSET_NONE},
+	{pattern_eth_pppoes_ipv6_udp,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_IPV6_UDP,	ICE_INSET_NONE},
+	{pattern_eth_vlan_pppoes_ipv4,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_IPV4,		ICE_INSET_NONE},
+	{pattern_eth_vlan_pppoes_ipv4_tcp,		ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_IPV4_TCP,	ICE_INSET_NONE},
+	{pattern_eth_vlan_pppoes_ipv4_udp,		ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_IPV4_UDP,	ICE_INSET_NONE},
+	{pattern_eth_vlan_pppoes_ipv6,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_IPV6,		ICE_INSET_NONE},
+	{pattern_eth_vlan_pppoes_ipv6_tcp,		ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_IPV6_TCP,	ICE_INSET_NONE},
+	{pattern_eth_vlan_pppoes_ipv6_udp,		ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_IPV6_UDP,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_esp,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV4_ESP,		ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_esp,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV4_ESP,		ICE_INSET_NONE},
+	{pattern_eth_ipv6_esp,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV6_ESP,		ICE_INSET_NONE},
+	{pattern_eth_ipv6_udp_esp,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV6_ESP,		ICE_INSET_NONE},
+	{pattern_eth_ipv4_ah,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV4_AH,		ICE_INSET_NONE},
+	{pattern_eth_ipv6_ah,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV6_AH,		ICE_INSET_NONE},
+	{pattern_eth_ipv6_udp_ah,			ICE_INSET_NONE,		ICE_INSET_NONE,				ICE_INSET_NONE},
+	{pattern_eth_ipv4_l2tp,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV4_L2TP,		ICE_INSET_NONE},
+	{pattern_eth_ipv6_l2tp,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV6_L2TP,		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},
 };
 
 static struct
 ice_pattern_match_item ice_switch_pattern_perm_os[] = {
-	{pattern_ethertype,
-			ICE_SW_INSET_ETHER, ICE_INSET_NONE},
-	{pattern_ethertype_vlan,
-			ICE_SW_INSET_MAC_VLAN, ICE_INSET_NONE},
-	{pattern_eth_arp,
-			ICE_INSET_NONE, ICE_INSET_NONE},
-	{pattern_eth_ipv4,
-			ICE_SW_INSET_MAC_IPV4, ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp,
-			ICE_SW_INSET_MAC_IPV4_UDP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_tcp,
-			ICE_SW_INSET_MAC_IPV4_TCP, ICE_INSET_NONE},
-	{pattern_eth_ipv6,
-			ICE_SW_INSET_MAC_IPV6, ICE_INSET_NONE},
-	{pattern_eth_ipv6_udp,
-			ICE_SW_INSET_MAC_IPV6_UDP, ICE_INSET_NONE},
-	{pattern_eth_ipv6_tcp,
-			ICE_SW_INSET_MAC_IPV6_TCP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_eth_ipv4,
-			ICE_SW_INSET_PERM_TUNNEL_IPV4, ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_udp,
-			ICE_SW_INSET_PERM_TUNNEL_IPV4_UDP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_tcp,
-			ICE_SW_INSET_PERM_TUNNEL_IPV4_TCP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_nvgre_eth_ipv4,
-			ICE_SW_INSET_PERM_TUNNEL_IPV4, ICE_INSET_NONE},
-	{pattern_eth_ipv4_nvgre_eth_ipv4_udp,
-			ICE_SW_INSET_PERM_TUNNEL_IPV4_UDP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_nvgre_eth_ipv4_tcp,
-			ICE_SW_INSET_PERM_TUNNEL_IPV4_TCP, ICE_INSET_NONE},
+	{pattern_ethertype,				ICE_INSET_NONE,		ICE_SW_INSET_ETHER,			ICE_INSET_NONE},
+	{pattern_ethertype_vlan,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_VLAN,			ICE_INSET_NONE},
+	{pattern_eth_arp,				ICE_INSET_NONE,		ICE_INSET_NONE,				ICE_INSET_NONE},
+	{pattern_eth_ipv4,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV4,			ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV4_UDP,		ICE_INSET_NONE},
+	{pattern_eth_ipv4_tcp,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV4_TCP,		ICE_INSET_NONE},
+	{pattern_eth_ipv6,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV6,			ICE_INSET_NONE},
+	{pattern_eth_ipv6_udp,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV6_UDP,		ICE_INSET_NONE},
+	{pattern_eth_ipv6_tcp,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV6_TCP,		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},
 };
 
 static struct
 ice_pattern_match_item ice_switch_pattern_perm_comms[] = {
-	{pattern_ethertype,
-			ICE_SW_INSET_ETHER, ICE_INSET_NONE},
-	{pattern_ethertype_vlan,
-			ICE_SW_INSET_MAC_VLAN, ICE_INSET_NONE},
-	{pattern_eth_arp,
-		ICE_INSET_NONE, ICE_INSET_NONE},
-	{pattern_eth_ipv4,
-			ICE_SW_INSET_MAC_IPV4, ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp,
-			ICE_SW_INSET_MAC_IPV4_UDP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_tcp,
-			ICE_SW_INSET_MAC_IPV4_TCP, ICE_INSET_NONE},
-	{pattern_eth_ipv6,
-			ICE_SW_INSET_MAC_IPV6, ICE_INSET_NONE},
-	{pattern_eth_ipv6_udp,
-			ICE_SW_INSET_MAC_IPV6_UDP, ICE_INSET_NONE},
-	{pattern_eth_ipv6_tcp,
-			ICE_SW_INSET_MAC_IPV6_TCP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_eth_ipv4,
-			ICE_SW_INSET_PERM_TUNNEL_IPV4, ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_udp,
-			ICE_SW_INSET_PERM_TUNNEL_IPV4_UDP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_tcp,
-			ICE_SW_INSET_PERM_TUNNEL_IPV4_TCP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_nvgre_eth_ipv4,
-			ICE_SW_INSET_PERM_TUNNEL_IPV4, ICE_INSET_NONE},
-	{pattern_eth_ipv4_nvgre_eth_ipv4_udp,
-			ICE_SW_INSET_PERM_TUNNEL_IPV4_UDP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_nvgre_eth_ipv4_tcp,
-			ICE_SW_INSET_PERM_TUNNEL_IPV4_TCP, ICE_INSET_NONE},
-	{pattern_eth_pppoes,
-			ICE_SW_INSET_MAC_PPPOE, ICE_INSET_NONE},
-	{pattern_eth_vlan_pppoes,
-			ICE_SW_INSET_MAC_PPPOE, ICE_INSET_NONE},
-	{pattern_eth_pppoes_proto,
-			ICE_SW_INSET_MAC_PPPOE_PROTO, ICE_INSET_NONE},
-	{pattern_eth_vlan_pppoes_proto,
-			ICE_SW_INSET_MAC_PPPOE_PROTO, ICE_INSET_NONE},
-	{pattern_eth_pppoes_ipv4,
-			ICE_SW_INSET_MAC_PPPOE_IPV4, ICE_INSET_NONE},
-	{pattern_eth_pppoes_ipv4_tcp,
-			ICE_SW_INSET_MAC_PPPOE_IPV4_TCP, ICE_INSET_NONE},
-	{pattern_eth_pppoes_ipv4_udp,
-			ICE_SW_INSET_MAC_PPPOE_IPV4_UDP, ICE_INSET_NONE},
-	{pattern_eth_pppoes_ipv6,
-			ICE_SW_INSET_MAC_PPPOE_IPV6, ICE_INSET_NONE},
-	{pattern_eth_pppoes_ipv6_tcp,
-			ICE_SW_INSET_MAC_PPPOE_IPV6_TCP, ICE_INSET_NONE},
-	{pattern_eth_pppoes_ipv6_udp,
-			ICE_SW_INSET_MAC_PPPOE_IPV6_UDP, ICE_INSET_NONE},
-	{pattern_eth_vlan_pppoes_ipv4,
-			ICE_SW_INSET_MAC_PPPOE_IPV4, ICE_INSET_NONE},
-	{pattern_eth_vlan_pppoes_ipv4_tcp,
-			ICE_SW_INSET_MAC_PPPOE_IPV4_TCP, ICE_INSET_NONE},
-	{pattern_eth_vlan_pppoes_ipv4_udp,
-			ICE_SW_INSET_MAC_PPPOE_IPV4_UDP, ICE_INSET_NONE},
-	{pattern_eth_vlan_pppoes_ipv6,
-			ICE_SW_INSET_MAC_PPPOE_IPV6, ICE_INSET_NONE},
-	{pattern_eth_vlan_pppoes_ipv6_tcp,
-			ICE_SW_INSET_MAC_PPPOE_IPV6_TCP, ICE_INSET_NONE},
-	{pattern_eth_vlan_pppoes_ipv6_udp,
-			ICE_SW_INSET_MAC_PPPOE_IPV6_UDP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_esp,
-			ICE_SW_INSET_MAC_IPV4_ESP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_esp,
-			ICE_SW_INSET_MAC_IPV4_ESP, ICE_INSET_NONE},
-	{pattern_eth_ipv6_esp,
-			ICE_SW_INSET_MAC_IPV6_ESP, ICE_INSET_NONE},
-	{pattern_eth_ipv6_udp_esp,
-			ICE_SW_INSET_MAC_IPV6_ESP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_ah,
-			ICE_SW_INSET_MAC_IPV4_AH, ICE_INSET_NONE},
-	{pattern_eth_ipv6_ah,
-			ICE_SW_INSET_MAC_IPV6_AH, ICE_INSET_NONE},
-	{pattern_eth_ipv6_udp_ah,
-			ICE_INSET_NONE, ICE_INSET_NONE},
-	{pattern_eth_ipv4_l2tp,
-			ICE_SW_INSET_MAC_IPV4_L2TP, ICE_INSET_NONE},
-	{pattern_eth_ipv6_l2tp,
-			ICE_SW_INSET_MAC_IPV6_L2TP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_pfcp,
-			ICE_INSET_NONE, ICE_INSET_NONE},
-	{pattern_eth_ipv6_pfcp,
-			ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_ethertype,				ICE_INSET_NONE,		ICE_SW_INSET_ETHER,			ICE_INSET_NONE},
+	{pattern_ethertype_vlan,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_VLAN,			ICE_INSET_NONE},
+	{pattern_eth_arp,				ICE_INSET_NONE,		ICE_INSET_NONE,				ICE_INSET_NONE},
+	{pattern_eth_ipv4,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV4,			ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV4_UDP,		ICE_INSET_NONE},
+	{pattern_eth_ipv4_tcp,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV4_TCP,		ICE_INSET_NONE},
+	{pattern_eth_ipv6,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV6,			ICE_INSET_NONE},
+	{pattern_eth_ipv6_udp,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV6_UDP,		ICE_INSET_NONE},
+	{pattern_eth_ipv6_tcp,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV6_TCP,		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_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE,			ICE_INSET_NONE},
+	{pattern_eth_vlan_pppoes,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE,			ICE_INSET_NONE},
+	{pattern_eth_pppoes_proto,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_PROTO,		ICE_INSET_NONE},
+	{pattern_eth_vlan_pppoes_proto,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_PROTO,		ICE_INSET_NONE},
+	{pattern_eth_pppoes_ipv4,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_IPV4,		ICE_INSET_NONE},
+	{pattern_eth_pppoes_ipv4_tcp,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_IPV4_TCP,	ICE_INSET_NONE},
+	{pattern_eth_pppoes_ipv4_udp,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_IPV4_UDP,	ICE_INSET_NONE},
+	{pattern_eth_pppoes_ipv6,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_IPV6,		ICE_INSET_NONE},
+	{pattern_eth_pppoes_ipv6_tcp,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_IPV6_TCP,	ICE_INSET_NONE},
+	{pattern_eth_pppoes_ipv6_udp,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_IPV6_UDP,	ICE_INSET_NONE},
+	{pattern_eth_vlan_pppoes_ipv4,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_IPV4,		ICE_INSET_NONE},
+	{pattern_eth_vlan_pppoes_ipv4_tcp,		ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_IPV4_TCP,	ICE_INSET_NONE},
+	{pattern_eth_vlan_pppoes_ipv4_udp,		ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_IPV4_UDP,	ICE_INSET_NONE},
+	{pattern_eth_vlan_pppoes_ipv6,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_IPV6,		ICE_INSET_NONE},
+	{pattern_eth_vlan_pppoes_ipv6_tcp,		ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_IPV6_TCP,	ICE_INSET_NONE},
+	{pattern_eth_vlan_pppoes_ipv6_udp,		ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_IPV6_UDP,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_esp,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV4_ESP,		ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_esp,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV4_ESP,		ICE_INSET_NONE},
+	{pattern_eth_ipv6_esp,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV6_ESP,		ICE_INSET_NONE},
+	{pattern_eth_ipv6_udp_esp,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV6_ESP,		ICE_INSET_NONE},
+	{pattern_eth_ipv4_ah,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV4_AH,		ICE_INSET_NONE},
+	{pattern_eth_ipv6_ah,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV6_AH,		ICE_INSET_NONE},
+	{pattern_eth_ipv6_udp_ah,			ICE_INSET_NONE,		ICE_INSET_NONE,				ICE_INSET_NONE},
+	{pattern_eth_ipv4_l2tp,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV4_L2TP,		ICE_INSET_NONE},
+	{pattern_eth_ipv6_l2tp,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV6_L2TP,		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},
 };
 
 static int
-- 
2.25.1


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

* [dpdk-dev] [PATCH v1 4/5] net/ice: add outer input set mask check
  2020-12-21  6:51 [dpdk-dev] [PATCH v1 0/5] Refactor FDIR pattern parser Zhirun Yan
                   ` (2 preceding siblings ...)
  2020-12-21  6:51 ` [dpdk-dev] [PATCH v1 3/5] net/ice: add outer input set mask to distinguish outer fields Zhirun Yan
@ 2020-12-21  6:51 ` Zhirun Yan
  2020-12-25  5:28   ` Cao, Yahui
  2020-12-21  6:51 ` [dpdk-dev] [PATCH v1 5/5] net/ice: enable FDIR outer/inner fields for VXLAN Zhirun Yan
  2021-01-27  5:29 ` [dpdk-dev] [PATCH v2 0/3] Refactor FDIR pattern parser Zhirun Yan
  5 siblings, 1 reply; 24+ messages in thread
From: Zhirun Yan @ 2020-12-21  6:51 UTC (permalink / raw)
  To: dev, qi.z.zhang, yahui.cao, xiao.w.wang, junfeng.guo
  Cc: simei.su, ting.xu, yuying.zhang, Zhirun Yan

Distinguish input set mask for inner/outer. Add outer input set
mask check.

Signed-off-by: Zhirun Yan <zhirun.yan@intel.com>
---
 drivers/net/ice/ice_fdir_filter.c  | 3 ++-
 drivers/net/ice/ice_generic_flow.c | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c
index 76e0a8df38..2d2b261368 100644
--- a/drivers/net/ice/ice_fdir_filter.c
+++ b/drivers/net/ice/ice_fdir_filter.c
@@ -2020,7 +2020,8 @@ ice_fdir_parse(struct ice_adapter *ad,
 	if (ret)
 		goto error;
 	input_set = filter->input_set | filter->outer_input_set;
-	if (!input_set || input_set & ~item->input_set_mask) {
+	if (!input_set || filter->input_set & ~item->input_set_mask ||
+	    filter->outer_input_set & ~item->input_set_mask_f) {
 		rte_flow_error_set(error, EINVAL,
 				   RTE_FLOW_ERROR_TYPE_ITEM_SPEC,
 				   pattern,
diff --git a/drivers/net/ice/ice_generic_flow.c b/drivers/net/ice/ice_generic_flow.c
index 1429cbc3b6..6c20b070c7 100644
--- a/drivers/net/ice/ice_generic_flow.c
+++ b/drivers/net/ice/ice_generic_flow.c
@@ -2088,6 +2088,8 @@ ice_search_pattern_match_item(const struct rte_flow_item pattern[],
 					items)) {
 			pattern_match_item->input_set_mask =
 				array[i].input_set_mask;
+			pattern_match_item->input_set_mask_f =
+				array[i].input_set_mask_f;
 			pattern_match_item->pattern_list =
 				array[i].pattern_list;
 			pattern_match_item->meta = array[i].meta;
-- 
2.25.1


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

* [dpdk-dev] [PATCH v1 5/5] net/ice: enable FDIR outer/inner fields for VXLAN
  2020-12-21  6:51 [dpdk-dev] [PATCH v1 0/5] Refactor FDIR pattern parser Zhirun Yan
                   ` (3 preceding siblings ...)
  2020-12-21  6:51 ` [dpdk-dev] [PATCH v1 4/5] net/ice: add outer input set mask check Zhirun Yan
@ 2020-12-21  6:51 ` Zhirun Yan
  2021-01-27  5:29 ` [dpdk-dev] [PATCH v2 0/3] Refactor FDIR pattern parser Zhirun Yan
  5 siblings, 0 replies; 24+ messages in thread
From: Zhirun Yan @ 2020-12-21  6:51 UTC (permalink / raw)
  To: dev, qi.z.zhang, yahui.cao, xiao.w.wang, junfeng.guo
  Cc: simei.su, ting.xu, yuying.zhang, Zhirun Yan

Enable FDIR outer fields L2/L3 fields and inner L2/L3 for VXLAN.

Signed-off-by: Zhirun Yan <zhirun.yan@intel.com>
---
 drivers/net/ice/ice_fdir_filter.c | 37 ++++++++++++++++++-------------
 1 file changed, 21 insertions(+), 16 deletions(-)

diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c
index 2d2b261368..f022050d48 100644
--- a/drivers/net/ice/ice_fdir_filter.c
+++ b/drivers/net/ice/ice_fdir_filter.c
@@ -55,7 +55,12 @@
 	ICE_FDIR_INSET_ETH_IPV6 | \
 	ICE_INSET_SCTP_SRC_PORT | ICE_INSET_SCTP_DST_PORT)
 
+#define ICE_FDIR_INSET_VXLAN_IPV4_F (\
+	ICE_FDIR_INSET_ETH | \
+	ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST)
+
 #define ICE_FDIR_INSET_VXLAN_IPV4_L (\
+	ICE_FDIR_INSET_ETH | \
 	ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST)
 
 #define ICE_FDIR_INSET_VXLAN_IPV4_TCP_L (\
@@ -93,14 +98,14 @@ static struct ice_pattern_match_item ice_fdir_pattern_os[] = {
 	{pattern_eth_ipv6_udp,				ICE_INSET_NONE,			ICE_FDIR_INSET_ETH_IPV6_UDP,		ICE_INSET_NONE},
 	{pattern_eth_ipv6_tcp,				ICE_INSET_NONE,			ICE_FDIR_INSET_ETH_IPV6_TCP,		ICE_INSET_NONE},
 	{pattern_eth_ipv6_sctp,				ICE_INSET_NONE,			ICE_FDIR_INSET_ETH_IPV6_SCTP,		ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_ipv4,		ICE_INSET_NONE,			ICE_FDIR_INSET_VXLAN_IPV4_L,		ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_ipv4_udp,		ICE_INSET_NONE,			ICE_FDIR_INSET_VXLAN_IPV4_UDP_L,	ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_ipv4_tcp,		ICE_INSET_NONE,			ICE_FDIR_INSET_VXLAN_IPV4_TCP_L,	ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_ipv4_sctp,		ICE_INSET_NONE,			ICE_FDIR_INSET_VXLAN_IPV4_SCTP_L,	ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_eth_ipv4,		ICE_INSET_NONE,			ICE_FDIR_INSET_VXLAN_IPV4_L,		ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_udp,	ICE_INSET_NONE,			ICE_FDIR_INSET_VXLAN_IPV4_UDP_L,	ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_tcp,	ICE_INSET_NONE,			ICE_FDIR_INSET_VXLAN_IPV4_TCP_L,	ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_sctp,	ICE_INSET_NONE,			ICE_FDIR_INSET_VXLAN_IPV4_SCTP_L,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_ipv4,		ICE_FDIR_INSET_VXLAN_IPV4_F,	ICE_FDIR_INSET_VXLAN_IPV4_L,		ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_ipv4_udp,		ICE_FDIR_INSET_VXLAN_IPV4_F,	ICE_FDIR_INSET_VXLAN_IPV4_UDP_L,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_ipv4_tcp,		ICE_FDIR_INSET_VXLAN_IPV4_F,	ICE_FDIR_INSET_VXLAN_IPV4_TCP_L,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_ipv4_sctp,		ICE_FDIR_INSET_VXLAN_IPV4_F,	ICE_FDIR_INSET_VXLAN_IPV4_SCTP_L,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_eth_ipv4,		ICE_FDIR_INSET_VXLAN_IPV4_F,	ICE_FDIR_INSET_VXLAN_IPV4_L,		ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_udp,	ICE_FDIR_INSET_VXLAN_IPV4_F,	ICE_FDIR_INSET_VXLAN_IPV4_UDP_L,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_tcp,	ICE_FDIR_INSET_VXLAN_IPV4_F,	ICE_FDIR_INSET_VXLAN_IPV4_TCP_L,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_sctp,	ICE_FDIR_INSET_VXLAN_IPV4_F,	ICE_FDIR_INSET_VXLAN_IPV4_SCTP_L,	ICE_INSET_NONE},
 };
 
 static struct ice_pattern_match_item ice_fdir_pattern_comms[] = {
@@ -111,14 +116,14 @@ static struct ice_pattern_match_item ice_fdir_pattern_comms[] = {
 	{pattern_eth_ipv4_sctp,				ICE_INSET_NONE,			ICE_FDIR_INSET_ETH_IPV4_SCTP,		ICE_INSET_NONE},
 	{pattern_eth_ipv6,				ICE_INSET_NONE,			ICE_FDIR_INSET_ETH_IPV6,		ICE_INSET_NONE},
 	{pattern_eth_ipv6_udp,				ICE_INSET_NONE,			ICE_FDIR_INSET_ETH_IPV6_UDP,		ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_ipv4,		ICE_INSET_NONE,			ICE_FDIR_INSET_VXLAN_IPV4_L,		ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_ipv4_udp,		ICE_INSET_NONE,			ICE_FDIR_INSET_VXLAN_IPV4_UDP_L,	ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_ipv4_tcp,		ICE_INSET_NONE,			ICE_FDIR_INSET_VXLAN_IPV4_TCP_L,	ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_ipv4_sctp,		ICE_INSET_NONE,			ICE_FDIR_INSET_VXLAN_IPV4_SCTP_L,	ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_eth_ipv4,		ICE_INSET_NONE,			ICE_FDIR_INSET_VXLAN_IPV4_L,		ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_udp,	ICE_INSET_NONE,			ICE_FDIR_INSET_VXLAN_IPV4_UDP_L,	ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_tcp,	ICE_INSET_NONE,			ICE_FDIR_INSET_VXLAN_IPV4_TCP_L,	ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_sctp,	ICE_INSET_NONE,			ICE_FDIR_INSET_VXLAN_IPV4_SCTP_L,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_ipv4,		ICE_FDIR_INSET_VXLAN_IPV4_F,	ICE_FDIR_INSET_VXLAN_IPV4_L,		ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_ipv4_udp,		ICE_FDIR_INSET_VXLAN_IPV4_F,	ICE_FDIR_INSET_VXLAN_IPV4_UDP_L,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_ipv4_tcp,		ICE_FDIR_INSET_VXLAN_IPV4_F,	ICE_FDIR_INSET_VXLAN_IPV4_TCP_L,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_ipv4_sctp,		ICE_FDIR_INSET_VXLAN_IPV4_F,	ICE_FDIR_INSET_VXLAN_IPV4_SCTP_L,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_eth_ipv4,		ICE_FDIR_INSET_VXLAN_IPV4_F,	ICE_FDIR_INSET_VXLAN_IPV4_L,		ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_udp,	ICE_FDIR_INSET_VXLAN_IPV4_F,	ICE_FDIR_INSET_VXLAN_IPV4_UDP_L,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_tcp,	ICE_FDIR_INSET_VXLAN_IPV4_F,	ICE_FDIR_INSET_VXLAN_IPV4_TCP_L,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_sctp,	ICE_FDIR_INSET_VXLAN_IPV4_F,	ICE_FDIR_INSET_VXLAN_IPV4_SCTP_L,	ICE_INSET_NONE},
 	{pattern_eth_ipv4_gtpu,				ICE_FDIR_INSET_IPV4_GTPU_F,	ICE_INSET_NONE,				ICE_INSET_NONE},
 	{pattern_eth_ipv4_gtpu_eh,			ICE_FDIR_INSET_IPV4_GTPU_EH_F,	ICE_INSET_NONE,				ICE_INSET_NONE},
 	{pattern_eth_ipv6_gtpu,				ICE_FDIR_INSET_IPV6_GTPU_F,	ICE_INSET_NONE,				ICE_INSET_NONE},
-- 
2.25.1


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

* Re: [dpdk-dev] [PATCH v1 2/5] net/ice: refactor flow pattern parser
  2020-12-21  6:51 ` [dpdk-dev] [PATCH v1 2/5] net/ice: refactor flow pattern parser Zhirun Yan
@ 2020-12-25  5:21   ` Cao, Yahui
  2021-01-07  3:07     ` Yan, Zhirun
  0 siblings, 1 reply; 24+ messages in thread
From: Cao, Yahui @ 2020-12-25  5:21 UTC (permalink / raw)
  To: Yan, Zhirun, dev, Zhang, Qi Z, Wang, Xiao W, Guo, Junfeng
  Cc: Su, Simei, Xu, Ting, Zhang, Yuying



> -----Original Message-----
> From: Yan, Zhirun <zhirun.yan@intel.com>
> Sent: Monday, December 21, 2020 2:52 PM
> To: dev@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>; Cao, Yahui <yahui.cao@intel.com>; Wang, Xiao W <xiao.w.wang@intel.com>;
> Guo, Junfeng <junfeng.guo@intel.com>
> Cc: Su, Simei <simei.su@intel.com>; Xu, Ting <ting.xu@intel.com>; Zhang, Yuying <yuying.zhang@intel.com>; Yan, Zhirun
> <zhirun.yan@intel.com>
> Subject: [PATCH v1 2/5] net/ice: refactor flow pattern parser
> 
> Distinguish inner/outer input set. And avoid too many nested
> conditionals in each type's parser. input_set_f is used for
> outer fields, input_set_l is used for inner or non-tunnel
> fields.
> 
> Signed-off-by: Zhirun Yan <zhirun.yan@intel.com>
> ---
>  drivers/net/ice/ice_fdir_filter.c | 467 +++++++++++++++---------------
>  1 file changed, 229 insertions(+), 238 deletions(-)
> 
> diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c
> index 92b8a7e6ad..1f2576a444 100644
> --- a/drivers/net/ice/ice_fdir_filter.c
> +++ b/drivers/net/ice/ice_fdir_filter.c
> @@ -1646,7 +1646,9 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
>  	const struct rte_flow_item_vxlan *vxlan_spec, *vxlan_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 input_set_l = ICE_INSET_NONE;
> +	uint64_t input_set_f = ICE_INSET_NONE;
> +	uint64_t *input_set;
>  	uint8_t flow_type = ICE_FLTR_PTYPE_NONF_NONE;
>  	uint8_t  ipv6_addr_mask[16] = {
>  		0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
> @@ -1655,289 +1657,276 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
>  	uint32_t vtc_flow_cpu;
>  	uint16_t ether_type;
>  	enum rte_flow_item_type next_type;
> +	bool is_outer = true;
> +	struct ice_fdir_extra *p_ext_data;
> +	struct ice_fdir_v4 *p_v4;
> +	struct ice_fdir_v6 *p_v6;
> 
> +	for (item = pattern; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {
> +		if (item->type == RTE_FLOW_ITEM_TYPE_VXLAN)
> +			tunnel_type = ICE_FDIR_TUNNEL_TYPE_VXLAN;
> +		if (item->type == RTE_FLOW_ITEM_TYPE_GTPU)
> +			tunnel_type = ICE_FDIR_TUNNEL_TYPE_GTPU;
> +		if (item->type == RTE_FLOW_ITEM_TYPE_GTP_PSC)
> +			tunnel_type = ICE_FDIR_TUNNEL_TYPE_GTPU_EH;
> +	}
> +
> +	/* This loop parse flow pattern and distinguish Non-tunnel and tunnel
> +	 * flow. input_set_l is used for non-tunnel and tunnel inner part.
> +	 */

...
> 
> +		input_set = (tunnel_type && is_outer) ?
> +			    &input_set_f : &input_set_l;
[Cao, Yahui] input_set_l used for inner filed or non-tunnel filed looks confusing, can we just use input_set_l as non-tunnel filed or tunnel outer field ?
> +
> +		if (l3 == RTE_FLOW_ITEM_TYPE_IPV4)
> +			p_v4 = (tunnel_type && is_outer) ?
> +			       &filter->input.ip_outer.v4 :
> +			       &filter->input.ip.v4;
> +		if (l3 == RTE_FLOW_ITEM_TYPE_IPV6)
> +			p_v6 = (tunnel_type && is_outer) ?
> +			       &filter->input.ip_outer.v6 :
> +			       &filter->input.ip.v6;
> +
[Cao, Yahui] p_v4 and p_v6 pointer assignment looks redundant since it will be assigned in IPV4 and IPV6 switch case statement.
>  		switch (item_type) {

...
> +
> +			p_v4 = (tunnel_type && is_outer) ?
> +			       &filter->input.ip_outer.v4 :
> +			       &filter->input.ip.v4;
[Cao, Yahui]  it is assigned here again
> +			p_v4->dst_ip = ipv4_spec->hdr.dst_addr;
> +			p_v4->src_ip = ipv4_spec->hdr.src_addr;
> +			p_v4->tos = ipv4_spec->hdr.type_of_service;
>  			break;

......
> +
> +			p_v6 = (tunnel_type && is_outer) ?
> +			       &filter->input.ip_outer.v6 :
> +			       &filter->input.ip.v6;
[Cao, Yahui]  it is assigned here again
> +			rte_memcpy(&p_v6->dst_ip, ipv6_spec->hdr.dst_addr, 16);
> +			rte_memcpy(&p_v6->src_ip, ipv6_spec->hdr.src_addr, 16);
> +			vtc_flow_cpu = rte_be_to_cpu_32(ipv6_spec->hdr.vtc_flow);
> +			p_v6->tc = (uint8_t)(vtc_flow_cpu >> ICE_FDIR_IPV6_TC_OFFSET);
> +			p_v6->proto = ipv6_spec->hdr.proto;
> +			p_v6->hlim = ipv6_spec->hdr.hop_limits;
>  			break;
......
>  	filter->tunnel_type = tunnel_type;
>  	filter->input.flow_type = flow_type;
> -	filter->input_set = input_set;
> +	filter->input_set = input_set_l;
> +	filter->outer_input_set = input_set_f;
[Cao, Yahui] Correspondingly here, input_set and outer_input_set naming is also confusing.
> 
>  	return 0;
>  }
> --
> 2.25.1


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

* Re: [dpdk-dev] [PATCH v1 3/5] net/ice: add outer input set mask to distinguish outer fields
  2020-12-21  6:51 ` [dpdk-dev] [PATCH v1 3/5] net/ice: add outer input set mask to distinguish outer fields Zhirun Yan
@ 2020-12-25  5:27   ` Cao, Yahui
  2021-01-07  3:11     ` Yan, Zhirun
  0 siblings, 1 reply; 24+ messages in thread
From: Cao, Yahui @ 2020-12-25  5:27 UTC (permalink / raw)
  To: Yan, Zhirun, dev, Zhang, Qi Z, Wang, Xiao W, Guo, Junfeng
  Cc: Su, Simei, Xu, Ting, Zhang, Yuying



> -----Original Message-----
> From: Yan, Zhirun <zhirun.yan@intel.com>
> Sent: Monday, December 21, 2020 2:52 PM
> To: dev@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>; Cao, Yahui <yahui.cao@intel.com>; Wang, Xiao W <xiao.w.wang@intel.com>;
> Guo, Junfeng <junfeng.guo@intel.com>
> Cc: Su, Simei <simei.su@intel.com>; Xu, Ting <ting.xu@intel.com>; Zhang, Yuying <yuying.zhang@intel.com>; Yan, Zhirun
> <zhirun.yan@intel.com>
> Subject: [PATCH v1 3/5] net/ice: add outer input set mask to distinguish outer fields
> 
> Add 64-bit input_set_mask_f for outer input set. input_set_mask_f is
> used for inner fields or non-tunnel fields. Adjust indentation of
> ice_pattern_match_item list in switch, RSS and FDIR for easy
> review. For fields in tunnel layer, like GTPU TEID, put them in
> outer part.
> 
> Signed-off-by: Zhirun Yan <zhirun.yan@intel.com>
> ---
>  drivers/net/ice/ice_fdir_filter.c   | 110 ++++-----
>  drivers/net/ice/ice_generic_flow.h  |   1 +
>  drivers/net/ice/ice_hash.c          | 192 ++++++---------
>  drivers/net/ice/ice_switch_filter.c | 348 ++++++++++------------------
>  4 files changed, 231 insertions(+), 420 deletions(-)
> 
> diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c
> index 1f2576a444..76e0a8df38 100644
> --- a/drivers/net/ice/ice_fdir_filter.c
> +++ b/drivers/net/ice/ice_fdir_filter.c
> @@ -55,92 +55,74 @@
> 

...
> +	{pattern_eth_ipv4,				ICE_INSET_NONE,			ICE_FDIR_INSET_ETH_IPV4, 	ICE_INSET_NONE},
> +	{pattern_eth_ipv4_udp,				ICE_INSET_NONE,	ICE_FDIR_INSET_ETH_IPV4_UDP,		ICE_INSET_NONE},
> +	{pattern_eth_ipv4_tcp,				ICE_INSET_NONE,			ICE_FDIR_INSET_ETH_IPV4_TCP, 	ICE_INSET_NONE},
> +	{pattern_eth_ipv4_sctp,				ICE_INSET_NONE, 	ICE_FDIR_INSET_ETH_IPV4_SCTP,		ICE_INSET_NONE},
> +	{pattern_eth_ipv6,				ICE_INSET_NONE,			ICE_FDIR_INSET_ETH_IPV6, 	ICE_INSET_NONE},
> +	{pattern_eth_ipv6_udp,				ICE_INSET_NONE, 	ICE_FDIR_INSET_ETH_IPV6_UDP,		ICE_INSET_NONE},
> +	{pattern_eth_ipv6_tcp,				ICE_INSET_NONE,			ICE_FDIR_INSET_ETH_IPV6_TCP, 	ICE_INSET_NONE},
> +	{pattern_eth_ipv6_sctp,				ICE_INSET_NONE, 	ICE_FDIR_INSET_ETH_IPV6_SCTP,		ICE_INSET_NONE},
> +	{pattern_eth_ipv4_udp_vxlan_ipv4,		ICE_INSET_NONE,			ICE_FDIR_INSET_VXLAN_IPV4_L, 	ICE_INSET_NONE},
> +	{pattern_eth_ipv4_udp_vxlan_ipv4_udp,		ICE_INSET_NONE, 	ICE_FDIR_INSET_VXLAN_IPV4_UDP_L,	ICE_INSET_NONE},
> +	{pattern_eth_ipv4_udp_vxlan_ipv4_tcp,		ICE_INSET_NONE, 	ICE_FDIR_INSET_VXLAN_IPV4_TCP_L,	ICE_INSET_NONE},
> +	{pattern_eth_ipv4_udp_vxlan_ipv4_sctp,		ICE_INSET_NONE, 	ICE_FDIR_INSET_VXLAN_IPV4_SCTP_L,	ICE_INSET_NONE},
> +	{pattern_eth_ipv4_udp_vxlan_eth_ipv4,		ICE_INSET_NONE,			ICE_FDIR_INSET_VXLAN_IPV4_L, 		ICE_INSET_NONE},
> +	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_udp,	ICE_INSET_NONE,			ICE_FDIR_INSET_VXLAN_IPV4_UDP_L, 	ICE_INSET_NONE},
> +	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_tcp,	ICE_INSET_NONE,			ICE_FDIR_INSET_VXLAN_IPV4_TCP_L, 	ICE_INSET_NONE},
> +	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_sctp,	ICE_INSET_NONE,			ICE_FDIR_INSET_VXLAN_IPV4_SCTP_L, 	ICE_INSET_NONE},
>  };
> 

[Cao, Yahui] Why is the mask put in the 3rd column instead of 2nd column ? I prefer the way that 2nd column is for outer field and 3rd column is for inner field.
> 
>  static int
> --
> 2.25.1


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

* Re: [dpdk-dev] [PATCH v1 4/5] net/ice: add outer input set mask check
  2020-12-21  6:51 ` [dpdk-dev] [PATCH v1 4/5] net/ice: add outer input set mask check Zhirun Yan
@ 2020-12-25  5:28   ` Cao, Yahui
  2021-01-07  3:14     ` Yan, Zhirun
  0 siblings, 1 reply; 24+ messages in thread
From: Cao, Yahui @ 2020-12-25  5:28 UTC (permalink / raw)
  To: Yan, Zhirun, dev, Zhang, Qi Z, Wang, Xiao W, Guo, Junfeng
  Cc: Su, Simei, Xu, Ting, Zhang, Yuying

I suggest that you can merge this commit into the Patch 3/5, since they  are all about input set mask changes.

> -----Original Message-----
> From: Yan, Zhirun <zhirun.yan@intel.com>
> Sent: Monday, December 21, 2020 2:52 PM
> To: dev@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>; Cao, Yahui <yahui.cao@intel.com>; Wang, Xiao W <xiao.w.wang@intel.com>;
> Guo, Junfeng <junfeng.guo@intel.com>
> Cc: Su, Simei <simei.su@intel.com>; Xu, Ting <ting.xu@intel.com>; Zhang, Yuying <yuying.zhang@intel.com>; Yan, Zhirun
> <zhirun.yan@intel.com>
> Subject: [PATCH v1 4/5] net/ice: add outer input set mask check
> 
> Distinguish input set mask for inner/outer. Add outer input set
> mask check.
> 
> Signed-off-by: Zhirun Yan <zhirun.yan@intel.com>
> ---
>  drivers/net/ice/ice_fdir_filter.c  | 3 ++-
>  drivers/net/ice/ice_generic_flow.c | 2 ++
>  2 files changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c
> index 76e0a8df38..2d2b261368 100644
> --- a/drivers/net/ice/ice_fdir_filter.c
> +++ b/drivers/net/ice/ice_fdir_filter.c
> @@ -2020,7 +2020,8 @@ ice_fdir_parse(struct ice_adapter *ad,
>  	if (ret)
>  		goto error;
>  	input_set = filter->input_set | filter->outer_input_set;
> -	if (!input_set || input_set & ~item->input_set_mask) {
> +	if (!input_set || filter->input_set & ~item->input_set_mask ||
> +	    filter->outer_input_set & ~item->input_set_mask_f) {
>  		rte_flow_error_set(error, EINVAL,
>  				   RTE_FLOW_ERROR_TYPE_ITEM_SPEC,
>  				   pattern,
> diff --git a/drivers/net/ice/ice_generic_flow.c b/drivers/net/ice/ice_generic_flow.c
> index 1429cbc3b6..6c20b070c7 100644
> --- a/drivers/net/ice/ice_generic_flow.c
> +++ b/drivers/net/ice/ice_generic_flow.c
> @@ -2088,6 +2088,8 @@ ice_search_pattern_match_item(const struct rte_flow_item pattern[],
>  					items)) {
>  			pattern_match_item->input_set_mask =
>  				array[i].input_set_mask;
> +			pattern_match_item->input_set_mask_f =
> +				array[i].input_set_mask_f;
>  			pattern_match_item->pattern_list =
>  				array[i].pattern_list;
>  			pattern_match_item->meta = array[i].meta;
> --
> 2.25.1


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

* Re: [dpdk-dev] [PATCH v1 2/5] net/ice: refactor flow pattern parser
  2020-12-25  5:21   ` Cao, Yahui
@ 2021-01-07  3:07     ` Yan, Zhirun
  0 siblings, 0 replies; 24+ messages in thread
From: Yan, Zhirun @ 2021-01-07  3:07 UTC (permalink / raw)
  To: Cao, Yahui, dev, Zhang, Qi Z, Wang, Xiao W, Guo, Junfeng
  Cc: Su, Simei, Xu, Ting, Zhang, Yuying



> -----Original Message-----
> From: Cao, Yahui
> Sent: Friday, December 25, 2020 1:22 PM
> To: Yan, Zhirun <zhirun.yan@intel.com>; dev@dpdk.org; Zhang, Qi Z
> <qi.z.zhang@intel.com>; Wang, Xiao W <xiao.w.wang@intel.com>; Guo,
> Junfeng <junfeng.guo@intel.com>
> Cc: Su, Simei <simei.su@intel.com>; Xu, Ting <ting.xu@intel.com>; Zhang,
> Yuying <yuying.zhang@intel.com>
> Subject: RE: [PATCH v1 2/5] net/ice: refactor flow pattern parser
> 
> 
> 
> > -----Original Message-----
> > From: Yan, Zhirun <zhirun.yan@intel.com>
> > Sent: Monday, December 21, 2020 2:52 PM
> > To: dev@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>; Cao, Yahui
> > <yahui.cao@intel.com>; Wang, Xiao W <xiao.w.wang@intel.com>; Guo,
> > Junfeng <junfeng.guo@intel.com>
> > Cc: Su, Simei <simei.su@intel.com>; Xu, Ting <ting.xu@intel.com>;
> > Zhang, Yuying <yuying.zhang@intel.com>; Yan, Zhirun
> > <zhirun.yan@intel.com>
> > Subject: [PATCH v1 2/5] net/ice: refactor flow pattern parser
> >
> > Distinguish inner/outer input set. And avoid too many nested
> > conditionals in each type's parser. input_set_f is used for outer
> > fields, input_set_l is used for inner or non-tunnel fields.
> >
> > Signed-off-by: Zhirun Yan <zhirun.yan@intel.com>
> > ---
> >  drivers/net/ice/ice_fdir_filter.c | 467
> > +++++++++++++++---------------
> >  1 file changed, 229 insertions(+), 238 deletions(-)
> >
> > diff --git a/drivers/net/ice/ice_fdir_filter.c
> > b/drivers/net/ice/ice_fdir_filter.c
> > index 92b8a7e6ad..1f2576a444 100644
> > --- a/drivers/net/ice/ice_fdir_filter.c
> > +++ b/drivers/net/ice/ice_fdir_filter.c
> > @@ -1646,7 +1646,9 @@ ice_fdir_parse_pattern(__rte_unused struct
> ice_adapter *ad,
> >  	const struct rte_flow_item_vxlan *vxlan_spec, *vxlan_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 input_set_l = ICE_INSET_NONE;
> > +	uint64_t input_set_f = ICE_INSET_NONE;
> > +	uint64_t *input_set;
> >  	uint8_t flow_type = ICE_FLTR_PTYPE_NONF_NONE;
> >  	uint8_t  ipv6_addr_mask[16] = {
> >  		0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, @@ -1655,289
> > +1657,276 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter
> *ad,
> >  	uint32_t vtc_flow_cpu;
> >  	uint16_t ether_type;
> >  	enum rte_flow_item_type next_type;
> > +	bool is_outer = true;
> > +	struct ice_fdir_extra *p_ext_data;
> > +	struct ice_fdir_v4 *p_v4;
> > +	struct ice_fdir_v6 *p_v6;
> >
> > +	for (item = pattern; item->type != RTE_FLOW_ITEM_TYPE_END;
> item++) {
> > +		if (item->type == RTE_FLOW_ITEM_TYPE_VXLAN)
> > +			tunnel_type = ICE_FDIR_TUNNEL_TYPE_VXLAN;
> > +		if (item->type == RTE_FLOW_ITEM_TYPE_GTPU)
> > +			tunnel_type = ICE_FDIR_TUNNEL_TYPE_GTPU;
> > +		if (item->type == RTE_FLOW_ITEM_TYPE_GTP_PSC)
> > +			tunnel_type = ICE_FDIR_TUNNEL_TYPE_GTPU_EH;
> > +	}
> > +
> > +	/* This loop parse flow pattern and distinguish Non-tunnel and
> tunnel
> > +	 * flow. input_set_l is used for non-tunnel and tunnel inner part.
> > +	 */
> 
> ...
> >
> > +		input_set = (tunnel_type && is_outer) ?
> > +			    &input_set_f : &input_set_l;
> [Cao, Yahui] input_set_l used for inner filed or non-tunnel filed looks
> confusing, can we just use input_set_l as non-tunnel filed or tunnel outer
> field ?

Yes, both are OK.
In my view, Non-tunnel and inner part have no tunnel layer info, they can be the same definition.
But for tunnel type, the outer part is different. It may contain tunnel layer info like VNI in VXLAN. 
Only this part is specific with tunnel type.

> > +
> > +		if (l3 == RTE_FLOW_ITEM_TYPE_IPV4)
> > +			p_v4 = (tunnel_type && is_outer) ?
> > +			       &filter->input.ip_outer.v4 :
> > +			       &filter->input.ip.v4;
> > +		if (l3 == RTE_FLOW_ITEM_TYPE_IPV6)
> > +			p_v6 = (tunnel_type && is_outer) ?
> > +			       &filter->input.ip_outer.v6 :
> > +			       &filter->input.ip.v6;
> > +
> [Cao, Yahui] p_v4 and p_v6 pointer assignment looks redundant since it will
> be assigned in IPV4 and IPV6 switch case statement.

If L3 has no fields, then we could not know whether it is ipv4 or ipv6 for L4 case.
You are right. The p_v4/6 assignment can be set earlier in L3 layer parse.

> >  		switch (item_type) {
> 
> ...
> > +
> > +			p_v4 = (tunnel_type && is_outer) ?
> > +			       &filter->input.ip_outer.v4 :
> > +			       &filter->input.ip.v4;
> [Cao, Yahui]  it is assigned here again

Yes, I will move this earlier when set flow item type.


> > +			p_v4->dst_ip = ipv4_spec->hdr.dst_addr;
> > +			p_v4->src_ip = ipv4_spec->hdr.src_addr;
> > +			p_v4->tos = ipv4_spec->hdr.type_of_service;
> >  			break;
> 
> ......
> > +
> > +			p_v6 = (tunnel_type && is_outer) ?
> > +			       &filter->input.ip_outer.v6 :
> > +			       &filter->input.ip.v6;
> [Cao, Yahui]  it is assigned here again

Yes, I will fix it.

> > +			rte_memcpy(&p_v6->dst_ip, ipv6_spec-
> >hdr.dst_addr, 16);
> > +			rte_memcpy(&p_v6->src_ip, ipv6_spec-
> >hdr.src_addr, 16);
> > +			vtc_flow_cpu = rte_be_to_cpu_32(ipv6_spec-
> >hdr.vtc_flow);
> > +			p_v6->tc = (uint8_t)(vtc_flow_cpu >>
> ICE_FDIR_IPV6_TC_OFFSET);
> > +			p_v6->proto = ipv6_spec->hdr.proto;
> > +			p_v6->hlim = ipv6_spec->hdr.hop_limits;
> >  			break;
> ......
> >  	filter->tunnel_type = tunnel_type;
> >  	filter->input.flow_type = flow_type;
> > -	filter->input_set = input_set;
> > +	filter->input_set = input_set_l;
> > +	filter->outer_input_set = input_set_f;
> [Cao, Yahui] Correspondingly here, input_set and outer_input_set naming is
> also confusing.

input_set is used for tunnel inner part and non-tunnel type.
outer_input_set is only for tunnel outer part.
Thanks.

> >
> >  	return 0;
> >  }
> > --
> > 2.25.1


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

* Re: [dpdk-dev] [PATCH v1 3/5] net/ice: add outer input set mask to distinguish outer fields
  2020-12-25  5:27   ` Cao, Yahui
@ 2021-01-07  3:11     ` Yan, Zhirun
  0 siblings, 0 replies; 24+ messages in thread
From: Yan, Zhirun @ 2021-01-07  3:11 UTC (permalink / raw)
  To: Cao, Yahui, dev, Zhang, Qi Z, Wang, Xiao W, Guo, Junfeng
  Cc: Su, Simei, Xu, Ting, Zhang, Yuying



> -----Original Message-----
> From: Cao, Yahui
> Sent: Friday, December 25, 2020 1:28 PM
> To: Yan, Zhirun <zhirun.yan@intel.com>; dev@dpdk.org; Zhang, Qi Z
> <qi.z.zhang@intel.com>; Wang, Xiao W <xiao.w.wang@intel.com>; Guo,
> Junfeng <junfeng.guo@intel.com>
> Cc: Su, Simei <simei.su@intel.com>; Xu, Ting <ting.xu@intel.com>; Zhang,
> Yuying <yuying.zhang@intel.com>
> Subject: RE: [PATCH v1 3/5] net/ice: add outer input set mask to distinguish
> outer fields
> 
> 
> 
> > -----Original Message-----
> > From: Yan, Zhirun <zhirun.yan@intel.com>
> > Sent: Monday, December 21, 2020 2:52 PM
> > To: dev@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>; Cao, Yahui
> > <yahui.cao@intel.com>; Wang, Xiao W <xiao.w.wang@intel.com>; Guo,
> > Junfeng <junfeng.guo@intel.com>
> > Cc: Su, Simei <simei.su@intel.com>; Xu, Ting <ting.xu@intel.com>;
> > Zhang, Yuying <yuying.zhang@intel.com>; Yan, Zhirun
> > <zhirun.yan@intel.com>
> > Subject: [PATCH v1 3/5] net/ice: add outer input set mask to
> > distinguish outer fields
> >
> > Add 64-bit input_set_mask_f for outer input set. input_set_mask_f is
> > used for inner fields or non-tunnel fields. Adjust indentation of
> > ice_pattern_match_item list in switch, RSS and FDIR for easy review.
> > For fields in tunnel layer, like GTPU TEID, put them in outer part.
> >
> > Signed-off-by: Zhirun Yan <zhirun.yan@intel.com>
> > ---
> >  drivers/net/ice/ice_fdir_filter.c   | 110 ++++-----
> >  drivers/net/ice/ice_generic_flow.h  |   1 +
> >  drivers/net/ice/ice_hash.c          | 192 ++++++---------
> >  drivers/net/ice/ice_switch_filter.c | 348
> > ++++++++++------------------
> >  4 files changed, 231 insertions(+), 420 deletions(-)
> >
> > diff --git a/drivers/net/ice/ice_fdir_filter.c
> > b/drivers/net/ice/ice_fdir_filter.c
> > index 1f2576a444..76e0a8df38 100644
> > --- a/drivers/net/ice/ice_fdir_filter.c
> > +++ b/drivers/net/ice/ice_fdir_filter.c
> > @@ -55,92 +55,74 @@
> >
> 
> ...
> > +	{pattern_eth_ipv4,				ICE_INSET_NONE,
> 			ICE_FDIR_INSET_ETH_IPV4, 	ICE_INSET_NONE},
> > +	{pattern_eth_ipv4_udp,
> 	ICE_INSET_NONE,	ICE_FDIR_INSET_ETH_IPV4_UDP,
> 	ICE_INSET_NONE},
> > +	{pattern_eth_ipv4_tcp,
> 	ICE_INSET_NONE,
> 	ICE_FDIR_INSET_ETH_IPV4_TCP, 	ICE_INSET_NONE},
> > +	{pattern_eth_ipv4_sctp,
> 	ICE_INSET_NONE, 	ICE_FDIR_INSET_ETH_IPV4_SCTP,
> 	ICE_INSET_NONE},
> > +	{pattern_eth_ipv6,				ICE_INSET_NONE,
> 			ICE_FDIR_INSET_ETH_IPV6, 	ICE_INSET_NONE},
> > +	{pattern_eth_ipv6_udp,
> 	ICE_INSET_NONE, 	ICE_FDIR_INSET_ETH_IPV6_UDP,
> 	ICE_INSET_NONE},
> > +	{pattern_eth_ipv6_tcp,
> 	ICE_INSET_NONE,
> 	ICE_FDIR_INSET_ETH_IPV6_TCP, 	ICE_INSET_NONE},
> > +	{pattern_eth_ipv6_sctp,
> 	ICE_INSET_NONE, 	ICE_FDIR_INSET_ETH_IPV6_SCTP,
> 	ICE_INSET_NONE},
> > +	{pattern_eth_ipv4_udp_vxlan_ipv4,		ICE_INSET_NONE,
> 			ICE_FDIR_INSET_VXLAN_IPV4_L,
> 	ICE_INSET_NONE},
> > +	{pattern_eth_ipv4_udp_vxlan_ipv4_udp,
> 	ICE_INSET_NONE, 	ICE_FDIR_INSET_VXLAN_IPV4_UDP_L,
> 	ICE_INSET_NONE},
> > +	{pattern_eth_ipv4_udp_vxlan_ipv4_tcp,
> 	ICE_INSET_NONE, 	ICE_FDIR_INSET_VXLAN_IPV4_TCP_L,
> 	ICE_INSET_NONE},
> > +	{pattern_eth_ipv4_udp_vxlan_ipv4_sctp,
> 	ICE_INSET_NONE, 	ICE_FDIR_INSET_VXLAN_IPV4_SCTP_L,
> 	ICE_INSET_NONE},
> > +	{pattern_eth_ipv4_udp_vxlan_eth_ipv4,
> 	ICE_INSET_NONE,
> 	ICE_FDIR_INSET_VXLAN_IPV4_L, 		ICE_INSET_NONE},
> > +	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_udp,	ICE_INSET_NONE,
> 			ICE_FDIR_INSET_VXLAN_IPV4_UDP_L,
> 	ICE_INSET_NONE},
> > +	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_tcp,	ICE_INSET_NONE,
> 			ICE_FDIR_INSET_VXLAN_IPV4_TCP_L,
> 	ICE_INSET_NONE},
> > +	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_sctp,	ICE_INSET_NONE,
> 			ICE_FDIR_INSET_VXLAN_IPV4_SCTP_L,
> 	ICE_INSET_NONE},
> >  };
> >
> 
> [Cao, Yahui] Why is the mask put in the 3rd column instead of 2nd column ? I
> prefer the way that 2nd column is for outer field and 3rd column is for inner
> field.

Both are OK. But for my way, the 2nd column is only for tunnel outer. The 3rd
can be reused by non-tunnel and tunnel inner part. I will redefine the macro.

> >
> >  static int
> > --
> > 2.25.1


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

* Re: [dpdk-dev] [PATCH v1 4/5] net/ice: add outer input set mask check
  2020-12-25  5:28   ` Cao, Yahui
@ 2021-01-07  3:14     ` Yan, Zhirun
  0 siblings, 0 replies; 24+ messages in thread
From: Yan, Zhirun @ 2021-01-07  3:14 UTC (permalink / raw)
  To: Cao, Yahui, dev, Zhang, Qi Z, Wang, Xiao W, Guo, Junfeng
  Cc: Su, Simei, Xu, Ting, Zhang, Yuying



> -----Original Message-----
> From: Cao, Yahui
> Sent: Friday, December 25, 2020 1:29 PM
> To: Yan, Zhirun <zhirun.yan@intel.com>; dev@dpdk.org; Zhang, Qi Z
> <qi.z.zhang@intel.com>; Wang, Xiao W <xiao.w.wang@intel.com>; Guo,
> Junfeng <junfeng.guo@intel.com>
> Cc: Su, Simei <simei.su@intel.com>; Xu, Ting <ting.xu@intel.com>; Zhang,
> Yuying <yuying.zhang@intel.com>
> Subject: RE: [PATCH v1 4/5] net/ice: add outer input set mask check
> 
> I suggest that you can merge this commit into the Patch 3/5, since they  are
> all about input set mask changes.
> 
Yes. I will meld into previous commit. Thanks.

> > -----Original Message-----
> > From: Yan, Zhirun <zhirun.yan@intel.com>
> > Sent: Monday, December 21, 2020 2:52 PM
> > To: dev@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>; Cao, Yahui
> > <yahui.cao@intel.com>; Wang, Xiao W <xiao.w.wang@intel.com>; Guo,
> > Junfeng <junfeng.guo@intel.com>
> > Cc: Su, Simei <simei.su@intel.com>; Xu, Ting <ting.xu@intel.com>;
> > Zhang, Yuying <yuying.zhang@intel.com>; Yan, Zhirun
> > <zhirun.yan@intel.com>
> > Subject: [PATCH v1 4/5] net/ice: add outer input set mask check
> >
> > Distinguish input set mask for inner/outer. Add outer input set mask
> > check.
> >
> > Signed-off-by: Zhirun Yan <zhirun.yan@intel.com>
> > ---
> >  drivers/net/ice/ice_fdir_filter.c  | 3 ++-
> > drivers/net/ice/ice_generic_flow.c | 2 ++
> >  2 files changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/ice/ice_fdir_filter.c
> > b/drivers/net/ice/ice_fdir_filter.c
> > index 76e0a8df38..2d2b261368 100644
> > --- a/drivers/net/ice/ice_fdir_filter.c
> > +++ b/drivers/net/ice/ice_fdir_filter.c
> > @@ -2020,7 +2020,8 @@ ice_fdir_parse(struct ice_adapter *ad,
> >  	if (ret)
> >  		goto error;
> >  	input_set = filter->input_set | filter->outer_input_set;
> > -	if (!input_set || input_set & ~item->input_set_mask) {
> > +	if (!input_set || filter->input_set & ~item->input_set_mask ||
> > +	    filter->outer_input_set & ~item->input_set_mask_f) {
> >  		rte_flow_error_set(error, EINVAL,
> >  				   RTE_FLOW_ERROR_TYPE_ITEM_SPEC,
> >  				   pattern,
> > diff --git a/drivers/net/ice/ice_generic_flow.c
> > b/drivers/net/ice/ice_generic_flow.c
> > index 1429cbc3b6..6c20b070c7 100644
> > --- a/drivers/net/ice/ice_generic_flow.c
> > +++ b/drivers/net/ice/ice_generic_flow.c
> > @@ -2088,6 +2088,8 @@ ice_search_pattern_match_item(const struct
> rte_flow_item pattern[],
> >  					items)) {
> >  			pattern_match_item->input_set_mask =
> >  				array[i].input_set_mask;
> > +			pattern_match_item->input_set_mask_f =
> > +				array[i].input_set_mask_f;
> >  			pattern_match_item->pattern_list =
> >  				array[i].pattern_list;
> >  			pattern_match_item->meta = array[i].meta;
> > --
> > 2.25.1


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

* [dpdk-dev] [PATCH v2 0/3] Refactor FDIR pattern parser
  2020-12-21  6:51 [dpdk-dev] [PATCH v1 0/5] Refactor FDIR pattern parser Zhirun Yan
                   ` (4 preceding siblings ...)
  2020-12-21  6:51 ` [dpdk-dev] [PATCH v1 5/5] net/ice: enable FDIR outer/inner fields for VXLAN Zhirun Yan
@ 2021-01-27  5:29 ` Zhirun Yan
  2021-01-27  5:29   ` [dpdk-dev] [PATCH v2 1/3] net/ice: clean input set macro definition Zhirun Yan
                     ` (3 more replies)
  5 siblings, 4 replies; 24+ messages in thread
From: Zhirun Yan @ 2021-01-27  5:29 UTC (permalink / raw)
  To: dev, qi.z.zhang, yahui.cao, xiao.w.wang, junfeng.guo
  Cc: simei.su, ting.xu, yuying.zhang, xuan.ding, Zhirun Yan

V2:

Meld patch 4,5 into 3.
Update ACL input set.
Clear PPPoE GTPU input set in RSS.
Put p_v4/6 assignment earlier to reduce redundant code in FDIR.




This patch set refactor FDIR pattern parser.

Redefine input set. Ignore the redundant inner/outer info.
Align the parser action with hardware, using input_set_f for outer,
input_set_l for inner or non-tunnel fields.
Adjust indentation for easy review.
Enable VXLAN inner/outer fields.

Zhirun Yan (3):
  net/ice: clean input set macro definition
  net/ice: refactor flow pattern parser
  net/ice: add outer input set mask to distinguish outer fields

 drivers/net/ice/ice_acl_filter.c    |   8 +-
 drivers/net/ice/ice_fdir_filter.c   | 558 ++++++++++++++--------------
 drivers/net/ice/ice_generic_flow.c  |   2 +
 drivers/net/ice/ice_generic_flow.h  | 235 +++++-------
 drivers/net/ice/ice_hash.c          | 243 ++++++------
 drivers/net/ice/ice_switch_filter.c | 294 +++++----------
 6 files changed, 590 insertions(+), 750 deletions(-)

-- 
2.25.1


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

* [dpdk-dev] [PATCH v2 1/3] net/ice: clean input set macro definition
  2021-01-27  5:29 ` [dpdk-dev] [PATCH v2 0/3] Refactor FDIR pattern parser Zhirun Yan
@ 2021-01-27  5:29   ` Zhirun Yan
  2021-01-27  5:29   ` [dpdk-dev] [PATCH v2 2/3] net/ice: refactor flow pattern parser Zhirun Yan
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 24+ messages in thread
From: Zhirun Yan @ 2021-01-27  5:29 UTC (permalink / raw)
  To: dev, qi.z.zhang, yahui.cao, xiao.w.wang, junfeng.guo
  Cc: simei.su, ting.xu, yuying.zhang, xuan.ding, Zhirun Yan

Currently, the macro of input set use 2 bits, one bit for protocol and
inner/outer, another bit for src/dst field. But this ccould not distinguish
a rule with inner and outer fields for tunnel packet.
Redefine input set macro to make it clear. Only use these two bits for
protocol and field. Ignore the redundant inner/outer info.

ICE_INSET_TUN_* is used by switch module, should be removed after
switch refactor.

Signed-off-by: Zhirun Yan <zhirun.yan@intel.com>
---
 drivers/net/ice/ice_fdir_filter.c  |   8 +-
 drivers/net/ice/ice_generic_flow.h | 234 ++++++++++++-----------------
 2 files changed, 104 insertions(+), 138 deletions(-)

diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c
index ce6aa09d3d..4e99df1272 100644
--- a/drivers/net/ice/ice_fdir_filter.c
+++ b/drivers/net/ice/ice_fdir_filter.c
@@ -56,19 +56,19 @@
 	ICE_INSET_SCTP_SRC_PORT | ICE_INSET_SCTP_DST_PORT)
 
 #define ICE_FDIR_INSET_VXLAN_IPV4 (\
-	ICE_INSET_TUN_IPV4_SRC | ICE_INSET_TUN_IPV4_DST)
+	ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST)
 
 #define ICE_FDIR_INSET_VXLAN_IPV4_TCP (\
 	ICE_FDIR_INSET_VXLAN_IPV4 | \
-	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT)
+	ICE_INSET_TCP_SRC_PORT | ICE_INSET_TCP_DST_PORT)
 
 #define ICE_FDIR_INSET_VXLAN_IPV4_UDP (\
 	ICE_FDIR_INSET_VXLAN_IPV4 | \
-	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT)
+	ICE_INSET_UDP_SRC_PORT | ICE_INSET_UDP_DST_PORT)
 
 #define ICE_FDIR_INSET_VXLAN_IPV4_SCTP (\
 	ICE_FDIR_INSET_VXLAN_IPV4 | \
-	ICE_INSET_TUN_SCTP_SRC_PORT | ICE_INSET_TUN_SCTP_DST_PORT)
+	ICE_INSET_SCTP_SRC_PORT | ICE_INSET_SCTP_DST_PORT)
 
 #define ICE_FDIR_INSET_IPV4_GTPU (\
 	ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST | ICE_INSET_GTPU_TEID)
diff --git a/drivers/net/ice/ice_generic_flow.h b/drivers/net/ice/ice_generic_flow.h
index 18918769d2..3c648c0f4f 100644
--- a/drivers/net/ice/ice_generic_flow.h
+++ b/drivers/net/ice/ice_generic_flow.h
@@ -9,177 +9,143 @@
 
 /* protocol */
 
-#define ICE_PROT_MAC_INNER         (1ULL << 1)
-#define ICE_PROT_MAC_OUTER         (1ULL << 2)
-#define ICE_PROT_VLAN_INNER        (1ULL << 3)
-#define ICE_PROT_VLAN_OUTER        (1ULL << 4)
-#define ICE_PROT_IPV4_INNER        (1ULL << 5)
-#define ICE_PROT_IPV4_OUTER        (1ULL << 6)
-#define ICE_PROT_IPV6_INNER        (1ULL << 7)
-#define ICE_PROT_IPV6_OUTER        (1ULL << 8)
-#define ICE_PROT_TCP_INNER         (1ULL << 9)
-#define ICE_PROT_TCP_OUTER         (1ULL << 10)
-#define ICE_PROT_UDP_INNER         (1ULL << 11)
-#define ICE_PROT_UDP_OUTER         (1ULL << 12)
-#define ICE_PROT_SCTP_INNER        (1ULL << 13)
-#define ICE_PROT_SCTP_OUTER        (1ULL << 14)
-#define ICE_PROT_ICMP4_INNER       (1ULL << 15)
-#define ICE_PROT_ICMP4_OUTER       (1ULL << 16)
-#define ICE_PROT_ICMP6_INNER       (1ULL << 17)
-#define ICE_PROT_ICMP6_OUTER       (1ULL << 18)
-#define ICE_PROT_VXLAN             (1ULL << 19)
-#define ICE_PROT_NVGRE             (1ULL << 20)
-#define ICE_PROT_GTPU              (1ULL << 21)
-#define ICE_PROT_PPPOE_S           (1ULL << 22)
-#define ICE_PROT_ESP               (1ULL << 23)
-#define ICE_PROT_AH                (1ULL << 24)
-#define ICE_PROT_L2TPV3OIP         (1ULL << 25)
-#define ICE_PROT_PFCP              (1ULL << 26)
+#define ICE_PROT_MAC			BIT_ULL(1)
+#define ICE_PROT_VLAN			BIT_ULL(2)
+#define ICE_PROT_IPV4			BIT_ULL(3)
+#define ICE_PROT_IPV6			BIT_ULL(4)
+#define ICE_PROT_TCP			BIT_ULL(5)
+#define ICE_PROT_UDP			BIT_ULL(6)
+#define ICE_PROT_SCTP			BIT_ULL(7)
+#define ICE_PROT_ICMP4			BIT_ULL(8)
+#define ICE_PROT_ICMP6			BIT_ULL(9)
+#define ICE_PROT_VXLAN			BIT_ULL(10)
+#define ICE_PROT_NVGRE			BIT_ULL(11)
+#define ICE_PROT_GTPU			BIT_ULL(12)
+#define ICE_PROT_PPPOE_S		BIT_ULL(13)
+#define ICE_PROT_ESP			BIT_ULL(14)
+#define ICE_PROT_AH			BIT_ULL(15)
+#define ICE_PROT_L2TPV3OIP		BIT_ULL(16)
+#define ICE_PROT_PFCP			BIT_ULL(17)
 
 /* field */
 
-#define ICE_SMAC                   (1ULL << 63)
-#define ICE_DMAC                   (1ULL << 62)
-#define ICE_ETHERTYPE              (1ULL << 61)
-#define ICE_IP_SRC                 (1ULL << 60)
-#define ICE_IP_DST                 (1ULL << 59)
-#define ICE_IP_PROTO               (1ULL << 58)
-#define ICE_IP_TTL                 (1ULL << 57)
-#define ICE_IP_TOS                 (1ULL << 56)
-#define ICE_SPORT                  (1ULL << 55)
-#define ICE_DPORT                  (1ULL << 54)
-#define ICE_ICMP_TYPE              (1ULL << 53)
-#define ICE_ICMP_CODE              (1ULL << 52)
-#define ICE_VXLAN_VNI              (1ULL << 51)
-#define ICE_NVGRE_TNI              (1ULL << 50)
-#define ICE_GTPU_TEID              (1ULL << 49)
-#define ICE_GTPU_QFI               (1ULL << 48)
-#define ICE_PPPOE_SESSION          (1ULL << 47)
-#define ICE_PPPOE_PROTO            (1ULL << 46)
-#define ICE_ESP_SPI                (1ULL << 45)
-#define ICE_AH_SPI                 (1ULL << 44)
-#define ICE_L2TPV3OIP_SESSION_ID   (1ULL << 43)
-#define ICE_PFCP_SEID              (1ULL << 42)
-#define ICE_PFCP_S_FIELD           (1ULL << 41)
+#define ICE_SMAC			BIT_ULL(63)
+#define ICE_DMAC			BIT_ULL(62)
+#define ICE_ETHERTYPE			BIT_ULL(61)
+#define ICE_IP_SRC			BIT_ULL(60)
+#define ICE_IP_DST			BIT_ULL(59)
+#define ICE_IP_PROTO			BIT_ULL(58)
+#define ICE_IP_TTL			BIT_ULL(57)
+#define ICE_IP_TOS			BIT_ULL(56)
+#define ICE_SPORT			BIT_ULL(55)
+#define ICE_DPORT			BIT_ULL(54)
+#define ICE_ICMP_TYPE			BIT_ULL(53)
+#define ICE_ICMP_CODE			BIT_ULL(52)
+#define ICE_VXLAN_VNI			BIT_ULL(51)
+#define ICE_NVGRE_TNI			BIT_ULL(50)
+#define ICE_GTPU_TEID			BIT_ULL(49)
+#define ICE_GTPU_QFI			BIT_ULL(48)
+#define ICE_PPPOE_SESSION		BIT_ULL(47)
+#define ICE_PPPOE_PROTO			BIT_ULL(46)
+#define ICE_ESP_SPI			BIT_ULL(45)
+#define ICE_AH_SPI			BIT_ULL(44)
+#define ICE_L2TPV3OIP_SESSION_ID	BIT_ULL(43)
+#define ICE_PFCP_SEID			BIT_ULL(42)
+#define ICE_PFCP_S_FIELD		BIT_ULL(41)
 
 /* input set */
 
-#define ICE_INSET_NONE             0ULL
-
-/* non-tunnel */
-
-#define ICE_INSET_SMAC         (ICE_PROT_MAC_OUTER | ICE_SMAC)
-#define ICE_INSET_DMAC         (ICE_PROT_MAC_OUTER | ICE_DMAC)
-#define ICE_INSET_VLAN_INNER   (ICE_PROT_VLAN_INNER)
-#define ICE_INSET_VLAN_OUTER   (ICE_PROT_VLAN_OUTER)
-#define ICE_INSET_ETHERTYPE    (ICE_ETHERTYPE)
-
-#define ICE_INSET_IPV4_SRC \
-	(ICE_PROT_IPV4_OUTER | ICE_IP_SRC)
-#define ICE_INSET_IPV4_DST \
-	(ICE_PROT_IPV4_OUTER | ICE_IP_DST)
-#define ICE_INSET_IPV4_TOS \
-	(ICE_PROT_IPV4_OUTER | ICE_IP_TOS)
-#define ICE_INSET_IPV4_PROTO \
-	(ICE_PROT_IPV4_OUTER | ICE_IP_PROTO)
-#define ICE_INSET_IPV4_TTL \
-	(ICE_PROT_IPV4_OUTER | ICE_IP_TTL)
-#define ICE_INSET_IPV6_SRC \
-	(ICE_PROT_IPV6_OUTER | ICE_IP_SRC)
-#define ICE_INSET_IPV6_DST \
-	(ICE_PROT_IPV6_OUTER | ICE_IP_DST)
-#define ICE_INSET_IPV6_NEXT_HDR \
-	(ICE_PROT_IPV6_OUTER | ICE_IP_PROTO)
-#define ICE_INSET_IPV6_HOP_LIMIT \
-	(ICE_PROT_IPV6_OUTER | ICE_IP_TTL)
-#define ICE_INSET_IPV6_TC \
-	(ICE_PROT_IPV6_OUTER | ICE_IP_TOS)
-
-#define ICE_INSET_TCP_SRC_PORT \
-	(ICE_PROT_TCP_OUTER | ICE_SPORT)
-#define ICE_INSET_TCP_DST_PORT \
-	(ICE_PROT_TCP_OUTER | ICE_DPORT)
-#define ICE_INSET_UDP_SRC_PORT \
-	(ICE_PROT_UDP_OUTER | ICE_SPORT)
-#define ICE_INSET_UDP_DST_PORT \
-	(ICE_PROT_UDP_OUTER | ICE_DPORT)
-#define ICE_INSET_SCTP_SRC_PORT \
-	(ICE_PROT_SCTP_OUTER | ICE_SPORT)
-#define ICE_INSET_SCTP_DST_PORT \
-	(ICE_PROT_SCTP_OUTER | ICE_DPORT)
-#define ICE_INSET_ICMP4_SRC_PORT \
-	(ICE_PROT_ICMP4_OUTER | ICE_SPORT)
-#define ICE_INSET_ICMP4_DST_PORT \
-	(ICE_PROT_ICMP4_OUTER | ICE_DPORT)
-#define ICE_INSET_ICMP6_SRC_PORT \
-	(ICE_PROT_ICMP6_OUTER | ICE_SPORT)
-#define ICE_INSET_ICMP6_DST_PORT \
-	(ICE_PROT_ICMP6_OUTER | ICE_DPORT)
-#define ICE_INSET_ICMP4_TYPE \
-	(ICE_PROT_ICMP4_OUTER | ICE_ICMP_TYPE)
-#define ICE_INSET_ICMP4_CODE \
-	(ICE_PROT_ICMP4_OUTER | ICE_ICMP_CODE)
-#define ICE_INSET_ICMP6_TYPE \
-	(ICE_PROT_ICMP6_OUTER | ICE_ICMP_TYPE)
-#define ICE_INSET_ICMP6_CODE \
-	(ICE_PROT_ICMP6_OUTER | ICE_ICMP_CODE)
+#define ICE_INSET_NONE			0ULL
+
+#define ICE_INSET_SMAC			(ICE_SMAC)
+#define ICE_INSET_DMAC			(ICE_DMAC)
+#define ICE_INSET_VLAN			(ICE_PROT_VLAN)
+#define ICE_INSET_VLAN_INNER		(ICE_PROT_VLAN)
+#define ICE_INSET_VLAN_OUTER		(ICE_PROT_VLAN)
+#define ICE_INSET_ETHERTYPE		(ICE_ETHERTYPE)
+
+#define ICE_INSET_IPV4_SRC		(ICE_PROT_IPV4 | ICE_IP_SRC)
+#define ICE_INSET_IPV4_DST		(ICE_PROT_IPV4 | ICE_IP_DST)
+#define ICE_INSET_IPV4_TOS		(ICE_PROT_IPV4 | ICE_IP_TOS)
+#define ICE_INSET_IPV4_PROTO		(ICE_PROT_IPV4 | ICE_IP_PROTO)
+#define ICE_INSET_IPV4_TTL		(ICE_PROT_IPV4 | ICE_IP_TTL)
+#define ICE_INSET_IPV6_SRC		(ICE_PROT_IPV6 | ICE_IP_SRC)
+#define ICE_INSET_IPV6_DST		(ICE_PROT_IPV6 | ICE_IP_DST)
+#define ICE_INSET_IPV6_NEXT_HDR		(ICE_PROT_IPV6 | ICE_IP_PROTO)
+#define ICE_INSET_IPV6_HOP_LIMIT	(ICE_PROT_IPV6 | ICE_IP_TTL)
+#define ICE_INSET_IPV6_TC		(ICE_PROT_IPV6 | ICE_IP_TOS)
+
+#define ICE_INSET_TCP_SRC_PORT		(ICE_PROT_TCP | ICE_SPORT)
+#define ICE_INSET_TCP_DST_PORT		(ICE_PROT_TCP | ICE_DPORT)
+#define ICE_INSET_UDP_SRC_PORT		(ICE_PROT_UDP | ICE_SPORT)
+#define ICE_INSET_UDP_DST_PORT		(ICE_PROT_UDP | ICE_DPORT)
+#define ICE_INSET_SCTP_SRC_PORT		(ICE_PROT_SCTP | ICE_SPORT)
+#define ICE_INSET_SCTP_DST_PORT		(ICE_PROT_SCTP | ICE_DPORT)
+#define ICE_INSET_ICMP4_SRC_PORT	(ICE_PROT_ICMP4 | ICE_SPORT)
+#define ICE_INSET_ICMP4_DST_PORT	(ICE_PROT_ICMP4 | ICE_DPORT)
+#define ICE_INSET_ICMP6_SRC_PORT	(ICE_PROT_ICMP6 | ICE_SPORT)
+#define ICE_INSET_ICMP6_DST_PORT	(ICE_PROT_ICMP6 | ICE_DPORT)
+#define ICE_INSET_ICMP4_TYPE		(ICE_PROT_ICMP4 | ICE_ICMP_TYPE)
+#define ICE_INSET_ICMP4_CODE		(ICE_PROT_ICMP4 | ICE_ICMP_CODE)
+#define ICE_INSET_ICMP6_TYPE		(ICE_PROT_ICMP6 | ICE_ICMP_TYPE)
+#define ICE_INSET_ICMP6_CODE		(ICE_PROT_ICMP6 | ICE_ICMP_CODE)
 
 /* tunnel */
 
 #define ICE_INSET_TUN_SMAC \
-	(ICE_PROT_MAC_INNER | ICE_SMAC)
+	(ICE_PROT_MAC | ICE_SMAC)
 #define ICE_INSET_TUN_DMAC \
-	(ICE_PROT_MAC_INNER | ICE_DMAC)
+	(ICE_PROT_MAC | ICE_DMAC)
 
 #define ICE_INSET_TUN_IPV4_SRC \
-	(ICE_PROT_IPV4_INNER | ICE_IP_SRC)
+	(ICE_PROT_IPV4 | ICE_IP_SRC)
 #define ICE_INSET_TUN_IPV4_DST \
-	(ICE_PROT_IPV4_INNER | ICE_IP_DST)
+	(ICE_PROT_IPV4 | ICE_IP_DST)
 #define ICE_INSET_TUN_IPV4_TTL \
-	(ICE_PROT_IPV4_INNER | ICE_IP_TTL)
+	(ICE_PROT_IPV4 | ICE_IP_TTL)
 #define ICE_INSET_TUN_IPV4_PROTO \
-	(ICE_PROT_IPV4_INNER | ICE_IP_PROTO)
+	(ICE_PROT_IPV4 | ICE_IP_PROTO)
 #define ICE_INSET_TUN_IPV4_TOS \
-	(ICE_PROT_IPV4_INNER | ICE_IP_TOS)
+	(ICE_PROT_IPV4 | ICE_IP_TOS)
 #define ICE_INSET_TUN_IPV6_SRC \
-	(ICE_PROT_IPV6_INNER | ICE_IP_SRC)
+	(ICE_PROT_IPV6 | ICE_IP_SRC)
 #define ICE_INSET_TUN_IPV6_DST \
-	(ICE_PROT_IPV6_INNER | ICE_IP_DST)
+	(ICE_PROT_IPV6 | ICE_IP_DST)
 #define ICE_INSET_TUN_IPV6_HOP_LIMIT \
-	(ICE_PROT_IPV6_INNER | ICE_IP_TTL)
+	(ICE_PROT_IPV6 | ICE_IP_TTL)
 #define ICE_INSET_TUN_IPV6_NEXT_HDR \
-	(ICE_PROT_IPV6_INNER | ICE_IP_PROTO)
+	(ICE_PROT_IPV6 | ICE_IP_PROTO)
 #define ICE_INSET_TUN_IPV6_TC \
-	(ICE_PROT_IPV6_INNER | ICE_IP_TOS)
+	(ICE_PROT_IPV6 | ICE_IP_TOS)
 
 #define ICE_INSET_TUN_TCP_SRC_PORT \
-	(ICE_PROT_TCP_INNER | ICE_SPORT)
+	(ICE_PROT_TCP | ICE_SPORT)
 #define ICE_INSET_TUN_TCP_DST_PORT \
-	(ICE_PROT_TCP_INNER | ICE_DPORT)
+	(ICE_PROT_TCP | ICE_DPORT)
 #define ICE_INSET_TUN_UDP_SRC_PORT \
-	(ICE_PROT_UDP_INNER | ICE_SPORT)
+	(ICE_PROT_UDP | ICE_SPORT)
 #define ICE_INSET_TUN_UDP_DST_PORT \
-	(ICE_PROT_UDP_INNER | ICE_DPORT)
+	(ICE_PROT_UDP | ICE_DPORT)
 #define ICE_INSET_TUN_SCTP_SRC_PORT \
-	(ICE_PROT_SCTP_INNER | ICE_SPORT)
+	(ICE_PROT_SCTP | ICE_SPORT)
 #define ICE_INSET_TUN_SCTP_DST_PORT \
-	(ICE_PROT_SCTP_INNER | ICE_DPORT)
+	(ICE_PROT_SCTP | ICE_DPORT)
 #define ICE_INSET_TUN_ICMP4_SRC_PORT \
-	(ICE_PROT_ICMP4_INNER | ICE_SPORT)
+	(ICE_PROT_ICMP4 | ICE_SPORT)
 #define ICE_INSET_TUN_ICMP4_DST_PORT \
-	(ICE_PROT_ICMP4_INNER | ICE_DPORT)
+	(ICE_PROT_ICMP4 | ICE_DPORT)
 #define ICE_INSET_TUN_ICMP6_SRC_PORT \
-	(ICE_PROT_ICMP6_INNER | ICE_SPORT)
+	(ICE_PROT_ICMP6 | ICE_SPORT)
 #define ICE_INSET_TUN_ICMP6_DST_PORT \
-	(ICE_PROT_ICMP6_INNER | ICE_DPORT)
+	(ICE_PROT_ICMP6 | ICE_DPORT)
 #define ICE_INSET_TUN_ICMP4_TYPE \
-	(ICE_PROT_ICMP4_INNER | ICE_ICMP_TYPE)
+	(ICE_PROT_ICMP4 | ICE_ICMP_TYPE)
 #define ICE_INSET_TUN_ICMP4_CODE \
-	(ICE_PROT_ICMP4_INNER | ICE_ICMP_CODE)
+	(ICE_PROT_ICMP4 | ICE_ICMP_CODE)
 #define ICE_INSET_TUN_ICMP6_TYPE \
-	(ICE_PROT_ICMP6_INNER | ICE_ICMP_TYPE)
+	(ICE_PROT_ICMP6 | ICE_ICMP_TYPE)
 #define ICE_INSET_TUN_ICMP6_CODE \
-	(ICE_PROT_ICMP6_INNER | ICE_ICMP_CODE)
+	(ICE_PROT_ICMP6 | ICE_ICMP_CODE)
 
 #define ICE_INSET_TUN_VXLAN_VNI \
 	(ICE_PROT_VXLAN | ICE_VXLAN_VNI)
-- 
2.25.1


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

* [dpdk-dev] [PATCH v2 2/3] net/ice: refactor flow pattern parser
  2021-01-27  5:29 ` [dpdk-dev] [PATCH v2 0/3] Refactor FDIR pattern parser Zhirun Yan
  2021-01-27  5:29   ` [dpdk-dev] [PATCH v2 1/3] net/ice: clean input set macro definition Zhirun Yan
@ 2021-01-27  5:29   ` Zhirun Yan
  2021-01-27  5:29   ` [dpdk-dev] [PATCH v2 3/3] net/ice: add outer input set mask to distinguish outer fields Zhirun Yan
  2021-03-02  2:54   ` [dpdk-dev] [PATCH v3 0/6] Refactor FDIR pattern parser Zhirun Yan
  3 siblings, 0 replies; 24+ messages in thread
From: Zhirun Yan @ 2021-01-27  5:29 UTC (permalink / raw)
  To: dev, qi.z.zhang, yahui.cao, xiao.w.wang, junfeng.guo
  Cc: simei.su, ting.xu, yuying.zhang, xuan.ding, Zhirun Yan

Distinguish inner/outer input_set. And avoid too many nested
conditionals in each type's parser. input_set_f is used for
outer fields, input_set_l is used for inner or non-tunnel
fields.

To align with shared code behavior, set GTPU as non-tunnel flow.
Ideally, GTPU packet should be parsed as tunnel and QFI, TEID should
set into input_set_f.

todo:
    1. Distinguish gtpu input set. Put QFI, TEID into input set outer.

Signed-off-by: Zhirun Yan <zhirun.yan@intel.com>
---
 drivers/net/ice/ice_fdir_filter.c | 478 +++++++++++++++---------------
 1 file changed, 239 insertions(+), 239 deletions(-)

diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c
index 4e99df1272..83b3a4c547 100644
--- a/drivers/net/ice/ice_fdir_filter.c
+++ b/drivers/net/ice/ice_fdir_filter.c
@@ -1610,7 +1610,9 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
 	const struct rte_flow_item_vxlan *vxlan_spec, *vxlan_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 input_set_l = ICE_INSET_NONE; /* non-tunnel and tunnel inner */
+	uint64_t input_set_f = ICE_INSET_NONE; /* only for tunnel outer */
+	uint64_t *input_set;
 	uint8_t flow_type = ICE_FLTR_PTYPE_NONF_NONE;
 	uint8_t  ipv6_addr_mask[16] = {
 		0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
@@ -1619,289 +1621,283 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
 	uint32_t vtc_flow_cpu;
 	uint16_t ether_type;
 	enum rte_flow_item_type next_type;
+	bool is_outer = true;
+	struct ice_fdir_extra *p_ext_data;
+	struct ice_fdir_v4 *p_v4 = NULL;
+	struct ice_fdir_v6 *p_v6 = NULL;
 
+	for (item = pattern; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {
+		if (item->type == RTE_FLOW_ITEM_TYPE_VXLAN)
+			tunnel_type = ICE_FDIR_TUNNEL_TYPE_VXLAN;
+		if (item->type == RTE_FLOW_ITEM_TYPE_GTPU) {
+			tunnel_type = ICE_FDIR_TUNNEL_TYPE_GTPU;
+			is_outer = false;
+		}
+		if (item->type == RTE_FLOW_ITEM_TYPE_GTP_PSC) {
+			tunnel_type = ICE_FDIR_TUNNEL_TYPE_GTPU_EH;
+			is_outer = false;
+		}
+	}
+
+	/* This loop parse flow pattern and distinguish Non-tunnel and tunnel
+	 * flow. input_set_l is used for non-tunnel and tunnel inner part.
+	 */
 	for (item = pattern; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {
 		if (item->last) {
 			rte_flow_error_set(error, EINVAL,
-					RTE_FLOW_ERROR_TYPE_ITEM,
-					item,
-					"Not support range");
+					   RTE_FLOW_ERROR_TYPE_ITEM,
+					   item,
+					   "Not support range");
 			return -rte_errno;
 		}
 		item_type = item->type;
 
+		input_set = (tunnel_type && is_outer) ?
+			    &input_set_f : &input_set_l;
+
 		switch (item_type) {
 		case RTE_FLOW_ITEM_TYPE_ETH:
+			flow_type = ICE_FLTR_PTYPE_NON_IP_L2;
 			eth_spec = item->spec;
 			eth_mask = item->mask;
-			next_type = (item + 1)->type;
 
-			if (eth_spec && eth_mask) {
-				if (!rte_is_zero_ether_addr(&eth_mask->dst)) {
-					input_set |= ICE_INSET_DMAC;
-					rte_memcpy(&filter->input.ext_data.dst_mac,
-						   &eth_spec->dst,
-						   RTE_ETHER_ADDR_LEN);
-				}
+			if (!(eth_spec && eth_mask))
+				break;
 
-				if (!rte_is_zero_ether_addr(&eth_mask->src)) {
-					input_set |= ICE_INSET_SMAC;
-					rte_memcpy(&filter->input.ext_data.src_mac,
-						   &eth_spec->src,
-						   RTE_ETHER_ADDR_LEN);
-				}
+			if (!rte_is_zero_ether_addr(&eth_mask->dst))
+				*input_set |= ICE_INSET_DMAC;
+			if (!rte_is_zero_ether_addr(&eth_mask->src))
+				*input_set |= ICE_INSET_SMAC;
 
-				/* Ignore this field except for ICE_FLTR_PTYPE_NON_IP_L2 */
-				if (eth_mask->type == RTE_BE16(0xffff) &&
-				    next_type == RTE_FLOW_ITEM_TYPE_END) {
-					input_set |= ICE_INSET_ETHERTYPE;
-					ether_type = rte_be_to_cpu_16(eth_spec->type);
-
-					if (ether_type == RTE_ETHER_TYPE_IPV4 ||
-					    ether_type == RTE_ETHER_TYPE_IPV6) {
-						rte_flow_error_set(error, EINVAL,
-								   RTE_FLOW_ERROR_TYPE_ITEM,
-								   item,
-								   "Unsupported ether_type.");
-						return -rte_errno;
-					}
-
-					rte_memcpy(&filter->input.ext_data.ether_type,
-						   &eth_spec->type,
-						   sizeof(eth_spec->type));
-					flow_type = ICE_FLTR_PTYPE_NON_IP_L2;
+			next_type = (item + 1)->type;
+			/* Ignore this field except for ICE_FLTR_PTYPE_NON_IP_L2 */
+			if (eth_mask->type == RTE_BE16(0xffff) &&
+			    next_type == RTE_FLOW_ITEM_TYPE_END) {
+				*input_set |= ICE_INSET_ETHERTYPE;
+				ether_type = rte_be_to_cpu_16(eth_spec->type);
+
+				if (ether_type == RTE_ETHER_TYPE_IPV4 ||
+				    ether_type == RTE_ETHER_TYPE_IPV6) {
+					rte_flow_error_set(error, EINVAL,
+							   RTE_FLOW_ERROR_TYPE_ITEM,
+							   item,
+							   "Unsupported ether_type.");
+					return -rte_errno;
 				}
 			}
+
+			p_ext_data = (tunnel_type && is_outer) ?
+				     &filter->input.ext_data_outer :
+				     &filter->input.ext_data;
+			rte_memcpy(&p_ext_data->src_mac,
+				   &eth_spec->src, RTE_ETHER_ADDR_LEN);
+			rte_memcpy(&p_ext_data->dst_mac,
+				   &eth_spec->dst, RTE_ETHER_ADDR_LEN);
+			rte_memcpy(&p_ext_data->ether_type,
+				   &eth_spec->type, sizeof(eth_spec->type));
 			break;
 		case RTE_FLOW_ITEM_TYPE_IPV4:
+			flow_type = ICE_FLTR_PTYPE_NONF_IPV4_OTHER;
 			l3 = RTE_FLOW_ITEM_TYPE_IPV4;
 			ipv4_spec = item->spec;
 			ipv4_mask = item->mask;
-
-			if (ipv4_spec && ipv4_mask) {
-				/* Check IPv4 mask and update input set */
-				if (ipv4_mask->hdr.version_ihl ||
-				    ipv4_mask->hdr.total_length ||
-				    ipv4_mask->hdr.packet_id ||
-				    ipv4_mask->hdr.fragment_offset ||
-				    ipv4_mask->hdr.hdr_checksum) {
-					rte_flow_error_set(error, EINVAL,
+			p_v4 = (tunnel_type && is_outer) ?
+			       &filter->input.ip_outer.v4 :
+			       &filter->input.ip.v4;
+
+			if (!(ipv4_spec && ipv4_mask))
+				break;
+
+			/* Check IPv4 mask and update input set */
+			if (ipv4_mask->hdr.version_ihl ||
+			    ipv4_mask->hdr.total_length ||
+			    ipv4_mask->hdr.packet_id ||
+			    ipv4_mask->hdr.fragment_offset ||
+			    ipv4_mask->hdr.hdr_checksum) {
+				rte_flow_error_set(error, EINVAL,
 						   RTE_FLOW_ERROR_TYPE_ITEM,
 						   item,
 						   "Invalid IPv4 mask.");
-					return -rte_errno;
-				}
-				if (ipv4_mask->hdr.src_addr == UINT32_MAX)
-					input_set |= tunnel_type ?
-						     ICE_INSET_TUN_IPV4_SRC :
-						     ICE_INSET_IPV4_SRC;
-				if (ipv4_mask->hdr.dst_addr == UINT32_MAX)
-					input_set |= tunnel_type ?
-						     ICE_INSET_TUN_IPV4_DST :
-						     ICE_INSET_IPV4_DST;
-				if (ipv4_mask->hdr.type_of_service == UINT8_MAX)
-					input_set |= ICE_INSET_IPV4_TOS;
-				if (ipv4_mask->hdr.time_to_live == UINT8_MAX)
-					input_set |= ICE_INSET_IPV4_TTL;
-				if (ipv4_mask->hdr.next_proto_id == UINT8_MAX)
-					input_set |= ICE_INSET_IPV4_PROTO;
-
-				filter->input.ip.v4.dst_ip =
-					ipv4_spec->hdr.dst_addr;
-				filter->input.ip.v4.src_ip =
-					ipv4_spec->hdr.src_addr;
-				filter->input.ip.v4.tos =
-					ipv4_spec->hdr.type_of_service;
-				filter->input.ip.v4.ttl =
-					ipv4_spec->hdr.time_to_live;
-				filter->input.ip.v4.proto =
-					ipv4_spec->hdr.next_proto_id;
+				return -rte_errno;
 			}
 
-			flow_type = ICE_FLTR_PTYPE_NONF_IPV4_OTHER;
+			if (ipv4_mask->hdr.dst_addr == UINT32_MAX)
+				*input_set |= ICE_INSET_IPV4_DST;
+			if (ipv4_mask->hdr.src_addr == UINT32_MAX)
+				*input_set |= ICE_INSET_IPV4_SRC;
+			if (ipv4_mask->hdr.time_to_live == UINT8_MAX)
+				*input_set |= ICE_INSET_IPV4_TTL;
+			if (ipv4_mask->hdr.next_proto_id == UINT8_MAX)
+				*input_set |= ICE_INSET_IPV4_PROTO;
+			if (ipv4_mask->hdr.type_of_service == UINT8_MAX)
+				*input_set |= ICE_INSET_IPV4_TOS;
+
+			p_v4->dst_ip = ipv4_spec->hdr.dst_addr;
+			p_v4->src_ip = ipv4_spec->hdr.src_addr;
+			p_v4->ttl = ipv4_spec->hdr.time_to_live;
+			p_v4->proto = ipv4_spec->hdr.next_proto_id;
+			p_v4->tos = ipv4_spec->hdr.type_of_service;
 			break;
 		case RTE_FLOW_ITEM_TYPE_IPV6:
+			flow_type = ICE_FLTR_PTYPE_NONF_IPV6_OTHER;
 			l3 = RTE_FLOW_ITEM_TYPE_IPV6;
 			ipv6_spec = item->spec;
 			ipv6_mask = item->mask;
+			p_v6 = (tunnel_type && is_outer) ?
+			       &filter->input.ip_outer.v6 :
+			       &filter->input.ip.v6;
 
-			if (ipv6_spec && ipv6_mask) {
-				/* Check IPv6 mask and update input set */
-				if (ipv6_mask->hdr.payload_len) {
-					rte_flow_error_set(error, EINVAL,
+			if (!(ipv6_spec && ipv6_mask))
+				break;
+
+			/* Check IPv6 mask and update input set */
+			if (ipv6_mask->hdr.payload_len) {
+				rte_flow_error_set(error, EINVAL,
 						   RTE_FLOW_ERROR_TYPE_ITEM,
 						   item,
 						   "Invalid IPv6 mask");
-					return -rte_errno;
-				}
-
-				if (!memcmp(ipv6_mask->hdr.src_addr,
-					    ipv6_addr_mask,
-					    RTE_DIM(ipv6_mask->hdr.src_addr)))
-					input_set |= ICE_INSET_IPV6_SRC;
-				if (!memcmp(ipv6_mask->hdr.dst_addr,
-					    ipv6_addr_mask,
-					    RTE_DIM(ipv6_mask->hdr.dst_addr)))
-					input_set |= ICE_INSET_IPV6_DST;
-
-				if ((ipv6_mask->hdr.vtc_flow &
-				     rte_cpu_to_be_32(ICE_IPV6_TC_MASK))
-				    == rte_cpu_to_be_32(ICE_IPV6_TC_MASK))
-					input_set |= ICE_INSET_IPV6_TC;
-				if (ipv6_mask->hdr.proto == UINT8_MAX)
-					input_set |= ICE_INSET_IPV6_NEXT_HDR;
-				if (ipv6_mask->hdr.hop_limits == UINT8_MAX)
-					input_set |= ICE_INSET_IPV6_HOP_LIMIT;
-
-				rte_memcpy(filter->input.ip.v6.dst_ip,
-					   ipv6_spec->hdr.dst_addr, 16);
-				rte_memcpy(filter->input.ip.v6.src_ip,
-					   ipv6_spec->hdr.src_addr, 16);
-
-				vtc_flow_cpu =
-				      rte_be_to_cpu_32(ipv6_spec->hdr.vtc_flow);
-				filter->input.ip.v6.tc =
-					(uint8_t)(vtc_flow_cpu >>
-						  ICE_FDIR_IPV6_TC_OFFSET);
-				filter->input.ip.v6.proto =
-					ipv6_spec->hdr.proto;
-				filter->input.ip.v6.hlim =
-					ipv6_spec->hdr.hop_limits;
+				return -rte_errno;
 			}
 
-			flow_type = ICE_FLTR_PTYPE_NONF_IPV6_OTHER;
+			if (!memcmp(ipv6_mask->hdr.src_addr, ipv6_addr_mask,
+				    RTE_DIM(ipv6_mask->hdr.src_addr)))
+				*input_set |= ICE_INSET_IPV6_SRC;
+			if (!memcmp(ipv6_mask->hdr.dst_addr, ipv6_addr_mask,
+				    RTE_DIM(ipv6_mask->hdr.dst_addr)))
+				*input_set |= ICE_INSET_IPV6_DST;
+
+			if ((ipv6_mask->hdr.vtc_flow &
+			     rte_cpu_to_be_32(ICE_IPV6_TC_MASK))
+			    == rte_cpu_to_be_32(ICE_IPV6_TC_MASK))
+				*input_set |= ICE_INSET_IPV6_TC;
+			if (ipv6_mask->hdr.proto == UINT8_MAX)
+				*input_set |= ICE_INSET_IPV6_NEXT_HDR;
+			if (ipv6_mask->hdr.hop_limits == UINT8_MAX)
+				*input_set |= ICE_INSET_IPV6_HOP_LIMIT;
+
+			rte_memcpy(&p_v6->dst_ip, ipv6_spec->hdr.dst_addr, 16);
+			rte_memcpy(&p_v6->src_ip, ipv6_spec->hdr.src_addr, 16);
+			vtc_flow_cpu = rte_be_to_cpu_32(ipv6_spec->hdr.vtc_flow);
+			p_v6->tc = (uint8_t)(vtc_flow_cpu >> ICE_FDIR_IPV6_TC_OFFSET);
+			p_v6->proto = ipv6_spec->hdr.proto;
+			p_v6->hlim = ipv6_spec->hdr.hop_limits;
 			break;
 		case RTE_FLOW_ITEM_TYPE_TCP:
-			tcp_spec = item->spec;
-			tcp_mask = item->mask;
-
 			if (l3 == RTE_FLOW_ITEM_TYPE_IPV4)
 				flow_type = ICE_FLTR_PTYPE_NONF_IPV4_TCP;
-			else if (l3 == RTE_FLOW_ITEM_TYPE_IPV6)
+			if (l3 == RTE_FLOW_ITEM_TYPE_IPV6)
 				flow_type = ICE_FLTR_PTYPE_NONF_IPV6_TCP;
 
-			if (tcp_spec && tcp_mask) {
-				/* Check TCP mask and update input set */
-				if (tcp_mask->hdr.sent_seq ||
-				    tcp_mask->hdr.recv_ack ||
-				    tcp_mask->hdr.data_off ||
-				    tcp_mask->hdr.tcp_flags ||
-				    tcp_mask->hdr.rx_win ||
-				    tcp_mask->hdr.cksum ||
-				    tcp_mask->hdr.tcp_urp) {
-					rte_flow_error_set(error, EINVAL,
+			tcp_spec = item->spec;
+			tcp_mask = item->mask;
+
+			if (!(tcp_spec && tcp_mask))
+				break;
+
+			/* Check TCP mask and update input set */
+			if (tcp_mask->hdr.sent_seq ||
+			    tcp_mask->hdr.recv_ack ||
+			    tcp_mask->hdr.data_off ||
+			    tcp_mask->hdr.tcp_flags ||
+			    tcp_mask->hdr.rx_win ||
+			    tcp_mask->hdr.cksum ||
+			    tcp_mask->hdr.tcp_urp) {
+				rte_flow_error_set(error, EINVAL,
 						   RTE_FLOW_ERROR_TYPE_ITEM,
 						   item,
 						   "Invalid TCP mask");
-					return -rte_errno;
-				}
+				return -rte_errno;
+			}
 
-				if (tcp_mask->hdr.src_port == UINT16_MAX)
-					input_set |= tunnel_type ?
-						     ICE_INSET_TUN_TCP_SRC_PORT :
-						     ICE_INSET_TCP_SRC_PORT;
-				if (tcp_mask->hdr.dst_port == UINT16_MAX)
-					input_set |= tunnel_type ?
-						     ICE_INSET_TUN_TCP_DST_PORT :
-						     ICE_INSET_TCP_DST_PORT;
-
-				/* Get filter info */
-				if (l3 == RTE_FLOW_ITEM_TYPE_IPV4) {
-					filter->input.ip.v4.dst_port =
-						tcp_spec->hdr.dst_port;
-					filter->input.ip.v4.src_port =
-						tcp_spec->hdr.src_port;
-				} else if (l3 == RTE_FLOW_ITEM_TYPE_IPV6) {
-					filter->input.ip.v6.dst_port =
-						tcp_spec->hdr.dst_port;
-					filter->input.ip.v6.src_port =
-						tcp_spec->hdr.src_port;
-				}
+			if (tcp_mask->hdr.src_port == UINT16_MAX)
+				*input_set |= ICE_INSET_TCP_SRC_PORT;
+			if (tcp_mask->hdr.dst_port == UINT16_MAX)
+				*input_set |= ICE_INSET_TCP_DST_PORT;
+
+			/* Get filter info */
+			if (l3 == RTE_FLOW_ITEM_TYPE_IPV4) {
+				assert(p_v4);
+				p_v4->dst_port = tcp_spec->hdr.dst_port;
+				p_v4->src_port = tcp_spec->hdr.src_port;
+			} else if (l3 == RTE_FLOW_ITEM_TYPE_IPV6) {
+				assert(p_v6);
+				p_v6->dst_port = tcp_spec->hdr.dst_port;
+				p_v6->src_port = tcp_spec->hdr.src_port;
 			}
 			break;
 		case RTE_FLOW_ITEM_TYPE_UDP:
-			udp_spec = item->spec;
-			udp_mask = item->mask;
-
 			if (l3 == RTE_FLOW_ITEM_TYPE_IPV4)
 				flow_type = ICE_FLTR_PTYPE_NONF_IPV4_UDP;
-			else if (l3 == RTE_FLOW_ITEM_TYPE_IPV6)
+			if (l3 == RTE_FLOW_ITEM_TYPE_IPV6)
 				flow_type = ICE_FLTR_PTYPE_NONF_IPV6_UDP;
 
-			if (udp_spec && udp_mask) {
-				/* Check UDP mask and update input set*/
-				if (udp_mask->hdr.dgram_len ||
-				    udp_mask->hdr.dgram_cksum) {
-					rte_flow_error_set(error, EINVAL,
+			udp_spec = item->spec;
+			udp_mask = item->mask;
+
+			if (!(udp_spec && udp_mask))
+				break;
+
+			/* Check UDP mask and update input set*/
+			if (udp_mask->hdr.dgram_len ||
+			    udp_mask->hdr.dgram_cksum) {
+				rte_flow_error_set(error, EINVAL,
 						   RTE_FLOW_ERROR_TYPE_ITEM,
 						   item,
 						   "Invalid UDP mask");
-					return -rte_errno;
-				}
+				return -rte_errno;
+			}
 
-				if (udp_mask->hdr.src_port == UINT16_MAX)
-					input_set |= tunnel_type ?
-						     ICE_INSET_TUN_UDP_SRC_PORT :
-						     ICE_INSET_UDP_SRC_PORT;
-				if (udp_mask->hdr.dst_port == UINT16_MAX)
-					input_set |= tunnel_type ?
-						     ICE_INSET_TUN_UDP_DST_PORT :
-						     ICE_INSET_UDP_DST_PORT;
-
-				/* Get filter info */
-				if (l3 == RTE_FLOW_ITEM_TYPE_IPV4) {
-					filter->input.ip.v4.dst_port =
-						udp_spec->hdr.dst_port;
-					filter->input.ip.v4.src_port =
-						udp_spec->hdr.src_port;
-				} else if (l3 == RTE_FLOW_ITEM_TYPE_IPV6) {
-					filter->input.ip.v6.src_port =
-						udp_spec->hdr.src_port;
-					filter->input.ip.v6.dst_port =
-						udp_spec->hdr.dst_port;
-				}
+			if (udp_mask->hdr.src_port == UINT16_MAX)
+				*input_set |= ICE_INSET_UDP_SRC_PORT;
+			if (udp_mask->hdr.dst_port == UINT16_MAX)
+				*input_set |= ICE_INSET_UDP_DST_PORT;
+
+			/* Get filter info */
+			if (l3 == RTE_FLOW_ITEM_TYPE_IPV4) {
+				assert(p_v4);
+				p_v4->dst_port = udp_spec->hdr.dst_port;
+				p_v4->src_port = udp_spec->hdr.src_port;
+			} else if (l3 == RTE_FLOW_ITEM_TYPE_IPV6) {
+				assert(p_v6);
+				p_v6->src_port = udp_spec->hdr.src_port;
+				p_v6->dst_port = udp_spec->hdr.dst_port;
 			}
 			break;
 		case RTE_FLOW_ITEM_TYPE_SCTP:
-			sctp_spec = item->spec;
-			sctp_mask = item->mask;
-
 			if (l3 == RTE_FLOW_ITEM_TYPE_IPV4)
 				flow_type = ICE_FLTR_PTYPE_NONF_IPV4_SCTP;
-			else if (l3 == RTE_FLOW_ITEM_TYPE_IPV6)
+			if (l3 == RTE_FLOW_ITEM_TYPE_IPV6)
 				flow_type = ICE_FLTR_PTYPE_NONF_IPV6_SCTP;
 
-			if (sctp_spec && sctp_mask) {
-				/* Check SCTP mask and update input set */
-				if (sctp_mask->hdr.cksum) {
-					rte_flow_error_set(error, EINVAL,
+			sctp_spec = item->spec;
+			sctp_mask = item->mask;
+
+			if (!(sctp_spec && sctp_mask))
+				break;
+
+			/* Check SCTP mask and update input set */
+			if (sctp_mask->hdr.cksum) {
+				rte_flow_error_set(error, EINVAL,
 						   RTE_FLOW_ERROR_TYPE_ITEM,
 						   item,
 						   "Invalid UDP mask");
-					return -rte_errno;
-				}
+				return -rte_errno;
+			}
 
-				if (sctp_mask->hdr.src_port == UINT16_MAX)
-					input_set |= tunnel_type ?
-						     ICE_INSET_TUN_SCTP_SRC_PORT :
-						     ICE_INSET_SCTP_SRC_PORT;
-				if (sctp_mask->hdr.dst_port == UINT16_MAX)
-					input_set |= tunnel_type ?
-						     ICE_INSET_TUN_SCTP_DST_PORT :
-						     ICE_INSET_SCTP_DST_PORT;
-
-				/* Get filter info */
-				if (l3 == RTE_FLOW_ITEM_TYPE_IPV4) {
-					filter->input.ip.v4.dst_port =
-						sctp_spec->hdr.dst_port;
-					filter->input.ip.v4.src_port =
-						sctp_spec->hdr.src_port;
-				} else if (l3 == RTE_FLOW_ITEM_TYPE_IPV6) {
-					filter->input.ip.v6.dst_port =
-						sctp_spec->hdr.dst_port;
-					filter->input.ip.v6.src_port =
-						sctp_spec->hdr.src_port;
-				}
+			if (sctp_mask->hdr.src_port == UINT16_MAX)
+				*input_set |= ICE_INSET_SCTP_SRC_PORT;
+			if (sctp_mask->hdr.dst_port == UINT16_MAX)
+				*input_set |= ICE_INSET_SCTP_DST_PORT;
+
+			/* Get filter info */
+			if (l3 == RTE_FLOW_ITEM_TYPE_IPV4) {
+				assert(p_v4);
+				p_v4->dst_port = sctp_spec->hdr.dst_port;
+				p_v4->src_port = sctp_spec->hdr.src_port;
+			} else if (l3 == RTE_FLOW_ITEM_TYPE_IPV6) {
+				assert(p_v6);
+				p_v6->dst_port = sctp_spec->hdr.dst_port;
+				p_v6->src_port = sctp_spec->hdr.src_port;
 			}
 			break;
 		case RTE_FLOW_ITEM_TYPE_VOID:
@@ -1910,6 +1906,7 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
 			l3 = RTE_FLOW_ITEM_TYPE_END;
 			vxlan_spec = item->spec;
 			vxlan_mask = item->mask;
+			is_outer = false;
 
 			if (vxlan_spec || vxlan_mask) {
 				rte_flow_error_set(error, EINVAL,
@@ -1919,50 +1916,52 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
 				return -rte_errno;
 			}
 
-			tunnel_type = ICE_FDIR_TUNNEL_TYPE_VXLAN;
 			break;
 		case RTE_FLOW_ITEM_TYPE_GTPU:
 			l3 = RTE_FLOW_ITEM_TYPE_END;
 			gtp_spec = item->spec;
 			gtp_mask = item->mask;
+			is_outer = false;
 
-			if (gtp_spec && gtp_mask) {
-				if (gtp_mask->v_pt_rsv_flags ||
-				    gtp_mask->msg_type ||
-				    gtp_mask->msg_len) {
-					rte_flow_error_set(error, EINVAL,
+			if (!(gtp_spec && gtp_mask))
+				break;
+
+			if (gtp_mask->v_pt_rsv_flags ||
+			    gtp_mask->msg_type ||
+			    gtp_mask->msg_len) {
+				rte_flow_error_set(error, EINVAL,
 						   RTE_FLOW_ERROR_TYPE_ITEM,
 						   item,
 						   "Invalid GTP mask");
-					return -rte_errno;
-				}
-
-				if (gtp_mask->teid == UINT32_MAX)
-					input_set |= ICE_INSET_GTPU_TEID;
-
-				filter->input.gtpu_data.teid = gtp_spec->teid;
+				return -rte_errno;
 			}
 
-			tunnel_type = ICE_FDIR_TUNNEL_TYPE_GTPU;
+			/* To align with shared code behavior, set TEID in input_set_l */
+			if (gtp_mask->teid == UINT32_MAX)
+				input_set_l |= ICE_INSET_GTPU_TEID;
+
+			filter->input.gtpu_data.teid = gtp_spec->teid;
 			break;
 		case RTE_FLOW_ITEM_TYPE_GTP_PSC:
 			gtp_psc_spec = item->spec;
 			gtp_psc_mask = item->mask;
+			is_outer = false;
 
-			if (gtp_psc_spec && gtp_psc_mask) {
-				if (gtp_psc_mask->qfi == UINT8_MAX)
-					input_set |= ICE_INSET_GTPU_QFI;
+			if (!(gtp_psc_spec && gtp_psc_mask))
+				break;
 
-				filter->input.gtpu_data.qfi =
-					gtp_psc_spec->qfi;
-			}
-			tunnel_type = ICE_FDIR_TUNNEL_TYPE_GTPU_EH;
+			/* To align with shared code behavior, set TEID in input_set_l */
+			if (gtp_psc_mask->qfi == UINT8_MAX)
+				input_set_l |= ICE_INSET_GTPU_QFI;
+
+			filter->input.gtpu_data.qfi =
+				gtp_psc_spec->qfi;
 			break;
 		default:
 			rte_flow_error_set(error, EINVAL,
-				   RTE_FLOW_ERROR_TYPE_ITEM,
-				   item,
-				   "Invalid pattern item.");
+					   RTE_FLOW_ERROR_TYPE_ITEM,
+					   item,
+					   "Invalid pattern item.");
 			return -rte_errno;
 		}
 	}
@@ -1982,7 +1981,8 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
 
 	filter->tunnel_type = tunnel_type;
 	filter->input.flow_type = flow_type;
-	filter->input_set = input_set;
+	filter->input_set = input_set_l;
+	filter->outer_input_set = input_set_f;
 
 	return 0;
 }
-- 
2.25.1


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

* [dpdk-dev] [PATCH v2 3/3] net/ice: add outer input set mask to distinguish outer fields
  2021-01-27  5:29 ` [dpdk-dev] [PATCH v2 0/3] Refactor FDIR pattern parser Zhirun Yan
  2021-01-27  5:29   ` [dpdk-dev] [PATCH v2 1/3] net/ice: clean input set macro definition Zhirun Yan
  2021-01-27  5:29   ` [dpdk-dev] [PATCH v2 2/3] net/ice: refactor flow pattern parser Zhirun Yan
@ 2021-01-27  5:29   ` Zhirun Yan
  2021-03-02  2:54   ` [dpdk-dev] [PATCH v3 0/6] Refactor FDIR pattern parser Zhirun Yan
  3 siblings, 0 replies; 24+ messages in thread
From: Zhirun Yan @ 2021-01-27  5:29 UTC (permalink / raw)
  To: dev, qi.z.zhang, yahui.cao, xiao.w.wang, junfeng.guo
  Cc: simei.su, ting.xu, yuying.zhang, xuan.ding, Zhirun Yan

Add 64-bit input_set_mask_f for outer inputset. input_set_mask_f is
used for inner fields or non-tunnel fields. Adjust indentation of
ice_pattern_match_item list in switch, ACL, RSS and FDIR for easy
review. For fields in tunnel layer, put them in outer part.

Signed-off-by: Zhirun Yan <zhirun.yan@intel.com>
---
 drivers/net/ice/ice_acl_filter.c    |   8 +-
 drivers/net/ice/ice_fdir_filter.c   |  72 ++++---
 drivers/net/ice/ice_generic_flow.c  |   2 +
 drivers/net/ice/ice_generic_flow.h  |   1 +
 drivers/net/ice/ice_hash.c          | 243 ++++++++++-------------
 drivers/net/ice/ice_switch_filter.c | 294 ++++++++++------------------
 6 files changed, 247 insertions(+), 373 deletions(-)

diff --git a/drivers/net/ice/ice_acl_filter.c b/drivers/net/ice/ice_acl_filter.c
index 363ce68318..fe0a56eff5 100644
--- a/drivers/net/ice/ice_acl_filter.c
+++ b/drivers/net/ice/ice_acl_filter.c
@@ -50,10 +50,10 @@ struct acl_rule {
 
 static struct
 ice_pattern_match_item ice_acl_pattern[] = {
-	{pattern_eth_ipv4,      ICE_ACL_INSET_ETH_IPV4,      ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp,  ICE_ACL_INSET_ETH_IPV4_UDP,  ICE_INSET_NONE},
-	{pattern_eth_ipv4_tcp,  ICE_ACL_INSET_ETH_IPV4_TCP,  ICE_INSET_NONE},
-	{pattern_eth_ipv4_sctp, ICE_ACL_INSET_ETH_IPV4_SCTP, ICE_INSET_NONE},
+	{pattern_eth_ipv4,	ICE_INSET_NONE,	ICE_ACL_INSET_ETH_IPV4,		ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp,	ICE_INSET_NONE,	ICE_ACL_INSET_ETH_IPV4_UDP,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_tcp,	ICE_INSET_NONE,	ICE_ACL_INSET_ETH_IPV4_TCP,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_sctp,	ICE_INSET_NONE,	ICE_ACL_INSET_ETH_IPV4_SCTP,	ICE_INSET_NONE},
 };
 
 static int
diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c
index 83b3a4c547..cf26559df3 100644
--- a/drivers/net/ice/ice_fdir_filter.c
+++ b/drivers/net/ice/ice_fdir_filter.c
@@ -55,21 +55,25 @@
 	ICE_FDIR_INSET_ETH_IPV6 | \
 	ICE_INSET_SCTP_SRC_PORT | ICE_INSET_SCTP_DST_PORT)
 
-#define ICE_FDIR_INSET_VXLAN_IPV4 (\
+#define ICE_FDIR_INSET_IPV4 (\
 	ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST)
 
-#define ICE_FDIR_INSET_VXLAN_IPV4_TCP (\
-	ICE_FDIR_INSET_VXLAN_IPV4 | \
+#define ICE_FDIR_INSET_IPV4_TCP (\
+	ICE_FDIR_INSET_IPV4 | \
 	ICE_INSET_TCP_SRC_PORT | ICE_INSET_TCP_DST_PORT)
 
-#define ICE_FDIR_INSET_VXLAN_IPV4_UDP (\
-	ICE_FDIR_INSET_VXLAN_IPV4 | \
+#define ICE_FDIR_INSET_IPV4_UDP (\
+	ICE_FDIR_INSET_IPV4 | \
 	ICE_INSET_UDP_SRC_PORT | ICE_INSET_UDP_DST_PORT)
 
-#define ICE_FDIR_INSET_VXLAN_IPV4_SCTP (\
-	ICE_FDIR_INSET_VXLAN_IPV4 | \
+#define ICE_FDIR_INSET_IPV4_SCTP (\
+	ICE_FDIR_INSET_IPV4 | \
 	ICE_INSET_SCTP_SRC_PORT | ICE_INSET_SCTP_DST_PORT)
 
+#define ICE_FDIR_INSET_ETH_IPV4_VXLAN (\
+	ICE_FDIR_INSET_ETH | \
+	ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST)
+
 #define ICE_FDIR_INSET_IPV4_GTPU (\
 	ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST | ICE_INSET_GTPU_TEID)
 
@@ -85,35 +89,28 @@
 	ICE_INSET_GTPU_TEID | ICE_INSET_GTPU_QFI)
 
 static struct ice_pattern_match_item ice_fdir_pattern_list[] = {
-	{pattern_ethertype,	       ICE_FDIR_INSET_ETH,		     ICE_INSET_NONE},
-	{pattern_eth_ipv4,             ICE_FDIR_INSET_ETH_IPV4,              ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp,         ICE_FDIR_INSET_ETH_IPV4_UDP,          ICE_INSET_NONE},
-	{pattern_eth_ipv4_tcp,         ICE_FDIR_INSET_ETH_IPV4_TCP,          ICE_INSET_NONE},
-	{pattern_eth_ipv4_sctp,        ICE_FDIR_INSET_ETH_IPV4_SCTP,         ICE_INSET_NONE},
-	{pattern_eth_ipv6,             ICE_FDIR_INSET_ETH_IPV6,              ICE_INSET_NONE},
-	{pattern_eth_ipv6_udp,         ICE_FDIR_INSET_ETH_IPV6_UDP,          ICE_INSET_NONE},
-	{pattern_eth_ipv6_tcp,         ICE_FDIR_INSET_ETH_IPV6_TCP,          ICE_INSET_NONE},
-	{pattern_eth_ipv6_sctp,        ICE_FDIR_INSET_ETH_IPV6_SCTP,         ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_ipv4,
-				       ICE_FDIR_INSET_VXLAN_IPV4,            ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_ipv4_udp,
-				       ICE_FDIR_INSET_VXLAN_IPV4_UDP,        ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_ipv4_tcp,
-				       ICE_FDIR_INSET_VXLAN_IPV4_TCP,        ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_ipv4_sctp,
-				       ICE_FDIR_INSET_VXLAN_IPV4_SCTP,       ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_eth_ipv4,
-				       ICE_FDIR_INSET_VXLAN_IPV4,            ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_udp,
-				       ICE_FDIR_INSET_VXLAN_IPV4_UDP,        ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_tcp,
-				       ICE_FDIR_INSET_VXLAN_IPV4_TCP,        ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_sctp,
-				       ICE_FDIR_INSET_VXLAN_IPV4_SCTP,       ICE_INSET_NONE},
-	{pattern_eth_ipv4_gtpu,	       ICE_FDIR_INSET_IPV4_GTPU,             ICE_INSET_NONE},
-	{pattern_eth_ipv4_gtpu_eh,     ICE_FDIR_INSET_IPV4_GTPU_EH,          ICE_INSET_NONE},
-	{pattern_eth_ipv6_gtpu,	       ICE_FDIR_INSET_IPV6_GTPU,             ICE_INSET_NONE},
-	{pattern_eth_ipv6_gtpu_eh,     ICE_FDIR_INSET_IPV6_GTPU_EH,          ICE_INSET_NONE},
+	{pattern_ethertype,				ICE_INSET_NONE,			ICE_FDIR_INSET_ETH,		ICE_INSET_NONE},
+	{pattern_eth_ipv4,				ICE_INSET_NONE,			ICE_FDIR_INSET_ETH_IPV4,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp,				ICE_INSET_NONE,			ICE_FDIR_INSET_ETH_IPV4_UDP,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_tcp,				ICE_INSET_NONE,			ICE_FDIR_INSET_ETH_IPV4_TCP,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_sctp,				ICE_INSET_NONE,			ICE_FDIR_INSET_ETH_IPV4_SCTP,	ICE_INSET_NONE},
+	{pattern_eth_ipv6,				ICE_INSET_NONE,			ICE_FDIR_INSET_ETH_IPV6,	ICE_INSET_NONE},
+	{pattern_eth_ipv6_udp,				ICE_INSET_NONE,			ICE_FDIR_INSET_ETH_IPV6_UDP,	ICE_INSET_NONE},
+	{pattern_eth_ipv6_tcp,				ICE_INSET_NONE,			ICE_FDIR_INSET_ETH_IPV6_TCP,	ICE_INSET_NONE},
+	{pattern_eth_ipv6_sctp,				ICE_INSET_NONE,			ICE_FDIR_INSET_ETH_IPV6_SCTP,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_ipv4,		ICE_FDIR_INSET_ETH_IPV4_VXLAN,	ICE_FDIR_INSET_IPV4,		ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_ipv4_udp,		ICE_FDIR_INSET_ETH_IPV4_VXLAN,	ICE_FDIR_INSET_IPV4_UDP,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_ipv4_tcp,		ICE_FDIR_INSET_ETH_IPV4_VXLAN,	ICE_FDIR_INSET_IPV4_TCP,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_ipv4_sctp,		ICE_FDIR_INSET_ETH_IPV4_VXLAN,	ICE_FDIR_INSET_IPV4_SCTP,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_eth_ipv4,		ICE_FDIR_INSET_ETH_IPV4_VXLAN,	ICE_FDIR_INSET_ETH_IPV4,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_udp,	ICE_FDIR_INSET_ETH_IPV4_VXLAN,	ICE_FDIR_INSET_ETH_IPV4_UDP,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_tcp,	ICE_FDIR_INSET_ETH_IPV4_VXLAN,	ICE_FDIR_INSET_ETH_IPV4_TCP,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_sctp,	ICE_FDIR_INSET_ETH_IPV4_VXLAN,	ICE_FDIR_INSET_ETH_IPV4_SCTP,	ICE_INSET_NONE},
+	/* duplicated GTPU input set in 3rd column to align with shared code behavior. Ideally, only put GTPU field in 2nd column. */
+	{pattern_eth_ipv4_gtpu,				ICE_FDIR_INSET_IPV4_GTPU,	ICE_FDIR_INSET_IPV4_GTPU,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh,			ICE_FDIR_INSET_IPV4_GTPU_EH,	ICE_FDIR_INSET_IPV4_GTPU_EH,	ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu,				ICE_FDIR_INSET_IPV6_GTPU,   	ICE_FDIR_INSET_IPV6_GTPU,	ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh,			ICE_FDIR_INSET_IPV6_GTPU_EH,	ICE_FDIR_INSET_IPV6_GTPU_EH,	ICE_INSET_NONE},
 };
 
 static struct ice_flow_parser ice_fdir_parser;
@@ -2012,7 +2009,8 @@ ice_fdir_parse(struct ice_adapter *ad,
 	if (ret)
 		goto error;
 	input_set = filter->input_set | filter->outer_input_set;
-	if (!input_set || input_set & ~item->input_set_mask) {
+	if (!input_set || filter->input_set & ~item->input_set_mask ||
+	    filter->outer_input_set & ~item->input_set_mask_f) {
 		rte_flow_error_set(error, EINVAL,
 				   RTE_FLOW_ERROR_TYPE_ITEM_SPEC,
 				   pattern,
diff --git a/drivers/net/ice/ice_generic_flow.c b/drivers/net/ice/ice_generic_flow.c
index c4496dbbe1..ea83714815 100644
--- a/drivers/net/ice/ice_generic_flow.c
+++ b/drivers/net/ice/ice_generic_flow.c
@@ -2216,6 +2216,8 @@ ice_search_pattern_match_item(struct ice_adapter *ad,
 	for (i = 0; i < array_len; i++) {
 		if (ice_match_pattern(array[i].pattern_list,
 				      items)) {
+			pattern_match_item->input_set_mask_f =
+				array[i].input_set_mask_f;
 			pattern_match_item->input_set_mask =
 				array[i].input_set_mask;
 			pattern_match_item->pattern_list =
diff --git a/drivers/net/ice/ice_generic_flow.h b/drivers/net/ice/ice_generic_flow.h
index 3c648c0f4f..d3f9037383 100644
--- a/drivers/net/ice/ice_generic_flow.h
+++ b/drivers/net/ice/ice_generic_flow.h
@@ -473,6 +473,7 @@ enum ice_flow_classification_stage {
 /* pattern structure */
 struct ice_pattern_match_item {
 	enum rte_flow_item_type *pattern_list;
+	uint64_t input_set_mask_f; /* only used for tunnel outer fields */
 	/* pattern_list must end with RTE_FLOW_ITEM_TYPE_END */
 	uint64_t input_set_mask;
 	void *meta;
diff --git a/drivers/net/ice/ice_hash.c b/drivers/net/ice/ice_hash.c
index aee4761625..6db16a186a 100644
--- a/drivers/net/ice/ice_hash.c
+++ b/drivers/net/ice/ice_hash.c
@@ -352,97 +352,65 @@ struct ice_rss_hash_cfg empty_tmplt = {
 	0
 };
 
-/* rss type super set */
-/* Empty rss type to support simple_xor. */
-#define ICE_RSS_TYPE_EMPTY	0ULL
-
-/* IPv4 outer */
-#define ICE_RSS_TYPE_OUTER_IPV4		(ETH_RSS_ETH | ETH_RSS_IPV4)
-#define ICE_RSS_TYPE_OUTER_IPV4_UDP	(ICE_RSS_TYPE_OUTER_IPV4 | \
-					 ETH_RSS_NONFRAG_IPV4_UDP)
-#define ICE_RSS_TYPE_OUTER_IPV4_TCP	(ICE_RSS_TYPE_OUTER_IPV4 | \
-					 ETH_RSS_NONFRAG_IPV4_TCP)
-#define ICE_RSS_TYPE_OUTER_IPV4_SCTP	(ICE_RSS_TYPE_OUTER_IPV4 | \
-					 ETH_RSS_NONFRAG_IPV4_SCTP)
-/* IPv6 outer */
-#define ICE_RSS_TYPE_OUTER_IPV6		(ETH_RSS_ETH | ETH_RSS_IPV6)
-#define ICE_RSS_TYPE_OUTER_IPV6_UDP	(ICE_RSS_TYPE_OUTER_IPV6 | \
-					 ETH_RSS_NONFRAG_IPV6_UDP)
-#define ICE_RSS_TYPE_OUTER_IPV6_TCP	(ICE_RSS_TYPE_OUTER_IPV6 | \
-					 ETH_RSS_NONFRAG_IPV6_TCP)
-#define ICE_RSS_TYPE_OUTER_IPV6_SCTP	(ICE_RSS_TYPE_OUTER_IPV6 | \
-					 ETH_RSS_NONFRAG_IPV6_SCTP)
+/* IPv4 */
+#define ICE_RSS_TYPE_ETH_IPV4		(ETH_RSS_ETH | ETH_RSS_IPV4)
+#define ICE_RSS_TYPE_ETH_IPV4_UDP	(ICE_RSS_TYPE_ETH_IPV4 | \
+					ETH_RSS_NONFRAG_IPV4_UDP)
+#define ICE_RSS_TYPE_ETH_IPV4_TCP	(ICE_RSS_TYPE_ETH_IPV4 | \
+					ETH_RSS_NONFRAG_IPV4_TCP)
+#define ICE_RSS_TYPE_ETH_IPV4_SCTP	(ICE_RSS_TYPE_ETH_IPV4 | \
+					ETH_RSS_NONFRAG_IPV4_SCTP)
+
+#define ICE_RSS_TYPE_IPV4		ETH_RSS_IPV4
+#define ICE_RSS_TYPE_IPV4_UDP		(ICE_RSS_TYPE_IPV4 | \
+					ETH_RSS_NONFRAG_IPV4_UDP)
+#define ICE_RSS_TYPE_IPV4_TCP		(ICE_RSS_TYPE_IPV4 | \
+					ETH_RSS_NONFRAG_IPV4_TCP)
+#define ICE_RSS_TYPE_IPV4_SCTP		(ICE_RSS_TYPE_IPV4 | \
+					ETH_RSS_NONFRAG_IPV4_SCTP)
+
+/* IPv6 */
+#define ICE_RSS_TYPE_ETH_IPV6		(ETH_RSS_ETH | ETH_RSS_IPV6)
+#define ICE_RSS_TYPE_ETH_IPV6_UDP	(ICE_RSS_TYPE_ETH_IPV6 | \
+					ETH_RSS_NONFRAG_IPV6_UDP)
+#define ICE_RSS_TYPE_ETH_IPV6_TCP	(ICE_RSS_TYPE_ETH_IPV6 | \
+					ETH_RSS_NONFRAG_IPV6_TCP)
+#define ICE_RSS_TYPE_ETH_IPV6_SCTP	(ICE_RSS_TYPE_ETH_IPV6 | \
+					ETH_RSS_NONFRAG_IPV6_SCTP)
+
+#define ICE_RSS_TYPE_IPV6		ETH_RSS_IPV6
+#define ICE_RSS_TYPE_IPV6_UDP		(ICE_RSS_TYPE_IPV6 | \
+					ETH_RSS_NONFRAG_IPV6_UDP)
+#define ICE_RSS_TYPE_IPV6_TCP		(ICE_RSS_TYPE_IPV6 | \
+					ETH_RSS_NONFRAG_IPV6_TCP)
+#define ICE_RSS_TYPE_IPV6_SCTP		(ICE_RSS_TYPE_IPV6 | \
+					ETH_RSS_NONFRAG_IPV6_SCTP)
 
 /* VLAN IPV4 */
-#define ICE_RSS_TYPE_VLAN_IPV4		(ICE_RSS_TYPE_OUTER_IPV4 | \
+#define ICE_RSS_TYPE_VLAN_IPV4		(ICE_RSS_TYPE_IPV4 | \
 					 ETH_RSS_S_VLAN | ETH_RSS_C_VLAN)
-#define ICE_RSS_TYPE_VLAN_IPV4_UDP	(ICE_RSS_TYPE_OUTER_IPV4_UDP | \
+#define ICE_RSS_TYPE_VLAN_IPV4_UDP	(ICE_RSS_TYPE_IPV4_UDP | \
 					 ETH_RSS_S_VLAN | ETH_RSS_C_VLAN)
-#define ICE_RSS_TYPE_VLAN_IPV4_TCP	(ICE_RSS_TYPE_OUTER_IPV4_TCP | \
+#define ICE_RSS_TYPE_VLAN_IPV4_TCP	(ICE_RSS_TYPE_IPV4_TCP | \
 					 ETH_RSS_S_VLAN | ETH_RSS_C_VLAN)
-#define ICE_RSS_TYPE_VLAN_IPV4_SCTP	(ICE_RSS_TYPE_OUTER_IPV4_SCTP | \
+#define ICE_RSS_TYPE_VLAN_IPV4_SCTP	(ICE_RSS_TYPE_IPV4_SCTP | \
 					 ETH_RSS_S_VLAN | ETH_RSS_C_VLAN)
 /* VLAN IPv6 */
-#define ICE_RSS_TYPE_VLAN_IPV6		(ICE_RSS_TYPE_OUTER_IPV6 | \
+#define ICE_RSS_TYPE_VLAN_IPV6		(ICE_RSS_TYPE_IPV6 | \
 					 ETH_RSS_S_VLAN | ETH_RSS_C_VLAN)
-#define ICE_RSS_TYPE_VLAN_IPV6_UDP	(ICE_RSS_TYPE_OUTER_IPV6_UDP | \
+#define ICE_RSS_TYPE_VLAN_IPV6_UDP	(ICE_RSS_TYPE_IPV6_UDP | \
 					 ETH_RSS_S_VLAN | ETH_RSS_C_VLAN)
-#define ICE_RSS_TYPE_VLAN_IPV6_TCP	(ICE_RSS_TYPE_OUTER_IPV6_TCP | \
+#define ICE_RSS_TYPE_VLAN_IPV6_TCP	(ICE_RSS_TYPE_IPV6_TCP | \
 					 ETH_RSS_S_VLAN | ETH_RSS_C_VLAN)
-#define ICE_RSS_TYPE_VLAN_IPV6_SCTP	(ICE_RSS_TYPE_OUTER_IPV6_SCTP | \
+#define ICE_RSS_TYPE_VLAN_IPV6_SCTP	(ICE_RSS_TYPE_IPV6_SCTP | \
 					 ETH_RSS_S_VLAN | ETH_RSS_C_VLAN)
 
-/* IPv4 inner */
-#define ICE_RSS_TYPE_INNER_IPV4		ETH_RSS_IPV4
-#define ICE_RSS_TYPE_INNER_IPV4_UDP	(ETH_RSS_IPV4 | \
-					 ETH_RSS_NONFRAG_IPV4_UDP)
-#define ICE_RSS_TYPE_INNER_IPV4_TCP	(ETH_RSS_IPV4 | \
-					 ETH_RSS_NONFRAG_IPV4_TCP)
-#define ICE_RSS_TYPE_INNER_IPV4_SCTP	(ETH_RSS_IPV4 | \
-					 ETH_RSS_NONFRAG_IPV4_SCTP)
-/* IPv6 inner */
-#define ICE_RSS_TYPE_INNER_IPV6		ETH_RSS_IPV6
-#define ICE_RSS_TYPE_INNER_IPV6_UDP	(ETH_RSS_IPV6 | \
-					 ETH_RSS_NONFRAG_IPV6_UDP)
-#define ICE_RSS_TYPE_INNER_IPV6_TCP	(ETH_RSS_IPV6 | \
-					 ETH_RSS_NONFRAG_IPV6_TCP)
-#define ICE_RSS_TYPE_INNER_IPV6_SCTP	(ETH_RSS_IPV6 | \
-					 ETH_RSS_NONFRAG_IPV6_SCTP)
-
-/* GTPU IPv4 */
-#define ICE_RSS_TYPE_GTPU_IPV4		(ICE_RSS_TYPE_INNER_IPV4 | \
-					 ETH_RSS_GTPU)
-#define ICE_RSS_TYPE_GTPU_IPV4_UDP	(ICE_RSS_TYPE_INNER_IPV4_UDP | \
-					 ETH_RSS_GTPU)
-#define ICE_RSS_TYPE_GTPU_IPV4_TCP	(ICE_RSS_TYPE_INNER_IPV4_TCP | \
-					 ETH_RSS_GTPU)
-/* GTPU IPv6 */
-#define ICE_RSS_TYPE_GTPU_IPV6		(ICE_RSS_TYPE_INNER_IPV6 | \
-					 ETH_RSS_GTPU)
-#define ICE_RSS_TYPE_GTPU_IPV6_UDP	(ICE_RSS_TYPE_INNER_IPV6_UDP | \
-					 ETH_RSS_GTPU)
-#define ICE_RSS_TYPE_GTPU_IPV6_TCP	(ICE_RSS_TYPE_INNER_IPV6_TCP | \
-					 ETH_RSS_GTPU)
-
-/* PPPOE IPv4 */
-#define ICE_RSS_TYPE_PPPOE_IPV4		(ICE_RSS_TYPE_INNER_IPV4 | \
-					 ETH_RSS_PPPOE)
-#define ICE_RSS_TYPE_PPPOE_IPV4_UDP	(ICE_RSS_TYPE_INNER_IPV4_UDP | \
-					 ETH_RSS_PPPOE)
-#define ICE_RSS_TYPE_PPPOE_IPV4_TCP	(ICE_RSS_TYPE_INNER_IPV4_TCP | \
-					 ETH_RSS_PPPOE)
-
-/* PPPOE IPv6 */
-#define ICE_RSS_TYPE_PPPOE_IPV6		(ICE_RSS_TYPE_INNER_IPV6 | \
-					 ETH_RSS_PPPOE)
-#define ICE_RSS_TYPE_PPPOE_IPV6_UDP	(ICE_RSS_TYPE_INNER_IPV6_UDP | \
-					 ETH_RSS_PPPOE)
-#define ICE_RSS_TYPE_PPPOE_IPV6_TCP	(ICE_RSS_TYPE_INNER_IPV6_TCP | \
-					 ETH_RSS_PPPOE)
-
-/* PPPOE*/
+/* PPPOE */
 #define ICE_RSS_TYPE_PPPOE		(ETH_RSS_ETH | ETH_RSS_PPPOE)
 
+/* GTPU */
+#define ICE_RSS_TYPE_GTPU		ETH_RSS_GTPU
+
 /* ESP, AH, L2TPV3 and PFCP */
 #define ICE_RSS_TYPE_IPV4_ESP		(ETH_RSS_ESP | ETH_RSS_IPV4)
 #define ICE_RSS_TYPE_IPV6_ESP		(ETH_RSS_ESP | ETH_RSS_IPV6)
@@ -461,67 +429,67 @@ struct ice_rss_hash_cfg empty_tmplt = {
  */
 static struct ice_pattern_match_item ice_hash_pattern_list[] = {
 	/* IPV4 */
-	{pattern_eth_ipv4,			ICE_RSS_TYPE_OUTER_IPV4,	&ipv4_tmplt},
-	{pattern_eth_ipv4_udp,			ICE_RSS_TYPE_OUTER_IPV4_UDP,	&ipv4_udp_tmplt},
-	{pattern_eth_ipv4_tcp,			ICE_RSS_TYPE_OUTER_IPV4_TCP,	&ipv4_tcp_tmplt},
-	{pattern_eth_ipv4_sctp,			ICE_RSS_TYPE_OUTER_IPV4_SCTP,	&ipv4_sctp_tmplt},
-	{pattern_eth_vlan_ipv4,			ICE_RSS_TYPE_VLAN_IPV4,		&ipv4_tmplt},
-	{pattern_eth_vlan_ipv4_udp,		ICE_RSS_TYPE_VLAN_IPV4_UDP,	&ipv4_udp_tmplt},
-	{pattern_eth_vlan_ipv4_tcp,		ICE_RSS_TYPE_VLAN_IPV4_TCP,	&ipv4_tcp_tmplt},
-	{pattern_eth_vlan_ipv4_sctp,		ICE_RSS_TYPE_VLAN_IPV4_SCTP,	&ipv4_sctp_tmplt},
-	{pattern_eth_ipv4_gtpu_ipv4,		ICE_RSS_TYPE_GTPU_IPV4,		&outer_ipv4_inner_ipv4_tmplt},
-	{pattern_eth_ipv4_gtpu_ipv4_udp,	ICE_RSS_TYPE_GTPU_IPV4_UDP,	&outer_ipv4_inner_ipv4_udp_tmplt},
-	{pattern_eth_ipv4_gtpu_ipv4_tcp,	ICE_RSS_TYPE_GTPU_IPV4_TCP,	&outer_ipv4_inner_ipv4_tcp_tmplt},
-	{pattern_eth_ipv6_gtpu_ipv4,		ICE_RSS_TYPE_GTPU_IPV4,		&outer_ipv6_inner_ipv4_tmplt},
-	{pattern_eth_ipv6_gtpu_ipv4_udp,	ICE_RSS_TYPE_GTPU_IPV4_UDP,	&outer_ipv6_inner_ipv4_udp_tmplt},
-	{pattern_eth_ipv6_gtpu_ipv4_tcp,	ICE_RSS_TYPE_GTPU_IPV4_TCP,	&outer_ipv6_inner_ipv4_tcp_tmplt},
-	{pattern_eth_ipv4_gtpu_eh_ipv4,		ICE_RSS_TYPE_GTPU_IPV4,		&outer_ipv4_inner_ipv4_tmplt},
-	{pattern_eth_ipv4_gtpu_eh_ipv4_udp,	ICE_RSS_TYPE_GTPU_IPV4_UDP,	&outer_ipv4_inner_ipv4_udp_tmplt},
-	{pattern_eth_ipv4_gtpu_eh_ipv4_tcp,	ICE_RSS_TYPE_GTPU_IPV4_TCP,	&outer_ipv4_inner_ipv4_tcp_tmplt},
-	{pattern_eth_ipv6_gtpu_eh_ipv4,		ICE_RSS_TYPE_GTPU_IPV4,		&outer_ipv6_inner_ipv4_tmplt},
-	{pattern_eth_ipv6_gtpu_eh_ipv4_udp,	ICE_RSS_TYPE_GTPU_IPV4_UDP,	&outer_ipv6_inner_ipv4_udp_tmplt},
-	{pattern_eth_ipv6_gtpu_eh_ipv4_tcp,	ICE_RSS_TYPE_GTPU_IPV4_TCP,	&outer_ipv6_inner_ipv4_tcp_tmplt},
-	{pattern_eth_pppoes_ipv4,		ICE_RSS_TYPE_PPPOE_IPV4,	&ipv4_tmplt},
-	{pattern_eth_pppoes_ipv4_udp,		ICE_RSS_TYPE_PPPOE_IPV4_UDP,	&ipv4_udp_tmplt},
-	{pattern_eth_pppoes_ipv4_tcp,		ICE_RSS_TYPE_PPPOE_IPV4_TCP,	&ipv4_tcp_tmplt},
-	{pattern_eth_ipv4_esp,			ICE_RSS_TYPE_IPV4_ESP,		&eth_ipv4_esp_tmplt},
-	{pattern_eth_ipv4_udp_esp,		ICE_RSS_TYPE_IPV4_ESP,		&eth_ipv4_udp_esp_tmplt},
-	{pattern_eth_ipv4_ah,			ICE_RSS_TYPE_IPV4_AH,		&eth_ipv4_ah_tmplt},
-	{pattern_eth_ipv4_l2tp,			ICE_RSS_TYPE_IPV4_L2TPV3,	&eth_ipv4_l2tpv3_tmplt},
-	{pattern_eth_ipv4_pfcp,			ICE_RSS_TYPE_IPV4_PFCP,		&eth_ipv4_pfcp_tmplt},
+	{pattern_eth_ipv4,			ICE_INSET_NONE,			ICE_RSS_TYPE_ETH_IPV4,		&ipv4_tmplt},
+	{pattern_eth_ipv4_udp,			ICE_INSET_NONE,			ICE_RSS_TYPE_ETH_IPV4_UDP,	&ipv4_udp_tmplt},
+	{pattern_eth_ipv4_tcp,			ICE_INSET_NONE,			ICE_RSS_TYPE_ETH_IPV4_TCP,	&ipv4_tcp_tmplt},
+	{pattern_eth_ipv4_sctp,			ICE_INSET_NONE,			ICE_RSS_TYPE_ETH_IPV4_SCTP,	&ipv4_sctp_tmplt},
+	{pattern_eth_vlan_ipv4,			ICE_INSET_NONE,			ICE_RSS_TYPE_VLAN_IPV4,		&ipv4_tmplt},
+	{pattern_eth_vlan_ipv4_udp,		ICE_INSET_NONE,			ICE_RSS_TYPE_VLAN_IPV4_UDP,	&ipv4_udp_tmplt},
+	{pattern_eth_vlan_ipv4_tcp,		ICE_INSET_NONE,			ICE_RSS_TYPE_VLAN_IPV4_TCP,	&ipv4_tcp_tmplt},
+	{pattern_eth_vlan_ipv4_sctp,		ICE_INSET_NONE,			ICE_RSS_TYPE_VLAN_IPV4_SCTP,	&ipv4_sctp_tmplt},
+	{pattern_eth_ipv4_gtpu_ipv4,		ICE_RSS_TYPE_GTPU,		ICE_RSS_TYPE_IPV4,		&outer_ipv4_inner_ipv4_tmplt},
+	{pattern_eth_ipv4_gtpu_ipv4_udp,	ICE_RSS_TYPE_GTPU,		ICE_RSS_TYPE_IPV4_UDP,		&outer_ipv4_inner_ipv4_udp_tmplt},
+	{pattern_eth_ipv4_gtpu_ipv4_tcp,	ICE_RSS_TYPE_GTPU,		ICE_RSS_TYPE_IPV4_TCP,		&outer_ipv4_inner_ipv4_tcp_tmplt},
+	{pattern_eth_ipv6_gtpu_ipv4,		ICE_RSS_TYPE_GTPU,		ICE_RSS_TYPE_IPV4,		&outer_ipv6_inner_ipv4_tmplt},
+	{pattern_eth_ipv6_gtpu_ipv4_udp,	ICE_RSS_TYPE_GTPU,		ICE_RSS_TYPE_IPV4_UDP,		&outer_ipv6_inner_ipv4_udp_tmplt},
+	{pattern_eth_ipv6_gtpu_ipv4_tcp,	ICE_RSS_TYPE_GTPU,		ICE_RSS_TYPE_IPV4_TCP,		&outer_ipv6_inner_ipv4_tcp_tmplt},
+	{pattern_eth_ipv4_gtpu_eh_ipv4,		ICE_RSS_TYPE_GTPU,		ICE_RSS_TYPE_IPV4,		&outer_ipv4_inner_ipv4_tmplt},
+	{pattern_eth_ipv4_gtpu_eh_ipv4_udp,	ICE_RSS_TYPE_GTPU,		ICE_RSS_TYPE_IPV4_UDP,		&outer_ipv4_inner_ipv4_udp_tmplt},
+	{pattern_eth_ipv4_gtpu_eh_ipv4_tcp,	ICE_RSS_TYPE_GTPU,		ICE_RSS_TYPE_IPV4_TCP,		&outer_ipv4_inner_ipv4_tcp_tmplt},
+	{pattern_eth_ipv6_gtpu_eh_ipv4,		ICE_RSS_TYPE_GTPU,		ICE_RSS_TYPE_IPV4,		&outer_ipv6_inner_ipv4_tmplt},
+	{pattern_eth_ipv6_gtpu_eh_ipv4_udp,	ICE_RSS_TYPE_GTPU,		ICE_RSS_TYPE_IPV4_UDP,		&outer_ipv6_inner_ipv4_udp_tmplt},
+	{pattern_eth_ipv6_gtpu_eh_ipv4_tcp,	ICE_RSS_TYPE_GTPU,		ICE_RSS_TYPE_IPV4_TCP,		&outer_ipv6_inner_ipv4_tcp_tmplt},
+	{pattern_eth_pppoes_ipv4,		ICE_RSS_TYPE_PPPOE,		ICE_RSS_TYPE_IPV4,		&ipv4_tmplt},
+	{pattern_eth_pppoes_ipv4_udp,		ICE_RSS_TYPE_PPPOE,		ICE_RSS_TYPE_IPV4_UDP,		&ipv4_udp_tmplt},
+	{pattern_eth_pppoes_ipv4_tcp,		ICE_RSS_TYPE_PPPOE,		ICE_RSS_TYPE_IPV4_TCP,		&ipv4_tcp_tmplt},
+	{pattern_eth_ipv4_esp,			ICE_RSS_TYPE_IPV4_ESP,		ICE_INSET_NONE,			&eth_ipv4_esp_tmplt},
+	{pattern_eth_ipv4_udp_esp,		ICE_RSS_TYPE_IPV4_ESP,		ICE_INSET_NONE,			&eth_ipv4_udp_esp_tmplt},
+	{pattern_eth_ipv4_ah,			ICE_RSS_TYPE_IPV4_AH,		ICE_INSET_NONE,			&eth_ipv4_ah_tmplt},
+	{pattern_eth_ipv4_l2tp,			ICE_RSS_TYPE_IPV4_L2TPV3,	ICE_INSET_NONE,			&eth_ipv4_l2tpv3_tmplt},
+	{pattern_eth_ipv4_pfcp,			ICE_RSS_TYPE_IPV4_PFCP,		ICE_INSET_NONE,			&eth_ipv4_pfcp_tmplt},
 	/* IPV6 */
-	{pattern_eth_ipv6,			ICE_RSS_TYPE_OUTER_IPV6,	&ipv6_tmplt},
-	{pattern_eth_ipv6_udp,			ICE_RSS_TYPE_OUTER_IPV6_UDP,	&ipv6_udp_tmplt},
-	{pattern_eth_ipv6_tcp,			ICE_RSS_TYPE_OUTER_IPV6_TCP,	&ipv6_tcp_tmplt},
-	{pattern_eth_ipv6_sctp,			ICE_RSS_TYPE_OUTER_IPV6_SCTP,	&ipv6_sctp_tmplt},
-	{pattern_eth_vlan_ipv6,			ICE_RSS_TYPE_VLAN_IPV6,		&ipv6_tmplt},
-	{pattern_eth_vlan_ipv6_udp,		ICE_RSS_TYPE_VLAN_IPV6_UDP,	&ipv6_udp_tmplt},
-	{pattern_eth_vlan_ipv6_tcp,		ICE_RSS_TYPE_VLAN_IPV6_TCP,	&ipv6_tcp_tmplt},
-	{pattern_eth_vlan_ipv6_sctp,		ICE_RSS_TYPE_VLAN_IPV6_SCTP,	&ipv6_sctp_tmplt},
-	{pattern_eth_ipv4_gtpu_ipv6,		ICE_RSS_TYPE_GTPU_IPV6,		&outer_ipv4_inner_ipv6_tmplt},
-	{pattern_eth_ipv4_gtpu_ipv6_udp,	ICE_RSS_TYPE_GTPU_IPV6_UDP,	&outer_ipv4_inner_ipv6_udp_tmplt},
-	{pattern_eth_ipv4_gtpu_ipv6_tcp,	ICE_RSS_TYPE_GTPU_IPV6_TCP,	&outer_ipv4_inner_ipv6_tcp_tmplt},
-	{pattern_eth_ipv6_gtpu_ipv6,		ICE_RSS_TYPE_GTPU_IPV6,		&outer_ipv6_inner_ipv6_tmplt},
-	{pattern_eth_ipv6_gtpu_ipv6_udp,	ICE_RSS_TYPE_GTPU_IPV6_UDP,	&outer_ipv6_inner_ipv6_udp_tmplt},
-	{pattern_eth_ipv6_gtpu_ipv6_tcp,	ICE_RSS_TYPE_GTPU_IPV6_TCP,	&outer_ipv6_inner_ipv6_tcp_tmplt},
-	{pattern_eth_ipv4_gtpu_eh_ipv6,		ICE_RSS_TYPE_GTPU_IPV6,		&outer_ipv4_inner_ipv6_tmplt},
-	{pattern_eth_ipv4_gtpu_eh_ipv6_udp,	ICE_RSS_TYPE_GTPU_IPV6_UDP,	&outer_ipv4_inner_ipv6_udp_tmplt},
-	{pattern_eth_ipv4_gtpu_eh_ipv6_tcp,	ICE_RSS_TYPE_GTPU_IPV6_TCP,	&outer_ipv4_inner_ipv6_tcp_tmplt},
-	{pattern_eth_ipv6_gtpu_eh_ipv6,		ICE_RSS_TYPE_GTPU_IPV6,		&outer_ipv6_inner_ipv6_tmplt},
-	{pattern_eth_ipv6_gtpu_eh_ipv6_udp,	ICE_RSS_TYPE_GTPU_IPV6_UDP,	&outer_ipv6_inner_ipv6_udp_tmplt},
-	{pattern_eth_ipv6_gtpu_eh_ipv6_tcp,	ICE_RSS_TYPE_GTPU_IPV6_TCP,	&outer_ipv6_inner_ipv6_tcp_tmplt},
-	{pattern_eth_pppoes_ipv6,		ICE_RSS_TYPE_PPPOE_IPV6,	&ipv6_tmplt},
-	{pattern_eth_pppoes_ipv6_udp,		ICE_RSS_TYPE_PPPOE_IPV6_UDP,	&ipv6_udp_tmplt},
-	{pattern_eth_pppoes_ipv6_tcp,		ICE_RSS_TYPE_PPPOE_IPV6_TCP,	&ipv6_tcp_tmplt},
-	{pattern_eth_ipv6_esp,			ICE_RSS_TYPE_IPV6_ESP,		&eth_ipv6_esp_tmplt},
-	{pattern_eth_ipv6_udp_esp,		ICE_RSS_TYPE_IPV6_ESP,		&eth_ipv6_udp_esp_tmplt},
-	{pattern_eth_ipv6_ah,			ICE_RSS_TYPE_IPV6_AH,		&eth_ipv6_ah_tmplt},
-	{pattern_eth_ipv6_l2tp,			ICE_RSS_TYPE_IPV6_L2TPV3,	&eth_ipv6_l2tpv3_tmplt},
-	{pattern_eth_ipv6_pfcp,			ICE_RSS_TYPE_IPV6_PFCP,		&eth_ipv6_pfcp_tmplt},
+	{pattern_eth_ipv6,			ICE_INSET_NONE,			ICE_RSS_TYPE_ETH_IPV6,		&ipv6_tmplt},
+	{pattern_eth_ipv6_udp,			ICE_INSET_NONE,			ICE_RSS_TYPE_ETH_IPV6_UDP,	&ipv6_udp_tmplt},
+	{pattern_eth_ipv6_tcp,			ICE_INSET_NONE,			ICE_RSS_TYPE_ETH_IPV6_TCP,	&ipv6_tcp_tmplt},
+	{pattern_eth_ipv6_sctp,			ICE_INSET_NONE,			ICE_RSS_TYPE_ETH_IPV6_SCTP,	&ipv6_sctp_tmplt},
+	{pattern_eth_vlan_ipv6,			ICE_INSET_NONE,			ICE_RSS_TYPE_VLAN_IPV6,		&ipv6_tmplt},
+	{pattern_eth_vlan_ipv6_udp,		ICE_INSET_NONE,			ICE_RSS_TYPE_VLAN_IPV6_UDP,	&ipv6_udp_tmplt},
+	{pattern_eth_vlan_ipv6_tcp,		ICE_INSET_NONE,			ICE_RSS_TYPE_VLAN_IPV6_TCP,	&ipv6_tcp_tmplt},
+	{pattern_eth_vlan_ipv6_sctp,		ICE_INSET_NONE,			ICE_RSS_TYPE_VLAN_IPV6_SCTP,	&ipv6_sctp_tmplt},
+	{pattern_eth_ipv4_gtpu_ipv6,		ICE_RSS_TYPE_GTPU,		ICE_RSS_TYPE_IPV6,		&outer_ipv4_inner_ipv6_tmplt},
+	{pattern_eth_ipv4_gtpu_ipv6_udp,	ICE_RSS_TYPE_GTPU,		ICE_RSS_TYPE_IPV6_UDP,		&outer_ipv4_inner_ipv6_udp_tmplt},
+	{pattern_eth_ipv4_gtpu_ipv6_tcp,	ICE_RSS_TYPE_GTPU,		ICE_RSS_TYPE_IPV6_TCP,		&outer_ipv4_inner_ipv6_tcp_tmplt},
+	{pattern_eth_ipv6_gtpu_ipv6,		ICE_RSS_TYPE_GTPU,		ICE_RSS_TYPE_IPV6,		&outer_ipv6_inner_ipv6_tmplt},
+	{pattern_eth_ipv6_gtpu_ipv6_udp,	ICE_RSS_TYPE_GTPU,		ICE_RSS_TYPE_IPV6_UDP,		&outer_ipv6_inner_ipv6_udp_tmplt},
+	{pattern_eth_ipv6_gtpu_ipv6_tcp,	ICE_RSS_TYPE_GTPU,		ICE_RSS_TYPE_IPV6_TCP,		&outer_ipv6_inner_ipv6_tcp_tmplt},
+	{pattern_eth_ipv4_gtpu_eh_ipv6,		ICE_RSS_TYPE_GTPU,		ICE_RSS_TYPE_IPV6,		&outer_ipv4_inner_ipv6_tmplt},
+	{pattern_eth_ipv4_gtpu_eh_ipv6_udp,	ICE_RSS_TYPE_GTPU,		ICE_RSS_TYPE_IPV6_UDP,		&outer_ipv4_inner_ipv6_udp_tmplt},
+	{pattern_eth_ipv4_gtpu_eh_ipv6_tcp,	ICE_RSS_TYPE_GTPU,		ICE_RSS_TYPE_IPV6_TCP,		&outer_ipv4_inner_ipv6_tcp_tmplt},
+	{pattern_eth_ipv6_gtpu_eh_ipv6,		ICE_RSS_TYPE_GTPU,		ICE_RSS_TYPE_IPV6,		&outer_ipv6_inner_ipv6_tmplt},
+	{pattern_eth_ipv6_gtpu_eh_ipv6_udp,	ICE_RSS_TYPE_GTPU,		ICE_RSS_TYPE_IPV6_UDP,		&outer_ipv6_inner_ipv6_udp_tmplt},
+	{pattern_eth_ipv6_gtpu_eh_ipv6_tcp,	ICE_RSS_TYPE_GTPU,		ICE_RSS_TYPE_IPV6_TCP,		&outer_ipv6_inner_ipv6_tcp_tmplt},
+	{pattern_eth_pppoes_ipv6,		ICE_RSS_TYPE_PPPOE,		ICE_RSS_TYPE_IPV6,		&ipv6_tmplt},
+	{pattern_eth_pppoes_ipv6_udp,		ICE_RSS_TYPE_PPPOE,		ICE_RSS_TYPE_IPV6_UDP,		&ipv6_udp_tmplt},
+	{pattern_eth_pppoes_ipv6_tcp,		ICE_RSS_TYPE_PPPOE,		ICE_RSS_TYPE_IPV6_TCP,		&ipv6_tcp_tmplt},
+	{pattern_eth_ipv6_esp,			ICE_RSS_TYPE_IPV6_ESP,		ICE_INSET_NONE,			&eth_ipv6_esp_tmplt},
+	{pattern_eth_ipv6_udp_esp,		ICE_RSS_TYPE_IPV6_ESP,		ICE_INSET_NONE,			&eth_ipv6_udp_esp_tmplt},
+	{pattern_eth_ipv6_ah,			ICE_RSS_TYPE_IPV6_AH,		ICE_INSET_NONE,			&eth_ipv6_ah_tmplt},
+	{pattern_eth_ipv6_l2tp,			ICE_RSS_TYPE_IPV6_L2TPV3,	ICE_INSET_NONE,			&eth_ipv6_l2tpv3_tmplt},
+	{pattern_eth_ipv6_pfcp,			ICE_RSS_TYPE_IPV6_PFCP,		ICE_INSET_NONE,			&eth_ipv6_pfcp_tmplt},
 	/* PPPOE */
-	{pattern_eth_pppoes,			ICE_RSS_TYPE_PPPOE,		&pppoe_tmplt},
+	{pattern_eth_pppoes,			ICE_RSS_TYPE_PPPOE,		ICE_INSET_NONE,			&pppoe_tmplt},
 	/* EMPTY */
-	{pattern_empty,				ICE_RSS_TYPE_EMPTY,		&empty_tmplt},
+	{pattern_empty,				ICE_INSET_NONE,			ICE_INSET_NONE,			&empty_tmplt},
 };
 
 static struct ice_flow_engine ice_hash_engine = {
@@ -908,6 +876,7 @@ ice_hash_parse_action(struct ice_pattern_match_item *pattern_match_item,
 	enum rte_flow_action_type action_type;
 	const struct rte_flow_action_rss *rss;
 	const struct rte_flow_action *action;
+	uint64_t allow_rss_type;
 	uint64_t rss_type;
 
 	/* Supported action is RSS. */
@@ -959,8 +928,10 @@ ice_hash_parse_action(struct ice_pattern_match_item *pattern_match_item,
 			 */
 			rss_type = rte_eth_rss_hf_refine(rss_type);
 
+			allow_rss_type = pattern_match_item->input_set_mask_f |
+				pattern_match_item->input_set_mask;
 			if (ice_any_invalid_rss_type(rss->func, rss_type,
-					pattern_match_item->input_set_mask))
+					allow_rss_type))
 				return rte_flow_error_set(error, ENOTSUP,
 					RTE_FLOW_ERROR_TYPE_ACTION,
 					action, "RSS type not supported");
diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c
index 7bac77ecd1..ee0055e415 100644
--- a/drivers/net/ice/ice_switch_filter.c
+++ b/drivers/net/ice/ice_switch_filter.c
@@ -148,206 +148,108 @@ 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},
-	{pattern_ethertype_vlan,
-			ICE_SW_INSET_MAC_VLAN, ICE_INSET_NONE},
-	{pattern_ethertype_qinq,
-			ICE_SW_INSET_MAC_QINQ, ICE_INSET_NONE},
-	{pattern_eth_arp,
-			ICE_INSET_NONE, ICE_INSET_NONE},
-	{pattern_eth_ipv4,
-			ICE_SW_INSET_MAC_IPV4, ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp,
-			ICE_SW_INSET_MAC_IPV4_UDP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_tcp,
-			ICE_SW_INSET_MAC_IPV4_TCP, ICE_INSET_NONE},
-	{pattern_eth_ipv6,
-			ICE_SW_INSET_MAC_IPV6, ICE_INSET_NONE},
-	{pattern_eth_ipv6_udp,
-			ICE_SW_INSET_MAC_IPV6_UDP, ICE_INSET_NONE},
-	{pattern_eth_ipv6_tcp,
-			ICE_SW_INSET_MAC_IPV6_TCP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_eth_ipv4,
-			ICE_SW_INSET_DIST_VXLAN_IPV4, ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_udp,
-			ICE_SW_INSET_DIST_VXLAN_IPV4_UDP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_tcp,
-			ICE_SW_INSET_DIST_VXLAN_IPV4_TCP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_nvgre_eth_ipv4,
-			ICE_SW_INSET_DIST_NVGRE_IPV4, ICE_INSET_NONE},
-	{pattern_eth_ipv4_nvgre_eth_ipv4_udp,
-			ICE_SW_INSET_DIST_NVGRE_IPV4_UDP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_nvgre_eth_ipv4_tcp,
-			ICE_SW_INSET_DIST_NVGRE_IPV4_TCP, ICE_INSET_NONE},
-	{pattern_eth_pppoes,
-			ICE_SW_INSET_MAC_PPPOE, ICE_INSET_NONE},
-	{pattern_eth_vlan_pppoes,
-			ICE_SW_INSET_MAC_PPPOE, ICE_INSET_NONE},
-	{pattern_eth_pppoes_proto,
-			ICE_SW_INSET_MAC_PPPOE_PROTO, ICE_INSET_NONE},
-	{pattern_eth_vlan_pppoes_proto,
-			ICE_SW_INSET_MAC_PPPOE_PROTO, ICE_INSET_NONE},
-	{pattern_eth_pppoes_ipv4,
-			ICE_SW_INSET_MAC_PPPOE_IPV4, ICE_INSET_NONE},
-	{pattern_eth_pppoes_ipv4_tcp,
-			ICE_SW_INSET_MAC_PPPOE_IPV4_TCP, ICE_INSET_NONE},
-	{pattern_eth_pppoes_ipv4_udp,
-			ICE_SW_INSET_MAC_PPPOE_IPV4_UDP, ICE_INSET_NONE},
-	{pattern_eth_pppoes_ipv6,
-			ICE_SW_INSET_MAC_PPPOE_IPV6, ICE_INSET_NONE},
-	{pattern_eth_pppoes_ipv6_tcp,
-			ICE_SW_INSET_MAC_PPPOE_IPV6_TCP, ICE_INSET_NONE},
-	{pattern_eth_pppoes_ipv6_udp,
-			ICE_SW_INSET_MAC_PPPOE_IPV6_UDP, ICE_INSET_NONE},
-	{pattern_eth_vlan_pppoes_ipv4,
-			ICE_SW_INSET_MAC_PPPOE_IPV4, ICE_INSET_NONE},
-	{pattern_eth_vlan_pppoes_ipv4_tcp,
-			ICE_SW_INSET_MAC_PPPOE_IPV4_TCP, ICE_INSET_NONE},
-	{pattern_eth_vlan_pppoes_ipv4_udp,
-			ICE_SW_INSET_MAC_PPPOE_IPV4_UDP, ICE_INSET_NONE},
-	{pattern_eth_vlan_pppoes_ipv6,
-			ICE_SW_INSET_MAC_PPPOE_IPV6, ICE_INSET_NONE},
-	{pattern_eth_vlan_pppoes_ipv6_tcp,
-			ICE_SW_INSET_MAC_PPPOE_IPV6_TCP, ICE_INSET_NONE},
-	{pattern_eth_vlan_pppoes_ipv6_udp,
-			ICE_SW_INSET_MAC_PPPOE_IPV6_UDP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_esp,
-			ICE_SW_INSET_MAC_IPV4_ESP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_esp,
-			ICE_SW_INSET_MAC_IPV4_ESP, ICE_INSET_NONE},
-	{pattern_eth_ipv6_esp,
-			ICE_SW_INSET_MAC_IPV6_ESP, ICE_INSET_NONE},
-	{pattern_eth_ipv6_udp_esp,
-			ICE_SW_INSET_MAC_IPV6_ESP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_ah,
-			ICE_SW_INSET_MAC_IPV4_AH, ICE_INSET_NONE},
-	{pattern_eth_ipv6_ah,
-			ICE_SW_INSET_MAC_IPV6_AH, ICE_INSET_NONE},
-	{pattern_eth_ipv6_udp_ah,
-			ICE_INSET_NONE, ICE_INSET_NONE},
-	{pattern_eth_ipv4_l2tp,
-			ICE_SW_INSET_MAC_IPV4_L2TP, ICE_INSET_NONE},
-	{pattern_eth_ipv6_l2tp,
-			ICE_SW_INSET_MAC_IPV6_L2TP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_pfcp,
-			ICE_INSET_NONE, ICE_INSET_NONE},
-	{pattern_eth_ipv6_pfcp,
-			ICE_INSET_NONE, ICE_INSET_NONE},
-	{pattern_eth_qinq_ipv4,
-			ICE_SW_INSET_MAC_QINQ_IPV4, ICE_INSET_NONE},
-	{pattern_eth_qinq_ipv6,
-			ICE_SW_INSET_MAC_QINQ_IPV6, ICE_INSET_NONE},
-	{pattern_eth_qinq_pppoes,
-			ICE_SW_INSET_MAC_PPPOE, ICE_INSET_NONE},
-	{pattern_eth_qinq_pppoes_proto,
-			ICE_SW_INSET_MAC_PPPOE_PROTO, ICE_INSET_NONE},
-	{pattern_eth_qinq_pppoes_ipv4,
-			ICE_SW_INSET_MAC_PPPOE_IPV4, ICE_INSET_NONE},
-	{pattern_eth_qinq_pppoes_ipv6,
-			ICE_SW_INSET_MAC_PPPOE_IPV6, ICE_INSET_NONE},
+	{pattern_ethertype,				ICE_INSET_NONE,		ICE_SW_INSET_ETHER,			ICE_INSET_NONE},
+	{pattern_ethertype_vlan,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_VLAN,			ICE_INSET_NONE},
+	{pattern_ethertype_qinq,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_QINQ,			ICE_INSET_NONE},
+	{pattern_eth_arp,				ICE_INSET_NONE,		ICE_INSET_NONE,				ICE_INSET_NONE},
+	{pattern_eth_ipv4,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV4,			ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV4_UDP,		ICE_INSET_NONE},
+	{pattern_eth_ipv4_tcp,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV4_TCP,		ICE_INSET_NONE},
+	{pattern_eth_ipv6,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV6,			ICE_INSET_NONE},
+	{pattern_eth_ipv6_udp,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV6_UDP,		ICE_INSET_NONE},
+	{pattern_eth_ipv6_tcp,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV6_TCP,		ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_eth_ipv4,		ICE_INSET_NONE,		ICE_SW_INSET_DIST_VXLAN_IPV4,		ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_udp,	ICE_INSET_NONE,		ICE_SW_INSET_DIST_VXLAN_IPV4_UDP,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_tcp,	ICE_INSET_NONE,		ICE_SW_INSET_DIST_VXLAN_IPV4_TCP,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_nvgre_eth_ipv4,		ICE_INSET_NONE,		ICE_SW_INSET_DIST_NVGRE_IPV4,		ICE_INSET_NONE},
+	{pattern_eth_ipv4_nvgre_eth_ipv4_udp,		ICE_INSET_NONE,		ICE_SW_INSET_DIST_NVGRE_IPV4_UDP,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_nvgre_eth_ipv4_tcp,		ICE_INSET_NONE,		ICE_SW_INSET_DIST_NVGRE_IPV4_TCP,	ICE_INSET_NONE},
+	{pattern_eth_pppoes,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE,			ICE_INSET_NONE},
+	{pattern_eth_vlan_pppoes,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE,			ICE_INSET_NONE},
+	{pattern_eth_pppoes_proto,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_PROTO,		ICE_INSET_NONE},
+	{pattern_eth_vlan_pppoes_proto,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_PROTO,		ICE_INSET_NONE},
+	{pattern_eth_pppoes_ipv4,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_IPV4,		ICE_INSET_NONE},
+	{pattern_eth_pppoes_ipv4_tcp,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_IPV4_TCP,	ICE_INSET_NONE},
+	{pattern_eth_pppoes_ipv4_udp,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_IPV4_UDP,	ICE_INSET_NONE},
+	{pattern_eth_pppoes_ipv6,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_IPV6,		ICE_INSET_NONE},
+	{pattern_eth_pppoes_ipv6_tcp,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_IPV6_TCP,	ICE_INSET_NONE},
+	{pattern_eth_pppoes_ipv6_udp,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_IPV6_UDP,	ICE_INSET_NONE},
+	{pattern_eth_vlan_pppoes_ipv4,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_IPV4,		ICE_INSET_NONE},
+	{pattern_eth_vlan_pppoes_ipv4_tcp,		ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_IPV4_TCP,	ICE_INSET_NONE},
+	{pattern_eth_vlan_pppoes_ipv4_udp,		ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_IPV4_UDP,	ICE_INSET_NONE},
+	{pattern_eth_vlan_pppoes_ipv6,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_IPV6,		ICE_INSET_NONE},
+	{pattern_eth_vlan_pppoes_ipv6_tcp,		ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_IPV6_TCP,	ICE_INSET_NONE},
+	{pattern_eth_vlan_pppoes_ipv6_udp,		ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_IPV6_UDP,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_esp,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV4_ESP,		ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_esp,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV4_ESP,		ICE_INSET_NONE},
+	{pattern_eth_ipv6_esp,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV6_ESP,		ICE_INSET_NONE},
+	{pattern_eth_ipv6_udp_esp,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV6_ESP,		ICE_INSET_NONE},
+	{pattern_eth_ipv4_ah,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV4_AH,		ICE_INSET_NONE},
+	{pattern_eth_ipv6_ah,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV6_AH,		ICE_INSET_NONE},
+	{pattern_eth_ipv6_udp_ah,			ICE_INSET_NONE,		ICE_INSET_NONE,				ICE_INSET_NONE},
+	{pattern_eth_ipv4_l2tp,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV4_L2TP,		ICE_INSET_NONE},
+	{pattern_eth_ipv6_l2tp,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV6_L2TP,		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_INSET_NONE,		ICE_SW_INSET_MAC_QINQ_IPV4,		ICE_INSET_NONE},
+	{pattern_eth_qinq_ipv6,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_QINQ_IPV6,		ICE_INSET_NONE},
+	{pattern_eth_qinq_pppoes,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE,			ICE_INSET_NONE},
+	{pattern_eth_qinq_pppoes_proto,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_PROTO,		ICE_INSET_NONE},
+	{pattern_eth_qinq_pppoes_ipv4,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_IPV4,		ICE_INSET_NONE},
+	{pattern_eth_qinq_pppoes_ipv6,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_IPV6,		ICE_INSET_NONE},
 };
 
 static struct
 ice_pattern_match_item ice_switch_pattern_perm_list[] = {
-	{pattern_ethertype,
-			ICE_SW_INSET_ETHER, ICE_INSET_NONE},
-	{pattern_ethertype_vlan,
-			ICE_SW_INSET_MAC_VLAN, ICE_INSET_NONE},
-	{pattern_ethertype_qinq,
-			ICE_SW_INSET_MAC_QINQ, ICE_INSET_NONE},
-	{pattern_eth_arp,
-		ICE_INSET_NONE, ICE_INSET_NONE},
-	{pattern_eth_ipv4,
-			ICE_SW_INSET_MAC_IPV4, ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp,
-			ICE_SW_INSET_MAC_IPV4_UDP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_tcp,
-			ICE_SW_INSET_MAC_IPV4_TCP, ICE_INSET_NONE},
-	{pattern_eth_ipv6,
-			ICE_SW_INSET_MAC_IPV6, ICE_INSET_NONE},
-	{pattern_eth_ipv6_udp,
-			ICE_SW_INSET_MAC_IPV6_UDP, ICE_INSET_NONE},
-	{pattern_eth_ipv6_tcp,
-			ICE_SW_INSET_MAC_IPV6_TCP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_eth_ipv4,
-			ICE_SW_INSET_PERM_TUNNEL_IPV4, ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_udp,
-			ICE_SW_INSET_PERM_TUNNEL_IPV4_UDP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_tcp,
-			ICE_SW_INSET_PERM_TUNNEL_IPV4_TCP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_nvgre_eth_ipv4,
-			ICE_SW_INSET_PERM_TUNNEL_IPV4, ICE_INSET_NONE},
-	{pattern_eth_ipv4_nvgre_eth_ipv4_udp,
-			ICE_SW_INSET_PERM_TUNNEL_IPV4_UDP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_nvgre_eth_ipv4_tcp,
-			ICE_SW_INSET_PERM_TUNNEL_IPV4_TCP, ICE_INSET_NONE},
-	{pattern_eth_pppoes,
-			ICE_SW_INSET_MAC_PPPOE, ICE_INSET_NONE},
-	{pattern_eth_vlan_pppoes,
-			ICE_SW_INSET_MAC_PPPOE, ICE_INSET_NONE},
-	{pattern_eth_pppoes_proto,
-			ICE_SW_INSET_MAC_PPPOE_PROTO, ICE_INSET_NONE},
-	{pattern_eth_vlan_pppoes_proto,
-			ICE_SW_INSET_MAC_PPPOE_PROTO, ICE_INSET_NONE},
-	{pattern_eth_pppoes_ipv4,
-			ICE_SW_INSET_MAC_PPPOE_IPV4, ICE_INSET_NONE},
-	{pattern_eth_pppoes_ipv4_tcp,
-			ICE_SW_INSET_MAC_PPPOE_IPV4_TCP, ICE_INSET_NONE},
-	{pattern_eth_pppoes_ipv4_udp,
-			ICE_SW_INSET_MAC_PPPOE_IPV4_UDP, ICE_INSET_NONE},
-	{pattern_eth_pppoes_ipv6,
-			ICE_SW_INSET_MAC_PPPOE_IPV6, ICE_INSET_NONE},
-	{pattern_eth_pppoes_ipv6_tcp,
-			ICE_SW_INSET_MAC_PPPOE_IPV6_TCP, ICE_INSET_NONE},
-	{pattern_eth_pppoes_ipv6_udp,
-			ICE_SW_INSET_MAC_PPPOE_IPV6_UDP, ICE_INSET_NONE},
-	{pattern_eth_vlan_pppoes_ipv4,
-			ICE_SW_INSET_MAC_PPPOE_IPV4, ICE_INSET_NONE},
-	{pattern_eth_vlan_pppoes_ipv4_tcp,
-			ICE_SW_INSET_MAC_PPPOE_IPV4_TCP, ICE_INSET_NONE},
-	{pattern_eth_vlan_pppoes_ipv4_udp,
-			ICE_SW_INSET_MAC_PPPOE_IPV4_UDP, ICE_INSET_NONE},
-	{pattern_eth_vlan_pppoes_ipv6,
-			ICE_SW_INSET_MAC_PPPOE_IPV6, ICE_INSET_NONE},
-	{pattern_eth_vlan_pppoes_ipv6_tcp,
-			ICE_SW_INSET_MAC_PPPOE_IPV6_TCP, ICE_INSET_NONE},
-	{pattern_eth_vlan_pppoes_ipv6_udp,
-			ICE_SW_INSET_MAC_PPPOE_IPV6_UDP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_esp,
-			ICE_SW_INSET_MAC_IPV4_ESP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_esp,
-			ICE_SW_INSET_MAC_IPV4_ESP, ICE_INSET_NONE},
-	{pattern_eth_ipv6_esp,
-			ICE_SW_INSET_MAC_IPV6_ESP, ICE_INSET_NONE},
-	{pattern_eth_ipv6_udp_esp,
-			ICE_SW_INSET_MAC_IPV6_ESP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_ah,
-			ICE_SW_INSET_MAC_IPV4_AH, ICE_INSET_NONE},
-	{pattern_eth_ipv6_ah,
-			ICE_SW_INSET_MAC_IPV6_AH, ICE_INSET_NONE},
-	{pattern_eth_ipv6_udp_ah,
-			ICE_INSET_NONE, ICE_INSET_NONE},
-	{pattern_eth_ipv4_l2tp,
-			ICE_SW_INSET_MAC_IPV4_L2TP, ICE_INSET_NONE},
-	{pattern_eth_ipv6_l2tp,
-			ICE_SW_INSET_MAC_IPV6_L2TP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_pfcp,
-			ICE_INSET_NONE, ICE_INSET_NONE},
-	{pattern_eth_ipv6_pfcp,
-			ICE_INSET_NONE, ICE_INSET_NONE},
-	{pattern_eth_qinq_ipv4,
-			ICE_SW_INSET_MAC_QINQ_IPV4, ICE_INSET_NONE},
-	{pattern_eth_qinq_ipv6,
-			ICE_SW_INSET_MAC_QINQ_IPV6, ICE_INSET_NONE},
-	{pattern_eth_qinq_pppoes,
-			ICE_SW_INSET_MAC_PPPOE, ICE_INSET_NONE},
-	{pattern_eth_qinq_pppoes_proto,
-			ICE_SW_INSET_MAC_PPPOE_PROTO, ICE_INSET_NONE},
-	{pattern_eth_qinq_pppoes_ipv4,
-			ICE_SW_INSET_MAC_PPPOE_IPV4, ICE_INSET_NONE},
-	{pattern_eth_qinq_pppoes_ipv6,
-			ICE_SW_INSET_MAC_PPPOE_IPV6, ICE_INSET_NONE},
+	{pattern_ethertype,				ICE_INSET_NONE,		ICE_SW_INSET_ETHER,			ICE_INSET_NONE},
+	{pattern_ethertype_vlan,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_VLAN,			ICE_INSET_NONE},
+	{pattern_ethertype_qinq,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_QINQ,			ICE_INSET_NONE},
+	{pattern_eth_arp,				ICE_INSET_NONE,		ICE_INSET_NONE,				ICE_INSET_NONE},
+	{pattern_eth_ipv4,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV4,			ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV4_UDP,		ICE_INSET_NONE},
+	{pattern_eth_ipv4_tcp,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV4_TCP,		ICE_INSET_NONE},
+	{pattern_eth_ipv6,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV6,			ICE_INSET_NONE},
+	{pattern_eth_ipv6_udp,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV6_UDP,		ICE_INSET_NONE},
+	{pattern_eth_ipv6_tcp,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV6_TCP,		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_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE,			ICE_INSET_NONE},
+	{pattern_eth_vlan_pppoes,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE,			ICE_INSET_NONE},
+	{pattern_eth_pppoes_proto,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_PROTO,		ICE_INSET_NONE},
+	{pattern_eth_vlan_pppoes_proto,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_PROTO,		ICE_INSET_NONE},
+	{pattern_eth_pppoes_ipv4,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_IPV4,		ICE_INSET_NONE},
+	{pattern_eth_pppoes_ipv4_tcp,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_IPV4_TCP,	ICE_INSET_NONE},
+	{pattern_eth_pppoes_ipv4_udp,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_IPV4_UDP,	ICE_INSET_NONE},
+	{pattern_eth_pppoes_ipv6,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_IPV6,		ICE_INSET_NONE},
+	{pattern_eth_pppoes_ipv6_tcp,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_IPV6_TCP,	ICE_INSET_NONE},
+	{pattern_eth_pppoes_ipv6_udp,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_IPV6_UDP,	ICE_INSET_NONE},
+	{pattern_eth_vlan_pppoes_ipv4,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_IPV4,		ICE_INSET_NONE},
+	{pattern_eth_vlan_pppoes_ipv4_tcp,		ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_IPV4_TCP,	ICE_INSET_NONE},
+	{pattern_eth_vlan_pppoes_ipv4_udp,		ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_IPV4_UDP,	ICE_INSET_NONE},
+	{pattern_eth_vlan_pppoes_ipv6,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_IPV6,		ICE_INSET_NONE},
+	{pattern_eth_vlan_pppoes_ipv6_tcp,		ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_IPV6_TCP,	ICE_INSET_NONE},
+	{pattern_eth_vlan_pppoes_ipv6_udp,		ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_IPV6_UDP,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_esp,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV4_ESP,		ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_esp,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV4_ESP,		ICE_INSET_NONE},
+	{pattern_eth_ipv6_esp,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV6_ESP,		ICE_INSET_NONE},
+	{pattern_eth_ipv6_udp_esp,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV6_ESP,		ICE_INSET_NONE},
+	{pattern_eth_ipv4_ah,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV4_AH,		ICE_INSET_NONE},
+	{pattern_eth_ipv6_ah,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV6_AH,		ICE_INSET_NONE},
+	{pattern_eth_ipv6_udp_ah,			ICE_INSET_NONE,		ICE_INSET_NONE,				ICE_INSET_NONE},
+	{pattern_eth_ipv4_l2tp,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV4_L2TP,		ICE_INSET_NONE},
+	{pattern_eth_ipv6_l2tp,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_IPV6_L2TP,		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_INSET_NONE,		ICE_SW_INSET_MAC_QINQ_IPV4,		ICE_INSET_NONE},
+	{pattern_eth_qinq_ipv6,				ICE_INSET_NONE,		ICE_SW_INSET_MAC_QINQ_IPV6,		ICE_INSET_NONE},
+	{pattern_eth_qinq_pppoes,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE,			ICE_INSET_NONE},
+	{pattern_eth_qinq_pppoes_proto,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_PROTO,		ICE_INSET_NONE},
+	{pattern_eth_qinq_pppoes_ipv4,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_IPV4,		ICE_INSET_NONE},
+	{pattern_eth_qinq_pppoes_ipv6,			ICE_INSET_NONE,		ICE_SW_INSET_MAC_PPPOE_IPV6,		ICE_INSET_NONE},
 };
 
 static int
-- 
2.25.1


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

* [dpdk-dev] [PATCH v3 0/6] Refactor FDIR pattern parser
  2021-01-27  5:29 ` [dpdk-dev] [PATCH v2 0/3] Refactor FDIR pattern parser Zhirun Yan
                     ` (2 preceding siblings ...)
  2021-01-27  5:29   ` [dpdk-dev] [PATCH v2 3/3] net/ice: add outer input set mask to distinguish outer fields Zhirun Yan
@ 2021-03-02  2:54   ` Zhirun Yan
  2021-03-02  2:54     ` [dpdk-dev] [PATCH v3 1/6] net/ice: clean input set macro definition Zhirun Yan
                       ` (6 more replies)
  3 siblings, 7 replies; 24+ messages in thread
From: Zhirun Yan @ 2021-03-02  2:54 UTC (permalink / raw)
  To: dev, qi.z.zhang, yahui.cao, xiao.w.wang, junfeng.guo
  Cc: simei.su, ting.xu, yuying.zhang, xuan.ding, Zhirun Yan

V3:
Clear the variable name of input_set_o and input_set_i.
Use input_set_o for tunnerl outer or non-tunnel fields, let
ice_pattern_match_item 3rd columns all none in ACL, RSS, switch.
Add new patch to use seg_tun[1] to record tunnel inner part.
Add new patch to clean GTPU inner flow type for PF.


V2:

Meld patch 4,5 into 3.
Update ACL input set.
Clear PPPoE GTPU input set in RSS.
Put p_v4/6 assignment earlier to reduce redundant code in FDIR.




This patch set refactor FDIR pattern parser.

Redefine input set. Ignore the redundant inner/outer info.
Align the parser action with hardware, using input_set_f for outer,
input_set_l for inner or non-tunnel fields.
Adjust indentation for easy review.
Enable VXLAN inner/outer fields.

Zhirun Yan (6):
  net/ice: clean input set macro definition
  net/ice: refactor structure field
  net/ice: refactor flow pattern parser
  net/ice: refactor input set conf
  net/ice: add outer input set mask to distinguish outer fields
  net/ice: clean GTPU flow_type for FDIR

 drivers/net/ice/ice_acl_filter.c    |  10 +-
 drivers/net/ice/ice_ethdev.h        |   4 +-
 drivers/net/ice/ice_fdir_filter.c   | 590 ++++++++++++++--------------
 drivers/net/ice/ice_generic_flow.c  |   6 +-
 drivers/net/ice/ice_generic_flow.h  | 237 +++++------
 drivers/net/ice/ice_hash.c          | 214 +++++-----
 drivers/net/ice/ice_switch_filter.c | 296 +++++---------
 7 files changed, 605 insertions(+), 752 deletions(-)

-- 
2.25.1


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

* [dpdk-dev] [PATCH v3 1/6] net/ice: clean input set macro definition
  2021-03-02  2:54   ` [dpdk-dev] [PATCH v3 0/6] Refactor FDIR pattern parser Zhirun Yan
@ 2021-03-02  2:54     ` Zhirun Yan
  2021-03-02  2:54     ` [dpdk-dev] [PATCH v3 2/6] net/ice: refactor structure field Zhirun Yan
                       ` (5 subsequent siblings)
  6 siblings, 0 replies; 24+ messages in thread
From: Zhirun Yan @ 2021-03-02  2:54 UTC (permalink / raw)
  To: dev, qi.z.zhang, yahui.cao, xiao.w.wang, junfeng.guo
  Cc: simei.su, ting.xu, yuying.zhang, xuan.ding, Zhirun Yan

Currently, the macro of input set use 2 bits, one bit for protocol and
inner/outer, another bit for src/dst field. But this could not distinguish
a rule with inner and outer fields for tunnel packet.
Redefine input set macro to make it clear. Only use these two bits for
protocol and field. Ignore the redundant inner/outer info.

ICE_INSET_TUN_* is used by switch module, should be removed after
switch refactor.

Signed-off-by: Zhirun Yan <zhirun.yan@intel.com>
---
 drivers/net/ice/ice_fdir_filter.c  |   8 +-
 drivers/net/ice/ice_generic_flow.h | 234 ++++++++++++-----------------
 2 files changed, 104 insertions(+), 138 deletions(-)

diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c
index ce6aa09d3d..4e99df1272 100644
--- a/drivers/net/ice/ice_fdir_filter.c
+++ b/drivers/net/ice/ice_fdir_filter.c
@@ -56,19 +56,19 @@
 	ICE_INSET_SCTP_SRC_PORT | ICE_INSET_SCTP_DST_PORT)
 
 #define ICE_FDIR_INSET_VXLAN_IPV4 (\
-	ICE_INSET_TUN_IPV4_SRC | ICE_INSET_TUN_IPV4_DST)
+	ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST)
 
 #define ICE_FDIR_INSET_VXLAN_IPV4_TCP (\
 	ICE_FDIR_INSET_VXLAN_IPV4 | \
-	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT)
+	ICE_INSET_TCP_SRC_PORT | ICE_INSET_TCP_DST_PORT)
 
 #define ICE_FDIR_INSET_VXLAN_IPV4_UDP (\
 	ICE_FDIR_INSET_VXLAN_IPV4 | \
-	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT)
+	ICE_INSET_UDP_SRC_PORT | ICE_INSET_UDP_DST_PORT)
 
 #define ICE_FDIR_INSET_VXLAN_IPV4_SCTP (\
 	ICE_FDIR_INSET_VXLAN_IPV4 | \
-	ICE_INSET_TUN_SCTP_SRC_PORT | ICE_INSET_TUN_SCTP_DST_PORT)
+	ICE_INSET_SCTP_SRC_PORT | ICE_INSET_SCTP_DST_PORT)
 
 #define ICE_FDIR_INSET_IPV4_GTPU (\
 	ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST | ICE_INSET_GTPU_TEID)
diff --git a/drivers/net/ice/ice_generic_flow.h b/drivers/net/ice/ice_generic_flow.h
index 18918769d2..3c648c0f4f 100644
--- a/drivers/net/ice/ice_generic_flow.h
+++ b/drivers/net/ice/ice_generic_flow.h
@@ -9,177 +9,143 @@
 
 /* protocol */
 
-#define ICE_PROT_MAC_INNER         (1ULL << 1)
-#define ICE_PROT_MAC_OUTER         (1ULL << 2)
-#define ICE_PROT_VLAN_INNER        (1ULL << 3)
-#define ICE_PROT_VLAN_OUTER        (1ULL << 4)
-#define ICE_PROT_IPV4_INNER        (1ULL << 5)
-#define ICE_PROT_IPV4_OUTER        (1ULL << 6)
-#define ICE_PROT_IPV6_INNER        (1ULL << 7)
-#define ICE_PROT_IPV6_OUTER        (1ULL << 8)
-#define ICE_PROT_TCP_INNER         (1ULL << 9)
-#define ICE_PROT_TCP_OUTER         (1ULL << 10)
-#define ICE_PROT_UDP_INNER         (1ULL << 11)
-#define ICE_PROT_UDP_OUTER         (1ULL << 12)
-#define ICE_PROT_SCTP_INNER        (1ULL << 13)
-#define ICE_PROT_SCTP_OUTER        (1ULL << 14)
-#define ICE_PROT_ICMP4_INNER       (1ULL << 15)
-#define ICE_PROT_ICMP4_OUTER       (1ULL << 16)
-#define ICE_PROT_ICMP6_INNER       (1ULL << 17)
-#define ICE_PROT_ICMP6_OUTER       (1ULL << 18)
-#define ICE_PROT_VXLAN             (1ULL << 19)
-#define ICE_PROT_NVGRE             (1ULL << 20)
-#define ICE_PROT_GTPU              (1ULL << 21)
-#define ICE_PROT_PPPOE_S           (1ULL << 22)
-#define ICE_PROT_ESP               (1ULL << 23)
-#define ICE_PROT_AH                (1ULL << 24)
-#define ICE_PROT_L2TPV3OIP         (1ULL << 25)
-#define ICE_PROT_PFCP              (1ULL << 26)
+#define ICE_PROT_MAC			BIT_ULL(1)
+#define ICE_PROT_VLAN			BIT_ULL(2)
+#define ICE_PROT_IPV4			BIT_ULL(3)
+#define ICE_PROT_IPV6			BIT_ULL(4)
+#define ICE_PROT_TCP			BIT_ULL(5)
+#define ICE_PROT_UDP			BIT_ULL(6)
+#define ICE_PROT_SCTP			BIT_ULL(7)
+#define ICE_PROT_ICMP4			BIT_ULL(8)
+#define ICE_PROT_ICMP6			BIT_ULL(9)
+#define ICE_PROT_VXLAN			BIT_ULL(10)
+#define ICE_PROT_NVGRE			BIT_ULL(11)
+#define ICE_PROT_GTPU			BIT_ULL(12)
+#define ICE_PROT_PPPOE_S		BIT_ULL(13)
+#define ICE_PROT_ESP			BIT_ULL(14)
+#define ICE_PROT_AH			BIT_ULL(15)
+#define ICE_PROT_L2TPV3OIP		BIT_ULL(16)
+#define ICE_PROT_PFCP			BIT_ULL(17)
 
 /* field */
 
-#define ICE_SMAC                   (1ULL << 63)
-#define ICE_DMAC                   (1ULL << 62)
-#define ICE_ETHERTYPE              (1ULL << 61)
-#define ICE_IP_SRC                 (1ULL << 60)
-#define ICE_IP_DST                 (1ULL << 59)
-#define ICE_IP_PROTO               (1ULL << 58)
-#define ICE_IP_TTL                 (1ULL << 57)
-#define ICE_IP_TOS                 (1ULL << 56)
-#define ICE_SPORT                  (1ULL << 55)
-#define ICE_DPORT                  (1ULL << 54)
-#define ICE_ICMP_TYPE              (1ULL << 53)
-#define ICE_ICMP_CODE              (1ULL << 52)
-#define ICE_VXLAN_VNI              (1ULL << 51)
-#define ICE_NVGRE_TNI              (1ULL << 50)
-#define ICE_GTPU_TEID              (1ULL << 49)
-#define ICE_GTPU_QFI               (1ULL << 48)
-#define ICE_PPPOE_SESSION          (1ULL << 47)
-#define ICE_PPPOE_PROTO            (1ULL << 46)
-#define ICE_ESP_SPI                (1ULL << 45)
-#define ICE_AH_SPI                 (1ULL << 44)
-#define ICE_L2TPV3OIP_SESSION_ID   (1ULL << 43)
-#define ICE_PFCP_SEID              (1ULL << 42)
-#define ICE_PFCP_S_FIELD           (1ULL << 41)
+#define ICE_SMAC			BIT_ULL(63)
+#define ICE_DMAC			BIT_ULL(62)
+#define ICE_ETHERTYPE			BIT_ULL(61)
+#define ICE_IP_SRC			BIT_ULL(60)
+#define ICE_IP_DST			BIT_ULL(59)
+#define ICE_IP_PROTO			BIT_ULL(58)
+#define ICE_IP_TTL			BIT_ULL(57)
+#define ICE_IP_TOS			BIT_ULL(56)
+#define ICE_SPORT			BIT_ULL(55)
+#define ICE_DPORT			BIT_ULL(54)
+#define ICE_ICMP_TYPE			BIT_ULL(53)
+#define ICE_ICMP_CODE			BIT_ULL(52)
+#define ICE_VXLAN_VNI			BIT_ULL(51)
+#define ICE_NVGRE_TNI			BIT_ULL(50)
+#define ICE_GTPU_TEID			BIT_ULL(49)
+#define ICE_GTPU_QFI			BIT_ULL(48)
+#define ICE_PPPOE_SESSION		BIT_ULL(47)
+#define ICE_PPPOE_PROTO			BIT_ULL(46)
+#define ICE_ESP_SPI			BIT_ULL(45)
+#define ICE_AH_SPI			BIT_ULL(44)
+#define ICE_L2TPV3OIP_SESSION_ID	BIT_ULL(43)
+#define ICE_PFCP_SEID			BIT_ULL(42)
+#define ICE_PFCP_S_FIELD		BIT_ULL(41)
 
 /* input set */
 
-#define ICE_INSET_NONE             0ULL
-
-/* non-tunnel */
-
-#define ICE_INSET_SMAC         (ICE_PROT_MAC_OUTER | ICE_SMAC)
-#define ICE_INSET_DMAC         (ICE_PROT_MAC_OUTER | ICE_DMAC)
-#define ICE_INSET_VLAN_INNER   (ICE_PROT_VLAN_INNER)
-#define ICE_INSET_VLAN_OUTER   (ICE_PROT_VLAN_OUTER)
-#define ICE_INSET_ETHERTYPE    (ICE_ETHERTYPE)
-
-#define ICE_INSET_IPV4_SRC \
-	(ICE_PROT_IPV4_OUTER | ICE_IP_SRC)
-#define ICE_INSET_IPV4_DST \
-	(ICE_PROT_IPV4_OUTER | ICE_IP_DST)
-#define ICE_INSET_IPV4_TOS \
-	(ICE_PROT_IPV4_OUTER | ICE_IP_TOS)
-#define ICE_INSET_IPV4_PROTO \
-	(ICE_PROT_IPV4_OUTER | ICE_IP_PROTO)
-#define ICE_INSET_IPV4_TTL \
-	(ICE_PROT_IPV4_OUTER | ICE_IP_TTL)
-#define ICE_INSET_IPV6_SRC \
-	(ICE_PROT_IPV6_OUTER | ICE_IP_SRC)
-#define ICE_INSET_IPV6_DST \
-	(ICE_PROT_IPV6_OUTER | ICE_IP_DST)
-#define ICE_INSET_IPV6_NEXT_HDR \
-	(ICE_PROT_IPV6_OUTER | ICE_IP_PROTO)
-#define ICE_INSET_IPV6_HOP_LIMIT \
-	(ICE_PROT_IPV6_OUTER | ICE_IP_TTL)
-#define ICE_INSET_IPV6_TC \
-	(ICE_PROT_IPV6_OUTER | ICE_IP_TOS)
-
-#define ICE_INSET_TCP_SRC_PORT \
-	(ICE_PROT_TCP_OUTER | ICE_SPORT)
-#define ICE_INSET_TCP_DST_PORT \
-	(ICE_PROT_TCP_OUTER | ICE_DPORT)
-#define ICE_INSET_UDP_SRC_PORT \
-	(ICE_PROT_UDP_OUTER | ICE_SPORT)
-#define ICE_INSET_UDP_DST_PORT \
-	(ICE_PROT_UDP_OUTER | ICE_DPORT)
-#define ICE_INSET_SCTP_SRC_PORT \
-	(ICE_PROT_SCTP_OUTER | ICE_SPORT)
-#define ICE_INSET_SCTP_DST_PORT \
-	(ICE_PROT_SCTP_OUTER | ICE_DPORT)
-#define ICE_INSET_ICMP4_SRC_PORT \
-	(ICE_PROT_ICMP4_OUTER | ICE_SPORT)
-#define ICE_INSET_ICMP4_DST_PORT \
-	(ICE_PROT_ICMP4_OUTER | ICE_DPORT)
-#define ICE_INSET_ICMP6_SRC_PORT \
-	(ICE_PROT_ICMP6_OUTER | ICE_SPORT)
-#define ICE_INSET_ICMP6_DST_PORT \
-	(ICE_PROT_ICMP6_OUTER | ICE_DPORT)
-#define ICE_INSET_ICMP4_TYPE \
-	(ICE_PROT_ICMP4_OUTER | ICE_ICMP_TYPE)
-#define ICE_INSET_ICMP4_CODE \
-	(ICE_PROT_ICMP4_OUTER | ICE_ICMP_CODE)
-#define ICE_INSET_ICMP6_TYPE \
-	(ICE_PROT_ICMP6_OUTER | ICE_ICMP_TYPE)
-#define ICE_INSET_ICMP6_CODE \
-	(ICE_PROT_ICMP6_OUTER | ICE_ICMP_CODE)
+#define ICE_INSET_NONE			0ULL
+
+#define ICE_INSET_SMAC			(ICE_SMAC)
+#define ICE_INSET_DMAC			(ICE_DMAC)
+#define ICE_INSET_VLAN			(ICE_PROT_VLAN)
+#define ICE_INSET_VLAN_INNER		(ICE_PROT_VLAN)
+#define ICE_INSET_VLAN_OUTER		(ICE_PROT_VLAN)
+#define ICE_INSET_ETHERTYPE		(ICE_ETHERTYPE)
+
+#define ICE_INSET_IPV4_SRC		(ICE_PROT_IPV4 | ICE_IP_SRC)
+#define ICE_INSET_IPV4_DST		(ICE_PROT_IPV4 | ICE_IP_DST)
+#define ICE_INSET_IPV4_TOS		(ICE_PROT_IPV4 | ICE_IP_TOS)
+#define ICE_INSET_IPV4_PROTO		(ICE_PROT_IPV4 | ICE_IP_PROTO)
+#define ICE_INSET_IPV4_TTL		(ICE_PROT_IPV4 | ICE_IP_TTL)
+#define ICE_INSET_IPV6_SRC		(ICE_PROT_IPV6 | ICE_IP_SRC)
+#define ICE_INSET_IPV6_DST		(ICE_PROT_IPV6 | ICE_IP_DST)
+#define ICE_INSET_IPV6_NEXT_HDR		(ICE_PROT_IPV6 | ICE_IP_PROTO)
+#define ICE_INSET_IPV6_HOP_LIMIT	(ICE_PROT_IPV6 | ICE_IP_TTL)
+#define ICE_INSET_IPV6_TC		(ICE_PROT_IPV6 | ICE_IP_TOS)
+
+#define ICE_INSET_TCP_SRC_PORT		(ICE_PROT_TCP | ICE_SPORT)
+#define ICE_INSET_TCP_DST_PORT		(ICE_PROT_TCP | ICE_DPORT)
+#define ICE_INSET_UDP_SRC_PORT		(ICE_PROT_UDP | ICE_SPORT)
+#define ICE_INSET_UDP_DST_PORT		(ICE_PROT_UDP | ICE_DPORT)
+#define ICE_INSET_SCTP_SRC_PORT		(ICE_PROT_SCTP | ICE_SPORT)
+#define ICE_INSET_SCTP_DST_PORT		(ICE_PROT_SCTP | ICE_DPORT)
+#define ICE_INSET_ICMP4_SRC_PORT	(ICE_PROT_ICMP4 | ICE_SPORT)
+#define ICE_INSET_ICMP4_DST_PORT	(ICE_PROT_ICMP4 | ICE_DPORT)
+#define ICE_INSET_ICMP6_SRC_PORT	(ICE_PROT_ICMP6 | ICE_SPORT)
+#define ICE_INSET_ICMP6_DST_PORT	(ICE_PROT_ICMP6 | ICE_DPORT)
+#define ICE_INSET_ICMP4_TYPE		(ICE_PROT_ICMP4 | ICE_ICMP_TYPE)
+#define ICE_INSET_ICMP4_CODE		(ICE_PROT_ICMP4 | ICE_ICMP_CODE)
+#define ICE_INSET_ICMP6_TYPE		(ICE_PROT_ICMP6 | ICE_ICMP_TYPE)
+#define ICE_INSET_ICMP6_CODE		(ICE_PROT_ICMP6 | ICE_ICMP_CODE)
 
 /* tunnel */
 
 #define ICE_INSET_TUN_SMAC \
-	(ICE_PROT_MAC_INNER | ICE_SMAC)
+	(ICE_PROT_MAC | ICE_SMAC)
 #define ICE_INSET_TUN_DMAC \
-	(ICE_PROT_MAC_INNER | ICE_DMAC)
+	(ICE_PROT_MAC | ICE_DMAC)
 
 #define ICE_INSET_TUN_IPV4_SRC \
-	(ICE_PROT_IPV4_INNER | ICE_IP_SRC)
+	(ICE_PROT_IPV4 | ICE_IP_SRC)
 #define ICE_INSET_TUN_IPV4_DST \
-	(ICE_PROT_IPV4_INNER | ICE_IP_DST)
+	(ICE_PROT_IPV4 | ICE_IP_DST)
 #define ICE_INSET_TUN_IPV4_TTL \
-	(ICE_PROT_IPV4_INNER | ICE_IP_TTL)
+	(ICE_PROT_IPV4 | ICE_IP_TTL)
 #define ICE_INSET_TUN_IPV4_PROTO \
-	(ICE_PROT_IPV4_INNER | ICE_IP_PROTO)
+	(ICE_PROT_IPV4 | ICE_IP_PROTO)
 #define ICE_INSET_TUN_IPV4_TOS \
-	(ICE_PROT_IPV4_INNER | ICE_IP_TOS)
+	(ICE_PROT_IPV4 | ICE_IP_TOS)
 #define ICE_INSET_TUN_IPV6_SRC \
-	(ICE_PROT_IPV6_INNER | ICE_IP_SRC)
+	(ICE_PROT_IPV6 | ICE_IP_SRC)
 #define ICE_INSET_TUN_IPV6_DST \
-	(ICE_PROT_IPV6_INNER | ICE_IP_DST)
+	(ICE_PROT_IPV6 | ICE_IP_DST)
 #define ICE_INSET_TUN_IPV6_HOP_LIMIT \
-	(ICE_PROT_IPV6_INNER | ICE_IP_TTL)
+	(ICE_PROT_IPV6 | ICE_IP_TTL)
 #define ICE_INSET_TUN_IPV6_NEXT_HDR \
-	(ICE_PROT_IPV6_INNER | ICE_IP_PROTO)
+	(ICE_PROT_IPV6 | ICE_IP_PROTO)
 #define ICE_INSET_TUN_IPV6_TC \
-	(ICE_PROT_IPV6_INNER | ICE_IP_TOS)
+	(ICE_PROT_IPV6 | ICE_IP_TOS)
 
 #define ICE_INSET_TUN_TCP_SRC_PORT \
-	(ICE_PROT_TCP_INNER | ICE_SPORT)
+	(ICE_PROT_TCP | ICE_SPORT)
 #define ICE_INSET_TUN_TCP_DST_PORT \
-	(ICE_PROT_TCP_INNER | ICE_DPORT)
+	(ICE_PROT_TCP | ICE_DPORT)
 #define ICE_INSET_TUN_UDP_SRC_PORT \
-	(ICE_PROT_UDP_INNER | ICE_SPORT)
+	(ICE_PROT_UDP | ICE_SPORT)
 #define ICE_INSET_TUN_UDP_DST_PORT \
-	(ICE_PROT_UDP_INNER | ICE_DPORT)
+	(ICE_PROT_UDP | ICE_DPORT)
 #define ICE_INSET_TUN_SCTP_SRC_PORT \
-	(ICE_PROT_SCTP_INNER | ICE_SPORT)
+	(ICE_PROT_SCTP | ICE_SPORT)
 #define ICE_INSET_TUN_SCTP_DST_PORT \
-	(ICE_PROT_SCTP_INNER | ICE_DPORT)
+	(ICE_PROT_SCTP | ICE_DPORT)
 #define ICE_INSET_TUN_ICMP4_SRC_PORT \
-	(ICE_PROT_ICMP4_INNER | ICE_SPORT)
+	(ICE_PROT_ICMP4 | ICE_SPORT)
 #define ICE_INSET_TUN_ICMP4_DST_PORT \
-	(ICE_PROT_ICMP4_INNER | ICE_DPORT)
+	(ICE_PROT_ICMP4 | ICE_DPORT)
 #define ICE_INSET_TUN_ICMP6_SRC_PORT \
-	(ICE_PROT_ICMP6_INNER | ICE_SPORT)
+	(ICE_PROT_ICMP6 | ICE_SPORT)
 #define ICE_INSET_TUN_ICMP6_DST_PORT \
-	(ICE_PROT_ICMP6_INNER | ICE_DPORT)
+	(ICE_PROT_ICMP6 | ICE_DPORT)
 #define ICE_INSET_TUN_ICMP4_TYPE \
-	(ICE_PROT_ICMP4_INNER | ICE_ICMP_TYPE)
+	(ICE_PROT_ICMP4 | ICE_ICMP_TYPE)
 #define ICE_INSET_TUN_ICMP4_CODE \
-	(ICE_PROT_ICMP4_INNER | ICE_ICMP_CODE)
+	(ICE_PROT_ICMP4 | ICE_ICMP_CODE)
 #define ICE_INSET_TUN_ICMP6_TYPE \
-	(ICE_PROT_ICMP6_INNER | ICE_ICMP_TYPE)
+	(ICE_PROT_ICMP6 | ICE_ICMP_TYPE)
 #define ICE_INSET_TUN_ICMP6_CODE \
-	(ICE_PROT_ICMP6_INNER | ICE_ICMP_CODE)
+	(ICE_PROT_ICMP6 | ICE_ICMP_CODE)
 
 #define ICE_INSET_TUN_VXLAN_VNI \
 	(ICE_PROT_VXLAN | ICE_VXLAN_VNI)
-- 
2.25.1


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

* [dpdk-dev] [PATCH v3 2/6] net/ice: refactor structure field
  2021-03-02  2:54   ` [dpdk-dev] [PATCH v3 0/6] Refactor FDIR pattern parser Zhirun Yan
  2021-03-02  2:54     ` [dpdk-dev] [PATCH v3 1/6] net/ice: clean input set macro definition Zhirun Yan
@ 2021-03-02  2:54     ` Zhirun Yan
  2021-03-02  2:54     ` [dpdk-dev] [PATCH v3 3/6] net/ice: refactor flow pattern parser Zhirun Yan
                       ` (4 subsequent siblings)
  6 siblings, 0 replies; 24+ messages in thread
From: Zhirun Yan @ 2021-03-02  2:54 UTC (permalink / raw)
  To: dev, qi.z.zhang, yahui.cao, xiao.w.wang, junfeng.guo
  Cc: simei.su, ting.xu, yuying.zhang, xuan.ding, Zhirun Yan

This patch use input_set_o and input_set_i to distinguish inner/outer
input set. input_set_i is only used for inner field.

Signed-off-by: Zhirun Yan <zhirun.yan@intel.com>
---
 drivers/net/ice/ice_ethdev.h      | 4 ++--
 drivers/net/ice/ice_fdir_filter.c | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h
index 7a7a5d5bfb..2a8a8169d5 100644
--- a/drivers/net/ice/ice_ethdev.h
+++ b/drivers/net/ice/ice_ethdev.h
@@ -301,8 +301,8 @@ struct ice_fdir_filter_conf {
 	struct ice_fdir_counter *counter; /* flow specific counter context */
 	struct rte_flow_action_count act_count;
 
-	uint64_t input_set;
-	uint64_t outer_input_set; /* only for tunnel packets outer fields */
+	uint64_t input_set_o; /* used for non-tunnel or tunnel outer fields */
+	uint64_t input_set_i; /* only for tunnel inner fields */
 	uint32_t mark_flag;
 };
 
diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c
index 4e99df1272..570ec56058 100644
--- a/drivers/net/ice/ice_fdir_filter.c
+++ b/drivers/net/ice/ice_fdir_filter.c
@@ -1249,7 +1249,7 @@ ice_fdir_create_filter(struct ice_adapter *ad,
 	is_tun = ice_fdir_is_tunnel_profile(filter->tunnel_type);
 
 	ret = ice_fdir_input_set_conf(pf, filter->input.flow_type,
-				      filter->input_set, filter->outer_input_set,
+				      filter->input_set_i, filter->input_set_o,
 				      filter->tunnel_type);
 	if (ret) {
 		rte_flow_error_set(error, -ret,
@@ -1982,7 +1982,7 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
 
 	filter->tunnel_type = tunnel_type;
 	filter->input.flow_type = flow_type;
-	filter->input_set = input_set;
+	filter->input_set_o = input_set;
 
 	return 0;
 }
@@ -2011,7 +2011,7 @@ ice_fdir_parse(struct ice_adapter *ad,
 	ret = ice_fdir_parse_pattern(ad, pattern, error, filter);
 	if (ret)
 		goto error;
-	input_set = filter->input_set | filter->outer_input_set;
+	input_set = filter->input_set_o | filter->input_set_i;
 	if (!input_set || input_set & ~item->input_set_mask) {
 		rte_flow_error_set(error, EINVAL,
 				   RTE_FLOW_ERROR_TYPE_ITEM_SPEC,
-- 
2.25.1


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

* [dpdk-dev] [PATCH v3 3/6] net/ice: refactor flow pattern parser
  2021-03-02  2:54   ` [dpdk-dev] [PATCH v3 0/6] Refactor FDIR pattern parser Zhirun Yan
  2021-03-02  2:54     ` [dpdk-dev] [PATCH v3 1/6] net/ice: clean input set macro definition Zhirun Yan
  2021-03-02  2:54     ` [dpdk-dev] [PATCH v3 2/6] net/ice: refactor structure field Zhirun Yan
@ 2021-03-02  2:54     ` Zhirun Yan
  2021-03-02  2:54     ` [dpdk-dev] [PATCH v3 4/6] net/ice: refactor input set conf Zhirun Yan
                       ` (3 subsequent siblings)
  6 siblings, 0 replies; 24+ messages in thread
From: Zhirun Yan @ 2021-03-02  2:54 UTC (permalink / raw)
  To: dev, qi.z.zhang, yahui.cao, xiao.w.wang, junfeng.guo
  Cc: simei.su, ting.xu, yuying.zhang, xuan.ding, Zhirun Yan

Distinguish inner/outer input_set. And avoid too many nested
conditionals in each type's parser. input_set_o is used for
tunnel outer fields or non-tunnel fields , input_set_i is only
used for inner fields.

For GTPU, store the outer IP fields in inner part to align with
shared code behavior.

Signed-off-by: Zhirun Yan <zhirun.yan@intel.com>
---
 drivers/net/ice/ice_fdir_filter.c | 475 +++++++++++++++---------------
 1 file changed, 236 insertions(+), 239 deletions(-)

diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c
index 570ec56058..6bee2b1167 100644
--- a/drivers/net/ice/ice_fdir_filter.c
+++ b/drivers/net/ice/ice_fdir_filter.c
@@ -1610,7 +1610,9 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
 	const struct rte_flow_item_vxlan *vxlan_spec, *vxlan_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 input_set_i = ICE_INSET_NONE; /* only for tunnel inner */
+	uint64_t input_set_o = ICE_INSET_NONE; /* non-tunnel and tunnel outer */
+	uint64_t *input_set;
 	uint8_t flow_type = ICE_FLTR_PTYPE_NONF_NONE;
 	uint8_t  ipv6_addr_mask[16] = {
 		0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
@@ -1619,289 +1621,282 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
 	uint32_t vtc_flow_cpu;
 	uint16_t ether_type;
 	enum rte_flow_item_type next_type;
+	bool is_outer = true;
+	struct ice_fdir_extra *p_ext_data;
+	struct ice_fdir_v4 *p_v4 = NULL;
+	struct ice_fdir_v6 *p_v6 = NULL;
 
+	for (item = pattern; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {
+		if (item->type == RTE_FLOW_ITEM_TYPE_VXLAN)
+			tunnel_type = ICE_FDIR_TUNNEL_TYPE_VXLAN;
+		/* To align with shared code behavior, save gtpu outer
+		 * fields in inner struct.
+		 */
+		if (item->type == RTE_FLOW_ITEM_TYPE_GTPU ||
+		    item->type == RTE_FLOW_ITEM_TYPE_GTP_PSC) {
+			is_outer = false;
+		}
+	}
+
+	/* This loop parse flow pattern and distinguish Non-tunnel and tunnel
+	 * flow. input_set_i is used for inner part.
+	 */
 	for (item = pattern; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {
 		if (item->last) {
 			rte_flow_error_set(error, EINVAL,
-					RTE_FLOW_ERROR_TYPE_ITEM,
-					item,
-					"Not support range");
+					   RTE_FLOW_ERROR_TYPE_ITEM,
+					   item,
+					   "Not support range");
 			return -rte_errno;
 		}
 		item_type = item->type;
 
+		input_set = (tunnel_type && !is_outer) ?
+			    &input_set_i : &input_set_o;
+
 		switch (item_type) {
 		case RTE_FLOW_ITEM_TYPE_ETH:
+			flow_type = ICE_FLTR_PTYPE_NON_IP_L2;
 			eth_spec = item->spec;
 			eth_mask = item->mask;
-			next_type = (item + 1)->type;
 
-			if (eth_spec && eth_mask) {
-				if (!rte_is_zero_ether_addr(&eth_mask->dst)) {
-					input_set |= ICE_INSET_DMAC;
-					rte_memcpy(&filter->input.ext_data.dst_mac,
-						   &eth_spec->dst,
-						   RTE_ETHER_ADDR_LEN);
-				}
+			if (!(eth_spec && eth_mask))
+				break;
 
-				if (!rte_is_zero_ether_addr(&eth_mask->src)) {
-					input_set |= ICE_INSET_SMAC;
-					rte_memcpy(&filter->input.ext_data.src_mac,
-						   &eth_spec->src,
-						   RTE_ETHER_ADDR_LEN);
-				}
+			if (!rte_is_zero_ether_addr(&eth_mask->dst))
+				*input_set |= ICE_INSET_DMAC;
+			if (!rte_is_zero_ether_addr(&eth_mask->src))
+				*input_set |= ICE_INSET_SMAC;
 
-				/* Ignore this field except for ICE_FLTR_PTYPE_NON_IP_L2 */
-				if (eth_mask->type == RTE_BE16(0xffff) &&
-				    next_type == RTE_FLOW_ITEM_TYPE_END) {
-					input_set |= ICE_INSET_ETHERTYPE;
-					ether_type = rte_be_to_cpu_16(eth_spec->type);
-
-					if (ether_type == RTE_ETHER_TYPE_IPV4 ||
-					    ether_type == RTE_ETHER_TYPE_IPV6) {
-						rte_flow_error_set(error, EINVAL,
-								   RTE_FLOW_ERROR_TYPE_ITEM,
-								   item,
-								   "Unsupported ether_type.");
-						return -rte_errno;
-					}
-
-					rte_memcpy(&filter->input.ext_data.ether_type,
-						   &eth_spec->type,
-						   sizeof(eth_spec->type));
-					flow_type = ICE_FLTR_PTYPE_NON_IP_L2;
+			next_type = (item + 1)->type;
+			/* Ignore this field except for ICE_FLTR_PTYPE_NON_IP_L2 */
+			if (eth_mask->type == RTE_BE16(0xffff) &&
+			    next_type == RTE_FLOW_ITEM_TYPE_END) {
+				*input_set |= ICE_INSET_ETHERTYPE;
+				ether_type = rte_be_to_cpu_16(eth_spec->type);
+
+				if (ether_type == RTE_ETHER_TYPE_IPV4 ||
+				    ether_type == RTE_ETHER_TYPE_IPV6) {
+					rte_flow_error_set(error, EINVAL,
+							   RTE_FLOW_ERROR_TYPE_ITEM,
+							   item,
+							   "Unsupported ether_type.");
+					return -rte_errno;
 				}
 			}
+
+			p_ext_data = (tunnel_type && is_outer) ?
+				     &filter->input.ext_data_outer :
+				     &filter->input.ext_data;
+			rte_memcpy(&p_ext_data->src_mac,
+				   &eth_spec->src, RTE_ETHER_ADDR_LEN);
+			rte_memcpy(&p_ext_data->dst_mac,
+				   &eth_spec->dst, RTE_ETHER_ADDR_LEN);
+			rte_memcpy(&p_ext_data->ether_type,
+				   &eth_spec->type, sizeof(eth_spec->type));
 			break;
 		case RTE_FLOW_ITEM_TYPE_IPV4:
+			flow_type = ICE_FLTR_PTYPE_NONF_IPV4_OTHER;
 			l3 = RTE_FLOW_ITEM_TYPE_IPV4;
 			ipv4_spec = item->spec;
 			ipv4_mask = item->mask;
-
-			if (ipv4_spec && ipv4_mask) {
-				/* Check IPv4 mask and update input set */
-				if (ipv4_mask->hdr.version_ihl ||
-				    ipv4_mask->hdr.total_length ||
-				    ipv4_mask->hdr.packet_id ||
-				    ipv4_mask->hdr.fragment_offset ||
-				    ipv4_mask->hdr.hdr_checksum) {
-					rte_flow_error_set(error, EINVAL,
+			p_v4 = (tunnel_type && is_outer) ?
+			       &filter->input.ip_outer.v4 :
+			       &filter->input.ip.v4;
+
+			if (!(ipv4_spec && ipv4_mask))
+				break;
+
+			/* Check IPv4 mask and update input set */
+			if (ipv4_mask->hdr.version_ihl ||
+			    ipv4_mask->hdr.total_length ||
+			    ipv4_mask->hdr.packet_id ||
+			    ipv4_mask->hdr.fragment_offset ||
+			    ipv4_mask->hdr.hdr_checksum) {
+				rte_flow_error_set(error, EINVAL,
 						   RTE_FLOW_ERROR_TYPE_ITEM,
 						   item,
 						   "Invalid IPv4 mask.");
-					return -rte_errno;
-				}
-				if (ipv4_mask->hdr.src_addr == UINT32_MAX)
-					input_set |= tunnel_type ?
-						     ICE_INSET_TUN_IPV4_SRC :
-						     ICE_INSET_IPV4_SRC;
-				if (ipv4_mask->hdr.dst_addr == UINT32_MAX)
-					input_set |= tunnel_type ?
-						     ICE_INSET_TUN_IPV4_DST :
-						     ICE_INSET_IPV4_DST;
-				if (ipv4_mask->hdr.type_of_service == UINT8_MAX)
-					input_set |= ICE_INSET_IPV4_TOS;
-				if (ipv4_mask->hdr.time_to_live == UINT8_MAX)
-					input_set |= ICE_INSET_IPV4_TTL;
-				if (ipv4_mask->hdr.next_proto_id == UINT8_MAX)
-					input_set |= ICE_INSET_IPV4_PROTO;
-
-				filter->input.ip.v4.dst_ip =
-					ipv4_spec->hdr.dst_addr;
-				filter->input.ip.v4.src_ip =
-					ipv4_spec->hdr.src_addr;
-				filter->input.ip.v4.tos =
-					ipv4_spec->hdr.type_of_service;
-				filter->input.ip.v4.ttl =
-					ipv4_spec->hdr.time_to_live;
-				filter->input.ip.v4.proto =
-					ipv4_spec->hdr.next_proto_id;
+				return -rte_errno;
 			}
 
-			flow_type = ICE_FLTR_PTYPE_NONF_IPV4_OTHER;
+			if (ipv4_mask->hdr.dst_addr == UINT32_MAX)
+				*input_set |= ICE_INSET_IPV4_DST;
+			if (ipv4_mask->hdr.src_addr == UINT32_MAX)
+				*input_set |= ICE_INSET_IPV4_SRC;
+			if (ipv4_mask->hdr.time_to_live == UINT8_MAX)
+				*input_set |= ICE_INSET_IPV4_TTL;
+			if (ipv4_mask->hdr.next_proto_id == UINT8_MAX)
+				*input_set |= ICE_INSET_IPV4_PROTO;
+			if (ipv4_mask->hdr.type_of_service == UINT8_MAX)
+				*input_set |= ICE_INSET_IPV4_TOS;
+
+			p_v4->dst_ip = ipv4_spec->hdr.dst_addr;
+			p_v4->src_ip = ipv4_spec->hdr.src_addr;
+			p_v4->ttl = ipv4_spec->hdr.time_to_live;
+			p_v4->proto = ipv4_spec->hdr.next_proto_id;
+			p_v4->tos = ipv4_spec->hdr.type_of_service;
 			break;
 		case RTE_FLOW_ITEM_TYPE_IPV6:
+			flow_type = ICE_FLTR_PTYPE_NONF_IPV6_OTHER;
 			l3 = RTE_FLOW_ITEM_TYPE_IPV6;
 			ipv6_spec = item->spec;
 			ipv6_mask = item->mask;
+			p_v6 = (tunnel_type && is_outer) ?
+			       &filter->input.ip_outer.v6 :
+			       &filter->input.ip.v6;
 
-			if (ipv6_spec && ipv6_mask) {
-				/* Check IPv6 mask and update input set */
-				if (ipv6_mask->hdr.payload_len) {
-					rte_flow_error_set(error, EINVAL,
+			if (!(ipv6_spec && ipv6_mask))
+				break;
+
+			/* Check IPv6 mask and update input set */
+			if (ipv6_mask->hdr.payload_len) {
+				rte_flow_error_set(error, EINVAL,
 						   RTE_FLOW_ERROR_TYPE_ITEM,
 						   item,
 						   "Invalid IPv6 mask");
-					return -rte_errno;
-				}
-
-				if (!memcmp(ipv6_mask->hdr.src_addr,
-					    ipv6_addr_mask,
-					    RTE_DIM(ipv6_mask->hdr.src_addr)))
-					input_set |= ICE_INSET_IPV6_SRC;
-				if (!memcmp(ipv6_mask->hdr.dst_addr,
-					    ipv6_addr_mask,
-					    RTE_DIM(ipv6_mask->hdr.dst_addr)))
-					input_set |= ICE_INSET_IPV6_DST;
-
-				if ((ipv6_mask->hdr.vtc_flow &
-				     rte_cpu_to_be_32(ICE_IPV6_TC_MASK))
-				    == rte_cpu_to_be_32(ICE_IPV6_TC_MASK))
-					input_set |= ICE_INSET_IPV6_TC;
-				if (ipv6_mask->hdr.proto == UINT8_MAX)
-					input_set |= ICE_INSET_IPV6_NEXT_HDR;
-				if (ipv6_mask->hdr.hop_limits == UINT8_MAX)
-					input_set |= ICE_INSET_IPV6_HOP_LIMIT;
-
-				rte_memcpy(filter->input.ip.v6.dst_ip,
-					   ipv6_spec->hdr.dst_addr, 16);
-				rte_memcpy(filter->input.ip.v6.src_ip,
-					   ipv6_spec->hdr.src_addr, 16);
-
-				vtc_flow_cpu =
-				      rte_be_to_cpu_32(ipv6_spec->hdr.vtc_flow);
-				filter->input.ip.v6.tc =
-					(uint8_t)(vtc_flow_cpu >>
-						  ICE_FDIR_IPV6_TC_OFFSET);
-				filter->input.ip.v6.proto =
-					ipv6_spec->hdr.proto;
-				filter->input.ip.v6.hlim =
-					ipv6_spec->hdr.hop_limits;
+				return -rte_errno;
 			}
 
-			flow_type = ICE_FLTR_PTYPE_NONF_IPV6_OTHER;
+			if (!memcmp(ipv6_mask->hdr.src_addr, ipv6_addr_mask,
+				    RTE_DIM(ipv6_mask->hdr.src_addr)))
+				*input_set |= ICE_INSET_IPV6_SRC;
+			if (!memcmp(ipv6_mask->hdr.dst_addr, ipv6_addr_mask,
+				    RTE_DIM(ipv6_mask->hdr.dst_addr)))
+				*input_set |= ICE_INSET_IPV6_DST;
+
+			if ((ipv6_mask->hdr.vtc_flow &
+			     rte_cpu_to_be_32(ICE_IPV6_TC_MASK))
+			    == rte_cpu_to_be_32(ICE_IPV6_TC_MASK))
+				*input_set |= ICE_INSET_IPV6_TC;
+			if (ipv6_mask->hdr.proto == UINT8_MAX)
+				*input_set |= ICE_INSET_IPV6_NEXT_HDR;
+			if (ipv6_mask->hdr.hop_limits == UINT8_MAX)
+				*input_set |= ICE_INSET_IPV6_HOP_LIMIT;
+
+			rte_memcpy(&p_v6->dst_ip, ipv6_spec->hdr.dst_addr, 16);
+			rte_memcpy(&p_v6->src_ip, ipv6_spec->hdr.src_addr, 16);
+			vtc_flow_cpu = rte_be_to_cpu_32(ipv6_spec->hdr.vtc_flow);
+			p_v6->tc = (uint8_t)(vtc_flow_cpu >> ICE_FDIR_IPV6_TC_OFFSET);
+			p_v6->proto = ipv6_spec->hdr.proto;
+			p_v6->hlim = ipv6_spec->hdr.hop_limits;
 			break;
 		case RTE_FLOW_ITEM_TYPE_TCP:
-			tcp_spec = item->spec;
-			tcp_mask = item->mask;
-
 			if (l3 == RTE_FLOW_ITEM_TYPE_IPV4)
 				flow_type = ICE_FLTR_PTYPE_NONF_IPV4_TCP;
-			else if (l3 == RTE_FLOW_ITEM_TYPE_IPV6)
+			if (l3 == RTE_FLOW_ITEM_TYPE_IPV6)
 				flow_type = ICE_FLTR_PTYPE_NONF_IPV6_TCP;
 
-			if (tcp_spec && tcp_mask) {
-				/* Check TCP mask and update input set */
-				if (tcp_mask->hdr.sent_seq ||
-				    tcp_mask->hdr.recv_ack ||
-				    tcp_mask->hdr.data_off ||
-				    tcp_mask->hdr.tcp_flags ||
-				    tcp_mask->hdr.rx_win ||
-				    tcp_mask->hdr.cksum ||
-				    tcp_mask->hdr.tcp_urp) {
-					rte_flow_error_set(error, EINVAL,
+			tcp_spec = item->spec;
+			tcp_mask = item->mask;
+
+			if (!(tcp_spec && tcp_mask))
+				break;
+
+			/* Check TCP mask and update input set */
+			if (tcp_mask->hdr.sent_seq ||
+			    tcp_mask->hdr.recv_ack ||
+			    tcp_mask->hdr.data_off ||
+			    tcp_mask->hdr.tcp_flags ||
+			    tcp_mask->hdr.rx_win ||
+			    tcp_mask->hdr.cksum ||
+			    tcp_mask->hdr.tcp_urp) {
+				rte_flow_error_set(error, EINVAL,
 						   RTE_FLOW_ERROR_TYPE_ITEM,
 						   item,
 						   "Invalid TCP mask");
-					return -rte_errno;
-				}
+				return -rte_errno;
+			}
 
-				if (tcp_mask->hdr.src_port == UINT16_MAX)
-					input_set |= tunnel_type ?
-						     ICE_INSET_TUN_TCP_SRC_PORT :
-						     ICE_INSET_TCP_SRC_PORT;
-				if (tcp_mask->hdr.dst_port == UINT16_MAX)
-					input_set |= tunnel_type ?
-						     ICE_INSET_TUN_TCP_DST_PORT :
-						     ICE_INSET_TCP_DST_PORT;
-
-				/* Get filter info */
-				if (l3 == RTE_FLOW_ITEM_TYPE_IPV4) {
-					filter->input.ip.v4.dst_port =
-						tcp_spec->hdr.dst_port;
-					filter->input.ip.v4.src_port =
-						tcp_spec->hdr.src_port;
-				} else if (l3 == RTE_FLOW_ITEM_TYPE_IPV6) {
-					filter->input.ip.v6.dst_port =
-						tcp_spec->hdr.dst_port;
-					filter->input.ip.v6.src_port =
-						tcp_spec->hdr.src_port;
-				}
+			if (tcp_mask->hdr.src_port == UINT16_MAX)
+				*input_set |= ICE_INSET_TCP_SRC_PORT;
+			if (tcp_mask->hdr.dst_port == UINT16_MAX)
+				*input_set |= ICE_INSET_TCP_DST_PORT;
+
+			/* Get filter info */
+			if (l3 == RTE_FLOW_ITEM_TYPE_IPV4) {
+				assert(p_v4);
+				p_v4->dst_port = tcp_spec->hdr.dst_port;
+				p_v4->src_port = tcp_spec->hdr.src_port;
+			} else if (l3 == RTE_FLOW_ITEM_TYPE_IPV6) {
+				assert(p_v6);
+				p_v6->dst_port = tcp_spec->hdr.dst_port;
+				p_v6->src_port = tcp_spec->hdr.src_port;
 			}
 			break;
 		case RTE_FLOW_ITEM_TYPE_UDP:
-			udp_spec = item->spec;
-			udp_mask = item->mask;
-
 			if (l3 == RTE_FLOW_ITEM_TYPE_IPV4)
 				flow_type = ICE_FLTR_PTYPE_NONF_IPV4_UDP;
-			else if (l3 == RTE_FLOW_ITEM_TYPE_IPV6)
+			if (l3 == RTE_FLOW_ITEM_TYPE_IPV6)
 				flow_type = ICE_FLTR_PTYPE_NONF_IPV6_UDP;
 
-			if (udp_spec && udp_mask) {
-				/* Check UDP mask and update input set*/
-				if (udp_mask->hdr.dgram_len ||
-				    udp_mask->hdr.dgram_cksum) {
-					rte_flow_error_set(error, EINVAL,
+			udp_spec = item->spec;
+			udp_mask = item->mask;
+
+			if (!(udp_spec && udp_mask))
+				break;
+
+			/* Check UDP mask and update input set*/
+			if (udp_mask->hdr.dgram_len ||
+			    udp_mask->hdr.dgram_cksum) {
+				rte_flow_error_set(error, EINVAL,
 						   RTE_FLOW_ERROR_TYPE_ITEM,
 						   item,
 						   "Invalid UDP mask");
-					return -rte_errno;
-				}
+				return -rte_errno;
+			}
 
-				if (udp_mask->hdr.src_port == UINT16_MAX)
-					input_set |= tunnel_type ?
-						     ICE_INSET_TUN_UDP_SRC_PORT :
-						     ICE_INSET_UDP_SRC_PORT;
-				if (udp_mask->hdr.dst_port == UINT16_MAX)
-					input_set |= tunnel_type ?
-						     ICE_INSET_TUN_UDP_DST_PORT :
-						     ICE_INSET_UDP_DST_PORT;
-
-				/* Get filter info */
-				if (l3 == RTE_FLOW_ITEM_TYPE_IPV4) {
-					filter->input.ip.v4.dst_port =
-						udp_spec->hdr.dst_port;
-					filter->input.ip.v4.src_port =
-						udp_spec->hdr.src_port;
-				} else if (l3 == RTE_FLOW_ITEM_TYPE_IPV6) {
-					filter->input.ip.v6.src_port =
-						udp_spec->hdr.src_port;
-					filter->input.ip.v6.dst_port =
-						udp_spec->hdr.dst_port;
-				}
+			if (udp_mask->hdr.src_port == UINT16_MAX)
+				*input_set |= ICE_INSET_UDP_SRC_PORT;
+			if (udp_mask->hdr.dst_port == UINT16_MAX)
+				*input_set |= ICE_INSET_UDP_DST_PORT;
+
+			/* Get filter info */
+			if (l3 == RTE_FLOW_ITEM_TYPE_IPV4) {
+				assert(p_v4);
+				p_v4->dst_port = udp_spec->hdr.dst_port;
+				p_v4->src_port = udp_spec->hdr.src_port;
+			} else if (l3 == RTE_FLOW_ITEM_TYPE_IPV6) {
+				assert(p_v6);
+				p_v6->src_port = udp_spec->hdr.src_port;
+				p_v6->dst_port = udp_spec->hdr.dst_port;
 			}
 			break;
 		case RTE_FLOW_ITEM_TYPE_SCTP:
-			sctp_spec = item->spec;
-			sctp_mask = item->mask;
-
 			if (l3 == RTE_FLOW_ITEM_TYPE_IPV4)
 				flow_type = ICE_FLTR_PTYPE_NONF_IPV4_SCTP;
-			else if (l3 == RTE_FLOW_ITEM_TYPE_IPV6)
+			if (l3 == RTE_FLOW_ITEM_TYPE_IPV6)
 				flow_type = ICE_FLTR_PTYPE_NONF_IPV6_SCTP;
 
-			if (sctp_spec && sctp_mask) {
-				/* Check SCTP mask and update input set */
-				if (sctp_mask->hdr.cksum) {
-					rte_flow_error_set(error, EINVAL,
+			sctp_spec = item->spec;
+			sctp_mask = item->mask;
+
+			if (!(sctp_spec && sctp_mask))
+				break;
+
+			/* Check SCTP mask and update input set */
+			if (sctp_mask->hdr.cksum) {
+				rte_flow_error_set(error, EINVAL,
 						   RTE_FLOW_ERROR_TYPE_ITEM,
 						   item,
 						   "Invalid UDP mask");
-					return -rte_errno;
-				}
+				return -rte_errno;
+			}
 
-				if (sctp_mask->hdr.src_port == UINT16_MAX)
-					input_set |= tunnel_type ?
-						     ICE_INSET_TUN_SCTP_SRC_PORT :
-						     ICE_INSET_SCTP_SRC_PORT;
-				if (sctp_mask->hdr.dst_port == UINT16_MAX)
-					input_set |= tunnel_type ?
-						     ICE_INSET_TUN_SCTP_DST_PORT :
-						     ICE_INSET_SCTP_DST_PORT;
-
-				/* Get filter info */
-				if (l3 == RTE_FLOW_ITEM_TYPE_IPV4) {
-					filter->input.ip.v4.dst_port =
-						sctp_spec->hdr.dst_port;
-					filter->input.ip.v4.src_port =
-						sctp_spec->hdr.src_port;
-				} else if (l3 == RTE_FLOW_ITEM_TYPE_IPV6) {
-					filter->input.ip.v6.dst_port =
-						sctp_spec->hdr.dst_port;
-					filter->input.ip.v6.src_port =
-						sctp_spec->hdr.src_port;
-				}
+			if (sctp_mask->hdr.src_port == UINT16_MAX)
+				*input_set |= ICE_INSET_SCTP_SRC_PORT;
+			if (sctp_mask->hdr.dst_port == UINT16_MAX)
+				*input_set |= ICE_INSET_SCTP_DST_PORT;
+
+			/* Get filter info */
+			if (l3 == RTE_FLOW_ITEM_TYPE_IPV4) {
+				assert(p_v4);
+				p_v4->dst_port = sctp_spec->hdr.dst_port;
+				p_v4->src_port = sctp_spec->hdr.src_port;
+			} else if (l3 == RTE_FLOW_ITEM_TYPE_IPV6) {
+				assert(p_v6);
+				p_v6->dst_port = sctp_spec->hdr.dst_port;
+				p_v6->src_port = sctp_spec->hdr.src_port;
 			}
 			break;
 		case RTE_FLOW_ITEM_TYPE_VOID:
@@ -1910,6 +1905,7 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
 			l3 = RTE_FLOW_ITEM_TYPE_END;
 			vxlan_spec = item->spec;
 			vxlan_mask = item->mask;
+			is_outer = false;
 
 			if (vxlan_spec || vxlan_mask) {
 				rte_flow_error_set(error, EINVAL,
@@ -1919,50 +1915,50 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
 				return -rte_errno;
 			}
 
-			tunnel_type = ICE_FDIR_TUNNEL_TYPE_VXLAN;
 			break;
 		case RTE_FLOW_ITEM_TYPE_GTPU:
 			l3 = RTE_FLOW_ITEM_TYPE_END;
+			tunnel_type = ICE_FDIR_TUNNEL_TYPE_GTPU;
 			gtp_spec = item->spec;
 			gtp_mask = item->mask;
 
-			if (gtp_spec && gtp_mask) {
-				if (gtp_mask->v_pt_rsv_flags ||
-				    gtp_mask->msg_type ||
-				    gtp_mask->msg_len) {
-					rte_flow_error_set(error, EINVAL,
+			if (!(gtp_spec && gtp_mask))
+				break;
+
+			if (gtp_mask->v_pt_rsv_flags ||
+			    gtp_mask->msg_type ||
+			    gtp_mask->msg_len) {
+				rte_flow_error_set(error, EINVAL,
 						   RTE_FLOW_ERROR_TYPE_ITEM,
 						   item,
 						   "Invalid GTP mask");
-					return -rte_errno;
-				}
-
-				if (gtp_mask->teid == UINT32_MAX)
-					input_set |= ICE_INSET_GTPU_TEID;
-
-				filter->input.gtpu_data.teid = gtp_spec->teid;
+				return -rte_errno;
 			}
 
-			tunnel_type = ICE_FDIR_TUNNEL_TYPE_GTPU;
+			if (gtp_mask->teid == UINT32_MAX)
+				input_set_o |= ICE_INSET_GTPU_TEID;
+
+			filter->input.gtpu_data.teid = gtp_spec->teid;
 			break;
 		case RTE_FLOW_ITEM_TYPE_GTP_PSC:
+			tunnel_type = ICE_FDIR_TUNNEL_TYPE_GTPU_EH;
 			gtp_psc_spec = item->spec;
 			gtp_psc_mask = item->mask;
 
-			if (gtp_psc_spec && gtp_psc_mask) {
-				if (gtp_psc_mask->qfi == UINT8_MAX)
-					input_set |= ICE_INSET_GTPU_QFI;
+			if (!(gtp_psc_spec && gtp_psc_mask))
+				break;
 
-				filter->input.gtpu_data.qfi =
-					gtp_psc_spec->qfi;
-			}
-			tunnel_type = ICE_FDIR_TUNNEL_TYPE_GTPU_EH;
+			if (gtp_psc_mask->qfi == UINT8_MAX)
+				input_set_o |= ICE_INSET_GTPU_QFI;
+
+			filter->input.gtpu_data.qfi =
+				gtp_psc_spec->qfi;
 			break;
 		default:
 			rte_flow_error_set(error, EINVAL,
-				   RTE_FLOW_ERROR_TYPE_ITEM,
-				   item,
-				   "Invalid pattern item.");
+					   RTE_FLOW_ERROR_TYPE_ITEM,
+					   item,
+					   "Invalid pattern item.");
 			return -rte_errno;
 		}
 	}
@@ -1982,7 +1978,8 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
 
 	filter->tunnel_type = tunnel_type;
 	filter->input.flow_type = flow_type;
-	filter->input_set_o = input_set;
+	filter->input_set_o = input_set_o;
+	filter->input_set_i = input_set_i;
 
 	return 0;
 }
-- 
2.25.1


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

* [dpdk-dev] [PATCH v3 4/6] net/ice: refactor input set conf
  2021-03-02  2:54   ` [dpdk-dev] [PATCH v3 0/6] Refactor FDIR pattern parser Zhirun Yan
                       ` (2 preceding siblings ...)
  2021-03-02  2:54     ` [dpdk-dev] [PATCH v3 3/6] net/ice: refactor flow pattern parser Zhirun Yan
@ 2021-03-02  2:54     ` Zhirun Yan
  2021-03-02  2:54     ` [dpdk-dev] [PATCH v3 5/6] net/ice: add outer input set mask to distinguish outer fields Zhirun Yan
                       ` (2 subsequent siblings)
  6 siblings, 0 replies; 24+ messages in thread
From: Zhirun Yan @ 2021-03-02  2:54 UTC (permalink / raw)
  To: dev, qi.z.zhang, yahui.cao, xiao.w.wang, junfeng.guo
  Cc: simei.su, ting.xu, yuying.zhang, xuan.ding, Zhirun Yan

For tunnel or non-tunnel packet, the input set is in outer_input_set
and use seg_tun[0]. seg_tun[1] is only used for tunnel inner fields.
This patch make align with input_set inner/outer with seg_tun[] and
simplify it.

Signed-off-by: Zhirun Yan <zhirun.yan@intel.com>
---
 drivers/net/ice/ice_fdir_filter.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c
index 6bee2b1167..9cc0e6e0e7 100644
--- a/drivers/net/ice/ice_fdir_filter.c
+++ b/drivers/net/ice/ice_fdir_filter.c
@@ -1013,7 +1013,7 @@ ice_fdir_input_set_conf(struct ice_pf *pf, enum ice_fltr_ptype flow,
 		return -ENOMEM;
 	}
 
-	/* use seg_tun[1] to record tunnel inner part or non-tunnel */
+	/* use seg_tun[1] to record tunnel inner part */
 	for (k = 0; k <= ICE_FD_HW_SEG_TUN; k++) {
 		seg = &seg_tun[k];
 		input_set = (k == ICE_FD_HW_SEG_TUN) ? inner_input_set : outer_input_set;
@@ -1036,13 +1036,9 @@ ice_fdir_input_set_conf(struct ice_pf *pf, enum ice_fltr_ptype flow,
 	}
 
 	is_tunnel = ice_fdir_is_tunnel_profile(ttype);
-	if (!is_tunnel) {
-		ret = ice_fdir_hw_tbl_conf(pf, pf->main_vsi, pf->fdir.fdir_vsi,
-					   seg_tun + 1, flow, false);
-	} else {
-		ret = ice_fdir_hw_tbl_conf(pf, pf->main_vsi, pf->fdir.fdir_vsi,
-					   seg_tun, flow, true);
-	}
+
+	ret = ice_fdir_hw_tbl_conf(pf, pf->main_vsi, pf->fdir.fdir_vsi,
+				   seg_tun, flow, is_tunnel);
 
 	if (!ret) {
 		return ret;
-- 
2.25.1


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

* [dpdk-dev] [PATCH v3 5/6] net/ice: add outer input set mask to distinguish outer fields
  2021-03-02  2:54   ` [dpdk-dev] [PATCH v3 0/6] Refactor FDIR pattern parser Zhirun Yan
                       ` (3 preceding siblings ...)
  2021-03-02  2:54     ` [dpdk-dev] [PATCH v3 4/6] net/ice: refactor input set conf Zhirun Yan
@ 2021-03-02  2:54     ` Zhirun Yan
  2021-03-02  2:54     ` [dpdk-dev] [PATCH v3 6/6] net/ice: clean GTPU flow_type for FDIR Zhirun Yan
  2021-03-05  8:46     ` [dpdk-dev] [PATCH v3 0/6] Refactor FDIR pattern parser Zhang, Qi Z
  6 siblings, 0 replies; 24+ messages in thread
From: Zhirun Yan @ 2021-03-02  2:54 UTC (permalink / raw)
  To: dev, qi.z.zhang, yahui.cao, xiao.w.wang, junfeng.guo
  Cc: simei.su, ting.xu, yuying.zhang, xuan.ding, Zhirun Yan

Distinguish input_set_mask to inner and outer part. Use
input_set_mask_o for tunnel outer or non-tunnel input set.
input_set_mask_i is used for tunnel inner fields only. Adjust
indentation of ice_pattern_match_item list in switch, ACL, RSS and
FDIR for easy review. For switch, ACL and RSS, only use
input_set_mask_o and set the input_set_mask_i all none.

Signed-off-by: Zhirun Yan <zhirun.yan@intel.com>
---
 drivers/net/ice/ice_acl_filter.c    |  10 +-
 drivers/net/ice/ice_fdir_filter.c   |  72 ++++---
 drivers/net/ice/ice_generic_flow.c  |   6 +-
 drivers/net/ice/ice_generic_flow.h  |   3 +-
 drivers/net/ice/ice_hash.c          | 214 ++++++++++----------
 drivers/net/ice/ice_switch_filter.c | 296 ++++++++++------------------
 6 files changed, 249 insertions(+), 352 deletions(-)

diff --git a/drivers/net/ice/ice_acl_filter.c b/drivers/net/ice/ice_acl_filter.c
index 113cb68765..9e06e8a3de 100644
--- a/drivers/net/ice/ice_acl_filter.c
+++ b/drivers/net/ice/ice_acl_filter.c
@@ -50,10 +50,10 @@ struct acl_rule {
 
 static struct
 ice_pattern_match_item ice_acl_pattern[] = {
-	{pattern_eth_ipv4,      ICE_ACL_INSET_ETH_IPV4,      ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp,  ICE_ACL_INSET_ETH_IPV4_UDP,  ICE_INSET_NONE},
-	{pattern_eth_ipv4_tcp,  ICE_ACL_INSET_ETH_IPV4_TCP,  ICE_INSET_NONE},
-	{pattern_eth_ipv4_sctp, ICE_ACL_INSET_ETH_IPV4_SCTP, ICE_INSET_NONE},
+	{pattern_eth_ipv4,	ICE_ACL_INSET_ETH_IPV4,		ICE_INSET_NONE,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp,	ICE_ACL_INSET_ETH_IPV4_UDP,	ICE_INSET_NONE,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_tcp,	ICE_ACL_INSET_ETH_IPV4_TCP,	ICE_INSET_NONE,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_sctp,	ICE_ACL_INSET_ETH_IPV4_SCTP,	ICE_INSET_NONE,	ICE_INSET_NONE},
 };
 
 static int
@@ -923,7 +923,7 @@ ice_acl_parse(struct ice_adapter *ad,
 	if (ret)
 		goto error;
 	input_set = filter->input_set;
-	if (!input_set || input_set & ~item->input_set_mask) {
+	if (!input_set || input_set & ~item->input_set_mask_o) {
 		rte_flow_error_set(error, EINVAL,
 				   RTE_FLOW_ERROR_TYPE_ITEM_SPEC,
 				   pattern,
diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c
index 9cc0e6e0e7..72836fca6c 100644
--- a/drivers/net/ice/ice_fdir_filter.c
+++ b/drivers/net/ice/ice_fdir_filter.c
@@ -55,21 +55,25 @@
 	ICE_FDIR_INSET_ETH_IPV6 | \
 	ICE_INSET_SCTP_SRC_PORT | ICE_INSET_SCTP_DST_PORT)
 
-#define ICE_FDIR_INSET_VXLAN_IPV4 (\
+#define ICE_FDIR_INSET_IPV4 (\
 	ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST)
 
-#define ICE_FDIR_INSET_VXLAN_IPV4_TCP (\
-	ICE_FDIR_INSET_VXLAN_IPV4 | \
+#define ICE_FDIR_INSET_IPV4_TCP (\
+	ICE_FDIR_INSET_IPV4 | \
 	ICE_INSET_TCP_SRC_PORT | ICE_INSET_TCP_DST_PORT)
 
-#define ICE_FDIR_INSET_VXLAN_IPV4_UDP (\
-	ICE_FDIR_INSET_VXLAN_IPV4 | \
+#define ICE_FDIR_INSET_IPV4_UDP (\
+	ICE_FDIR_INSET_IPV4 | \
 	ICE_INSET_UDP_SRC_PORT | ICE_INSET_UDP_DST_PORT)
 
-#define ICE_FDIR_INSET_VXLAN_IPV4_SCTP (\
-	ICE_FDIR_INSET_VXLAN_IPV4 | \
+#define ICE_FDIR_INSET_IPV4_SCTP (\
+	ICE_FDIR_INSET_IPV4 | \
 	ICE_INSET_SCTP_SRC_PORT | ICE_INSET_SCTP_DST_PORT)
 
+#define ICE_FDIR_INSET_ETH_IPV4_VXLAN (\
+	ICE_FDIR_INSET_ETH | \
+	ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST)
+
 #define ICE_FDIR_INSET_IPV4_GTPU (\
 	ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST | ICE_INSET_GTPU_TEID)
 
@@ -85,35 +89,28 @@
 	ICE_INSET_GTPU_TEID | ICE_INSET_GTPU_QFI)
 
 static struct ice_pattern_match_item ice_fdir_pattern_list[] = {
-	{pattern_ethertype,	       ICE_FDIR_INSET_ETH,		     ICE_INSET_NONE},
-	{pattern_eth_ipv4,             ICE_FDIR_INSET_ETH_IPV4,              ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp,         ICE_FDIR_INSET_ETH_IPV4_UDP,          ICE_INSET_NONE},
-	{pattern_eth_ipv4_tcp,         ICE_FDIR_INSET_ETH_IPV4_TCP,          ICE_INSET_NONE},
-	{pattern_eth_ipv4_sctp,        ICE_FDIR_INSET_ETH_IPV4_SCTP,         ICE_INSET_NONE},
-	{pattern_eth_ipv6,             ICE_FDIR_INSET_ETH_IPV6,              ICE_INSET_NONE},
-	{pattern_eth_ipv6_udp,         ICE_FDIR_INSET_ETH_IPV6_UDP,          ICE_INSET_NONE},
-	{pattern_eth_ipv6_tcp,         ICE_FDIR_INSET_ETH_IPV6_TCP,          ICE_INSET_NONE},
-	{pattern_eth_ipv6_sctp,        ICE_FDIR_INSET_ETH_IPV6_SCTP,         ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_ipv4,
-				       ICE_FDIR_INSET_VXLAN_IPV4,            ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_ipv4_udp,
-				       ICE_FDIR_INSET_VXLAN_IPV4_UDP,        ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_ipv4_tcp,
-				       ICE_FDIR_INSET_VXLAN_IPV4_TCP,        ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_ipv4_sctp,
-				       ICE_FDIR_INSET_VXLAN_IPV4_SCTP,       ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_eth_ipv4,
-				       ICE_FDIR_INSET_VXLAN_IPV4,            ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_udp,
-				       ICE_FDIR_INSET_VXLAN_IPV4_UDP,        ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_tcp,
-				       ICE_FDIR_INSET_VXLAN_IPV4_TCP,        ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_sctp,
-				       ICE_FDIR_INSET_VXLAN_IPV4_SCTP,       ICE_INSET_NONE},
-	{pattern_eth_ipv4_gtpu,	       ICE_FDIR_INSET_IPV4_GTPU,             ICE_INSET_NONE},
-	{pattern_eth_ipv4_gtpu_eh,     ICE_FDIR_INSET_IPV4_GTPU_EH,          ICE_INSET_NONE},
-	{pattern_eth_ipv6_gtpu,	       ICE_FDIR_INSET_IPV6_GTPU,             ICE_INSET_NONE},
-	{pattern_eth_ipv6_gtpu_eh,     ICE_FDIR_INSET_IPV6_GTPU_EH,          ICE_INSET_NONE},
+	{pattern_ethertype,				ICE_FDIR_INSET_ETH,		ICE_INSET_NONE,			ICE_INSET_NONE},
+	{pattern_eth_ipv4,				ICE_FDIR_INSET_ETH_IPV4,	ICE_INSET_NONE,			ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp,				ICE_FDIR_INSET_ETH_IPV4_UDP,	ICE_INSET_NONE,			ICE_INSET_NONE},
+	{pattern_eth_ipv4_tcp,				ICE_FDIR_INSET_ETH_IPV4_TCP,	ICE_INSET_NONE,			ICE_INSET_NONE},
+	{pattern_eth_ipv4_sctp,				ICE_FDIR_INSET_ETH_IPV4_SCTP,	ICE_INSET_NONE,			ICE_INSET_NONE},
+	{pattern_eth_ipv6,				ICE_FDIR_INSET_ETH_IPV6,	ICE_INSET_NONE,			ICE_INSET_NONE},
+	{pattern_eth_ipv6_udp,				ICE_FDIR_INSET_ETH_IPV6_UDP,	ICE_INSET_NONE,			ICE_INSET_NONE},
+	{pattern_eth_ipv6_tcp,				ICE_FDIR_INSET_ETH_IPV6_TCP,	ICE_INSET_NONE,			ICE_INSET_NONE},
+	{pattern_eth_ipv6_sctp,				ICE_FDIR_INSET_ETH_IPV6_SCTP,	ICE_INSET_NONE,			ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_ipv4,		ICE_FDIR_INSET_ETH_IPV4_VXLAN,	ICE_FDIR_INSET_IPV4,		ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_ipv4_udp,		ICE_FDIR_INSET_ETH_IPV4_VXLAN,	ICE_FDIR_INSET_IPV4_UDP,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_ipv4_tcp,		ICE_FDIR_INSET_ETH_IPV4_VXLAN,	ICE_FDIR_INSET_IPV4_TCP,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_ipv4_sctp,		ICE_FDIR_INSET_ETH_IPV4_VXLAN,	ICE_FDIR_INSET_IPV4_SCTP,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_eth_ipv4,		ICE_FDIR_INSET_ETH_IPV4_VXLAN,	ICE_FDIR_INSET_ETH_IPV4,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_udp,	ICE_FDIR_INSET_ETH_IPV4_VXLAN,	ICE_FDIR_INSET_ETH_IPV4_UDP,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_tcp,	ICE_FDIR_INSET_ETH_IPV4_VXLAN,	ICE_FDIR_INSET_ETH_IPV4_TCP,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_sctp,	ICE_FDIR_INSET_ETH_IPV4_VXLAN,	ICE_FDIR_INSET_ETH_IPV4_SCTP,	ICE_INSET_NONE},
+	/* duplicated GTPU input set in 3rd column to align with shared code behavior. Ideally, only put GTPU field in 2nd column. */
+	{pattern_eth_ipv4_gtpu,				ICE_FDIR_INSET_IPV4_GTPU,	ICE_FDIR_INSET_IPV4_GTPU,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh,			ICE_FDIR_INSET_IPV4_GTPU_EH,	ICE_FDIR_INSET_IPV4_GTPU_EH,	ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu,				ICE_FDIR_INSET_IPV6_GTPU,	ICE_FDIR_INSET_IPV6_GTPU,	ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh,			ICE_FDIR_INSET_IPV6_GTPU_EH,	ICE_FDIR_INSET_IPV6_GTPU_EH,	ICE_INSET_NONE},
 };
 
 static struct ice_flow_parser ice_fdir_parser;
@@ -2005,7 +2002,8 @@ ice_fdir_parse(struct ice_adapter *ad,
 	if (ret)
 		goto error;
 	input_set = filter->input_set_o | filter->input_set_i;
-	if (!input_set || input_set & ~item->input_set_mask) {
+	if (!input_set || filter->input_set_o & ~item->input_set_mask_o ||
+	    filter->input_set_i & ~item->input_set_mask_i) {
 		rte_flow_error_set(error, EINVAL,
 				   RTE_FLOW_ERROR_TYPE_ITEM_SPEC,
 				   pattern,
diff --git a/drivers/net/ice/ice_generic_flow.c b/drivers/net/ice/ice_generic_flow.c
index 25d15a8adb..8704812622 100644
--- a/drivers/net/ice/ice_generic_flow.c
+++ b/drivers/net/ice/ice_generic_flow.c
@@ -2216,8 +2216,10 @@ ice_search_pattern_match_item(struct ice_adapter *ad,
 	for (i = 0; i < array_len; i++) {
 		if (ice_match_pattern(array[i].pattern_list,
 				      items)) {
-			pattern_match_item->input_set_mask =
-				array[i].input_set_mask;
+			pattern_match_item->input_set_mask_o =
+				array[i].input_set_mask_o;
+			pattern_match_item->input_set_mask_i =
+				array[i].input_set_mask_i;
 			pattern_match_item->pattern_list =
 				array[i].pattern_list;
 			pattern_match_item->meta = array[i].meta;
diff --git a/drivers/net/ice/ice_generic_flow.h b/drivers/net/ice/ice_generic_flow.h
index 3c648c0f4f..9f422e5925 100644
--- a/drivers/net/ice/ice_generic_flow.h
+++ b/drivers/net/ice/ice_generic_flow.h
@@ -473,8 +473,9 @@ 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;
+	uint64_t input_set_mask_i; /* only used for tunnel inner fields */
 	void *meta;
 };
 
diff --git a/drivers/net/ice/ice_hash.c b/drivers/net/ice/ice_hash.c
index 81caf6c635..58a0c18d09 100644
--- a/drivers/net/ice/ice_hash.c
+++ b/drivers/net/ice/ice_hash.c
@@ -352,95 +352,89 @@ struct ice_rss_hash_cfg empty_tmplt = {
 	0
 };
 
-/* rss type super set */
-/* Empty rss type to support simple_xor. */
-#define ICE_RSS_TYPE_EMPTY	0ULL
-
-/* IPv4 outer */
-#define ICE_RSS_TYPE_OUTER_IPV4		(ETH_RSS_ETH | ETH_RSS_IPV4)
-#define ICE_RSS_TYPE_OUTER_IPV4_UDP	(ICE_RSS_TYPE_OUTER_IPV4 | \
+/* IPv4 */
+#define ICE_RSS_TYPE_ETH_IPV4		(ETH_RSS_ETH | ETH_RSS_IPV4)
+#define ICE_RSS_TYPE_ETH_IPV4_UDP	(ICE_RSS_TYPE_ETH_IPV4 | \
+					 ETH_RSS_NONFRAG_IPV4_UDP)
+#define ICE_RSS_TYPE_ETH_IPV4_TCP	(ICE_RSS_TYPE_ETH_IPV4 | \
+					 ETH_RSS_NONFRAG_IPV4_TCP)
+#define ICE_RSS_TYPE_ETH_IPV4_SCTP	(ICE_RSS_TYPE_ETH_IPV4 | \
+					 ETH_RSS_NONFRAG_IPV4_SCTP)
+#define ICE_RSS_TYPE_IPV4		ETH_RSS_IPV4
+#define ICE_RSS_TYPE_IPV4_UDP		(ETH_RSS_IPV4 | \
 					 ETH_RSS_NONFRAG_IPV4_UDP)
-#define ICE_RSS_TYPE_OUTER_IPV4_TCP	(ICE_RSS_TYPE_OUTER_IPV4 | \
+#define ICE_RSS_TYPE_IPV4_TCP		(ETH_RSS_IPV4 | \
 					 ETH_RSS_NONFRAG_IPV4_TCP)
-#define ICE_RSS_TYPE_OUTER_IPV4_SCTP	(ICE_RSS_TYPE_OUTER_IPV4 | \
+#define ICE_RSS_TYPE_IPV4_SCTP		(ETH_RSS_IPV4 | \
 					 ETH_RSS_NONFRAG_IPV4_SCTP)
-/* IPv6 outer */
-#define ICE_RSS_TYPE_OUTER_IPV6		(ETH_RSS_ETH | ETH_RSS_IPV6)
-#define ICE_RSS_TYPE_OUTER_IPV6_UDP	(ICE_RSS_TYPE_OUTER_IPV6 | \
+
+/* IPv6 */
+#define ICE_RSS_TYPE_ETH_IPV6		(ETH_RSS_ETH | ETH_RSS_IPV6)
+#define ICE_RSS_TYPE_ETH_IPV6_UDP	(ICE_RSS_TYPE_ETH_IPV6 | \
+					 ETH_RSS_NONFRAG_IPV6_UDP)
+#define ICE_RSS_TYPE_ETH_IPV6_TCP	(ICE_RSS_TYPE_ETH_IPV6 | \
+					 ETH_RSS_NONFRAG_IPV6_TCP)
+#define ICE_RSS_TYPE_ETH_IPV6_SCTP	(ICE_RSS_TYPE_ETH_IPV6 | \
+					 ETH_RSS_NONFRAG_IPV6_SCTP)
+#define ICE_RSS_TYPE_IPV6		ETH_RSS_IPV6
+#define ICE_RSS_TYPE_IPV6_UDP		(ETH_RSS_IPV6 | \
 					 ETH_RSS_NONFRAG_IPV6_UDP)
-#define ICE_RSS_TYPE_OUTER_IPV6_TCP	(ICE_RSS_TYPE_OUTER_IPV6 | \
+#define ICE_RSS_TYPE_IPV6_TCP		(ETH_RSS_IPV6 | \
 					 ETH_RSS_NONFRAG_IPV6_TCP)
-#define ICE_RSS_TYPE_OUTER_IPV6_SCTP	(ICE_RSS_TYPE_OUTER_IPV6 | \
+#define ICE_RSS_TYPE_IPV6_SCTP		(ETH_RSS_IPV6 | \
 					 ETH_RSS_NONFRAG_IPV6_SCTP)
 
 /* VLAN IPV4 */
-#define ICE_RSS_TYPE_VLAN_IPV4		(ICE_RSS_TYPE_OUTER_IPV4 | \
+#define ICE_RSS_TYPE_VLAN_IPV4		(ICE_RSS_TYPE_IPV4 | \
 					 ETH_RSS_S_VLAN | ETH_RSS_C_VLAN)
-#define ICE_RSS_TYPE_VLAN_IPV4_UDP	(ICE_RSS_TYPE_OUTER_IPV4_UDP | \
+#define ICE_RSS_TYPE_VLAN_IPV4_UDP	(ICE_RSS_TYPE_IPV4_UDP | \
 					 ETH_RSS_S_VLAN | ETH_RSS_C_VLAN)
-#define ICE_RSS_TYPE_VLAN_IPV4_TCP	(ICE_RSS_TYPE_OUTER_IPV4_TCP | \
+#define ICE_RSS_TYPE_VLAN_IPV4_TCP	(ICE_RSS_TYPE_IPV4_TCP | \
 					 ETH_RSS_S_VLAN | ETH_RSS_C_VLAN)
-#define ICE_RSS_TYPE_VLAN_IPV4_SCTP	(ICE_RSS_TYPE_OUTER_IPV4_SCTP | \
+#define ICE_RSS_TYPE_VLAN_IPV4_SCTP	(ICE_RSS_TYPE_IPV4_SCTP | \
 					 ETH_RSS_S_VLAN | ETH_RSS_C_VLAN)
 /* VLAN IPv6 */
-#define ICE_RSS_TYPE_VLAN_IPV6		(ICE_RSS_TYPE_OUTER_IPV6 | \
+#define ICE_RSS_TYPE_VLAN_IPV6		(ICE_RSS_TYPE_IPV6 | \
 					 ETH_RSS_S_VLAN | ETH_RSS_C_VLAN)
-#define ICE_RSS_TYPE_VLAN_IPV6_UDP	(ICE_RSS_TYPE_OUTER_IPV6_UDP | \
+#define ICE_RSS_TYPE_VLAN_IPV6_UDP	(ICE_RSS_TYPE_IPV6_UDP | \
 					 ETH_RSS_S_VLAN | ETH_RSS_C_VLAN)
-#define ICE_RSS_TYPE_VLAN_IPV6_TCP	(ICE_RSS_TYPE_OUTER_IPV6_TCP | \
+#define ICE_RSS_TYPE_VLAN_IPV6_TCP	(ICE_RSS_TYPE_IPV6_TCP | \
 					 ETH_RSS_S_VLAN | ETH_RSS_C_VLAN)
-#define ICE_RSS_TYPE_VLAN_IPV6_SCTP	(ICE_RSS_TYPE_OUTER_IPV6_SCTP | \
+#define ICE_RSS_TYPE_VLAN_IPV6_SCTP	(ICE_RSS_TYPE_IPV6_SCTP | \
 					 ETH_RSS_S_VLAN | ETH_RSS_C_VLAN)
 
-/* IPv4 inner */
-#define ICE_RSS_TYPE_INNER_IPV4		ETH_RSS_IPV4
-#define ICE_RSS_TYPE_INNER_IPV4_UDP	(ETH_RSS_IPV4 | \
-					 ETH_RSS_NONFRAG_IPV4_UDP)
-#define ICE_RSS_TYPE_INNER_IPV4_TCP	(ETH_RSS_IPV4 | \
-					 ETH_RSS_NONFRAG_IPV4_TCP)
-#define ICE_RSS_TYPE_INNER_IPV4_SCTP	(ETH_RSS_IPV4 | \
-					 ETH_RSS_NONFRAG_IPV4_SCTP)
-/* IPv6 inner */
-#define ICE_RSS_TYPE_INNER_IPV6		ETH_RSS_IPV6
-#define ICE_RSS_TYPE_INNER_IPV6_UDP	(ETH_RSS_IPV6 | \
-					 ETH_RSS_NONFRAG_IPV6_UDP)
-#define ICE_RSS_TYPE_INNER_IPV6_TCP	(ETH_RSS_IPV6 | \
-					 ETH_RSS_NONFRAG_IPV6_TCP)
-#define ICE_RSS_TYPE_INNER_IPV6_SCTP	(ETH_RSS_IPV6 | \
-					 ETH_RSS_NONFRAG_IPV6_SCTP)
-
 /* GTPU IPv4 */
-#define ICE_RSS_TYPE_GTPU_IPV4		(ICE_RSS_TYPE_INNER_IPV4 | \
+#define ICE_RSS_TYPE_GTPU_IPV4		(ICE_RSS_TYPE_IPV4 | \
 					 ETH_RSS_GTPU)
-#define ICE_RSS_TYPE_GTPU_IPV4_UDP	(ICE_RSS_TYPE_INNER_IPV4_UDP | \
+#define ICE_RSS_TYPE_GTPU_IPV4_UDP	(ICE_RSS_TYPE_IPV4_UDP | \
 					 ETH_RSS_GTPU)
-#define ICE_RSS_TYPE_GTPU_IPV4_TCP	(ICE_RSS_TYPE_INNER_IPV4_TCP | \
+#define ICE_RSS_TYPE_GTPU_IPV4_TCP	(ICE_RSS_TYPE_IPV4_TCP | \
 					 ETH_RSS_GTPU)
 /* GTPU IPv6 */
-#define ICE_RSS_TYPE_GTPU_IPV6		(ICE_RSS_TYPE_INNER_IPV6 | \
+#define ICE_RSS_TYPE_GTPU_IPV6		(ICE_RSS_TYPE_IPV6 | \
 					 ETH_RSS_GTPU)
-#define ICE_RSS_TYPE_GTPU_IPV6_UDP	(ICE_RSS_TYPE_INNER_IPV6_UDP | \
+#define ICE_RSS_TYPE_GTPU_IPV6_UDP	(ICE_RSS_TYPE_IPV6_UDP | \
 					 ETH_RSS_GTPU)
-#define ICE_RSS_TYPE_GTPU_IPV6_TCP	(ICE_RSS_TYPE_INNER_IPV6_TCP | \
+#define ICE_RSS_TYPE_GTPU_IPV6_TCP	(ICE_RSS_TYPE_IPV6_TCP | \
 					 ETH_RSS_GTPU)
 
 /* PPPOE */
 #define ICE_RSS_TYPE_PPPOE		(ETH_RSS_ETH | ETH_RSS_PPPOE)
 
 /* PPPOE IPv4 */
-#define ICE_RSS_TYPE_PPPOE_IPV4		(ICE_RSS_TYPE_INNER_IPV4 | \
+#define ICE_RSS_TYPE_PPPOE_IPV4		(ICE_RSS_TYPE_IPV4 | \
 					 ICE_RSS_TYPE_PPPOE)
-#define ICE_RSS_TYPE_PPPOE_IPV4_UDP	(ICE_RSS_TYPE_INNER_IPV4_UDP | \
+#define ICE_RSS_TYPE_PPPOE_IPV4_UDP	(ICE_RSS_TYPE_IPV4_UDP | \
 					 ICE_RSS_TYPE_PPPOE)
-#define ICE_RSS_TYPE_PPPOE_IPV4_TCP	(ICE_RSS_TYPE_INNER_IPV4_TCP | \
+#define ICE_RSS_TYPE_PPPOE_IPV4_TCP	(ICE_RSS_TYPE_IPV4_TCP | \
 					 ICE_RSS_TYPE_PPPOE)
 
 /* PPPOE IPv6 */
-#define ICE_RSS_TYPE_PPPOE_IPV6		(ICE_RSS_TYPE_INNER_IPV6 | \
+#define ICE_RSS_TYPE_PPPOE_IPV6		(ICE_RSS_TYPE_IPV6 | \
 					 ICE_RSS_TYPE_PPPOE)
-#define ICE_RSS_TYPE_PPPOE_IPV6_UDP	(ICE_RSS_TYPE_INNER_IPV6_UDP | \
+#define ICE_RSS_TYPE_PPPOE_IPV6_UDP	(ICE_RSS_TYPE_IPV6_UDP | \
 					 ICE_RSS_TYPE_PPPOE)
-#define ICE_RSS_TYPE_PPPOE_IPV6_TCP	(ICE_RSS_TYPE_INNER_IPV6_TCP | \
+#define ICE_RSS_TYPE_PPPOE_IPV6_TCP	(ICE_RSS_TYPE_IPV6_TCP | \
 					 ICE_RSS_TYPE_PPPOE)
 
 /* ESP, AH, L2TPV3 and PFCP */
@@ -461,67 +455,67 @@ struct ice_rss_hash_cfg empty_tmplt = {
  */
 static struct ice_pattern_match_item ice_hash_pattern_list[] = {
 	/* IPV4 */
-	{pattern_eth_ipv4,			ICE_RSS_TYPE_OUTER_IPV4,	&ipv4_tmplt},
-	{pattern_eth_ipv4_udp,			ICE_RSS_TYPE_OUTER_IPV4_UDP,	&ipv4_udp_tmplt},
-	{pattern_eth_ipv4_tcp,			ICE_RSS_TYPE_OUTER_IPV4_TCP,	&ipv4_tcp_tmplt},
-	{pattern_eth_ipv4_sctp,			ICE_RSS_TYPE_OUTER_IPV4_SCTP,	&ipv4_sctp_tmplt},
-	{pattern_eth_vlan_ipv4,			ICE_RSS_TYPE_VLAN_IPV4,		&ipv4_tmplt},
-	{pattern_eth_vlan_ipv4_udp,		ICE_RSS_TYPE_VLAN_IPV4_UDP,	&ipv4_udp_tmplt},
-	{pattern_eth_vlan_ipv4_tcp,		ICE_RSS_TYPE_VLAN_IPV4_TCP,	&ipv4_tcp_tmplt},
-	{pattern_eth_vlan_ipv4_sctp,		ICE_RSS_TYPE_VLAN_IPV4_SCTP,	&ipv4_sctp_tmplt},
-	{pattern_eth_ipv4_gtpu_ipv4,		ICE_RSS_TYPE_GTPU_IPV4,		&outer_ipv4_inner_ipv4_tmplt},
-	{pattern_eth_ipv4_gtpu_ipv4_udp,	ICE_RSS_TYPE_GTPU_IPV4_UDP,	&outer_ipv4_inner_ipv4_udp_tmplt},
-	{pattern_eth_ipv4_gtpu_ipv4_tcp,	ICE_RSS_TYPE_GTPU_IPV4_TCP,	&outer_ipv4_inner_ipv4_tcp_tmplt},
-	{pattern_eth_ipv6_gtpu_ipv4,		ICE_RSS_TYPE_GTPU_IPV4,		&outer_ipv6_inner_ipv4_tmplt},
-	{pattern_eth_ipv6_gtpu_ipv4_udp,	ICE_RSS_TYPE_GTPU_IPV4_UDP,	&outer_ipv6_inner_ipv4_udp_tmplt},
-	{pattern_eth_ipv6_gtpu_ipv4_tcp,	ICE_RSS_TYPE_GTPU_IPV4_TCP,	&outer_ipv6_inner_ipv4_tcp_tmplt},
-	{pattern_eth_ipv4_gtpu_eh_ipv4,		ICE_RSS_TYPE_GTPU_IPV4,		&outer_ipv4_inner_ipv4_tmplt},
-	{pattern_eth_ipv4_gtpu_eh_ipv4_udp,	ICE_RSS_TYPE_GTPU_IPV4_UDP,	&outer_ipv4_inner_ipv4_udp_tmplt},
-	{pattern_eth_ipv4_gtpu_eh_ipv4_tcp,	ICE_RSS_TYPE_GTPU_IPV4_TCP,	&outer_ipv4_inner_ipv4_tcp_tmplt},
-	{pattern_eth_ipv6_gtpu_eh_ipv4,		ICE_RSS_TYPE_GTPU_IPV4,		&outer_ipv6_inner_ipv4_tmplt},
-	{pattern_eth_ipv6_gtpu_eh_ipv4_udp,	ICE_RSS_TYPE_GTPU_IPV4_UDP,	&outer_ipv6_inner_ipv4_udp_tmplt},
-	{pattern_eth_ipv6_gtpu_eh_ipv4_tcp,	ICE_RSS_TYPE_GTPU_IPV4_TCP,	&outer_ipv6_inner_ipv4_tcp_tmplt},
-	{pattern_eth_pppoes_ipv4,		ICE_RSS_TYPE_PPPOE_IPV4,	&ipv4_tmplt},
-	{pattern_eth_pppoes_ipv4_udp,		ICE_RSS_TYPE_PPPOE_IPV4_UDP,	&ipv4_udp_tmplt},
-	{pattern_eth_pppoes_ipv4_tcp,		ICE_RSS_TYPE_PPPOE_IPV4_TCP,	&ipv4_tcp_tmplt},
-	{pattern_eth_ipv4_esp,			ICE_RSS_TYPE_IPV4_ESP,		&eth_ipv4_esp_tmplt},
-	{pattern_eth_ipv4_udp_esp,		ICE_RSS_TYPE_IPV4_ESP,		&eth_ipv4_udp_esp_tmplt},
-	{pattern_eth_ipv4_ah,			ICE_RSS_TYPE_IPV4_AH,		&eth_ipv4_ah_tmplt},
-	{pattern_eth_ipv4_l2tp,			ICE_RSS_TYPE_IPV4_L2TPV3,	&eth_ipv4_l2tpv3_tmplt},
-	{pattern_eth_ipv4_pfcp,			ICE_RSS_TYPE_IPV4_PFCP,		&eth_ipv4_pfcp_tmplt},
+	{pattern_eth_ipv4,			ICE_RSS_TYPE_ETH_IPV4,		ICE_INSET_NONE,	&ipv4_tmplt},
+	{pattern_eth_ipv4_udp,			ICE_RSS_TYPE_ETH_IPV4_UDP,	ICE_INSET_NONE,	&ipv4_udp_tmplt},
+	{pattern_eth_ipv4_tcp,			ICE_RSS_TYPE_ETH_IPV4_TCP,	ICE_INSET_NONE,	&ipv4_tcp_tmplt},
+	{pattern_eth_ipv4_sctp,			ICE_RSS_TYPE_ETH_IPV4_SCTP,	ICE_INSET_NONE,	&ipv4_sctp_tmplt},
+	{pattern_eth_vlan_ipv4,			ICE_RSS_TYPE_VLAN_IPV4,		ICE_INSET_NONE,	&ipv4_tmplt},
+	{pattern_eth_vlan_ipv4_udp,		ICE_RSS_TYPE_VLAN_IPV4_UDP,	ICE_INSET_NONE,	&ipv4_udp_tmplt},
+	{pattern_eth_vlan_ipv4_tcp,		ICE_RSS_TYPE_VLAN_IPV4_TCP,	ICE_INSET_NONE,	&ipv4_tcp_tmplt},
+	{pattern_eth_vlan_ipv4_sctp,		ICE_RSS_TYPE_VLAN_IPV4_SCTP,	ICE_INSET_NONE,	&ipv4_sctp_tmplt},
+	{pattern_eth_ipv4_gtpu_ipv4,		ICE_RSS_TYPE_GTPU_IPV4,		ICE_INSET_NONE,	&outer_ipv4_inner_ipv4_tmplt},
+	{pattern_eth_ipv4_gtpu_ipv4_udp,	ICE_RSS_TYPE_GTPU_IPV4_UDP,	ICE_INSET_NONE,	&outer_ipv4_inner_ipv4_udp_tmplt},
+	{pattern_eth_ipv4_gtpu_ipv4_tcp,	ICE_RSS_TYPE_GTPU_IPV4_TCP,	ICE_INSET_NONE,	&outer_ipv4_inner_ipv4_tcp_tmplt},
+	{pattern_eth_ipv6_gtpu_ipv4,		ICE_RSS_TYPE_GTPU_IPV4,		ICE_INSET_NONE,	&outer_ipv6_inner_ipv4_tmplt},
+	{pattern_eth_ipv6_gtpu_ipv4_udp,	ICE_RSS_TYPE_GTPU_IPV4_UDP,	ICE_INSET_NONE,	&outer_ipv6_inner_ipv4_udp_tmplt},
+	{pattern_eth_ipv6_gtpu_ipv4_tcp,	ICE_RSS_TYPE_GTPU_IPV4_TCP,	ICE_INSET_NONE,	&outer_ipv6_inner_ipv4_tcp_tmplt},
+	{pattern_eth_ipv4_gtpu_eh_ipv4,		ICE_RSS_TYPE_GTPU_IPV4,		ICE_INSET_NONE,	&outer_ipv4_inner_ipv4_tmplt},
+	{pattern_eth_ipv4_gtpu_eh_ipv4_udp,	ICE_RSS_TYPE_GTPU_IPV4_UDP,	ICE_INSET_NONE,	&outer_ipv4_inner_ipv4_udp_tmplt},
+	{pattern_eth_ipv4_gtpu_eh_ipv4_tcp,	ICE_RSS_TYPE_GTPU_IPV4_TCP,	ICE_INSET_NONE,	&outer_ipv4_inner_ipv4_tcp_tmplt},
+	{pattern_eth_ipv6_gtpu_eh_ipv4,		ICE_RSS_TYPE_GTPU_IPV4,		ICE_INSET_NONE,	&outer_ipv6_inner_ipv4_tmplt},
+	{pattern_eth_ipv6_gtpu_eh_ipv4_udp,	ICE_RSS_TYPE_GTPU_IPV4_UDP,	ICE_INSET_NONE,	&outer_ipv6_inner_ipv4_udp_tmplt},
+	{pattern_eth_ipv6_gtpu_eh_ipv4_tcp,	ICE_RSS_TYPE_GTPU_IPV4_TCP,	ICE_INSET_NONE,	&outer_ipv6_inner_ipv4_tcp_tmplt},
+	{pattern_eth_pppoes_ipv4,		ICE_RSS_TYPE_PPPOE_IPV4,	ICE_INSET_NONE,	&ipv4_tmplt},
+	{pattern_eth_pppoes_ipv4_udp,		ICE_RSS_TYPE_PPPOE_IPV4_UDP,	ICE_INSET_NONE,	&ipv4_udp_tmplt},
+	{pattern_eth_pppoes_ipv4_tcp,		ICE_RSS_TYPE_PPPOE_IPV4_TCP,	ICE_INSET_NONE,	&ipv4_tcp_tmplt},
+	{pattern_eth_ipv4_esp,			ICE_RSS_TYPE_IPV4_ESP,		ICE_INSET_NONE,	&eth_ipv4_esp_tmplt},
+	{pattern_eth_ipv4_udp_esp,		ICE_RSS_TYPE_IPV4_ESP,		ICE_INSET_NONE,	&eth_ipv4_udp_esp_tmplt},
+	{pattern_eth_ipv4_ah,			ICE_RSS_TYPE_IPV4_AH,		ICE_INSET_NONE,	&eth_ipv4_ah_tmplt},
+	{pattern_eth_ipv4_l2tp,			ICE_RSS_TYPE_IPV4_L2TPV3,	ICE_INSET_NONE,	&eth_ipv4_l2tpv3_tmplt},
+	{pattern_eth_ipv4_pfcp,			ICE_RSS_TYPE_IPV4_PFCP,		ICE_INSET_NONE,	&eth_ipv4_pfcp_tmplt},
 	/* IPV6 */
-	{pattern_eth_ipv6,			ICE_RSS_TYPE_OUTER_IPV6,	&ipv6_tmplt},
-	{pattern_eth_ipv6_udp,			ICE_RSS_TYPE_OUTER_IPV6_UDP,	&ipv6_udp_tmplt},
-	{pattern_eth_ipv6_tcp,			ICE_RSS_TYPE_OUTER_IPV6_TCP,	&ipv6_tcp_tmplt},
-	{pattern_eth_ipv6_sctp,			ICE_RSS_TYPE_OUTER_IPV6_SCTP,	&ipv6_sctp_tmplt},
-	{pattern_eth_vlan_ipv6,			ICE_RSS_TYPE_VLAN_IPV6,		&ipv6_tmplt},
-	{pattern_eth_vlan_ipv6_udp,		ICE_RSS_TYPE_VLAN_IPV6_UDP,	&ipv6_udp_tmplt},
-	{pattern_eth_vlan_ipv6_tcp,		ICE_RSS_TYPE_VLAN_IPV6_TCP,	&ipv6_tcp_tmplt},
-	{pattern_eth_vlan_ipv6_sctp,		ICE_RSS_TYPE_VLAN_IPV6_SCTP,	&ipv6_sctp_tmplt},
-	{pattern_eth_ipv4_gtpu_ipv6,		ICE_RSS_TYPE_GTPU_IPV6,		&outer_ipv4_inner_ipv6_tmplt},
-	{pattern_eth_ipv4_gtpu_ipv6_udp,	ICE_RSS_TYPE_GTPU_IPV6_UDP,	&outer_ipv4_inner_ipv6_udp_tmplt},
-	{pattern_eth_ipv4_gtpu_ipv6_tcp,	ICE_RSS_TYPE_GTPU_IPV6_TCP,	&outer_ipv4_inner_ipv6_tcp_tmplt},
-	{pattern_eth_ipv6_gtpu_ipv6,		ICE_RSS_TYPE_GTPU_IPV6,		&outer_ipv6_inner_ipv6_tmplt},
-	{pattern_eth_ipv6_gtpu_ipv6_udp,	ICE_RSS_TYPE_GTPU_IPV6_UDP,	&outer_ipv6_inner_ipv6_udp_tmplt},
-	{pattern_eth_ipv6_gtpu_ipv6_tcp,	ICE_RSS_TYPE_GTPU_IPV6_TCP,	&outer_ipv6_inner_ipv6_tcp_tmplt},
-	{pattern_eth_ipv4_gtpu_eh_ipv6,		ICE_RSS_TYPE_GTPU_IPV6,		&outer_ipv4_inner_ipv6_tmplt},
-	{pattern_eth_ipv4_gtpu_eh_ipv6_udp,	ICE_RSS_TYPE_GTPU_IPV6_UDP,	&outer_ipv4_inner_ipv6_udp_tmplt},
-	{pattern_eth_ipv4_gtpu_eh_ipv6_tcp,	ICE_RSS_TYPE_GTPU_IPV6_TCP,	&outer_ipv4_inner_ipv6_tcp_tmplt},
-	{pattern_eth_ipv6_gtpu_eh_ipv6,		ICE_RSS_TYPE_GTPU_IPV6,		&outer_ipv6_inner_ipv6_tmplt},
-	{pattern_eth_ipv6_gtpu_eh_ipv6_udp,	ICE_RSS_TYPE_GTPU_IPV6_UDP,	&outer_ipv6_inner_ipv6_udp_tmplt},
-	{pattern_eth_ipv6_gtpu_eh_ipv6_tcp,	ICE_RSS_TYPE_GTPU_IPV6_TCP,	&outer_ipv6_inner_ipv6_tcp_tmplt},
-	{pattern_eth_pppoes_ipv6,		ICE_RSS_TYPE_PPPOE_IPV6,	&ipv6_tmplt},
-	{pattern_eth_pppoes_ipv6_udp,		ICE_RSS_TYPE_PPPOE_IPV6_UDP,	&ipv6_udp_tmplt},
-	{pattern_eth_pppoes_ipv6_tcp,		ICE_RSS_TYPE_PPPOE_IPV6_TCP,	&ipv6_tcp_tmplt},
-	{pattern_eth_ipv6_esp,			ICE_RSS_TYPE_IPV6_ESP,		&eth_ipv6_esp_tmplt},
-	{pattern_eth_ipv6_udp_esp,		ICE_RSS_TYPE_IPV6_ESP,		&eth_ipv6_udp_esp_tmplt},
-	{pattern_eth_ipv6_ah,			ICE_RSS_TYPE_IPV6_AH,		&eth_ipv6_ah_tmplt},
-	{pattern_eth_ipv6_l2tp,			ICE_RSS_TYPE_IPV6_L2TPV3,	&eth_ipv6_l2tpv3_tmplt},
-	{pattern_eth_ipv6_pfcp,			ICE_RSS_TYPE_IPV6_PFCP,		&eth_ipv6_pfcp_tmplt},
+	{pattern_eth_ipv6,			ICE_RSS_TYPE_ETH_IPV6,		ICE_INSET_NONE,	&ipv6_tmplt},
+	{pattern_eth_ipv6_udp,			ICE_RSS_TYPE_ETH_IPV6_UDP,	ICE_INSET_NONE,	&ipv6_udp_tmplt},
+	{pattern_eth_ipv6_tcp,			ICE_RSS_TYPE_ETH_IPV6_TCP,	ICE_INSET_NONE,	&ipv6_tcp_tmplt},
+	{pattern_eth_ipv6_sctp,			ICE_RSS_TYPE_ETH_IPV6_SCTP,	ICE_INSET_NONE,	&ipv6_sctp_tmplt},
+	{pattern_eth_vlan_ipv6,			ICE_RSS_TYPE_VLAN_IPV6,		ICE_INSET_NONE,	&ipv6_tmplt},
+	{pattern_eth_vlan_ipv6_udp,		ICE_RSS_TYPE_VLAN_IPV6_UDP,	ICE_INSET_NONE,	&ipv6_udp_tmplt},
+	{pattern_eth_vlan_ipv6_tcp,		ICE_RSS_TYPE_VLAN_IPV6_TCP,	ICE_INSET_NONE,	&ipv6_tcp_tmplt},
+	{pattern_eth_vlan_ipv6_sctp,		ICE_RSS_TYPE_VLAN_IPV6_SCTP,	ICE_INSET_NONE,	&ipv6_sctp_tmplt},
+	{pattern_eth_ipv4_gtpu_ipv6,		ICE_RSS_TYPE_GTPU_IPV6,		ICE_INSET_NONE,	&outer_ipv4_inner_ipv6_tmplt},
+	{pattern_eth_ipv4_gtpu_ipv6_udp,	ICE_RSS_TYPE_GTPU_IPV6_UDP,	ICE_INSET_NONE,	&outer_ipv4_inner_ipv6_udp_tmplt},
+	{pattern_eth_ipv4_gtpu_ipv6_tcp,	ICE_RSS_TYPE_GTPU_IPV6_TCP,	ICE_INSET_NONE,	&outer_ipv4_inner_ipv6_tcp_tmplt},
+	{pattern_eth_ipv6_gtpu_ipv6,		ICE_RSS_TYPE_GTPU_IPV6,		ICE_INSET_NONE,	&outer_ipv6_inner_ipv6_tmplt},
+	{pattern_eth_ipv6_gtpu_ipv6_udp,	ICE_RSS_TYPE_GTPU_IPV6_UDP,	ICE_INSET_NONE,	&outer_ipv6_inner_ipv6_udp_tmplt},
+	{pattern_eth_ipv6_gtpu_ipv6_tcp,	ICE_RSS_TYPE_GTPU_IPV6_TCP,	ICE_INSET_NONE,	&outer_ipv6_inner_ipv6_tcp_tmplt},
+	{pattern_eth_ipv4_gtpu_eh_ipv6,		ICE_RSS_TYPE_GTPU_IPV6,		ICE_INSET_NONE,	&outer_ipv4_inner_ipv6_tmplt},
+	{pattern_eth_ipv4_gtpu_eh_ipv6_udp,	ICE_RSS_TYPE_GTPU_IPV6_UDP,	ICE_INSET_NONE,	&outer_ipv4_inner_ipv6_udp_tmplt},
+	{pattern_eth_ipv4_gtpu_eh_ipv6_tcp,	ICE_RSS_TYPE_GTPU_IPV6_TCP,	ICE_INSET_NONE,	&outer_ipv4_inner_ipv6_tcp_tmplt},
+	{pattern_eth_ipv6_gtpu_eh_ipv6,		ICE_RSS_TYPE_GTPU_IPV6,		ICE_INSET_NONE,	&outer_ipv6_inner_ipv6_tmplt},
+	{pattern_eth_ipv6_gtpu_eh_ipv6_udp,	ICE_RSS_TYPE_GTPU_IPV6_UDP,	ICE_INSET_NONE,	&outer_ipv6_inner_ipv6_udp_tmplt},
+	{pattern_eth_ipv6_gtpu_eh_ipv6_tcp,	ICE_RSS_TYPE_GTPU_IPV6_TCP,	ICE_INSET_NONE,	&outer_ipv6_inner_ipv6_tcp_tmplt},
+	{pattern_eth_pppoes_ipv6,		ICE_RSS_TYPE_PPPOE_IPV6,	ICE_INSET_NONE,	&ipv6_tmplt},
+	{pattern_eth_pppoes_ipv6_udp,		ICE_RSS_TYPE_PPPOE_IPV6_UDP,	ICE_INSET_NONE,	&ipv6_udp_tmplt},
+	{pattern_eth_pppoes_ipv6_tcp,		ICE_RSS_TYPE_PPPOE_IPV6_TCP,	ICE_INSET_NONE,	&ipv6_tcp_tmplt},
+	{pattern_eth_ipv6_esp,			ICE_RSS_TYPE_IPV6_ESP,		ICE_INSET_NONE,	&eth_ipv6_esp_tmplt},
+	{pattern_eth_ipv6_udp_esp,		ICE_RSS_TYPE_IPV6_ESP,		ICE_INSET_NONE,	&eth_ipv6_udp_esp_tmplt},
+	{pattern_eth_ipv6_ah,			ICE_RSS_TYPE_IPV6_AH,		ICE_INSET_NONE,	&eth_ipv6_ah_tmplt},
+	{pattern_eth_ipv6_l2tp,			ICE_RSS_TYPE_IPV6_L2TPV3,	ICE_INSET_NONE,	&eth_ipv6_l2tpv3_tmplt},
+	{pattern_eth_ipv6_pfcp,			ICE_RSS_TYPE_IPV6_PFCP,		ICE_INSET_NONE,	&eth_ipv6_pfcp_tmplt},
 	/* PPPOE */
-	{pattern_eth_pppoes,			ICE_RSS_TYPE_PPPOE,		&pppoe_tmplt},
+	{pattern_eth_pppoes,			ICE_RSS_TYPE_PPPOE,		ICE_INSET_NONE,	&pppoe_tmplt},
 	/* EMPTY */
-	{pattern_empty,				ICE_RSS_TYPE_EMPTY,		&empty_tmplt},
+	{pattern_empty,				ICE_INSET_NONE,			ICE_INSET_NONE,	&empty_tmplt},
 };
 
 static struct ice_flow_engine ice_hash_engine = {
@@ -960,7 +954,7 @@ ice_hash_parse_action(struct ice_pattern_match_item *pattern_match_item,
 			rss_type = rte_eth_rss_hf_refine(rss_type);
 
 			if (ice_any_invalid_rss_type(rss->func, rss_type,
-					pattern_match_item->input_set_mask))
+					pattern_match_item->input_set_mask_o))
 				return rte_flow_error_set(error, ENOTSUP,
 					RTE_FLOW_ERROR_TYPE_ACTION,
 					action, "RSS type not supported");
diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c
index 6525e6c115..ada3ecf60b 100644
--- a/drivers/net/ice/ice_switch_filter.c
+++ b/drivers/net/ice/ice_switch_filter.c
@@ -149,206 +149,108 @@ 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},
-	{pattern_ethertype_vlan,
-			ICE_SW_INSET_MAC_VLAN, ICE_INSET_NONE},
-	{pattern_ethertype_qinq,
-			ICE_SW_INSET_MAC_QINQ, ICE_INSET_NONE},
-	{pattern_eth_arp,
-			ICE_INSET_NONE, ICE_INSET_NONE},
-	{pattern_eth_ipv4,
-			ICE_SW_INSET_MAC_IPV4, ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp,
-			ICE_SW_INSET_MAC_IPV4_UDP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_tcp,
-			ICE_SW_INSET_MAC_IPV4_TCP, ICE_INSET_NONE},
-	{pattern_eth_ipv6,
-			ICE_SW_INSET_MAC_IPV6, ICE_INSET_NONE},
-	{pattern_eth_ipv6_udp,
-			ICE_SW_INSET_MAC_IPV6_UDP, ICE_INSET_NONE},
-	{pattern_eth_ipv6_tcp,
-			ICE_SW_INSET_MAC_IPV6_TCP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_eth_ipv4,
-			ICE_SW_INSET_DIST_VXLAN_IPV4, ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_udp,
-			ICE_SW_INSET_DIST_VXLAN_IPV4_UDP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_tcp,
-			ICE_SW_INSET_DIST_VXLAN_IPV4_TCP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_nvgre_eth_ipv4,
-			ICE_SW_INSET_DIST_NVGRE_IPV4, ICE_INSET_NONE},
-	{pattern_eth_ipv4_nvgre_eth_ipv4_udp,
-			ICE_SW_INSET_DIST_NVGRE_IPV4_UDP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_nvgre_eth_ipv4_tcp,
-			ICE_SW_INSET_DIST_NVGRE_IPV4_TCP, ICE_INSET_NONE},
-	{pattern_eth_pppoes,
-			ICE_SW_INSET_MAC_PPPOE, ICE_INSET_NONE},
-	{pattern_eth_vlan_pppoes,
-			ICE_SW_INSET_MAC_PPPOE, ICE_INSET_NONE},
-	{pattern_eth_pppoes_proto,
-			ICE_SW_INSET_MAC_PPPOE_PROTO, ICE_INSET_NONE},
-	{pattern_eth_vlan_pppoes_proto,
-			ICE_SW_INSET_MAC_PPPOE_PROTO, ICE_INSET_NONE},
-	{pattern_eth_pppoes_ipv4,
-			ICE_SW_INSET_MAC_PPPOE_IPV4, ICE_INSET_NONE},
-	{pattern_eth_pppoes_ipv4_tcp,
-			ICE_SW_INSET_MAC_PPPOE_IPV4_TCP, ICE_INSET_NONE},
-	{pattern_eth_pppoes_ipv4_udp,
-			ICE_SW_INSET_MAC_PPPOE_IPV4_UDP, ICE_INSET_NONE},
-	{pattern_eth_pppoes_ipv6,
-			ICE_SW_INSET_MAC_PPPOE_IPV6, ICE_INSET_NONE},
-	{pattern_eth_pppoes_ipv6_tcp,
-			ICE_SW_INSET_MAC_PPPOE_IPV6_TCP, ICE_INSET_NONE},
-	{pattern_eth_pppoes_ipv6_udp,
-			ICE_SW_INSET_MAC_PPPOE_IPV6_UDP, ICE_INSET_NONE},
-	{pattern_eth_vlan_pppoes_ipv4,
-			ICE_SW_INSET_MAC_PPPOE_IPV4, ICE_INSET_NONE},
-	{pattern_eth_vlan_pppoes_ipv4_tcp,
-			ICE_SW_INSET_MAC_PPPOE_IPV4_TCP, ICE_INSET_NONE},
-	{pattern_eth_vlan_pppoes_ipv4_udp,
-			ICE_SW_INSET_MAC_PPPOE_IPV4_UDP, ICE_INSET_NONE},
-	{pattern_eth_vlan_pppoes_ipv6,
-			ICE_SW_INSET_MAC_PPPOE_IPV6, ICE_INSET_NONE},
-	{pattern_eth_vlan_pppoes_ipv6_tcp,
-			ICE_SW_INSET_MAC_PPPOE_IPV6_TCP, ICE_INSET_NONE},
-	{pattern_eth_vlan_pppoes_ipv6_udp,
-			ICE_SW_INSET_MAC_PPPOE_IPV6_UDP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_esp,
-			ICE_SW_INSET_MAC_IPV4_ESP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_esp,
-			ICE_SW_INSET_MAC_IPV4_ESP, ICE_INSET_NONE},
-	{pattern_eth_ipv6_esp,
-			ICE_SW_INSET_MAC_IPV6_ESP, ICE_INSET_NONE},
-	{pattern_eth_ipv6_udp_esp,
-			ICE_SW_INSET_MAC_IPV6_ESP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_ah,
-			ICE_SW_INSET_MAC_IPV4_AH, ICE_INSET_NONE},
-	{pattern_eth_ipv6_ah,
-			ICE_SW_INSET_MAC_IPV6_AH, ICE_INSET_NONE},
-	{pattern_eth_ipv6_udp_ah,
-			ICE_INSET_NONE, ICE_INSET_NONE},
-	{pattern_eth_ipv4_l2tp,
-			ICE_SW_INSET_MAC_IPV4_L2TP, ICE_INSET_NONE},
-	{pattern_eth_ipv6_l2tp,
-			ICE_SW_INSET_MAC_IPV6_L2TP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_pfcp,
-			ICE_INSET_NONE, ICE_INSET_NONE},
-	{pattern_eth_ipv6_pfcp,
-			ICE_INSET_NONE, ICE_INSET_NONE},
-	{pattern_eth_qinq_ipv4,
-			ICE_SW_INSET_MAC_QINQ_IPV4, ICE_INSET_NONE},
-	{pattern_eth_qinq_ipv6,
-			ICE_SW_INSET_MAC_QINQ_IPV6, ICE_INSET_NONE},
-	{pattern_eth_qinq_pppoes,
-			ICE_SW_INSET_MAC_PPPOE, ICE_INSET_NONE},
-	{pattern_eth_qinq_pppoes_proto,
-			ICE_SW_INSET_MAC_PPPOE_PROTO, ICE_INSET_NONE},
-	{pattern_eth_qinq_pppoes_ipv4,
-			ICE_SW_INSET_MAC_PPPOE_IPV4, ICE_INSET_NONE},
-	{pattern_eth_qinq_pppoes_ipv6,
-			ICE_SW_INSET_MAC_PPPOE_IPV6, 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_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},
 };
 
 static struct
 ice_pattern_match_item ice_switch_pattern_perm_list[] = {
-	{pattern_ethertype,
-			ICE_SW_INSET_ETHER, ICE_INSET_NONE},
-	{pattern_ethertype_vlan,
-			ICE_SW_INSET_MAC_VLAN, ICE_INSET_NONE},
-	{pattern_ethertype_qinq,
-			ICE_SW_INSET_MAC_QINQ, ICE_INSET_NONE},
-	{pattern_eth_arp,
-		ICE_INSET_NONE, ICE_INSET_NONE},
-	{pattern_eth_ipv4,
-			ICE_SW_INSET_MAC_IPV4, ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp,
-			ICE_SW_INSET_MAC_IPV4_UDP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_tcp,
-			ICE_SW_INSET_MAC_IPV4_TCP, ICE_INSET_NONE},
-	{pattern_eth_ipv6,
-			ICE_SW_INSET_MAC_IPV6, ICE_INSET_NONE},
-	{pattern_eth_ipv6_udp,
-			ICE_SW_INSET_MAC_IPV6_UDP, ICE_INSET_NONE},
-	{pattern_eth_ipv6_tcp,
-			ICE_SW_INSET_MAC_IPV6_TCP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_eth_ipv4,
-			ICE_SW_INSET_PERM_TUNNEL_IPV4, ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_udp,
-			ICE_SW_INSET_PERM_TUNNEL_IPV4_UDP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_vxlan_eth_ipv4_tcp,
-			ICE_SW_INSET_PERM_TUNNEL_IPV4_TCP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_nvgre_eth_ipv4,
-			ICE_SW_INSET_PERM_TUNNEL_IPV4, ICE_INSET_NONE},
-	{pattern_eth_ipv4_nvgre_eth_ipv4_udp,
-			ICE_SW_INSET_PERM_TUNNEL_IPV4_UDP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_nvgre_eth_ipv4_tcp,
-			ICE_SW_INSET_PERM_TUNNEL_IPV4_TCP, ICE_INSET_NONE},
-	{pattern_eth_pppoes,
-			ICE_SW_INSET_MAC_PPPOE, ICE_INSET_NONE},
-	{pattern_eth_vlan_pppoes,
-			ICE_SW_INSET_MAC_PPPOE, ICE_INSET_NONE},
-	{pattern_eth_pppoes_proto,
-			ICE_SW_INSET_MAC_PPPOE_PROTO, ICE_INSET_NONE},
-	{pattern_eth_vlan_pppoes_proto,
-			ICE_SW_INSET_MAC_PPPOE_PROTO, ICE_INSET_NONE},
-	{pattern_eth_pppoes_ipv4,
-			ICE_SW_INSET_MAC_PPPOE_IPV4, ICE_INSET_NONE},
-	{pattern_eth_pppoes_ipv4_tcp,
-			ICE_SW_INSET_MAC_PPPOE_IPV4_TCP, ICE_INSET_NONE},
-	{pattern_eth_pppoes_ipv4_udp,
-			ICE_SW_INSET_MAC_PPPOE_IPV4_UDP, ICE_INSET_NONE},
-	{pattern_eth_pppoes_ipv6,
-			ICE_SW_INSET_MAC_PPPOE_IPV6, ICE_INSET_NONE},
-	{pattern_eth_pppoes_ipv6_tcp,
-			ICE_SW_INSET_MAC_PPPOE_IPV6_TCP, ICE_INSET_NONE},
-	{pattern_eth_pppoes_ipv6_udp,
-			ICE_SW_INSET_MAC_PPPOE_IPV6_UDP, ICE_INSET_NONE},
-	{pattern_eth_vlan_pppoes_ipv4,
-			ICE_SW_INSET_MAC_PPPOE_IPV4, ICE_INSET_NONE},
-	{pattern_eth_vlan_pppoes_ipv4_tcp,
-			ICE_SW_INSET_MAC_PPPOE_IPV4_TCP, ICE_INSET_NONE},
-	{pattern_eth_vlan_pppoes_ipv4_udp,
-			ICE_SW_INSET_MAC_PPPOE_IPV4_UDP, ICE_INSET_NONE},
-	{pattern_eth_vlan_pppoes_ipv6,
-			ICE_SW_INSET_MAC_PPPOE_IPV6, ICE_INSET_NONE},
-	{pattern_eth_vlan_pppoes_ipv6_tcp,
-			ICE_SW_INSET_MAC_PPPOE_IPV6_TCP, ICE_INSET_NONE},
-	{pattern_eth_vlan_pppoes_ipv6_udp,
-			ICE_SW_INSET_MAC_PPPOE_IPV6_UDP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_esp,
-			ICE_SW_INSET_MAC_IPV4_ESP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_udp_esp,
-			ICE_SW_INSET_MAC_IPV4_ESP, ICE_INSET_NONE},
-	{pattern_eth_ipv6_esp,
-			ICE_SW_INSET_MAC_IPV6_ESP, ICE_INSET_NONE},
-	{pattern_eth_ipv6_udp_esp,
-			ICE_SW_INSET_MAC_IPV6_ESP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_ah,
-			ICE_SW_INSET_MAC_IPV4_AH, ICE_INSET_NONE},
-	{pattern_eth_ipv6_ah,
-			ICE_SW_INSET_MAC_IPV6_AH, ICE_INSET_NONE},
-	{pattern_eth_ipv6_udp_ah,
-			ICE_INSET_NONE, ICE_INSET_NONE},
-	{pattern_eth_ipv4_l2tp,
-			ICE_SW_INSET_MAC_IPV4_L2TP, ICE_INSET_NONE},
-	{pattern_eth_ipv6_l2tp,
-			ICE_SW_INSET_MAC_IPV6_L2TP, ICE_INSET_NONE},
-	{pattern_eth_ipv4_pfcp,
-			ICE_INSET_NONE, ICE_INSET_NONE},
-	{pattern_eth_ipv6_pfcp,
-			ICE_INSET_NONE, ICE_INSET_NONE},
-	{pattern_eth_qinq_ipv4,
-			ICE_SW_INSET_MAC_QINQ_IPV4, ICE_INSET_NONE},
-	{pattern_eth_qinq_ipv6,
-			ICE_SW_INSET_MAC_QINQ_IPV6, ICE_INSET_NONE},
-	{pattern_eth_qinq_pppoes,
-			ICE_SW_INSET_MAC_PPPOE, ICE_INSET_NONE},
-	{pattern_eth_qinq_pppoes_proto,
-			ICE_SW_INSET_MAC_PPPOE_PROTO, ICE_INSET_NONE},
-	{pattern_eth_qinq_pppoes_ipv4,
-			ICE_SW_INSET_MAC_PPPOE_IPV4, ICE_INSET_NONE},
-	{pattern_eth_qinq_pppoes_ipv6,
-			ICE_SW_INSET_MAC_PPPOE_IPV6, 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_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},
 };
 
 static int
@@ -1724,7 +1626,7 @@ ice_switch_parse_pattern_action(struct ice_adapter *ad,
 	inputset = ice_switch_inset_get
 		(pattern, error, list, &lkups_num, &tun_type);
 	if ((!inputset && !ice_is_profile_rule(tun_type)) ||
-		(inputset & ~pattern_match_item->input_set_mask)) {
+		(inputset & ~pattern_match_item->input_set_mask_o)) {
 		rte_flow_error_set(error, EINVAL,
 				   RTE_FLOW_ERROR_TYPE_ITEM_SPEC,
 				   pattern,
-- 
2.25.1


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

* [dpdk-dev] [PATCH v3 6/6] net/ice: clean GTPU flow_type for FDIR
  2021-03-02  2:54   ` [dpdk-dev] [PATCH v3 0/6] Refactor FDIR pattern parser Zhirun Yan
                       ` (4 preceding siblings ...)
  2021-03-02  2:54     ` [dpdk-dev] [PATCH v3 5/6] net/ice: add outer input set mask to distinguish outer fields Zhirun Yan
@ 2021-03-02  2:54     ` Zhirun Yan
  2021-03-05  8:46     ` [dpdk-dev] [PATCH v3 0/6] Refactor FDIR pattern parser Zhang, Qi Z
  6 siblings, 0 replies; 24+ messages in thread
From: Zhirun Yan @ 2021-03-02  2:54 UTC (permalink / raw)
  To: dev, qi.z.zhang, yahui.cao, xiao.w.wang, junfeng.guo
  Cc: simei.su, ting.xu, yuying.zhang, xuan.ding, Zhirun Yan

Currently, FDIR only support GTPU outer fields in PF. Clean the
redundant GTPU inner info in flow type definition and align with
shared code.

Signed-off-by: Zhirun Yan <zhirun.yan@intel.com>
Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
---
 drivers/net/ice/ice_fdir_filter.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c
index 72836fca6c..3af5812660 100644
--- a/drivers/net/ice/ice_fdir_filter.c
+++ b/drivers/net/ice/ice_fdir_filter.c
@@ -954,26 +954,23 @@ ice_fdir_input_set_hdrs(enum ice_fltr_ptype flow, struct ice_flow_seg_info *seg)
 		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_IPV6 |
 				  ICE_FLOW_SEG_HDR_IPV_OTHER);
 		break;
-	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_UDP:
-	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_TCP:
-	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_ICMP:
-	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER:
+	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU:
 		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_IP |
 				  ICE_FLOW_SEG_HDR_IPV4 |
 				  ICE_FLOW_SEG_HDR_IPV_OTHER);
 		break;
-	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_IPV4_OTHER:
+	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH:
 		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_EH |
 				  ICE_FLOW_SEG_HDR_GTPU_IP |
 				  ICE_FLOW_SEG_HDR_IPV4 |
 				  ICE_FLOW_SEG_HDR_IPV_OTHER);
 		break;
-	case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER:
+	case ICE_FLTR_PTYPE_NONF_IPV6_GTPU:
 		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_IP |
 				  ICE_FLOW_SEG_HDR_IPV6 |
 				  ICE_FLOW_SEG_HDR_IPV_OTHER);
 		break;
-	case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_EH_IPV6_OTHER:
+	case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_EH:
 		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_EH |
 				  ICE_FLOW_SEG_HDR_GTPU_IP |
 				  ICE_FLOW_SEG_HDR_IPV6 |
@@ -1958,16 +1955,16 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
 
 	if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU &&
 		flow_type == ICE_FLTR_PTYPE_NONF_IPV4_UDP)
-		flow_type = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER;
+		flow_type = ICE_FLTR_PTYPE_NONF_IPV4_GTPU;
 	else if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU_EH &&
 		flow_type == ICE_FLTR_PTYPE_NONF_IPV4_UDP)
-		flow_type = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_IPV4_OTHER;
+		flow_type = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH;
 	else if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU &&
 		flow_type == ICE_FLTR_PTYPE_NONF_IPV6_UDP)
-		flow_type = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER;
+		flow_type = ICE_FLTR_PTYPE_NONF_IPV6_GTPU;
 	else if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU_EH &&
 		flow_type == ICE_FLTR_PTYPE_NONF_IPV6_UDP)
-		flow_type = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_EH_IPV6_OTHER;
+		flow_type = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_EH;
 
 	filter->tunnel_type = tunnel_type;
 	filter->input.flow_type = flow_type;
-- 
2.25.1


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

* Re: [dpdk-dev] [PATCH v3 0/6] Refactor FDIR pattern parser
  2021-03-02  2:54   ` [dpdk-dev] [PATCH v3 0/6] Refactor FDIR pattern parser Zhirun Yan
                       ` (5 preceding siblings ...)
  2021-03-02  2:54     ` [dpdk-dev] [PATCH v3 6/6] net/ice: clean GTPU flow_type for FDIR Zhirun Yan
@ 2021-03-05  8:46     ` Zhang, Qi Z
  6 siblings, 0 replies; 24+ messages in thread
From: Zhang, Qi Z @ 2021-03-05  8:46 UTC (permalink / raw)
  To: Yan, Zhirun, dev, Cao, Yahui, Wang, Xiao W, Guo, Junfeng
  Cc: Su, Simei, Xu, Ting, Zhang, Yuying, Ding, Xuan



> -----Original Message-----
> From: Yan, Zhirun <zhirun.yan@intel.com>
> Sent: Tuesday, March 2, 2021 10:54 AM
> To: dev@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>; Cao, Yahui
> <yahui.cao@intel.com>; Wang, Xiao W <xiao.w.wang@intel.com>; Guo,
> Junfeng <junfeng.guo@intel.com>
> Cc: Su, Simei <simei.su@intel.com>; Xu, Ting <ting.xu@intel.com>; Zhang,
> Yuying <yuying.zhang@intel.com>; Ding, Xuan <xuan.ding@intel.com>; Yan,
> Zhirun <zhirun.yan@intel.com>
> Subject: [PATCH v3 0/6] Refactor FDIR pattern parser
> 
> V3:
> Clear the variable name of input_set_o and input_set_i.
> Use input_set_o for tunnerl outer or non-tunnel fields, let
> ice_pattern_match_item 3rd columns all none in ACL, RSS, switch.
> Add new patch to use seg_tun[1] to record tunnel inner part.
> Add new patch to clean GTPU inner flow type for PF.
> 
> 
> V2:
> 
> Meld patch 4,5 into 3.
> Update ACL input set.
> Clear PPPoE GTPU input set in RSS.
> Put p_v4/6 assignment earlier to reduce redundant code in FDIR.
> 
> 
> 
> 
> This patch set refactor FDIR pattern parser.
> 
> Redefine input set. Ignore the redundant inner/outer info.
> Align the parser action with hardware, using input_set_f for outer, input_set_l
> for inner or non-tunnel fields.
> Adjust indentation for easy review.
> Enable VXLAN inner/outer fields.
> 
> Zhirun Yan (6):
>   net/ice: clean input set macro definition
>   net/ice: refactor structure field
>   net/ice: refactor flow pattern parser
>   net/ice: refactor input set conf
>   net/ice: add outer input set mask to distinguish outer fields
>   net/ice: clean GTPU flow_type for FDIR
> 
>  drivers/net/ice/ice_acl_filter.c    |  10 +-
>  drivers/net/ice/ice_ethdev.h        |   4 +-
>  drivers/net/ice/ice_fdir_filter.c   | 590 ++++++++++++++--------------
>  drivers/net/ice/ice_generic_flow.c  |   6 +-
>  drivers/net/ice/ice_generic_flow.h  | 237 +++++------
>  drivers/net/ice/ice_hash.c          | 214 +++++-----
>  drivers/net/ice/ice_switch_filter.c | 296 +++++---------
>  7 files changed, 605 insertions(+), 752 deletions(-)
> 
> --
> 2.25.1


Acked-by: Qi Zhang <qi.z.zhang@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi

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

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

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-21  6:51 [dpdk-dev] [PATCH v1 0/5] Refactor FDIR pattern parser Zhirun Yan
2020-12-21  6:51 ` [dpdk-dev] [PATCH v1 1/5] net/ice: clean input set macro definition Zhirun Yan
2020-12-21  6:51 ` [dpdk-dev] [PATCH v1 2/5] net/ice: refactor flow pattern parser Zhirun Yan
2020-12-25  5:21   ` Cao, Yahui
2021-01-07  3:07     ` Yan, Zhirun
2020-12-21  6:51 ` [dpdk-dev] [PATCH v1 3/5] net/ice: add outer input set mask to distinguish outer fields Zhirun Yan
2020-12-25  5:27   ` Cao, Yahui
2021-01-07  3:11     ` Yan, Zhirun
2020-12-21  6:51 ` [dpdk-dev] [PATCH v1 4/5] net/ice: add outer input set mask check Zhirun Yan
2020-12-25  5:28   ` Cao, Yahui
2021-01-07  3:14     ` Yan, Zhirun
2020-12-21  6:51 ` [dpdk-dev] [PATCH v1 5/5] net/ice: enable FDIR outer/inner fields for VXLAN Zhirun Yan
2021-01-27  5:29 ` [dpdk-dev] [PATCH v2 0/3] Refactor FDIR pattern parser Zhirun Yan
2021-01-27  5:29   ` [dpdk-dev] [PATCH v2 1/3] net/ice: clean input set macro definition Zhirun Yan
2021-01-27  5:29   ` [dpdk-dev] [PATCH v2 2/3] net/ice: refactor flow pattern parser Zhirun Yan
2021-01-27  5:29   ` [dpdk-dev] [PATCH v2 3/3] net/ice: add outer input set mask to distinguish outer fields Zhirun Yan
2021-03-02  2:54   ` [dpdk-dev] [PATCH v3 0/6] Refactor FDIR pattern parser Zhirun Yan
2021-03-02  2:54     ` [dpdk-dev] [PATCH v3 1/6] net/ice: clean input set macro definition Zhirun Yan
2021-03-02  2:54     ` [dpdk-dev] [PATCH v3 2/6] net/ice: refactor structure field Zhirun Yan
2021-03-02  2:54     ` [dpdk-dev] [PATCH v3 3/6] net/ice: refactor flow pattern parser Zhirun Yan
2021-03-02  2:54     ` [dpdk-dev] [PATCH v3 4/6] net/ice: refactor input set conf Zhirun Yan
2021-03-02  2:54     ` [dpdk-dev] [PATCH v3 5/6] net/ice: add outer input set mask to distinguish outer fields Zhirun Yan
2021-03-02  2:54     ` [dpdk-dev] [PATCH v3 6/6] net/ice: clean GTPU flow_type for FDIR Zhirun Yan
2021-03-05  8:46     ` [dpdk-dev] [PATCH v3 0/6] Refactor FDIR pattern parser Zhang, Qi Z

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git