From patchwork Fri Jul 3 03:56:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Guo, Jia" X-Patchwork-Id: 72924 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id A7914A0519; Fri, 3 Jul 2020 05:58:14 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0F1841D96C; Fri, 3 Jul 2020 05:57:56 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 42D421D987 for ; Fri, 3 Jul 2020 05:57:54 +0200 (CEST) IronPort-SDR: tXn18B5dqc2wpcYTAyqDo9UMq4JPl0ktV8ijEA8q03gR2fefBbPhhw3r252i01vnYWNWC857Jo K9/wec4LhFwg== X-IronPort-AV: E=McAfee;i="6000,8403,9670"; a="208603632" X-IronPort-AV: E=Sophos;i="5.75,306,1589266800"; d="scan'208";a="208603632" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jul 2020 20:57:53 -0700 IronPort-SDR: 3UfuI6YcoVHyzWnJOre+ShOiBsbt/YsAHW93DenjPAwE4o1/aiJkLrUNcBRGGEGHTxobwQ1tlO l4eGbh+VL3Lw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,306,1589266800"; d="scan'208";a="278309780" Received: from npg-dpdk-cvl-jeffguo-01.sh.intel.com ([10.67.111.128]) by orsmga003.jf.intel.com with ESMTP; 02 Jul 2020 20:57:51 -0700 From: Jeff Guo To: qi.z.zhang@intel.com, jingjing.wu@intel.com, beilei.xing@intel.com Cc: dev@dpdk.org, junfeng.guo@intel.com, qiming.yang@intel.com, simei.su@intel.com, jia.guo@intel.com Date: Fri, 3 Jul 2020 11:56:56 +0800 Message-Id: <20200703035656.87908-4-jia.guo@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200703035656.87908-1-jia.guo@intel.com> References: <20200621140235.20488-1-jia.guo@intel.com> <20200703035656.87908-1-jia.guo@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [dpdk-dev v4 3/3] net/iavf: enable some new hash flow X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Some new hash flow will be supported to expend the flow hash capability, the input set are the session id for NAT-T ESP protocol, the l3 src/dst and the teid for GTPU_IP protocol. Signed-off-by: Jeff Guo --- drivers/net/iavf/iavf_hash.c | 76 ++++++++++++++++++++++++++++++++++-- 1 file changed, 72 insertions(+), 4 deletions(-) diff --git a/drivers/net/iavf/iavf_hash.c b/drivers/net/iavf/iavf_hash.c index a253d08f6..bb51b76b5 100644 --- a/drivers/net/iavf/iavf_hash.c +++ b/drivers/net/iavf/iavf_hash.c @@ -35,9 +35,10 @@ enum iavf_pattern_hint_type { IAVF_PHINT_IPV6_SCTP = 0x00000080, IAVF_PHINT_C_VLAN = 0x00000100, IAVF_PHINT_S_VLAN = 0x00000200, - IAVF_PHINT_IPV4_GTPU_EH = 0x00000400, - IAVF_PHINT_IPV4_GTPU_EH_DWNLINK = 0x00000800, - IAVF_PHINT_IPV4_GTPU_EH_UPLINK = 0x00001000, + IAVF_PHINT_IPV4_GTPU_IP = 0x00000400, + IAVF_PHINT_IPV4_GTPU_EH = 0x00000800, + IAVF_PHINT_IPV4_GTPU_EH_DWNLINK = 0x00001000, + IAVF_PHINT_IPV4_GTPU_EH_UPLINK = 0x00002000, }; #define IAVF_GTPU_EH_DWNLINK 0 @@ -94,6 +95,8 @@ static struct iavf_pattern_match_type phint_eth_ipv4_tcp = { IAVF_PHINT_IPV4_TCP}; static struct iavf_pattern_match_type phint_eth_ipv4_sctp = { IAVF_PHINT_IPV4_SCTP}; +static struct iavf_pattern_match_type phint_eth_ipv4_gtpu_ipv4 = { + IAVF_PHINT_IPV4}; static struct iavf_pattern_match_type phint_eth_ipv4_gtpu_eh_ipv4 = { IAVF_PHINT_IPV4}; static struct iavf_pattern_match_type phint_eth_ipv4_gtpu_eh_ipv4_udp = { @@ -102,6 +105,8 @@ static struct iavf_pattern_match_type phint_eth_ipv4_gtpu_eh_ipv4_tcp = { IAVF_PHINT_IPV4_TCP}; static struct iavf_pattern_match_type phint_eth_ipv4_esp = { IAVF_PHINT_IPV4}; +static struct iavf_pattern_match_type phint_eth_ipv4_udp_esp = { + IAVF_PHINT_IPV4_UDP}; static struct iavf_pattern_match_type phint_eth_ipv4_ah = { IAVF_PHINT_IPV4}; static struct iavf_pattern_match_type phint_eth_ipv4_l2tpv3 = { @@ -120,6 +125,8 @@ static struct iavf_pattern_match_type phint_eth_ipv6_sctp = { IAVF_PHINT_IPV6_SCTP}; static struct iavf_pattern_match_type phint_eth_ipv6_esp = { IAVF_PHINT_IPV6}; +static struct iavf_pattern_match_type phint_eth_ipv6_udp_esp = { + IAVF_PHINT_IPV6_UDP}; static struct iavf_pattern_match_type phint_eth_ipv6_ah = { IAVF_PHINT_IPV6}; static struct iavf_pattern_match_type phint_eth_ipv6_l2tpv3 = { @@ -140,6 +147,8 @@ static struct iavf_pattern_match_item iavf_hash_pattern_list[] = { {iavf_pattern_eth_ipv4_udp, IAVF_INSET_NONE, &phint_eth_ipv4_udp}, {iavf_pattern_eth_ipv4_tcp, IAVF_INSET_NONE, &phint_eth_ipv4_tcp}, {iavf_pattern_eth_ipv4_sctp, IAVF_INSET_NONE, &phint_eth_ipv4_sctp}, + {iavf_pattern_eth_ipv4_gtpu_ipv4, IAVF_INSET_NONE, + &phint_eth_ipv4_gtpu_ipv4}, {iavf_pattern_eth_ipv4_gtpu_eh_ipv4, IAVF_INSET_NONE, &phint_eth_ipv4_gtpu_eh_ipv4}, {iavf_pattern_eth_ipv4_gtpu_eh_ipv4_udp, IAVF_INSET_NONE, @@ -147,6 +156,8 @@ static struct iavf_pattern_match_item iavf_hash_pattern_list[] = { {iavf_pattern_eth_ipv4_gtpu_eh_ipv4_tcp, IAVF_INSET_NONE, &phint_eth_ipv4_gtpu_eh_ipv4_tcp}, {iavf_pattern_eth_ipv4_esp, IAVF_INSET_NONE, &phint_eth_ipv4_esp}, + {iavf_pattern_eth_ipv4_udp_esp, IAVF_INSET_NONE, + &phint_eth_ipv4_udp_esp}, {iavf_pattern_eth_ipv4_ah, IAVF_INSET_NONE, &phint_eth_ipv4_ah}, {iavf_pattern_eth_ipv4_l2tpv3, IAVF_INSET_NONE, &phint_eth_ipv4_l2tpv3}, @@ -157,6 +168,8 @@ static struct iavf_pattern_match_item iavf_hash_pattern_list[] = { {iavf_pattern_eth_ipv6_tcp, IAVF_INSET_NONE, &phint_eth_ipv6_tcp}, {iavf_pattern_eth_ipv6_sctp, IAVF_INSET_NONE, &phint_eth_ipv6_sctp}, {iavf_pattern_eth_ipv6_esp, IAVF_INSET_NONE, &phint_eth_ipv6_esp}, + {iavf_pattern_eth_ipv6_udp_esp, IAVF_INSET_NONE, + &phint_eth_ipv6_udp_esp}, {iavf_pattern_eth_ipv6_ah, IAVF_INSET_NONE, &phint_eth_ipv6_ah}, {iavf_pattern_eth_ipv6_l2tpv3, IAVF_INSET_NONE, &phint_eth_ipv6_l2tpv3}, @@ -326,10 +339,18 @@ static struct iavf_pattern_match_item iavf_hash_pattern_list[] = { FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_IPV6_DST) | \ FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_IPV6_PROT), {BUFF_NOUSED } } +#define proto_hint_gtpu_ip_teid { \ + VIRTCHNL_PROTO_HDR_GTPU_IP, \ + FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_GTPU_IP_TEID), {BUFF_NOUSED } } + #define proto_hint_gtpu_eh_only { \ VIRTCHNL_PROTO_HDR_GTPU_EH, \ FIELD_FOR_PROTO_ONLY, {BUFF_NOUSED } } +#define proto_hint_gtpu_ip_only { \ + VIRTCHNL_PROTO_HDR_GTPU_IP, \ + FIELD_FOR_PROTO_ONLY, {BUFF_NOUSED } } + #define proto_hint_gtpu_up_only { \ VIRTCHNL_PROTO_HDR_GTPU_EH_PDU_UP, \ FIELD_FOR_PROTO_ONLY, {BUFF_NOUSED } } @@ -520,6 +541,26 @@ struct virtchnl_proto_hdrs hdrs_hint_ipv4_udp_esp = { proto_hint_udp_only, proto_hint_esp } }; +/* GTPU IP */ +struct virtchnl_proto_hdrs hdrs_hint_ipv4_src_gtpu_ip = { + TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_TWO, {proto_hint_gtpu_ip_only, + proto_hint_ipv4_src } +}; + +struct virtchnl_proto_hdrs hdrs_hint_ipv4_dst_gtpu_ip = { + TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_TWO, {proto_hint_gtpu_ip_only, + proto_hint_ipv4_dst } +}; + +struct virtchnl_proto_hdrs hdrs_hint_ipv4_gtpu_ip = { + TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_TWO, {proto_hint_gtpu_ip_only, + proto_hint_ipv4 } +}; + +struct virtchnl_proto_hdrs hdrs_hint_teid_gtpu_ip = { + TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_TWO, {proto_hint_gtpu_ip_teid} +}; + /* GTPU EH */ struct virtchnl_proto_hdrs hdrs_hint_ipv4_udp_src_gtpu_eh = { @@ -1235,6 +1276,28 @@ struct iavf_hash_match_type iavf_hash_map_list[] = { struct iavf_hash_match_type iavf_gtpu_hash_map_list[] = { /* GTPU */ + /* GTPU IP */ + /* GTPU IPV4*/ + {ETH_RSS_L3_SRC_ONLY, + &hdrs_hint_ipv4_src_gtpu_ip, + IAVF_PHINT_IPV4_GTPU_IP | IAVF_PHINT_IPV4}, + {ETH_RSS_L3_DST_ONLY, + &hdrs_hint_ipv4_dst_gtpu_ip, + IAVF_PHINT_IPV4_GTPU_IP | IAVF_PHINT_IPV4}, + {ETH_RSS_IPV4 | + ETH_RSS_L3_SRC_ONLY, + &hdrs_hint_ipv4_src_gtpu_ip, + IAVF_PHINT_IPV4_GTPU_IP | IAVF_PHINT_IPV4}, + {ETH_RSS_IPV4 | + ETH_RSS_L3_DST_ONLY, + &hdrs_hint_ipv4_dst_gtpu_ip, + IAVF_PHINT_IPV4_GTPU_IP | IAVF_PHINT_IPV4}, + {ETH_RSS_IPV4, + &hdrs_hint_ipv4_gtpu_ip, + IAVF_PHINT_IPV4_GTPU_IP | IAVF_PHINT_IPV4}, + {ETH_RSS_GTPU, + &hdrs_hint_teid_gtpu_ip, + IAVF_PHINT_IPV4_GTPU_IP | IAVF_PHINT_IPV4}, /* GTPU EH */ /* Inner IPV4 */ {ETH_RSS_L3_SRC_ONLY, @@ -1789,8 +1852,12 @@ iavf_hash_parse_pattern(struct iavf_pattern_match_item *pattern_match_item, } switch (item->type) { + case RTE_FLOW_ITEM_TYPE_GTPU: + *phint |= IAVF_PHINT_IPV4_GTPU_IP; + break; case RTE_FLOW_ITEM_TYPE_GTP_PSC: psc = item->spec; + *phint &= ~IAVF_PHINT_IPV4_GTPU_IP; if (!psc) *phint |= IAVF_PHINT_IPV4_GTPU_EH; else if (psc->pdu_type == IAVF_GTPU_EH_UPLINK) @@ -1868,7 +1935,8 @@ iavf_hash_parse_action(const struct rte_flow_action actions[], */ rss_type = rte_eth_rss_hf_refine(rss_type); - if ((pattern_hint & IAVF_PHINT_IPV4_GTPU_EH) || + if ((pattern_hint & IAVF_PHINT_IPV4_GTPU_IP) || + (pattern_hint & IAVF_PHINT_IPV4_GTPU_EH) || (pattern_hint & IAVF_PHINT_IPV4_GTPU_EH_UPLINK) || (pattern_hint & IAVF_PHINT_IPV4_GTPU_EH_DWNLINK)) { hash_map_list = iavf_gtpu_hash_map_list;