DPDK patches and discussions
 help / color / mirror / Atom feed
From: alvinx.zhang@intel.com
To: jia.guo@intel.com, qi.z.zhang@intel.com
Cc: dev@dpdk.org, Alvin Zhang <alvinx.zhang@intel.com>
Subject: [dpdk-dev] [PATCH 2/2] net/iavf: support outer IP hash for GTPC
Date: Thu, 27 Aug 2020 15:31:20 +0800	[thread overview]
Message-ID: <20200827073120.48772-2-alvinx.zhang@intel.com> (raw)
In-Reply-To: <20200827073120.48772-1-alvinx.zhang@intel.com>

From: Alvin Zhang <alvinx.zhang@intel.com>

Add patterns for GTPC, now outer IP hash can be configured as input set for
GTPC packet.

Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
---
 drivers/net/iavf/iavf_generic_flow.c |  36 +++++++++++
 drivers/net/iavf/iavf_generic_flow.h |   8 +++
 drivers/net/iavf/iavf_hash.c         | 122 ++++++++++++++++++++++++++++++++++-
 3 files changed, 164 insertions(+), 2 deletions(-)

diff --git a/drivers/net/iavf/iavf_generic_flow.c b/drivers/net/iavf/iavf_generic_flow.c
index 321a4dc..44fab4d 100644
--- a/drivers/net/iavf/iavf_generic_flow.c
+++ b/drivers/net/iavf/iavf_generic_flow.c
@@ -315,6 +315,24 @@ enum rte_flow_item_type iavf_pattern_eth_qinq_ipv6_icmp6[] = {
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
+/* IPV4 GTPC */
+enum rte_flow_item_type iavf_pattern_eth_ipv4_gtpc[] = {
+	RTE_FLOW_ITEM_TYPE_ETH,
+	RTE_FLOW_ITEM_TYPE_IPV4,
+	RTE_FLOW_ITEM_TYPE_UDP,
+	RTE_FLOW_ITEM_TYPE_GTPC,
+	RTE_FLOW_ITEM_TYPE_END,
+};
+
+enum rte_flow_item_type iavf_pattern_eth_vlan_ipv4_gtpc[] = {
+	RTE_FLOW_ITEM_TYPE_ETH,
+	RTE_FLOW_ITEM_TYPE_VLAN,
+	RTE_FLOW_ITEM_TYPE_IPV4,
+	RTE_FLOW_ITEM_TYPE_UDP,
+	RTE_FLOW_ITEM_TYPE_GTPC,
+	RTE_FLOW_ITEM_TYPE_END,
+};
+
 /* IPV4 GTPU (EH) */
 enum rte_flow_item_type iavf_pattern_eth_ipv4_gtpu[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
@@ -333,6 +351,24 @@ enum rte_flow_item_type iavf_pattern_eth_ipv4_gtpu_eh[] = {
 	RTE_FLOW_ITEM_TYPE_END,
 };
 
+/* IPV6 GTPC */
+enum rte_flow_item_type iavf_pattern_eth_ipv6_gtpc[] = {
+	RTE_FLOW_ITEM_TYPE_ETH,
+	RTE_FLOW_ITEM_TYPE_IPV6,
+	RTE_FLOW_ITEM_TYPE_UDP,
+	RTE_FLOW_ITEM_TYPE_GTPC,
+	RTE_FLOW_ITEM_TYPE_END,
+};
+
+enum rte_flow_item_type iavf_pattern_eth_vlan_ipv6_gtpc[] = {
+	RTE_FLOW_ITEM_TYPE_ETH,
+	RTE_FLOW_ITEM_TYPE_VLAN,
+	RTE_FLOW_ITEM_TYPE_IPV6,
+	RTE_FLOW_ITEM_TYPE_UDP,
+	RTE_FLOW_ITEM_TYPE_GTPC,
+	RTE_FLOW_ITEM_TYPE_END,
+};
+
 /* IPV6 GTPU (EH) */
 enum rte_flow_item_type iavf_pattern_eth_ipv6_gtpu[] = {
 	RTE_FLOW_ITEM_TYPE_ETH,
diff --git a/drivers/net/iavf/iavf_generic_flow.h b/drivers/net/iavf/iavf_generic_flow.h
index f365cc3..eb466f9 100644
--- a/drivers/net/iavf/iavf_generic_flow.h
+++ b/drivers/net/iavf/iavf_generic_flow.h
@@ -182,10 +182,18 @@
 extern enum rte_flow_item_type iavf_pattern_eth_vlan_ipv6_icmp6[];
 extern enum rte_flow_item_type iavf_pattern_eth_qinq_ipv6_icmp6[];
 
+/* IPV4 GTPC */
+extern enum rte_flow_item_type iavf_pattern_eth_ipv4_gtpc[];
+extern enum rte_flow_item_type iavf_pattern_eth_vlan_ipv4_gtpc[];
+
 /* IPv4 GTPU (EH) */
 extern enum rte_flow_item_type iavf_pattern_eth_ipv4_gtpu[];
 extern enum rte_flow_item_type iavf_pattern_eth_ipv4_gtpu_eh[];
 
+/* IPV4 GTPC */
+extern enum rte_flow_item_type iavf_pattern_eth_ipv6_gtpc[];
+extern enum rte_flow_item_type iavf_pattern_eth_vlan_ipv6_gtpc[];
+
 /* IPv6 GTPU (EH) */
 extern enum rte_flow_item_type iavf_pattern_eth_ipv6_gtpu[];
 extern enum rte_flow_item_type iavf_pattern_eth_ipv6_gtpu_eh[];
diff --git a/drivers/net/iavf/iavf_hash.c b/drivers/net/iavf/iavf_hash.c
index c06b52e..7bc32b0 100644
--- a/drivers/net/iavf/iavf_hash.c
+++ b/drivers/net/iavf/iavf_hash.c
@@ -41,6 +41,8 @@ enum iavf_pattern_hint_type {
 	IAVF_PHINT_IPV6_GTPU_EH			= 0x00002000,
 	IAVF_PHINT_IPV6_GTPU_EH_DWNLINK		= 0x00004000,
 	IAVF_PHINT_IPV6_GTPU_EH_UPLINK		= 0x00008000,
+	IAVF_PHINT_IPV4_GTPC			= 0x00010000,
+	IAVF_PHINT_IPV6_GTPC			= 0x00020000,
 };
 
 #define IAVF_GTPU_EH_DWNLINK	0
@@ -189,6 +191,10 @@ struct iavf_hash_flow_cfg {
 	IAVF_PHINT_IPV6_TCP};
 static struct iavf_pattern_match_type phint_eth_vlan_ipv6_sctp = {
 	IAVF_PHINT_IPV6_SCTP};
+static struct iavf_pattern_match_type phint_eth_ipv4_gtpc = {
+	IAVF_PHINT_IPV4_GTPC };
+static struct iavf_pattern_match_type phint_eth_ipv6_gtpc = {
+	IAVF_PHINT_IPV6_GTPC };
 
 /**
  * Supported pattern for hash.
@@ -281,6 +287,12 @@ struct iavf_hash_flow_cfg {
 					&phint_eth_vlan_ipv6_tcp},
 	{iavf_pattern_eth_vlan_ipv6_sctp, IAVF_INSET_NONE,
 					&phint_eth_vlan_ipv6_sctp},
+	{iavf_pattern_eth_ipv4_gtpc, IAVF_INSET_NONE, &phint_eth_ipv4_gtpc},
+	{iavf_pattern_eth_ipv6_gtpc, IAVF_INSET_NONE, &phint_eth_ipv6_gtpc},
+	{iavf_pattern_eth_vlan_ipv4_gtpc, IAVF_INSET_NONE,
+					&phint_eth_ipv4_gtpc},
+	{iavf_pattern_eth_vlan_ipv6_gtpc, IAVF_INSET_NONE,
+					&phint_eth_ipv6_gtpc},
 	{iavf_pattern_empty, IAVF_INSET_NONE, &phint_empty},
 };
 
@@ -290,6 +302,7 @@ struct iavf_hash_flow_cfg {
 #define PROTO_COUNT_ONE			1
 #define PROTO_COUNT_TWO			2
 #define PROTO_COUNT_THREE		3
+#define PROTO_COUNT_FOUR		4
 
 #define BUFF_NOUSED			0
 #define FIELD_FOR_PROTO_ONLY		0
@@ -445,6 +458,10 @@ struct iavf_hash_flow_cfg {
 	FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_IPV6_DST) | \
 	FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_IPV6_PROT), {BUFF_NOUSED } }
 
+#define proto_hint_gtpc_only { \
+	VIRTCHNL_PROTO_HDR_GTPC, \
+	FIELD_FOR_PROTO_ONLY, {BUFF_NOUSED } }
+
 #define proto_hint_gtpu_ip_teid { \
 	VIRTCHNL_PROTO_HDR_GTPU_IP, \
 	FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_GTPU_IP_TEID), {BUFF_NOUSED } }
@@ -770,6 +787,37 @@ struct virtchnl_proto_hdrs hdrs_hint_ipv4_udp_esp = {
 	proto_hint_udp_only, proto_hint_esp }
 };
 
+/* IPv4 GTPC */
+struct virtchnl_proto_hdrs hdrs_hint_ipv4_gtpc = {
+	TUNNEL_LEVEL_OUTER, PROTO_COUNT_THREE, {proto_hint_ipv4,
+	proto_hint_udp_only, proto_hint_gtpc_only}
+};
+
+struct virtchnl_proto_hdrs hdrs_hint_ipv4_dst_gtpc = {
+	TUNNEL_LEVEL_OUTER, PROTO_COUNT_THREE, {proto_hint_ipv4_dst,
+	proto_hint_udp_only, proto_hint_gtpc_only}
+};
+
+struct virtchnl_proto_hdrs hdrs_hint_ipv4_src_gtpc = {
+	TUNNEL_LEVEL_OUTER, PROTO_COUNT_THREE, {proto_hint_ipv4_src,
+	proto_hint_udp_only, proto_hint_gtpc_only}
+};
+
+struct virtchnl_proto_hdrs hdrs_hint_cvlan_ipv4_gtpc = {
+	TUNNEL_LEVEL_OUTER, PROTO_COUNT_FOUR, {proto_hint_cvlan,
+	proto_hint_ipv4, proto_hint_udp_only, proto_hint_gtpc_only}
+};
+
+struct virtchnl_proto_hdrs hdrs_hint_cvlan_ipv4_dst_gtpc = {
+	TUNNEL_LEVEL_OUTER, PROTO_COUNT_FOUR, {proto_hint_cvlan,
+	proto_hint_ipv4_dst, proto_hint_udp_only, proto_hint_gtpc_only}
+};
+
+struct virtchnl_proto_hdrs hdrs_hint_cvlan_ipv4_src_gtpc = {
+	TUNNEL_LEVEL_OUTER, PROTO_COUNT_FOUR, {proto_hint_cvlan,
+	proto_hint_ipv4_src, proto_hint_udp_only, proto_hint_gtpc_only}
+};
+
 /* IPv4 GTPU IP */
 
 struct virtchnl_proto_hdrs hdrs_hint_ipv4_src_gtpu_ip = {
@@ -891,6 +939,37 @@ struct virtchnl_proto_hdrs hdrs_hint_teid_gtpu_ip = {
 	TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_TWO, {proto_hint_gtpu_ip_teid}
 };
 
+/* IPv6 GTPC */
+struct virtchnl_proto_hdrs hdrs_hint_ipv6_gtpc = {
+	TUNNEL_LEVEL_OUTER, PROTO_COUNT_THREE, {proto_hint_ipv6,
+	proto_hint_udp_only, proto_hint_gtpc_only}
+};
+
+struct virtchnl_proto_hdrs hdrs_hint_ipv6_dst_gtpc = {
+	TUNNEL_LEVEL_OUTER, PROTO_COUNT_THREE, {proto_hint_ipv6_dst,
+	proto_hint_udp_only, proto_hint_gtpc_only}
+};
+
+struct virtchnl_proto_hdrs hdrs_hint_ipv6_src_gtpc = {
+	TUNNEL_LEVEL_OUTER, PROTO_COUNT_THREE, {proto_hint_ipv6_src,
+	proto_hint_udp_only, proto_hint_gtpc_only}
+};
+
+struct virtchnl_proto_hdrs hdrs_hint_cvlan_ipv6_gtpc = {
+	TUNNEL_LEVEL_OUTER, PROTO_COUNT_FOUR, {proto_hint_cvlan,
+	proto_hint_ipv6, proto_hint_udp_only, proto_hint_gtpc_only}
+};
+
+struct virtchnl_proto_hdrs hdrs_hint_cvlan_ipv6_dst_gtpc = {
+	TUNNEL_LEVEL_OUTER, PROTO_COUNT_FOUR, {proto_hint_cvlan,
+	proto_hint_ipv6_dst, proto_hint_udp_only, proto_hint_gtpc_only}
+};
+
+struct virtchnl_proto_hdrs hdrs_hint_cvlan_ipv6_src_gtpc = {
+	TUNNEL_LEVEL_OUTER, PROTO_COUNT_FOUR, {proto_hint_cvlan,
+	proto_hint_ipv6_src, proto_hint_udp_only, proto_hint_gtpc_only}
+};
+
 /* IPv6 GTPU IP */
 
 struct virtchnl_proto_hdrs hdrs_hint_ipv6_src_gtpu_ip = {
@@ -2267,7 +2346,44 @@ struct iavf_hash_match_type iavf_hash_map_list[] = {
 };
 
 struct iavf_hash_match_type iavf_gtpu_hash_map_list[] = {
-	/* GTPU */
+	/* IPv4 GTPC */
+	{ETH_RSS_IPV4,
+		&hdrs_hint_ipv4_gtpc, IAVF_PHINT_IPV4_GTPC},
+	{ETH_RSS_IPV4 |
+		ETH_RSS_L3_DST_ONLY,
+		&hdrs_hint_ipv4_dst_gtpc, IAVF_PHINT_IPV4_GTPC},
+	{ETH_RSS_IPV4 |
+		ETH_RSS_L3_SRC_ONLY,
+		&hdrs_hint_ipv4_src_gtpc, IAVF_PHINT_IPV4_GTPC},
+	{ETH_RSS_C_VLAN |
+		ETH_RSS_IPV4,
+		&hdrs_hint_cvlan_ipv4_gtpc, IAVF_PHINT_IPV4_GTPC},
+	{ETH_RSS_C_VLAN |
+		ETH_RSS_IPV4 | ETH_RSS_L3_DST_ONLY,
+		&hdrs_hint_cvlan_ipv4_dst_gtpc, IAVF_PHINT_IPV4_GTPC},
+	{ETH_RSS_C_VLAN |
+		ETH_RSS_IPV4 | ETH_RSS_L3_SRC_ONLY,
+		&hdrs_hint_cvlan_ipv4_src_gtpc, IAVF_PHINT_IPV4_GTPC},
+
+	/* IPv6 GTPC */
+	{ETH_RSS_IPV6,
+		&hdrs_hint_ipv6_gtpc, IAVF_PHINT_IPV6_GTPC},
+	{ETH_RSS_IPV6 |
+		ETH_RSS_L3_DST_ONLY,
+		&hdrs_hint_ipv6_dst_gtpc, IAVF_PHINT_IPV6_GTPC},
+	{ETH_RSS_IPV6 |
+		ETH_RSS_L3_SRC_ONLY,
+		&hdrs_hint_ipv6_src_gtpc, IAVF_PHINT_IPV6_GTPC},
+	{ETH_RSS_C_VLAN |
+		ETH_RSS_IPV6,
+		&hdrs_hint_cvlan_ipv6_gtpc, IAVF_PHINT_IPV6_GTPC},
+	{ETH_RSS_C_VLAN |
+		ETH_RSS_IPV6 | ETH_RSS_L3_DST_ONLY,
+		&hdrs_hint_cvlan_ipv6_dst_gtpc, IAVF_PHINT_IPV6_GTPC},
+	{ETH_RSS_C_VLAN |
+		ETH_RSS_IPV6 | ETH_RSS_L3_SRC_ONLY,
+		&hdrs_hint_cvlan_ipv6_src_gtpc, IAVF_PHINT_IPV6_GTPC},
+
 	/* GTPU IP */
 	/* IPv4 GTPU IP IPv4*/
 	{ETH_RSS_IPV4 |
@@ -3841,7 +3957,9 @@ struct virtchnl_proto_hdrs *iavf_hash_default_hdrs[] = {
 			    (pattern_hint & IAVF_PHINT_IPV6_GTPU_IP) ||
 			    (pattern_hint & IAVF_PHINT_IPV6_GTPU_EH) ||
 			    (pattern_hint & IAVF_PHINT_IPV6_GTPU_EH_UPLINK) ||
-			    (pattern_hint & IAVF_PHINT_IPV6_GTPU_EH_DWNLINK)) {
+			    (pattern_hint & IAVF_PHINT_IPV6_GTPU_EH_DWNLINK) ||
+			    (pattern_hint & IAVF_PHINT_IPV4_GTPC) ||
+			    (pattern_hint & IAVF_PHINT_IPV6_GTPC)) {
 				hash_map_list = iavf_gtpu_hash_map_list;
 				mlist_len = RTE_DIM(iavf_gtpu_hash_map_list);
 			} else {
-- 
1.8.3.1


  reply	other threads:[~2020-08-27  7:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-27  7:31 [dpdk-dev] [PATCH 1/2] common/iavf: add GTPC support alvinx.zhang
2020-08-27  7:31 ` alvinx.zhang [this message]
2020-08-31  6:32 ` alvinx.zhang
2020-08-31  6:32   ` [dpdk-dev] [PATCH 2/2] net/iavf: support outer IP hash for GTPC alvinx.zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200827073120.48772-2-alvinx.zhang@intel.com \
    --to=alvinx.zhang@intel.com \
    --cc=dev@dpdk.org \
    --cc=jia.guo@intel.com \
    --cc=qi.z.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).