DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v1] net/ice: support GTPU TEID pattern for switch filter
@ 2021-03-18  8:48 Yuying
  2021-03-30  9:14 ` [dpdk-dev] [PATCH v2] " Yuying Zhang
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Yuying @ 2021-03-18  8:48 UTC (permalink / raw)
  To: dev, qi.z.zhang; +Cc: Yuying

Enable GTPU pattern for CVL switch filter. This patch only
supports outer l3/l4 filtering.

Signed-off-by: Yuying <yuying.zhang@intel.com>
---
 doc/guides/rel_notes/release_21_05.rst |  3 +
 drivers/net/ice/ice_switch_filter.c    | 91 ++++++++++++++++++++++++++
 2 files changed, 94 insertions(+)

diff --git a/doc/guides/rel_notes/release_21_05.rst b/doc/guides/rel_notes/release_21_05.rst
index 88e7607a08..8507dc948f 100644
--- a/doc/guides/rel_notes/release_21_05.rst
+++ b/doc/guides/rel_notes/release_21_05.rst
@@ -91,6 +91,9 @@ New Features
   * Added a command line option to configure forced speed for Ethernet port.
     ``dpdk-testpmd -c 0xff  -- -i  --eth-link-speed N``
 
+* **Updated Intel ice driver.**
+
+  * Added GTP TEID support for DCF switch filter.
 
 Removed Items
 -------------
diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c
index ada3ecf60b..9147a5fdbe 100644
--- a/drivers/net/ice/ice_switch_filter.c
+++ b/drivers/net/ice/ice_switch_filter.c
@@ -137,6 +137,17 @@
 #define ICE_SW_INSET_MAC_IPV6_PFCP ( \
 	ICE_SW_INSET_MAC_IPV6 | \
 	ICE_INSET_PFCP_S_FIELD | ICE_INSET_PFCP_SEID)
+#define ICE_SW_INSET_MAC_IPV4_GTPU ( \
+	ICE_SW_INSET_MAC_IPV4 | ICE_INSET_GTPU_TEID)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_EH ( \
+	ICE_SW_INSET_MAC_IPV4 | ICE_INSET_GTPU_TEID | \
+	ICE_INSET_GTPU_QFI)
+#define ICE_SW_INSET_MAC_IPV6_GTPU ( \
+	ICE_SW_INSET_MAC_IPV6 | ICE_INSET_GTPU_TEID)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_EH ( \
+	ICE_SW_INSET_MAC_IPV6 | ICE_INSET_GTPU_TEID | \
+	ICE_INSET_GTPU_QFI)
+
 
 struct sw_meta {
 	struct ice_adv_lkup_elem *list;
@@ -198,6 +209,10 @@ ice_pattern_match_item ice_switch_pattern_dist_list[] = {
 	{pattern_eth_qinq_pppoes_proto,			ICE_SW_INSET_MAC_PPPOE_PROTO,		ICE_INSET_NONE,	ICE_INSET_NONE},
 	{pattern_eth_qinq_pppoes_ipv4,			ICE_SW_INSET_MAC_PPPOE_IPV4,		ICE_INSET_NONE,	ICE_INSET_NONE},
 	{pattern_eth_qinq_pppoes_ipv6,			ICE_SW_INSET_MAC_PPPOE_IPV6,		ICE_INSET_NONE,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu,				ICE_SW_INSET_MAC_IPV4_GTPU,		ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh,			ICE_SW_INSET_MAC_IPV4_GTPU_EH,		ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu,				ICE_SW_INSET_MAC_IPV6_GTPU,		ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh,			ICE_SW_INSET_MAC_IPV6_GTPU_EH,		ICE_INSET_NONE, ICE_INSET_NONE},
 };
 
 static struct
@@ -251,6 +266,10 @@ ice_pattern_match_item ice_switch_pattern_perm_list[] = {
 	{pattern_eth_qinq_pppoes_proto,			ICE_SW_INSET_MAC_PPPOE_PROTO,		ICE_INSET_NONE,	ICE_INSET_NONE},
 	{pattern_eth_qinq_pppoes_ipv4,			ICE_SW_INSET_MAC_PPPOE_IPV4,		ICE_INSET_NONE,	ICE_INSET_NONE},
 	{pattern_eth_qinq_pppoes_ipv6,			ICE_SW_INSET_MAC_PPPOE_IPV6,		ICE_INSET_NONE,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu,				ICE_SW_INSET_MAC_IPV4_GTPU,		ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh,			ICE_SW_INSET_MAC_IPV4_GTPU_EH,		ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu,				ICE_SW_INSET_MAC_IPV6_GTPU,		ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh,			ICE_SW_INSET_MAC_IPV6_GTPU_EH,		ICE_INSET_NONE, ICE_INSET_NONE},
 };
 
 static int
@@ -378,6 +397,8 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
 	const struct rte_flow_item_ah *ah_spec, *ah_mask;
 	const struct rte_flow_item_l2tpv3oip *l2tp_spec, *l2tp_mask;
 	const struct rte_flow_item_pfcp *pfcp_spec, *pfcp_mask;
+	const struct rte_flow_item_gtp *gtp_spec, *gtp_mask;
+	const struct rte_flow_item_gtp_psc *gtp_psc_spec, *gtp_psc_mask;
 	uint64_t input_set = ICE_INSET_NONE;
 	uint16_t input_set_byte = 0;
 	bool pppoe_elem_valid = 0;
@@ -1255,6 +1276,76 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
 			}
 			break;
 
+		case RTE_FLOW_ITEM_TYPE_GTPU:
+			gtp_spec = item->spec;
+			gtp_mask = item->mask;
+			if (gtp_spec && !gtp_mask) {
+				rte_flow_error_set(error, EINVAL,
+					RTE_FLOW_ERROR_TYPE_ITEM,
+					item,
+					"Invalid GTPU item");
+				return 0;
+			}
+			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,
+						RTE_FLOW_ERROR_TYPE_ITEM,
+						item,
+						"Invalid GTPU mask");
+					return 0;
+				}
+				if (gtp_mask->teid)
+					input_set |= ICE_INSET_GTPU_TEID;
+				list[t].type = ICE_GTP;
+				list[t].h_u.gtp_hdr.teid =
+					gtp_spec->teid;
+				list[t].m_u.gtp_hdr.teid =
+					gtp_mask->teid;
+				input_set_byte += 4;
+				t++;
+			}
+			if (ipv4_valid)
+				*tun_type = ICE_SW_TUN_GTP_IPV4;
+			else if (ipv6_valid)
+				*tun_type = ICE_SW_TUN_GTP_IPV6;
+			break;
+
+		case RTE_FLOW_ITEM_TYPE_GTP_PSC:
+			gtp_psc_spec = item->spec;
+			gtp_psc_mask = item->mask;
+			if (gtp_psc_spec && !gtp_psc_mask) {
+				rte_flow_error_set(error, EINVAL,
+					RTE_FLOW_ERROR_TYPE_ITEM,
+					item,
+					"Invalid GTPU_EH item");
+				return 0;
+			}
+			if (gtp_psc_spec && gtp_psc_mask) {
+				if (gtp_psc_mask->pdu_type) {
+					rte_flow_error_set(error, EINVAL,
+						RTE_FLOW_ERROR_TYPE_ITEM,
+						item,
+						"Invalid GTPU_EH mask");
+					return 0;
+				}
+				if (gtp_psc_mask->qfi)
+					input_set |= ICE_INSET_GTPU_QFI;
+				list[t].type = ICE_GTP;
+				list[t].h_u.gtp_hdr.qfi =
+					gtp_psc_spec->qfi;
+				list[t].m_u.gtp_hdr.qfi =
+					gtp_psc_mask->qfi;
+				input_set_byte += 1;
+				t++;
+			}
+			if (ipv4_valid)
+				*tun_type = ICE_SW_TUN_GTP_IPV4_EH;
+			else if (ipv6_valid)
+				*tun_type = ICE_SW_TUN_GTP_IPV6_EH;
+			break;
+
 		case RTE_FLOW_ITEM_TYPE_VOID:
 			break;
 
-- 
2.25.1


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

* [dpdk-dev] [PATCH v2] net/ice: support GTPU TEID pattern for switch filter
  2021-03-18  8:48 [dpdk-dev] [PATCH v1] net/ice: support GTPU TEID pattern for switch filter Yuying
@ 2021-03-30  9:14 ` Yuying Zhang
  2021-04-07  5:15 ` [dpdk-dev] [PATCH v3] " Yuying Zhang
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Yuying Zhang @ 2021-03-30  9:14 UTC (permalink / raw)
  To: dev, qi.z.zhang, yuying.zhang

Enable GTPU pattern for CVL switch filter. Support teid and
qfi field of GTPU pattern. Patterns without inner l3/l4 field
support outer dst/src ip. Patterns with inner l3/l4 field only
support inner dst/src ip and inner dst/src port.

+-----------------------------------+-------------------------------------+
| Pattern                           | Input Set                           |
+-----------------------------------+-------------------------------------+
| pattern_eth_ipv4_gtpu             | teid, dst/src ip                    |
| pattern_eth_ipv6_gtpu             | teid, dst/src ip                    |
| pattern_eth_ipv4_gtpu_ipv4        | teid, dst/src ip                    |
| pattern_eth_ipv4_gtpu_ipv4_tcp    | teid, dst/src ip, dst/src port      |
| pattern_eth_ipv4_gtpu_ipv4_udp    | teid, dst/src ip, dst/src port      |
| pattern_eth_ipv4_gtpu_ipv6        | teid, dst/src ip                    |
| pattern_eth_ipv4_gtpu_ipv6_tcp    | teid, dst/src ip, dst/src port      |
| pattern_eth_ipv4_gtpu_ipv6_udp    | teid, dst/src ip, dst/src port      |
| pattern_eth_ipv6_gtpu_ipv4        | teid, dst/src ip                    |
| pattern_eth_ipv6_gtpu_ipv4_tcp    | teid, dst/src ip, dst/src port      |
| pattern_eth_ipv6_gtpu_ipv4_udp    | teid, dst/src ip, dst/src port      |
| pattern_eth_ipv6_gtpu_ipv6        | teid, dst/src ip                    |
| pattern_eth_ipv6_gtpu_ipv6_tcp    | teid, dst/src ip, dst/src port      |
| pattern_eth_ipv6_gtpu_ipv6_udp    | teid, dst/src ip, dst/src port      |
| pattern_eth_ipv4_gtpu_eh_ipv4     | teid, qfi, dst/src ip               |
| pattern_eth_ipv4_gtpu_eh_ipv4_tcp | teid, qfi, dst/src ip, dst/src port |
| pattern_eth_ipv4_gtpu_eh_ipv4_udp | teid, qfi, dst/src ip, dst/src port |
| pattern_eth_ipv4_gtpu_eh_ipv6     | teid, qfi, dst/src ip               |
| pattern_eth_ipv4_gtpu_eh_ipv6_tcp | teid, qfi, dst/src ip, dst/src port |
| pattern_eth_ipv4_gtpu_eh_ipv6_udp | teid, qfi, dst/src ip, dst/src port |
| pattern_eth_ipv6_gtpu_eh_ipv4     | teid, qfi, dst/src ip               |
| pattern_eth_ipv6_gtpu_eh_ipv4_tcp | teid, qfi, dst/src ip, dst/src port |
| pattern_eth_ipv6_gtpu_eh_ipv4_udp | teid, qfi, dst/src ip, dst/src port |
| pattern_eth_ipv6_gtpu_eh_ipv6     | teid, qfi, dst/src ip               |
| pattern_eth_ipv6_gtpu_eh_ipv6_tcp | teid, qfi, dst/src ip, dst/src port |
| pattern_eth_ipv6_gtpu_eh_ipv6_udp | teid, qfi, dst/src ip, dst/src port |
+-----------------------------------+-------------------------------------+

Signed-off-by: Yuying Zhang <yuying.zhang@intel.com>
---
 doc/guides/rel_notes/release_21_05.rst   |   4 +
 drivers/net/ice/base/ice_protocol_type.h |  28 ++-
 drivers/net/ice/base/ice_switch.c        | 184 +++++++++++++-
 drivers/net/ice/ice_switch_filter.c      | 298 ++++++++++++++++++++++-
 4 files changed, 492 insertions(+), 22 deletions(-)

diff --git a/doc/guides/rel_notes/release_21_05.rst b/doc/guides/rel_notes/release_21_05.rst
index d1785c706f..e4ed0acb85 100644
--- a/doc/guides/rel_notes/release_21_05.rst
+++ b/doc/guides/rel_notes/release_21_05.rst
@@ -136,6 +136,10 @@ New Features
 
   * Added flow filter to support GTPU inner L3/L4 fields matching.
 
+* **Updated Intel ice driver.**
+
+  * Added GTP TEID support for DCF switch filter.
+
 
 Removed Items
 -------------
diff --git a/drivers/net/ice/base/ice_protocol_type.h b/drivers/net/ice/base/ice_protocol_type.h
index ee1f29d41f..077f411ebe 100644
--- a/drivers/net/ice/base/ice_protocol_type.h
+++ b/drivers/net/ice/base/ice_protocol_type.h
@@ -75,6 +75,30 @@ enum ice_sw_tunnel_type {
 	ICE_SW_TUN_GTP,
 	ICE_SW_TUN_IPV4_GTPU_NO_PAY,
 	ICE_SW_TUN_IPV6_GTPU_NO_PAY,
+	ICE_SW_TUN_IPV4_GTPU_IPV4,
+	ICE_SW_TUN_IPV4_GTPU_EH_IPV4,
+	ICE_SW_TUN_IPV4_GTPU_IPV4_UDP,
+	ICE_SW_TUN_IPV4_GTPU_EH_IPV4_UDP,
+	ICE_SW_TUN_IPV4_GTPU_IPV4_TCP,
+	ICE_SW_TUN_IPV4_GTPU_EH_IPV4_TCP,
+	ICE_SW_TUN_IPV4_GTPU_IPV6,
+	ICE_SW_TUN_IPV4_GTPU_EH_IPV6,
+	ICE_SW_TUN_IPV4_GTPU_IPV6_UDP,
+	ICE_SW_TUN_IPV4_GTPU_EH_IPV6_UDP,
+	ICE_SW_TUN_IPV4_GTPU_IPV6_TCP,
+	ICE_SW_TUN_IPV4_GTPU_EH_IPV6_TCP,
+	ICE_SW_TUN_IPV6_GTPU_IPV4,
+	ICE_SW_TUN_IPV6_GTPU_EH_IPV4,
+	ICE_SW_TUN_IPV6_GTPU_IPV4_UDP,
+	ICE_SW_TUN_IPV6_GTPU_EH_IPV4_UDP,
+	ICE_SW_TUN_IPV6_GTPU_IPV4_TCP,
+	ICE_SW_TUN_IPV6_GTPU_EH_IPV4_TCP,
+	ICE_SW_TUN_IPV6_GTPU_IPV6,
+	ICE_SW_TUN_IPV6_GTPU_EH_IPV6,
+	ICE_SW_TUN_IPV6_GTPU_IPV6_UDP,
+	ICE_SW_TUN_IPV6_GTPU_EH_IPV6_UDP,
+	ICE_SW_TUN_IPV6_GTPU_IPV6_TCP,
+	ICE_SW_TUN_IPV6_GTPU_EH_IPV6_TCP,
 	ICE_SW_TUN_PPPOE,
 	ICE_SW_TUN_PPPOE_PAY,
 	ICE_SW_TUN_PPPOE_IPV4,
@@ -105,10 +129,6 @@ enum ice_sw_tunnel_type {
 	ICE_SW_TUN_PPPOE_PAY_QINQ,
 	ICE_SW_TUN_PPPOE_IPV4_QINQ,
 	ICE_SW_TUN_PPPOE_IPV6_QINQ,
-	ICE_SW_TUN_IPV4_GTPU_IPV4,
-	ICE_SW_TUN_IPV4_GTPU_IPV6,
-	ICE_SW_TUN_IPV6_GTPU_IPV4,
-	ICE_SW_TUN_IPV6_GTPU_IPV6,
 	ICE_ALL_TUNNELS /* All tunnel types including NVGRE */
 };
 
diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c
index 3dc764266b..0090020a78 100644
--- a/drivers/net/ice/base/ice_switch.c
+++ b/drivers/net/ice/base/ice_switch.c
@@ -6522,7 +6522,7 @@ static const struct ice_prot_ext_tbl_entry ice_prot_ext[ICE_PROTOCOL_LAST] = {
 	{ ICE_GENEVE,		{ 8, 10, 12, 14 } },
 	{ ICE_VXLAN_GPE,	{ 8, 10, 12, 14 } },
 	{ ICE_NVGRE,		{ 0, 2, 4, 6 } },
-	{ ICE_GTP,		{ 8, 10, 12, 14, 16, 18, 20 } },
+	{ ICE_GTP,		{ 8, 10, 12, 14, 16, 18, 20, 22 } },
 	{ ICE_PPPOE,		{ 0, 2, 4, 6 } },
 	{ ICE_PFCP,		{ 8, 10, 12, 14, 16, 18, 20, 22 } },
 	{ ICE_L2TPV3,		{ 0, 2, 4, 6, 8, 10 } },
@@ -7442,38 +7442,100 @@ ice_get_compat_fv_bitmap(struct ice_hw *hw, struct ice_adv_rule_info *rinfo,
 	case ICE_SW_IPV6_UDP:
 		ice_set_bit(ICE_PROFID_IPV6_UDP, bm);
 		return;
+	case ICE_SW_TUN_IPV4_GTPU_NO_PAY:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_TEID, bm);
+		return;
+	case ICE_SW_TUN_IPV6_GTPU_NO_PAY:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_TEID, bm);
+		return;
 	case ICE_SW_TUN_IPV4_GTPU_IPV4:
-		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV4_OTHER, bm);
 		ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV4_OTHER, bm);
-		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV4_UDP, bm);
 		ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV4_UDP, bm);
-		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV4_TCP, bm);
 		ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV4_TCP, bm);
 		return;
+	case ICE_SW_TUN_IPV4_GTPU_IPV4_UDP:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV4_UDP, bm);
+		return;
+	case ICE_SW_TUN_IPV4_GTPU_IPV4_TCP:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV4_TCP, bm);
+		return;
+	case ICE_SW_TUN_IPV4_GTPU_EH_IPV4:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV4_OTHER, bm);
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV4_UDP, bm);
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV4_TCP, bm);
+		return;
+	case ICE_SW_TUN_IPV4_GTPU_EH_IPV4_UDP:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV4_UDP, bm);
+		return;
+	case ICE_SW_TUN_IPV4_GTPU_EH_IPV4_TCP:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV4_TCP, bm);
+		return;
 	case ICE_SW_TUN_IPV6_GTPU_IPV4:
-		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV4_OTHER, bm);
 		ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV4_OTHER, bm);
-		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV4_UDP, bm);
 		ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV4_UDP, bm);
-		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV4_TCP, bm);
 		ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV4_TCP, bm);
 		return;
+	case ICE_SW_TUN_IPV6_GTPU_IPV4_UDP:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV4_UDP, bm);
+		return;
+	case ICE_SW_TUN_IPV6_GTPU_IPV4_TCP:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV4_TCP, bm);
+		return;
+	case ICE_SW_TUN_IPV6_GTPU_EH_IPV4:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV4_OTHER, bm);
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV4_UDP, bm);
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV4_TCP, bm);
+		return;
+	case ICE_SW_TUN_IPV6_GTPU_EH_IPV4_UDP:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV4_UDP, bm);
+		return;
+	case ICE_SW_TUN_IPV6_GTPU_EH_IPV4_TCP:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV4_TCP, bm);
+		return;
 	case ICE_SW_TUN_IPV4_GTPU_IPV6:
-		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV6_OTHER, bm);
 		ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV6_OTHER, bm);
-		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV6_UDP, bm);
 		ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV6_UDP, bm);
-		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV6_TCP, bm);
 		ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV6_TCP, bm);
 		return;
+	case ICE_SW_TUN_IPV4_GTPU_IPV6_UDP:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV6_UDP, bm);
+		return;
+	case ICE_SW_TUN_IPV4_GTPU_IPV6_TCP:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV6_TCP, bm);
+		return;
+	case ICE_SW_TUN_IPV4_GTPU_EH_IPV6:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV6_OTHER, bm);
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV6_UDP, bm);
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV6_TCP, bm);
+		return;
+	case ICE_SW_TUN_IPV4_GTPU_EH_IPV6_UDP:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV6_UDP, bm);
+		return;
+	case ICE_SW_TUN_IPV4_GTPU_EH_IPV6_TCP:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV6_TCP, bm);
+		return;
 	case ICE_SW_TUN_IPV6_GTPU_IPV6:
-		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV6_OTHER, bm);
 		ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV6_OTHER, bm);
-		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV6_UDP, bm);
 		ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV6_UDP, bm);
-		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV6_TCP, bm);
 		ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV6_TCP, bm);
 		return;
+	case ICE_SW_TUN_IPV6_GTPU_IPV6_UDP:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV6_UDP, bm);
+		return;
+	case ICE_SW_TUN_IPV6_GTPU_IPV6_TCP:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV6_TCP, bm);
+		return;
+	case ICE_SW_TUN_IPV6_GTPU_EH_IPV6:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV6_OTHER, bm);
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV6_UDP, bm);
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV6_TCP, bm);
+		return;
+	case ICE_SW_TUN_IPV6_GTPU_EH_IPV6_UDP:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV6_UDP, bm);
+		return;
+	case ICE_SW_TUN_IPV6_GTPU_EH_IPV6_TCP:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV6_TCP, bm);
+		return;
 	case ICE_SW_TUN_AND_NON_TUN:
 	case ICE_SW_TUN_AND_NON_TUN_QINQ:
 	default:
@@ -7872,6 +7934,102 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,
 		return;
 	}
 
+	if (tun_type == ICE_SW_TUN_IPV4_GTPU_IPV4 ||
+	    tun_type == ICE_SW_TUN_IPV4_GTPU_EH_IPV4) {
+		*pkt = dummy_ipv4_gtpu_ipv4_packet;
+		*pkt_len = sizeof(dummy_ipv4_gtpu_ipv4_packet);
+		*offsets = dummy_ipv4_gtpu_ipv4_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV4_GTPU_IPV4_UDP ||
+	    tun_type == ICE_SW_TUN_IPV4_GTPU_EH_IPV4_UDP) {
+		*pkt = dummy_ipv4_gtpu_ipv4_udp_packet;
+		*pkt_len = sizeof(dummy_ipv4_gtpu_ipv4_udp_packet);
+		*offsets = dummy_ipv4_gtpu_ipv4_udp_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV4_GTPU_IPV4_TCP ||
+	    tun_type == ICE_SW_TUN_IPV4_GTPU_EH_IPV4_TCP) {
+		*pkt = dummy_ipv4_gtpu_ipv4_tcp_packet;
+		*pkt_len = sizeof(dummy_ipv4_gtpu_ipv4_tcp_packet);
+		*offsets = dummy_ipv4_gtpu_ipv4_tcp_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV4_GTPU_IPV6 ||
+	    tun_type == ICE_SW_TUN_IPV4_GTPU_EH_IPV6) {
+		*pkt = dummy_ipv4_gtpu_ipv6_packet;
+		*pkt_len = sizeof(dummy_ipv4_gtpu_ipv6_packet);
+		*offsets = dummy_ipv4_gtpu_ipv6_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV4_GTPU_IPV6_UDP ||
+	    tun_type == ICE_SW_TUN_IPV4_GTPU_EH_IPV6_UDP) {
+		*pkt = dummy_ipv4_gtpu_ipv6_udp_packet;
+		*pkt_len = sizeof(dummy_ipv4_gtpu_ipv6_udp_packet);
+		*offsets = dummy_ipv4_gtpu_ipv6_udp_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV4_GTPU_IPV6_TCP ||
+	    tun_type == ICE_SW_TUN_IPV4_GTPU_EH_IPV6_TCP) {
+		*pkt = dummy_ipv4_gtpu_ipv6_tcp_packet;
+		*pkt_len = sizeof(dummy_ipv4_gtpu_ipv6_tcp_packet);
+		*offsets = dummy_ipv4_gtpu_ipv6_tcp_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV6_GTPU_IPV4 ||
+	    tun_type == ICE_SW_TUN_IPV6_GTPU_EH_IPV4) {
+		*pkt = dummy_ipv6_gtpu_ipv4_packet;
+		*pkt_len = sizeof(dummy_ipv6_gtpu_ipv4_packet);
+		*offsets = dummy_ipv6_gtpu_ipv4_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV6_GTPU_IPV4_UDP ||
+	    tun_type == ICE_SW_TUN_IPV6_GTPU_EH_IPV4_UDP) {
+		*pkt = dummy_ipv6_gtpu_ipv4_udp_packet;
+		*pkt_len = sizeof(dummy_ipv6_gtpu_ipv4_udp_packet);
+		*offsets = dummy_ipv6_gtpu_ipv4_udp_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV6_GTPU_IPV4_TCP ||
+	    tun_type == ICE_SW_TUN_IPV6_GTPU_EH_IPV4_TCP) {
+		*pkt = dummy_ipv6_gtpu_ipv4_tcp_packet;
+		*pkt_len = sizeof(dummy_ipv6_gtpu_ipv4_tcp_packet);
+		*offsets = dummy_ipv6_gtpu_ipv4_tcp_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV6_GTPU_IPV6 ||
+	    tun_type == ICE_SW_TUN_IPV6_GTPU_EH_IPV6) {
+		*pkt = dummy_ipv6_gtpu_ipv6_packet;
+		*pkt_len = sizeof(dummy_ipv6_gtpu_ipv6_packet);
+		*offsets = dummy_ipv6_gtpu_ipv6_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV6_GTPU_IPV6_UDP ||
+	    tun_type == ICE_SW_TUN_IPV6_GTPU_EH_IPV6_UDP) {
+		*pkt = dummy_ipv6_gtpu_ipv6_udp_packet;
+		*pkt_len = sizeof(dummy_ipv6_gtpu_ipv6_udp_packet);
+		*offsets = dummy_ipv6_gtpu_ipv6_udp_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV6_GTPU_IPV6_TCP ||
+	    tun_type == ICE_SW_TUN_IPV6_GTPU_EH_IPV6_TCP) {
+		*pkt = dummy_ipv6_gtpu_ipv6_tcp_packet;
+		*pkt_len = sizeof(dummy_ipv6_gtpu_ipv6_tcp_packet);
+		*offsets = dummy_ipv6_gtpu_ipv6_tcp_packet_offsets;
+		return;
+	}
+
 	if (tun_type == ICE_SW_TUN_PPPOE && ipv6) {
 		*pkt = dummy_pppoe_ipv6_packet;
 		*pkt_len = sizeof(dummy_pppoe_ipv6_packet);
diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c
index ada3ecf60b..27d5bcc325 100644
--- a/drivers/net/ice/ice_switch_filter.c
+++ b/drivers/net/ice/ice_switch_filter.c
@@ -137,6 +137,84 @@
 #define ICE_SW_INSET_MAC_IPV6_PFCP ( \
 	ICE_SW_INSET_MAC_IPV6 | \
 	ICE_INSET_PFCP_S_FIELD | ICE_INSET_PFCP_SEID)
+#define ICE_SW_INSET_MAC_IPV4_GTPU ( \
+	ICE_SW_INSET_MAC_IPV4 | ICE_INSET_GTPU_TEID)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_EH ( \
+	ICE_SW_INSET_MAC_IPV4 | ICE_INSET_GTPU_TEID | \
+	ICE_INSET_GTPU_QFI)
+#define ICE_SW_INSET_MAC_IPV6_GTPU ( \
+	ICE_SW_INSET_MAC_IPV6 | ICE_INSET_GTPU_TEID)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_EH ( \
+	ICE_SW_INSET_MAC_IPV6 | ICE_INSET_GTPU_TEID | \
+	ICE_INSET_GTPU_QFI)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_IPV4 ( \
+	ICE_INSET_DMAC | ICE_INSET_GTPU_TEID | \
+	ICE_INSET_TUN_IPV4_SRC | ICE_INSET_TUN_IPV4_DST)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4 ( \
+	ICE_SW_INSET_MAC_IPV4_GTPU_IPV4 | ICE_INSET_GTPU_QFI)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_IPV6 ( \
+	ICE_INSET_DMAC | ICE_INSET_GTPU_TEID | \
+	ICE_INSET_TUN_IPV6_SRC | ICE_INSET_TUN_IPV6_DST)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6 ( \
+	ICE_SW_INSET_MAC_IPV4_GTPU_IPV6 | ICE_INSET_GTPU_QFI)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_IPV4 ( \
+	ICE_INSET_DMAC | ICE_INSET_GTPU_TEID | \
+	ICE_INSET_TUN_IPV4_SRC | ICE_INSET_TUN_IPV4_DST)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4 ( \
+	ICE_SW_INSET_MAC_IPV6_GTPU_IPV4 | ICE_INSET_GTPU_QFI)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_IPV6 ( \
+	ICE_INSET_DMAC | ICE_INSET_GTPU_TEID | \
+	ICE_INSET_TUN_IPV6_SRC | ICE_INSET_TUN_IPV6_DST)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6 ( \
+	ICE_SW_INSET_MAC_IPV6_GTPU_IPV6 | ICE_INSET_GTPU_QFI)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_IPV4_UDP ( \
+	ICE_SW_INSET_MAC_IPV4_GTPU_IPV4 | \
+	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4_UDP ( \
+	ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4 | \
+	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_IPV4_TCP ( \
+	ICE_SW_INSET_MAC_IPV4_GTPU_IPV4 | \
+	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4_TCP ( \
+	ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4 | \
+	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_IPV6_UDP ( \
+	ICE_SW_INSET_MAC_IPV4_GTPU_IPV6 | \
+	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6_UDP ( \
+	ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6 | \
+	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_IPV6_TCP ( \
+	ICE_SW_INSET_MAC_IPV4_GTPU_IPV6 | \
+	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6_TCP ( \
+	ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6 | \
+	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_IPV4_UDP ( \
+	ICE_SW_INSET_MAC_IPV6_GTPU_IPV4 | \
+	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4_UDP ( \
+	ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4 | \
+	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_IPV4_TCP ( \
+	ICE_SW_INSET_MAC_IPV6_GTPU_IPV4 | \
+	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4_TCP ( \
+	ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4 | \
+	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_IPV6_UDP ( \
+	ICE_SW_INSET_MAC_IPV6_GTPU_IPV6 | \
+	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6_UDP ( \
+	ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6 | \
+	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_IPV6_TCP ( \
+	ICE_SW_INSET_MAC_IPV6_GTPU_IPV6 | \
+	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6_TCP ( \
+	ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6 | \
+	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT)
 
 struct sw_meta {
 	struct ice_adv_lkup_elem *list;
@@ -198,6 +276,34 @@ ice_pattern_match_item ice_switch_pattern_dist_list[] = {
 	{pattern_eth_qinq_pppoes_proto,			ICE_SW_INSET_MAC_PPPOE_PROTO,		ICE_INSET_NONE,	ICE_INSET_NONE},
 	{pattern_eth_qinq_pppoes_ipv4,			ICE_SW_INSET_MAC_PPPOE_IPV4,		ICE_INSET_NONE,	ICE_INSET_NONE},
 	{pattern_eth_qinq_pppoes_ipv6,			ICE_SW_INSET_MAC_PPPOE_IPV6,		ICE_INSET_NONE,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu,				ICE_SW_INSET_MAC_IPV4_GTPU,		ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh,			ICE_SW_INSET_MAC_IPV4_GTPU_EH,		ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu,				ICE_SW_INSET_MAC_IPV6_GTPU,		ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh,			ICE_SW_INSET_MAC_IPV6_GTPU_EH,		ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv4,			ICE_SW_INSET_MAC_IPV4_GTPU_IPV4,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv4,			ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv4_udp,		ICE_SW_INSET_MAC_IPV4_GTPU_IPV4_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv4_udp,		ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv4_tcp,		ICE_SW_INSET_MAC_IPV4_GTPU_IPV4_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv4_tcp,		ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv6,			ICE_SW_INSET_MAC_IPV4_GTPU_IPV6,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv6,			ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv6_udp,		ICE_SW_INSET_MAC_IPV4_GTPU_IPV6_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv6_udp,		ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv6_tcp,		ICE_SW_INSET_MAC_IPV4_GTPU_IPV6_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv6_tcp,		ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv4,			ICE_SW_INSET_MAC_IPV6_GTPU_IPV4,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv4,			ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv4_udp,		ICE_SW_INSET_MAC_IPV6_GTPU_IPV4_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv4_udp,		ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv4_tcp,		ICE_SW_INSET_MAC_IPV6_GTPU_IPV4_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv4_tcp,		ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv6,			ICE_SW_INSET_MAC_IPV6_GTPU_IPV6,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv6,			ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv6_udp,		ICE_SW_INSET_MAC_IPV6_GTPU_IPV6_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv6_udp,		ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv6_tcp,		ICE_SW_INSET_MAC_IPV6_GTPU_IPV6_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv6_tcp,		ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
 };
 
 static struct
@@ -251,6 +357,34 @@ ice_pattern_match_item ice_switch_pattern_perm_list[] = {
 	{pattern_eth_qinq_pppoes_proto,			ICE_SW_INSET_MAC_PPPOE_PROTO,		ICE_INSET_NONE,	ICE_INSET_NONE},
 	{pattern_eth_qinq_pppoes_ipv4,			ICE_SW_INSET_MAC_PPPOE_IPV4,		ICE_INSET_NONE,	ICE_INSET_NONE},
 	{pattern_eth_qinq_pppoes_ipv6,			ICE_SW_INSET_MAC_PPPOE_IPV6,		ICE_INSET_NONE,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu,				ICE_SW_INSET_MAC_IPV4_GTPU,		ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh,			ICE_SW_INSET_MAC_IPV4_GTPU_EH,		ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu,				ICE_SW_INSET_MAC_IPV6_GTPU,		ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh,			ICE_SW_INSET_MAC_IPV6_GTPU_EH,		ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv4,			ICE_SW_INSET_MAC_IPV4_GTPU_IPV4,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv4,			ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv4_udp,		ICE_SW_INSET_MAC_IPV4_GTPU_IPV4_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv4_udp,		ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv4_tcp,		ICE_SW_INSET_MAC_IPV4_GTPU_IPV4_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv4_tcp,		ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv6,			ICE_SW_INSET_MAC_IPV4_GTPU_IPV6,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv6,			ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv6_udp,		ICE_SW_INSET_MAC_IPV4_GTPU_IPV6_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv6_udp,		ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv6_tcp,		ICE_SW_INSET_MAC_IPV4_GTPU_IPV6_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv6_tcp,		ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv4,			ICE_SW_INSET_MAC_IPV6_GTPU_IPV4,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv4,			ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv4_udp,		ICE_SW_INSET_MAC_IPV6_GTPU_IPV4_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv4_udp,		ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv4_tcp,		ICE_SW_INSET_MAC_IPV6_GTPU_IPV4_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv4_tcp,		ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv6,			ICE_SW_INSET_MAC_IPV6_GTPU_IPV6,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv6,			ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv6_udp,		ICE_SW_INSET_MAC_IPV6_GTPU_IPV6_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv6_udp,		ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv6_tcp,		ICE_SW_INSET_MAC_IPV6_GTPU_IPV6_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv6_tcp,		ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
 };
 
 static int
@@ -378,6 +512,8 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
 	const struct rte_flow_item_ah *ah_spec, *ah_mask;
 	const struct rte_flow_item_l2tpv3oip *l2tp_spec, *l2tp_mask;
 	const struct rte_flow_item_pfcp *pfcp_spec, *pfcp_mask;
+	const struct rte_flow_item_gtp *gtp_spec, *gtp_mask;
+	const struct rte_flow_item_gtp_psc *gtp_psc_spec, *gtp_psc_mask;
 	uint64_t input_set = ICE_INSET_NONE;
 	uint16_t input_set_byte = 0;
 	bool pppoe_elem_valid = 0;
@@ -393,7 +529,13 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
 	bool ipv4_valid = 0;
 	bool udp_valid = 0;
 	bool tcp_valid = 0;
-	uint16_t j, t = 0;
+	bool gtpu_valid = 0;
+	bool gtpu_psc_valid = 0;
+	bool inner_ipv4_valid = 0;
+	bool inner_ipv6_valid = 0;
+	bool inner_tcp_valid = 0;
+	bool inner_udp_valid = 0;
+	uint16_t j, k, t = 0;
 
 	for (item = pattern; item->type !=
 			RTE_FLOW_ITEM_TYPE_END; item++) {
@@ -479,7 +621,11 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
 		case RTE_FLOW_ITEM_TYPE_IPV4:
 			ipv4_spec = item->spec;
 			ipv4_mask = item->mask;
-			ipv4_valid = 1;
+			if (tunnel_valid)
+				inner_ipv4_valid = 1;
+			else
+				ipv4_valid = 1;
+
 			if (ipv4_spec && ipv4_mask) {
 				/* Check IPv4 mask and update input set */
 				if (ipv4_mask->hdr.version_ihl ||
@@ -571,7 +717,10 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
 		case RTE_FLOW_ITEM_TYPE_IPV6:
 			ipv6_spec = item->spec;
 			ipv6_mask = item->mask;
-			ipv6_valid = 1;
+			if (tunnel_valid)
+				inner_ipv6_valid = 1;
+			else
+				ipv6_valid = 1;
 			if (ipv6_spec && ipv6_mask) {
 				if (ipv6_mask->hdr.payload_len) {
 					rte_flow_error_set(error, EINVAL,
@@ -689,7 +838,10 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
 		case RTE_FLOW_ITEM_TYPE_UDP:
 			udp_spec = item->spec;
 			udp_mask = item->mask;
-			udp_valid = 1;
+			if (tunnel_valid)
+				inner_udp_valid = 1;
+			else
+				udp_valid = 1;
 			if (udp_spec && udp_mask) {
 				/* Check UDP mask and update input set*/
 				if (udp_mask->hdr.dgram_len ||
@@ -742,7 +894,10 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
 		case RTE_FLOW_ITEM_TYPE_TCP:
 			tcp_spec = item->spec;
 			tcp_mask = item->mask;
-			tcp_valid = 1;
+			if (tunnel_valid)
+				inner_tcp_valid = 1;
+			else
+				tcp_valid = 1;
 			if (tcp_spec && tcp_mask) {
 				/* Check TCP mask and update input set */
 				if (tcp_mask->hdr.sent_seq ||
@@ -1255,6 +1410,71 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
 			}
 			break;
 
+		case RTE_FLOW_ITEM_TYPE_GTPU:
+			gtp_spec = item->spec;
+			gtp_mask = item->mask;
+			if (gtp_spec && !gtp_mask) {
+				rte_flow_error_set(error, EINVAL,
+					RTE_FLOW_ERROR_TYPE_ITEM,
+					item,
+					"Invalid GTP item");
+				return 0;
+			}
+			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,
+						RTE_FLOW_ERROR_TYPE_ITEM,
+						item,
+						"Invalid GTP mask");
+					return 0;
+				}
+				if (gtp_mask->teid)
+					input_set |= ICE_INSET_GTPU_TEID;
+				list[t].type = ICE_GTP;
+				list[t].h_u.gtp_hdr.teid =
+					gtp_spec->teid;
+				list[t].m_u.gtp_hdr.teid =
+					gtp_mask->teid;
+				input_set_byte += 4;
+				t++;
+			}
+			tunnel_valid = 1;
+			gtpu_valid = 1;
+			break;
+
+		case RTE_FLOW_ITEM_TYPE_GTP_PSC:
+			gtp_psc_spec = item->spec;
+			gtp_psc_mask = item->mask;
+			if (gtp_psc_spec && !gtp_psc_mask) {
+				rte_flow_error_set(error, EINVAL,
+					RTE_FLOW_ERROR_TYPE_ITEM,
+					item,
+					"Invalid GTPU_EH item");
+				return 0;
+			}
+			if (gtp_psc_spec && gtp_psc_mask) {
+				if (gtp_psc_mask->pdu_type) {
+					rte_flow_error_set(error, EINVAL,
+						RTE_FLOW_ERROR_TYPE_ITEM,
+						item,
+						"Invalid GTPU_EH mask");
+					return 0;
+				}
+				if (gtp_psc_mask->qfi)
+					input_set |= ICE_INSET_GTPU_QFI;
+				list[t].type = ICE_GTP;
+				list[t].h_u.gtp_hdr.qfi =
+					gtp_psc_spec->qfi;
+				list[t].m_u.gtp_hdr.qfi =
+					gtp_psc_mask->qfi;
+				input_set_byte += 1;
+				t++;
+			}
+			gtpu_psc_valid = 1;
+			break;
+
 		case RTE_FLOW_ITEM_TYPE_VOID:
 			break;
 
@@ -1302,6 +1522,74 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
 			*tun_type = ICE_SW_TUN_PPPOE;
 	}
 
+	if (gtpu_valid && gtpu_psc_valid) {
+		if (ipv4_valid && inner_ipv4_valid && inner_udp_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_EH_IPV4_UDP;
+		else if (ipv4_valid && inner_ipv4_valid && inner_tcp_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_EH_IPV4_TCP;
+		else if (ipv4_valid && inner_ipv4_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_EH_IPV4;
+		else if (ipv4_valid && inner_ipv6_valid && inner_udp_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_EH_IPV6_UDP;
+		else if (ipv4_valid && inner_ipv6_valid && inner_tcp_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_EH_IPV6_TCP;
+		else if (ipv4_valid && inner_ipv6_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_EH_IPV6;
+		else if (ipv6_valid && inner_ipv4_valid && inner_udp_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_EH_IPV4_UDP;
+		else if (ipv6_valid && inner_ipv4_valid && inner_tcp_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_EH_IPV4_TCP;
+		else if (ipv6_valid && inner_ipv4_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_EH_IPV4;
+		else if (ipv6_valid && inner_ipv6_valid && inner_udp_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_EH_IPV6_UDP;
+		else if (ipv6_valid && inner_ipv6_valid && inner_tcp_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_EH_IPV6_TCP;
+		else if (ipv6_valid && inner_ipv6_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_EH_IPV6;
+		else if (ipv4_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_NO_PAY;
+		else if (ipv6_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_NO_PAY;
+	} else if (gtpu_valid) {
+		if (ipv4_valid && inner_ipv4_valid && inner_udp_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_IPV4_UDP;
+		else if (ipv4_valid && inner_ipv4_valid && inner_tcp_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_IPV4_TCP;
+		else if (ipv4_valid && inner_ipv4_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_IPV4;
+		else if (ipv4_valid && inner_ipv6_valid && inner_udp_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_IPV6_UDP;
+		else if (ipv4_valid && inner_ipv6_valid && inner_tcp_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_IPV6_TCP;
+		else if (ipv4_valid && inner_ipv6_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_IPV6;
+		else if (ipv6_valid && inner_ipv4_valid && inner_udp_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_IPV4_UDP;
+		else if (ipv6_valid && inner_ipv4_valid && inner_tcp_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_IPV4_TCP;
+		else if (ipv6_valid && inner_ipv4_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_IPV4;
+		else if (ipv6_valid && inner_ipv6_valid && inner_udp_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_IPV6_UDP;
+		else if (ipv6_valid && inner_ipv6_valid && inner_tcp_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_IPV6_TCP;
+		else if (ipv6_valid && inner_ipv6_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_IPV6;
+		else if (ipv4_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_NO_PAY;
+		else if (ipv6_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_NO_PAY;
+	}
+
+	if (*tun_type == ICE_SW_TUN_IPV4_GTPU_NO_PAY ||
+	    *tun_type == ICE_SW_TUN_IPV6_GTPU_NO_PAY) {
+		for (k = 0; k < t; k++) {
+			if (list[k].type == ICE_GTP)
+				list[k].type = ICE_GTP_NO_PAY;
+		}
+	}
+
 	if (*tun_type == ICE_NON_TUN) {
 		if (vxlan_valid)
 			*tun_type = ICE_SW_TUN_VXLAN;
-- 
2.25.1


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

* [dpdk-dev] [PATCH v3] net/ice: support GTPU TEID pattern for switch filter
  2021-03-18  8:48 [dpdk-dev] [PATCH v1] net/ice: support GTPU TEID pattern for switch filter Yuying
  2021-03-30  9:14 ` [dpdk-dev] [PATCH v2] " Yuying Zhang
@ 2021-04-07  5:15 ` Yuying Zhang
  2021-04-15  7:35 ` [dpdk-dev] [PATCH v4] " Yuying Zhang
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Yuying Zhang @ 2021-04-07  5:15 UTC (permalink / raw)
  To: dev, qi.z.zhang; +Cc: Yuying Zhang

Enable GTPU pattern for CVL switch filter. Support teid and
qfi field of GTPU pattern. Patterns without inner l3/l4 field
support outer dst/src ip. Patterns with inner l3/l4 field only
support inner dst/src ip and inner dst/src port.

+-----------------------------------+-------------------------------------+
| Pattern                           | Input Set                           |
+-----------------------------------+-------------------------------------+
| pattern_eth_ipv4_gtpu             | teid, dst/src ip                    |
| pattern_eth_ipv6_gtpu             | teid, dst/src ip                    |
| pattern_eth_ipv4_gtpu_ipv4        | teid, dst/src ip                    |
| pattern_eth_ipv4_gtpu_ipv4_tcp    | teid, dst/src ip, dst/src port      |
| pattern_eth_ipv4_gtpu_ipv4_udp    | teid, dst/src ip, dst/src port      |
| pattern_eth_ipv4_gtpu_ipv6        | teid, dst/src ip                    |
| pattern_eth_ipv4_gtpu_ipv6_tcp    | teid, dst/src ip, dst/src port      |
| pattern_eth_ipv4_gtpu_ipv6_udp    | teid, dst/src ip, dst/src port      |
| pattern_eth_ipv6_gtpu_ipv4        | teid, dst/src ip                    |
| pattern_eth_ipv6_gtpu_ipv4_tcp    | teid, dst/src ip, dst/src port      |
| pattern_eth_ipv6_gtpu_ipv4_udp    | teid, dst/src ip, dst/src port      |
| pattern_eth_ipv6_gtpu_ipv6        | teid, dst/src ip                    |
| pattern_eth_ipv6_gtpu_ipv6_tcp    | teid, dst/src ip, dst/src port      |
| pattern_eth_ipv6_gtpu_ipv6_udp    | teid, dst/src ip, dst/src port      |
| pattern_eth_ipv4_gtpu_eh_ipv4     | teid, qfi, dst/src ip               |
| pattern_eth_ipv4_gtpu_eh_ipv4_tcp | teid, qfi, dst/src ip, dst/src port |
| pattern_eth_ipv4_gtpu_eh_ipv4_udp | teid, qfi, dst/src ip, dst/src port |
| pattern_eth_ipv4_gtpu_eh_ipv6     | teid, qfi, dst/src ip               |
| pattern_eth_ipv4_gtpu_eh_ipv6_tcp | teid, qfi, dst/src ip, dst/src port |
| pattern_eth_ipv4_gtpu_eh_ipv6_udp | teid, qfi, dst/src ip, dst/src port |
| pattern_eth_ipv6_gtpu_eh_ipv4     | teid, qfi, dst/src ip               |
| pattern_eth_ipv6_gtpu_eh_ipv4_tcp | teid, qfi, dst/src ip, dst/src port |
| pattern_eth_ipv6_gtpu_eh_ipv4_udp | teid, qfi, dst/src ip, dst/src port |
| pattern_eth_ipv6_gtpu_eh_ipv6     | teid, qfi, dst/src ip               |
| pattern_eth_ipv6_gtpu_eh_ipv6_tcp | teid, qfi, dst/src ip, dst/src port |
| pattern_eth_ipv6_gtpu_eh_ipv6_udp | teid, qfi, dst/src ip, dst/src port |
+-----------------------------------+-------------------------------------+

Signed-off-by: Yuying Zhang <yuying.zhang@intel.com>
---
 doc/guides/rel_notes/release_21_05.rst   |   4 +
 drivers/net/ice/base/ice_protocol_type.h |  28 ++-
 drivers/net/ice/base/ice_switch.c        | 275 ++++++++++++++++++++--
 drivers/net/ice/ice_switch_filter.c      | 288 ++++++++++++++++++++++-
 4 files changed, 571 insertions(+), 24 deletions(-)

diff --git a/doc/guides/rel_notes/release_21_05.rst b/doc/guides/rel_notes/release_21_05.rst
index 873140b433..e738283a67 100644
--- a/doc/guides/rel_notes/release_21_05.rst
+++ b/doc/guides/rel_notes/release_21_05.rst
@@ -97,6 +97,10 @@ New Features
 
   * Added flow filter to support GTPU inner L3/L4 fields matching.
 
+* **Updated Intel ice driver.**
+
+  * Added GTP TEID support for DCF switch filter.
+
 * **Updated NXP DPAA driver.**
 
   * Added support for shared ethernet interface.
diff --git a/drivers/net/ice/base/ice_protocol_type.h b/drivers/net/ice/base/ice_protocol_type.h
index ee1f29d41f..077f411ebe 100644
--- a/drivers/net/ice/base/ice_protocol_type.h
+++ b/drivers/net/ice/base/ice_protocol_type.h
@@ -75,6 +75,30 @@ enum ice_sw_tunnel_type {
 	ICE_SW_TUN_GTP,
 	ICE_SW_TUN_IPV4_GTPU_NO_PAY,
 	ICE_SW_TUN_IPV6_GTPU_NO_PAY,
+	ICE_SW_TUN_IPV4_GTPU_IPV4,
+	ICE_SW_TUN_IPV4_GTPU_EH_IPV4,
+	ICE_SW_TUN_IPV4_GTPU_IPV4_UDP,
+	ICE_SW_TUN_IPV4_GTPU_EH_IPV4_UDP,
+	ICE_SW_TUN_IPV4_GTPU_IPV4_TCP,
+	ICE_SW_TUN_IPV4_GTPU_EH_IPV4_TCP,
+	ICE_SW_TUN_IPV4_GTPU_IPV6,
+	ICE_SW_TUN_IPV4_GTPU_EH_IPV6,
+	ICE_SW_TUN_IPV4_GTPU_IPV6_UDP,
+	ICE_SW_TUN_IPV4_GTPU_EH_IPV6_UDP,
+	ICE_SW_TUN_IPV4_GTPU_IPV6_TCP,
+	ICE_SW_TUN_IPV4_GTPU_EH_IPV6_TCP,
+	ICE_SW_TUN_IPV6_GTPU_IPV4,
+	ICE_SW_TUN_IPV6_GTPU_EH_IPV4,
+	ICE_SW_TUN_IPV6_GTPU_IPV4_UDP,
+	ICE_SW_TUN_IPV6_GTPU_EH_IPV4_UDP,
+	ICE_SW_TUN_IPV6_GTPU_IPV4_TCP,
+	ICE_SW_TUN_IPV6_GTPU_EH_IPV4_TCP,
+	ICE_SW_TUN_IPV6_GTPU_IPV6,
+	ICE_SW_TUN_IPV6_GTPU_EH_IPV6,
+	ICE_SW_TUN_IPV6_GTPU_IPV6_UDP,
+	ICE_SW_TUN_IPV6_GTPU_EH_IPV6_UDP,
+	ICE_SW_TUN_IPV6_GTPU_IPV6_TCP,
+	ICE_SW_TUN_IPV6_GTPU_EH_IPV6_TCP,
 	ICE_SW_TUN_PPPOE,
 	ICE_SW_TUN_PPPOE_PAY,
 	ICE_SW_TUN_PPPOE_IPV4,
@@ -105,10 +129,6 @@ enum ice_sw_tunnel_type {
 	ICE_SW_TUN_PPPOE_PAY_QINQ,
 	ICE_SW_TUN_PPPOE_IPV4_QINQ,
 	ICE_SW_TUN_PPPOE_IPV6_QINQ,
-	ICE_SW_TUN_IPV4_GTPU_IPV4,
-	ICE_SW_TUN_IPV4_GTPU_IPV6,
-	ICE_SW_TUN_IPV6_GTPU_IPV4,
-	ICE_SW_TUN_IPV6_GTPU_IPV6,
 	ICE_ALL_TUNNELS /* All tunnel types including NVGRE */
 };
 
diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c
index 3dc764266b..20e2e6188c 100644
--- a/drivers/net/ice/base/ice_switch.c
+++ b/drivers/net/ice/base/ice_switch.c
@@ -1123,6 +1123,7 @@ static const u8 dummy_udp_gtp_packet[] = {
 
 	0x02, 0x00, 0x00, 0x00, /* PDU Session extension header */
 	0x00, 0x00, 0x00, 0x00,
+
 };
 
 static const struct ice_dummy_pkt_offsets dummy_ipv4_gtp_no_pay_packet_offsets[] = {
@@ -1142,6 +1143,32 @@ struct ice_dummy_pkt_offsets dummy_ipv6_gtp_no_pay_packet_offsets[] = {
 	{ ICE_PROTOCOL_LAST,	0 },
 };
 
+static const u8 dummy_ipv6_gtp_packet[] = {
+	0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x86, 0xdd,
+
+	0x60, 0x00, 0x00, 0x00, /* ICE_IPV6_OFOS 14 */
+	0x00, 0x6c, 0x11, 0x00, /* Next header UDP*/
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+
+	0x08, 0x68, 0x08, 0x68, /* ICE_UDP_OF 54 */
+	0x00, 0x00, 0x00, 0x00,
+
+	0x30, 0x00, 0x00, 0x28,  /* ICE_GTP 62 */
+	0x00, 0x00, 0x00, 0x00,
+
+	0x00, 0x00,
+};
+
 static const struct ice_dummy_pkt_offsets dummy_pppoe_packet_offsets[] = {
 	{ ICE_MAC_OFOS,		0 },
 	{ ICE_ETYPE_OL,		12 },
@@ -1873,15 +1900,75 @@ static enum ice_sw_tunnel_type ice_get_tun_type_for_recipe(u8 rid, bool vlan)
 		if (ice_is_bit_set(recipe_to_profile[rid],
 				   ICE_PROFID_IPV4_GTPU_IPV4_OTHER))
 			tun_type = ICE_SW_TUN_IPV4_GTPU_IPV4;
+		else if (ice_is_bit_set(recipe_to_profile[rid],
+					ICE_PROFID_IPV4_GTPU_IPV4_UDP))
+			tun_type = ICE_SW_TUN_IPV4_GTPU_IPV4_UDP;
+		else if (ice_is_bit_set(recipe_to_profile[rid],
+					ICE_PROFID_IPV4_GTPU_IPV4_TCP))
+			tun_type = ICE_SW_TUN_IPV4_GTPU_IPV4_TCP;
+		else if (ice_is_bit_set(recipe_to_profile[rid],
+					ICE_PROFID_IPV4_GTPU_EH_IPV4_OTHER))
+			tun_type = ICE_SW_TUN_IPV4_GTPU_EH_IPV4;
+		else if (ice_is_bit_set(recipe_to_profile[rid],
+					ICE_PROFID_IPV4_GTPU_EH_IPV4_UDP))
+			tun_type = ICE_SW_TUN_IPV4_GTPU_EH_IPV4_UDP;
+		else if (ice_is_bit_set(recipe_to_profile[rid],
+					ICE_PROFID_IPV4_GTPU_EH_IPV4_TCP))
+			tun_type = ICE_SW_TUN_IPV4_GTPU_EH_IPV4_TCP;
 		else if (ice_is_bit_set(recipe_to_profile[rid],
 					ICE_PROFID_IPV4_GTPU_IPV6_OTHER))
 			tun_type = ICE_SW_TUN_IPV4_GTPU_IPV6;
+		else if (ice_is_bit_set(recipe_to_profile[rid],
+					ICE_PROFID_IPV4_GTPU_IPV6_UDP))
+			tun_type = ICE_SW_TUN_IPV4_GTPU_IPV6_UDP;
+		else if (ice_is_bit_set(recipe_to_profile[rid],
+					ICE_PROFID_IPV4_GTPU_IPV6_TCP))
+			tun_type = ICE_SW_TUN_IPV4_GTPU_IPV6_TCP;
+		else if (ice_is_bit_set(recipe_to_profile[rid],
+					ICE_PROFID_IPV4_GTPU_EH_IPV6_OTHER))
+			tun_type = ICE_SW_TUN_IPV4_GTPU_EH_IPV6;
+		else if (ice_is_bit_set(recipe_to_profile[rid],
+					ICE_PROFID_IPV4_GTPU_EH_IPV6_UDP))
+			tun_type = ICE_SW_TUN_IPV4_GTPU_EH_IPV6_UDP;
+		else if (ice_is_bit_set(recipe_to_profile[rid],
+					ICE_PROFID_IPV4_GTPU_EH_IPV6_TCP))
+			tun_type = ICE_SW_TUN_IPV4_GTPU_EH_IPV6_TCP;
 		else if (ice_is_bit_set(recipe_to_profile[rid],
 					ICE_PROFID_IPV6_GTPU_IPV4_OTHER))
 			tun_type = ICE_SW_TUN_IPV6_GTPU_IPV4;
+		else if (ice_is_bit_set(recipe_to_profile[rid],
+					ICE_PROFID_IPV6_GTPU_IPV4_UDP))
+			tun_type = ICE_SW_TUN_IPV6_GTPU_IPV4_UDP;
+		else if (ice_is_bit_set(recipe_to_profile[rid],
+					ICE_PROFID_IPV6_GTPU_IPV4_TCP))
+			tun_type = ICE_SW_TUN_IPV6_GTPU_IPV4_TCP;
+		else if (ice_is_bit_set(recipe_to_profile[rid],
+					ICE_PROFID_IPV6_GTPU_EH_IPV4_OTHER))
+			tun_type = ICE_SW_TUN_IPV6_GTPU_EH_IPV4;
+		else if (ice_is_bit_set(recipe_to_profile[rid],
+					ICE_PROFID_IPV6_GTPU_EH_IPV4_UDP))
+			tun_type = ICE_SW_TUN_IPV6_GTPU_EH_IPV4_UDP;
+		else if (ice_is_bit_set(recipe_to_profile[rid],
+					ICE_PROFID_IPV6_GTPU_EH_IPV4_TCP))
+			tun_type = ICE_SW_TUN_IPV6_GTPU_EH_IPV4_TCP;
 		else if (ice_is_bit_set(recipe_to_profile[rid],
 					ICE_PROFID_IPV6_GTPU_IPV6_OTHER))
 			tun_type = ICE_SW_TUN_IPV6_GTPU_IPV6;
+		else if (ice_is_bit_set(recipe_to_profile[rid],
+					ICE_PROFID_IPV6_GTPU_IPV6_UDP))
+			tun_type = ICE_SW_TUN_IPV6_GTPU_IPV6_UDP;
+		else if (ice_is_bit_set(recipe_to_profile[rid],
+					ICE_PROFID_IPV6_GTPU_IPV6_TCP))
+			tun_type = ICE_SW_TUN_IPV6_GTPU_IPV6_TCP;
+		else if (ice_is_bit_set(recipe_to_profile[rid],
+					ICE_PROFID_IPV6_GTPU_EH_IPV6_OTHER))
+			tun_type = ICE_SW_TUN_IPV6_GTPU_EH_IPV6;
+		else if (ice_is_bit_set(recipe_to_profile[rid],
+					ICE_PROFID_IPV6_GTPU_EH_IPV6_UDP))
+			tun_type = ICE_SW_TUN_IPV6_GTPU_EH_IPV6_UDP;
+		else if (ice_is_bit_set(recipe_to_profile[rid],
+					ICE_PROFID_IPV6_GTPU_EH_IPV6_TCP))
+			tun_type = ICE_SW_TUN_IPV6_GTPU_EH_IPV6_TCP;
 	}
 
 	if (profile_num == 1 && (flag_valid || non_tun_valid || pppoe_valid)) {
@@ -6522,7 +6609,7 @@ static const struct ice_prot_ext_tbl_entry ice_prot_ext[ICE_PROTOCOL_LAST] = {
 	{ ICE_GENEVE,		{ 8, 10, 12, 14 } },
 	{ ICE_VXLAN_GPE,	{ 8, 10, 12, 14 } },
 	{ ICE_NVGRE,		{ 0, 2, 4, 6 } },
-	{ ICE_GTP,		{ 8, 10, 12, 14, 16, 18, 20 } },
+	{ ICE_GTP,		{ 8, 10, 12, 14, 16, 18, 20, 22 } },
 	{ ICE_PPPOE,		{ 0, 2, 4, 6 } },
 	{ ICE_PFCP,		{ 8, 10, 12, 14, 16, 18, 20, 22 } },
 	{ ICE_L2TPV3,		{ 0, 2, 4, 6, 8, 10 } },
@@ -7442,38 +7529,100 @@ ice_get_compat_fv_bitmap(struct ice_hw *hw, struct ice_adv_rule_info *rinfo,
 	case ICE_SW_IPV6_UDP:
 		ice_set_bit(ICE_PROFID_IPV6_UDP, bm);
 		return;
+	case ICE_SW_TUN_IPV4_GTPU_NO_PAY:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_TEID, bm);
+		return;
+	case ICE_SW_TUN_IPV6_GTPU_NO_PAY:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_TEID, bm);
+		return;
 	case ICE_SW_TUN_IPV4_GTPU_IPV4:
-		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV4_OTHER, bm);
 		ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV4_OTHER, bm);
-		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV4_UDP, bm);
 		ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV4_UDP, bm);
-		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV4_TCP, bm);
 		ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV4_TCP, bm);
 		return;
+	case ICE_SW_TUN_IPV4_GTPU_IPV4_UDP:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV4_UDP, bm);
+		return;
+	case ICE_SW_TUN_IPV4_GTPU_IPV4_TCP:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV4_TCP, bm);
+		return;
+	case ICE_SW_TUN_IPV4_GTPU_EH_IPV4:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV4_OTHER, bm);
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV4_UDP, bm);
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV4_TCP, bm);
+		return;
+	case ICE_SW_TUN_IPV4_GTPU_EH_IPV4_UDP:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV4_UDP, bm);
+		return;
+	case ICE_SW_TUN_IPV4_GTPU_EH_IPV4_TCP:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV4_TCP, bm);
+		return;
 	case ICE_SW_TUN_IPV6_GTPU_IPV4:
-		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV4_OTHER, bm);
 		ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV4_OTHER, bm);
-		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV4_UDP, bm);
 		ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV4_UDP, bm);
-		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV4_TCP, bm);
 		ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV4_TCP, bm);
 		return;
+	case ICE_SW_TUN_IPV6_GTPU_IPV4_UDP:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV4_UDP, bm);
+		return;
+	case ICE_SW_TUN_IPV6_GTPU_IPV4_TCP:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV4_TCP, bm);
+		return;
+	case ICE_SW_TUN_IPV6_GTPU_EH_IPV4:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV4_OTHER, bm);
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV4_UDP, bm);
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV4_TCP, bm);
+		return;
+	case ICE_SW_TUN_IPV6_GTPU_EH_IPV4_UDP:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV4_UDP, bm);
+		return;
+	case ICE_SW_TUN_IPV6_GTPU_EH_IPV4_TCP:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV4_TCP, bm);
+		return;
 	case ICE_SW_TUN_IPV4_GTPU_IPV6:
-		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV6_OTHER, bm);
 		ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV6_OTHER, bm);
-		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV6_UDP, bm);
 		ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV6_UDP, bm);
-		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV6_TCP, bm);
 		ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV6_TCP, bm);
 		return;
+	case ICE_SW_TUN_IPV4_GTPU_IPV6_UDP:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV6_UDP, bm);
+		return;
+	case ICE_SW_TUN_IPV4_GTPU_IPV6_TCP:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV6_TCP, bm);
+		return;
+	case ICE_SW_TUN_IPV4_GTPU_EH_IPV6:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV6_OTHER, bm);
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV6_UDP, bm);
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV6_TCP, bm);
+		return;
+	case ICE_SW_TUN_IPV4_GTPU_EH_IPV6_UDP:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV6_UDP, bm);
+		return;
+	case ICE_SW_TUN_IPV4_GTPU_EH_IPV6_TCP:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV6_TCP, bm);
+		return;
 	case ICE_SW_TUN_IPV6_GTPU_IPV6:
-		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV6_OTHER, bm);
 		ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV6_OTHER, bm);
-		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV6_UDP, bm);
 		ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV6_UDP, bm);
-		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV6_TCP, bm);
 		ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV6_TCP, bm);
 		return;
+	case ICE_SW_TUN_IPV6_GTPU_IPV6_UDP:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV6_UDP, bm);
+		return;
+	case ICE_SW_TUN_IPV6_GTPU_IPV6_TCP:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV6_TCP, bm);
+		return;
+	case ICE_SW_TUN_IPV6_GTPU_EH_IPV6:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV6_OTHER, bm);
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV6_UDP, bm);
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV6_TCP, bm);
+		return;
+	case ICE_SW_TUN_IPV6_GTPU_EH_IPV6_UDP:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV6_UDP, bm);
+		return;
+	case ICE_SW_TUN_IPV6_GTPU_EH_IPV6_TCP:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV6_TCP, bm);
+		return;
 	case ICE_SW_TUN_AND_NON_TUN:
 	case ICE_SW_TUN_AND_NON_TUN_QINQ:
 	default:
@@ -7803,8 +7952,8 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,
 		*offsets = dummy_ipv4_gtp_no_pay_packet_offsets;
 		return;
 	} else if (tun_type == ICE_SW_TUN_IPV6_GTPU_NO_PAY) {
-		*pkt = dummy_ipv6_gtpu_ipv6_packet;
-		*pkt_len = sizeof(dummy_ipv6_gtpu_ipv6_packet);
+		*pkt = dummy_ipv6_gtp_packet;
+		*pkt_len = sizeof(dummy_ipv6_gtp_packet);
 		*offsets = dummy_ipv6_gtp_no_pay_packet_offsets;
 		return;
 	}
@@ -7872,6 +8021,102 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,
 		return;
 	}
 
+	if (tun_type == ICE_SW_TUN_IPV4_GTPU_IPV4 ||
+	    tun_type == ICE_SW_TUN_IPV4_GTPU_EH_IPV4) {
+		*pkt = dummy_ipv4_gtpu_ipv4_packet;
+		*pkt_len = sizeof(dummy_ipv4_gtpu_ipv4_packet);
+		*offsets = dummy_ipv4_gtpu_ipv4_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV4_GTPU_IPV4_UDP ||
+	    tun_type == ICE_SW_TUN_IPV4_GTPU_EH_IPV4_UDP) {
+		*pkt = dummy_ipv4_gtpu_ipv4_udp_packet;
+		*pkt_len = sizeof(dummy_ipv4_gtpu_ipv4_udp_packet);
+		*offsets = dummy_ipv4_gtpu_ipv4_udp_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV4_GTPU_IPV4_TCP ||
+	    tun_type == ICE_SW_TUN_IPV4_GTPU_EH_IPV4_TCP) {
+		*pkt = dummy_ipv4_gtpu_ipv4_tcp_packet;
+		*pkt_len = sizeof(dummy_ipv4_gtpu_ipv4_tcp_packet);
+		*offsets = dummy_ipv4_gtpu_ipv4_tcp_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV4_GTPU_IPV6 ||
+	    tun_type == ICE_SW_TUN_IPV4_GTPU_EH_IPV6) {
+		*pkt = dummy_ipv4_gtpu_ipv6_packet;
+		*pkt_len = sizeof(dummy_ipv4_gtpu_ipv6_packet);
+		*offsets = dummy_ipv4_gtpu_ipv6_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV4_GTPU_IPV6_UDP ||
+	    tun_type == ICE_SW_TUN_IPV4_GTPU_EH_IPV6_UDP) {
+		*pkt = dummy_ipv4_gtpu_ipv6_udp_packet;
+		*pkt_len = sizeof(dummy_ipv4_gtpu_ipv6_udp_packet);
+		*offsets = dummy_ipv4_gtpu_ipv6_udp_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV4_GTPU_IPV6_TCP ||
+	    tun_type == ICE_SW_TUN_IPV4_GTPU_EH_IPV6_TCP) {
+		*pkt = dummy_ipv4_gtpu_ipv6_tcp_packet;
+		*pkt_len = sizeof(dummy_ipv4_gtpu_ipv6_tcp_packet);
+		*offsets = dummy_ipv4_gtpu_ipv6_tcp_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV6_GTPU_IPV4 ||
+	    tun_type == ICE_SW_TUN_IPV6_GTPU_EH_IPV4) {
+		*pkt = dummy_ipv6_gtpu_ipv4_packet;
+		*pkt_len = sizeof(dummy_ipv6_gtpu_ipv4_packet);
+		*offsets = dummy_ipv6_gtpu_ipv4_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV6_GTPU_IPV4_UDP ||
+	    tun_type == ICE_SW_TUN_IPV6_GTPU_EH_IPV4_UDP) {
+		*pkt = dummy_ipv6_gtpu_ipv4_udp_packet;
+		*pkt_len = sizeof(dummy_ipv6_gtpu_ipv4_udp_packet);
+		*offsets = dummy_ipv6_gtpu_ipv4_udp_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV6_GTPU_IPV4_TCP ||
+	    tun_type == ICE_SW_TUN_IPV6_GTPU_EH_IPV4_TCP) {
+		*pkt = dummy_ipv6_gtpu_ipv4_tcp_packet;
+		*pkt_len = sizeof(dummy_ipv6_gtpu_ipv4_tcp_packet);
+		*offsets = dummy_ipv6_gtpu_ipv4_tcp_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV6_GTPU_IPV6 ||
+	    tun_type == ICE_SW_TUN_IPV6_GTPU_EH_IPV6) {
+		*pkt = dummy_ipv6_gtpu_ipv6_packet;
+		*pkt_len = sizeof(dummy_ipv6_gtpu_ipv6_packet);
+		*offsets = dummy_ipv6_gtpu_ipv6_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV6_GTPU_IPV6_UDP ||
+	    tun_type == ICE_SW_TUN_IPV6_GTPU_EH_IPV6_UDP) {
+		*pkt = dummy_ipv6_gtpu_ipv6_udp_packet;
+		*pkt_len = sizeof(dummy_ipv6_gtpu_ipv6_udp_packet);
+		*offsets = dummy_ipv6_gtpu_ipv6_udp_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV6_GTPU_IPV6_TCP ||
+	    tun_type == ICE_SW_TUN_IPV6_GTPU_EH_IPV6_TCP) {
+		*pkt = dummy_ipv6_gtpu_ipv6_tcp_packet;
+		*pkt_len = sizeof(dummy_ipv6_gtpu_ipv6_tcp_packet);
+		*offsets = dummy_ipv6_gtpu_ipv6_tcp_packet_offsets;
+		return;
+	}
+
 	if (tun_type == ICE_SW_TUN_PPPOE && ipv6) {
 		*pkt = dummy_pppoe_ipv6_packet;
 		*pkt_len = sizeof(dummy_pppoe_ipv6_packet);
diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c
index 6f9e861d08..dd570a2a8c 100644
--- a/drivers/net/ice/ice_switch_filter.c
+++ b/drivers/net/ice/ice_switch_filter.c
@@ -137,6 +137,78 @@
 #define ICE_SW_INSET_MAC_IPV6_PFCP ( \
 	ICE_SW_INSET_MAC_IPV6 | \
 	ICE_INSET_PFCP_S_FIELD | ICE_INSET_PFCP_SEID)
+#define ICE_SW_INSET_MAC_IPV4_GTPU ( \
+	ICE_SW_INSET_MAC_IPV4 | ICE_INSET_GTPU_TEID)
+#define ICE_SW_INSET_MAC_IPV6_GTPU ( \
+	ICE_SW_INSET_MAC_IPV6 | ICE_INSET_GTPU_TEID)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_IPV4 ( \
+	ICE_INSET_DMAC | ICE_INSET_GTPU_TEID | \
+	ICE_INSET_TUN_IPV4_SRC | ICE_INSET_TUN_IPV4_DST)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4 ( \
+	ICE_SW_INSET_MAC_IPV4_GTPU_IPV4 | ICE_INSET_GTPU_QFI)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_IPV6 ( \
+	ICE_INSET_DMAC | ICE_INSET_GTPU_TEID | \
+	ICE_INSET_TUN_IPV6_SRC | ICE_INSET_TUN_IPV6_DST)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6 ( \
+	ICE_SW_INSET_MAC_IPV4_GTPU_IPV6 | ICE_INSET_GTPU_QFI)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_IPV4 ( \
+	ICE_INSET_DMAC | ICE_INSET_GTPU_TEID | \
+	ICE_INSET_TUN_IPV4_SRC | ICE_INSET_TUN_IPV4_DST)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4 ( \
+	ICE_SW_INSET_MAC_IPV6_GTPU_IPV4 | ICE_INSET_GTPU_QFI)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_IPV6 ( \
+	ICE_INSET_DMAC | ICE_INSET_GTPU_TEID | \
+	ICE_INSET_TUN_IPV6_SRC | ICE_INSET_TUN_IPV6_DST)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6 ( \
+	ICE_SW_INSET_MAC_IPV6_GTPU_IPV6 | ICE_INSET_GTPU_QFI)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_IPV4_UDP ( \
+	ICE_SW_INSET_MAC_IPV4_GTPU_IPV4 | \
+	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4_UDP ( \
+	ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4 | \
+	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_IPV4_TCP ( \
+	ICE_SW_INSET_MAC_IPV4_GTPU_IPV4 | \
+	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4_TCP ( \
+	ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4 | \
+	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_IPV6_UDP ( \
+	ICE_SW_INSET_MAC_IPV4_GTPU_IPV6 | \
+	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6_UDP ( \
+	ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6 | \
+	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_IPV6_TCP ( \
+	ICE_SW_INSET_MAC_IPV4_GTPU_IPV6 | \
+	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6_TCP ( \
+	ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6 | \
+	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_IPV4_UDP ( \
+	ICE_SW_INSET_MAC_IPV6_GTPU_IPV4 | \
+	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4_UDP ( \
+	ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4 | \
+	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_IPV4_TCP ( \
+	ICE_SW_INSET_MAC_IPV6_GTPU_IPV4 | \
+	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4_TCP ( \
+	ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4 | \
+	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_IPV6_UDP ( \
+	ICE_SW_INSET_MAC_IPV6_GTPU_IPV6 | \
+	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6_UDP ( \
+	ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6 | \
+	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_IPV6_TCP ( \
+	ICE_SW_INSET_MAC_IPV6_GTPU_IPV6 | \
+	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6_TCP ( \
+	ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6 | \
+	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT)
 
 struct sw_meta {
 	struct ice_adv_lkup_elem *list;
@@ -198,6 +270,32 @@ ice_pattern_match_item ice_switch_pattern_dist_list[] = {
 	{pattern_eth_qinq_pppoes_proto,			ICE_SW_INSET_MAC_PPPOE_PROTO,		ICE_INSET_NONE,	ICE_INSET_NONE},
 	{pattern_eth_qinq_pppoes_ipv4,			ICE_SW_INSET_MAC_PPPOE_IPV4,		ICE_INSET_NONE,	ICE_INSET_NONE},
 	{pattern_eth_qinq_pppoes_ipv6,			ICE_SW_INSET_MAC_PPPOE_IPV6,		ICE_INSET_NONE,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu,				ICE_SW_INSET_MAC_IPV4_GTPU,		ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu,				ICE_SW_INSET_MAC_IPV6_GTPU,		ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv4,			ICE_SW_INSET_MAC_IPV4_GTPU_IPV4,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv4,			ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv4_udp,		ICE_SW_INSET_MAC_IPV4_GTPU_IPV4_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv4_udp,		ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv4_tcp,		ICE_SW_INSET_MAC_IPV4_GTPU_IPV4_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv4_tcp,		ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv6,			ICE_SW_INSET_MAC_IPV4_GTPU_IPV6,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv6,			ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv6_udp,		ICE_SW_INSET_MAC_IPV4_GTPU_IPV6_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv6_udp,		ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv6_tcp,		ICE_SW_INSET_MAC_IPV4_GTPU_IPV6_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv6_tcp,		ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv4,			ICE_SW_INSET_MAC_IPV6_GTPU_IPV4,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv4,			ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv4_udp,		ICE_SW_INSET_MAC_IPV6_GTPU_IPV4_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv4_udp,		ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv4_tcp,		ICE_SW_INSET_MAC_IPV6_GTPU_IPV4_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv4_tcp,		ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv6,			ICE_SW_INSET_MAC_IPV6_GTPU_IPV6,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv6,			ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv6_udp,		ICE_SW_INSET_MAC_IPV6_GTPU_IPV6_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv6_udp,		ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv6_tcp,		ICE_SW_INSET_MAC_IPV6_GTPU_IPV6_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv6_tcp,		ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
 };
 
 static struct
@@ -251,6 +349,32 @@ ice_pattern_match_item ice_switch_pattern_perm_list[] = {
 	{pattern_eth_qinq_pppoes_proto,			ICE_SW_INSET_MAC_PPPOE_PROTO,		ICE_INSET_NONE,	ICE_INSET_NONE},
 	{pattern_eth_qinq_pppoes_ipv4,			ICE_SW_INSET_MAC_PPPOE_IPV4,		ICE_INSET_NONE,	ICE_INSET_NONE},
 	{pattern_eth_qinq_pppoes_ipv6,			ICE_SW_INSET_MAC_PPPOE_IPV6,		ICE_INSET_NONE,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu,				ICE_SW_INSET_MAC_IPV4_GTPU,		ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu,				ICE_SW_INSET_MAC_IPV6_GTPU,		ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv4,			ICE_SW_INSET_MAC_IPV4_GTPU_IPV4,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv4,			ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv4_udp,		ICE_SW_INSET_MAC_IPV4_GTPU_IPV4_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv4_udp,		ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv4_tcp,		ICE_SW_INSET_MAC_IPV4_GTPU_IPV4_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv4_tcp,		ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv6,			ICE_SW_INSET_MAC_IPV4_GTPU_IPV6,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv6,			ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv6_udp,		ICE_SW_INSET_MAC_IPV4_GTPU_IPV6_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv6_udp,		ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv6_tcp,		ICE_SW_INSET_MAC_IPV4_GTPU_IPV6_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv6_tcp,		ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv4,			ICE_SW_INSET_MAC_IPV6_GTPU_IPV4,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv4,			ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv4_udp,		ICE_SW_INSET_MAC_IPV6_GTPU_IPV4_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv4_udp,		ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv4_tcp,		ICE_SW_INSET_MAC_IPV6_GTPU_IPV4_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv4_tcp,		ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv6,			ICE_SW_INSET_MAC_IPV6_GTPU_IPV6,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv6,			ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv6_udp,		ICE_SW_INSET_MAC_IPV6_GTPU_IPV6_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv6_udp,		ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv6_tcp,		ICE_SW_INSET_MAC_IPV6_GTPU_IPV6_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv6_tcp,		ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
 };
 
 static int
@@ -378,6 +502,8 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
 	const struct rte_flow_item_ah *ah_spec, *ah_mask;
 	const struct rte_flow_item_l2tpv3oip *l2tp_spec, *l2tp_mask;
 	const struct rte_flow_item_pfcp *pfcp_spec, *pfcp_mask;
+	const struct rte_flow_item_gtp *gtp_spec, *gtp_mask;
+	const struct rte_flow_item_gtp_psc *gtp_psc_spec, *gtp_psc_mask;
 	uint64_t input_set = ICE_INSET_NONE;
 	uint16_t input_set_byte = 0;
 	bool pppoe_elem_valid = 0;
@@ -393,7 +519,13 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
 	bool ipv4_valid = 0;
 	bool udp_valid = 0;
 	bool tcp_valid = 0;
-	uint16_t j, t = 0;
+	bool gtpu_valid = 0;
+	bool gtpu_psc_valid = 0;
+	bool inner_ipv4_valid = 0;
+	bool inner_ipv6_valid = 0;
+	bool inner_tcp_valid = 0;
+	bool inner_udp_valid = 0;
+	uint16_t j, k, t = 0;
 
 	for (item = pattern; item->type !=
 			RTE_FLOW_ITEM_TYPE_END; item++) {
@@ -479,7 +611,11 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
 		case RTE_FLOW_ITEM_TYPE_IPV4:
 			ipv4_spec = item->spec;
 			ipv4_mask = item->mask;
-			ipv4_valid = 1;
+			if (tunnel_valid)
+				inner_ipv4_valid = 1;
+			else
+				ipv4_valid = 1;
+
 			if (ipv4_spec && ipv4_mask) {
 				/* Check IPv4 mask and update input set */
 				if (ipv4_mask->hdr.version_ihl ||
@@ -571,7 +707,10 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
 		case RTE_FLOW_ITEM_TYPE_IPV6:
 			ipv6_spec = item->spec;
 			ipv6_mask = item->mask;
-			ipv6_valid = 1;
+			if (tunnel_valid)
+				inner_ipv6_valid = 1;
+			else
+				ipv6_valid = 1;
 			if (ipv6_spec && ipv6_mask) {
 				if (ipv6_mask->hdr.payload_len) {
 					rte_flow_error_set(error, EINVAL,
@@ -689,7 +828,10 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
 		case RTE_FLOW_ITEM_TYPE_UDP:
 			udp_spec = item->spec;
 			udp_mask = item->mask;
-			udp_valid = 1;
+			if (tunnel_valid)
+				inner_udp_valid = 1;
+			else
+				udp_valid = 1;
 			if (udp_spec && udp_mask) {
 				/* Check UDP mask and update input set*/
 				if (udp_mask->hdr.dgram_len ||
@@ -742,7 +884,10 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
 		case RTE_FLOW_ITEM_TYPE_TCP:
 			tcp_spec = item->spec;
 			tcp_mask = item->mask;
-			tcp_valid = 1;
+			if (tunnel_valid)
+				inner_tcp_valid = 1;
+			else
+				tcp_valid = 1;
 			if (tcp_spec && tcp_mask) {
 				/* Check TCP mask and update input set */
 				if (tcp_mask->hdr.sent_seq ||
@@ -1255,6 +1400,71 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
 			}
 			break;
 
+		case RTE_FLOW_ITEM_TYPE_GTPU:
+			gtp_spec = item->spec;
+			gtp_mask = item->mask;
+			if (gtp_spec && !gtp_mask) {
+				rte_flow_error_set(error, EINVAL,
+					RTE_FLOW_ERROR_TYPE_ITEM,
+					item,
+					"Invalid GTP item");
+				return 0;
+			}
+			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,
+						RTE_FLOW_ERROR_TYPE_ITEM,
+						item,
+						"Invalid GTP mask");
+					return 0;
+				}
+				if (gtp_mask->teid)
+					input_set |= ICE_INSET_GTPU_TEID;
+				list[t].type = ICE_GTP;
+				list[t].h_u.gtp_hdr.teid =
+					gtp_spec->teid;
+				list[t].m_u.gtp_hdr.teid =
+					gtp_mask->teid;
+				input_set_byte += 4;
+				t++;
+			}
+			tunnel_valid = 1;
+			gtpu_valid = 1;
+			break;
+
+		case RTE_FLOW_ITEM_TYPE_GTP_PSC:
+			gtp_psc_spec = item->spec;
+			gtp_psc_mask = item->mask;
+			if (gtp_psc_spec && !gtp_psc_mask) {
+				rte_flow_error_set(error, EINVAL,
+					RTE_FLOW_ERROR_TYPE_ITEM,
+					item,
+					"Invalid GTPU_EH item");
+				return 0;
+			}
+			if (gtp_psc_spec && gtp_psc_mask) {
+				if (gtp_psc_mask->pdu_type) {
+					rte_flow_error_set(error, EINVAL,
+						RTE_FLOW_ERROR_TYPE_ITEM,
+						item,
+						"Invalid GTPU_EH mask");
+					return 0;
+				}
+				if (gtp_psc_mask->qfi)
+					input_set |= ICE_INSET_GTPU_QFI;
+				list[t].type = ICE_GTP;
+				list[t].h_u.gtp_hdr.qfi =
+					gtp_psc_spec->qfi;
+				list[t].m_u.gtp_hdr.qfi =
+					gtp_psc_mask->qfi;
+				input_set_byte += 1;
+				t++;
+			}
+			gtpu_psc_valid = 1;
+			break;
+
 		case RTE_FLOW_ITEM_TYPE_VOID:
 			break;
 
@@ -1302,6 +1512,74 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
 			*tun_type = ICE_SW_TUN_PPPOE;
 	}
 
+	if (gtpu_valid && gtpu_psc_valid) {
+		if (ipv4_valid && inner_ipv4_valid && inner_udp_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_EH_IPV4_UDP;
+		else if (ipv4_valid && inner_ipv4_valid && inner_tcp_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_EH_IPV4_TCP;
+		else if (ipv4_valid && inner_ipv4_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_EH_IPV4;
+		else if (ipv4_valid && inner_ipv6_valid && inner_udp_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_EH_IPV6_UDP;
+		else if (ipv4_valid && inner_ipv6_valid && inner_tcp_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_EH_IPV6_TCP;
+		else if (ipv4_valid && inner_ipv6_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_EH_IPV6;
+		else if (ipv6_valid && inner_ipv4_valid && inner_udp_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_EH_IPV4_UDP;
+		else if (ipv6_valid && inner_ipv4_valid && inner_tcp_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_EH_IPV4_TCP;
+		else if (ipv6_valid && inner_ipv4_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_EH_IPV4;
+		else if (ipv6_valid && inner_ipv6_valid && inner_udp_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_EH_IPV6_UDP;
+		else if (ipv6_valid && inner_ipv6_valid && inner_tcp_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_EH_IPV6_TCP;
+		else if (ipv6_valid && inner_ipv6_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_EH_IPV6;
+		else if (ipv4_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_NO_PAY;
+		else if (ipv6_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_NO_PAY;
+	} else if (gtpu_valid) {
+		if (ipv4_valid && inner_ipv4_valid && inner_udp_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_IPV4_UDP;
+		else if (ipv4_valid && inner_ipv4_valid && inner_tcp_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_IPV4_TCP;
+		else if (ipv4_valid && inner_ipv4_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_IPV4;
+		else if (ipv4_valid && inner_ipv6_valid && inner_udp_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_IPV6_UDP;
+		else if (ipv4_valid && inner_ipv6_valid && inner_tcp_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_IPV6_TCP;
+		else if (ipv4_valid && inner_ipv6_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_IPV6;
+		else if (ipv6_valid && inner_ipv4_valid && inner_udp_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_IPV4_UDP;
+		else if (ipv6_valid && inner_ipv4_valid && inner_tcp_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_IPV4_TCP;
+		else if (ipv6_valid && inner_ipv4_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_IPV4;
+		else if (ipv6_valid && inner_ipv6_valid && inner_udp_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_IPV6_UDP;
+		else if (ipv6_valid && inner_ipv6_valid && inner_tcp_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_IPV6_TCP;
+		else if (ipv6_valid && inner_ipv6_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_IPV6;
+		else if (ipv4_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_NO_PAY;
+		else if (ipv6_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_NO_PAY;
+	}
+
+	if (*tun_type == ICE_SW_TUN_IPV4_GTPU_NO_PAY ||
+	    *tun_type == ICE_SW_TUN_IPV6_GTPU_NO_PAY) {
+		for (k = 0; k < t; k++) {
+			if (list[k].type == ICE_GTP)
+				list[k].type = ICE_GTP_NO_PAY;
+		}
+	}
+
 	if (*tun_type == ICE_NON_TUN) {
 		if (vxlan_valid)
 			*tun_type = ICE_SW_TUN_VXLAN;
-- 
2.25.1


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

* [dpdk-dev] [PATCH v4] net/ice: support GTPU TEID pattern for switch filter
  2021-03-18  8:48 [dpdk-dev] [PATCH v1] net/ice: support GTPU TEID pattern for switch filter Yuying
  2021-03-30  9:14 ` [dpdk-dev] [PATCH v2] " Yuying Zhang
  2021-04-07  5:15 ` [dpdk-dev] [PATCH v3] " Yuying Zhang
@ 2021-04-15  7:35 ` Yuying Zhang
  2021-04-15  9:29 ` [dpdk-dev] [PATCH v5 1/2] " Yuying Zhang
  2021-04-15 10:47 ` [dpdk-dev] [PATCH v6 1/2] " Yuying Zhang
  4 siblings, 0 replies; 10+ messages in thread
From: Yuying Zhang @ 2021-04-15  7:35 UTC (permalink / raw)
  To: dev, qi.z.zhang; +Cc: Yuying Zhang

Enable GTPU pattern for CVL switch filter. Support teid and
qfi field of GTPU pattern. Patterns without inner l3/l4 field
support outer dst/src ip. Patterns with inner l3/l4 field only
support inner dst/src ip and inner dst/src port.

+-----------------------------------+-------------------------------------+
| Pattern                           | Input Set                           |
+-----------------------------------+-------------------------------------+
| pattern_eth_ipv4_gtpu             | teid, dst/src ip                    |
| pattern_eth_ipv6_gtpu             | teid, dst/src ip                    |
| pattern_eth_ipv4_gtpu_ipv4        | teid, dst/src ip                    |
| pattern_eth_ipv4_gtpu_ipv4_tcp    | teid, dst/src ip, dst/src port      |
| pattern_eth_ipv4_gtpu_ipv4_udp    | teid, dst/src ip, dst/src port      |
| pattern_eth_ipv4_gtpu_ipv6        | teid, dst/src ip                    |
| pattern_eth_ipv4_gtpu_ipv6_tcp    | teid, dst/src ip, dst/src port      |
| pattern_eth_ipv4_gtpu_ipv6_udp    | teid, dst/src ip, dst/src port      |
| pattern_eth_ipv6_gtpu_ipv4        | teid, dst/src ip                    |
| pattern_eth_ipv6_gtpu_ipv4_tcp    | teid, dst/src ip, dst/src port      |
| pattern_eth_ipv6_gtpu_ipv4_udp    | teid, dst/src ip, dst/src port      |
| pattern_eth_ipv6_gtpu_ipv6        | teid, dst/src ip                    |
| pattern_eth_ipv6_gtpu_ipv6_tcp    | teid, dst/src ip, dst/src port      |
| pattern_eth_ipv6_gtpu_ipv6_udp    | teid, dst/src ip, dst/src port      |
| pattern_eth_ipv4_gtpu_eh_ipv4     | teid, qfi, dst/src ip               |
| pattern_eth_ipv4_gtpu_eh_ipv4_tcp | teid, qfi, dst/src ip, dst/src port |
| pattern_eth_ipv4_gtpu_eh_ipv4_udp | teid, qfi, dst/src ip, dst/src port |
| pattern_eth_ipv4_gtpu_eh_ipv6     | teid, qfi, dst/src ip               |
| pattern_eth_ipv4_gtpu_eh_ipv6_tcp | teid, qfi, dst/src ip, dst/src port |
| pattern_eth_ipv4_gtpu_eh_ipv6_udp | teid, qfi, dst/src ip, dst/src port |
| pattern_eth_ipv6_gtpu_eh_ipv4     | teid, qfi, dst/src ip               |
| pattern_eth_ipv6_gtpu_eh_ipv4_tcp | teid, qfi, dst/src ip, dst/src port |
| pattern_eth_ipv6_gtpu_eh_ipv4_udp | teid, qfi, dst/src ip, dst/src port |
| pattern_eth_ipv6_gtpu_eh_ipv6     | teid, qfi, dst/src ip               |
| pattern_eth_ipv6_gtpu_eh_ipv6_tcp | teid, qfi, dst/src ip, dst/src port |
| pattern_eth_ipv6_gtpu_eh_ipv6_udp | teid, qfi, dst/src ip, dst/src port |
+-----------------------------------+-------------------------------------+

Signed-off-by: Yuying Zhang <yuying.zhang@intel.com>
---
 doc/guides/rel_notes/release_21_05.rst   |   1 +
 drivers/net/ice/base/ice_protocol_type.h |  20 ++
 drivers/net/ice/base/ice_switch.c        | 263 ++++++++++++++++++---
 drivers/net/ice/base/ice_switch.h        |   5 +
 drivers/net/ice/ice_switch_filter.c      | 288 ++++++++++++++++++++++-
 5 files changed, 544 insertions(+), 33 deletions(-)

diff --git a/doc/guides/rel_notes/release_21_05.rst b/doc/guides/rel_notes/release_21_05.rst
index 3bd775772f..d28e44c997 100644
--- a/doc/guides/rel_notes/release_21_05.rst
+++ b/doc/guides/rel_notes/release_21_05.rst
@@ -125,6 +125,7 @@ New Features
 * **Updated Intel ice driver.**
 
   * Added Intel ice support on Windows.
+  * Added GTPU TEID support for DCF switch filter.
 
 * **Updated Marvell OCTEON TX2 ethdev driver.**
 
diff --git a/drivers/net/ice/base/ice_protocol_type.h b/drivers/net/ice/base/ice_protocol_type.h
index 8c9d098e22..d1d266ffd2 100644
--- a/drivers/net/ice/base/ice_protocol_type.h
+++ b/drivers/net/ice/base/ice_protocol_type.h
@@ -76,6 +76,26 @@ enum ice_sw_tunnel_type {
 	ICE_SW_TUN_GTP,
 	ICE_SW_TUN_IPV4_GTPU_NO_PAY,
 	ICE_SW_TUN_IPV6_GTPU_NO_PAY,
+	ICE_SW_TUN_IPV4_GTPU_EH_IPV4,
+	ICE_SW_TUN_IPV4_GTPU_IPV4_UDP,
+	ICE_SW_TUN_IPV4_GTPU_EH_IPV4_UDP,
+	ICE_SW_TUN_IPV4_GTPU_IPV4_TCP,
+	ICE_SW_TUN_IPV4_GTPU_EH_IPV4_TCP,
+	ICE_SW_TUN_IPV4_GTPU_EH_IPV6,
+	ICE_SW_TUN_IPV4_GTPU_IPV6_UDP,
+	ICE_SW_TUN_IPV4_GTPU_EH_IPV6_UDP,
+	ICE_SW_TUN_IPV4_GTPU_IPV6_TCP,
+	ICE_SW_TUN_IPV4_GTPU_EH_IPV6_TCP,
+	ICE_SW_TUN_IPV6_GTPU_EH_IPV4,
+	ICE_SW_TUN_IPV6_GTPU_IPV4_UDP,
+	ICE_SW_TUN_IPV6_GTPU_EH_IPV4_UDP,
+	ICE_SW_TUN_IPV6_GTPU_IPV4_TCP,
+	ICE_SW_TUN_IPV6_GTPU_EH_IPV4_TCP,
+	ICE_SW_TUN_IPV6_GTPU_EH_IPV6,
+	ICE_SW_TUN_IPV6_GTPU_IPV6_UDP,
+	ICE_SW_TUN_IPV6_GTPU_EH_IPV6_UDP,
+	ICE_SW_TUN_IPV6_GTPU_IPV6_TCP,
+	ICE_SW_TUN_IPV6_GTPU_EH_IPV6_TCP,
 	ICE_SW_TUN_PPPOE,
 	ICE_SW_TUN_PPPOE_PAY,
 	ICE_SW_TUN_PPPOE_IPV4,
diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c
index 45f83cd10c..2a9bea4261 100644
--- a/drivers/net/ice/base/ice_switch.c
+++ b/drivers/net/ice/base/ice_switch.c
@@ -14,6 +14,7 @@
 #define ICE_PPP_IPV6_PROTO_ID		0x0057
 #define ICE_IPV6_ETHER_ID		0x86DD
 #define ICE_TCP_PROTO_ID		0x06
+#define ICE_GTPU_PROFILE		24
 #define ICE_ETH_P_8021Q			0x8100
 
 /* Dummy ethernet header needed in the ice_aqc_sw_rules_elem
@@ -1123,6 +1124,7 @@ static const u8 dummy_udp_gtp_packet[] = {
 
 	0x02, 0x00, 0x00, 0x00, /* PDU Session extension header */
 	0x00, 0x00, 0x00, 0x00,
+
 };
 
 static const struct ice_dummy_pkt_offsets dummy_ipv4_gtp_no_pay_packet_offsets[] = {
@@ -1142,6 +1144,32 @@ struct ice_dummy_pkt_offsets dummy_ipv6_gtp_no_pay_packet_offsets[] = {
 	{ ICE_PROTOCOL_LAST,	0 },
 };
 
+static const u8 dummy_ipv6_gtp_packet[] = {
+	0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x86, 0xdd,
+
+	0x60, 0x00, 0x00, 0x00, /* ICE_IPV6_OFOS 14 */
+	0x00, 0x6c, 0x11, 0x00, /* Next header UDP*/
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+
+	0x08, 0x68, 0x08, 0x68, /* ICE_UDP_OF 54 */
+	0x00, 0x00, 0x00, 0x00,
+
+	0x30, 0x00, 0x00, 0x28,  /* ICE_GTP 62 */
+	0x00, 0x00, 0x00, 0x00,
+
+	0x00, 0x00,
+};
+
 static const struct ice_dummy_pkt_offsets dummy_pppoe_packet_offsets[] = {
 	{ ICE_MAC_OFOS,		0 },
 	{ ICE_ETYPE_OL,		12 },
@@ -1785,6 +1813,33 @@ static void ice_collect_result_idx(struct ice_aqc_recipe_data_elem *buf,
 			    ~ICE_AQ_RECIPE_RESULT_EN, recp->res_idxs);
 }
 
+static struct ice_prof_type_entry ice_prof_type_tbl[ICE_GTPU_PROFILE] = {
+	{ ICE_PROFID_IPV4_GTPU_IPV4_OTHER,    ICE_SW_TUN_IPV4_GTPU_IPV4},
+	{ ICE_PROFID_IPV4_GTPU_IPV4_UDP,      ICE_SW_TUN_IPV4_GTPU_IPV4_UDP},
+	{ ICE_PROFID_IPV4_GTPU_IPV4_TCP,      ICE_SW_TUN_IPV4_GTPU_IPV4_TCP},
+	{ ICE_PROFID_IPV4_GTPU_EH_IPV4_OTHER, ICE_SW_TUN_IPV4_GTPU_EH_IPV4},
+	{ ICE_PROFID_IPV4_GTPU_EH_IPV4_UDP,   ICE_SW_TUN_IPV4_GTPU_EH_IPV4_UDP},
+	{ ICE_PROFID_IPV4_GTPU_EH_IPV4_TCP,   ICE_SW_TUN_IPV4_GTPU_EH_IPV4_TCP},
+	{ ICE_PROFID_IPV4_GTPU_IPV6_OTHER,    ICE_SW_TUN_IPV4_GTPU_IPV6},
+	{ ICE_PROFID_IPV4_GTPU_IPV6_UDP,      ICE_SW_TUN_IPV4_GTPU_IPV6_UDP},
+	{ ICE_PROFID_IPV4_GTPU_IPV6_TCP,      ICE_SW_TUN_IPV4_GTPU_IPV6_TCP},
+	{ ICE_PROFID_IPV4_GTPU_EH_IPV6_OTHER, ICE_SW_TUN_IPV4_GTPU_EH_IPV6},
+	{ ICE_PROFID_IPV4_GTPU_EH_IPV6_UDP,   ICE_SW_TUN_IPV4_GTPU_EH_IPV6_UDP},
+	{ ICE_PROFID_IPV4_GTPU_EH_IPV6_TCP,   ICE_SW_TUN_IPV4_GTPU_EH_IPV6_TCP},
+	{ ICE_PROFID_IPV6_GTPU_IPV4_OTHER,    ICE_SW_TUN_IPV6_GTPU_IPV4},
+	{ ICE_PROFID_IPV6_GTPU_IPV4_UDP,      ICE_SW_TUN_IPV6_GTPU_IPV4_UDP},
+	{ ICE_PROFID_IPV6_GTPU_IPV4_TCP,      ICE_SW_TUN_IPV6_GTPU_IPV4_TCP},
+	{ ICE_PROFID_IPV6_GTPU_EH_IPV4_OTHER, ICE_SW_TUN_IPV6_GTPU_EH_IPV4},
+	{ ICE_PROFID_IPV6_GTPU_EH_IPV4_UDP,   ICE_SW_TUN_IPV6_GTPU_EH_IPV4_UDP},
+	{ ICE_PROFID_IPV6_GTPU_EH_IPV4_TCP,   ICE_SW_TUN_IPV6_GTPU_EH_IPV4_TCP},
+	{ ICE_PROFID_IPV6_GTPU_IPV6_OTHER,    ICE_SW_TUN_IPV6_GTPU_IPV6},
+	{ ICE_PROFID_IPV6_GTPU_IPV6_UDP,      ICE_SW_TUN_IPV6_GTPU_IPV6_UDP},
+	{ ICE_PROFID_IPV6_GTPU_IPV6_TCP,      ICE_SW_TUN_IPV6_GTPU_IPV6_TCP},
+	{ ICE_PROFID_IPV6_GTPU_EH_IPV6_OTHER, ICE_SW_TUN_IPV6_GTPU_EH_IPV6},
+	{ ICE_PROFID_IPV6_GTPU_EH_IPV6_UDP,   ICE_SW_TUN_IPV6_GTPU_EH_IPV6_UDP},
+	{ ICE_PROFID_IPV6_GTPU_EH_IPV6_TCP,   ICE_SW_TUN_IPV6_GTPU_EH_IPV6_TCP},
+};
+
 /**
  * ice_get_tun_type_for_recipe - get tunnel type for the recipe
  * @rid: recipe ID that we are populating
@@ -1796,7 +1851,7 @@ static enum ice_sw_tunnel_type ice_get_tun_type_for_recipe(u8 rid, bool vlan)
 	u8 pppoe_profile[7] = {34, 35, 36, 37, 38, 39, 40};
 	u8 non_tun_profile[6] = {4, 5, 6, 7, 8, 9};
 	enum ice_sw_tunnel_type tun_type;
-	u16 i, j, profile_num = 0;
+	u16 i, j, k, profile_num = 0;
 	bool non_tun_valid = false;
 	bool pppoe_valid = false;
 	bool vxlan_valid = false;
@@ -1870,18 +1925,12 @@ static enum ice_sw_tunnel_type ice_get_tun_type_for_recipe(u8 rid, bool vlan)
 	}
 
 	if (tun_type == ICE_SW_TUN_GTP) {
-		if (ice_is_bit_set(recipe_to_profile[rid],
-				   ICE_PROFID_IPV4_GTPU_IPV4_OTHER))
-			tun_type = ICE_SW_TUN_IPV4_GTPU_IPV4;
-		else if (ice_is_bit_set(recipe_to_profile[rid],
-					ICE_PROFID_IPV4_GTPU_IPV6_OTHER))
-			tun_type = ICE_SW_TUN_IPV4_GTPU_IPV6;
-		else if (ice_is_bit_set(recipe_to_profile[rid],
-					ICE_PROFID_IPV6_GTPU_IPV4_OTHER))
-			tun_type = ICE_SW_TUN_IPV6_GTPU_IPV4;
-		else if (ice_is_bit_set(recipe_to_profile[rid],
-					ICE_PROFID_IPV6_GTPU_IPV6_OTHER))
-			tun_type = ICE_SW_TUN_IPV6_GTPU_IPV6;
+		for (k = 0; k < ARRAY_SIZE(ice_prof_type_tbl); k++)
+			if (ice_is_bit_set(recipe_to_profile[rid],
+					   ice_prof_type_tbl[k].prof_id)) {
+				tun_type = ice_prof_type_tbl[k].type;
+				break;
+			}
 	}
 
 	if (profile_num == 1 && (flag_valid || non_tun_valid || pppoe_valid)) {
@@ -6521,7 +6570,7 @@ static const struct ice_prot_ext_tbl_entry ice_prot_ext[ICE_PROTOCOL_LAST] = {
 	{ ICE_GENEVE,		{ 8, 10, 12, 14 } },
 	{ ICE_VXLAN_GPE,	{ 8, 10, 12, 14 } },
 	{ ICE_NVGRE,		{ 0, 2, 4, 6 } },
-	{ ICE_GTP,		{ 8, 10, 12, 14, 16, 18, 20 } },
+	{ ICE_GTP,		{ 8, 10, 12, 14, 16, 18, 20, 22 } },
 	{ ICE_PPPOE,		{ 0, 2, 4, 6 } },
 	{ ICE_PFCP,		{ 8, 10, 12, 14, 16, 18, 20, 22 } },
 	{ ICE_L2TPV3,		{ 0, 2, 4, 6, 8, 10 } },
@@ -7461,38 +7510,100 @@ ice_get_compat_fv_bitmap(struct ice_hw *hw, struct ice_adv_rule_info *rinfo,
 	case ICE_SW_IPV6_UDP:
 		ice_set_bit(ICE_PROFID_IPV6_UDP, bm);
 		return;
+	case ICE_SW_TUN_IPV4_GTPU_NO_PAY:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_TEID, bm);
+		return;
+	case ICE_SW_TUN_IPV6_GTPU_NO_PAY:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_TEID, bm);
+		return;
 	case ICE_SW_TUN_IPV4_GTPU_IPV4:
-		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV4_OTHER, bm);
 		ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV4_OTHER, bm);
-		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV4_UDP, bm);
 		ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV4_UDP, bm);
-		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV4_TCP, bm);
 		ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV4_TCP, bm);
 		return;
+	case ICE_SW_TUN_IPV4_GTPU_IPV4_UDP:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV4_UDP, bm);
+		return;
+	case ICE_SW_TUN_IPV4_GTPU_IPV4_TCP:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV4_TCP, bm);
+		return;
+	case ICE_SW_TUN_IPV4_GTPU_EH_IPV4:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV4_OTHER, bm);
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV4_UDP, bm);
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV4_TCP, bm);
+		return;
+	case ICE_SW_TUN_IPV4_GTPU_EH_IPV4_UDP:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV4_UDP, bm);
+		return;
+	case ICE_SW_TUN_IPV4_GTPU_EH_IPV4_TCP:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV4_TCP, bm);
+		return;
 	case ICE_SW_TUN_IPV6_GTPU_IPV4:
-		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV4_OTHER, bm);
 		ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV4_OTHER, bm);
-		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV4_UDP, bm);
 		ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV4_UDP, bm);
-		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV4_TCP, bm);
 		ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV4_TCP, bm);
 		return;
+	case ICE_SW_TUN_IPV6_GTPU_IPV4_UDP:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV4_UDP, bm);
+		return;
+	case ICE_SW_TUN_IPV6_GTPU_IPV4_TCP:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV4_TCP, bm);
+		return;
+	case ICE_SW_TUN_IPV6_GTPU_EH_IPV4:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV4_OTHER, bm);
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV4_UDP, bm);
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV4_TCP, bm);
+		return;
+	case ICE_SW_TUN_IPV6_GTPU_EH_IPV4_UDP:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV4_UDP, bm);
+		return;
+	case ICE_SW_TUN_IPV6_GTPU_EH_IPV4_TCP:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV4_TCP, bm);
+		return;
 	case ICE_SW_TUN_IPV4_GTPU_IPV6:
-		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV6_OTHER, bm);
 		ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV6_OTHER, bm);
-		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV6_UDP, bm);
 		ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV6_UDP, bm);
-		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV6_TCP, bm);
 		ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV6_TCP, bm);
 		return;
+	case ICE_SW_TUN_IPV4_GTPU_IPV6_UDP:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV6_UDP, bm);
+		return;
+	case ICE_SW_TUN_IPV4_GTPU_IPV6_TCP:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV6_TCP, bm);
+		return;
+	case ICE_SW_TUN_IPV4_GTPU_EH_IPV6:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV6_OTHER, bm);
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV6_UDP, bm);
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV6_TCP, bm);
+		return;
+	case ICE_SW_TUN_IPV4_GTPU_EH_IPV6_UDP:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV6_UDP, bm);
+		return;
+	case ICE_SW_TUN_IPV4_GTPU_EH_IPV6_TCP:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV6_TCP, bm);
+		return;
 	case ICE_SW_TUN_IPV6_GTPU_IPV6:
-		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV6_OTHER, bm);
 		ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV6_OTHER, bm);
-		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV6_UDP, bm);
 		ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV6_UDP, bm);
-		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV6_TCP, bm);
 		ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV6_TCP, bm);
 		return;
+	case ICE_SW_TUN_IPV6_GTPU_IPV6_UDP:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV6_UDP, bm);
+		return;
+	case ICE_SW_TUN_IPV6_GTPU_IPV6_TCP:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV6_TCP, bm);
+		return;
+	case ICE_SW_TUN_IPV6_GTPU_EH_IPV6:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV6_OTHER, bm);
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV6_UDP, bm);
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV6_TCP, bm);
+		return;
+	case ICE_SW_TUN_IPV6_GTPU_EH_IPV6_UDP:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV6_UDP, bm);
+		return;
+	case ICE_SW_TUN_IPV6_GTPU_EH_IPV6_TCP:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV6_TCP, bm);
+		return;
 	case ICE_SW_TUN_AND_NON_TUN:
 	case ICE_SW_TUN_AND_NON_TUN_QINQ:
 	default:
@@ -7827,8 +7938,8 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,
 		*offsets = dummy_ipv4_gtp_no_pay_packet_offsets;
 		return;
 	} else if (tun_type == ICE_SW_TUN_IPV6_GTPU_NO_PAY) {
-		*pkt = dummy_ipv6_gtpu_ipv6_packet;
-		*pkt_len = sizeof(dummy_ipv6_gtpu_ipv6_packet);
+		*pkt = dummy_ipv6_gtp_packet;
+		*pkt_len = sizeof(dummy_ipv6_gtp_packet);
 		*offsets = dummy_ipv6_gtp_no_pay_packet_offsets;
 		return;
 	}
@@ -7896,6 +8007,102 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,
 		return;
 	}
 
+	if (tun_type == ICE_SW_TUN_IPV4_GTPU_IPV4 ||
+	    tun_type == ICE_SW_TUN_IPV4_GTPU_EH_IPV4) {
+		*pkt = dummy_ipv4_gtpu_ipv4_packet;
+		*pkt_len = sizeof(dummy_ipv4_gtpu_ipv4_packet);
+		*offsets = dummy_ipv4_gtpu_ipv4_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV4_GTPU_IPV4_UDP ||
+	    tun_type == ICE_SW_TUN_IPV4_GTPU_EH_IPV4_UDP) {
+		*pkt = dummy_ipv4_gtpu_ipv4_udp_packet;
+		*pkt_len = sizeof(dummy_ipv4_gtpu_ipv4_udp_packet);
+		*offsets = dummy_ipv4_gtpu_ipv4_udp_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV4_GTPU_IPV4_TCP ||
+	    tun_type == ICE_SW_TUN_IPV4_GTPU_EH_IPV4_TCP) {
+		*pkt = dummy_ipv4_gtpu_ipv4_tcp_packet;
+		*pkt_len = sizeof(dummy_ipv4_gtpu_ipv4_tcp_packet);
+		*offsets = dummy_ipv4_gtpu_ipv4_tcp_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV4_GTPU_IPV6 ||
+	    tun_type == ICE_SW_TUN_IPV4_GTPU_EH_IPV6) {
+		*pkt = dummy_ipv4_gtpu_ipv6_packet;
+		*pkt_len = sizeof(dummy_ipv4_gtpu_ipv6_packet);
+		*offsets = dummy_ipv4_gtpu_ipv6_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV4_GTPU_IPV6_UDP ||
+	    tun_type == ICE_SW_TUN_IPV4_GTPU_EH_IPV6_UDP) {
+		*pkt = dummy_ipv4_gtpu_ipv6_udp_packet;
+		*pkt_len = sizeof(dummy_ipv4_gtpu_ipv6_udp_packet);
+		*offsets = dummy_ipv4_gtpu_ipv6_udp_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV4_GTPU_IPV6_TCP ||
+	    tun_type == ICE_SW_TUN_IPV4_GTPU_EH_IPV6_TCP) {
+		*pkt = dummy_ipv4_gtpu_ipv6_tcp_packet;
+		*pkt_len = sizeof(dummy_ipv4_gtpu_ipv6_tcp_packet);
+		*offsets = dummy_ipv4_gtpu_ipv6_tcp_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV6_GTPU_IPV4 ||
+	    tun_type == ICE_SW_TUN_IPV6_GTPU_EH_IPV4) {
+		*pkt = dummy_ipv6_gtpu_ipv4_packet;
+		*pkt_len = sizeof(dummy_ipv6_gtpu_ipv4_packet);
+		*offsets = dummy_ipv6_gtpu_ipv4_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV6_GTPU_IPV4_UDP ||
+	    tun_type == ICE_SW_TUN_IPV6_GTPU_EH_IPV4_UDP) {
+		*pkt = dummy_ipv6_gtpu_ipv4_udp_packet;
+		*pkt_len = sizeof(dummy_ipv6_gtpu_ipv4_udp_packet);
+		*offsets = dummy_ipv6_gtpu_ipv4_udp_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV6_GTPU_IPV4_TCP ||
+	    tun_type == ICE_SW_TUN_IPV6_GTPU_EH_IPV4_TCP) {
+		*pkt = dummy_ipv6_gtpu_ipv4_tcp_packet;
+		*pkt_len = sizeof(dummy_ipv6_gtpu_ipv4_tcp_packet);
+		*offsets = dummy_ipv6_gtpu_ipv4_tcp_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV6_GTPU_IPV6 ||
+	    tun_type == ICE_SW_TUN_IPV6_GTPU_EH_IPV6) {
+		*pkt = dummy_ipv6_gtpu_ipv6_packet;
+		*pkt_len = sizeof(dummy_ipv6_gtpu_ipv6_packet);
+		*offsets = dummy_ipv6_gtpu_ipv6_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV6_GTPU_IPV6_UDP ||
+	    tun_type == ICE_SW_TUN_IPV6_GTPU_EH_IPV6_UDP) {
+		*pkt = dummy_ipv6_gtpu_ipv6_udp_packet;
+		*pkt_len = sizeof(dummy_ipv6_gtpu_ipv6_udp_packet);
+		*offsets = dummy_ipv6_gtpu_ipv6_udp_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV6_GTPU_IPV6_TCP ||
+	    tun_type == ICE_SW_TUN_IPV6_GTPU_EH_IPV6_TCP) {
+		*pkt = dummy_ipv6_gtpu_ipv6_tcp_packet;
+		*pkt_len = sizeof(dummy_ipv6_gtpu_ipv6_tcp_packet);
+		*offsets = dummy_ipv6_gtpu_ipv6_tcp_packet_offsets;
+		return;
+	}
+
 	if (tun_type == ICE_SW_TUN_PPPOE && ipv6) {
 		*pkt = dummy_pppoe_ipv6_packet;
 		*pkt_len = sizeof(dummy_pppoe_ipv6_packet);
diff --git a/drivers/net/ice/base/ice_switch.h b/drivers/net/ice/base/ice_switch.h
index 61be54f9c0..980bae5806 100644
--- a/drivers/net/ice/base/ice_switch.h
+++ b/drivers/net/ice/base/ice_switch.h
@@ -216,6 +216,11 @@ struct ice_adv_lkup_elem {
 	union ice_prot_hdr m_u;	/* Mask of header values to match */
 };
 
+struct ice_prof_type_entry {
+	u16 prof_id;
+	enum ice_sw_tunnel_type type;
+};
+
 struct ice_sw_act_ctrl {
 	/* Source VSI for LOOKUP_TX or source port for LOOKUP_RX */
 	u16 src;
diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c
index 0bf3660677..7560fc4353 100644
--- a/drivers/net/ice/ice_switch_filter.c
+++ b/drivers/net/ice/ice_switch_filter.c
@@ -137,6 +137,78 @@
 #define ICE_SW_INSET_MAC_IPV6_PFCP ( \
 	ICE_SW_INSET_MAC_IPV6 | \
 	ICE_INSET_PFCP_S_FIELD | ICE_INSET_PFCP_SEID)
+#define ICE_SW_INSET_MAC_IPV4_GTPU ( \
+	ICE_SW_INSET_MAC_IPV4 | ICE_INSET_GTPU_TEID)
+#define ICE_SW_INSET_MAC_IPV6_GTPU ( \
+	ICE_SW_INSET_MAC_IPV6 | ICE_INSET_GTPU_TEID)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_IPV4 ( \
+	ICE_INSET_DMAC | ICE_INSET_GTPU_TEID | \
+	ICE_INSET_TUN_IPV4_SRC | ICE_INSET_TUN_IPV4_DST)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4 ( \
+	ICE_SW_INSET_MAC_IPV4_GTPU_IPV4 | ICE_INSET_GTPU_QFI)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_IPV6 ( \
+	ICE_INSET_DMAC | ICE_INSET_GTPU_TEID | \
+	ICE_INSET_TUN_IPV6_SRC | ICE_INSET_TUN_IPV6_DST)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6 ( \
+	ICE_SW_INSET_MAC_IPV4_GTPU_IPV6 | ICE_INSET_GTPU_QFI)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_IPV4 ( \
+	ICE_INSET_DMAC | ICE_INSET_GTPU_TEID | \
+	ICE_INSET_TUN_IPV4_SRC | ICE_INSET_TUN_IPV4_DST)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4 ( \
+	ICE_SW_INSET_MAC_IPV6_GTPU_IPV4 | ICE_INSET_GTPU_QFI)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_IPV6 ( \
+	ICE_INSET_DMAC | ICE_INSET_GTPU_TEID | \
+	ICE_INSET_TUN_IPV6_SRC | ICE_INSET_TUN_IPV6_DST)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6 ( \
+	ICE_SW_INSET_MAC_IPV6_GTPU_IPV6 | ICE_INSET_GTPU_QFI)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_IPV4_UDP ( \
+	ICE_SW_INSET_MAC_IPV4_GTPU_IPV4 | \
+	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4_UDP ( \
+	ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4 | \
+	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_IPV4_TCP ( \
+	ICE_SW_INSET_MAC_IPV4_GTPU_IPV4 | \
+	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4_TCP ( \
+	ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4 | \
+	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_IPV6_UDP ( \
+	ICE_SW_INSET_MAC_IPV4_GTPU_IPV6 | \
+	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6_UDP ( \
+	ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6 | \
+	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_IPV6_TCP ( \
+	ICE_SW_INSET_MAC_IPV4_GTPU_IPV6 | \
+	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6_TCP ( \
+	ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6 | \
+	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_IPV4_UDP ( \
+	ICE_SW_INSET_MAC_IPV6_GTPU_IPV4 | \
+	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4_UDP ( \
+	ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4 | \
+	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_IPV4_TCP ( \
+	ICE_SW_INSET_MAC_IPV6_GTPU_IPV4 | \
+	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4_TCP ( \
+	ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4 | \
+	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_IPV6_UDP ( \
+	ICE_SW_INSET_MAC_IPV6_GTPU_IPV6 | \
+	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6_UDP ( \
+	ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6 | \
+	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_IPV6_TCP ( \
+	ICE_SW_INSET_MAC_IPV6_GTPU_IPV6 | \
+	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6_TCP ( \
+	ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6 | \
+	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT)
 
 struct sw_meta {
 	struct ice_adv_lkup_elem *list;
@@ -198,6 +270,32 @@ ice_pattern_match_item ice_switch_pattern_dist_list[] = {
 	{pattern_eth_qinq_pppoes_proto,			ICE_SW_INSET_MAC_PPPOE_PROTO,		ICE_INSET_NONE,	ICE_INSET_NONE},
 	{pattern_eth_qinq_pppoes_ipv4,			ICE_SW_INSET_MAC_PPPOE_IPV4,		ICE_INSET_NONE,	ICE_INSET_NONE},
 	{pattern_eth_qinq_pppoes_ipv6,			ICE_SW_INSET_MAC_PPPOE_IPV6,		ICE_INSET_NONE,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu,				ICE_SW_INSET_MAC_IPV4_GTPU,		ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu,				ICE_SW_INSET_MAC_IPV6_GTPU,		ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv4,			ICE_SW_INSET_MAC_IPV4_GTPU_IPV4,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv4,			ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv4_udp,		ICE_SW_INSET_MAC_IPV4_GTPU_IPV4_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv4_udp,		ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv4_tcp,		ICE_SW_INSET_MAC_IPV4_GTPU_IPV4_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv4_tcp,		ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv6,			ICE_SW_INSET_MAC_IPV4_GTPU_IPV6,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv6,			ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv6_udp,		ICE_SW_INSET_MAC_IPV4_GTPU_IPV6_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv6_udp,		ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv6_tcp,		ICE_SW_INSET_MAC_IPV4_GTPU_IPV6_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv6_tcp,		ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv4,			ICE_SW_INSET_MAC_IPV6_GTPU_IPV4,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv4,			ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv4_udp,		ICE_SW_INSET_MAC_IPV6_GTPU_IPV4_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv4_udp,		ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv4_tcp,		ICE_SW_INSET_MAC_IPV6_GTPU_IPV4_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv4_tcp,		ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv6,			ICE_SW_INSET_MAC_IPV6_GTPU_IPV6,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv6,			ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv6_udp,		ICE_SW_INSET_MAC_IPV6_GTPU_IPV6_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv6_udp,		ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv6_tcp,		ICE_SW_INSET_MAC_IPV6_GTPU_IPV6_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv6_tcp,		ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
 };
 
 static struct
@@ -251,6 +349,32 @@ ice_pattern_match_item ice_switch_pattern_perm_list[] = {
 	{pattern_eth_qinq_pppoes_proto,			ICE_SW_INSET_MAC_PPPOE_PROTO,		ICE_INSET_NONE,	ICE_INSET_NONE},
 	{pattern_eth_qinq_pppoes_ipv4,			ICE_SW_INSET_MAC_PPPOE_IPV4,		ICE_INSET_NONE,	ICE_INSET_NONE},
 	{pattern_eth_qinq_pppoes_ipv6,			ICE_SW_INSET_MAC_PPPOE_IPV6,		ICE_INSET_NONE,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu,				ICE_SW_INSET_MAC_IPV4_GTPU,		ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu,				ICE_SW_INSET_MAC_IPV6_GTPU,		ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv4,			ICE_SW_INSET_MAC_IPV4_GTPU_IPV4,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv4,			ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv4_udp,		ICE_SW_INSET_MAC_IPV4_GTPU_IPV4_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv4_udp,		ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv4_tcp,		ICE_SW_INSET_MAC_IPV4_GTPU_IPV4_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv4_tcp,		ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv6,			ICE_SW_INSET_MAC_IPV4_GTPU_IPV6,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv6,			ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv6_udp,		ICE_SW_INSET_MAC_IPV4_GTPU_IPV6_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv6_udp,		ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv6_tcp,		ICE_SW_INSET_MAC_IPV4_GTPU_IPV6_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv6_tcp,		ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv4,			ICE_SW_INSET_MAC_IPV6_GTPU_IPV4,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv4,			ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv4_udp,		ICE_SW_INSET_MAC_IPV6_GTPU_IPV4_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv4_udp,		ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv4_tcp,		ICE_SW_INSET_MAC_IPV6_GTPU_IPV4_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv4_tcp,		ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv6,			ICE_SW_INSET_MAC_IPV6_GTPU_IPV6,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv6,			ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv6_udp,		ICE_SW_INSET_MAC_IPV6_GTPU_IPV6_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv6_udp,		ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv6_tcp,		ICE_SW_INSET_MAC_IPV6_GTPU_IPV6_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv6_tcp,		ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
 };
 
 static int
@@ -378,6 +502,8 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
 	const struct rte_flow_item_ah *ah_spec, *ah_mask;
 	const struct rte_flow_item_l2tpv3oip *l2tp_spec, *l2tp_mask;
 	const struct rte_flow_item_pfcp *pfcp_spec, *pfcp_mask;
+	const struct rte_flow_item_gtp *gtp_spec, *gtp_mask;
+	const struct rte_flow_item_gtp_psc *gtp_psc_spec, *gtp_psc_mask;
 	uint64_t input_set = ICE_INSET_NONE;
 	uint16_t input_set_byte = 0;
 	bool pppoe_elem_valid = 0;
@@ -394,7 +520,13 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
 	bool ipv4_valid = 0;
 	bool udp_valid = 0;
 	bool tcp_valid = 0;
-	uint16_t j, t = 0;
+	bool gtpu_valid = 0;
+	bool gtpu_psc_valid = 0;
+	bool inner_ipv4_valid = 0;
+	bool inner_ipv6_valid = 0;
+	bool inner_tcp_valid = 0;
+	bool inner_udp_valid = 0;
+	uint16_t j, k, t = 0;
 
 	if (*tun_type == ICE_SW_TUN_AND_NON_TUN_QINQ ||
 	    *tun_type == ICE_NON_TUN_QINQ)
@@ -484,7 +616,11 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
 		case RTE_FLOW_ITEM_TYPE_IPV4:
 			ipv4_spec = item->spec;
 			ipv4_mask = item->mask;
-			ipv4_valid = 1;
+			if (tunnel_valid)
+				inner_ipv4_valid = 1;
+			else
+				ipv4_valid = 1;
+
 			if (ipv4_spec && ipv4_mask) {
 				/* Check IPv4 mask and update input set */
 				if (ipv4_mask->hdr.version_ihl ||
@@ -576,7 +712,10 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
 		case RTE_FLOW_ITEM_TYPE_IPV6:
 			ipv6_spec = item->spec;
 			ipv6_mask = item->mask;
-			ipv6_valid = 1;
+			if (tunnel_valid)
+				inner_ipv6_valid = 1;
+			else
+				ipv6_valid = 1;
 			if (ipv6_spec && ipv6_mask) {
 				if (ipv6_mask->hdr.payload_len) {
 					rte_flow_error_set(error, EINVAL,
@@ -694,7 +833,10 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
 		case RTE_FLOW_ITEM_TYPE_UDP:
 			udp_spec = item->spec;
 			udp_mask = item->mask;
-			udp_valid = 1;
+			if (tunnel_valid)
+				inner_udp_valid = 1;
+			else
+				udp_valid = 1;
 			if (udp_spec && udp_mask) {
 				/* Check UDP mask and update input set*/
 				if (udp_mask->hdr.dgram_len ||
@@ -747,7 +889,10 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
 		case RTE_FLOW_ITEM_TYPE_TCP:
 			tcp_spec = item->spec;
 			tcp_mask = item->mask;
-			tcp_valid = 1;
+			if (tunnel_valid)
+				inner_tcp_valid = 1;
+			else
+				tcp_valid = 1;
 			if (tcp_spec && tcp_mask) {
 				/* Check TCP mask and update input set */
 				if (tcp_mask->hdr.sent_seq ||
@@ -1263,6 +1408,71 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
 			}
 			break;
 
+		case RTE_FLOW_ITEM_TYPE_GTPU:
+			gtp_spec = item->spec;
+			gtp_mask = item->mask;
+			if (gtp_spec && !gtp_mask) {
+				rte_flow_error_set(error, EINVAL,
+					RTE_FLOW_ERROR_TYPE_ITEM,
+					item,
+					"Invalid GTP item");
+				return 0;
+			}
+			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,
+						RTE_FLOW_ERROR_TYPE_ITEM,
+						item,
+						"Invalid GTP mask");
+					return 0;
+				}
+				if (gtp_mask->teid)
+					input_set |= ICE_INSET_GTPU_TEID;
+				list[t].type = ICE_GTP;
+				list[t].h_u.gtp_hdr.teid =
+					gtp_spec->teid;
+				list[t].m_u.gtp_hdr.teid =
+					gtp_mask->teid;
+				input_set_byte += 4;
+				t++;
+			}
+			tunnel_valid = 1;
+			gtpu_valid = 1;
+			break;
+
+		case RTE_FLOW_ITEM_TYPE_GTP_PSC:
+			gtp_psc_spec = item->spec;
+			gtp_psc_mask = item->mask;
+			if (gtp_psc_spec && !gtp_psc_mask) {
+				rte_flow_error_set(error, EINVAL,
+					RTE_FLOW_ERROR_TYPE_ITEM,
+					item,
+					"Invalid GTPU_EH item");
+				return 0;
+			}
+			if (gtp_psc_spec && gtp_psc_mask) {
+				if (gtp_psc_mask->pdu_type) {
+					rte_flow_error_set(error, EINVAL,
+						RTE_FLOW_ERROR_TYPE_ITEM,
+						item,
+						"Invalid GTPU_EH mask");
+					return 0;
+				}
+				if (gtp_psc_mask->qfi)
+					input_set |= ICE_INSET_GTPU_QFI;
+				list[t].type = ICE_GTP;
+				list[t].h_u.gtp_hdr.qfi =
+					gtp_psc_spec->qfi;
+				list[t].m_u.gtp_hdr.qfi =
+					gtp_psc_mask->qfi;
+				input_set_byte += 1;
+				t++;
+			}
+			gtpu_psc_valid = 1;
+			break;
+
 		case RTE_FLOW_ITEM_TYPE_VOID:
 			break;
 
@@ -1310,6 +1520,74 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
 			*tun_type = ICE_SW_TUN_PPPOE;
 	}
 
+	if (gtpu_valid && gtpu_psc_valid) {
+		if (ipv4_valid && inner_ipv4_valid && inner_udp_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_EH_IPV4_UDP;
+		else if (ipv4_valid && inner_ipv4_valid && inner_tcp_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_EH_IPV4_TCP;
+		else if (ipv4_valid && inner_ipv4_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_EH_IPV4;
+		else if (ipv4_valid && inner_ipv6_valid && inner_udp_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_EH_IPV6_UDP;
+		else if (ipv4_valid && inner_ipv6_valid && inner_tcp_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_EH_IPV6_TCP;
+		else if (ipv4_valid && inner_ipv6_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_EH_IPV6;
+		else if (ipv6_valid && inner_ipv4_valid && inner_udp_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_EH_IPV4_UDP;
+		else if (ipv6_valid && inner_ipv4_valid && inner_tcp_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_EH_IPV4_TCP;
+		else if (ipv6_valid && inner_ipv4_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_EH_IPV4;
+		else if (ipv6_valid && inner_ipv6_valid && inner_udp_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_EH_IPV6_UDP;
+		else if (ipv6_valid && inner_ipv6_valid && inner_tcp_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_EH_IPV6_TCP;
+		else if (ipv6_valid && inner_ipv6_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_EH_IPV6;
+		else if (ipv4_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_NO_PAY;
+		else if (ipv6_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_NO_PAY;
+	} else if (gtpu_valid) {
+		if (ipv4_valid && inner_ipv4_valid && inner_udp_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_IPV4_UDP;
+		else if (ipv4_valid && inner_ipv4_valid && inner_tcp_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_IPV4_TCP;
+		else if (ipv4_valid && inner_ipv4_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_IPV4;
+		else if (ipv4_valid && inner_ipv6_valid && inner_udp_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_IPV6_UDP;
+		else if (ipv4_valid && inner_ipv6_valid && inner_tcp_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_IPV6_TCP;
+		else if (ipv4_valid && inner_ipv6_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_IPV6;
+		else if (ipv6_valid && inner_ipv4_valid && inner_udp_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_IPV4_UDP;
+		else if (ipv6_valid && inner_ipv4_valid && inner_tcp_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_IPV4_TCP;
+		else if (ipv6_valid && inner_ipv4_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_IPV4;
+		else if (ipv6_valid && inner_ipv6_valid && inner_udp_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_IPV6_UDP;
+		else if (ipv6_valid && inner_ipv6_valid && inner_tcp_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_IPV6_TCP;
+		else if (ipv6_valid && inner_ipv6_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_IPV6;
+		else if (ipv4_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_NO_PAY;
+		else if (ipv6_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_NO_PAY;
+	}
+
+	if (*tun_type == ICE_SW_TUN_IPV4_GTPU_NO_PAY ||
+	    *tun_type == ICE_SW_TUN_IPV6_GTPU_NO_PAY) {
+		for (k = 0; k < t; k++) {
+			if (list[k].type == ICE_GTP)
+				list[k].type = ICE_GTP_NO_PAY;
+		}
+	}
+
 	if (*tun_type == ICE_NON_TUN) {
 		if (vxlan_valid)
 			*tun_type = ICE_SW_TUN_VXLAN;
-- 
2.25.1


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

* [dpdk-dev] [PATCH v5 1/2] net/ice: support GTPU TEID pattern for switch filter
  2021-03-18  8:48 [dpdk-dev] [PATCH v1] net/ice: support GTPU TEID pattern for switch filter Yuying
                   ` (2 preceding siblings ...)
  2021-04-15  7:35 ` [dpdk-dev] [PATCH v4] " Yuying Zhang
@ 2021-04-15  9:29 ` Yuying Zhang
  2021-04-15  9:29   ` [dpdk-dev] [PATCH v5 2/2] net/ice/base: support GTPU for DCF " Yuying Zhang
  2021-04-15 10:47 ` [dpdk-dev] [PATCH v6 1/2] " Yuying Zhang
  4 siblings, 1 reply; 10+ messages in thread
From: Yuying Zhang @ 2021-04-15  9:29 UTC (permalink / raw)
  To: dev, qi.z.zhang; +Cc: Yuying Zhang

Enable GTPU pattern for CVL switch filter. Support teid and
qfi field of GTPU pattern. Patterns without inner l3/l4 field
support outer dst/src ip. Patterns with inner l3/l4 field only
support inner dst/src ip and inner dst/src port.

+-----------------------------------+-------------------------------------+
| Pattern                           | Input Set                           |
+-----------------------------------+-------------------------------------+
| pattern_eth_ipv4_gtpu             | teid, dst/src ip                    |
| pattern_eth_ipv6_gtpu             | teid, dst/src ip                    |
| pattern_eth_ipv4_gtpu_ipv4        | teid, dst/src ip                    |
| pattern_eth_ipv4_gtpu_ipv4_tcp    | teid, dst/src ip, dst/src port      |
| pattern_eth_ipv4_gtpu_ipv4_udp    | teid, dst/src ip, dst/src port      |
| pattern_eth_ipv4_gtpu_ipv6        | teid, dst/src ip                    |
| pattern_eth_ipv4_gtpu_ipv6_tcp    | teid, dst/src ip, dst/src port      |
| pattern_eth_ipv4_gtpu_ipv6_udp    | teid, dst/src ip, dst/src port      |
| pattern_eth_ipv6_gtpu_ipv4        | teid, dst/src ip                    |
| pattern_eth_ipv6_gtpu_ipv4_tcp    | teid, dst/src ip, dst/src port      |
| pattern_eth_ipv6_gtpu_ipv4_udp    | teid, dst/src ip, dst/src port      |
| pattern_eth_ipv6_gtpu_ipv6        | teid, dst/src ip                    |
| pattern_eth_ipv6_gtpu_ipv6_tcp    | teid, dst/src ip, dst/src port      |
| pattern_eth_ipv6_gtpu_ipv6_udp    | teid, dst/src ip, dst/src port      |
| pattern_eth_ipv4_gtpu_eh_ipv4     | teid, qfi, dst/src ip               |
| pattern_eth_ipv4_gtpu_eh_ipv4_tcp | teid, qfi, dst/src ip, dst/src port |
| pattern_eth_ipv4_gtpu_eh_ipv4_udp | teid, qfi, dst/src ip, dst/src port |
| pattern_eth_ipv4_gtpu_eh_ipv6     | teid, qfi, dst/src ip               |
| pattern_eth_ipv4_gtpu_eh_ipv6_tcp | teid, qfi, dst/src ip, dst/src port |
| pattern_eth_ipv4_gtpu_eh_ipv6_udp | teid, qfi, dst/src ip, dst/src port |
| pattern_eth_ipv6_gtpu_eh_ipv4     | teid, qfi, dst/src ip               |
| pattern_eth_ipv6_gtpu_eh_ipv4_tcp | teid, qfi, dst/src ip, dst/src port |
| pattern_eth_ipv6_gtpu_eh_ipv4_udp | teid, qfi, dst/src ip, dst/src port |
| pattern_eth_ipv6_gtpu_eh_ipv6     | teid, qfi, dst/src ip               |
| pattern_eth_ipv6_gtpu_eh_ipv6_tcp | teid, qfi, dst/src ip, dst/src port |
| pattern_eth_ipv6_gtpu_eh_ipv6_udp | teid, qfi, dst/src ip, dst/src port |
+-----------------------------------+-------------------------------------+

Signed-off-by: Yuying Zhang <yuying.zhang@intel.com>
---
 doc/guides/rel_notes/release_21_05.rst |   1 +
 drivers/net/ice/ice_switch_filter.c    | 288 ++++++++++++++++++++++++-
 2 files changed, 284 insertions(+), 5 deletions(-)

diff --git a/doc/guides/rel_notes/release_21_05.rst b/doc/guides/rel_notes/release_21_05.rst
index 3bd775772f..d28e44c997 100644
--- a/doc/guides/rel_notes/release_21_05.rst
+++ b/doc/guides/rel_notes/release_21_05.rst
@@ -125,6 +125,7 @@ New Features
 * **Updated Intel ice driver.**
 
   * Added Intel ice support on Windows.
+  * Added GTPU TEID support for DCF switch filter.
 
 * **Updated Marvell OCTEON TX2 ethdev driver.**
 
diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c
index 0bf3660677..7560fc4353 100644
--- a/drivers/net/ice/ice_switch_filter.c
+++ b/drivers/net/ice/ice_switch_filter.c
@@ -137,6 +137,78 @@
 #define ICE_SW_INSET_MAC_IPV6_PFCP ( \
 	ICE_SW_INSET_MAC_IPV6 | \
 	ICE_INSET_PFCP_S_FIELD | ICE_INSET_PFCP_SEID)
+#define ICE_SW_INSET_MAC_IPV4_GTPU ( \
+	ICE_SW_INSET_MAC_IPV4 | ICE_INSET_GTPU_TEID)
+#define ICE_SW_INSET_MAC_IPV6_GTPU ( \
+	ICE_SW_INSET_MAC_IPV6 | ICE_INSET_GTPU_TEID)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_IPV4 ( \
+	ICE_INSET_DMAC | ICE_INSET_GTPU_TEID | \
+	ICE_INSET_TUN_IPV4_SRC | ICE_INSET_TUN_IPV4_DST)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4 ( \
+	ICE_SW_INSET_MAC_IPV4_GTPU_IPV4 | ICE_INSET_GTPU_QFI)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_IPV6 ( \
+	ICE_INSET_DMAC | ICE_INSET_GTPU_TEID | \
+	ICE_INSET_TUN_IPV6_SRC | ICE_INSET_TUN_IPV6_DST)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6 ( \
+	ICE_SW_INSET_MAC_IPV4_GTPU_IPV6 | ICE_INSET_GTPU_QFI)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_IPV4 ( \
+	ICE_INSET_DMAC | ICE_INSET_GTPU_TEID | \
+	ICE_INSET_TUN_IPV4_SRC | ICE_INSET_TUN_IPV4_DST)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4 ( \
+	ICE_SW_INSET_MAC_IPV6_GTPU_IPV4 | ICE_INSET_GTPU_QFI)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_IPV6 ( \
+	ICE_INSET_DMAC | ICE_INSET_GTPU_TEID | \
+	ICE_INSET_TUN_IPV6_SRC | ICE_INSET_TUN_IPV6_DST)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6 ( \
+	ICE_SW_INSET_MAC_IPV6_GTPU_IPV6 | ICE_INSET_GTPU_QFI)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_IPV4_UDP ( \
+	ICE_SW_INSET_MAC_IPV4_GTPU_IPV4 | \
+	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4_UDP ( \
+	ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4 | \
+	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_IPV4_TCP ( \
+	ICE_SW_INSET_MAC_IPV4_GTPU_IPV4 | \
+	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4_TCP ( \
+	ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4 | \
+	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_IPV6_UDP ( \
+	ICE_SW_INSET_MAC_IPV4_GTPU_IPV6 | \
+	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6_UDP ( \
+	ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6 | \
+	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_IPV6_TCP ( \
+	ICE_SW_INSET_MAC_IPV4_GTPU_IPV6 | \
+	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6_TCP ( \
+	ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6 | \
+	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_IPV4_UDP ( \
+	ICE_SW_INSET_MAC_IPV6_GTPU_IPV4 | \
+	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4_UDP ( \
+	ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4 | \
+	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_IPV4_TCP ( \
+	ICE_SW_INSET_MAC_IPV6_GTPU_IPV4 | \
+	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4_TCP ( \
+	ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4 | \
+	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_IPV6_UDP ( \
+	ICE_SW_INSET_MAC_IPV6_GTPU_IPV6 | \
+	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6_UDP ( \
+	ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6 | \
+	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_IPV6_TCP ( \
+	ICE_SW_INSET_MAC_IPV6_GTPU_IPV6 | \
+	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6_TCP ( \
+	ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6 | \
+	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT)
 
 struct sw_meta {
 	struct ice_adv_lkup_elem *list;
@@ -198,6 +270,32 @@ ice_pattern_match_item ice_switch_pattern_dist_list[] = {
 	{pattern_eth_qinq_pppoes_proto,			ICE_SW_INSET_MAC_PPPOE_PROTO,		ICE_INSET_NONE,	ICE_INSET_NONE},
 	{pattern_eth_qinq_pppoes_ipv4,			ICE_SW_INSET_MAC_PPPOE_IPV4,		ICE_INSET_NONE,	ICE_INSET_NONE},
 	{pattern_eth_qinq_pppoes_ipv6,			ICE_SW_INSET_MAC_PPPOE_IPV6,		ICE_INSET_NONE,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu,				ICE_SW_INSET_MAC_IPV4_GTPU,		ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu,				ICE_SW_INSET_MAC_IPV6_GTPU,		ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv4,			ICE_SW_INSET_MAC_IPV4_GTPU_IPV4,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv4,			ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv4_udp,		ICE_SW_INSET_MAC_IPV4_GTPU_IPV4_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv4_udp,		ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv4_tcp,		ICE_SW_INSET_MAC_IPV4_GTPU_IPV4_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv4_tcp,		ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv6,			ICE_SW_INSET_MAC_IPV4_GTPU_IPV6,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv6,			ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv6_udp,		ICE_SW_INSET_MAC_IPV4_GTPU_IPV6_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv6_udp,		ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv6_tcp,		ICE_SW_INSET_MAC_IPV4_GTPU_IPV6_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv6_tcp,		ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv4,			ICE_SW_INSET_MAC_IPV6_GTPU_IPV4,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv4,			ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv4_udp,		ICE_SW_INSET_MAC_IPV6_GTPU_IPV4_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv4_udp,		ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv4_tcp,		ICE_SW_INSET_MAC_IPV6_GTPU_IPV4_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv4_tcp,		ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv6,			ICE_SW_INSET_MAC_IPV6_GTPU_IPV6,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv6,			ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv6_udp,		ICE_SW_INSET_MAC_IPV6_GTPU_IPV6_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv6_udp,		ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv6_tcp,		ICE_SW_INSET_MAC_IPV6_GTPU_IPV6_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv6_tcp,		ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
 };
 
 static struct
@@ -251,6 +349,32 @@ ice_pattern_match_item ice_switch_pattern_perm_list[] = {
 	{pattern_eth_qinq_pppoes_proto,			ICE_SW_INSET_MAC_PPPOE_PROTO,		ICE_INSET_NONE,	ICE_INSET_NONE},
 	{pattern_eth_qinq_pppoes_ipv4,			ICE_SW_INSET_MAC_PPPOE_IPV4,		ICE_INSET_NONE,	ICE_INSET_NONE},
 	{pattern_eth_qinq_pppoes_ipv6,			ICE_SW_INSET_MAC_PPPOE_IPV6,		ICE_INSET_NONE,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu,				ICE_SW_INSET_MAC_IPV4_GTPU,		ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu,				ICE_SW_INSET_MAC_IPV6_GTPU,		ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv4,			ICE_SW_INSET_MAC_IPV4_GTPU_IPV4,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv4,			ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv4_udp,		ICE_SW_INSET_MAC_IPV4_GTPU_IPV4_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv4_udp,		ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv4_tcp,		ICE_SW_INSET_MAC_IPV4_GTPU_IPV4_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv4_tcp,		ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv6,			ICE_SW_INSET_MAC_IPV4_GTPU_IPV6,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv6,			ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv6_udp,		ICE_SW_INSET_MAC_IPV4_GTPU_IPV6_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv6_udp,		ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv6_tcp,		ICE_SW_INSET_MAC_IPV4_GTPU_IPV6_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv6_tcp,		ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv4,			ICE_SW_INSET_MAC_IPV6_GTPU_IPV4,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv4,			ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv4_udp,		ICE_SW_INSET_MAC_IPV6_GTPU_IPV4_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv4_udp,		ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv4_tcp,		ICE_SW_INSET_MAC_IPV6_GTPU_IPV4_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv4_tcp,		ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv6,			ICE_SW_INSET_MAC_IPV6_GTPU_IPV6,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv6,			ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv6_udp,		ICE_SW_INSET_MAC_IPV6_GTPU_IPV6_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv6_udp,		ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv6_tcp,		ICE_SW_INSET_MAC_IPV6_GTPU_IPV6_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv6_tcp,		ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
 };
 
 static int
@@ -378,6 +502,8 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
 	const struct rte_flow_item_ah *ah_spec, *ah_mask;
 	const struct rte_flow_item_l2tpv3oip *l2tp_spec, *l2tp_mask;
 	const struct rte_flow_item_pfcp *pfcp_spec, *pfcp_mask;
+	const struct rte_flow_item_gtp *gtp_spec, *gtp_mask;
+	const struct rte_flow_item_gtp_psc *gtp_psc_spec, *gtp_psc_mask;
 	uint64_t input_set = ICE_INSET_NONE;
 	uint16_t input_set_byte = 0;
 	bool pppoe_elem_valid = 0;
@@ -394,7 +520,13 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
 	bool ipv4_valid = 0;
 	bool udp_valid = 0;
 	bool tcp_valid = 0;
-	uint16_t j, t = 0;
+	bool gtpu_valid = 0;
+	bool gtpu_psc_valid = 0;
+	bool inner_ipv4_valid = 0;
+	bool inner_ipv6_valid = 0;
+	bool inner_tcp_valid = 0;
+	bool inner_udp_valid = 0;
+	uint16_t j, k, t = 0;
 
 	if (*tun_type == ICE_SW_TUN_AND_NON_TUN_QINQ ||
 	    *tun_type == ICE_NON_TUN_QINQ)
@@ -484,7 +616,11 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
 		case RTE_FLOW_ITEM_TYPE_IPV4:
 			ipv4_spec = item->spec;
 			ipv4_mask = item->mask;
-			ipv4_valid = 1;
+			if (tunnel_valid)
+				inner_ipv4_valid = 1;
+			else
+				ipv4_valid = 1;
+
 			if (ipv4_spec && ipv4_mask) {
 				/* Check IPv4 mask and update input set */
 				if (ipv4_mask->hdr.version_ihl ||
@@ -576,7 +712,10 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
 		case RTE_FLOW_ITEM_TYPE_IPV6:
 			ipv6_spec = item->spec;
 			ipv6_mask = item->mask;
-			ipv6_valid = 1;
+			if (tunnel_valid)
+				inner_ipv6_valid = 1;
+			else
+				ipv6_valid = 1;
 			if (ipv6_spec && ipv6_mask) {
 				if (ipv6_mask->hdr.payload_len) {
 					rte_flow_error_set(error, EINVAL,
@@ -694,7 +833,10 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
 		case RTE_FLOW_ITEM_TYPE_UDP:
 			udp_spec = item->spec;
 			udp_mask = item->mask;
-			udp_valid = 1;
+			if (tunnel_valid)
+				inner_udp_valid = 1;
+			else
+				udp_valid = 1;
 			if (udp_spec && udp_mask) {
 				/* Check UDP mask and update input set*/
 				if (udp_mask->hdr.dgram_len ||
@@ -747,7 +889,10 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
 		case RTE_FLOW_ITEM_TYPE_TCP:
 			tcp_spec = item->spec;
 			tcp_mask = item->mask;
-			tcp_valid = 1;
+			if (tunnel_valid)
+				inner_tcp_valid = 1;
+			else
+				tcp_valid = 1;
 			if (tcp_spec && tcp_mask) {
 				/* Check TCP mask and update input set */
 				if (tcp_mask->hdr.sent_seq ||
@@ -1263,6 +1408,71 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
 			}
 			break;
 
+		case RTE_FLOW_ITEM_TYPE_GTPU:
+			gtp_spec = item->spec;
+			gtp_mask = item->mask;
+			if (gtp_spec && !gtp_mask) {
+				rte_flow_error_set(error, EINVAL,
+					RTE_FLOW_ERROR_TYPE_ITEM,
+					item,
+					"Invalid GTP item");
+				return 0;
+			}
+			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,
+						RTE_FLOW_ERROR_TYPE_ITEM,
+						item,
+						"Invalid GTP mask");
+					return 0;
+				}
+				if (gtp_mask->teid)
+					input_set |= ICE_INSET_GTPU_TEID;
+				list[t].type = ICE_GTP;
+				list[t].h_u.gtp_hdr.teid =
+					gtp_spec->teid;
+				list[t].m_u.gtp_hdr.teid =
+					gtp_mask->teid;
+				input_set_byte += 4;
+				t++;
+			}
+			tunnel_valid = 1;
+			gtpu_valid = 1;
+			break;
+
+		case RTE_FLOW_ITEM_TYPE_GTP_PSC:
+			gtp_psc_spec = item->spec;
+			gtp_psc_mask = item->mask;
+			if (gtp_psc_spec && !gtp_psc_mask) {
+				rte_flow_error_set(error, EINVAL,
+					RTE_FLOW_ERROR_TYPE_ITEM,
+					item,
+					"Invalid GTPU_EH item");
+				return 0;
+			}
+			if (gtp_psc_spec && gtp_psc_mask) {
+				if (gtp_psc_mask->pdu_type) {
+					rte_flow_error_set(error, EINVAL,
+						RTE_FLOW_ERROR_TYPE_ITEM,
+						item,
+						"Invalid GTPU_EH mask");
+					return 0;
+				}
+				if (gtp_psc_mask->qfi)
+					input_set |= ICE_INSET_GTPU_QFI;
+				list[t].type = ICE_GTP;
+				list[t].h_u.gtp_hdr.qfi =
+					gtp_psc_spec->qfi;
+				list[t].m_u.gtp_hdr.qfi =
+					gtp_psc_mask->qfi;
+				input_set_byte += 1;
+				t++;
+			}
+			gtpu_psc_valid = 1;
+			break;
+
 		case RTE_FLOW_ITEM_TYPE_VOID:
 			break;
 
@@ -1310,6 +1520,74 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
 			*tun_type = ICE_SW_TUN_PPPOE;
 	}
 
+	if (gtpu_valid && gtpu_psc_valid) {
+		if (ipv4_valid && inner_ipv4_valid && inner_udp_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_EH_IPV4_UDP;
+		else if (ipv4_valid && inner_ipv4_valid && inner_tcp_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_EH_IPV4_TCP;
+		else if (ipv4_valid && inner_ipv4_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_EH_IPV4;
+		else if (ipv4_valid && inner_ipv6_valid && inner_udp_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_EH_IPV6_UDP;
+		else if (ipv4_valid && inner_ipv6_valid && inner_tcp_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_EH_IPV6_TCP;
+		else if (ipv4_valid && inner_ipv6_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_EH_IPV6;
+		else if (ipv6_valid && inner_ipv4_valid && inner_udp_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_EH_IPV4_UDP;
+		else if (ipv6_valid && inner_ipv4_valid && inner_tcp_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_EH_IPV4_TCP;
+		else if (ipv6_valid && inner_ipv4_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_EH_IPV4;
+		else if (ipv6_valid && inner_ipv6_valid && inner_udp_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_EH_IPV6_UDP;
+		else if (ipv6_valid && inner_ipv6_valid && inner_tcp_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_EH_IPV6_TCP;
+		else if (ipv6_valid && inner_ipv6_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_EH_IPV6;
+		else if (ipv4_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_NO_PAY;
+		else if (ipv6_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_NO_PAY;
+	} else if (gtpu_valid) {
+		if (ipv4_valid && inner_ipv4_valid && inner_udp_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_IPV4_UDP;
+		else if (ipv4_valid && inner_ipv4_valid && inner_tcp_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_IPV4_TCP;
+		else if (ipv4_valid && inner_ipv4_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_IPV4;
+		else if (ipv4_valid && inner_ipv6_valid && inner_udp_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_IPV6_UDP;
+		else if (ipv4_valid && inner_ipv6_valid && inner_tcp_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_IPV6_TCP;
+		else if (ipv4_valid && inner_ipv6_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_IPV6;
+		else if (ipv6_valid && inner_ipv4_valid && inner_udp_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_IPV4_UDP;
+		else if (ipv6_valid && inner_ipv4_valid && inner_tcp_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_IPV4_TCP;
+		else if (ipv6_valid && inner_ipv4_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_IPV4;
+		else if (ipv6_valid && inner_ipv6_valid && inner_udp_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_IPV6_UDP;
+		else if (ipv6_valid && inner_ipv6_valid && inner_tcp_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_IPV6_TCP;
+		else if (ipv6_valid && inner_ipv6_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_IPV6;
+		else if (ipv4_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_NO_PAY;
+		else if (ipv6_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_NO_PAY;
+	}
+
+	if (*tun_type == ICE_SW_TUN_IPV4_GTPU_NO_PAY ||
+	    *tun_type == ICE_SW_TUN_IPV6_GTPU_NO_PAY) {
+		for (k = 0; k < t; k++) {
+			if (list[k].type == ICE_GTP)
+				list[k].type = ICE_GTP_NO_PAY;
+		}
+	}
+
 	if (*tun_type == ICE_NON_TUN) {
 		if (vxlan_valid)
 			*tun_type = ICE_SW_TUN_VXLAN;
-- 
2.25.1


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

* [dpdk-dev] [PATCH v5 2/2] net/ice/base: support GTPU for DCF switch filter
  2021-04-15  9:29 ` [dpdk-dev] [PATCH v5 1/2] " Yuying Zhang
@ 2021-04-15  9:29   ` Yuying Zhang
  0 siblings, 0 replies; 10+ messages in thread
From: Yuying Zhang @ 2021-04-15  9:29 UTC (permalink / raw)
  To: dev, qi.z.zhang; +Cc: Yuying Zhang

Enable GTPU filtering for DCF switch filter.

Signed-off-by: Yuying Zhang <yuying.zhang@intel.com>
---
 drivers/net/ice/base/ice_protocol_type.h |  20 ++
 drivers/net/ice/base/ice_switch.c        | 263 ++++++++++++++++++++---
 drivers/net/ice/base/ice_switch.h        |   5 +
 3 files changed, 260 insertions(+), 28 deletions(-)

diff --git a/drivers/net/ice/base/ice_protocol_type.h b/drivers/net/ice/base/ice_protocol_type.h
index 8c9d098e22..d1d266ffd2 100644
--- a/drivers/net/ice/base/ice_protocol_type.h
+++ b/drivers/net/ice/base/ice_protocol_type.h
@@ -76,6 +76,26 @@ enum ice_sw_tunnel_type {
 	ICE_SW_TUN_GTP,
 	ICE_SW_TUN_IPV4_GTPU_NO_PAY,
 	ICE_SW_TUN_IPV6_GTPU_NO_PAY,
+	ICE_SW_TUN_IPV4_GTPU_EH_IPV4,
+	ICE_SW_TUN_IPV4_GTPU_IPV4_UDP,
+	ICE_SW_TUN_IPV4_GTPU_EH_IPV4_UDP,
+	ICE_SW_TUN_IPV4_GTPU_IPV4_TCP,
+	ICE_SW_TUN_IPV4_GTPU_EH_IPV4_TCP,
+	ICE_SW_TUN_IPV4_GTPU_EH_IPV6,
+	ICE_SW_TUN_IPV4_GTPU_IPV6_UDP,
+	ICE_SW_TUN_IPV4_GTPU_EH_IPV6_UDP,
+	ICE_SW_TUN_IPV4_GTPU_IPV6_TCP,
+	ICE_SW_TUN_IPV4_GTPU_EH_IPV6_TCP,
+	ICE_SW_TUN_IPV6_GTPU_EH_IPV4,
+	ICE_SW_TUN_IPV6_GTPU_IPV4_UDP,
+	ICE_SW_TUN_IPV6_GTPU_EH_IPV4_UDP,
+	ICE_SW_TUN_IPV6_GTPU_IPV4_TCP,
+	ICE_SW_TUN_IPV6_GTPU_EH_IPV4_TCP,
+	ICE_SW_TUN_IPV6_GTPU_EH_IPV6,
+	ICE_SW_TUN_IPV6_GTPU_IPV6_UDP,
+	ICE_SW_TUN_IPV6_GTPU_EH_IPV6_UDP,
+	ICE_SW_TUN_IPV6_GTPU_IPV6_TCP,
+	ICE_SW_TUN_IPV6_GTPU_EH_IPV6_TCP,
 	ICE_SW_TUN_PPPOE,
 	ICE_SW_TUN_PPPOE_PAY,
 	ICE_SW_TUN_PPPOE_IPV4,
diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c
index 45f83cd10c..2a9bea4261 100644
--- a/drivers/net/ice/base/ice_switch.c
+++ b/drivers/net/ice/base/ice_switch.c
@@ -14,6 +14,7 @@
 #define ICE_PPP_IPV6_PROTO_ID		0x0057
 #define ICE_IPV6_ETHER_ID		0x86DD
 #define ICE_TCP_PROTO_ID		0x06
+#define ICE_GTPU_PROFILE		24
 #define ICE_ETH_P_8021Q			0x8100
 
 /* Dummy ethernet header needed in the ice_aqc_sw_rules_elem
@@ -1123,6 +1124,7 @@ static const u8 dummy_udp_gtp_packet[] = {
 
 	0x02, 0x00, 0x00, 0x00, /* PDU Session extension header */
 	0x00, 0x00, 0x00, 0x00,
+
 };
 
 static const struct ice_dummy_pkt_offsets dummy_ipv4_gtp_no_pay_packet_offsets[] = {
@@ -1142,6 +1144,32 @@ struct ice_dummy_pkt_offsets dummy_ipv6_gtp_no_pay_packet_offsets[] = {
 	{ ICE_PROTOCOL_LAST,	0 },
 };
 
+static const u8 dummy_ipv6_gtp_packet[] = {
+	0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x86, 0xdd,
+
+	0x60, 0x00, 0x00, 0x00, /* ICE_IPV6_OFOS 14 */
+	0x00, 0x6c, 0x11, 0x00, /* Next header UDP*/
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+
+	0x08, 0x68, 0x08, 0x68, /* ICE_UDP_OF 54 */
+	0x00, 0x00, 0x00, 0x00,
+
+	0x30, 0x00, 0x00, 0x28,  /* ICE_GTP 62 */
+	0x00, 0x00, 0x00, 0x00,
+
+	0x00, 0x00,
+};
+
 static const struct ice_dummy_pkt_offsets dummy_pppoe_packet_offsets[] = {
 	{ ICE_MAC_OFOS,		0 },
 	{ ICE_ETYPE_OL,		12 },
@@ -1785,6 +1813,33 @@ static void ice_collect_result_idx(struct ice_aqc_recipe_data_elem *buf,
 			    ~ICE_AQ_RECIPE_RESULT_EN, recp->res_idxs);
 }
 
+static struct ice_prof_type_entry ice_prof_type_tbl[ICE_GTPU_PROFILE] = {
+	{ ICE_PROFID_IPV4_GTPU_IPV4_OTHER,    ICE_SW_TUN_IPV4_GTPU_IPV4},
+	{ ICE_PROFID_IPV4_GTPU_IPV4_UDP,      ICE_SW_TUN_IPV4_GTPU_IPV4_UDP},
+	{ ICE_PROFID_IPV4_GTPU_IPV4_TCP,      ICE_SW_TUN_IPV4_GTPU_IPV4_TCP},
+	{ ICE_PROFID_IPV4_GTPU_EH_IPV4_OTHER, ICE_SW_TUN_IPV4_GTPU_EH_IPV4},
+	{ ICE_PROFID_IPV4_GTPU_EH_IPV4_UDP,   ICE_SW_TUN_IPV4_GTPU_EH_IPV4_UDP},
+	{ ICE_PROFID_IPV4_GTPU_EH_IPV4_TCP,   ICE_SW_TUN_IPV4_GTPU_EH_IPV4_TCP},
+	{ ICE_PROFID_IPV4_GTPU_IPV6_OTHER,    ICE_SW_TUN_IPV4_GTPU_IPV6},
+	{ ICE_PROFID_IPV4_GTPU_IPV6_UDP,      ICE_SW_TUN_IPV4_GTPU_IPV6_UDP},
+	{ ICE_PROFID_IPV4_GTPU_IPV6_TCP,      ICE_SW_TUN_IPV4_GTPU_IPV6_TCP},
+	{ ICE_PROFID_IPV4_GTPU_EH_IPV6_OTHER, ICE_SW_TUN_IPV4_GTPU_EH_IPV6},
+	{ ICE_PROFID_IPV4_GTPU_EH_IPV6_UDP,   ICE_SW_TUN_IPV4_GTPU_EH_IPV6_UDP},
+	{ ICE_PROFID_IPV4_GTPU_EH_IPV6_TCP,   ICE_SW_TUN_IPV4_GTPU_EH_IPV6_TCP},
+	{ ICE_PROFID_IPV6_GTPU_IPV4_OTHER,    ICE_SW_TUN_IPV6_GTPU_IPV4},
+	{ ICE_PROFID_IPV6_GTPU_IPV4_UDP,      ICE_SW_TUN_IPV6_GTPU_IPV4_UDP},
+	{ ICE_PROFID_IPV6_GTPU_IPV4_TCP,      ICE_SW_TUN_IPV6_GTPU_IPV4_TCP},
+	{ ICE_PROFID_IPV6_GTPU_EH_IPV4_OTHER, ICE_SW_TUN_IPV6_GTPU_EH_IPV4},
+	{ ICE_PROFID_IPV6_GTPU_EH_IPV4_UDP,   ICE_SW_TUN_IPV6_GTPU_EH_IPV4_UDP},
+	{ ICE_PROFID_IPV6_GTPU_EH_IPV4_TCP,   ICE_SW_TUN_IPV6_GTPU_EH_IPV4_TCP},
+	{ ICE_PROFID_IPV6_GTPU_IPV6_OTHER,    ICE_SW_TUN_IPV6_GTPU_IPV6},
+	{ ICE_PROFID_IPV6_GTPU_IPV6_UDP,      ICE_SW_TUN_IPV6_GTPU_IPV6_UDP},
+	{ ICE_PROFID_IPV6_GTPU_IPV6_TCP,      ICE_SW_TUN_IPV6_GTPU_IPV6_TCP},
+	{ ICE_PROFID_IPV6_GTPU_EH_IPV6_OTHER, ICE_SW_TUN_IPV6_GTPU_EH_IPV6},
+	{ ICE_PROFID_IPV6_GTPU_EH_IPV6_UDP,   ICE_SW_TUN_IPV6_GTPU_EH_IPV6_UDP},
+	{ ICE_PROFID_IPV6_GTPU_EH_IPV6_TCP,   ICE_SW_TUN_IPV6_GTPU_EH_IPV6_TCP},
+};
+
 /**
  * ice_get_tun_type_for_recipe - get tunnel type for the recipe
  * @rid: recipe ID that we are populating
@@ -1796,7 +1851,7 @@ static enum ice_sw_tunnel_type ice_get_tun_type_for_recipe(u8 rid, bool vlan)
 	u8 pppoe_profile[7] = {34, 35, 36, 37, 38, 39, 40};
 	u8 non_tun_profile[6] = {4, 5, 6, 7, 8, 9};
 	enum ice_sw_tunnel_type tun_type;
-	u16 i, j, profile_num = 0;
+	u16 i, j, k, profile_num = 0;
 	bool non_tun_valid = false;
 	bool pppoe_valid = false;
 	bool vxlan_valid = false;
@@ -1870,18 +1925,12 @@ static enum ice_sw_tunnel_type ice_get_tun_type_for_recipe(u8 rid, bool vlan)
 	}
 
 	if (tun_type == ICE_SW_TUN_GTP) {
-		if (ice_is_bit_set(recipe_to_profile[rid],
-				   ICE_PROFID_IPV4_GTPU_IPV4_OTHER))
-			tun_type = ICE_SW_TUN_IPV4_GTPU_IPV4;
-		else if (ice_is_bit_set(recipe_to_profile[rid],
-					ICE_PROFID_IPV4_GTPU_IPV6_OTHER))
-			tun_type = ICE_SW_TUN_IPV4_GTPU_IPV6;
-		else if (ice_is_bit_set(recipe_to_profile[rid],
-					ICE_PROFID_IPV6_GTPU_IPV4_OTHER))
-			tun_type = ICE_SW_TUN_IPV6_GTPU_IPV4;
-		else if (ice_is_bit_set(recipe_to_profile[rid],
-					ICE_PROFID_IPV6_GTPU_IPV6_OTHER))
-			tun_type = ICE_SW_TUN_IPV6_GTPU_IPV6;
+		for (k = 0; k < ARRAY_SIZE(ice_prof_type_tbl); k++)
+			if (ice_is_bit_set(recipe_to_profile[rid],
+					   ice_prof_type_tbl[k].prof_id)) {
+				tun_type = ice_prof_type_tbl[k].type;
+				break;
+			}
 	}
 
 	if (profile_num == 1 && (flag_valid || non_tun_valid || pppoe_valid)) {
@@ -6521,7 +6570,7 @@ static const struct ice_prot_ext_tbl_entry ice_prot_ext[ICE_PROTOCOL_LAST] = {
 	{ ICE_GENEVE,		{ 8, 10, 12, 14 } },
 	{ ICE_VXLAN_GPE,	{ 8, 10, 12, 14 } },
 	{ ICE_NVGRE,		{ 0, 2, 4, 6 } },
-	{ ICE_GTP,		{ 8, 10, 12, 14, 16, 18, 20 } },
+	{ ICE_GTP,		{ 8, 10, 12, 14, 16, 18, 20, 22 } },
 	{ ICE_PPPOE,		{ 0, 2, 4, 6 } },
 	{ ICE_PFCP,		{ 8, 10, 12, 14, 16, 18, 20, 22 } },
 	{ ICE_L2TPV3,		{ 0, 2, 4, 6, 8, 10 } },
@@ -7461,38 +7510,100 @@ ice_get_compat_fv_bitmap(struct ice_hw *hw, struct ice_adv_rule_info *rinfo,
 	case ICE_SW_IPV6_UDP:
 		ice_set_bit(ICE_PROFID_IPV6_UDP, bm);
 		return;
+	case ICE_SW_TUN_IPV4_GTPU_NO_PAY:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_TEID, bm);
+		return;
+	case ICE_SW_TUN_IPV6_GTPU_NO_PAY:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_TEID, bm);
+		return;
 	case ICE_SW_TUN_IPV4_GTPU_IPV4:
-		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV4_OTHER, bm);
 		ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV4_OTHER, bm);
-		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV4_UDP, bm);
 		ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV4_UDP, bm);
-		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV4_TCP, bm);
 		ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV4_TCP, bm);
 		return;
+	case ICE_SW_TUN_IPV4_GTPU_IPV4_UDP:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV4_UDP, bm);
+		return;
+	case ICE_SW_TUN_IPV4_GTPU_IPV4_TCP:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV4_TCP, bm);
+		return;
+	case ICE_SW_TUN_IPV4_GTPU_EH_IPV4:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV4_OTHER, bm);
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV4_UDP, bm);
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV4_TCP, bm);
+		return;
+	case ICE_SW_TUN_IPV4_GTPU_EH_IPV4_UDP:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV4_UDP, bm);
+		return;
+	case ICE_SW_TUN_IPV4_GTPU_EH_IPV4_TCP:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV4_TCP, bm);
+		return;
 	case ICE_SW_TUN_IPV6_GTPU_IPV4:
-		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV4_OTHER, bm);
 		ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV4_OTHER, bm);
-		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV4_UDP, bm);
 		ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV4_UDP, bm);
-		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV4_TCP, bm);
 		ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV4_TCP, bm);
 		return;
+	case ICE_SW_TUN_IPV6_GTPU_IPV4_UDP:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV4_UDP, bm);
+		return;
+	case ICE_SW_TUN_IPV6_GTPU_IPV4_TCP:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV4_TCP, bm);
+		return;
+	case ICE_SW_TUN_IPV6_GTPU_EH_IPV4:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV4_OTHER, bm);
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV4_UDP, bm);
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV4_TCP, bm);
+		return;
+	case ICE_SW_TUN_IPV6_GTPU_EH_IPV4_UDP:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV4_UDP, bm);
+		return;
+	case ICE_SW_TUN_IPV6_GTPU_EH_IPV4_TCP:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV4_TCP, bm);
+		return;
 	case ICE_SW_TUN_IPV4_GTPU_IPV6:
-		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV6_OTHER, bm);
 		ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV6_OTHER, bm);
-		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV6_UDP, bm);
 		ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV6_UDP, bm);
-		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV6_TCP, bm);
 		ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV6_TCP, bm);
 		return;
+	case ICE_SW_TUN_IPV4_GTPU_IPV6_UDP:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV6_UDP, bm);
+		return;
+	case ICE_SW_TUN_IPV4_GTPU_IPV6_TCP:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV6_TCP, bm);
+		return;
+	case ICE_SW_TUN_IPV4_GTPU_EH_IPV6:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV6_OTHER, bm);
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV6_UDP, bm);
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV6_TCP, bm);
+		return;
+	case ICE_SW_TUN_IPV4_GTPU_EH_IPV6_UDP:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV6_UDP, bm);
+		return;
+	case ICE_SW_TUN_IPV4_GTPU_EH_IPV6_TCP:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV6_TCP, bm);
+		return;
 	case ICE_SW_TUN_IPV6_GTPU_IPV6:
-		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV6_OTHER, bm);
 		ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV6_OTHER, bm);
-		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV6_UDP, bm);
 		ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV6_UDP, bm);
-		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV6_TCP, bm);
 		ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV6_TCP, bm);
 		return;
+	case ICE_SW_TUN_IPV6_GTPU_IPV6_UDP:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV6_UDP, bm);
+		return;
+	case ICE_SW_TUN_IPV6_GTPU_IPV6_TCP:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV6_TCP, bm);
+		return;
+	case ICE_SW_TUN_IPV6_GTPU_EH_IPV6:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV6_OTHER, bm);
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV6_UDP, bm);
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV6_TCP, bm);
+		return;
+	case ICE_SW_TUN_IPV6_GTPU_EH_IPV6_UDP:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV6_UDP, bm);
+		return;
+	case ICE_SW_TUN_IPV6_GTPU_EH_IPV6_TCP:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV6_TCP, bm);
+		return;
 	case ICE_SW_TUN_AND_NON_TUN:
 	case ICE_SW_TUN_AND_NON_TUN_QINQ:
 	default:
@@ -7827,8 +7938,8 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,
 		*offsets = dummy_ipv4_gtp_no_pay_packet_offsets;
 		return;
 	} else if (tun_type == ICE_SW_TUN_IPV6_GTPU_NO_PAY) {
-		*pkt = dummy_ipv6_gtpu_ipv6_packet;
-		*pkt_len = sizeof(dummy_ipv6_gtpu_ipv6_packet);
+		*pkt = dummy_ipv6_gtp_packet;
+		*pkt_len = sizeof(dummy_ipv6_gtp_packet);
 		*offsets = dummy_ipv6_gtp_no_pay_packet_offsets;
 		return;
 	}
@@ -7896,6 +8007,102 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,
 		return;
 	}
 
+	if (tun_type == ICE_SW_TUN_IPV4_GTPU_IPV4 ||
+	    tun_type == ICE_SW_TUN_IPV4_GTPU_EH_IPV4) {
+		*pkt = dummy_ipv4_gtpu_ipv4_packet;
+		*pkt_len = sizeof(dummy_ipv4_gtpu_ipv4_packet);
+		*offsets = dummy_ipv4_gtpu_ipv4_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV4_GTPU_IPV4_UDP ||
+	    tun_type == ICE_SW_TUN_IPV4_GTPU_EH_IPV4_UDP) {
+		*pkt = dummy_ipv4_gtpu_ipv4_udp_packet;
+		*pkt_len = sizeof(dummy_ipv4_gtpu_ipv4_udp_packet);
+		*offsets = dummy_ipv4_gtpu_ipv4_udp_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV4_GTPU_IPV4_TCP ||
+	    tun_type == ICE_SW_TUN_IPV4_GTPU_EH_IPV4_TCP) {
+		*pkt = dummy_ipv4_gtpu_ipv4_tcp_packet;
+		*pkt_len = sizeof(dummy_ipv4_gtpu_ipv4_tcp_packet);
+		*offsets = dummy_ipv4_gtpu_ipv4_tcp_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV4_GTPU_IPV6 ||
+	    tun_type == ICE_SW_TUN_IPV4_GTPU_EH_IPV6) {
+		*pkt = dummy_ipv4_gtpu_ipv6_packet;
+		*pkt_len = sizeof(dummy_ipv4_gtpu_ipv6_packet);
+		*offsets = dummy_ipv4_gtpu_ipv6_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV4_GTPU_IPV6_UDP ||
+	    tun_type == ICE_SW_TUN_IPV4_GTPU_EH_IPV6_UDP) {
+		*pkt = dummy_ipv4_gtpu_ipv6_udp_packet;
+		*pkt_len = sizeof(dummy_ipv4_gtpu_ipv6_udp_packet);
+		*offsets = dummy_ipv4_gtpu_ipv6_udp_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV4_GTPU_IPV6_TCP ||
+	    tun_type == ICE_SW_TUN_IPV4_GTPU_EH_IPV6_TCP) {
+		*pkt = dummy_ipv4_gtpu_ipv6_tcp_packet;
+		*pkt_len = sizeof(dummy_ipv4_gtpu_ipv6_tcp_packet);
+		*offsets = dummy_ipv4_gtpu_ipv6_tcp_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV6_GTPU_IPV4 ||
+	    tun_type == ICE_SW_TUN_IPV6_GTPU_EH_IPV4) {
+		*pkt = dummy_ipv6_gtpu_ipv4_packet;
+		*pkt_len = sizeof(dummy_ipv6_gtpu_ipv4_packet);
+		*offsets = dummy_ipv6_gtpu_ipv4_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV6_GTPU_IPV4_UDP ||
+	    tun_type == ICE_SW_TUN_IPV6_GTPU_EH_IPV4_UDP) {
+		*pkt = dummy_ipv6_gtpu_ipv4_udp_packet;
+		*pkt_len = sizeof(dummy_ipv6_gtpu_ipv4_udp_packet);
+		*offsets = dummy_ipv6_gtpu_ipv4_udp_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV6_GTPU_IPV4_TCP ||
+	    tun_type == ICE_SW_TUN_IPV6_GTPU_EH_IPV4_TCP) {
+		*pkt = dummy_ipv6_gtpu_ipv4_tcp_packet;
+		*pkt_len = sizeof(dummy_ipv6_gtpu_ipv4_tcp_packet);
+		*offsets = dummy_ipv6_gtpu_ipv4_tcp_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV6_GTPU_IPV6 ||
+	    tun_type == ICE_SW_TUN_IPV6_GTPU_EH_IPV6) {
+		*pkt = dummy_ipv6_gtpu_ipv6_packet;
+		*pkt_len = sizeof(dummy_ipv6_gtpu_ipv6_packet);
+		*offsets = dummy_ipv6_gtpu_ipv6_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV6_GTPU_IPV6_UDP ||
+	    tun_type == ICE_SW_TUN_IPV6_GTPU_EH_IPV6_UDP) {
+		*pkt = dummy_ipv6_gtpu_ipv6_udp_packet;
+		*pkt_len = sizeof(dummy_ipv6_gtpu_ipv6_udp_packet);
+		*offsets = dummy_ipv6_gtpu_ipv6_udp_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV6_GTPU_IPV6_TCP ||
+	    tun_type == ICE_SW_TUN_IPV6_GTPU_EH_IPV6_TCP) {
+		*pkt = dummy_ipv6_gtpu_ipv6_tcp_packet;
+		*pkt_len = sizeof(dummy_ipv6_gtpu_ipv6_tcp_packet);
+		*offsets = dummy_ipv6_gtpu_ipv6_tcp_packet_offsets;
+		return;
+	}
+
 	if (tun_type == ICE_SW_TUN_PPPOE && ipv6) {
 		*pkt = dummy_pppoe_ipv6_packet;
 		*pkt_len = sizeof(dummy_pppoe_ipv6_packet);
diff --git a/drivers/net/ice/base/ice_switch.h b/drivers/net/ice/base/ice_switch.h
index 61be54f9c0..980bae5806 100644
--- a/drivers/net/ice/base/ice_switch.h
+++ b/drivers/net/ice/base/ice_switch.h
@@ -216,6 +216,11 @@ struct ice_adv_lkup_elem {
 	union ice_prot_hdr m_u;	/* Mask of header values to match */
 };
 
+struct ice_prof_type_entry {
+	u16 prof_id;
+	enum ice_sw_tunnel_type type;
+};
+
 struct ice_sw_act_ctrl {
 	/* Source VSI for LOOKUP_TX or source port for LOOKUP_RX */
 	u16 src;
-- 
2.25.1


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

* [dpdk-dev] [PATCH v6 1/2] net/ice/base: support GTPU for DCF switch filter
  2021-03-18  8:48 [dpdk-dev] [PATCH v1] net/ice: support GTPU TEID pattern for switch filter Yuying
                   ` (3 preceding siblings ...)
  2021-04-15  9:29 ` [dpdk-dev] [PATCH v5 1/2] " Yuying Zhang
@ 2021-04-15 10:47 ` Yuying Zhang
  2021-04-15 10:47   ` [dpdk-dev] [PATCH v6 2/2] net/ice: support GTPU TEID pattern for " Yuying Zhang
  2021-04-15 12:21   ` [dpdk-dev] [PATCH v6 1/2] net/ice/base: support GTPU for DCF " Zhang, Qi Z
  4 siblings, 2 replies; 10+ messages in thread
From: Yuying Zhang @ 2021-04-15 10:47 UTC (permalink / raw)
  To: dev, qi.z.zhang; +Cc: Yuying Zhang

Enable GTPU filtering for DCF switch filter.

Signed-off-by: Yuying Zhang <yuying.zhang@intel.com>
---
 drivers/net/ice/base/ice_protocol_type.h |  20 ++
 drivers/net/ice/base/ice_switch.c        | 263 ++++++++++++++++++++---
 drivers/net/ice/base/ice_switch.h        |   5 +
 3 files changed, 260 insertions(+), 28 deletions(-)

diff --git a/drivers/net/ice/base/ice_protocol_type.h b/drivers/net/ice/base/ice_protocol_type.h
index 8c9d098e22..d1d266ffd2 100644
--- a/drivers/net/ice/base/ice_protocol_type.h
+++ b/drivers/net/ice/base/ice_protocol_type.h
@@ -76,6 +76,26 @@ enum ice_sw_tunnel_type {
 	ICE_SW_TUN_GTP,
 	ICE_SW_TUN_IPV4_GTPU_NO_PAY,
 	ICE_SW_TUN_IPV6_GTPU_NO_PAY,
+	ICE_SW_TUN_IPV4_GTPU_EH_IPV4,
+	ICE_SW_TUN_IPV4_GTPU_IPV4_UDP,
+	ICE_SW_TUN_IPV4_GTPU_EH_IPV4_UDP,
+	ICE_SW_TUN_IPV4_GTPU_IPV4_TCP,
+	ICE_SW_TUN_IPV4_GTPU_EH_IPV4_TCP,
+	ICE_SW_TUN_IPV4_GTPU_EH_IPV6,
+	ICE_SW_TUN_IPV4_GTPU_IPV6_UDP,
+	ICE_SW_TUN_IPV4_GTPU_EH_IPV6_UDP,
+	ICE_SW_TUN_IPV4_GTPU_IPV6_TCP,
+	ICE_SW_TUN_IPV4_GTPU_EH_IPV6_TCP,
+	ICE_SW_TUN_IPV6_GTPU_EH_IPV4,
+	ICE_SW_TUN_IPV6_GTPU_IPV4_UDP,
+	ICE_SW_TUN_IPV6_GTPU_EH_IPV4_UDP,
+	ICE_SW_TUN_IPV6_GTPU_IPV4_TCP,
+	ICE_SW_TUN_IPV6_GTPU_EH_IPV4_TCP,
+	ICE_SW_TUN_IPV6_GTPU_EH_IPV6,
+	ICE_SW_TUN_IPV6_GTPU_IPV6_UDP,
+	ICE_SW_TUN_IPV6_GTPU_EH_IPV6_UDP,
+	ICE_SW_TUN_IPV6_GTPU_IPV6_TCP,
+	ICE_SW_TUN_IPV6_GTPU_EH_IPV6_TCP,
 	ICE_SW_TUN_PPPOE,
 	ICE_SW_TUN_PPPOE_PAY,
 	ICE_SW_TUN_PPPOE_IPV4,
diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c
index 45f83cd10c..2a9bea4261 100644
--- a/drivers/net/ice/base/ice_switch.c
+++ b/drivers/net/ice/base/ice_switch.c
@@ -14,6 +14,7 @@
 #define ICE_PPP_IPV6_PROTO_ID		0x0057
 #define ICE_IPV6_ETHER_ID		0x86DD
 #define ICE_TCP_PROTO_ID		0x06
+#define ICE_GTPU_PROFILE		24
 #define ICE_ETH_P_8021Q			0x8100
 
 /* Dummy ethernet header needed in the ice_aqc_sw_rules_elem
@@ -1123,6 +1124,7 @@ static const u8 dummy_udp_gtp_packet[] = {
 
 	0x02, 0x00, 0x00, 0x00, /* PDU Session extension header */
 	0x00, 0x00, 0x00, 0x00,
+
 };
 
 static const struct ice_dummy_pkt_offsets dummy_ipv4_gtp_no_pay_packet_offsets[] = {
@@ -1142,6 +1144,32 @@ struct ice_dummy_pkt_offsets dummy_ipv6_gtp_no_pay_packet_offsets[] = {
 	{ ICE_PROTOCOL_LAST,	0 },
 };
 
+static const u8 dummy_ipv6_gtp_packet[] = {
+	0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x86, 0xdd,
+
+	0x60, 0x00, 0x00, 0x00, /* ICE_IPV6_OFOS 14 */
+	0x00, 0x6c, 0x11, 0x00, /* Next header UDP*/
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+
+	0x08, 0x68, 0x08, 0x68, /* ICE_UDP_OF 54 */
+	0x00, 0x00, 0x00, 0x00,
+
+	0x30, 0x00, 0x00, 0x28,  /* ICE_GTP 62 */
+	0x00, 0x00, 0x00, 0x00,
+
+	0x00, 0x00,
+};
+
 static const struct ice_dummy_pkt_offsets dummy_pppoe_packet_offsets[] = {
 	{ ICE_MAC_OFOS,		0 },
 	{ ICE_ETYPE_OL,		12 },
@@ -1785,6 +1813,33 @@ static void ice_collect_result_idx(struct ice_aqc_recipe_data_elem *buf,
 			    ~ICE_AQ_RECIPE_RESULT_EN, recp->res_idxs);
 }
 
+static struct ice_prof_type_entry ice_prof_type_tbl[ICE_GTPU_PROFILE] = {
+	{ ICE_PROFID_IPV4_GTPU_IPV4_OTHER,    ICE_SW_TUN_IPV4_GTPU_IPV4},
+	{ ICE_PROFID_IPV4_GTPU_IPV4_UDP,      ICE_SW_TUN_IPV4_GTPU_IPV4_UDP},
+	{ ICE_PROFID_IPV4_GTPU_IPV4_TCP,      ICE_SW_TUN_IPV4_GTPU_IPV4_TCP},
+	{ ICE_PROFID_IPV4_GTPU_EH_IPV4_OTHER, ICE_SW_TUN_IPV4_GTPU_EH_IPV4},
+	{ ICE_PROFID_IPV4_GTPU_EH_IPV4_UDP,   ICE_SW_TUN_IPV4_GTPU_EH_IPV4_UDP},
+	{ ICE_PROFID_IPV4_GTPU_EH_IPV4_TCP,   ICE_SW_TUN_IPV4_GTPU_EH_IPV4_TCP},
+	{ ICE_PROFID_IPV4_GTPU_IPV6_OTHER,    ICE_SW_TUN_IPV4_GTPU_IPV6},
+	{ ICE_PROFID_IPV4_GTPU_IPV6_UDP,      ICE_SW_TUN_IPV4_GTPU_IPV6_UDP},
+	{ ICE_PROFID_IPV4_GTPU_IPV6_TCP,      ICE_SW_TUN_IPV4_GTPU_IPV6_TCP},
+	{ ICE_PROFID_IPV4_GTPU_EH_IPV6_OTHER, ICE_SW_TUN_IPV4_GTPU_EH_IPV6},
+	{ ICE_PROFID_IPV4_GTPU_EH_IPV6_UDP,   ICE_SW_TUN_IPV4_GTPU_EH_IPV6_UDP},
+	{ ICE_PROFID_IPV4_GTPU_EH_IPV6_TCP,   ICE_SW_TUN_IPV4_GTPU_EH_IPV6_TCP},
+	{ ICE_PROFID_IPV6_GTPU_IPV4_OTHER,    ICE_SW_TUN_IPV6_GTPU_IPV4},
+	{ ICE_PROFID_IPV6_GTPU_IPV4_UDP,      ICE_SW_TUN_IPV6_GTPU_IPV4_UDP},
+	{ ICE_PROFID_IPV6_GTPU_IPV4_TCP,      ICE_SW_TUN_IPV6_GTPU_IPV4_TCP},
+	{ ICE_PROFID_IPV6_GTPU_EH_IPV4_OTHER, ICE_SW_TUN_IPV6_GTPU_EH_IPV4},
+	{ ICE_PROFID_IPV6_GTPU_EH_IPV4_UDP,   ICE_SW_TUN_IPV6_GTPU_EH_IPV4_UDP},
+	{ ICE_PROFID_IPV6_GTPU_EH_IPV4_TCP,   ICE_SW_TUN_IPV6_GTPU_EH_IPV4_TCP},
+	{ ICE_PROFID_IPV6_GTPU_IPV6_OTHER,    ICE_SW_TUN_IPV6_GTPU_IPV6},
+	{ ICE_PROFID_IPV6_GTPU_IPV6_UDP,      ICE_SW_TUN_IPV6_GTPU_IPV6_UDP},
+	{ ICE_PROFID_IPV6_GTPU_IPV6_TCP,      ICE_SW_TUN_IPV6_GTPU_IPV6_TCP},
+	{ ICE_PROFID_IPV6_GTPU_EH_IPV6_OTHER, ICE_SW_TUN_IPV6_GTPU_EH_IPV6},
+	{ ICE_PROFID_IPV6_GTPU_EH_IPV6_UDP,   ICE_SW_TUN_IPV6_GTPU_EH_IPV6_UDP},
+	{ ICE_PROFID_IPV6_GTPU_EH_IPV6_TCP,   ICE_SW_TUN_IPV6_GTPU_EH_IPV6_TCP},
+};
+
 /**
  * ice_get_tun_type_for_recipe - get tunnel type for the recipe
  * @rid: recipe ID that we are populating
@@ -1796,7 +1851,7 @@ static enum ice_sw_tunnel_type ice_get_tun_type_for_recipe(u8 rid, bool vlan)
 	u8 pppoe_profile[7] = {34, 35, 36, 37, 38, 39, 40};
 	u8 non_tun_profile[6] = {4, 5, 6, 7, 8, 9};
 	enum ice_sw_tunnel_type tun_type;
-	u16 i, j, profile_num = 0;
+	u16 i, j, k, profile_num = 0;
 	bool non_tun_valid = false;
 	bool pppoe_valid = false;
 	bool vxlan_valid = false;
@@ -1870,18 +1925,12 @@ static enum ice_sw_tunnel_type ice_get_tun_type_for_recipe(u8 rid, bool vlan)
 	}
 
 	if (tun_type == ICE_SW_TUN_GTP) {
-		if (ice_is_bit_set(recipe_to_profile[rid],
-				   ICE_PROFID_IPV4_GTPU_IPV4_OTHER))
-			tun_type = ICE_SW_TUN_IPV4_GTPU_IPV4;
-		else if (ice_is_bit_set(recipe_to_profile[rid],
-					ICE_PROFID_IPV4_GTPU_IPV6_OTHER))
-			tun_type = ICE_SW_TUN_IPV4_GTPU_IPV6;
-		else if (ice_is_bit_set(recipe_to_profile[rid],
-					ICE_PROFID_IPV6_GTPU_IPV4_OTHER))
-			tun_type = ICE_SW_TUN_IPV6_GTPU_IPV4;
-		else if (ice_is_bit_set(recipe_to_profile[rid],
-					ICE_PROFID_IPV6_GTPU_IPV6_OTHER))
-			tun_type = ICE_SW_TUN_IPV6_GTPU_IPV6;
+		for (k = 0; k < ARRAY_SIZE(ice_prof_type_tbl); k++)
+			if (ice_is_bit_set(recipe_to_profile[rid],
+					   ice_prof_type_tbl[k].prof_id)) {
+				tun_type = ice_prof_type_tbl[k].type;
+				break;
+			}
 	}
 
 	if (profile_num == 1 && (flag_valid || non_tun_valid || pppoe_valid)) {
@@ -6521,7 +6570,7 @@ static const struct ice_prot_ext_tbl_entry ice_prot_ext[ICE_PROTOCOL_LAST] = {
 	{ ICE_GENEVE,		{ 8, 10, 12, 14 } },
 	{ ICE_VXLAN_GPE,	{ 8, 10, 12, 14 } },
 	{ ICE_NVGRE,		{ 0, 2, 4, 6 } },
-	{ ICE_GTP,		{ 8, 10, 12, 14, 16, 18, 20 } },
+	{ ICE_GTP,		{ 8, 10, 12, 14, 16, 18, 20, 22 } },
 	{ ICE_PPPOE,		{ 0, 2, 4, 6 } },
 	{ ICE_PFCP,		{ 8, 10, 12, 14, 16, 18, 20, 22 } },
 	{ ICE_L2TPV3,		{ 0, 2, 4, 6, 8, 10 } },
@@ -7461,38 +7510,100 @@ ice_get_compat_fv_bitmap(struct ice_hw *hw, struct ice_adv_rule_info *rinfo,
 	case ICE_SW_IPV6_UDP:
 		ice_set_bit(ICE_PROFID_IPV6_UDP, bm);
 		return;
+	case ICE_SW_TUN_IPV4_GTPU_NO_PAY:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_TEID, bm);
+		return;
+	case ICE_SW_TUN_IPV6_GTPU_NO_PAY:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_TEID, bm);
+		return;
 	case ICE_SW_TUN_IPV4_GTPU_IPV4:
-		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV4_OTHER, bm);
 		ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV4_OTHER, bm);
-		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV4_UDP, bm);
 		ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV4_UDP, bm);
-		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV4_TCP, bm);
 		ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV4_TCP, bm);
 		return;
+	case ICE_SW_TUN_IPV4_GTPU_IPV4_UDP:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV4_UDP, bm);
+		return;
+	case ICE_SW_TUN_IPV4_GTPU_IPV4_TCP:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV4_TCP, bm);
+		return;
+	case ICE_SW_TUN_IPV4_GTPU_EH_IPV4:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV4_OTHER, bm);
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV4_UDP, bm);
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV4_TCP, bm);
+		return;
+	case ICE_SW_TUN_IPV4_GTPU_EH_IPV4_UDP:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV4_UDP, bm);
+		return;
+	case ICE_SW_TUN_IPV4_GTPU_EH_IPV4_TCP:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV4_TCP, bm);
+		return;
 	case ICE_SW_TUN_IPV6_GTPU_IPV4:
-		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV4_OTHER, bm);
 		ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV4_OTHER, bm);
-		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV4_UDP, bm);
 		ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV4_UDP, bm);
-		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV4_TCP, bm);
 		ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV4_TCP, bm);
 		return;
+	case ICE_SW_TUN_IPV6_GTPU_IPV4_UDP:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV4_UDP, bm);
+		return;
+	case ICE_SW_TUN_IPV6_GTPU_IPV4_TCP:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV4_TCP, bm);
+		return;
+	case ICE_SW_TUN_IPV6_GTPU_EH_IPV4:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV4_OTHER, bm);
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV4_UDP, bm);
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV4_TCP, bm);
+		return;
+	case ICE_SW_TUN_IPV6_GTPU_EH_IPV4_UDP:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV4_UDP, bm);
+		return;
+	case ICE_SW_TUN_IPV6_GTPU_EH_IPV4_TCP:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV4_TCP, bm);
+		return;
 	case ICE_SW_TUN_IPV4_GTPU_IPV6:
-		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV6_OTHER, bm);
 		ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV6_OTHER, bm);
-		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV6_UDP, bm);
 		ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV6_UDP, bm);
-		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV6_TCP, bm);
 		ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV6_TCP, bm);
 		return;
+	case ICE_SW_TUN_IPV4_GTPU_IPV6_UDP:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV6_UDP, bm);
+		return;
+	case ICE_SW_TUN_IPV4_GTPU_IPV6_TCP:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV6_TCP, bm);
+		return;
+	case ICE_SW_TUN_IPV4_GTPU_EH_IPV6:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV6_OTHER, bm);
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV6_UDP, bm);
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV6_TCP, bm);
+		return;
+	case ICE_SW_TUN_IPV4_GTPU_EH_IPV6_UDP:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV6_UDP, bm);
+		return;
+	case ICE_SW_TUN_IPV4_GTPU_EH_IPV6_TCP:
+		ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV6_TCP, bm);
+		return;
 	case ICE_SW_TUN_IPV6_GTPU_IPV6:
-		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV6_OTHER, bm);
 		ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV6_OTHER, bm);
-		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV6_UDP, bm);
 		ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV6_UDP, bm);
-		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV6_TCP, bm);
 		ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV6_TCP, bm);
 		return;
+	case ICE_SW_TUN_IPV6_GTPU_IPV6_UDP:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV6_UDP, bm);
+		return;
+	case ICE_SW_TUN_IPV6_GTPU_IPV6_TCP:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV6_TCP, bm);
+		return;
+	case ICE_SW_TUN_IPV6_GTPU_EH_IPV6:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV6_OTHER, bm);
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV6_UDP, bm);
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV6_TCP, bm);
+		return;
+	case ICE_SW_TUN_IPV6_GTPU_EH_IPV6_UDP:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV6_UDP, bm);
+		return;
+	case ICE_SW_TUN_IPV6_GTPU_EH_IPV6_TCP:
+		ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV6_TCP, bm);
+		return;
 	case ICE_SW_TUN_AND_NON_TUN:
 	case ICE_SW_TUN_AND_NON_TUN_QINQ:
 	default:
@@ -7827,8 +7938,8 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,
 		*offsets = dummy_ipv4_gtp_no_pay_packet_offsets;
 		return;
 	} else if (tun_type == ICE_SW_TUN_IPV6_GTPU_NO_PAY) {
-		*pkt = dummy_ipv6_gtpu_ipv6_packet;
-		*pkt_len = sizeof(dummy_ipv6_gtpu_ipv6_packet);
+		*pkt = dummy_ipv6_gtp_packet;
+		*pkt_len = sizeof(dummy_ipv6_gtp_packet);
 		*offsets = dummy_ipv6_gtp_no_pay_packet_offsets;
 		return;
 	}
@@ -7896,6 +8007,102 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,
 		return;
 	}
 
+	if (tun_type == ICE_SW_TUN_IPV4_GTPU_IPV4 ||
+	    tun_type == ICE_SW_TUN_IPV4_GTPU_EH_IPV4) {
+		*pkt = dummy_ipv4_gtpu_ipv4_packet;
+		*pkt_len = sizeof(dummy_ipv4_gtpu_ipv4_packet);
+		*offsets = dummy_ipv4_gtpu_ipv4_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV4_GTPU_IPV4_UDP ||
+	    tun_type == ICE_SW_TUN_IPV4_GTPU_EH_IPV4_UDP) {
+		*pkt = dummy_ipv4_gtpu_ipv4_udp_packet;
+		*pkt_len = sizeof(dummy_ipv4_gtpu_ipv4_udp_packet);
+		*offsets = dummy_ipv4_gtpu_ipv4_udp_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV4_GTPU_IPV4_TCP ||
+	    tun_type == ICE_SW_TUN_IPV4_GTPU_EH_IPV4_TCP) {
+		*pkt = dummy_ipv4_gtpu_ipv4_tcp_packet;
+		*pkt_len = sizeof(dummy_ipv4_gtpu_ipv4_tcp_packet);
+		*offsets = dummy_ipv4_gtpu_ipv4_tcp_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV4_GTPU_IPV6 ||
+	    tun_type == ICE_SW_TUN_IPV4_GTPU_EH_IPV6) {
+		*pkt = dummy_ipv4_gtpu_ipv6_packet;
+		*pkt_len = sizeof(dummy_ipv4_gtpu_ipv6_packet);
+		*offsets = dummy_ipv4_gtpu_ipv6_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV4_GTPU_IPV6_UDP ||
+	    tun_type == ICE_SW_TUN_IPV4_GTPU_EH_IPV6_UDP) {
+		*pkt = dummy_ipv4_gtpu_ipv6_udp_packet;
+		*pkt_len = sizeof(dummy_ipv4_gtpu_ipv6_udp_packet);
+		*offsets = dummy_ipv4_gtpu_ipv6_udp_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV4_GTPU_IPV6_TCP ||
+	    tun_type == ICE_SW_TUN_IPV4_GTPU_EH_IPV6_TCP) {
+		*pkt = dummy_ipv4_gtpu_ipv6_tcp_packet;
+		*pkt_len = sizeof(dummy_ipv4_gtpu_ipv6_tcp_packet);
+		*offsets = dummy_ipv4_gtpu_ipv6_tcp_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV6_GTPU_IPV4 ||
+	    tun_type == ICE_SW_TUN_IPV6_GTPU_EH_IPV4) {
+		*pkt = dummy_ipv6_gtpu_ipv4_packet;
+		*pkt_len = sizeof(dummy_ipv6_gtpu_ipv4_packet);
+		*offsets = dummy_ipv6_gtpu_ipv4_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV6_GTPU_IPV4_UDP ||
+	    tun_type == ICE_SW_TUN_IPV6_GTPU_EH_IPV4_UDP) {
+		*pkt = dummy_ipv6_gtpu_ipv4_udp_packet;
+		*pkt_len = sizeof(dummy_ipv6_gtpu_ipv4_udp_packet);
+		*offsets = dummy_ipv6_gtpu_ipv4_udp_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV6_GTPU_IPV4_TCP ||
+	    tun_type == ICE_SW_TUN_IPV6_GTPU_EH_IPV4_TCP) {
+		*pkt = dummy_ipv6_gtpu_ipv4_tcp_packet;
+		*pkt_len = sizeof(dummy_ipv6_gtpu_ipv4_tcp_packet);
+		*offsets = dummy_ipv6_gtpu_ipv4_tcp_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV6_GTPU_IPV6 ||
+	    tun_type == ICE_SW_TUN_IPV6_GTPU_EH_IPV6) {
+		*pkt = dummy_ipv6_gtpu_ipv6_packet;
+		*pkt_len = sizeof(dummy_ipv6_gtpu_ipv6_packet);
+		*offsets = dummy_ipv6_gtpu_ipv6_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV6_GTPU_IPV6_UDP ||
+	    tun_type == ICE_SW_TUN_IPV6_GTPU_EH_IPV6_UDP) {
+		*pkt = dummy_ipv6_gtpu_ipv6_udp_packet;
+		*pkt_len = sizeof(dummy_ipv6_gtpu_ipv6_udp_packet);
+		*offsets = dummy_ipv6_gtpu_ipv6_udp_packet_offsets;
+		return;
+	}
+
+	if (tun_type == ICE_SW_TUN_IPV6_GTPU_IPV6_TCP ||
+	    tun_type == ICE_SW_TUN_IPV6_GTPU_EH_IPV6_TCP) {
+		*pkt = dummy_ipv6_gtpu_ipv6_tcp_packet;
+		*pkt_len = sizeof(dummy_ipv6_gtpu_ipv6_tcp_packet);
+		*offsets = dummy_ipv6_gtpu_ipv6_tcp_packet_offsets;
+		return;
+	}
+
 	if (tun_type == ICE_SW_TUN_PPPOE && ipv6) {
 		*pkt = dummy_pppoe_ipv6_packet;
 		*pkt_len = sizeof(dummy_pppoe_ipv6_packet);
diff --git a/drivers/net/ice/base/ice_switch.h b/drivers/net/ice/base/ice_switch.h
index 61be54f9c0..980bae5806 100644
--- a/drivers/net/ice/base/ice_switch.h
+++ b/drivers/net/ice/base/ice_switch.h
@@ -216,6 +216,11 @@ struct ice_adv_lkup_elem {
 	union ice_prot_hdr m_u;	/* Mask of header values to match */
 };
 
+struct ice_prof_type_entry {
+	u16 prof_id;
+	enum ice_sw_tunnel_type type;
+};
+
 struct ice_sw_act_ctrl {
 	/* Source VSI for LOOKUP_TX or source port for LOOKUP_RX */
 	u16 src;
-- 
2.25.1


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

* [dpdk-dev] [PATCH v6 2/2] net/ice: support GTPU TEID pattern for switch filter
  2021-04-15 10:47 ` [dpdk-dev] [PATCH v6 1/2] " Yuying Zhang
@ 2021-04-15 10:47   ` Yuying Zhang
  2021-04-15 12:21     ` Zhang, Qi Z
  2021-04-15 12:21   ` [dpdk-dev] [PATCH v6 1/2] net/ice/base: support GTPU for DCF " Zhang, Qi Z
  1 sibling, 1 reply; 10+ messages in thread
From: Yuying Zhang @ 2021-04-15 10:47 UTC (permalink / raw)
  To: dev, qi.z.zhang; +Cc: Yuying Zhang

Enable GTPU pattern for CVL switch filter. Support teid and
qfi field of GTPU pattern. Patterns without inner l3/l4 field
support outer dst/src ip. Patterns with inner l3/l4 field only
support inner dst/src ip and inner dst/src port.

+-----------------------------------+-------------------------------------+
| Pattern                           | Input Set                           |
+-----------------------------------+-------------------------------------+
| pattern_eth_ipv4_gtpu             | teid, dst/src ip                    |
| pattern_eth_ipv6_gtpu             | teid, dst/src ip                    |
| pattern_eth_ipv4_gtpu_ipv4        | teid, dst/src ip                    |
| pattern_eth_ipv4_gtpu_ipv4_tcp    | teid, dst/src ip, dst/src port      |
| pattern_eth_ipv4_gtpu_ipv4_udp    | teid, dst/src ip, dst/src port      |
| pattern_eth_ipv4_gtpu_ipv6        | teid, dst/src ip                    |
| pattern_eth_ipv4_gtpu_ipv6_tcp    | teid, dst/src ip, dst/src port      |
| pattern_eth_ipv4_gtpu_ipv6_udp    | teid, dst/src ip, dst/src port      |
| pattern_eth_ipv6_gtpu_ipv4        | teid, dst/src ip                    |
| pattern_eth_ipv6_gtpu_ipv4_tcp    | teid, dst/src ip, dst/src port      |
| pattern_eth_ipv6_gtpu_ipv4_udp    | teid, dst/src ip, dst/src port      |
| pattern_eth_ipv6_gtpu_ipv6        | teid, dst/src ip                    |
| pattern_eth_ipv6_gtpu_ipv6_tcp    | teid, dst/src ip, dst/src port      |
| pattern_eth_ipv6_gtpu_ipv6_udp    | teid, dst/src ip, dst/src port      |
| pattern_eth_ipv4_gtpu_eh_ipv4     | teid, qfi, dst/src ip               |
| pattern_eth_ipv4_gtpu_eh_ipv4_tcp | teid, qfi, dst/src ip, dst/src port |
| pattern_eth_ipv4_gtpu_eh_ipv4_udp | teid, qfi, dst/src ip, dst/src port |
| pattern_eth_ipv4_gtpu_eh_ipv6     | teid, qfi, dst/src ip               |
| pattern_eth_ipv4_gtpu_eh_ipv6_tcp | teid, qfi, dst/src ip, dst/src port |
| pattern_eth_ipv4_gtpu_eh_ipv6_udp | teid, qfi, dst/src ip, dst/src port |
| pattern_eth_ipv6_gtpu_eh_ipv4     | teid, qfi, dst/src ip               |
| pattern_eth_ipv6_gtpu_eh_ipv4_tcp | teid, qfi, dst/src ip, dst/src port |
| pattern_eth_ipv6_gtpu_eh_ipv4_udp | teid, qfi, dst/src ip, dst/src port |
| pattern_eth_ipv6_gtpu_eh_ipv6     | teid, qfi, dst/src ip               |
| pattern_eth_ipv6_gtpu_eh_ipv6_tcp | teid, qfi, dst/src ip, dst/src port |
| pattern_eth_ipv6_gtpu_eh_ipv6_udp | teid, qfi, dst/src ip, dst/src port |
+-----------------------------------+-------------------------------------+

Signed-off-by: Yuying Zhang <yuying.zhang@intel.com>
---
 doc/guides/rel_notes/release_21_05.rst |   1 +
 drivers/net/ice/ice_switch_filter.c    | 288 ++++++++++++++++++++++++-
 2 files changed, 284 insertions(+), 5 deletions(-)

diff --git a/doc/guides/rel_notes/release_21_05.rst b/doc/guides/rel_notes/release_21_05.rst
index 3bd775772f..d28e44c997 100644
--- a/doc/guides/rel_notes/release_21_05.rst
+++ b/doc/guides/rel_notes/release_21_05.rst
@@ -125,6 +125,7 @@ New Features
 * **Updated Intel ice driver.**
 
   * Added Intel ice support on Windows.
+  * Added GTPU TEID support for DCF switch filter.
 
 * **Updated Marvell OCTEON TX2 ethdev driver.**
 
diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c
index 0bf3660677..7560fc4353 100644
--- a/drivers/net/ice/ice_switch_filter.c
+++ b/drivers/net/ice/ice_switch_filter.c
@@ -137,6 +137,78 @@
 #define ICE_SW_INSET_MAC_IPV6_PFCP ( \
 	ICE_SW_INSET_MAC_IPV6 | \
 	ICE_INSET_PFCP_S_FIELD | ICE_INSET_PFCP_SEID)
+#define ICE_SW_INSET_MAC_IPV4_GTPU ( \
+	ICE_SW_INSET_MAC_IPV4 | ICE_INSET_GTPU_TEID)
+#define ICE_SW_INSET_MAC_IPV6_GTPU ( \
+	ICE_SW_INSET_MAC_IPV6 | ICE_INSET_GTPU_TEID)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_IPV4 ( \
+	ICE_INSET_DMAC | ICE_INSET_GTPU_TEID | \
+	ICE_INSET_TUN_IPV4_SRC | ICE_INSET_TUN_IPV4_DST)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4 ( \
+	ICE_SW_INSET_MAC_IPV4_GTPU_IPV4 | ICE_INSET_GTPU_QFI)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_IPV6 ( \
+	ICE_INSET_DMAC | ICE_INSET_GTPU_TEID | \
+	ICE_INSET_TUN_IPV6_SRC | ICE_INSET_TUN_IPV6_DST)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6 ( \
+	ICE_SW_INSET_MAC_IPV4_GTPU_IPV6 | ICE_INSET_GTPU_QFI)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_IPV4 ( \
+	ICE_INSET_DMAC | ICE_INSET_GTPU_TEID | \
+	ICE_INSET_TUN_IPV4_SRC | ICE_INSET_TUN_IPV4_DST)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4 ( \
+	ICE_SW_INSET_MAC_IPV6_GTPU_IPV4 | ICE_INSET_GTPU_QFI)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_IPV6 ( \
+	ICE_INSET_DMAC | ICE_INSET_GTPU_TEID | \
+	ICE_INSET_TUN_IPV6_SRC | ICE_INSET_TUN_IPV6_DST)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6 ( \
+	ICE_SW_INSET_MAC_IPV6_GTPU_IPV6 | ICE_INSET_GTPU_QFI)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_IPV4_UDP ( \
+	ICE_SW_INSET_MAC_IPV4_GTPU_IPV4 | \
+	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4_UDP ( \
+	ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4 | \
+	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_IPV4_TCP ( \
+	ICE_SW_INSET_MAC_IPV4_GTPU_IPV4 | \
+	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4_TCP ( \
+	ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4 | \
+	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_IPV6_UDP ( \
+	ICE_SW_INSET_MAC_IPV4_GTPU_IPV6 | \
+	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6_UDP ( \
+	ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6 | \
+	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_IPV6_TCP ( \
+	ICE_SW_INSET_MAC_IPV4_GTPU_IPV6 | \
+	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6_TCP ( \
+	ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6 | \
+	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_IPV4_UDP ( \
+	ICE_SW_INSET_MAC_IPV6_GTPU_IPV4 | \
+	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4_UDP ( \
+	ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4 | \
+	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_IPV4_TCP ( \
+	ICE_SW_INSET_MAC_IPV6_GTPU_IPV4 | \
+	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4_TCP ( \
+	ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4 | \
+	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_IPV6_UDP ( \
+	ICE_SW_INSET_MAC_IPV6_GTPU_IPV6 | \
+	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6_UDP ( \
+	ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6 | \
+	ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_IPV6_TCP ( \
+	ICE_SW_INSET_MAC_IPV6_GTPU_IPV6 | \
+	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT)
+#define ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6_TCP ( \
+	ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6 | \
+	ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT)
 
 struct sw_meta {
 	struct ice_adv_lkup_elem *list;
@@ -198,6 +270,32 @@ ice_pattern_match_item ice_switch_pattern_dist_list[] = {
 	{pattern_eth_qinq_pppoes_proto,			ICE_SW_INSET_MAC_PPPOE_PROTO,		ICE_INSET_NONE,	ICE_INSET_NONE},
 	{pattern_eth_qinq_pppoes_ipv4,			ICE_SW_INSET_MAC_PPPOE_IPV4,		ICE_INSET_NONE,	ICE_INSET_NONE},
 	{pattern_eth_qinq_pppoes_ipv6,			ICE_SW_INSET_MAC_PPPOE_IPV6,		ICE_INSET_NONE,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu,				ICE_SW_INSET_MAC_IPV4_GTPU,		ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu,				ICE_SW_INSET_MAC_IPV6_GTPU,		ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv4,			ICE_SW_INSET_MAC_IPV4_GTPU_IPV4,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv4,			ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv4_udp,		ICE_SW_INSET_MAC_IPV4_GTPU_IPV4_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv4_udp,		ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv4_tcp,		ICE_SW_INSET_MAC_IPV4_GTPU_IPV4_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv4_tcp,		ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv6,			ICE_SW_INSET_MAC_IPV4_GTPU_IPV6,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv6,			ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv6_udp,		ICE_SW_INSET_MAC_IPV4_GTPU_IPV6_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv6_udp,		ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv6_tcp,		ICE_SW_INSET_MAC_IPV4_GTPU_IPV6_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv6_tcp,		ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv4,			ICE_SW_INSET_MAC_IPV6_GTPU_IPV4,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv4,			ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv4_udp,		ICE_SW_INSET_MAC_IPV6_GTPU_IPV4_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv4_udp,		ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv4_tcp,		ICE_SW_INSET_MAC_IPV6_GTPU_IPV4_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv4_tcp,		ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv6,			ICE_SW_INSET_MAC_IPV6_GTPU_IPV6,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv6,			ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv6_udp,		ICE_SW_INSET_MAC_IPV6_GTPU_IPV6_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv6_udp,		ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv6_tcp,		ICE_SW_INSET_MAC_IPV6_GTPU_IPV6_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv6_tcp,		ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
 };
 
 static struct
@@ -251,6 +349,32 @@ ice_pattern_match_item ice_switch_pattern_perm_list[] = {
 	{pattern_eth_qinq_pppoes_proto,			ICE_SW_INSET_MAC_PPPOE_PROTO,		ICE_INSET_NONE,	ICE_INSET_NONE},
 	{pattern_eth_qinq_pppoes_ipv4,			ICE_SW_INSET_MAC_PPPOE_IPV4,		ICE_INSET_NONE,	ICE_INSET_NONE},
 	{pattern_eth_qinq_pppoes_ipv6,			ICE_SW_INSET_MAC_PPPOE_IPV6,		ICE_INSET_NONE,	ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu,				ICE_SW_INSET_MAC_IPV4_GTPU,		ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu,				ICE_SW_INSET_MAC_IPV6_GTPU,		ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv4,			ICE_SW_INSET_MAC_IPV4_GTPU_IPV4,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv4,			ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv4_udp,		ICE_SW_INSET_MAC_IPV4_GTPU_IPV4_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv4_udp,		ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv4_tcp,		ICE_SW_INSET_MAC_IPV4_GTPU_IPV4_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv4_tcp,		ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv6,			ICE_SW_INSET_MAC_IPV4_GTPU_IPV6,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv6,			ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv6_udp,		ICE_SW_INSET_MAC_IPV4_GTPU_IPV6_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv6_udp,		ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_ipv6_tcp,		ICE_SW_INSET_MAC_IPV4_GTPU_IPV6_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv4_gtpu_eh_ipv6_tcp,		ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv4,			ICE_SW_INSET_MAC_IPV6_GTPU_IPV4,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv4,			ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv4_udp,		ICE_SW_INSET_MAC_IPV6_GTPU_IPV4_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv4_udp,		ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv4_tcp,		ICE_SW_INSET_MAC_IPV6_GTPU_IPV4_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv4_tcp,		ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv6,			ICE_SW_INSET_MAC_IPV6_GTPU_IPV6,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv6,			ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv6_udp,		ICE_SW_INSET_MAC_IPV6_GTPU_IPV6_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv6_udp,		ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_ipv6_tcp,		ICE_SW_INSET_MAC_IPV6_GTPU_IPV6_UDP,	ICE_INSET_NONE, ICE_INSET_NONE},
+	{pattern_eth_ipv6_gtpu_eh_ipv6_tcp,		ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6_TCP,	ICE_INSET_NONE, ICE_INSET_NONE},
 };
 
 static int
@@ -378,6 +502,8 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
 	const struct rte_flow_item_ah *ah_spec, *ah_mask;
 	const struct rte_flow_item_l2tpv3oip *l2tp_spec, *l2tp_mask;
 	const struct rte_flow_item_pfcp *pfcp_spec, *pfcp_mask;
+	const struct rte_flow_item_gtp *gtp_spec, *gtp_mask;
+	const struct rte_flow_item_gtp_psc *gtp_psc_spec, *gtp_psc_mask;
 	uint64_t input_set = ICE_INSET_NONE;
 	uint16_t input_set_byte = 0;
 	bool pppoe_elem_valid = 0;
@@ -394,7 +520,13 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
 	bool ipv4_valid = 0;
 	bool udp_valid = 0;
 	bool tcp_valid = 0;
-	uint16_t j, t = 0;
+	bool gtpu_valid = 0;
+	bool gtpu_psc_valid = 0;
+	bool inner_ipv4_valid = 0;
+	bool inner_ipv6_valid = 0;
+	bool inner_tcp_valid = 0;
+	bool inner_udp_valid = 0;
+	uint16_t j, k, t = 0;
 
 	if (*tun_type == ICE_SW_TUN_AND_NON_TUN_QINQ ||
 	    *tun_type == ICE_NON_TUN_QINQ)
@@ -484,7 +616,11 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
 		case RTE_FLOW_ITEM_TYPE_IPV4:
 			ipv4_spec = item->spec;
 			ipv4_mask = item->mask;
-			ipv4_valid = 1;
+			if (tunnel_valid)
+				inner_ipv4_valid = 1;
+			else
+				ipv4_valid = 1;
+
 			if (ipv4_spec && ipv4_mask) {
 				/* Check IPv4 mask and update input set */
 				if (ipv4_mask->hdr.version_ihl ||
@@ -576,7 +712,10 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
 		case RTE_FLOW_ITEM_TYPE_IPV6:
 			ipv6_spec = item->spec;
 			ipv6_mask = item->mask;
-			ipv6_valid = 1;
+			if (tunnel_valid)
+				inner_ipv6_valid = 1;
+			else
+				ipv6_valid = 1;
 			if (ipv6_spec && ipv6_mask) {
 				if (ipv6_mask->hdr.payload_len) {
 					rte_flow_error_set(error, EINVAL,
@@ -694,7 +833,10 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
 		case RTE_FLOW_ITEM_TYPE_UDP:
 			udp_spec = item->spec;
 			udp_mask = item->mask;
-			udp_valid = 1;
+			if (tunnel_valid)
+				inner_udp_valid = 1;
+			else
+				udp_valid = 1;
 			if (udp_spec && udp_mask) {
 				/* Check UDP mask and update input set*/
 				if (udp_mask->hdr.dgram_len ||
@@ -747,7 +889,10 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
 		case RTE_FLOW_ITEM_TYPE_TCP:
 			tcp_spec = item->spec;
 			tcp_mask = item->mask;
-			tcp_valid = 1;
+			if (tunnel_valid)
+				inner_tcp_valid = 1;
+			else
+				tcp_valid = 1;
 			if (tcp_spec && tcp_mask) {
 				/* Check TCP mask and update input set */
 				if (tcp_mask->hdr.sent_seq ||
@@ -1263,6 +1408,71 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
 			}
 			break;
 
+		case RTE_FLOW_ITEM_TYPE_GTPU:
+			gtp_spec = item->spec;
+			gtp_mask = item->mask;
+			if (gtp_spec && !gtp_mask) {
+				rte_flow_error_set(error, EINVAL,
+					RTE_FLOW_ERROR_TYPE_ITEM,
+					item,
+					"Invalid GTP item");
+				return 0;
+			}
+			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,
+						RTE_FLOW_ERROR_TYPE_ITEM,
+						item,
+						"Invalid GTP mask");
+					return 0;
+				}
+				if (gtp_mask->teid)
+					input_set |= ICE_INSET_GTPU_TEID;
+				list[t].type = ICE_GTP;
+				list[t].h_u.gtp_hdr.teid =
+					gtp_spec->teid;
+				list[t].m_u.gtp_hdr.teid =
+					gtp_mask->teid;
+				input_set_byte += 4;
+				t++;
+			}
+			tunnel_valid = 1;
+			gtpu_valid = 1;
+			break;
+
+		case RTE_FLOW_ITEM_TYPE_GTP_PSC:
+			gtp_psc_spec = item->spec;
+			gtp_psc_mask = item->mask;
+			if (gtp_psc_spec && !gtp_psc_mask) {
+				rte_flow_error_set(error, EINVAL,
+					RTE_FLOW_ERROR_TYPE_ITEM,
+					item,
+					"Invalid GTPU_EH item");
+				return 0;
+			}
+			if (gtp_psc_spec && gtp_psc_mask) {
+				if (gtp_psc_mask->pdu_type) {
+					rte_flow_error_set(error, EINVAL,
+						RTE_FLOW_ERROR_TYPE_ITEM,
+						item,
+						"Invalid GTPU_EH mask");
+					return 0;
+				}
+				if (gtp_psc_mask->qfi)
+					input_set |= ICE_INSET_GTPU_QFI;
+				list[t].type = ICE_GTP;
+				list[t].h_u.gtp_hdr.qfi =
+					gtp_psc_spec->qfi;
+				list[t].m_u.gtp_hdr.qfi =
+					gtp_psc_mask->qfi;
+				input_set_byte += 1;
+				t++;
+			}
+			gtpu_psc_valid = 1;
+			break;
+
 		case RTE_FLOW_ITEM_TYPE_VOID:
 			break;
 
@@ -1310,6 +1520,74 @@ ice_switch_inset_get(const struct rte_flow_item pattern[],
 			*tun_type = ICE_SW_TUN_PPPOE;
 	}
 
+	if (gtpu_valid && gtpu_psc_valid) {
+		if (ipv4_valid && inner_ipv4_valid && inner_udp_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_EH_IPV4_UDP;
+		else if (ipv4_valid && inner_ipv4_valid && inner_tcp_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_EH_IPV4_TCP;
+		else if (ipv4_valid && inner_ipv4_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_EH_IPV4;
+		else if (ipv4_valid && inner_ipv6_valid && inner_udp_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_EH_IPV6_UDP;
+		else if (ipv4_valid && inner_ipv6_valid && inner_tcp_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_EH_IPV6_TCP;
+		else if (ipv4_valid && inner_ipv6_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_EH_IPV6;
+		else if (ipv6_valid && inner_ipv4_valid && inner_udp_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_EH_IPV4_UDP;
+		else if (ipv6_valid && inner_ipv4_valid && inner_tcp_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_EH_IPV4_TCP;
+		else if (ipv6_valid && inner_ipv4_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_EH_IPV4;
+		else if (ipv6_valid && inner_ipv6_valid && inner_udp_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_EH_IPV6_UDP;
+		else if (ipv6_valid && inner_ipv6_valid && inner_tcp_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_EH_IPV6_TCP;
+		else if (ipv6_valid && inner_ipv6_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_EH_IPV6;
+		else if (ipv4_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_NO_PAY;
+		else if (ipv6_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_NO_PAY;
+	} else if (gtpu_valid) {
+		if (ipv4_valid && inner_ipv4_valid && inner_udp_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_IPV4_UDP;
+		else if (ipv4_valid && inner_ipv4_valid && inner_tcp_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_IPV4_TCP;
+		else if (ipv4_valid && inner_ipv4_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_IPV4;
+		else if (ipv4_valid && inner_ipv6_valid && inner_udp_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_IPV6_UDP;
+		else if (ipv4_valid && inner_ipv6_valid && inner_tcp_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_IPV6_TCP;
+		else if (ipv4_valid && inner_ipv6_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_IPV6;
+		else if (ipv6_valid && inner_ipv4_valid && inner_udp_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_IPV4_UDP;
+		else if (ipv6_valid && inner_ipv4_valid && inner_tcp_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_IPV4_TCP;
+		else if (ipv6_valid && inner_ipv4_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_IPV4;
+		else if (ipv6_valid && inner_ipv6_valid && inner_udp_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_IPV6_UDP;
+		else if (ipv6_valid && inner_ipv6_valid && inner_tcp_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_IPV6_TCP;
+		else if (ipv6_valid && inner_ipv6_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_IPV6;
+		else if (ipv4_valid)
+			*tun_type = ICE_SW_TUN_IPV4_GTPU_NO_PAY;
+		else if (ipv6_valid)
+			*tun_type = ICE_SW_TUN_IPV6_GTPU_NO_PAY;
+	}
+
+	if (*tun_type == ICE_SW_TUN_IPV4_GTPU_NO_PAY ||
+	    *tun_type == ICE_SW_TUN_IPV6_GTPU_NO_PAY) {
+		for (k = 0; k < t; k++) {
+			if (list[k].type == ICE_GTP)
+				list[k].type = ICE_GTP_NO_PAY;
+		}
+	}
+
 	if (*tun_type == ICE_NON_TUN) {
 		if (vxlan_valid)
 			*tun_type = ICE_SW_TUN_VXLAN;
-- 
2.25.1


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

* Re: [dpdk-dev] [PATCH v6 1/2] net/ice/base: support GTPU for DCF switch filter
  2021-04-15 10:47 ` [dpdk-dev] [PATCH v6 1/2] " Yuying Zhang
  2021-04-15 10:47   ` [dpdk-dev] [PATCH v6 2/2] net/ice: support GTPU TEID pattern for " Yuying Zhang
@ 2021-04-15 12:21   ` Zhang, Qi Z
  1 sibling, 0 replies; 10+ messages in thread
From: Zhang, Qi Z @ 2021-04-15 12:21 UTC (permalink / raw)
  To: Zhang, Yuying, dev



> -----Original Message-----
> From: Zhang, Yuying <yuying.zhang@intel.com>
> Sent: Thursday, April 15, 2021 6:48 PM
> To: dev@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: Zhang, Yuying <yuying.zhang@intel.com>
> Subject: [PATCH v6 1/2] net/ice/base: support GTPU for DCF switch filter
> 
> Enable GTPU filtering for DCF switch filter.
> 
> Signed-off-by: Yuying Zhang <yuying.zhang@intel.com>

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

Applied to dpdk-next-net-intel.

Thanks
Qi


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

* Re: [dpdk-dev] [PATCH v6 2/2] net/ice: support GTPU TEID pattern for switch filter
  2021-04-15 10:47   ` [dpdk-dev] [PATCH v6 2/2] net/ice: support GTPU TEID pattern for " Yuying Zhang
@ 2021-04-15 12:21     ` Zhang, Qi Z
  0 siblings, 0 replies; 10+ messages in thread
From: Zhang, Qi Z @ 2021-04-15 12:21 UTC (permalink / raw)
  To: Zhang, Yuying, dev



> -----Original Message-----
> From: Zhang, Yuying <yuying.zhang@intel.com>
> Sent: Thursday, April 15, 2021 6:48 PM
> To: dev@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: Zhang, Yuying <yuying.zhang@intel.com>
> Subject: [PATCH v6 2/2] net/ice: support GTPU TEID pattern for switch filter
> 
> Enable GTPU pattern for CVL switch filter. Support teid and qfi field of GTPU
> pattern. Patterns without inner l3/l4 field support outer dst/src ip. Patterns
> with inner l3/l4 field only support inner dst/src ip and inner dst/src port.
> 
> +-----------------------------------+-------------------------------------+
> | Pattern                           | Input Set
> |
> +-----------------------------------+-------------------------------------+
> | pattern_eth_ipv4_gtpu             | teid, dst/src ip
> |
> | pattern_eth_ipv6_gtpu             | teid, dst/src ip
> |
> | pattern_eth_ipv4_gtpu_ipv4        | teid, dst/src ip
> |
> | pattern_eth_ipv4_gtpu_ipv4_tcp    | teid, dst/src ip, dst/src port      |
> | pattern_eth_ipv4_gtpu_ipv4_udp    | teid, dst/src ip, dst/src port      |
> | pattern_eth_ipv4_gtpu_ipv6        | teid, dst/src ip
> |
> | pattern_eth_ipv4_gtpu_ipv6_tcp    | teid, dst/src ip, dst/src port      |
> | pattern_eth_ipv4_gtpu_ipv6_udp    | teid, dst/src ip, dst/src port      |
> | pattern_eth_ipv6_gtpu_ipv4        | teid, dst/src ip
> |
> | pattern_eth_ipv6_gtpu_ipv4_tcp    | teid, dst/src ip, dst/src port      |
> | pattern_eth_ipv6_gtpu_ipv4_udp    | teid, dst/src ip, dst/src port      |
> | pattern_eth_ipv6_gtpu_ipv6        | teid, dst/src ip
> |
> | pattern_eth_ipv6_gtpu_ipv6_tcp    | teid, dst/src ip, dst/src port      |
> | pattern_eth_ipv6_gtpu_ipv6_udp    | teid, dst/src ip, dst/src port      |
> | pattern_eth_ipv4_gtpu_eh_ipv4     | teid, qfi, dst/src ip               |
> | pattern_eth_ipv4_gtpu_eh_ipv4_tcp | teid, qfi, dst/src ip, dst/src
> | port | pattern_eth_ipv4_gtpu_eh_ipv4_udp | teid, qfi, dst/src ip, dst/src port
> |
> | pattern_eth_ipv4_gtpu_eh_ipv6     | teid, qfi, dst/src ip               |
> | pattern_eth_ipv4_gtpu_eh_ipv6_tcp | teid, qfi, dst/src ip, dst/src
> | port | pattern_eth_ipv4_gtpu_eh_ipv6_udp | teid, qfi, dst/src ip, dst/src port
> |
> | pattern_eth_ipv6_gtpu_eh_ipv4     | teid, qfi, dst/src ip               |
> | pattern_eth_ipv6_gtpu_eh_ipv4_tcp | teid, qfi, dst/src ip, dst/src
> | port | pattern_eth_ipv6_gtpu_eh_ipv4_udp | teid, qfi, dst/src ip, dst/src port
> |
> | pattern_eth_ipv6_gtpu_eh_ipv6     | teid, qfi, dst/src ip               |
> | pattern_eth_ipv6_gtpu_eh_ipv6_tcp | teid, qfi, dst/src ip, dst/src
> | port | pattern_eth_ipv6_gtpu_eh_ipv6_udp | teid, qfi, dst/src ip,
> | dst/src port |
> +-----------------------------------+-------------------------------------+
> 
> Signed-off-by: Yuying Zhang <yuying.zhang@intel.com>

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

Applied to dpdk-next-net-intel.

Thanks
Qi


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

end of thread, other threads:[~2021-04-15 12:21 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-18  8:48 [dpdk-dev] [PATCH v1] net/ice: support GTPU TEID pattern for switch filter Yuying
2021-03-30  9:14 ` [dpdk-dev] [PATCH v2] " Yuying Zhang
2021-04-07  5:15 ` [dpdk-dev] [PATCH v3] " Yuying Zhang
2021-04-15  7:35 ` [dpdk-dev] [PATCH v4] " Yuying Zhang
2021-04-15  9:29 ` [dpdk-dev] [PATCH v5 1/2] " Yuying Zhang
2021-04-15  9:29   ` [dpdk-dev] [PATCH v5 2/2] net/ice/base: support GTPU for DCF " Yuying Zhang
2021-04-15 10:47 ` [dpdk-dev] [PATCH v6 1/2] " Yuying Zhang
2021-04-15 10:47   ` [dpdk-dev] [PATCH v6 2/2] net/ice: support GTPU TEID pattern for " Yuying Zhang
2021-04-15 12:21     ` Zhang, Qi Z
2021-04-15 12:21   ` [dpdk-dev] [PATCH v6 1/2] net/ice/base: support GTPU for DCF " Zhang, Qi Z

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