From patchwork Thu Jun 22 09:30:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Xing, Beilei" X-Patchwork-Id: 25613 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 89EE2548B; Thu, 22 Jun 2017 11:35:09 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 463AC4C57; Thu, 22 Jun 2017 11:35:08 +0200 (CEST) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Jun 2017 02:35:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,372,1493708400"; d="scan'208";a="117933470" Received: from dpdk9.sh.intel.com ([10.239.129.190]) by fmsmga006.fm.intel.com with ESMTP; 22 Jun 2017 02:35:03 -0700 From: Beilei Xing To: jingjing.wu@intel.com Cc: dev@dpdk.org, stable@dpdk.org Date: Thu, 22 Jun 2017 17:30:52 +0800 Message-Id: <1498123852-91591-1-git-send-email-beilei.xing@intel.com> X-Mailer: git-send-email 2.5.5 Subject: [dpdk-dev] [PATCH] net/i40e: fix flow director for IPv6 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" After adding a fdir rule for IPv6 with input set TC, IPv6 packets with the specific TC can't be assigned the right queue. The root cause is that TC is parsed wrongly, this patch fixes TC parsing problem. Fixes: 7d83c152a207 ("net/i40e: parse flow director filter") Cc: stable@dpdk.org Signed-off-by: Beilei Xing Tested-by: Yuan Peng --- drivers/net/i40e/i40e_ethdev.h | 1 + drivers/net/i40e/i40e_fdir.c | 1 - drivers/net/i40e/i40e_flow.c | 14 ++++++++------ 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h index 05ecd27..80f9504 100644 --- a/drivers/net/i40e/i40e_ethdev.h +++ b/drivers/net/i40e/i40e_ethdev.h @@ -448,6 +448,7 @@ struct i40e_vmdq_info { I40E_PRTQF_FLX_PIT_DEST_OFF_MASK)) #define I40E_WORD(hi, lo) (uint16_t)((((hi) << 8) & 0xFF00) | ((lo) & 0xFF)) #define I40E_FLEX_WORD_MASK(off) (0x80 >> (off)) +#define I40E_FDIR_IPv6_TC_OFFSET 20 /* * Structure to store flex pit for flow diretor. diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index a970b56..8013add 100644 --- a/drivers/net/i40e/i40e_fdir.c +++ b/drivers/net/i40e/i40e_fdir.c @@ -67,7 +67,6 @@ #define I40E_FDIR_IP_DEFAULT_VERSION_IHL 0x45 #define I40E_FDIR_TCP_DEFAULT_DATAOFF 0x50 #define I40E_FDIR_IPv6_DEFAULT_VTC_FLOW 0x60000000 -#define I40E_FDIR_IPv6_TC_OFFSET 20 #define I40E_FDIR_IPv6_DEFAULT_HOP_LIMITS 0xFF #define I40E_FDIR_IPv6_PAYLOAD_LEN 380 diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c index c7589ce..1a27572 100644 --- a/drivers/net/i40e/i40e_flow.c +++ b/drivers/net/i40e/i40e_flow.c @@ -52,8 +52,7 @@ #include "base/i40e_prototype.h" #include "i40e_ethdev.h" -#define I40E_IPV4_TC_SHIFT 4 -#define I40E_IPV6_TC_MASK (0x00FF << I40E_IPV4_TC_SHIFT) +#define I40E_IPV6_TC_MASK (0xFF << I40E_FDIR_IPv6_TC_OFFSET) #define I40E_IPV6_FRAG_HEADER 44 #define I40E_TENANT_ARRAY_NUM 3 #define I40E_TCI_MASK 0xFFFF @@ -2352,6 +2351,7 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, bool cfg_flex_msk = true; uint16_t outer_tpid; uint16_t ether_type; + uint32_t vtc_flow_cpu; int ret; memset(off_arr, 0, I40E_MAX_FLXPLD_FIED); @@ -2508,8 +2508,8 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, input_set |= I40E_INSET_IPV6_DST; if ((ipv6_mask->hdr.vtc_flow & - rte_cpu_to_be_16(I40E_IPV6_TC_MASK)) - == rte_cpu_to_be_16(I40E_IPV6_TC_MASK)) + rte_cpu_to_be_32(I40E_IPV6_TC_MASK)) + == rte_cpu_to_be_32(I40E_IPV6_TC_MASK)) input_set |= I40E_INSET_IPV6_TC; if (ipv6_mask->hdr.proto == UINT8_MAX) input_set |= I40E_INSET_IPV6_NEXT_HDR; @@ -2517,9 +2517,11 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, input_set |= I40E_INSET_IPV6_HOP_LIMIT; /* Get filter info */ + vtc_flow_cpu = + rte_be_to_cpu_32(ipv6_spec->hdr.vtc_flow); filter->input.flow.ipv6_flow.tc = - (uint8_t)(ipv6_spec->hdr.vtc_flow << - I40E_IPV4_TC_SHIFT); + (uint8_t)(vtc_flow_cpu >> + I40E_FDIR_IPv6_TC_OFFSET); filter->input.flow.ipv6_flow.proto = ipv6_spec->hdr.proto; filter->input.flow.ipv6_flow.hop_limits =