diff mbox series

[2/2] net/iavf: support outer IP hash for GTPC

Message ID 20200827073120.48772-2-alvinx.zhang@intel.com (mailing list archive)
State Changes Requested, archived
Delegated to: Qi Zhang
Headers show
Series [1/2] common/iavf: add GTPC support | expand

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/travis-robot success Travis build: passed
ci/Intel-compilation success Compilation OK

Commit Message

Alvin Zhang Aug. 27, 2020, 7:31 a.m. UTC
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 mbox series

Patch

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 {