From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B4972A0546; Thu, 27 May 2021 10:06:27 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B786B41114; Thu, 27 May 2021 10:06:11 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 5B5CA41110 for ; Thu, 27 May 2021 10:06:10 +0200 (CEST) IronPort-SDR: 58pRxc7GKjl2YyDS0ObjG6lXbntahvZer+qN/qk6b7+pKCJ6t3aQ1Vwyhgy0Vywqvj4rvV7wp8 ZPttvS74mjwg== X-IronPort-AV: E=McAfee;i="6200,9189,9996"; a="223877761" X-IronPort-AV: E=Sophos;i="5.82,334,1613462400"; d="scan'208";a="223877761" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 May 2021 01:06:10 -0700 IronPort-SDR: ukkZqbJ64dbW3c6UQscMMCiT8JWE+f43Z5neC4MnmWvpe64ahta9XTkIv8G2czN/3snjCp3ETf 5hO4/gadJzoQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,334,1613462400"; d="scan'208";a="477382086" Received: from wuwenjun.sh.intel.com ([10.67.110.159]) by orsmga001.jf.intel.com with ESMTP; 27 May 2021 01:06:08 -0700 From: Wenjun Wu To: dev@dpdk.org, jingjing.wu@intel.com, beilei.xing@intel.com Cc: Wenjun Wu Date: Thu, 27 May 2021 15:48:43 +0800 Message-Id: <20210527074845.1263679-5-wenjun1.wu@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210527074845.1263679-1-wenjun1.wu@intel.com> References: <20210527074845.1263679-1-wenjun1.wu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v1 4/6] net/iavf: support AVF RSS for GRE tunnel packet X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" Support AVF RSS for inner header of GRE tunnel packet. It supports RSS based on fields inner IP src + dst address and TCP/UDP src + dst port. Signed-off-by: Wenjun Wu --- drivers/net/iavf/iavf_hash.c | 37 ++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/drivers/net/iavf/iavf_hash.c b/drivers/net/iavf/iavf_hash.c index 5d3d62839b..973591100f 100644 --- a/drivers/net/iavf/iavf_hash.c +++ b/drivers/net/iavf/iavf_hash.c @@ -30,6 +30,7 @@ #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_GRE BIT_ULL(6) #define IAVF_PHINT_GTPU_MSK (IAVF_PHINT_GTPU | \ IAVF_PHINT_GTPU_EH | \ @@ -390,6 +391,14 @@ struct virtchnl_proto_hdrs ipv4_ecpri_tmplt = { #define IAVF_RSS_TYPE_IPV6_L2TPV3 (ETH_RSS_L2TPV3 | ETH_RSS_IPV6) #define IAVF_RSS_TYPE_IPV4_PFCP (ETH_RSS_PFCP | ETH_RSS_IPV4) #define IAVF_RSS_TYPE_IPV6_PFCP (ETH_RSS_PFCP | ETH_RSS_IPV6) +/* GRE IPv4 */ +#define IAVF_RSS_TYPE_GRE_IPV4 (ETH_RSS_GRE | IAVF_RSS_TYPE_INNER_IPV4) +#define IAVF_RSS_TYPE_GRE_IPV4_TCP (ETH_RSS_GRE | IAVF_RSS_TYPE_INNER_IPV4_TCP) +#define IAVF_RSS_TYPE_GRE_IPV4_UDP (ETH_RSS_GRE | IAVF_RSS_TYPE_INNER_IPV4_UDP) +/* GRE IPv6 */ +#define IAVF_RSS_TYPE_GRE_IPV6 (ETH_RSS_GRE | IAVF_RSS_TYPE_INNER_IPV6) +#define IAVF_RSS_TYPE_GRE_IPV6_TCP (ETH_RSS_GRE | IAVF_RSS_TYPE_INNER_IPV6_TCP) +#define IAVF_RSS_TYPE_GRE_IPV6_UDP (ETH_RSS_GRE | IAVF_RSS_TYPE_INNER_IPV6_UDP) /** * Supported pattern for hash. @@ -428,6 +437,12 @@ static struct iavf_pattern_match_item iavf_hash_pattern_list[] = { {iavf_pattern_eth_ipv4_gtpc, ETH_RSS_IPV4, &ipv4_udp_gtpc_tmplt}, {iavf_pattern_eth_ecpri, ETH_RSS_ECPRI, ð_ecpri_tmplt}, {iavf_pattern_eth_ipv4_ecpri, ETH_RSS_ECPRI, &ipv4_ecpri_tmplt}, + {iavf_pattern_eth_ipv4_gre_ipv4, IAVF_RSS_TYPE_GRE_IPV4, &inner_ipv4_tmplt}, + {iavf_pattern_eth_ipv6_gre_ipv4, IAVF_RSS_TYPE_GRE_IPV4, &inner_ipv4_tmplt}, + {iavf_pattern_eth_ipv4_gre_ipv4_tcp, IAVF_RSS_TYPE_GRE_IPV4_TCP, &inner_ipv4_tcp_tmplt}, + {iavf_pattern_eth_ipv6_gre_ipv4_tcp, IAVF_RSS_TYPE_GRE_IPV4_TCP, &inner_ipv4_tcp_tmplt}, + {iavf_pattern_eth_ipv4_gre_ipv4_udp, IAVF_RSS_TYPE_GRE_IPV4_UDP, &inner_ipv4_udp_tmplt}, + {iavf_pattern_eth_ipv6_gre_ipv4_udp, IAVF_RSS_TYPE_GRE_IPV4_UDP, &inner_ipv4_udp_tmplt}, /* IPv6 */ {iavf_pattern_eth_ipv6, IAVF_RSS_TYPE_OUTER_IPV6, &outer_ipv6_tmplt}, {iavf_pattern_eth_ipv6_frag_ext, IAVF_RSS_TYPE_OUTER_IPV6_FRAG, &outer_ipv6_frag_tmplt}, @@ -458,6 +473,12 @@ static struct iavf_pattern_match_item iavf_hash_pattern_list[] = { {iavf_pattern_eth_ipv6_l2tpv3, IAVF_RSS_TYPE_IPV6_L2TPV3, &ipv6_l2tpv3_tmplt}, {iavf_pattern_eth_ipv6_pfcp, IAVF_RSS_TYPE_IPV6_PFCP, &ipv6_pfcp_tmplt}, {iavf_pattern_eth_ipv6_gtpc, ETH_RSS_IPV6, &ipv6_udp_gtpc_tmplt}, + {iavf_pattern_eth_ipv4_gre_ipv6, IAVF_RSS_TYPE_GRE_IPV6, &inner_ipv6_tmplt}, + {iavf_pattern_eth_ipv6_gre_ipv6, IAVF_RSS_TYPE_GRE_IPV6, &inner_ipv6_tmplt}, + {iavf_pattern_eth_ipv4_gre_ipv6_tcp, IAVF_RSS_TYPE_GRE_IPV6_TCP, &inner_ipv6_tcp_tmplt}, + {iavf_pattern_eth_ipv6_gre_ipv6_tcp, IAVF_RSS_TYPE_GRE_IPV6_TCP, &inner_ipv6_tcp_tmplt}, + {iavf_pattern_eth_ipv4_gre_ipv6_udp, IAVF_RSS_TYPE_GRE_IPV6_UDP, &inner_ipv6_udp_tmplt}, + {iavf_pattern_eth_ipv6_gre_ipv6_udp, IAVF_RSS_TYPE_GRE_IPV6_UDP, &inner_ipv6_udp_tmplt}, }; static struct iavf_flow_engine iavf_hash_engine = { @@ -592,11 +613,11 @@ iavf_hash_parse_pattern(const struct rte_flow_item pattern[], uint64_t *phint, switch (item->type) { case RTE_FLOW_ITEM_TYPE_IPV4: - if (!(*phint & IAVF_PHINT_GTPU_MSK)) + if (!(*phint & IAVF_PHINT_GTPU_MSK) && !(*phint & IAVF_PHINT_GRE)) *phint |= IAVF_PHINT_OUTER_IPV4; break; case RTE_FLOW_ITEM_TYPE_IPV6: - if (!(*phint & IAVF_PHINT_GTPU_MSK)) + if (!(*phint & IAVF_PHINT_GTPU_MSK) && !(*phint & IAVF_PHINT_GRE)) *phint |= IAVF_PHINT_OUTER_IPV6; break; case RTE_FLOW_ITEM_TYPE_GTPU: @@ -627,6 +648,8 @@ iavf_hash_parse_pattern(const struct rte_flow_item pattern[], uint64_t *phint, return -rte_errno; } break; + case RTE_FLOW_ITEM_TYPE_GRE: + *phint |= IAVF_PHINT_GRE; default: break; } @@ -867,7 +890,7 @@ iavf_refine_proto_hdrs_by_pattern(struct virtchnl_proto_hdrs *proto_hdrs, struct virtchnl_proto_hdr *hdr2; int i, shift_count = 1; - if (!(phint & IAVF_PHINT_GTPU_MSK)) + if (!(phint & IAVF_PHINT_GTPU_MSK) && !(phint & IAVF_PHINT_GRE)) return; if (phint & IAVF_PHINT_LAYERS_MSK) @@ -883,10 +906,10 @@ iavf_refine_proto_hdrs_by_pattern(struct virtchnl_proto_hdrs *proto_hdrs, } if (shift_count == 1) { - /* adding gtpu header at layer 0 */ + /* adding tunnel header at layer 0 */ hdr1 = &proto_hdrs->proto_hdr[0]; } else { - /* adding gtpu header and outer ip header */ + /* adding tunnel header and outer ip header */ hdr1 = &proto_hdrs->proto_hdr[1]; hdr2 = &proto_hdrs->proto_hdr[0]; hdr2->field_selector = 0; @@ -913,6 +936,8 @@ iavf_refine_proto_hdrs_by_pattern(struct virtchnl_proto_hdrs *proto_hdrs, VIRTCHNL_SET_PROTO_HDR_TYPE(hdr1, GTPU_EH); else if (phint & IAVF_PHINT_GTPU) VIRTCHNL_SET_PROTO_HDR_TYPE(hdr1, GTPU_IP); + else if (phint & IAVF_PHINT_GRE) + VIRTCHNL_SET_PROTO_HDR_TYPE(hdr1, GRE); } static void iavf_refine_proto_hdrs(struct virtchnl_proto_hdrs *proto_hdrs, @@ -1172,8 +1197,8 @@ iavf_hash_create(__rte_unused struct iavf_adapter *ad, rss_cfg->proto_hdrs = rss_meta->proto_hdrs; rss_cfg->rss_algorithm = rss_meta->rss_algorithm; - ret = iavf_add_del_rss_cfg(ad, rss_cfg, true); + if (!ret) { flow->rule = rss_cfg; } else { -- 2.25.1