DPDK patches and discussions
 help / color / Atom feed
* [dpdk-dev] [PATCH v1] net/iavf: support gtpu outer and inner co-exist
@ 2020-09-09  8:20 Jeff Guo
  2020-09-16  4:18 ` [dpdk-dev] [PATCH v2] " Jeff Guo
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Jeff Guo @ 2020-09-09  8:20 UTC (permalink / raw)
  To: jingjing.wu, qi.z.zhang, beilei.xing; +Cc: dev, jia.guo

Although currently only the gtpu inner hash be enabled while not the
gtpu outer hash, but the outer protocol still needed to co-exist with
inner protocol when configure the gtpu inner hash rule, that would
allow the gtpu innner hash support for the different outer protocols.

Signed-off-by: Jeff Guo <jia.guo@intel.com>
---
 drivers/net/iavf/iavf_hash.c | 183 +++++++++++++++++++++++++++--------
 1 file changed, 143 insertions(+), 40 deletions(-)

diff --git a/drivers/net/iavf/iavf_hash.c b/drivers/net/iavf/iavf_hash.c
index ff77d7135..ba0411dff 100644
--- a/drivers/net/iavf/iavf_hash.c
+++ b/drivers/net/iavf/iavf_hash.c
@@ -134,6 +134,7 @@ iavf_hash_parse_pattern_action(struct iavf_adapter *ad,
 
 #define TUNNEL_LEVEL_OUTER		0
 #define TUNNEL_LEVEL_INNER		1
+#define TUNNEL_LEVEL_OUTER_AND_INNER	2
 
 /* proto_hdrs template */
 struct virtchnl_proto_hdrs outer_ipv4_tmplt = {
@@ -256,6 +257,54 @@ struct virtchnl_proto_hdrs ipv6_pfcp_tmplt = {
 	TUNNEL_LEVEL_OUTER, 2, {proto_hdr_ipv6, proto_hdr_pfcp}
 };
 
+struct virtchnl_proto_hdrs outer_ipv4_udp_inner_ipv4_tmplt = {
+	TUNNEL_LEVEL_OUTER_AND_INNER, 3, {proto_hdr_ipv4, proto_hdr_udp, proto_hdr_ipv4}
+};
+
+struct virtchnl_proto_hdrs outer_ipv4_udp_inner_ipv4_udp_tmplt = {
+	TUNNEL_LEVEL_OUTER_AND_INNER, 4, {proto_hdr_ipv4, proto_hdr_udp, proto_hdr_ipv4, proto_hdr_udp}
+};
+
+struct virtchnl_proto_hdrs outer_ipv4_udp_inner_ipv4_tcp_tmplt = {
+	TUNNEL_LEVEL_OUTER_AND_INNER, 4, {proto_hdr_ipv4, proto_hdr_udp, proto_hdr_ipv4, proto_hdr_tcp}
+};
+
+struct virtchnl_proto_hdrs outer_ipv4_udp_inner_ipv6_tmplt = {
+	TUNNEL_LEVEL_OUTER_AND_INNER, 3, {proto_hdr_ipv4, proto_hdr_udp, proto_hdr_ipv6}
+};
+
+struct virtchnl_proto_hdrs outer_ipv4_udp_inner_ipv6_udp_tmplt = {
+	TUNNEL_LEVEL_OUTER_AND_INNER, 4, {proto_hdr_ipv4, proto_hdr_udp, proto_hdr_ipv6, proto_hdr_udp}
+};
+
+struct virtchnl_proto_hdrs outer_ipv4_udp_inner_ipv6_tcp_tmplt = {
+	TUNNEL_LEVEL_OUTER_AND_INNER, 4, {proto_hdr_ipv4, proto_hdr_udp, proto_hdr_ipv6, proto_hdr_tcp}
+};
+
+struct virtchnl_proto_hdrs outer_ipv6_udp_inner_ipv4_tmplt = {
+	TUNNEL_LEVEL_OUTER_AND_INNER, 3, {proto_hdr_ipv6, proto_hdr_udp, proto_hdr_ipv4}
+};
+
+struct virtchnl_proto_hdrs outer_ipv6_udp_inner_ipv4_udp_tmplt = {
+	TUNNEL_LEVEL_OUTER_AND_INNER, 4, {proto_hdr_ipv6, proto_hdr_udp, proto_hdr_ipv4, proto_hdr_udp}
+};
+
+struct virtchnl_proto_hdrs outer_ipv6_udp_inner_ipv4_tcp_tmplt = {
+	TUNNEL_LEVEL_OUTER_AND_INNER, 4, {proto_hdr_ipv6, proto_hdr_udp, proto_hdr_ipv4, proto_hdr_tcp}
+};
+
+struct virtchnl_proto_hdrs outer_ipv6_udp_inner_ipv6_tmplt = {
+	TUNNEL_LEVEL_OUTER_AND_INNER, 3, {proto_hdr_ipv6, proto_hdr_udp, proto_hdr_ipv6}
+};
+
+struct virtchnl_proto_hdrs outer_ipv6_udp_inner_ipv6_udp_tmplt = {
+	TUNNEL_LEVEL_OUTER_AND_INNER, 4, {proto_hdr_ipv6, proto_hdr_udp, proto_hdr_ipv6, proto_hdr_udp}
+};
+
+struct virtchnl_proto_hdrs outer_ipv6_udp_inner_ipv6_tcp_tmplt = {
+	TUNNEL_LEVEL_OUTER_AND_INNER, 4, {proto_hdr_ipv6, proto_hdr_udp, proto_hdr_ipv6, proto_hdr_tcp}
+};
+
 /* rss type super set */
 
 /* IPv4 outer */
@@ -308,20 +357,50 @@ struct virtchnl_proto_hdrs ipv6_pfcp_tmplt = {
 					 ETH_RSS_NONFRAG_IPV6_TCP)
 #define IAVF_RSS_TYPE_INNER_IPV6_SCTP	(ETH_RSS_IPV6 | \
 					 ETH_RSS_NONFRAG_IPV6_SCTP)
-/* GTPU IPv4 */
-#define IAVF_RSS_TYPE_GTPU_IPV4		(IAVF_RSS_TYPE_INNER_IPV4 | \
-					 ETH_RSS_GTPU)
-#define IAVF_RSS_TYPE_GTPU_IPV4_UDP	(IAVF_RSS_TYPE_INNER_IPV4_UDP | \
-					 ETH_RSS_GTPU)
-#define IAVF_RSS_TYPE_GTPU_IPV4_TCP	(IAVF_RSS_TYPE_INNER_IPV4_TCP | \
+/* GTPU outer IPv4 inner IPv4 */
+#define IAVF_RSS_TYPE_IPV4_GTPU_IPV4	(IAVF_RSS_TYPE_OUTER_IPV4 | \
+					 IAVF_RSS_TYPE_INNER_IPV4 | \
 					 ETH_RSS_GTPU)
-/* GTPU IPv6 */
-#define IAVF_RSS_TYPE_GTPU_IPV6		(IAVF_RSS_TYPE_INNER_IPV6 | \
+#define IAVF_RSS_TYPE_IPV4_GTPU_IPV4_UDP (IAVF_RSS_TYPE_OUTER_IPV4 | \
+					  IAVF_RSS_TYPE_INNER_IPV4_UDP | \
+					  ETH_RSS_GTPU)
+#define IAVF_RSS_TYPE_IPV4_GTPU_IPV4_TCP (IAVF_RSS_TYPE_OUTER_IPV4 | \
+					  IAVF_RSS_TYPE_INNER_IPV4_TCP | \
+					  ETH_RSS_GTPU)
+
+/* GTPU outer IPv4 inner IPv6 */
+#define IAVF_RSS_TYPE_IPV4_GTPU_IPV6	(IAVF_RSS_TYPE_OUTER_IPV4 | \
+					 IAVF_RSS_TYPE_INNER_IPV6 | \
 					 ETH_RSS_GTPU)
-#define IAVF_RSS_TYPE_GTPU_IPV6_UDP	(IAVF_RSS_TYPE_INNER_IPV6_UDP | \
+#define IAVF_RSS_TYPE_IPV4_GTPU_IPV6_UDP (IAVF_RSS_TYPE_OUTER_IPV4 | \
+					  IAVF_RSS_TYPE_INNER_IPV6_UDP | \
+					  ETH_RSS_GTPU)
+#define IAVF_RSS_TYPE_IPV4_GTPU_IPV6_TCP (IAVF_RSS_TYPE_OUTER_IPV4 | \
+					  IAVF_RSS_TYPE_INNER_IPV6_TCP | \
+					  ETH_RSS_GTPU)
+
+/* GTPU outer IPv6 inner IPv4 */
+#define IAVF_RSS_TYPE_IPV6_GTPU_IPV4	(IAVF_RSS_TYPE_OUTER_IPV6 | \
+					 IAVF_RSS_TYPE_INNER_IPV4 | \
 					 ETH_RSS_GTPU)
-#define IAVF_RSS_TYPE_GTPU_IPV6_TCP	(IAVF_RSS_TYPE_INNER_IPV6_TCP | \
+#define IAVF_RSS_TYPE_IPV6_GTPU_IPV4_UDP (IAVF_RSS_TYPE_OUTER_IPV6 | \
+					  IAVF_RSS_TYPE_INNER_IPV4_UDP | \
+					  ETH_RSS_GTPU)
+#define IAVF_RSS_TYPE_IPV6_GTPU_IPV4_TCP (IAVF_RSS_TYPE_OUTER_IPV6 | \
+					  IAVF_RSS_TYPE_INNER_IPV4_TCP | \
+					  ETH_RSS_GTPU)
+
+/* GTPU outer IPv6 inner IPv6 */
+#define IAVF_RSS_TYPE_IPV6_GTPU_IPV6	(IAVF_RSS_TYPE_OUTER_IPV6 | \
+					 IAVF_RSS_TYPE_INNER_IPV6 | \
 					 ETH_RSS_GTPU)
+#define IAVF_RSS_TYPE_IPV6_GTPU_IPV6_UDP (IAVF_RSS_TYPE_OUTER_IPV6 | \
+					  IAVF_RSS_TYPE_INNER_IPV6_UDP | \
+					  ETH_RSS_GTPU)
+#define IAVF_RSS_TYPE_IPV6_GTPU_IPV6_TCP (IAVF_RSS_TYPE_OUTER_IPV6 | \
+					  IAVF_RSS_TYPE_INNER_IPV6_TCP | \
+					  ETH_RSS_GTPU)
+
 /* ESP, AH, L2TPV3 and PFCP */
 #define IAVF_RSS_TYPE_IPV4_ESP		(ETH_RSS_ESP | ETH_RSS_IPV4)
 #define IAVF_RSS_TYPE_IPV4_AH		(ETH_RSS_AH | ETH_RSS_IPV4)
@@ -348,18 +427,18 @@ static struct iavf_pattern_match_item iavf_hash_pattern_list[] = {
 	{iavf_pattern_eth_vlan_ipv4_udp,		IAVF_RSS_TYPE_VLAN_IPV4_UDP,	&outer_ipv4_udp_tmplt},
 	{iavf_pattern_eth_vlan_ipv4_tcp,		IAVF_RSS_TYPE_VLAN_IPV4_TCP,	&outer_ipv4_tcp_tmplt},
 	{iavf_pattern_eth_vlan_ipv4_sctp,		IAVF_RSS_TYPE_VLAN_IPV4_SCTP,	&outer_ipv4_sctp_tmplt},
-	{iavf_pattern_eth_ipv4_gtpu_ipv4,		IAVF_RSS_TYPE_GTPU_IPV4,	&inner_ipv4_tmplt},
-	{iavf_pattern_eth_ipv4_gtpu_ipv4_udp,		IAVF_RSS_TYPE_GTPU_IPV4_UDP,	&inner_ipv4_udp_tmplt},
-	{iavf_pattern_eth_ipv4_gtpu_ipv4_tcp,		IAVF_RSS_TYPE_GTPU_IPV4_TCP,	&inner_ipv4_tcp_tmplt},
-	{iavf_pattern_eth_ipv6_gtpu_ipv4,		IAVF_RSS_TYPE_GTPU_IPV4,	&inner_ipv4_tmplt},
-	{iavf_pattern_eth_ipv6_gtpu_ipv4_udp,		IAVF_RSS_TYPE_GTPU_IPV4_UDP,	&inner_ipv4_udp_tmplt},
-	{iavf_pattern_eth_ipv6_gtpu_ipv4_tcp,		IAVF_RSS_TYPE_GTPU_IPV4_TCP,	&inner_ipv4_tcp_tmplt},
-	{iavf_pattern_eth_ipv4_gtpu_eh_ipv4,		IAVF_RSS_TYPE_GTPU_IPV4,	&inner_ipv4_tmplt},
-	{iavf_pattern_eth_ipv4_gtpu_eh_ipv4_udp,	IAVF_RSS_TYPE_GTPU_IPV4_UDP,	&inner_ipv4_udp_tmplt},
-	{iavf_pattern_eth_ipv4_gtpu_eh_ipv4_tcp,	IAVF_RSS_TYPE_GTPU_IPV4_TCP,	&inner_ipv4_tcp_tmplt},
-	{iavf_pattern_eth_ipv6_gtpu_eh_ipv4,		IAVF_RSS_TYPE_GTPU_IPV4,	&inner_ipv4_tmplt},
-	{iavf_pattern_eth_ipv6_gtpu_eh_ipv4_udp,	IAVF_RSS_TYPE_GTPU_IPV4_UDP,	&inner_ipv4_udp_tmplt},
-	{iavf_pattern_eth_ipv6_gtpu_eh_ipv4_tcp,	IAVF_RSS_TYPE_GTPU_IPV4_TCP,	&inner_ipv4_tcp_tmplt},
+	{iavf_pattern_eth_ipv4_gtpu_ipv4,		IAVF_RSS_TYPE_IPV4_GTPU_IPV4,	&outer_ipv4_udp_inner_ipv4_tmplt},
+	{iavf_pattern_eth_ipv4_gtpu_ipv4_udp,		IAVF_RSS_TYPE_IPV4_GTPU_IPV4_UDP,	&outer_ipv4_udp_inner_ipv4_udp_tmplt},
+	{iavf_pattern_eth_ipv4_gtpu_ipv4_tcp,		IAVF_RSS_TYPE_IPV4_GTPU_IPV4_TCP,	&outer_ipv4_udp_inner_ipv4_tcp_tmplt},
+	{iavf_pattern_eth_ipv6_gtpu_ipv4,		IAVF_RSS_TYPE_IPV6_GTPU_IPV4,	&outer_ipv6_udp_inner_ipv4_tmplt},
+	{iavf_pattern_eth_ipv6_gtpu_ipv4_udp,		IAVF_RSS_TYPE_IPV6_GTPU_IPV4_UDP,	&inner_ipv4_udp_tmplt},
+	{iavf_pattern_eth_ipv6_gtpu_ipv4_tcp,		IAVF_RSS_TYPE_IPV6_GTPU_IPV4_TCP,	&inner_ipv4_tcp_tmplt},
+	{iavf_pattern_eth_ipv4_gtpu_eh_ipv4,		IAVF_RSS_TYPE_IPV4_GTPU_IPV4,	&outer_ipv4_udp_inner_ipv4_tmplt},
+	{iavf_pattern_eth_ipv4_gtpu_eh_ipv4_udp,	IAVF_RSS_TYPE_IPV4_GTPU_IPV4_UDP,	&outer_ipv4_udp_inner_ipv4_udp_tmplt},
+	{iavf_pattern_eth_ipv4_gtpu_eh_ipv4_tcp,	IAVF_RSS_TYPE_IPV4_GTPU_IPV4_TCP,	&outer_ipv4_udp_inner_ipv4_tcp_tmplt},
+	{iavf_pattern_eth_ipv6_gtpu_eh_ipv4,		IAVF_RSS_TYPE_IPV6_GTPU_IPV4,	&inner_ipv4_tmplt},
+	{iavf_pattern_eth_ipv6_gtpu_eh_ipv4_udp,	IAVF_RSS_TYPE_IPV6_GTPU_IPV4_UDP,	&inner_ipv4_udp_tmplt},
+	{iavf_pattern_eth_ipv6_gtpu_eh_ipv4_tcp,	IAVF_RSS_TYPE_IPV6_GTPU_IPV4_TCP,	&inner_ipv4_tcp_tmplt},
 	{iavf_pattern_eth_ipv4_esp,			IAVF_RSS_TYPE_IPV4_ESP,		&ipv4_esp_tmplt},
 	{iavf_pattern_eth_ipv4_udp_esp,			IAVF_RSS_TYPE_IPV4_ESP,		&ipv4_udp_esp_tmplt},
 	{iavf_pattern_eth_ipv4_ah,			IAVF_RSS_TYPE_IPV4_AH,		&ipv4_ah_tmplt},
@@ -374,18 +453,18 @@ static struct iavf_pattern_match_item iavf_hash_pattern_list[] = {
 	{iavf_pattern_eth_vlan_ipv6_udp,		IAVF_RSS_TYPE_VLAN_IPV6_UDP,	&outer_ipv6_udp_tmplt},
 	{iavf_pattern_eth_vlan_ipv6_tcp,		IAVF_RSS_TYPE_VLAN_IPV6_TCP,	&outer_ipv6_tcp_tmplt},
 	{iavf_pattern_eth_vlan_ipv6_sctp,		IAVF_RSS_TYPE_VLAN_IPV6_SCTP,	&outer_ipv6_sctp_tmplt},
-	{iavf_pattern_eth_ipv4_gtpu_ipv6,		IAVF_RSS_TYPE_GTPU_IPV6,	&inner_ipv6_tmplt},
-	{iavf_pattern_eth_ipv4_gtpu_ipv6_udp,		IAVF_RSS_TYPE_GTPU_IPV6_UDP,	&inner_ipv6_udp_tmplt},
-	{iavf_pattern_eth_ipv4_gtpu_ipv6_tcp,		IAVF_RSS_TYPE_GTPU_IPV6_TCP,	&inner_ipv6_tcp_tmplt},
-	{iavf_pattern_eth_ipv6_gtpu_ipv6,		IAVF_RSS_TYPE_GTPU_IPV6,	&inner_ipv6_tmplt},
-	{iavf_pattern_eth_ipv6_gtpu_ipv6_udp,		IAVF_RSS_TYPE_GTPU_IPV6_UDP,	&inner_ipv6_udp_tmplt},
-	{iavf_pattern_eth_ipv6_gtpu_ipv6_tcp,		IAVF_RSS_TYPE_GTPU_IPV6_TCP,	&inner_ipv6_tcp_tmplt},
-	{iavf_pattern_eth_ipv4_gtpu_eh_ipv6,		IAVF_RSS_TYPE_GTPU_IPV6,	&inner_ipv6_tmplt},
-	{iavf_pattern_eth_ipv4_gtpu_eh_ipv6_udp,	IAVF_RSS_TYPE_GTPU_IPV6_UDP,	&inner_ipv6_udp_tmplt},
-	{iavf_pattern_eth_ipv4_gtpu_eh_ipv6_tcp,	IAVF_RSS_TYPE_GTPU_IPV6_TCP,	&inner_ipv6_tcp_tmplt},
-	{iavf_pattern_eth_ipv6_gtpu_eh_ipv6,		IAVF_RSS_TYPE_GTPU_IPV6,	&inner_ipv6_tmplt},
-	{iavf_pattern_eth_ipv6_gtpu_eh_ipv6_udp,	IAVF_RSS_TYPE_GTPU_IPV6_UDP,	&inner_ipv6_udp_tmplt},
-	{iavf_pattern_eth_ipv6_gtpu_eh_ipv6_tcp,	IAVF_RSS_TYPE_GTPU_IPV6_TCP,	&inner_ipv6_tcp_tmplt},
+	{iavf_pattern_eth_ipv4_gtpu_ipv6,		IAVF_RSS_TYPE_IPV4_GTPU_IPV6,	&outer_ipv4_udp_inner_ipv6_tmplt},
+	{iavf_pattern_eth_ipv4_gtpu_ipv6_udp,		IAVF_RSS_TYPE_IPV4_GTPU_IPV6_UDP,	&outer_ipv4_udp_inner_ipv6_udp_tmplt},
+	{iavf_pattern_eth_ipv4_gtpu_ipv6_tcp,		IAVF_RSS_TYPE_IPV4_GTPU_IPV6_TCP,	&outer_ipv4_udp_inner_ipv6_tcp_tmplt},
+	{iavf_pattern_eth_ipv6_gtpu_ipv6,		IAVF_RSS_TYPE_IPV6_GTPU_IPV6,	&inner_ipv6_tmplt},
+	{iavf_pattern_eth_ipv6_gtpu_ipv6_udp,		IAVF_RSS_TYPE_IPV6_GTPU_IPV6_UDP,	&inner_ipv6_udp_tmplt},
+	{iavf_pattern_eth_ipv6_gtpu_ipv6_tcp,		IAVF_RSS_TYPE_IPV6_GTPU_IPV6_TCP,	&inner_ipv6_tcp_tmplt},
+	{iavf_pattern_eth_ipv4_gtpu_eh_ipv6,		IAVF_RSS_TYPE_IPV4_GTPU_IPV6,	&outer_ipv4_udp_inner_ipv6_tmplt},
+	{iavf_pattern_eth_ipv4_gtpu_eh_ipv6_udp,	IAVF_RSS_TYPE_IPV4_GTPU_IPV6_UDP,	&outer_ipv4_udp_inner_ipv6_udp_tmplt},
+	{iavf_pattern_eth_ipv4_gtpu_eh_ipv6_tcp,	IAVF_RSS_TYPE_IPV4_GTPU_IPV6_TCP,	&outer_ipv4_udp_inner_ipv6_tcp_tmplt},
+	{iavf_pattern_eth_ipv6_gtpu_eh_ipv6,		IAVF_RSS_TYPE_IPV6_GTPU_IPV6,	&inner_ipv6_tmplt},
+	{iavf_pattern_eth_ipv6_gtpu_eh_ipv6_udp,	IAVF_RSS_TYPE_IPV6_GTPU_IPV6_UDP,	&inner_ipv6_udp_tmplt},
+	{iavf_pattern_eth_ipv6_gtpu_eh_ipv6_tcp,	IAVF_RSS_TYPE_IPV6_GTPU_IPV6_TCP,	&inner_ipv6_tcp_tmplt},
 	{iavf_pattern_eth_ipv6_esp,			IAVF_RSS_TYPE_IPV6_ESP,		&ipv6_esp_tmplt},
 	{iavf_pattern_eth_ipv6_udp_esp,			IAVF_RSS_TYPE_IPV6_ESP,		&ipv6_udp_esp_tmplt},
 	{iavf_pattern_eth_ipv6_ah,			IAVF_RSS_TYPE_IPV6_AH,		&ipv6_ah_tmplt},
@@ -668,18 +747,42 @@ iavf_refine_proto_hdrs_l234(struct virtchnl_proto_hdrs *proto_hdrs,
 
 /* refine proto hdrs base on gtpu rss type */
 static void
-iavf_refine_proto_hdrs_gtpu(struct virtchnl_proto_hdrs *proto_hdrs,
-			    uint64_t rss_type)
+iavf_refine_proto_hdrs_gtpu(struct virtchnl_proto_hdrs *proto_hdrs)
 {
 	struct virtchnl_proto_hdr *hdr;
+	bool is_inner_ipv4 = false;
+	bool is_inner_ipv6 = false;
+	bool is_inner_udp = false;
+	bool is_inner_tcp = false;
 	int i;
 
-	if (!(rss_type & ETH_RSS_GTPU))
-		return;
-
 	for (i = 0; i < proto_hdrs->count; i++) {
 		hdr = &proto_hdrs->proto_hdr[i];
 		switch (hdr->type) {
+		case VIRTCHNL_PROTO_HDR_IPV4:
+			if (!is_inner_ipv4) {
+				hdr->field_selector = 0;
+				is_inner_ipv4 = true;
+			}
+			break;
+		case VIRTCHNL_PROTO_HDR_IPV6:
+			if (!is_inner_ipv6) {
+				hdr->field_selector = 0;
+				is_inner_ipv6 = true;
+			}
+			break;
+		case VIRTCHNL_PROTO_HDR_UDP:
+			if (!is_inner_udp) {
+				hdr->field_selector = 0;
+				is_inner_udp = true;
+			}
+			break;
+		case VIRTCHNL_PROTO_HDR_TCP:
+			if (!is_inner_tcp) {
+				hdr->field_selector = 0;
+				is_inner_tcp = true;
+			}
+			break;
 		case VIRTCHNL_PROTO_HDR_GTPU_IP:
 			VIRTCHNL_ADD_PROTO_HDR_FIELD(hdr,
 				VIRTCHNL_PROTO_HDR_GTPU_IP_TEID);
@@ -730,7 +833,7 @@ static void iavf_refine_proto_hdrs(struct virtchnl_proto_hdrs *proto_hdrs,
 {
 	iavf_refine_proto_hdrs_l234(proto_hdrs, rss_type);
 	iavf_refine_proto_hdrs_by_pattern(proto_hdrs, phint);
-	iavf_refine_proto_hdrs_gtpu(proto_hdrs, rss_type);
+	iavf_refine_proto_hdrs_gtpu(proto_hdrs);
 }
 
 static uint64_t invalid_rss_comb[] = {
-- 
2.20.1


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

* [dpdk-dev] [PATCH v2] net/iavf: support gtpu outer and inner co-exist
  2020-09-09  8:20 [dpdk-dev] [PATCH v1] net/iavf: support gtpu outer and inner co-exist Jeff Guo
@ 2020-09-16  4:18 ` " Jeff Guo
  2020-09-16  4:29 ` [dpdk-dev] [PATCH v3] " Jeff Guo
  2020-09-18  5:46 ` [dpdk-dev] [PATCH v4] " Jeff Guo
  2 siblings, 0 replies; 5+ messages in thread
From: Jeff Guo @ 2020-09-16  4:18 UTC (permalink / raw)
  To: jingjing.wu, qi.z.zhang, beilei.xing; +Cc: dev, jia.guo

Although currently only the gtpu inner hash be enabled while not the
gtpu outer hash, but the outer protocol still needed to co-exist with
inner protocol when configure the gtpu inner hash rule, that would
allow the gtpu innner hash support for the different outer protocols.

Signed-off-by: Jeff Guo <jia.guo@intel.com>
---
v2->v1:
use phint to replace of template for outer_inner
---
 drivers/net/iavf/iavf_hash.c | 46 +++++++++++++++++++++++++++++++++---
 1 file changed, 43 insertions(+), 3 deletions(-)

diff --git a/drivers/net/iavf/iavf_hash.c b/drivers/net/iavf/iavf_hash.c
index 3152218dc..0f51e100e 100644
--- a/drivers/net/iavf/iavf_hash.c
+++ b/drivers/net/iavf/iavf_hash.c
@@ -29,11 +29,21 @@
 #define	IAVF_PHINT_GTPU_EH_DWN			BIT_ULL(2)
 #define	IAVF_PHINT_GTPU_EH_UP			BIT_ULL(3)
 
+#define IAVF_PHINT_OUTER_IPV4_INNER_IPV4	BIT_ULL(4)
+#define IAVF_PHINT_OUTER_IPV4_INNER_IPV6	BIT_ULL(5)
+#define IAVF_PHINT_OUTER_IPV6_INNER_IPV4	BIT_ULL(6)
+#define IAVF_PHINT_OUTER_IPV6_INNER_IPV6	BIT_ULL(7)
+
 #define IAVF_PHINT_GTPU_MSK	(IAVF_PHINT_GTPU	| \
 				 IAVF_PHINT_GTPU_EH	| \
 				 IAVF_PHINT_GTPU_EH_DWN	| \
 				 IAVF_PHINT_GTPU_EH_UP)
 
+#define IAVF_PHINT_LAYERS_MSK	(IAVF_PHINT_OUTER_IPV4_INNER_IPV4	| \
+				 IAVF_PHINT_OUTER_IPV4_INNER_IPV6	| \
+				 IAVF_PHINT_OUTER_IPV6_INNER_IPV4	| \
+				 IAVF_PHINT_OUTER_IPV6_INNER_IPV6)
+
 #define IAVF_GTPU_EH_DWNLINK	0
 #define IAVF_GTPU_EH_UPLINK	1
 
@@ -505,6 +515,8 @@ iavf_hash_parse_pattern(struct iavf_pattern_match_item *pattern_match_item,
 {
 	const struct rte_flow_item *item = pattern;
 	const struct rte_flow_item_gtp_psc *psc;
+	bool outer_ipv4 = false;
+	bool outer_ipv6 = false;
 
 	for (item = pattern; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {
 		if (item->last) {
@@ -515,6 +527,22 @@ iavf_hash_parse_pattern(struct iavf_pattern_match_item *pattern_match_item,
 		}
 
 		switch (item->type) {
+		case RTE_FLOW_ITEM_TYPE_IPV4:
+			if (outer_ipv4)
+				*phint |= IAVF_PHINT_OUTER_IPV4_INNER_IPV4;
+			else if (outer_ipv6)
+				*phint |= IAVF_PHINT_OUTER_IPV6_INNER_IPV4;
+			else
+				outer_ipv4 = true;
+			break;
+		case RTE_FLOW_ITEM_TYPE_IPV6:
+			if (outer_ipv4)
+				*phint |= IAVF_PHINT_OUTER_IPV4_INNER_IPV6;
+			else if (outer_ipv6)
+				*phint |= IAVF_PHINT_OUTER_IPV6_INNER_IPV6;
+			else
+				outer_ipv6 = true;
+			break;
 		case RTE_FLOW_ITEM_TYPE_GTPU:
 			*phint |= IAVF_PHINT_GTPU;
 			break;
@@ -533,9 +561,6 @@ iavf_hash_parse_pattern(struct iavf_pattern_match_item *pattern_match_item,
 		}
 	}
 
-	/* update and restore pattern hint */
-	*phint |= *(uint64_t *)(pattern_match_item->meta);
-
 	return 0;
 }
 
@@ -712,6 +737,7 @@ static void
 iavf_refine_proto_hdrs_by_pattern(struct virtchnl_proto_hdrs *proto_hdrs,
 				  uint64_t phint)
 {
+	struct virtchnl_proto_hdr *hdr_outer;
 	struct virtchnl_proto_hdr *hdr1;
 	struct virtchnl_proto_hdr *hdr2;
 	int i;
@@ -720,6 +746,20 @@ iavf_refine_proto_hdrs_by_pattern(struct virtchnl_proto_hdrs *proto_hdrs,
 		return;
 
 	if (proto_hdrs->tunnel_level == TUNNEL_LEVEL_INNER) {
+		if (phint & IAVF_PHINT_LAYERS_MSK) {
+			/* adding gtpu outer header */
+			hdr_outer = &proto_hdrs->proto_hdr[proto_hdrs->count];
+			hdr_outer->field_selector = 0;
+			proto_hdrs->count++;
+
+			if (phint & (IAVF_PHINT_OUTER_IPV4_INNER_IPV4 |
+				     IAVF_PHINT_OUTER_IPV4_INNER_IPV6))
+				VIRTCHNL_SET_PROTO_HDR_TYPE(hdr_outer, IPV4);
+			else if (phint & (IAVF_PHINT_OUTER_IPV6_INNER_IPV4 |
+					  IAVF_PHINT_OUTER_IPV6_INNER_IPV6))
+				VIRTCHNL_SET_PROTO_HDR_TYPE(hdr_outer, IPV6);
+		}
+
 		/* shift headers 1 layer */
 		for (i = proto_hdrs->count; i > 0; i--) {
 			hdr1 = &proto_hdrs->proto_hdr[i];
-- 
2.20.1


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

* [dpdk-dev] [PATCH v3] net/iavf: support gtpu outer and inner co-exist
  2020-09-09  8:20 [dpdk-dev] [PATCH v1] net/iavf: support gtpu outer and inner co-exist Jeff Guo
  2020-09-16  4:18 ` [dpdk-dev] [PATCH v2] " Jeff Guo
@ 2020-09-16  4:29 ` " Jeff Guo
  2020-09-18  5:46 ` [dpdk-dev] [PATCH v4] " Jeff Guo
  2 siblings, 0 replies; 5+ messages in thread
From: Jeff Guo @ 2020-09-16  4:29 UTC (permalink / raw)
  To: jingjing.wu, qi.z.zhang, beilei.xing; +Cc: dev, jia.guo

Although currently only the gtpu inner hash be enabled while not the
gtpu outer hash, but the outer protocol still needed to co-exist with
inner protocol when configure the gtpu inner hash rule, that would
allow the gtpu innner hash support for the different outer protocols.

Signed-off-by: Jeff Guo <jia.guo@intel.com>
---
v3->v2:
delete unused param
---
 drivers/net/iavf/iavf_hash.c | 52 +++++++++++++++++++++++++++++++-----
 1 file changed, 45 insertions(+), 7 deletions(-)

diff --git a/drivers/net/iavf/iavf_hash.c b/drivers/net/iavf/iavf_hash.c
index 3152218dc..7ffaf42d1 100644
--- a/drivers/net/iavf/iavf_hash.c
+++ b/drivers/net/iavf/iavf_hash.c
@@ -29,11 +29,21 @@
 #define	IAVF_PHINT_GTPU_EH_DWN			BIT_ULL(2)
 #define	IAVF_PHINT_GTPU_EH_UP			BIT_ULL(3)
 
+#define IAVF_PHINT_OUTER_IPV4_INNER_IPV4	BIT_ULL(4)
+#define IAVF_PHINT_OUTER_IPV4_INNER_IPV6	BIT_ULL(5)
+#define IAVF_PHINT_OUTER_IPV6_INNER_IPV4	BIT_ULL(6)
+#define IAVF_PHINT_OUTER_IPV6_INNER_IPV6	BIT_ULL(7)
+
 #define IAVF_PHINT_GTPU_MSK	(IAVF_PHINT_GTPU	| \
 				 IAVF_PHINT_GTPU_EH	| \
 				 IAVF_PHINT_GTPU_EH_DWN	| \
 				 IAVF_PHINT_GTPU_EH_UP)
 
+#define IAVF_PHINT_LAYERS_MSK	(IAVF_PHINT_OUTER_IPV4_INNER_IPV4	| \
+				 IAVF_PHINT_OUTER_IPV4_INNER_IPV6	| \
+				 IAVF_PHINT_OUTER_IPV6_INNER_IPV4	| \
+				 IAVF_PHINT_OUTER_IPV6_INNER_IPV6)
+
 #define IAVF_GTPU_EH_DWNLINK	0
 #define IAVF_GTPU_EH_UPLINK	1
 
@@ -499,12 +509,13 @@ iavf_hash_init(struct iavf_adapter *ad)
 }
 
 static int
-iavf_hash_parse_pattern(struct iavf_pattern_match_item *pattern_match_item,
-			const struct rte_flow_item pattern[], uint64_t *phint,
+iavf_hash_parse_pattern(const struct rte_flow_item pattern[], uint64_t *phint,
 			struct rte_flow_error *error)
 {
 	const struct rte_flow_item *item = pattern;
 	const struct rte_flow_item_gtp_psc *psc;
+	bool outer_ipv4 = false;
+	bool outer_ipv6 = false;
 
 	for (item = pattern; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {
 		if (item->last) {
@@ -515,6 +526,22 @@ iavf_hash_parse_pattern(struct iavf_pattern_match_item *pattern_match_item,
 		}
 
 		switch (item->type) {
+		case RTE_FLOW_ITEM_TYPE_IPV4:
+			if (outer_ipv4)
+				*phint |= IAVF_PHINT_OUTER_IPV4_INNER_IPV4;
+			else if (outer_ipv6)
+				*phint |= IAVF_PHINT_OUTER_IPV6_INNER_IPV4;
+			else
+				outer_ipv4 = true;
+			break;
+		case RTE_FLOW_ITEM_TYPE_IPV6:
+			if (outer_ipv4)
+				*phint |= IAVF_PHINT_OUTER_IPV4_INNER_IPV6;
+			else if (outer_ipv6)
+				*phint |= IAVF_PHINT_OUTER_IPV6_INNER_IPV6;
+			else
+				outer_ipv6 = true;
+			break;
 		case RTE_FLOW_ITEM_TYPE_GTPU:
 			*phint |= IAVF_PHINT_GTPU;
 			break;
@@ -533,9 +560,6 @@ iavf_hash_parse_pattern(struct iavf_pattern_match_item *pattern_match_item,
 		}
 	}
 
-	/* update and restore pattern hint */
-	*phint |= *(uint64_t *)(pattern_match_item->meta);
-
 	return 0;
 }
 
@@ -712,6 +736,7 @@ static void
 iavf_refine_proto_hdrs_by_pattern(struct virtchnl_proto_hdrs *proto_hdrs,
 				  uint64_t phint)
 {
+	struct virtchnl_proto_hdr *hdr_outer;
 	struct virtchnl_proto_hdr *hdr1;
 	struct virtchnl_proto_hdr *hdr2;
 	int i;
@@ -720,6 +745,20 @@ iavf_refine_proto_hdrs_by_pattern(struct virtchnl_proto_hdrs *proto_hdrs,
 		return;
 
 	if (proto_hdrs->tunnel_level == TUNNEL_LEVEL_INNER) {
+		if (phint & IAVF_PHINT_LAYERS_MSK) {
+			/* adding gtpu outer header */
+			hdr_outer = &proto_hdrs->proto_hdr[proto_hdrs->count];
+			hdr_outer->field_selector = 0;
+			proto_hdrs->count++;
+
+			if (phint & (IAVF_PHINT_OUTER_IPV4_INNER_IPV4 |
+				     IAVF_PHINT_OUTER_IPV4_INNER_IPV6))
+				VIRTCHNL_SET_PROTO_HDR_TYPE(hdr_outer, IPV4);
+			else if (phint & (IAVF_PHINT_OUTER_IPV6_INNER_IPV4 |
+					  IAVF_PHINT_OUTER_IPV6_INNER_IPV6))
+				VIRTCHNL_SET_PROTO_HDR_TYPE(hdr_outer, IPV6);
+		}
+
 		/* shift headers 1 layer */
 		for (i = proto_hdrs->count; i > 0; i--) {
 			hdr1 = &proto_hdrs->proto_hdr[i];
@@ -908,8 +947,7 @@ iavf_hash_parse_pattern_action(__rte_unused struct iavf_adapter *ad,
 		goto error;
 	}
 
-	ret = iavf_hash_parse_pattern(pattern_match_item, pattern, &phint,
-				      error);
+	ret = iavf_hash_parse_pattern(pattern, &phint, error);
 	if (ret)
 		goto error;
 
-- 
2.20.1


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

* [dpdk-dev] [PATCH v4] net/iavf: support gtpu outer and inner co-exist
  2020-09-09  8:20 [dpdk-dev] [PATCH v1] net/iavf: support gtpu outer and inner co-exist Jeff Guo
  2020-09-16  4:18 ` [dpdk-dev] [PATCH v2] " Jeff Guo
  2020-09-16  4:29 ` [dpdk-dev] [PATCH v3] " Jeff Guo
@ 2020-09-18  5:46 ` " Jeff Guo
  2020-09-22 13:06   ` Zhang, Qi Z
  2 siblings, 1 reply; 5+ messages in thread
From: Jeff Guo @ 2020-09-18  5:46 UTC (permalink / raw)
  To: jingjing.wu, qi.z.zhang, beilei.xing; +Cc: dev, jia.guo

Although currently only the gtpu inner hash be enabled while not the
gtpu outer hash, but the outer protocol still needed to co-exist with
inner protocol when configure the gtpu inner hash rule, that would
allow the gtpu innner hash support for the different outer protocols.

Signed-off-by: Jeff Guo <jia.guo@intel.com>
---
v4->v3:
refine the header set
---
 drivers/net/iavf/iavf_hash.c | 53 ++++++++++++++++++++++++++----------
 1 file changed, 39 insertions(+), 14 deletions(-)

diff --git a/drivers/net/iavf/iavf_hash.c b/drivers/net/iavf/iavf_hash.c
index 3152218dc..34c425cdb 100644
--- a/drivers/net/iavf/iavf_hash.c
+++ b/drivers/net/iavf/iavf_hash.c
@@ -28,12 +28,17 @@
 #define IAVF_PHINT_GTPU_EH			BIT_ULL(1)
 #define	IAVF_PHINT_GTPU_EH_DWN			BIT_ULL(2)
 #define	IAVF_PHINT_GTPU_EH_UP			BIT_ULL(3)
+#define IAVF_PHINT_OUTER_IPV4			BIT_ULL(4)
+#define IAVF_PHINT_OUTER_IPV6			BIT_ULL(5)
 
 #define IAVF_PHINT_GTPU_MSK	(IAVF_PHINT_GTPU	| \
 				 IAVF_PHINT_GTPU_EH	| \
 				 IAVF_PHINT_GTPU_EH_DWN	| \
 				 IAVF_PHINT_GTPU_EH_UP)
 
+#define IAVF_PHINT_LAYERS_MSK	(IAVF_PHINT_OUTER_IPV4	| \
+				 IAVF_PHINT_OUTER_IPV6)
+
 #define IAVF_GTPU_EH_DWNLINK	0
 #define IAVF_GTPU_EH_UPLINK	1
 
@@ -499,8 +504,7 @@ iavf_hash_init(struct iavf_adapter *ad)
 }
 
 static int
-iavf_hash_parse_pattern(struct iavf_pattern_match_item *pattern_match_item,
-			const struct rte_flow_item pattern[], uint64_t *phint,
+iavf_hash_parse_pattern(const struct rte_flow_item pattern[], uint64_t *phint,
 			struct rte_flow_error *error)
 {
 	const struct rte_flow_item *item = pattern;
@@ -515,6 +519,14 @@ iavf_hash_parse_pattern(struct iavf_pattern_match_item *pattern_match_item,
 		}
 
 		switch (item->type) {
+		case RTE_FLOW_ITEM_TYPE_IPV4:
+			if (!(*phint & IAVF_PHINT_GTPU_MSK))
+				*phint |= IAVF_PHINT_OUTER_IPV4;
+			break;
+		case RTE_FLOW_ITEM_TYPE_IPV6:
+			if (!(*phint & IAVF_PHINT_GTPU_MSK))
+				*phint |= IAVF_PHINT_OUTER_IPV6;
+			break;
 		case RTE_FLOW_ITEM_TYPE_GTPU:
 			*phint |= IAVF_PHINT_GTPU;
 			break;
@@ -533,9 +545,6 @@ iavf_hash_parse_pattern(struct iavf_pattern_match_item *pattern_match_item,
 		}
 	}
 
-	/* update and restore pattern hint */
-	*phint |= *(uint64_t *)(pattern_match_item->meta);
-
 	return 0;
 }
 
@@ -714,22 +723,39 @@ iavf_refine_proto_hdrs_by_pattern(struct virtchnl_proto_hdrs *proto_hdrs,
 {
 	struct virtchnl_proto_hdr *hdr1;
 	struct virtchnl_proto_hdr *hdr2;
-	int i;
+	int i, shift_count = 1;
 
 	if (!(phint & IAVF_PHINT_GTPU_MSK))
 		return;
 
+	if (phint & IAVF_PHINT_LAYERS_MSK)
+		shift_count++;
+
 	if (proto_hdrs->tunnel_level == TUNNEL_LEVEL_INNER) {
-		/* shift headers 1 layer */
-		for (i = proto_hdrs->count; i > 0; i--) {
+		/* shift headers layer */
+		for (i = proto_hdrs->count - 1 + shift_count;
+		     i > shift_count - 1; i--) {
 			hdr1 = &proto_hdrs->proto_hdr[i];
-			hdr2 = &proto_hdrs->proto_hdr[i - 1];
-
+			hdr2 = &proto_hdrs->proto_hdr[i - shift_count];
 			*hdr1 = *hdr2;
 		}
 
-		/* adding gtpu header at layer 0 */
-		hdr1 = &proto_hdrs->proto_hdr[0];
+		if (shift_count == 1) {
+			/* adding gtpu header at layer 0 */
+			hdr1 = &proto_hdrs->proto_hdr[0];
+		} else {
+			/* adding gtpu header and outer ip header */
+			hdr1 = &proto_hdrs->proto_hdr[1];
+			hdr2 = &proto_hdrs->proto_hdr[0];
+			hdr2->field_selector = 0;
+			proto_hdrs->count++;
+			proto_hdrs->tunnel_level = TUNNEL_LEVEL_OUTER;
+
+			if (phint & IAVF_PHINT_OUTER_IPV4)
+				VIRTCHNL_SET_PROTO_HDR_TYPE(hdr2, IPV4);
+			else if (phint & IAVF_PHINT_OUTER_IPV6)
+				VIRTCHNL_SET_PROTO_HDR_TYPE(hdr2, IPV6);
+		}
 	} else {
 		hdr1 = &proto_hdrs->proto_hdr[proto_hdrs->count];
 	}
@@ -908,8 +934,7 @@ iavf_hash_parse_pattern_action(__rte_unused struct iavf_adapter *ad,
 		goto error;
 	}
 
-	ret = iavf_hash_parse_pattern(pattern_match_item, pattern, &phint,
-				      error);
+	ret = iavf_hash_parse_pattern(pattern, &phint, error);
 	if (ret)
 		goto error;
 
-- 
2.20.1


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

* Re: [dpdk-dev] [PATCH v4] net/iavf: support gtpu outer and inner co-exist
  2020-09-18  5:46 ` [dpdk-dev] [PATCH v4] " Jeff Guo
@ 2020-09-22 13:06   ` Zhang, Qi Z
  0 siblings, 0 replies; 5+ messages in thread
From: Zhang, Qi Z @ 2020-09-22 13:06 UTC (permalink / raw)
  To: Guo, Jia, Wu, Jingjing, Xing, Beilei; +Cc: dev



> -----Original Message-----
> From: Guo, Jia <jia.guo@intel.com>
> Sent: Friday, September 18, 2020 1:47 PM
> To: Wu, Jingjing <jingjing.wu@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>;
> Xing, Beilei <beilei.xing@intel.com>
> Cc: dev@dpdk.org; Guo, Jia <jia.guo@intel.com>
> Subject: [PATCH v4] net/iavf: support gtpu outer and inner co-exist
> 
> Although currently only the gtpu inner hash be enabled while not the gtpu outer
> hash, but the outer protocol still needed to co-exist with inner protocol when
> configure the gtpu inner hash rule, that would allow the gtpu innner hash
> support for the different outer protocols.
> 
> Signed-off-by: Jeff Guo <jia.guo@intel.com>

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

Applied to dpdk-next-net-intel.

Thanks
Qi


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

end of thread, back to index

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-09  8:20 [dpdk-dev] [PATCH v1] net/iavf: support gtpu outer and inner co-exist Jeff Guo
2020-09-16  4:18 ` [dpdk-dev] [PATCH v2] " Jeff Guo
2020-09-16  4:29 ` [dpdk-dev] [PATCH v3] " Jeff Guo
2020-09-18  5:46 ` [dpdk-dev] [PATCH v4] " Jeff Guo
2020-09-22 13:06   ` Zhang, Qi Z

DPDK patches and discussions

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

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


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


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