DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/ice: fix FDIR GTPU rule create fail
@ 2020-07-30  8:30 Wei Zhao
  2020-07-30  9:26 ` Huang, ZhiminX
  2020-07-30  9:28 ` [dpdk-dev] [PATCH v2] " Wei Zhao
  0 siblings, 2 replies; 9+ messages in thread
From: Wei Zhao @ 2020-07-30  8:30 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, Wei Zhao

For GTPU rule with extend header of DOWN and UP link PDU type,
it should use different trainning packet, also for GTPU rule
without extend header the trainning packet for FDIR is also
different. This patch enable these case.

Fixes: 934fd00c9389 ("net/ice/base: fix GTPU IP hash")

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
---
 drivers/net/ice/base/ice_fdir.c   | 161 +++++++++++++++++++++++++++++-
 drivers/net/ice/base/ice_type.h   |   6 ++
 drivers/net/ice/ice_ethdev.h      |   4 +
 drivers/net/ice/ice_fdir_filter.c | 146 +++++++++++++++++----------
 drivers/net/ice/ice_hash.c        |   3 -
 5 files changed, 265 insertions(+), 55 deletions(-)

diff --git a/drivers/net/ice/base/ice_fdir.c b/drivers/net/ice/base/ice_fdir.c
index 2c47fb57b..724109637 100644
--- a/drivers/net/ice/base/ice_fdir.c
+++ b/drivers/net/ice/base/ice_fdir.c
@@ -89,6 +89,37 @@ static const u8 ice_fdir_icmp4_gtpu4_pkt[] = {
 };
 
 static const u8 ice_fdir_ipv4_gtpu4_pkt[] = {
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
+	0x00, 0x44, 0x00, 0x00, 0x40, 0x00, 0x40, 0x11,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x08, 0x68, 0x08, 0x68, 0x00, 0x00,
+	0x00, 0x00, 0x33, 0xff, 0x00, 0x20, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x85, 0x45, 0x00,
+	0x00, 0x14, 0x00, 0x00, 0x40, 0x00, 0x40, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00,
+};
+
+static const u8 ice_fdir_ipv6_gtpu6_pkt[] = {
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x86, 0xdd, 0x60, 0x00,
+	0x00, 0x00, 0x00, 0x44, 0x11, 0x40, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x08, 0x68,
+	0x08, 0x68, 0x00, 0x44, 0x7f, 0xed, 0x33, 0xff,
+	0x00, 0x34, 0x12, 0x34, 0x56, 0x78, 0x00, 0x00,
+	0x00, 0x85, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x3b, 0x40, 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,
+};
+
+static const u8 ice_fdir_ipv4_gtpu4_eh_pkt[] = {
 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
 	0x00, 0x44, 0x00, 0x00, 0x40, 0x00, 0x40, 0x11,
@@ -102,7 +133,73 @@ static const u8 ice_fdir_ipv4_gtpu4_pkt[] = {
 	0x00, 0x00,
 };
 
-static const u8 ice_fdir_ipv6_gtpu6_pkt[] = {
+static const u8 ice_fdir_ipv4_gtpu4_down_pkt[] = {
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
+	0x00, 0x44, 0x00, 0x00, 0x40, 0x00, 0x40, 0x11,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x08, 0x68, 0x08, 0x68, 0x00, 0x00,
+	0x00, 0x00, 0x34, 0xff, 0x00, 0x28, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x85, 0x02, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x00,
+	0x00, 0x14, 0x00, 0x00, 0x40, 0x00, 0x40, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00,
+};
+
+static const u8 ice_fdir_ipv4_gtpu4_up_pkt[] = {
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
+	0x00, 0x44, 0x00, 0x00, 0x40, 0x00, 0x40, 0x11,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x08, 0x68, 0x08, 0x68, 0x00, 0x00,
+	0x00, 0x00, 0x34, 0xff, 0x00, 0x28, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x85, 0x02, 0x10,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x00,
+	0x00, 0x14, 0x00, 0x00, 0x40, 0x00, 0x40, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00,
+};
+
+static const u8 ice_fdir_ipv6_gtpu6_eh_pkt[] = {
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x86, 0xdd, 0x60, 0x00,
+	0x00, 0x00, 0x00, 0x44, 0x11, 0x40, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x08, 0x68,
+	0x08, 0x68, 0x00, 0x44, 0x7f, 0xed, 0x34, 0xff,
+	0x00, 0x34, 0x12, 0x34, 0x56, 0x78, 0x00, 0x00,
+	0x00, 0x85, 0x02, 0x00, 0x33, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x3b, 0x40, 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,
+};
+
+static const u8 ice_fdir_ipv6_gtpu6_down_pkt[] = {
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x86, 0xdd, 0x60, 0x00,
+	0x00, 0x00, 0x00, 0x44, 0x11, 0x40, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x08, 0x68,
+	0x08, 0x68, 0x00, 0x44, 0x7f, 0xed, 0x34, 0xff,
+	0x00, 0x34, 0x12, 0x34, 0x56, 0x78, 0x00, 0x00,
+	0x00, 0x85, 0x02, 0x00, 0x33, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x3b, 0x40, 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,
+};
+
+static const u8 ice_fdir_ipv6_gtpu6_up_pkt[] = {
 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00, 0x86, 0xdd, 0x60, 0x00,
 	0x00, 0x00, 0x00, 0x44, 0x11, 0x40, 0x00, 0x00,
@@ -492,6 +589,48 @@ static const struct ice_fdir_base_pkt ice_fdir_pkt[] = {
 		sizeof(ice_fdir_ipv6_gtpu6_pkt),
 		ice_fdir_ipv6_gtpu6_pkt,
 	},
+	{
+		ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_IPV4_OTHER,
+		sizeof(ice_fdir_ipv4_gtpu4_eh_pkt),
+		ice_fdir_ipv4_gtpu4_eh_pkt,
+		sizeof(ice_fdir_ipv4_gtpu4_eh_pkt),
+		ice_fdir_ipv4_gtpu4_eh_pkt,
+	},
+	{
+		ICE_FLTR_PTYPE_NONF_IPV4_GTPU_DOWN_IPV4_OTHER,
+		sizeof(ice_fdir_ipv4_gtpu4_down_pkt),
+		ice_fdir_ipv4_gtpu4_down_pkt,
+		sizeof(ice_fdir_ipv4_gtpu4_down_pkt),
+		ice_fdir_ipv4_gtpu4_eh_pkt,
+	},
+	{
+		ICE_FLTR_PTYPE_NONF_IPV4_GTPU_UP_IPV4_OTHER,
+		sizeof(ice_fdir_ipv4_gtpu4_up_pkt),
+		ice_fdir_ipv4_gtpu4_up_pkt,
+		sizeof(ice_fdir_ipv4_gtpu4_up_pkt),
+		ice_fdir_ipv4_gtpu4_up_pkt,
+	},
+	{
+		ICE_FLTR_PTYPE_NONF_IPV6_GTPU_EH_IPV6_OTHER,
+		sizeof(ice_fdir_ipv6_gtpu6_eh_pkt),
+		ice_fdir_ipv6_gtpu6_eh_pkt,
+		sizeof(ice_fdir_ipv6_gtpu6_eh_pkt),
+		ice_fdir_ipv6_gtpu6_eh_pkt,
+	},
+	{
+		ICE_FLTR_PTYPE_NONF_IPV6_GTPU_DOWN_IPV6_OTHER,
+		sizeof(ice_fdir_ipv6_gtpu6_down_pkt),
+		ice_fdir_ipv6_gtpu6_down_pkt,
+		sizeof(ice_fdir_ipv6_gtpu6_down_pkt),
+		ice_fdir_ipv6_gtpu6_down_pkt,
+	},
+	{
+		ICE_FLTR_PTYPE_NONF_IPV6_GTPU_UP_IPV6_OTHER,
+		sizeof(ice_fdir_ipv6_gtpu6_up_pkt),
+		ice_fdir_ipv6_gtpu6_up_pkt,
+		sizeof(ice_fdir_ipv6_gtpu6_up_pkt),
+		ice_fdir_ipv6_gtpu6_up_pkt,
+	},
 	{
 		ICE_FLTR_PTYPE_NONF_IPV4_L2TPV3,
 		sizeof(ice_fdir_ipv4_l2tpv3_pkt), ice_fdir_ipv4_l2tpv3_pkt,
@@ -1053,6 +1192,16 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input,
 	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_TCP:
 	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_ICMP:
 	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER:
+		ice_pkt_insert_u32(loc, ICE_IPV4_DST_ADDR_OFFSET,
+				   input->ip.v4.src_ip);
+		ice_pkt_insert_u32(loc, ICE_IPV4_SRC_ADDR_OFFSET,
+				   input->ip.v4.dst_ip);
+		ice_pkt_insert_u32(loc, ICE_IPV4_GTPU_TEID_OFFSET,
+				   input->gtpu_data.teid);
+		break;
+	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_IPV4_OTHER:
+	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_DOWN_IPV4_OTHER:
+	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_UP_IPV4_OTHER:
 		ice_pkt_insert_u32(loc, ICE_IPV4_DST_ADDR_OFFSET,
 				   input->ip.v4.src_ip);
 		ice_pkt_insert_u32(loc, ICE_IPV4_SRC_ADDR_OFFSET,
@@ -1063,6 +1212,16 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input,
 				      input->gtpu_data.qfi);
 		break;
 	case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER:
+		ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_DST_ADDR_OFFSET,
+					 input->ip.v6.src_ip);
+		ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_SRC_ADDR_OFFSET,
+					 input->ip.v6.dst_ip);
+		ice_pkt_insert_u32(loc, ICE_IPV6_GTPU_TEID_OFFSET,
+				   input->gtpu_data.teid);
+		break;
+	case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_EH_IPV6_OTHER:
+	case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_DOWN_IPV6_OTHER:
+	case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_UP_IPV6_OTHER:
 		ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_DST_ADDR_OFFSET,
 					 input->ip.v6.src_ip);
 		ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_SRC_ADDR_OFFSET,
diff --git a/drivers/net/ice/base/ice_type.h b/drivers/net/ice/base/ice_type.h
index c13cd7b00..5d119b2a3 100644
--- a/drivers/net/ice/base/ice_type.h
+++ b/drivers/net/ice/base/ice_type.h
@@ -297,6 +297,12 @@ enum ice_fltr_ptype {
 	ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_ICMP,
 	ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER,
 	ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER,
+	ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_IPV4_OTHER,
+	ICE_FLTR_PTYPE_NONF_IPV6_GTPU_EH_IPV6_OTHER,
+	ICE_FLTR_PTYPE_NONF_IPV4_GTPU_UP_IPV4_OTHER,
+	ICE_FLTR_PTYPE_NONF_IPV4_GTPU_DOWN_IPV4_OTHER,
+	ICE_FLTR_PTYPE_NONF_IPV6_GTPU_UP_IPV6_OTHER,
+	ICE_FLTR_PTYPE_NONF_IPV6_GTPU_DOWN_IPV6_OTHER,
 	ICE_FLTR_PTYPE_NONF_IPV4_L2TPV3,
 	ICE_FLTR_PTYPE_NONF_IPV6_L2TPV3,
 	ICE_FLTR_PTYPE_NONF_IPV4_ESP,
diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h
index 2bff735ca..95a1dae92 100644
--- a/drivers/net/ice/ice_ethdev.h
+++ b/drivers/net/ice/ice_ethdev.h
@@ -41,6 +41,8 @@
 #define ICE_RX_VEC_ID            RTE_INTR_VEC_RXTX_OFFSET
 
 #define ICE_MAX_PKT_TYPE  1024
+#define ICE_GTPU_EH_DWNLINK	0
+#define ICE_GTPU_EH_UPLINK	1
 
 /* DDP package search path */
 #define ICE_PKG_FILE_DEFAULT "/lib/firmware/intel/ice/ddp/ice.pkg"
@@ -264,6 +266,8 @@ enum ice_fdir_tunnel_type {
 	ICE_FDIR_TUNNEL_TYPE_VXLAN,
 	ICE_FDIR_TUNNEL_TYPE_GTPU,
 	ICE_FDIR_TUNNEL_TYPE_GTPU_EH,
+	ICE_FDIR_TUNNEL_TYPE_GTPU_UP,
+	ICE_FDIR_TUNNEL_TYPE_GTPU_DOWN,
 };
 
 struct rte_flow;
diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c
index 745d7291a..86bcdddd1 100644
--- a/drivers/net/ice/ice_fdir_filter.c
+++ b/drivers/net/ice/ice_fdir_filter.c
@@ -778,30 +778,15 @@ ice_fdir_cross_prof_conflict(struct ice_pf *pf,
 			goto err;
 		break;
 	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER:
-		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER;
+		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_UDP;
 		if (!ice_fdir_prof_resolve_conflict
 			(pf, cflct_ptype, is_tunnel))
 			goto err;
-		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER;
+		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_TCP;
 		if (!ice_fdir_prof_resolve_conflict
 			(pf, cflct_ptype, is_tunnel))
 			goto err;
-		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER;
-		if (!ice_fdir_prof_resolve_conflict
-			(pf, cflct_ptype, is_tunnel))
-			goto err;
-		break;
-	/* IPv6 GTPU */
-	case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER:
-		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER;
-		if (!ice_fdir_prof_resolve_conflict
-			(pf, cflct_ptype, is_tunnel))
-			goto err;
-		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER;
-		if (!ice_fdir_prof_resolve_conflict
-			(pf, cflct_ptype, is_tunnel))
-			goto err;
-		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER;
+		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_ICMP;
 		if (!ice_fdir_prof_resolve_conflict
 			(pf, cflct_ptype, is_tunnel))
 			goto err;
@@ -1025,30 +1010,50 @@ ice_fdir_input_set_conf(struct ice_pf *pf, enum ice_fltr_ptype flow,
 	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_TCP:
 	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_ICMP:
 	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER:
-		if (ttype == ICE_FDIR_TUNNEL_TYPE_GTPU)
-			ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_IP |
-					  ICE_FLOW_SEG_HDR_IPV4 |
-					  ICE_FLOW_SEG_HDR_IPV_OTHER);
-		else if (ttype == ICE_FDIR_TUNNEL_TYPE_GTPU_EH)
-			ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_EH |
-					  ICE_FLOW_SEG_HDR_GTPU_IP |
-					  ICE_FLOW_SEG_HDR_IPV4 |
-					  ICE_FLOW_SEG_HDR_IPV_OTHER);
-		else
-			PMD_DRV_LOG(ERR, "not supported tunnel type.");
+		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_IP |
+				  ICE_FLOW_SEG_HDR_IPV4 |
+				  ICE_FLOW_SEG_HDR_IPV_OTHER);
+		break;
+	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_IPV4_OTHER:
+		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_EH |
+				  ICE_FLOW_SEG_HDR_GTPU_IP |
+				  ICE_FLOW_SEG_HDR_IPV4 |
+				  ICE_FLOW_SEG_HDR_IPV_OTHER);
+		break;
+	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_DOWN_IPV4_OTHER:
+		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_DWN |
+				  ICE_FLOW_SEG_HDR_GTPU_IP |
+				  ICE_FLOW_SEG_HDR_IPV4 |
+				  ICE_FLOW_SEG_HDR_IPV_OTHER);
+		break;
+	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_UP_IPV4_OTHER:
+		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_UP |
+				  ICE_FLOW_SEG_HDR_GTPU_IP |
+				  ICE_FLOW_SEG_HDR_IPV4 |
+				  ICE_FLOW_SEG_HDR_IPV_OTHER);
 		break;
 	case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER:
-		if (ttype == ICE_FDIR_TUNNEL_TYPE_GTPU)
-			ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_IP |
-					  ICE_FLOW_SEG_HDR_IPV6 |
-					  ICE_FLOW_SEG_HDR_IPV_OTHER);
-		else if (ttype == ICE_FDIR_TUNNEL_TYPE_GTPU_EH)
-			ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_EH |
-					  ICE_FLOW_SEG_HDR_GTPU_IP |
-					  ICE_FLOW_SEG_HDR_IPV6 |
-					  ICE_FLOW_SEG_HDR_IPV_OTHER);
-		else
-			PMD_DRV_LOG(ERR, "not supported tunnel type.");
+		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_IP |
+				  ICE_FLOW_SEG_HDR_IPV6 |
+				  ICE_FLOW_SEG_HDR_IPV_OTHER);
+		break;
+	case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_EH_IPV6_OTHER:
+		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_EH |
+				  ICE_FLOW_SEG_HDR_GTPU_IP |
+				  ICE_FLOW_SEG_HDR_IPV6 |
+				  ICE_FLOW_SEG_HDR_IPV_OTHER);
+		break;
+	case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_DOWN_IPV6_OTHER:
+		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_DWN |
+				  ICE_FLOW_SEG_HDR_GTPU_IP |
+				  ICE_FLOW_SEG_HDR_IPV6 |
+				  ICE_FLOW_SEG_HDR_IPV_OTHER);
+		break;
+	case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_UP_IPV6_OTHER:
+		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_UP |
+				  ICE_FLOW_SEG_HDR_GTPU_IP |
+				  ICE_FLOW_SEG_HDR_IPV6 |
+				  ICE_FLOW_SEG_HDR_IPV_OTHER);
 		break;
 	case ICE_FLTR_PTYPE_NON_IP_L2:
 		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_ETH_NON_IP);
@@ -1990,13 +1995,35 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
 			gtp_psc_mask = item->mask;
 
 			if (gtp_psc_spec && gtp_psc_mask) {
-				if (gtp_psc_mask->qfi == UINT8_MAX)
+				if (gtp_psc_mask->qfi == UINT8_MAX) {
 					input_set |= ICE_INSET_GTPU_QFI;
+					filter->input.gtpu_data.qfi =
+						gtp_psc_spec->qfi;
+				}
 
-				filter->input.gtpu_data.qfi =
-					gtp_psc_spec->qfi;
+				if (gtp_psc_mask->pdu_type == UINT8_MAX) {
+					if (gtp_psc_spec->pdu_type ==
+						ICE_GTPU_EH_DWNLINK) {
+						tunnel_type =
+						ICE_FDIR_TUNNEL_TYPE_GTPU_DOWN;
+					} else if (gtp_psc_spec->pdu_type ==
+						ICE_GTPU_EH_UPLINK) {
+						tunnel_type =
+						ICE_FDIR_TUNNEL_TYPE_GTPU_UP;
+					} else {
+						rte_flow_error_set(error,
+						EINVAL,
+						RTE_FLOW_ERROR_TYPE_ITEM,
+						item,
+						"Invalid pdu_type");
+						return -rte_errno;
+					}
+				}
 			}
-			tunnel_type = ICE_FDIR_TUNNEL_TYPE_GTPU_EH;
+
+			if (tunnel_type != ICE_FDIR_TUNNEL_TYPE_GTPU_DOWN &&
+				tunnel_type != ICE_FDIR_TUNNEL_TYPE_GTPU_UP)
+				tunnel_type = ICE_FDIR_TUNNEL_TYPE_GTPU_EH;
 			break;
 		default:
 			rte_flow_error_set(error, EINVAL,
@@ -2007,13 +2034,30 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
 		}
 	}
 
-	if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU ||
-	    tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU_EH) {
-		if (flow_type == ICE_FLTR_PTYPE_NONF_IPV4_UDP)
-			flow_type = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER;
-		else
-			flow_type = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER;
-	}
+	if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU &&
+		flow_type == ICE_FLTR_PTYPE_NONF_IPV4_UDP)
+		flow_type = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER;
+	else if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU_EH &&
+		flow_type == ICE_FLTR_PTYPE_NONF_IPV4_UDP)
+		flow_type = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_IPV4_OTHER;
+	else if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU &&
+		flow_type == ICE_FLTR_PTYPE_NONF_IPV6_UDP)
+		flow_type = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER;
+	else if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU_EH &&
+		flow_type == ICE_FLTR_PTYPE_NONF_IPV4_UDP)
+		flow_type = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_EH_IPV6_OTHER;
+	else if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU_DOWN &&
+		flow_type == ICE_FLTR_PTYPE_NONF_IPV4_UDP)
+		flow_type = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_DOWN_IPV4_OTHER;
+	else if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU_UP &&
+		flow_type == ICE_FLTR_PTYPE_NONF_IPV4_UDP)
+		flow_type = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_UP_IPV4_OTHER;
+	else if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU_DOWN &&
+		flow_type == ICE_FLTR_PTYPE_NONF_IPV6_UDP)
+		flow_type = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_DOWN_IPV6_OTHER;
+	else if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU_UP &&
+		flow_type == ICE_FLTR_PTYPE_NONF_IPV6_UDP)
+		flow_type = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_UP_IPV6_OTHER;
 
 	filter->tunnel_type = tunnel_type;
 	filter->input.flow_type = flow_type;
diff --git a/drivers/net/ice/ice_hash.c b/drivers/net/ice/ice_hash.c
index e535e4b95..14ce2ff4f 100644
--- a/drivers/net/ice/ice_hash.c
+++ b/drivers/net/ice/ice_hash.c
@@ -25,9 +25,6 @@
 #include "ice_ethdev.h"
 #include "ice_generic_flow.h"
 
-#define ICE_GTPU_EH_DWNLINK	0
-#define ICE_GTPU_EH_UPLINK	1
-
 struct rss_type_match_hdr {
 	uint32_t hdr_mask;
 	uint64_t eth_rss_hint;
-- 
2.19.1


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

* Re: [dpdk-dev] [PATCH] net/ice: fix FDIR GTPU rule create fail
  2020-07-30  8:30 [dpdk-dev] [PATCH] net/ice: fix FDIR GTPU rule create fail Wei Zhao
@ 2020-07-30  9:26 ` Huang, ZhiminX
  2020-07-30  9:28 ` [dpdk-dev] [PATCH v2] " Wei Zhao
  1 sibling, 0 replies; 9+ messages in thread
From: Huang, ZhiminX @ 2020-07-30  9:26 UTC (permalink / raw)
  To: Zhao1, Wei, dev; +Cc: Zhang, Qi Z, Zhao1, Wei

Tested-by: Huang, ZhiminX <zhiminx.huang@intel.com>

Regards,
HuangZhiMin


-----Original Message-----
From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wei Zhao
Sent: Thursday, July 30, 2020 4:31 PM
To: dev@dpdk.org
Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Zhao1, Wei <wei.zhao1@intel.com>
Subject: [dpdk-dev] [PATCH] net/ice: fix FDIR GTPU rule create fail

For GTPU rule with extend header of DOWN and UP link PDU type, it should use different trainning packet, also for GTPU rule without extend header the trainning packet for FDIR is also different. This patch enable these case.

Fixes: 934fd00c9389 ("net/ice/base: fix GTPU IP hash")

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
---
 drivers/net/ice/base/ice_fdir.c   | 161 +++++++++++++++++++++++++++++-
 drivers/net/ice/base/ice_type.h   |   6 ++
 drivers/net/ice/ice_ethdev.h      |   4 +
 drivers/net/ice/ice_fdir_filter.c | 146 +++++++++++++++++----------
 drivers/net/ice/ice_hash.c        |   3 -
 5 files changed, 265 insertions(+), 55 deletions(-)

diff --git a/drivers/net/ice/base/ice_fdir.c b/drivers/net/ice/base/ice_fdir.c index 2c47fb57b..724109637 100644
--- a/drivers/net/ice/base/ice_fdir.c
+++ b/drivers/net/ice/base/ice_fdir.c
@@ -89,6 +89,37 @@ static const u8 ice_fdir_icmp4_gtpu4_pkt[] = {  };
 
 static const u8 ice_fdir_ipv4_gtpu4_pkt[] = {
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
+	0x00, 0x44, 0x00, 0x00, 0x40, 0x00, 0x40, 0x11,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x08, 0x68, 0x08, 0x68, 0x00, 0x00,
+	0x00, 0x00, 0x33, 0xff, 0x00, 0x20, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x85, 0x45, 0x00,
+	0x00, 0x14, 0x00, 0x00, 0x40, 0x00, 0x40, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00,
+};
+
+static const u8 ice_fdir_ipv6_gtpu6_pkt[] = {
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x86, 0xdd, 0x60, 0x00,
+	0x00, 0x00, 0x00, 0x44, 0x11, 0x40, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x08, 0x68,
+	0x08, 0x68, 0x00, 0x44, 0x7f, 0xed, 0x33, 0xff,
+	0x00, 0x34, 0x12, 0x34, 0x56, 0x78, 0x00, 0x00,
+	0x00, 0x85, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x3b, 0x40, 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,
+};
+
+static const u8 ice_fdir_ipv4_gtpu4_eh_pkt[] = {
 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
 	0x00, 0x44, 0x00, 0x00, 0x40, 0x00, 0x40, 0x11, @@ -102,7 +133,73 @@ static const u8 ice_fdir_ipv4_gtpu4_pkt[] = {
 	0x00, 0x00,
 };
 
-static const u8 ice_fdir_ipv6_gtpu6_pkt[] = {
+static const u8 ice_fdir_ipv4_gtpu4_down_pkt[] = {
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
+	0x00, 0x44, 0x00, 0x00, 0x40, 0x00, 0x40, 0x11,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x08, 0x68, 0x08, 0x68, 0x00, 0x00,
+	0x00, 0x00, 0x34, 0xff, 0x00, 0x28, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x85, 0x02, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x00,
+	0x00, 0x14, 0x00, 0x00, 0x40, 0x00, 0x40, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00,
+};
+
+static const u8 ice_fdir_ipv4_gtpu4_up_pkt[] = {
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
+	0x00, 0x44, 0x00, 0x00, 0x40, 0x00, 0x40, 0x11,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x08, 0x68, 0x08, 0x68, 0x00, 0x00,
+	0x00, 0x00, 0x34, 0xff, 0x00, 0x28, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x85, 0x02, 0x10,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x00,
+	0x00, 0x14, 0x00, 0x00, 0x40, 0x00, 0x40, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00,
+};
+
+static const u8 ice_fdir_ipv6_gtpu6_eh_pkt[] = {
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x86, 0xdd, 0x60, 0x00,
+	0x00, 0x00, 0x00, 0x44, 0x11, 0x40, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x08, 0x68,
+	0x08, 0x68, 0x00, 0x44, 0x7f, 0xed, 0x34, 0xff,
+	0x00, 0x34, 0x12, 0x34, 0x56, 0x78, 0x00, 0x00,
+	0x00, 0x85, 0x02, 0x00, 0x33, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x3b, 0x40, 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,
+};
+
+static const u8 ice_fdir_ipv6_gtpu6_down_pkt[] = {
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x86, 0xdd, 0x60, 0x00,
+	0x00, 0x00, 0x00, 0x44, 0x11, 0x40, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x08, 0x68,
+	0x08, 0x68, 0x00, 0x44, 0x7f, 0xed, 0x34, 0xff,
+	0x00, 0x34, 0x12, 0x34, 0x56, 0x78, 0x00, 0x00,
+	0x00, 0x85, 0x02, 0x00, 0x33, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x3b, 0x40, 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,
+};
+
+static const u8 ice_fdir_ipv6_gtpu6_up_pkt[] = {
 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00, 0x86, 0xdd, 0x60, 0x00,
 	0x00, 0x00, 0x00, 0x44, 0x11, 0x40, 0x00, 0x00, @@ -492,6 +589,48 @@ static const struct ice_fdir_base_pkt ice_fdir_pkt[] = {
 		sizeof(ice_fdir_ipv6_gtpu6_pkt),
 		ice_fdir_ipv6_gtpu6_pkt,
 	},
+	{
+		ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_IPV4_OTHER,
+		sizeof(ice_fdir_ipv4_gtpu4_eh_pkt),
+		ice_fdir_ipv4_gtpu4_eh_pkt,
+		sizeof(ice_fdir_ipv4_gtpu4_eh_pkt),
+		ice_fdir_ipv4_gtpu4_eh_pkt,
+	},
+	{
+		ICE_FLTR_PTYPE_NONF_IPV4_GTPU_DOWN_IPV4_OTHER,
+		sizeof(ice_fdir_ipv4_gtpu4_down_pkt),
+		ice_fdir_ipv4_gtpu4_down_pkt,
+		sizeof(ice_fdir_ipv4_gtpu4_down_pkt),
+		ice_fdir_ipv4_gtpu4_eh_pkt,
+	},
+	{
+		ICE_FLTR_PTYPE_NONF_IPV4_GTPU_UP_IPV4_OTHER,
+		sizeof(ice_fdir_ipv4_gtpu4_up_pkt),
+		ice_fdir_ipv4_gtpu4_up_pkt,
+		sizeof(ice_fdir_ipv4_gtpu4_up_pkt),
+		ice_fdir_ipv4_gtpu4_up_pkt,
+	},
+	{
+		ICE_FLTR_PTYPE_NONF_IPV6_GTPU_EH_IPV6_OTHER,
+		sizeof(ice_fdir_ipv6_gtpu6_eh_pkt),
+		ice_fdir_ipv6_gtpu6_eh_pkt,
+		sizeof(ice_fdir_ipv6_gtpu6_eh_pkt),
+		ice_fdir_ipv6_gtpu6_eh_pkt,
+	},
+	{
+		ICE_FLTR_PTYPE_NONF_IPV6_GTPU_DOWN_IPV6_OTHER,
+		sizeof(ice_fdir_ipv6_gtpu6_down_pkt),
+		ice_fdir_ipv6_gtpu6_down_pkt,
+		sizeof(ice_fdir_ipv6_gtpu6_down_pkt),
+		ice_fdir_ipv6_gtpu6_down_pkt,
+	},
+	{
+		ICE_FLTR_PTYPE_NONF_IPV6_GTPU_UP_IPV6_OTHER,
+		sizeof(ice_fdir_ipv6_gtpu6_up_pkt),
+		ice_fdir_ipv6_gtpu6_up_pkt,
+		sizeof(ice_fdir_ipv6_gtpu6_up_pkt),
+		ice_fdir_ipv6_gtpu6_up_pkt,
+	},
 	{
 		ICE_FLTR_PTYPE_NONF_IPV4_L2TPV3,
 		sizeof(ice_fdir_ipv4_l2tpv3_pkt), ice_fdir_ipv4_l2tpv3_pkt, @@ -1053,6 +1192,16 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input,
 	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_TCP:
 	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_ICMP:
 	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER:
+		ice_pkt_insert_u32(loc, ICE_IPV4_DST_ADDR_OFFSET,
+				   input->ip.v4.src_ip);
+		ice_pkt_insert_u32(loc, ICE_IPV4_SRC_ADDR_OFFSET,
+				   input->ip.v4.dst_ip);
+		ice_pkt_insert_u32(loc, ICE_IPV4_GTPU_TEID_OFFSET,
+				   input->gtpu_data.teid);
+		break;
+	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_IPV4_OTHER:
+	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_DOWN_IPV4_OTHER:
+	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_UP_IPV4_OTHER:
 		ice_pkt_insert_u32(loc, ICE_IPV4_DST_ADDR_OFFSET,
 				   input->ip.v4.src_ip);
 		ice_pkt_insert_u32(loc, ICE_IPV4_SRC_ADDR_OFFSET, @@ -1063,6 +1212,16 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input,
 				      input->gtpu_data.qfi);
 		break;
 	case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER:
+		ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_DST_ADDR_OFFSET,
+					 input->ip.v6.src_ip);
+		ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_SRC_ADDR_OFFSET,
+					 input->ip.v6.dst_ip);
+		ice_pkt_insert_u32(loc, ICE_IPV6_GTPU_TEID_OFFSET,
+				   input->gtpu_data.teid);
+		break;
+	case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_EH_IPV6_OTHER:
+	case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_DOWN_IPV6_OTHER:
+	case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_UP_IPV6_OTHER:
 		ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_DST_ADDR_OFFSET,
 					 input->ip.v6.src_ip);
 		ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_SRC_ADDR_OFFSET, diff --git a/drivers/net/ice/base/ice_type.h b/drivers/net/ice/base/ice_type.h index c13cd7b00..5d119b2a3 100644
--- a/drivers/net/ice/base/ice_type.h
+++ b/drivers/net/ice/base/ice_type.h
@@ -297,6 +297,12 @@ enum ice_fltr_ptype {
 	ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_ICMP,
 	ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER,
 	ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER,
+	ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_IPV4_OTHER,
+	ICE_FLTR_PTYPE_NONF_IPV6_GTPU_EH_IPV6_OTHER,
+	ICE_FLTR_PTYPE_NONF_IPV4_GTPU_UP_IPV4_OTHER,
+	ICE_FLTR_PTYPE_NONF_IPV4_GTPU_DOWN_IPV4_OTHER,
+	ICE_FLTR_PTYPE_NONF_IPV6_GTPU_UP_IPV6_OTHER,
+	ICE_FLTR_PTYPE_NONF_IPV6_GTPU_DOWN_IPV6_OTHER,
 	ICE_FLTR_PTYPE_NONF_IPV4_L2TPV3,
 	ICE_FLTR_PTYPE_NONF_IPV6_L2TPV3,
 	ICE_FLTR_PTYPE_NONF_IPV4_ESP,
diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h index 2bff735ca..95a1dae92 100644
--- a/drivers/net/ice/ice_ethdev.h
+++ b/drivers/net/ice/ice_ethdev.h
@@ -41,6 +41,8 @@
 #define ICE_RX_VEC_ID            RTE_INTR_VEC_RXTX_OFFSET
 
 #define ICE_MAX_PKT_TYPE  1024
+#define ICE_GTPU_EH_DWNLINK	0
+#define ICE_GTPU_EH_UPLINK	1
 
 /* DDP package search path */
 #define ICE_PKG_FILE_DEFAULT "/lib/firmware/intel/ice/ddp/ice.pkg"
@@ -264,6 +266,8 @@ enum ice_fdir_tunnel_type {
 	ICE_FDIR_TUNNEL_TYPE_VXLAN,
 	ICE_FDIR_TUNNEL_TYPE_GTPU,
 	ICE_FDIR_TUNNEL_TYPE_GTPU_EH,
+	ICE_FDIR_TUNNEL_TYPE_GTPU_UP,
+	ICE_FDIR_TUNNEL_TYPE_GTPU_DOWN,
 };
 
 struct rte_flow;
diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c
index 745d7291a..86bcdddd1 100644
--- a/drivers/net/ice/ice_fdir_filter.c
+++ b/drivers/net/ice/ice_fdir_filter.c
@@ -778,30 +778,15 @@ ice_fdir_cross_prof_conflict(struct ice_pf *pf,
 			goto err;
 		break;
 	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER:
-		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER;
+		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_UDP;
 		if (!ice_fdir_prof_resolve_conflict
 			(pf, cflct_ptype, is_tunnel))
 			goto err;
-		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER;
+		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_TCP;
 		if (!ice_fdir_prof_resolve_conflict
 			(pf, cflct_ptype, is_tunnel))
 			goto err;
-		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER;
-		if (!ice_fdir_prof_resolve_conflict
-			(pf, cflct_ptype, is_tunnel))
-			goto err;
-		break;
-	/* IPv6 GTPU */
-	case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER:
-		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER;
-		if (!ice_fdir_prof_resolve_conflict
-			(pf, cflct_ptype, is_tunnel))
-			goto err;
-		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER;
-		if (!ice_fdir_prof_resolve_conflict
-			(pf, cflct_ptype, is_tunnel))
-			goto err;
-		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER;
+		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_ICMP;
 		if (!ice_fdir_prof_resolve_conflict
 			(pf, cflct_ptype, is_tunnel))
 			goto err;
@@ -1025,30 +1010,50 @@ ice_fdir_input_set_conf(struct ice_pf *pf, enum ice_fltr_ptype flow,
 	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_TCP:
 	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_ICMP:
 	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER:
-		if (ttype == ICE_FDIR_TUNNEL_TYPE_GTPU)
-			ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_IP |
-					  ICE_FLOW_SEG_HDR_IPV4 |
-					  ICE_FLOW_SEG_HDR_IPV_OTHER);
-		else if (ttype == ICE_FDIR_TUNNEL_TYPE_GTPU_EH)
-			ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_EH |
-					  ICE_FLOW_SEG_HDR_GTPU_IP |
-					  ICE_FLOW_SEG_HDR_IPV4 |
-					  ICE_FLOW_SEG_HDR_IPV_OTHER);
-		else
-			PMD_DRV_LOG(ERR, "not supported tunnel type.");
+		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_IP |
+				  ICE_FLOW_SEG_HDR_IPV4 |
+				  ICE_FLOW_SEG_HDR_IPV_OTHER);
+		break;
+	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_IPV4_OTHER:
+		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_EH |
+				  ICE_FLOW_SEG_HDR_GTPU_IP |
+				  ICE_FLOW_SEG_HDR_IPV4 |
+				  ICE_FLOW_SEG_HDR_IPV_OTHER);
+		break;
+	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_DOWN_IPV4_OTHER:
+		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_DWN |
+				  ICE_FLOW_SEG_HDR_GTPU_IP |
+				  ICE_FLOW_SEG_HDR_IPV4 |
+				  ICE_FLOW_SEG_HDR_IPV_OTHER);
+		break;
+	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_UP_IPV4_OTHER:
+		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_UP |
+				  ICE_FLOW_SEG_HDR_GTPU_IP |
+				  ICE_FLOW_SEG_HDR_IPV4 |
+				  ICE_FLOW_SEG_HDR_IPV_OTHER);
 		break;
 	case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER:
-		if (ttype == ICE_FDIR_TUNNEL_TYPE_GTPU)
-			ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_IP |
-					  ICE_FLOW_SEG_HDR_IPV6 |
-					  ICE_FLOW_SEG_HDR_IPV_OTHER);
-		else if (ttype == ICE_FDIR_TUNNEL_TYPE_GTPU_EH)
-			ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_EH |
-					  ICE_FLOW_SEG_HDR_GTPU_IP |
-					  ICE_FLOW_SEG_HDR_IPV6 |
-					  ICE_FLOW_SEG_HDR_IPV_OTHER);
-		else
-			PMD_DRV_LOG(ERR, "not supported tunnel type.");
+		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_IP |
+				  ICE_FLOW_SEG_HDR_IPV6 |
+				  ICE_FLOW_SEG_HDR_IPV_OTHER);
+		break;
+	case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_EH_IPV6_OTHER:
+		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_EH |
+				  ICE_FLOW_SEG_HDR_GTPU_IP |
+				  ICE_FLOW_SEG_HDR_IPV6 |
+				  ICE_FLOW_SEG_HDR_IPV_OTHER);
+		break;
+	case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_DOWN_IPV6_OTHER:
+		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_DWN |
+				  ICE_FLOW_SEG_HDR_GTPU_IP |
+				  ICE_FLOW_SEG_HDR_IPV6 |
+				  ICE_FLOW_SEG_HDR_IPV_OTHER);
+		break;
+	case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_UP_IPV6_OTHER:
+		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_UP |
+				  ICE_FLOW_SEG_HDR_GTPU_IP |
+				  ICE_FLOW_SEG_HDR_IPV6 |
+				  ICE_FLOW_SEG_HDR_IPV_OTHER);
 		break;
 	case ICE_FLTR_PTYPE_NON_IP_L2:
 		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_ETH_NON_IP); @@ -1990,13 +1995,35 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
 			gtp_psc_mask = item->mask;
 
 			if (gtp_psc_spec && gtp_psc_mask) {
-				if (gtp_psc_mask->qfi == UINT8_MAX)
+				if (gtp_psc_mask->qfi == UINT8_MAX) {
 					input_set |= ICE_INSET_GTPU_QFI;
+					filter->input.gtpu_data.qfi =
+						gtp_psc_spec->qfi;
+				}
 
-				filter->input.gtpu_data.qfi =
-					gtp_psc_spec->qfi;
+				if (gtp_psc_mask->pdu_type == UINT8_MAX) {
+					if (gtp_psc_spec->pdu_type ==
+						ICE_GTPU_EH_DWNLINK) {
+						tunnel_type =
+						ICE_FDIR_TUNNEL_TYPE_GTPU_DOWN;
+					} else if (gtp_psc_spec->pdu_type ==
+						ICE_GTPU_EH_UPLINK) {
+						tunnel_type =
+						ICE_FDIR_TUNNEL_TYPE_GTPU_UP;
+					} else {
+						rte_flow_error_set(error,
+						EINVAL,
+						RTE_FLOW_ERROR_TYPE_ITEM,
+						item,
+						"Invalid pdu_type");
+						return -rte_errno;
+					}
+				}
 			}
-			tunnel_type = ICE_FDIR_TUNNEL_TYPE_GTPU_EH;
+
+			if (tunnel_type != ICE_FDIR_TUNNEL_TYPE_GTPU_DOWN &&
+				tunnel_type != ICE_FDIR_TUNNEL_TYPE_GTPU_UP)
+				tunnel_type = ICE_FDIR_TUNNEL_TYPE_GTPU_EH;
 			break;
 		default:
 			rte_flow_error_set(error, EINVAL,
@@ -2007,13 +2034,30 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
 		}
 	}
 
-	if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU ||
-	    tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU_EH) {
-		if (flow_type == ICE_FLTR_PTYPE_NONF_IPV4_UDP)
-			flow_type = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER;
-		else
-			flow_type = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER;
-	}
+	if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU &&
+		flow_type == ICE_FLTR_PTYPE_NONF_IPV4_UDP)
+		flow_type = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER;
+	else if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU_EH &&
+		flow_type == ICE_FLTR_PTYPE_NONF_IPV4_UDP)
+		flow_type = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_IPV4_OTHER;
+	else if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU &&
+		flow_type == ICE_FLTR_PTYPE_NONF_IPV6_UDP)
+		flow_type = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER;
+	else if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU_EH &&
+		flow_type == ICE_FLTR_PTYPE_NONF_IPV4_UDP)
+		flow_type = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_EH_IPV6_OTHER;
+	else if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU_DOWN &&
+		flow_type == ICE_FLTR_PTYPE_NONF_IPV4_UDP)
+		flow_type = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_DOWN_IPV4_OTHER;
+	else if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU_UP &&
+		flow_type == ICE_FLTR_PTYPE_NONF_IPV4_UDP)
+		flow_type = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_UP_IPV4_OTHER;
+	else if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU_DOWN &&
+		flow_type == ICE_FLTR_PTYPE_NONF_IPV6_UDP)
+		flow_type = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_DOWN_IPV6_OTHER;
+	else if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU_UP &&
+		flow_type == ICE_FLTR_PTYPE_NONF_IPV6_UDP)
+		flow_type = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_UP_IPV6_OTHER;
 
 	filter->tunnel_type = tunnel_type;
 	filter->input.flow_type = flow_type;
diff --git a/drivers/net/ice/ice_hash.c b/drivers/net/ice/ice_hash.c index e535e4b95..14ce2ff4f 100644
--- a/drivers/net/ice/ice_hash.c
+++ b/drivers/net/ice/ice_hash.c
@@ -25,9 +25,6 @@
 #include "ice_ethdev.h"
 #include "ice_generic_flow.h"
 
-#define ICE_GTPU_EH_DWNLINK	0
-#define ICE_GTPU_EH_UPLINK	1
-
 struct rss_type_match_hdr {
 	uint32_t hdr_mask;
 	uint64_t eth_rss_hint;
--
2.19.1


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

* [dpdk-dev] [PATCH v2] net/ice: fix FDIR GTPU rule create fail
  2020-07-30  8:30 [dpdk-dev] [PATCH] net/ice: fix FDIR GTPU rule create fail Wei Zhao
  2020-07-30  9:26 ` Huang, ZhiminX
@ 2020-07-30  9:28 ` Wei Zhao
  2020-07-30 10:11   ` Zhao1, Wei
                     ` (2 more replies)
  1 sibling, 3 replies; 9+ messages in thread
From: Wei Zhao @ 2020-07-30  9:28 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, Wei Zhao

For GTPU rule without extend header the trainning packet
for FDIR is different. This patch enable these case.

Fixes: 934fd00c9389 ("net/ice/base: fix GTPU IP hash")

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
---
 drivers/net/ice/base/ice_fdir.c   | 63 +++++++++++++++++++++++-
 drivers/net/ice/base/ice_type.h   |  2 +
 drivers/net/ice/ice_fdir_filter.c | 80 +++++++++++++------------------
 3 files changed, 97 insertions(+), 48 deletions(-)

diff --git a/drivers/net/ice/base/ice_fdir.c b/drivers/net/ice/base/ice_fdir.c
index 2c47fb57b..a904ff513 100644
--- a/drivers/net/ice/base/ice_fdir.c
+++ b/drivers/net/ice/base/ice_fdir.c
@@ -89,6 +89,37 @@ static const u8 ice_fdir_icmp4_gtpu4_pkt[] = {
 };
 
 static const u8 ice_fdir_ipv4_gtpu4_pkt[] = {
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
+	0x00, 0x44, 0x00, 0x00, 0x40, 0x00, 0x40, 0x11,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x08, 0x68, 0x08, 0x68, 0x00, 0x00,
+	0x00, 0x00, 0x33, 0xff, 0x00, 0x20, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x85, 0x45, 0x00,
+	0x00, 0x14, 0x00, 0x00, 0x40, 0x00, 0x40, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00,
+};
+
+static const u8 ice_fdir_ipv6_gtpu6_pkt[] = {
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x86, 0xdd, 0x60, 0x00,
+	0x00, 0x00, 0x00, 0x44, 0x11, 0x40, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x08, 0x68,
+	0x08, 0x68, 0x00, 0x44, 0x7f, 0xed, 0x33, 0xff,
+	0x00, 0x34, 0x12, 0x34, 0x56, 0x78, 0x00, 0x00,
+	0x00, 0x85, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x3b, 0x40, 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,
+};
+
+static const u8 ice_fdir_ipv4_gtpu4_eh_pkt[] = {
 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
 	0x00, 0x44, 0x00, 0x00, 0x40, 0x00, 0x40, 0x11,
@@ -102,7 +133,7 @@ static const u8 ice_fdir_ipv4_gtpu4_pkt[] = {
 	0x00, 0x00,
 };
 
-static const u8 ice_fdir_ipv6_gtpu6_pkt[] = {
+static const u8 ice_fdir_ipv6_gtpu6_eh_pkt[] = {
 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00, 0x86, 0xdd, 0x60, 0x00,
 	0x00, 0x00, 0x00, 0x44, 0x11, 0x40, 0x00, 0x00,
@@ -492,6 +523,20 @@ static const struct ice_fdir_base_pkt ice_fdir_pkt[] = {
 		sizeof(ice_fdir_ipv6_gtpu6_pkt),
 		ice_fdir_ipv6_gtpu6_pkt,
 	},
+	{
+		ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_IPV4_OTHER,
+		sizeof(ice_fdir_ipv4_gtpu4_eh_pkt),
+		ice_fdir_ipv4_gtpu4_eh_pkt,
+		sizeof(ice_fdir_ipv4_gtpu4_eh_pkt),
+		ice_fdir_ipv4_gtpu4_eh_pkt,
+	},
+	{
+		ICE_FLTR_PTYPE_NONF_IPV6_GTPU_EH_IPV6_OTHER,
+		sizeof(ice_fdir_ipv6_gtpu6_eh_pkt),
+		ice_fdir_ipv6_gtpu6_eh_pkt,
+		sizeof(ice_fdir_ipv6_gtpu6_eh_pkt),
+		ice_fdir_ipv6_gtpu6_eh_pkt,
+	},
 	{
 		ICE_FLTR_PTYPE_NONF_IPV4_L2TPV3,
 		sizeof(ice_fdir_ipv4_l2tpv3_pkt), ice_fdir_ipv4_l2tpv3_pkt,
@@ -1053,6 +1098,14 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input,
 	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_TCP:
 	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_ICMP:
 	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER:
+		ice_pkt_insert_u32(loc, ICE_IPV4_DST_ADDR_OFFSET,
+				   input->ip.v4.src_ip);
+		ice_pkt_insert_u32(loc, ICE_IPV4_SRC_ADDR_OFFSET,
+				   input->ip.v4.dst_ip);
+		ice_pkt_insert_u32(loc, ICE_IPV4_GTPU_TEID_OFFSET,
+				   input->gtpu_data.teid);
+		break;
+	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_IPV4_OTHER:
 		ice_pkt_insert_u32(loc, ICE_IPV4_DST_ADDR_OFFSET,
 				   input->ip.v4.src_ip);
 		ice_pkt_insert_u32(loc, ICE_IPV4_SRC_ADDR_OFFSET,
@@ -1063,6 +1116,14 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input,
 				      input->gtpu_data.qfi);
 		break;
 	case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER:
+		ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_DST_ADDR_OFFSET,
+					 input->ip.v6.src_ip);
+		ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_SRC_ADDR_OFFSET,
+					 input->ip.v6.dst_ip);
+		ice_pkt_insert_u32(loc, ICE_IPV6_GTPU_TEID_OFFSET,
+				   input->gtpu_data.teid);
+		break;
+	case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_EH_IPV6_OTHER:
 		ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_DST_ADDR_OFFSET,
 					 input->ip.v6.src_ip);
 		ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_SRC_ADDR_OFFSET,
diff --git a/drivers/net/ice/base/ice_type.h b/drivers/net/ice/base/ice_type.h
index c13cd7b00..3775689a9 100644
--- a/drivers/net/ice/base/ice_type.h
+++ b/drivers/net/ice/base/ice_type.h
@@ -297,6 +297,8 @@ enum ice_fltr_ptype {
 	ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_ICMP,
 	ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER,
 	ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER,
+	ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_IPV4_OTHER,
+	ICE_FLTR_PTYPE_NONF_IPV6_GTPU_EH_IPV6_OTHER,
 	ICE_FLTR_PTYPE_NONF_IPV4_L2TPV3,
 	ICE_FLTR_PTYPE_NONF_IPV6_L2TPV3,
 	ICE_FLTR_PTYPE_NONF_IPV4_ESP,
diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c
index 745d7291a..c59fe46b9 100644
--- a/drivers/net/ice/ice_fdir_filter.c
+++ b/drivers/net/ice/ice_fdir_filter.c
@@ -778,30 +778,15 @@ ice_fdir_cross_prof_conflict(struct ice_pf *pf,
 			goto err;
 		break;
 	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER:
-		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER;
+		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_UDP;
 		if (!ice_fdir_prof_resolve_conflict
 			(pf, cflct_ptype, is_tunnel))
 			goto err;
-		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER;
+		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_TCP;
 		if (!ice_fdir_prof_resolve_conflict
 			(pf, cflct_ptype, is_tunnel))
 			goto err;
-		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER;
-		if (!ice_fdir_prof_resolve_conflict
-			(pf, cflct_ptype, is_tunnel))
-			goto err;
-		break;
-	/* IPv6 GTPU */
-	case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER:
-		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER;
-		if (!ice_fdir_prof_resolve_conflict
-			(pf, cflct_ptype, is_tunnel))
-			goto err;
-		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER;
-		if (!ice_fdir_prof_resolve_conflict
-			(pf, cflct_ptype, is_tunnel))
-			goto err;
-		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER;
+		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_ICMP;
 		if (!ice_fdir_prof_resolve_conflict
 			(pf, cflct_ptype, is_tunnel))
 			goto err;
@@ -1025,30 +1010,26 @@ ice_fdir_input_set_conf(struct ice_pf *pf, enum ice_fltr_ptype flow,
 	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_TCP:
 	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_ICMP:
 	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER:
-		if (ttype == ICE_FDIR_TUNNEL_TYPE_GTPU)
-			ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_IP |
-					  ICE_FLOW_SEG_HDR_IPV4 |
-					  ICE_FLOW_SEG_HDR_IPV_OTHER);
-		else if (ttype == ICE_FDIR_TUNNEL_TYPE_GTPU_EH)
-			ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_EH |
-					  ICE_FLOW_SEG_HDR_GTPU_IP |
-					  ICE_FLOW_SEG_HDR_IPV4 |
-					  ICE_FLOW_SEG_HDR_IPV_OTHER);
-		else
-			PMD_DRV_LOG(ERR, "not supported tunnel type.");
+		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_IP |
+				  ICE_FLOW_SEG_HDR_IPV4 |
+				  ICE_FLOW_SEG_HDR_IPV_OTHER);
+		break;
+	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_IPV4_OTHER:
+		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_EH |
+				  ICE_FLOW_SEG_HDR_GTPU_IP |
+				  ICE_FLOW_SEG_HDR_IPV4 |
+				  ICE_FLOW_SEG_HDR_IPV_OTHER);
 		break;
 	case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER:
-		if (ttype == ICE_FDIR_TUNNEL_TYPE_GTPU)
-			ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_IP |
-					  ICE_FLOW_SEG_HDR_IPV6 |
-					  ICE_FLOW_SEG_HDR_IPV_OTHER);
-		else if (ttype == ICE_FDIR_TUNNEL_TYPE_GTPU_EH)
-			ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_EH |
-					  ICE_FLOW_SEG_HDR_GTPU_IP |
-					  ICE_FLOW_SEG_HDR_IPV6 |
-					  ICE_FLOW_SEG_HDR_IPV_OTHER);
-		else
-			PMD_DRV_LOG(ERR, "not supported tunnel type.");
+		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_IP |
+				  ICE_FLOW_SEG_HDR_IPV6 |
+				  ICE_FLOW_SEG_HDR_IPV_OTHER);
+		break;
+	case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_EH_IPV6_OTHER:
+		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_EH |
+				  ICE_FLOW_SEG_HDR_GTPU_IP |
+				  ICE_FLOW_SEG_HDR_IPV6 |
+				  ICE_FLOW_SEG_HDR_IPV_OTHER);
 		break;
 	case ICE_FLTR_PTYPE_NON_IP_L2:
 		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_ETH_NON_IP);
@@ -2007,13 +1988,18 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
 		}
 	}
 
-	if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU ||
-	    tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU_EH) {
-		if (flow_type == ICE_FLTR_PTYPE_NONF_IPV4_UDP)
-			flow_type = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER;
-		else
-			flow_type = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER;
-	}
+	if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU &&
+		flow_type == ICE_FLTR_PTYPE_NONF_IPV4_UDP)
+		flow_type = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER;
+	else if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU_EH &&
+		flow_type == ICE_FLTR_PTYPE_NONF_IPV4_UDP)
+		flow_type = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_IPV4_OTHER;
+	else if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU &&
+		flow_type == ICE_FLTR_PTYPE_NONF_IPV6_UDP)
+		flow_type = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER;
+	else if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU_EH &&
+		flow_type == ICE_FLTR_PTYPE_NONF_IPV4_UDP)
+		flow_type = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_EH_IPV6_OTHER;
 
 	filter->tunnel_type = tunnel_type;
 	filter->input.flow_type = flow_type;
-- 
2.19.1


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

* Re: [dpdk-dev] [PATCH v2] net/ice: fix FDIR GTPU rule create fail
  2020-07-30  9:28 ` [dpdk-dev] [PATCH v2] " Wei Zhao
@ 2020-07-30 10:11   ` Zhao1, Wei
  2020-07-31  1:24   ` Huang, ZhiminX
  2020-08-28  1:11   ` [dpdk-dev] [PATCH v3] " Wei Zhao
  2 siblings, 0 replies; 9+ messages in thread
From: Zhao1, Wei @ 2020-07-30 10:11 UTC (permalink / raw)
  To: dev; +Cc: Zhang, Qi Z, Huang, ZhiminX

Add Cc zhiminx.huang

> -----Original Message-----
> From: Zhao1, Wei <wei.zhao1@intel.com>
> Sent: Thursday, July 30, 2020 5:28 PM
> To: dev@dpdk.org
> Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Zhao1, Wei <wei.zhao1@intel.com>
> Subject: [PATCH v2] net/ice: fix FDIR GTPU rule create fail
> 
> For GTPU rule without extend header the trainning packet for FDIR is different.
> This patch enable these case.
> 
> Fixes: 934fd00c9389 ("net/ice/base: fix GTPU IP hash")
> 
> Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
> ---
>  drivers/net/ice/base/ice_fdir.c   | 63 +++++++++++++++++++++++-
>  drivers/net/ice/base/ice_type.h   |  2 +
>  drivers/net/ice/ice_fdir_filter.c | 80 +++++++++++++------------------
>  3 files changed, 97 insertions(+), 48 deletions(-)
> 
> diff --git a/drivers/net/ice/base/ice_fdir.c b/drivers/net/ice/base/ice_fdir.c
> index 2c47fb57b..a904ff513 100644
> --- a/drivers/net/ice/base/ice_fdir.c
> +++ b/drivers/net/ice/base/ice_fdir.c
> @@ -89,6 +89,37 @@ static const u8 ice_fdir_icmp4_gtpu4_pkt[] = {  };
> 
>  static const u8 ice_fdir_ipv4_gtpu4_pkt[] = {
> +	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> +	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
> +	0x00, 0x44, 0x00, 0x00, 0x40, 0x00, 0x40, 0x11,
> +	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> +	0x00, 0x00, 0x08, 0x68, 0x08, 0x68, 0x00, 0x00,
> +	0x00, 0x00, 0x33, 0xff, 0x00, 0x20, 0x00, 0x00,
> +	0x00, 0x00, 0x00, 0x00, 0x00, 0x85, 0x45, 0x00,
> +	0x00, 0x14, 0x00, 0x00, 0x40, 0x00, 0x40, 0x00,
> +	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> +	0x00, 0x00,
> +};
> +
> +static const u8 ice_fdir_ipv6_gtpu6_pkt[] = {
> +	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> +	0x00, 0x00, 0x00, 0x00, 0x86, 0xdd, 0x60, 0x00,
> +	0x00, 0x00, 0x00, 0x44, 0x11, 0x40, 0x00, 0x00,
> +	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> +	0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
> +	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> +	0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x08, 0x68,
> +	0x08, 0x68, 0x00, 0x44, 0x7f, 0xed, 0x33, 0xff,
> +	0x00, 0x34, 0x12, 0x34, 0x56, 0x78, 0x00, 0x00,
> +	0x00, 0x85, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
> +	0x3b, 0x40, 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,
> +};
> +
> +static const u8 ice_fdir_ipv4_gtpu4_eh_pkt[] = {
>  	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
>  	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
>  	0x00, 0x44, 0x00, 0x00, 0x40, 0x00, 0x40, 0x11, @@ -102,7 +133,7 @@
> static const u8 ice_fdir_ipv4_gtpu4_pkt[] = {
>  	0x00, 0x00,
>  };
> 
> -static const u8 ice_fdir_ipv6_gtpu6_pkt[] = {
> +static const u8 ice_fdir_ipv6_gtpu6_eh_pkt[] = {
>  	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
>  	0x00, 0x00, 0x00, 0x00, 0x86, 0xdd, 0x60, 0x00,
>  	0x00, 0x00, 0x00, 0x44, 0x11, 0x40, 0x00, 0x00, @@ -492,6 +523,20 @@
> static const struct ice_fdir_base_pkt ice_fdir_pkt[] = {
>  		sizeof(ice_fdir_ipv6_gtpu6_pkt),
>  		ice_fdir_ipv6_gtpu6_pkt,
>  	},
> +	{
> +		ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_IPV4_OTHER,
> +		sizeof(ice_fdir_ipv4_gtpu4_eh_pkt),
> +		ice_fdir_ipv4_gtpu4_eh_pkt,
> +		sizeof(ice_fdir_ipv4_gtpu4_eh_pkt),
> +		ice_fdir_ipv4_gtpu4_eh_pkt,
> +	},
> +	{
> +		ICE_FLTR_PTYPE_NONF_IPV6_GTPU_EH_IPV6_OTHER,
> +		sizeof(ice_fdir_ipv6_gtpu6_eh_pkt),
> +		ice_fdir_ipv6_gtpu6_eh_pkt,
> +		sizeof(ice_fdir_ipv6_gtpu6_eh_pkt),
> +		ice_fdir_ipv6_gtpu6_eh_pkt,
> +	},
>  	{
>  		ICE_FLTR_PTYPE_NONF_IPV4_L2TPV3,
>  		sizeof(ice_fdir_ipv4_l2tpv3_pkt), ice_fdir_ipv4_l2tpv3_pkt, @@
> -1053,6 +1098,14 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct
> ice_fdir_fltr *input,
>  	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_TCP:
>  	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_ICMP:
>  	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER:
> +		ice_pkt_insert_u32(loc, ICE_IPV4_DST_ADDR_OFFSET,
> +				   input->ip.v4.src_ip);
> +		ice_pkt_insert_u32(loc, ICE_IPV4_SRC_ADDR_OFFSET,
> +				   input->ip.v4.dst_ip);
> +		ice_pkt_insert_u32(loc, ICE_IPV4_GTPU_TEID_OFFSET,
> +				   input->gtpu_data.teid);
> +		break;
> +	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_IPV4_OTHER:
>  		ice_pkt_insert_u32(loc, ICE_IPV4_DST_ADDR_OFFSET,
>  				   input->ip.v4.src_ip);
>  		ice_pkt_insert_u32(loc, ICE_IPV4_SRC_ADDR_OFFSET, @@ -1063,6
> +1116,14 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct
> ice_fdir_fltr *input,
>  				      input->gtpu_data.qfi);
>  		break;
>  	case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER:
> +		ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_DST_ADDR_OFFSET,
> +					 input->ip.v6.src_ip);
> +		ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_SRC_ADDR_OFFSET,
> +					 input->ip.v6.dst_ip);
> +		ice_pkt_insert_u32(loc, ICE_IPV6_GTPU_TEID_OFFSET,
> +				   input->gtpu_data.teid);
> +		break;
> +	case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_EH_IPV6_OTHER:
>  		ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_DST_ADDR_OFFSET,
>  					 input->ip.v6.src_ip);
>  		ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_SRC_ADDR_OFFSET, diff --git
> a/drivers/net/ice/base/ice_type.h b/drivers/net/ice/base/ice_type.h index
> c13cd7b00..3775689a9 100644
> --- a/drivers/net/ice/base/ice_type.h
> +++ b/drivers/net/ice/base/ice_type.h
> @@ -297,6 +297,8 @@ enum ice_fltr_ptype {
>  	ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_ICMP,
>  	ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER,
>  	ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER,
> +	ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_IPV4_OTHER,
> +	ICE_FLTR_PTYPE_NONF_IPV6_GTPU_EH_IPV6_OTHER,
>  	ICE_FLTR_PTYPE_NONF_IPV4_L2TPV3,
>  	ICE_FLTR_PTYPE_NONF_IPV6_L2TPV3,
>  	ICE_FLTR_PTYPE_NONF_IPV4_ESP,
> diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c
> index 745d7291a..c59fe46b9 100644
> --- a/drivers/net/ice/ice_fdir_filter.c
> +++ b/drivers/net/ice/ice_fdir_filter.c
> @@ -778,30 +778,15 @@ ice_fdir_cross_prof_conflict(struct ice_pf *pf,
>  			goto err;
>  		break;
>  	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER:
> -		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER;
> +		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_UDP;
>  		if (!ice_fdir_prof_resolve_conflict
>  			(pf, cflct_ptype, is_tunnel))
>  			goto err;
> -		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER;
> +		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_TCP;
>  		if (!ice_fdir_prof_resolve_conflict
>  			(pf, cflct_ptype, is_tunnel))
>  			goto err;
> -		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER;
> -		if (!ice_fdir_prof_resolve_conflict
> -			(pf, cflct_ptype, is_tunnel))
> -			goto err;
> -		break;
> -	/* IPv6 GTPU */
> -	case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER:
> -		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER;
> -		if (!ice_fdir_prof_resolve_conflict
> -			(pf, cflct_ptype, is_tunnel))
> -			goto err;
> -		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER;
> -		if (!ice_fdir_prof_resolve_conflict
> -			(pf, cflct_ptype, is_tunnel))
> -			goto err;
> -		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER;
> +		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_ICMP;
>  		if (!ice_fdir_prof_resolve_conflict
>  			(pf, cflct_ptype, is_tunnel))
>  			goto err;
> @@ -1025,30 +1010,26 @@ ice_fdir_input_set_conf(struct ice_pf *pf, enum
> ice_fltr_ptype flow,
>  	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_TCP:
>  	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_ICMP:
>  	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER:
> -		if (ttype == ICE_FDIR_TUNNEL_TYPE_GTPU)
> -			ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_IP |
> -					  ICE_FLOW_SEG_HDR_IPV4 |
> -					  ICE_FLOW_SEG_HDR_IPV_OTHER);
> -		else if (ttype == ICE_FDIR_TUNNEL_TYPE_GTPU_EH)
> -			ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_EH |
> -					  ICE_FLOW_SEG_HDR_GTPU_IP |
> -					  ICE_FLOW_SEG_HDR_IPV4 |
> -					  ICE_FLOW_SEG_HDR_IPV_OTHER);
> -		else
> -			PMD_DRV_LOG(ERR, "not supported tunnel type.");
> +		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_IP |
> +				  ICE_FLOW_SEG_HDR_IPV4 |
> +				  ICE_FLOW_SEG_HDR_IPV_OTHER);
> +		break;
> +	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_IPV4_OTHER:
> +		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_EH |
> +				  ICE_FLOW_SEG_HDR_GTPU_IP |
> +				  ICE_FLOW_SEG_HDR_IPV4 |
> +				  ICE_FLOW_SEG_HDR_IPV_OTHER);
>  		break;
>  	case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER:
> -		if (ttype == ICE_FDIR_TUNNEL_TYPE_GTPU)
> -			ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_IP |
> -					  ICE_FLOW_SEG_HDR_IPV6 |
> -					  ICE_FLOW_SEG_HDR_IPV_OTHER);
> -		else if (ttype == ICE_FDIR_TUNNEL_TYPE_GTPU_EH)
> -			ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_EH |
> -					  ICE_FLOW_SEG_HDR_GTPU_IP |
> -					  ICE_FLOW_SEG_HDR_IPV6 |
> -					  ICE_FLOW_SEG_HDR_IPV_OTHER);
> -		else
> -			PMD_DRV_LOG(ERR, "not supported tunnel type.");
> +		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_IP |
> +				  ICE_FLOW_SEG_HDR_IPV6 |
> +				  ICE_FLOW_SEG_HDR_IPV_OTHER);
> +		break;
> +	case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_EH_IPV6_OTHER:
> +		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_EH |
> +				  ICE_FLOW_SEG_HDR_GTPU_IP |
> +				  ICE_FLOW_SEG_HDR_IPV6 |
> +				  ICE_FLOW_SEG_HDR_IPV_OTHER);
>  		break;
>  	case ICE_FLTR_PTYPE_NON_IP_L2:
>  		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_ETH_NON_IP);
> @@ -2007,13 +1988,18 @@ ice_fdir_parse_pattern(__rte_unused struct
> ice_adapter *ad,
>  		}
>  	}
> 
> -	if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU ||
> -	    tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU_EH) {
> -		if (flow_type == ICE_FLTR_PTYPE_NONF_IPV4_UDP)
> -			flow_type = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER;
> -		else
> -			flow_type = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER;
> -	}
> +	if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU &&
> +		flow_type == ICE_FLTR_PTYPE_NONF_IPV4_UDP)
> +		flow_type = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER;
> +	else if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU_EH &&
> +		flow_type == ICE_FLTR_PTYPE_NONF_IPV4_UDP)
> +		flow_type = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_IPV4_OTHER;
> +	else if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU &&
> +		flow_type == ICE_FLTR_PTYPE_NONF_IPV6_UDP)
> +		flow_type = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER;
> +	else if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU_EH &&
> +		flow_type == ICE_FLTR_PTYPE_NONF_IPV4_UDP)
> +		flow_type = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_EH_IPV6_OTHER;
> 
>  	filter->tunnel_type = tunnel_type;
>  	filter->input.flow_type = flow_type;
> --
> 2.19.1


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

* Re: [dpdk-dev] [PATCH v2] net/ice: fix FDIR GTPU rule create fail
  2020-07-30  9:28 ` [dpdk-dev] [PATCH v2] " Wei Zhao
  2020-07-30 10:11   ` Zhao1, Wei
@ 2020-07-31  1:24   ` Huang, ZhiminX
  2020-08-28  1:11   ` [dpdk-dev] [PATCH v3] " Wei Zhao
  2 siblings, 0 replies; 9+ messages in thread
From: Huang, ZhiminX @ 2020-07-31  1:24 UTC (permalink / raw)
  To: Zhao1, Wei, dev; +Cc: Zhang, Qi Z, Zhao1, Wei

Tested-by: Huang, ZhiminX <zhiminx.huang@intel.com>

Regards,
HuangZhiMin



-----Original Message-----
From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wei Zhao
Sent: Thursday, July 30, 2020 5:28 PM
To: dev@dpdk.org
Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Zhao1, Wei <wei.zhao1@intel.com>
Subject: [dpdk-dev] [PATCH v2] net/ice: fix FDIR GTPU rule create fail

For GTPU rule without extend header the trainning packet for FDIR is different. This patch enable these case.

Fixes: 934fd00c9389 ("net/ice/base: fix GTPU IP hash")

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
---
 drivers/net/ice/base/ice_fdir.c   | 63 +++++++++++++++++++++++-
 drivers/net/ice/base/ice_type.h   |  2 +
 drivers/net/ice/ice_fdir_filter.c | 80 +++++++++++++------------------
 3 files changed, 97 insertions(+), 48 deletions(-)

diff --git a/drivers/net/ice/base/ice_fdir.c b/drivers/net/ice/base/ice_fdir.c index 2c47fb57b..a904ff513 100644
--- a/drivers/net/ice/base/ice_fdir.c
+++ b/drivers/net/ice/base/ice_fdir.c
@@ -89,6 +89,37 @@ static const u8 ice_fdir_icmp4_gtpu4_pkt[] = {  };
 
 static const u8 ice_fdir_ipv4_gtpu4_pkt[] = {
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
+	0x00, 0x44, 0x00, 0x00, 0x40, 0x00, 0x40, 0x11,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x08, 0x68, 0x08, 0x68, 0x00, 0x00,
+	0x00, 0x00, 0x33, 0xff, 0x00, 0x20, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x85, 0x45, 0x00,
+	0x00, 0x14, 0x00, 0x00, 0x40, 0x00, 0x40, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00,
+};
+
+static const u8 ice_fdir_ipv6_gtpu6_pkt[] = {
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x86, 0xdd, 0x60, 0x00,
+	0x00, 0x00, 0x00, 0x44, 0x11, 0x40, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x08, 0x68,
+	0x08, 0x68, 0x00, 0x44, 0x7f, 0xed, 0x33, 0xff,
+	0x00, 0x34, 0x12, 0x34, 0x56, 0x78, 0x00, 0x00,
+	0x00, 0x85, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x3b, 0x40, 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,
+};
+
+static const u8 ice_fdir_ipv4_gtpu4_eh_pkt[] = {
 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
 	0x00, 0x44, 0x00, 0x00, 0x40, 0x00, 0x40, 0x11, @@ -102,7 +133,7 @@ static const u8 ice_fdir_ipv4_gtpu4_pkt[] = {
 	0x00, 0x00,
 };
 
-static const u8 ice_fdir_ipv6_gtpu6_pkt[] = {
+static const u8 ice_fdir_ipv6_gtpu6_eh_pkt[] = {
 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00, 0x86, 0xdd, 0x60, 0x00,
 	0x00, 0x00, 0x00, 0x44, 0x11, 0x40, 0x00, 0x00, @@ -492,6 +523,20 @@ static const struct ice_fdir_base_pkt ice_fdir_pkt[] = {
 		sizeof(ice_fdir_ipv6_gtpu6_pkt),
 		ice_fdir_ipv6_gtpu6_pkt,
 	},
+	{
+		ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_IPV4_OTHER,
+		sizeof(ice_fdir_ipv4_gtpu4_eh_pkt),
+		ice_fdir_ipv4_gtpu4_eh_pkt,
+		sizeof(ice_fdir_ipv4_gtpu4_eh_pkt),
+		ice_fdir_ipv4_gtpu4_eh_pkt,
+	},
+	{
+		ICE_FLTR_PTYPE_NONF_IPV6_GTPU_EH_IPV6_OTHER,
+		sizeof(ice_fdir_ipv6_gtpu6_eh_pkt),
+		ice_fdir_ipv6_gtpu6_eh_pkt,
+		sizeof(ice_fdir_ipv6_gtpu6_eh_pkt),
+		ice_fdir_ipv6_gtpu6_eh_pkt,
+	},
 	{
 		ICE_FLTR_PTYPE_NONF_IPV4_L2TPV3,
 		sizeof(ice_fdir_ipv4_l2tpv3_pkt), ice_fdir_ipv4_l2tpv3_pkt, @@ -1053,6 +1098,14 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input,
 	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_TCP:
 	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_ICMP:
 	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER:
+		ice_pkt_insert_u32(loc, ICE_IPV4_DST_ADDR_OFFSET,
+				   input->ip.v4.src_ip);
+		ice_pkt_insert_u32(loc, ICE_IPV4_SRC_ADDR_OFFSET,
+				   input->ip.v4.dst_ip);
+		ice_pkt_insert_u32(loc, ICE_IPV4_GTPU_TEID_OFFSET,
+				   input->gtpu_data.teid);
+		break;
+	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_IPV4_OTHER:
 		ice_pkt_insert_u32(loc, ICE_IPV4_DST_ADDR_OFFSET,
 				   input->ip.v4.src_ip);
 		ice_pkt_insert_u32(loc, ICE_IPV4_SRC_ADDR_OFFSET, @@ -1063,6 +1116,14 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input,
 				      input->gtpu_data.qfi);
 		break;
 	case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER:
+		ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_DST_ADDR_OFFSET,
+					 input->ip.v6.src_ip);
+		ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_SRC_ADDR_OFFSET,
+					 input->ip.v6.dst_ip);
+		ice_pkt_insert_u32(loc, ICE_IPV6_GTPU_TEID_OFFSET,
+				   input->gtpu_data.teid);
+		break;
+	case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_EH_IPV6_OTHER:
 		ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_DST_ADDR_OFFSET,
 					 input->ip.v6.src_ip);
 		ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_SRC_ADDR_OFFSET, diff --git a/drivers/net/ice/base/ice_type.h b/drivers/net/ice/base/ice_type.h index c13cd7b00..3775689a9 100644
--- a/drivers/net/ice/base/ice_type.h
+++ b/drivers/net/ice/base/ice_type.h
@@ -297,6 +297,8 @@ enum ice_fltr_ptype {
 	ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_ICMP,
 	ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER,
 	ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER,
+	ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_IPV4_OTHER,
+	ICE_FLTR_PTYPE_NONF_IPV6_GTPU_EH_IPV6_OTHER,
 	ICE_FLTR_PTYPE_NONF_IPV4_L2TPV3,
 	ICE_FLTR_PTYPE_NONF_IPV6_L2TPV3,
 	ICE_FLTR_PTYPE_NONF_IPV4_ESP,
diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c
index 745d7291a..c59fe46b9 100644
--- a/drivers/net/ice/ice_fdir_filter.c
+++ b/drivers/net/ice/ice_fdir_filter.c
@@ -778,30 +778,15 @@ ice_fdir_cross_prof_conflict(struct ice_pf *pf,
 			goto err;
 		break;
 	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER:
-		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER;
+		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_UDP;
 		if (!ice_fdir_prof_resolve_conflict
 			(pf, cflct_ptype, is_tunnel))
 			goto err;
-		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER;
+		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_TCP;
 		if (!ice_fdir_prof_resolve_conflict
 			(pf, cflct_ptype, is_tunnel))
 			goto err;
-		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER;
-		if (!ice_fdir_prof_resolve_conflict
-			(pf, cflct_ptype, is_tunnel))
-			goto err;
-		break;
-	/* IPv6 GTPU */
-	case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER:
-		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER;
-		if (!ice_fdir_prof_resolve_conflict
-			(pf, cflct_ptype, is_tunnel))
-			goto err;
-		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER;
-		if (!ice_fdir_prof_resolve_conflict
-			(pf, cflct_ptype, is_tunnel))
-			goto err;
-		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER;
+		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_ICMP;
 		if (!ice_fdir_prof_resolve_conflict
 			(pf, cflct_ptype, is_tunnel))
 			goto err;
@@ -1025,30 +1010,26 @@ ice_fdir_input_set_conf(struct ice_pf *pf, enum ice_fltr_ptype flow,
 	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_TCP:
 	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_ICMP:
 	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER:
-		if (ttype == ICE_FDIR_TUNNEL_TYPE_GTPU)
-			ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_IP |
-					  ICE_FLOW_SEG_HDR_IPV4 |
-					  ICE_FLOW_SEG_HDR_IPV_OTHER);
-		else if (ttype == ICE_FDIR_TUNNEL_TYPE_GTPU_EH)
-			ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_EH |
-					  ICE_FLOW_SEG_HDR_GTPU_IP |
-					  ICE_FLOW_SEG_HDR_IPV4 |
-					  ICE_FLOW_SEG_HDR_IPV_OTHER);
-		else
-			PMD_DRV_LOG(ERR, "not supported tunnel type.");
+		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_IP |
+				  ICE_FLOW_SEG_HDR_IPV4 |
+				  ICE_FLOW_SEG_HDR_IPV_OTHER);
+		break;
+	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_IPV4_OTHER:
+		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_EH |
+				  ICE_FLOW_SEG_HDR_GTPU_IP |
+				  ICE_FLOW_SEG_HDR_IPV4 |
+				  ICE_FLOW_SEG_HDR_IPV_OTHER);
 		break;
 	case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER:
-		if (ttype == ICE_FDIR_TUNNEL_TYPE_GTPU)
-			ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_IP |
-					  ICE_FLOW_SEG_HDR_IPV6 |
-					  ICE_FLOW_SEG_HDR_IPV_OTHER);
-		else if (ttype == ICE_FDIR_TUNNEL_TYPE_GTPU_EH)
-			ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_EH |
-					  ICE_FLOW_SEG_HDR_GTPU_IP |
-					  ICE_FLOW_SEG_HDR_IPV6 |
-					  ICE_FLOW_SEG_HDR_IPV_OTHER);
-		else
-			PMD_DRV_LOG(ERR, "not supported tunnel type.");
+		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_IP |
+				  ICE_FLOW_SEG_HDR_IPV6 |
+				  ICE_FLOW_SEG_HDR_IPV_OTHER);
+		break;
+	case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_EH_IPV6_OTHER:
+		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_EH |
+				  ICE_FLOW_SEG_HDR_GTPU_IP |
+				  ICE_FLOW_SEG_HDR_IPV6 |
+				  ICE_FLOW_SEG_HDR_IPV_OTHER);
 		break;
 	case ICE_FLTR_PTYPE_NON_IP_L2:
 		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_ETH_NON_IP); @@ -2007,13 +1988,18 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
 		}
 	}
 
-	if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU ||
-	    tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU_EH) {
-		if (flow_type == ICE_FLTR_PTYPE_NONF_IPV4_UDP)
-			flow_type = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER;
-		else
-			flow_type = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER;
-	}
+	if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU &&
+		flow_type == ICE_FLTR_PTYPE_NONF_IPV4_UDP)
+		flow_type = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER;
+	else if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU_EH &&
+		flow_type == ICE_FLTR_PTYPE_NONF_IPV4_UDP)
+		flow_type = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_IPV4_OTHER;
+	else if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU &&
+		flow_type == ICE_FLTR_PTYPE_NONF_IPV6_UDP)
+		flow_type = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER;
+	else if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU_EH &&
+		flow_type == ICE_FLTR_PTYPE_NONF_IPV4_UDP)
+		flow_type = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_EH_IPV6_OTHER;
 
 	filter->tunnel_type = tunnel_type;
 	filter->input.flow_type = flow_type;
--
2.19.1


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

* [dpdk-dev] [PATCH v3] net/ice: fix FDIR GTPU rule create fail
  2020-07-30  9:28 ` [dpdk-dev] [PATCH v2] " Wei Zhao
  2020-07-30 10:11   ` Zhao1, Wei
  2020-07-31  1:24   ` Huang, ZhiminX
@ 2020-08-28  1:11   ` Wei Zhao
  2020-08-31  6:58     ` [dpdk-dev] [PATCH v4] " Wei Zhao
  2 siblings, 1 reply; 9+ messages in thread
From: Wei Zhao @ 2020-08-28  1:11 UTC (permalink / raw)
  To: dev; +Cc: stable, qi.z.zhang, Wei Zhao

For GTPU rule without extend header the trainning packet
for FDIR is different. This patch enable these case.

Fixes: 934fd00c9389 ("net/ice/base: fix GTPU IP hash")

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>

---

v3: fix typo
---
 drivers/net/ice/base/ice_fdir.c   | 63 +++++++++++++++++++++++-
 drivers/net/ice/base/ice_type.h   |  2 +
 drivers/net/ice/ice_fdir_filter.c | 80 +++++++++++++------------------
 3 files changed, 97 insertions(+), 48 deletions(-)

diff --git a/drivers/net/ice/base/ice_fdir.c b/drivers/net/ice/base/ice_fdir.c
index 2c47fb57b..a904ff513 100644
--- a/drivers/net/ice/base/ice_fdir.c
+++ b/drivers/net/ice/base/ice_fdir.c
@@ -89,6 +89,37 @@ static const u8 ice_fdir_icmp4_gtpu4_pkt[] = {
 };
 
 static const u8 ice_fdir_ipv4_gtpu4_pkt[] = {
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
+	0x00, 0x44, 0x00, 0x00, 0x40, 0x00, 0x40, 0x11,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x08, 0x68, 0x08, 0x68, 0x00, 0x00,
+	0x00, 0x00, 0x33, 0xff, 0x00, 0x20, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x85, 0x45, 0x00,
+	0x00, 0x14, 0x00, 0x00, 0x40, 0x00, 0x40, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00,
+};
+
+static const u8 ice_fdir_ipv6_gtpu6_pkt[] = {
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x86, 0xdd, 0x60, 0x00,
+	0x00, 0x00, 0x00, 0x44, 0x11, 0x40, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x08, 0x68,
+	0x08, 0x68, 0x00, 0x44, 0x7f, 0xed, 0x33, 0xff,
+	0x00, 0x34, 0x12, 0x34, 0x56, 0x78, 0x00, 0x00,
+	0x00, 0x85, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x3b, 0x40, 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,
+};
+
+static const u8 ice_fdir_ipv4_gtpu4_eh_pkt[] = {
 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
 	0x00, 0x44, 0x00, 0x00, 0x40, 0x00, 0x40, 0x11,
@@ -102,7 +133,7 @@ static const u8 ice_fdir_ipv4_gtpu4_pkt[] = {
 	0x00, 0x00,
 };
 
-static const u8 ice_fdir_ipv6_gtpu6_pkt[] = {
+static const u8 ice_fdir_ipv6_gtpu6_eh_pkt[] = {
 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00, 0x86, 0xdd, 0x60, 0x00,
 	0x00, 0x00, 0x00, 0x44, 0x11, 0x40, 0x00, 0x00,
@@ -492,6 +523,20 @@ static const struct ice_fdir_base_pkt ice_fdir_pkt[] = {
 		sizeof(ice_fdir_ipv6_gtpu6_pkt),
 		ice_fdir_ipv6_gtpu6_pkt,
 	},
+	{
+		ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_IPV4_OTHER,
+		sizeof(ice_fdir_ipv4_gtpu4_eh_pkt),
+		ice_fdir_ipv4_gtpu4_eh_pkt,
+		sizeof(ice_fdir_ipv4_gtpu4_eh_pkt),
+		ice_fdir_ipv4_gtpu4_eh_pkt,
+	},
+	{
+		ICE_FLTR_PTYPE_NONF_IPV6_GTPU_EH_IPV6_OTHER,
+		sizeof(ice_fdir_ipv6_gtpu6_eh_pkt),
+		ice_fdir_ipv6_gtpu6_eh_pkt,
+		sizeof(ice_fdir_ipv6_gtpu6_eh_pkt),
+		ice_fdir_ipv6_gtpu6_eh_pkt,
+	},
 	{
 		ICE_FLTR_PTYPE_NONF_IPV4_L2TPV3,
 		sizeof(ice_fdir_ipv4_l2tpv3_pkt), ice_fdir_ipv4_l2tpv3_pkt,
@@ -1053,6 +1098,14 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input,
 	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_TCP:
 	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_ICMP:
 	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER:
+		ice_pkt_insert_u32(loc, ICE_IPV4_DST_ADDR_OFFSET,
+				   input->ip.v4.src_ip);
+		ice_pkt_insert_u32(loc, ICE_IPV4_SRC_ADDR_OFFSET,
+				   input->ip.v4.dst_ip);
+		ice_pkt_insert_u32(loc, ICE_IPV4_GTPU_TEID_OFFSET,
+				   input->gtpu_data.teid);
+		break;
+	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_IPV4_OTHER:
 		ice_pkt_insert_u32(loc, ICE_IPV4_DST_ADDR_OFFSET,
 				   input->ip.v4.src_ip);
 		ice_pkt_insert_u32(loc, ICE_IPV4_SRC_ADDR_OFFSET,
@@ -1063,6 +1116,14 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input,
 				      input->gtpu_data.qfi);
 		break;
 	case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER:
+		ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_DST_ADDR_OFFSET,
+					 input->ip.v6.src_ip);
+		ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_SRC_ADDR_OFFSET,
+					 input->ip.v6.dst_ip);
+		ice_pkt_insert_u32(loc, ICE_IPV6_GTPU_TEID_OFFSET,
+				   input->gtpu_data.teid);
+		break;
+	case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_EH_IPV6_OTHER:
 		ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_DST_ADDR_OFFSET,
 					 input->ip.v6.src_ip);
 		ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_SRC_ADDR_OFFSET,
diff --git a/drivers/net/ice/base/ice_type.h b/drivers/net/ice/base/ice_type.h
index c13cd7b00..3775689a9 100644
--- a/drivers/net/ice/base/ice_type.h
+++ b/drivers/net/ice/base/ice_type.h
@@ -297,6 +297,8 @@ enum ice_fltr_ptype {
 	ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_ICMP,
 	ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER,
 	ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER,
+	ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_IPV4_OTHER,
+	ICE_FLTR_PTYPE_NONF_IPV6_GTPU_EH_IPV6_OTHER,
 	ICE_FLTR_PTYPE_NONF_IPV4_L2TPV3,
 	ICE_FLTR_PTYPE_NONF_IPV6_L2TPV3,
 	ICE_FLTR_PTYPE_NONF_IPV4_ESP,
diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c
index 745d7291a..c4b7265ce 100644
--- a/drivers/net/ice/ice_fdir_filter.c
+++ b/drivers/net/ice/ice_fdir_filter.c
@@ -778,30 +778,15 @@ ice_fdir_cross_prof_conflict(struct ice_pf *pf,
 			goto err;
 		break;
 	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER:
-		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER;
+		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_UDP;
 		if (!ice_fdir_prof_resolve_conflict
 			(pf, cflct_ptype, is_tunnel))
 			goto err;
-		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER;
+		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_TCP;
 		if (!ice_fdir_prof_resolve_conflict
 			(pf, cflct_ptype, is_tunnel))
 			goto err;
-		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER;
-		if (!ice_fdir_prof_resolve_conflict
-			(pf, cflct_ptype, is_tunnel))
-			goto err;
-		break;
-	/* IPv6 GTPU */
-	case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER:
-		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER;
-		if (!ice_fdir_prof_resolve_conflict
-			(pf, cflct_ptype, is_tunnel))
-			goto err;
-		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER;
-		if (!ice_fdir_prof_resolve_conflict
-			(pf, cflct_ptype, is_tunnel))
-			goto err;
-		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER;
+		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_ICMP;
 		if (!ice_fdir_prof_resolve_conflict
 			(pf, cflct_ptype, is_tunnel))
 			goto err;
@@ -1025,30 +1010,26 @@ ice_fdir_input_set_conf(struct ice_pf *pf, enum ice_fltr_ptype flow,
 	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_TCP:
 	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_ICMP:
 	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER:
-		if (ttype == ICE_FDIR_TUNNEL_TYPE_GTPU)
-			ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_IP |
-					  ICE_FLOW_SEG_HDR_IPV4 |
-					  ICE_FLOW_SEG_HDR_IPV_OTHER);
-		else if (ttype == ICE_FDIR_TUNNEL_TYPE_GTPU_EH)
-			ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_EH |
-					  ICE_FLOW_SEG_HDR_GTPU_IP |
-					  ICE_FLOW_SEG_HDR_IPV4 |
-					  ICE_FLOW_SEG_HDR_IPV_OTHER);
-		else
-			PMD_DRV_LOG(ERR, "not supported tunnel type.");
+		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_IP |
+				  ICE_FLOW_SEG_HDR_IPV4 |
+				  ICE_FLOW_SEG_HDR_IPV_OTHER);
+		break;
+	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_IPV4_OTHER:
+		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_EH |
+				  ICE_FLOW_SEG_HDR_GTPU_IP |
+				  ICE_FLOW_SEG_HDR_IPV4 |
+				  ICE_FLOW_SEG_HDR_IPV_OTHER);
 		break;
 	case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER:
-		if (ttype == ICE_FDIR_TUNNEL_TYPE_GTPU)
-			ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_IP |
-					  ICE_FLOW_SEG_HDR_IPV6 |
-					  ICE_FLOW_SEG_HDR_IPV_OTHER);
-		else if (ttype == ICE_FDIR_TUNNEL_TYPE_GTPU_EH)
-			ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_EH |
-					  ICE_FLOW_SEG_HDR_GTPU_IP |
-					  ICE_FLOW_SEG_HDR_IPV6 |
-					  ICE_FLOW_SEG_HDR_IPV_OTHER);
-		else
-			PMD_DRV_LOG(ERR, "not supported tunnel type.");
+		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_IP |
+				  ICE_FLOW_SEG_HDR_IPV6 |
+				  ICE_FLOW_SEG_HDR_IPV_OTHER);
+		break;
+	case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_EH_IPV6_OTHER:
+		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_EH |
+				  ICE_FLOW_SEG_HDR_GTPU_IP |
+				  ICE_FLOW_SEG_HDR_IPV6 |
+				  ICE_FLOW_SEG_HDR_IPV_OTHER);
 		break;
 	case ICE_FLTR_PTYPE_NON_IP_L2:
 		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_ETH_NON_IP);
@@ -2007,13 +1988,18 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
 		}
 	}
 
-	if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU ||
-	    tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU_EH) {
-		if (flow_type == ICE_FLTR_PTYPE_NONF_IPV4_UDP)
-			flow_type = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER;
-		else
-			flow_type = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER;
-	}
+	if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU &&
+		flow_type == ICE_FLTR_PTYPE_NONF_IPV4_UDP)
+		flow_type = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER;
+	else if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU_EH &&
+		flow_type == ICE_FLTR_PTYPE_NONF_IPV4_UDP)
+		flow_type = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_IPV4_OTHER;
+	else if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU &&
+		flow_type == ICE_FLTR_PTYPE_NONF_IPV6_UDP)
+		flow_type = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER;
+	else if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU_EH &&
+		flow_type == ICE_FLTR_PTYPE_NONF_IPV6_UDP)
+		flow_type = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_EH_IPV6_OTHER;
 
 	filter->tunnel_type = tunnel_type;
 	filter->input.flow_type = flow_type;
-- 
2.19.1


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

* [dpdk-dev] [PATCH v4] net/ice: fix FDIR GTPU rule create fail
  2020-08-28  1:11   ` [dpdk-dev] [PATCH v3] " Wei Zhao
@ 2020-08-31  6:58     ` Wei Zhao
  2020-08-31  7:36       ` Zhang, Qi Z
  2020-08-31  8:32       ` Huang, ZhiminX
  0 siblings, 2 replies; 9+ messages in thread
From: Wei Zhao @ 2020-08-31  6:58 UTC (permalink / raw)
  To: dev; +Cc: stable, qi.z.zhang, Wei Zhao

For GTPU rule without extend header the trainning packet
for FDIR is different. This patch enable these case.

Fixes: 934fd00c9389 ("net/ice/base: fix GTPU IP hash")
Cc: stable@dpdk.org

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
Tested-by: Huang ZhiminX <zhiminx.huang@intel.com>

---

v3: fix typo

v4: fix bug
---
 drivers/net/ice/base/ice_fdir.c   | 65 ++++++++++++++++++++++++-
 drivers/net/ice/base/ice_type.h   |  2 +
 drivers/net/ice/ice_fdir_filter.c | 80 +++++++++++++------------------
 3 files changed, 98 insertions(+), 49 deletions(-)

diff --git a/drivers/net/ice/base/ice_fdir.c b/drivers/net/ice/base/ice_fdir.c
index 2c47fb57b..aea388f2a 100644
--- a/drivers/net/ice/base/ice_fdir.c
+++ b/drivers/net/ice/base/ice_fdir.c
@@ -89,6 +89,37 @@ static const u8 ice_fdir_icmp4_gtpu4_pkt[] = {
 };
 
 static const u8 ice_fdir_ipv4_gtpu4_pkt[] = {
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
+	0x00, 0x44, 0x00, 0x00, 0x40, 0x00, 0x40, 0x11,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x08, 0x68, 0x08, 0x68, 0x00, 0x00,
+	0x00, 0x00, 0x33, 0xff, 0x00, 0x20, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x85, 0x45, 0x00,
+	0x00, 0x14, 0x00, 0x00, 0x40, 0x00, 0x40, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00,
+};
+
+static const u8 ice_fdir_ipv6_gtpu6_pkt[] = {
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x86, 0xdd, 0x60, 0x00,
+	0x00, 0x00, 0x00, 0x44, 0x11, 0x40, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x08, 0x68,
+	0x08, 0x68, 0x00, 0x44, 0x7f, 0xed, 0x33, 0xff,
+	0x00, 0x34, 0x12, 0x34, 0x56, 0x78, 0x00, 0x00,
+	0x00, 0x85, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x3b, 0x40, 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,
+};
+
+static const u8 ice_fdir_ipv4_gtpu4_eh_pkt[] = {
 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
 	0x00, 0x44, 0x00, 0x00, 0x40, 0x00, 0x40, 0x11,
@@ -102,7 +133,7 @@ static const u8 ice_fdir_ipv4_gtpu4_pkt[] = {
 	0x00, 0x00,
 };
 
-static const u8 ice_fdir_ipv6_gtpu6_pkt[] = {
+static const u8 ice_fdir_ipv6_gtpu6_eh_pkt[] = {
 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00, 0x86, 0xdd, 0x60, 0x00,
 	0x00, 0x00, 0x00, 0x44, 0x11, 0x40, 0x00, 0x00,
@@ -492,6 +523,20 @@ static const struct ice_fdir_base_pkt ice_fdir_pkt[] = {
 		sizeof(ice_fdir_ipv6_gtpu6_pkt),
 		ice_fdir_ipv6_gtpu6_pkt,
 	},
+	{
+		ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_IPV4_OTHER,
+		sizeof(ice_fdir_ipv4_gtpu4_eh_pkt),
+		ice_fdir_ipv4_gtpu4_eh_pkt,
+		sizeof(ice_fdir_ipv4_gtpu4_eh_pkt),
+		ice_fdir_ipv4_gtpu4_eh_pkt,
+	},
+	{
+		ICE_FLTR_PTYPE_NONF_IPV6_GTPU_EH_IPV6_OTHER,
+		sizeof(ice_fdir_ipv6_gtpu6_eh_pkt),
+		ice_fdir_ipv6_gtpu6_eh_pkt,
+		sizeof(ice_fdir_ipv6_gtpu6_eh_pkt),
+		ice_fdir_ipv6_gtpu6_eh_pkt,
+	},
 	{
 		ICE_FLTR_PTYPE_NONF_IPV4_L2TPV3,
 		sizeof(ice_fdir_ipv4_l2tpv3_pkt), ice_fdir_ipv4_l2tpv3_pkt,
@@ -1049,10 +1094,18 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input,
 				  input->ip.v4.proto);
 		ice_pkt_insert_mac_addr(loc, input->ext_data.dst_mac);
 		break;
+	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER:
+		ice_pkt_insert_u32(loc, ICE_IPV4_DST_ADDR_OFFSET,
+				   input->ip.v4.src_ip);
+		ice_pkt_insert_u32(loc, ICE_IPV4_SRC_ADDR_OFFSET,
+				   input->ip.v4.dst_ip);
+		ice_pkt_insert_u32(loc, ICE_IPV4_GTPU_TEID_OFFSET,
+				   input->gtpu_data.teid);
+		break;
 	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_UDP:
 	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_TCP:
 	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_ICMP:
-	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER:
+	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_IPV4_OTHER:
 		ice_pkt_insert_u32(loc, ICE_IPV4_DST_ADDR_OFFSET,
 				   input->ip.v4.src_ip);
 		ice_pkt_insert_u32(loc, ICE_IPV4_SRC_ADDR_OFFSET,
@@ -1063,6 +1116,14 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input,
 				      input->gtpu_data.qfi);
 		break;
 	case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER:
+		ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_DST_ADDR_OFFSET,
+					 input->ip.v6.src_ip);
+		ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_SRC_ADDR_OFFSET,
+					 input->ip.v6.dst_ip);
+		ice_pkt_insert_u32(loc, ICE_IPV6_GTPU_TEID_OFFSET,
+				   input->gtpu_data.teid);
+		break;
+	case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_EH_IPV6_OTHER:
 		ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_DST_ADDR_OFFSET,
 					 input->ip.v6.src_ip);
 		ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_SRC_ADDR_OFFSET,
diff --git a/drivers/net/ice/base/ice_type.h b/drivers/net/ice/base/ice_type.h
index c13cd7b00..3775689a9 100644
--- a/drivers/net/ice/base/ice_type.h
+++ b/drivers/net/ice/base/ice_type.h
@@ -297,6 +297,8 @@ enum ice_fltr_ptype {
 	ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_ICMP,
 	ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER,
 	ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER,
+	ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_IPV4_OTHER,
+	ICE_FLTR_PTYPE_NONF_IPV6_GTPU_EH_IPV6_OTHER,
 	ICE_FLTR_PTYPE_NONF_IPV4_L2TPV3,
 	ICE_FLTR_PTYPE_NONF_IPV6_L2TPV3,
 	ICE_FLTR_PTYPE_NONF_IPV4_ESP,
diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c
index 745d7291a..c4b7265ce 100644
--- a/drivers/net/ice/ice_fdir_filter.c
+++ b/drivers/net/ice/ice_fdir_filter.c
@@ -778,30 +778,15 @@ ice_fdir_cross_prof_conflict(struct ice_pf *pf,
 			goto err;
 		break;
 	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER:
-		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER;
+		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_UDP;
 		if (!ice_fdir_prof_resolve_conflict
 			(pf, cflct_ptype, is_tunnel))
 			goto err;
-		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER;
+		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_TCP;
 		if (!ice_fdir_prof_resolve_conflict
 			(pf, cflct_ptype, is_tunnel))
 			goto err;
-		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER;
-		if (!ice_fdir_prof_resolve_conflict
-			(pf, cflct_ptype, is_tunnel))
-			goto err;
-		break;
-	/* IPv6 GTPU */
-	case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER:
-		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER;
-		if (!ice_fdir_prof_resolve_conflict
-			(pf, cflct_ptype, is_tunnel))
-			goto err;
-		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER;
-		if (!ice_fdir_prof_resolve_conflict
-			(pf, cflct_ptype, is_tunnel))
-			goto err;
-		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER;
+		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_ICMP;
 		if (!ice_fdir_prof_resolve_conflict
 			(pf, cflct_ptype, is_tunnel))
 			goto err;
@@ -1025,30 +1010,26 @@ ice_fdir_input_set_conf(struct ice_pf *pf, enum ice_fltr_ptype flow,
 	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_TCP:
 	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_ICMP:
 	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER:
-		if (ttype == ICE_FDIR_TUNNEL_TYPE_GTPU)
-			ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_IP |
-					  ICE_FLOW_SEG_HDR_IPV4 |
-					  ICE_FLOW_SEG_HDR_IPV_OTHER);
-		else if (ttype == ICE_FDIR_TUNNEL_TYPE_GTPU_EH)
-			ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_EH |
-					  ICE_FLOW_SEG_HDR_GTPU_IP |
-					  ICE_FLOW_SEG_HDR_IPV4 |
-					  ICE_FLOW_SEG_HDR_IPV_OTHER);
-		else
-			PMD_DRV_LOG(ERR, "not supported tunnel type.");
+		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_IP |
+				  ICE_FLOW_SEG_HDR_IPV4 |
+				  ICE_FLOW_SEG_HDR_IPV_OTHER);
+		break;
+	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_IPV4_OTHER:
+		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_EH |
+				  ICE_FLOW_SEG_HDR_GTPU_IP |
+				  ICE_FLOW_SEG_HDR_IPV4 |
+				  ICE_FLOW_SEG_HDR_IPV_OTHER);
 		break;
 	case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER:
-		if (ttype == ICE_FDIR_TUNNEL_TYPE_GTPU)
-			ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_IP |
-					  ICE_FLOW_SEG_HDR_IPV6 |
-					  ICE_FLOW_SEG_HDR_IPV_OTHER);
-		else if (ttype == ICE_FDIR_TUNNEL_TYPE_GTPU_EH)
-			ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_EH |
-					  ICE_FLOW_SEG_HDR_GTPU_IP |
-					  ICE_FLOW_SEG_HDR_IPV6 |
-					  ICE_FLOW_SEG_HDR_IPV_OTHER);
-		else
-			PMD_DRV_LOG(ERR, "not supported tunnel type.");
+		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_IP |
+				  ICE_FLOW_SEG_HDR_IPV6 |
+				  ICE_FLOW_SEG_HDR_IPV_OTHER);
+		break;
+	case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_EH_IPV6_OTHER:
+		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_EH |
+				  ICE_FLOW_SEG_HDR_GTPU_IP |
+				  ICE_FLOW_SEG_HDR_IPV6 |
+				  ICE_FLOW_SEG_HDR_IPV_OTHER);
 		break;
 	case ICE_FLTR_PTYPE_NON_IP_L2:
 		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_ETH_NON_IP);
@@ -2007,13 +1988,18 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
 		}
 	}
 
-	if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU ||
-	    tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU_EH) {
-		if (flow_type == ICE_FLTR_PTYPE_NONF_IPV4_UDP)
-			flow_type = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER;
-		else
-			flow_type = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER;
-	}
+	if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU &&
+		flow_type == ICE_FLTR_PTYPE_NONF_IPV4_UDP)
+		flow_type = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER;
+	else if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU_EH &&
+		flow_type == ICE_FLTR_PTYPE_NONF_IPV4_UDP)
+		flow_type = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_IPV4_OTHER;
+	else if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU &&
+		flow_type == ICE_FLTR_PTYPE_NONF_IPV6_UDP)
+		flow_type = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER;
+	else if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU_EH &&
+		flow_type == ICE_FLTR_PTYPE_NONF_IPV6_UDP)
+		flow_type = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_EH_IPV6_OTHER;
 
 	filter->tunnel_type = tunnel_type;
 	filter->input.flow_type = flow_type;
-- 
2.19.1


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

* Re: [dpdk-dev] [PATCH v4] net/ice: fix FDIR GTPU rule create fail
  2020-08-31  6:58     ` [dpdk-dev] [PATCH v4] " Wei Zhao
@ 2020-08-31  7:36       ` Zhang, Qi Z
  2020-08-31  8:32       ` Huang, ZhiminX
  1 sibling, 0 replies; 9+ messages in thread
From: Zhang, Qi Z @ 2020-08-31  7:36 UTC (permalink / raw)
  To: Zhao1, Wei, dev; +Cc: stable



> -----Original Message-----
> From: Zhao1, Wei <wei.zhao1@intel.com>
> Sent: Monday, August 31, 2020 2:58 PM
> To: dev@dpdk.org
> Cc: stable@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>; Zhao1, Wei
> <wei.zhao1@intel.com>
> Subject: [PATCH v4] net/ice: fix FDIR GTPU rule create fail
> 
> For GTPU rule without extend header the trainning packet for FDIR is different.
> This patch enable these case.
> 
> Fixes: 934fd00c9389 ("net/ice/base: fix GTPU IP hash")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
> Tested-by: Huang ZhiminX <zhiminx.huang@intel.com>

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

Applied to dpdk-next-net-intel.

Thanks
Qi

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

* Re: [dpdk-dev] [PATCH v4] net/ice: fix FDIR GTPU rule create fail
  2020-08-31  6:58     ` [dpdk-dev] [PATCH v4] " Wei Zhao
  2020-08-31  7:36       ` Zhang, Qi Z
@ 2020-08-31  8:32       ` Huang, ZhiminX
  1 sibling, 0 replies; 9+ messages in thread
From: Huang, ZhiminX @ 2020-08-31  8:32 UTC (permalink / raw)
  To: Zhao1, Wei, dev; +Cc: stable, Zhang, Qi Z, Zhao1, Wei

Tested-by: Huang, ZhiminX <zhiminx.huang@intel.com>

Regards,
HuangZhiMin

-----Original Message-----
From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wei Zhao
Sent: Monday, August 31, 2020 2:58 PM
To: dev@dpdk.org
Cc: stable@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>; Zhao1, Wei <wei.zhao1@intel.com>
Subject: [dpdk-dev] [PATCH v4] net/ice: fix FDIR GTPU rule create fail

For GTPU rule without extend header the trainning packet for FDIR is different. This patch enable these case.

Fixes: 934fd00c9389 ("net/ice/base: fix GTPU IP hash")
Cc: stable@dpdk.org

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
Tested-by: Huang ZhiminX <zhiminx.huang@intel.com>

---

v3: fix typo

v4: fix bug
---
 drivers/net/ice/base/ice_fdir.c   | 65 ++++++++++++++++++++++++-
 drivers/net/ice/base/ice_type.h   |  2 +
 drivers/net/ice/ice_fdir_filter.c | 80 +++++++++++++------------------
 3 files changed, 98 insertions(+), 49 deletions(-)

diff --git a/drivers/net/ice/base/ice_fdir.c b/drivers/net/ice/base/ice_fdir.c index 2c47fb57b..aea388f2a 100644
--- a/drivers/net/ice/base/ice_fdir.c
+++ b/drivers/net/ice/base/ice_fdir.c
@@ -89,6 +89,37 @@ static const u8 ice_fdir_icmp4_gtpu4_pkt[] = {  };
 
 static const u8 ice_fdir_ipv4_gtpu4_pkt[] = {
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
+	0x00, 0x44, 0x00, 0x00, 0x40, 0x00, 0x40, 0x11,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x08, 0x68, 0x08, 0x68, 0x00, 0x00,
+	0x00, 0x00, 0x33, 0xff, 0x00, 0x20, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x85, 0x45, 0x00,
+	0x00, 0x14, 0x00, 0x00, 0x40, 0x00, 0x40, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00,
+};
+
+static const u8 ice_fdir_ipv6_gtpu6_pkt[] = {
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x86, 0xdd, 0x60, 0x00,
+	0x00, 0x00, 0x00, 0x44, 0x11, 0x40, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x08, 0x68,
+	0x08, 0x68, 0x00, 0x44, 0x7f, 0xed, 0x33, 0xff,
+	0x00, 0x34, 0x12, 0x34, 0x56, 0x78, 0x00, 0x00,
+	0x00, 0x85, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x3b, 0x40, 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,
+};
+
+static const u8 ice_fdir_ipv4_gtpu4_eh_pkt[] = {
 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
 	0x00, 0x44, 0x00, 0x00, 0x40, 0x00, 0x40, 0x11, @@ -102,7 +133,7 @@ static const u8 ice_fdir_ipv4_gtpu4_pkt[] = {
 	0x00, 0x00,
 };
 
-static const u8 ice_fdir_ipv6_gtpu6_pkt[] = {
+static const u8 ice_fdir_ipv6_gtpu6_eh_pkt[] = {
 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00, 0x86, 0xdd, 0x60, 0x00,
 	0x00, 0x00, 0x00, 0x44, 0x11, 0x40, 0x00, 0x00, @@ -492,6 +523,20 @@ static const struct ice_fdir_base_pkt ice_fdir_pkt[] = {
 		sizeof(ice_fdir_ipv6_gtpu6_pkt),
 		ice_fdir_ipv6_gtpu6_pkt,
 	},
+	{
+		ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_IPV4_OTHER,
+		sizeof(ice_fdir_ipv4_gtpu4_eh_pkt),
+		ice_fdir_ipv4_gtpu4_eh_pkt,
+		sizeof(ice_fdir_ipv4_gtpu4_eh_pkt),
+		ice_fdir_ipv4_gtpu4_eh_pkt,
+	},
+	{
+		ICE_FLTR_PTYPE_NONF_IPV6_GTPU_EH_IPV6_OTHER,
+		sizeof(ice_fdir_ipv6_gtpu6_eh_pkt),
+		ice_fdir_ipv6_gtpu6_eh_pkt,
+		sizeof(ice_fdir_ipv6_gtpu6_eh_pkt),
+		ice_fdir_ipv6_gtpu6_eh_pkt,
+	},
 	{
 		ICE_FLTR_PTYPE_NONF_IPV4_L2TPV3,
 		sizeof(ice_fdir_ipv4_l2tpv3_pkt), ice_fdir_ipv4_l2tpv3_pkt, @@ -1049,10 +1094,18 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input,
 				  input->ip.v4.proto);
 		ice_pkt_insert_mac_addr(loc, input->ext_data.dst_mac);
 		break;
+	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER:
+		ice_pkt_insert_u32(loc, ICE_IPV4_DST_ADDR_OFFSET,
+				   input->ip.v4.src_ip);
+		ice_pkt_insert_u32(loc, ICE_IPV4_SRC_ADDR_OFFSET,
+				   input->ip.v4.dst_ip);
+		ice_pkt_insert_u32(loc, ICE_IPV4_GTPU_TEID_OFFSET,
+				   input->gtpu_data.teid);
+		break;
 	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_UDP:
 	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_TCP:
 	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_ICMP:
-	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER:
+	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_IPV4_OTHER:
 		ice_pkt_insert_u32(loc, ICE_IPV4_DST_ADDR_OFFSET,
 				   input->ip.v4.src_ip);
 		ice_pkt_insert_u32(loc, ICE_IPV4_SRC_ADDR_OFFSET, @@ -1063,6 +1116,14 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input,
 				      input->gtpu_data.qfi);
 		break;
 	case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER:
+		ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_DST_ADDR_OFFSET,
+					 input->ip.v6.src_ip);
+		ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_SRC_ADDR_OFFSET,
+					 input->ip.v6.dst_ip);
+		ice_pkt_insert_u32(loc, ICE_IPV6_GTPU_TEID_OFFSET,
+				   input->gtpu_data.teid);
+		break;
+	case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_EH_IPV6_OTHER:
 		ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_DST_ADDR_OFFSET,
 					 input->ip.v6.src_ip);
 		ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_SRC_ADDR_OFFSET, diff --git a/drivers/net/ice/base/ice_type.h b/drivers/net/ice/base/ice_type.h index c13cd7b00..3775689a9 100644
--- a/drivers/net/ice/base/ice_type.h
+++ b/drivers/net/ice/base/ice_type.h
@@ -297,6 +297,8 @@ enum ice_fltr_ptype {
 	ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_ICMP,
 	ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER,
 	ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER,
+	ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_IPV4_OTHER,
+	ICE_FLTR_PTYPE_NONF_IPV6_GTPU_EH_IPV6_OTHER,
 	ICE_FLTR_PTYPE_NONF_IPV4_L2TPV3,
 	ICE_FLTR_PTYPE_NONF_IPV6_L2TPV3,
 	ICE_FLTR_PTYPE_NONF_IPV4_ESP,
diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c
index 745d7291a..c4b7265ce 100644
--- a/drivers/net/ice/ice_fdir_filter.c
+++ b/drivers/net/ice/ice_fdir_filter.c
@@ -778,30 +778,15 @@ ice_fdir_cross_prof_conflict(struct ice_pf *pf,
 			goto err;
 		break;
 	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER:
-		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER;
+		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_UDP;
 		if (!ice_fdir_prof_resolve_conflict
 			(pf, cflct_ptype, is_tunnel))
 			goto err;
-		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER;
+		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_TCP;
 		if (!ice_fdir_prof_resolve_conflict
 			(pf, cflct_ptype, is_tunnel))
 			goto err;
-		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER;
-		if (!ice_fdir_prof_resolve_conflict
-			(pf, cflct_ptype, is_tunnel))
-			goto err;
-		break;
-	/* IPv6 GTPU */
-	case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER:
-		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER;
-		if (!ice_fdir_prof_resolve_conflict
-			(pf, cflct_ptype, is_tunnel))
-			goto err;
-		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER;
-		if (!ice_fdir_prof_resolve_conflict
-			(pf, cflct_ptype, is_tunnel))
-			goto err;
-		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER;
+		cflct_ptype = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_ICMP;
 		if (!ice_fdir_prof_resolve_conflict
 			(pf, cflct_ptype, is_tunnel))
 			goto err;
@@ -1025,30 +1010,26 @@ ice_fdir_input_set_conf(struct ice_pf *pf, enum ice_fltr_ptype flow,
 	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_TCP:
 	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_ICMP:
 	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER:
-		if (ttype == ICE_FDIR_TUNNEL_TYPE_GTPU)
-			ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_IP |
-					  ICE_FLOW_SEG_HDR_IPV4 |
-					  ICE_FLOW_SEG_HDR_IPV_OTHER);
-		else if (ttype == ICE_FDIR_TUNNEL_TYPE_GTPU_EH)
-			ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_EH |
-					  ICE_FLOW_SEG_HDR_GTPU_IP |
-					  ICE_FLOW_SEG_HDR_IPV4 |
-					  ICE_FLOW_SEG_HDR_IPV_OTHER);
-		else
-			PMD_DRV_LOG(ERR, "not supported tunnel type.");
+		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_IP |
+				  ICE_FLOW_SEG_HDR_IPV4 |
+				  ICE_FLOW_SEG_HDR_IPV_OTHER);
+		break;
+	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_IPV4_OTHER:
+		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_EH |
+				  ICE_FLOW_SEG_HDR_GTPU_IP |
+				  ICE_FLOW_SEG_HDR_IPV4 |
+				  ICE_FLOW_SEG_HDR_IPV_OTHER);
 		break;
 	case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER:
-		if (ttype == ICE_FDIR_TUNNEL_TYPE_GTPU)
-			ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_IP |
-					  ICE_FLOW_SEG_HDR_IPV6 |
-					  ICE_FLOW_SEG_HDR_IPV_OTHER);
-		else if (ttype == ICE_FDIR_TUNNEL_TYPE_GTPU_EH)
-			ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_EH |
-					  ICE_FLOW_SEG_HDR_GTPU_IP |
-					  ICE_FLOW_SEG_HDR_IPV6 |
-					  ICE_FLOW_SEG_HDR_IPV_OTHER);
-		else
-			PMD_DRV_LOG(ERR, "not supported tunnel type.");
+		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_IP |
+				  ICE_FLOW_SEG_HDR_IPV6 |
+				  ICE_FLOW_SEG_HDR_IPV_OTHER);
+		break;
+	case ICE_FLTR_PTYPE_NONF_IPV6_GTPU_EH_IPV6_OTHER:
+		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_GTPU_EH |
+				  ICE_FLOW_SEG_HDR_GTPU_IP |
+				  ICE_FLOW_SEG_HDR_IPV6 |
+				  ICE_FLOW_SEG_HDR_IPV_OTHER);
 		break;
 	case ICE_FLTR_PTYPE_NON_IP_L2:
 		ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_ETH_NON_IP); @@ -2007,13 +1988,18 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
 		}
 	}
 
-	if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU ||
-	    tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU_EH) {
-		if (flow_type == ICE_FLTR_PTYPE_NONF_IPV4_UDP)
-			flow_type = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER;
-		else
-			flow_type = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER;
-	}
+	if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU &&
+		flow_type == ICE_FLTR_PTYPE_NONF_IPV4_UDP)
+		flow_type = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER;
+	else if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU_EH &&
+		flow_type == ICE_FLTR_PTYPE_NONF_IPV4_UDP)
+		flow_type = ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_IPV4_OTHER;
+	else if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU &&
+		flow_type == ICE_FLTR_PTYPE_NONF_IPV6_UDP)
+		flow_type = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER;
+	else if (tunnel_type == ICE_FDIR_TUNNEL_TYPE_GTPU_EH &&
+		flow_type == ICE_FLTR_PTYPE_NONF_IPV6_UDP)
+		flow_type = ICE_FLTR_PTYPE_NONF_IPV6_GTPU_EH_IPV6_OTHER;
 
 	filter->tunnel_type = tunnel_type;
 	filter->input.flow_type = flow_type;
--
2.19.1


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

end of thread, other threads:[~2020-08-31  8:32 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-30  8:30 [dpdk-dev] [PATCH] net/ice: fix FDIR GTPU rule create fail Wei Zhao
2020-07-30  9:26 ` Huang, ZhiminX
2020-07-30  9:28 ` [dpdk-dev] [PATCH v2] " Wei Zhao
2020-07-30 10:11   ` Zhao1, Wei
2020-07-31  1:24   ` Huang, ZhiminX
2020-08-28  1:11   ` [dpdk-dev] [PATCH v3] " Wei Zhao
2020-08-31  6:58     ` [dpdk-dev] [PATCH v4] " Wei Zhao
2020-08-31  7:36       ` Zhang, Qi Z
2020-08-31  8:32       ` Huang, ZhiminX

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).