DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Zhou, JunX W" <junx.w.zhou@intel.com>
To: "Yu, DapengX" <dapengx.yu@intel.com>, "Guo, Jia" <jia.guo@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	"Yu, DapengX" <dapengx.yu@intel.com>,
	"Zhang, Qi Z" <qi.z.zhang@intel.com>
Subject: Re: [dpdk-dev] [PATCH] net/ixgbe: fix fdirctrl register setting
Date: Tue, 15 Dec 2020 03:00:36 +0000	[thread overview]
Message-ID: <8aca632d412e494888896f24bb8ee4d9@intel.com> (raw)
In-Reply-To: <20201211013506.49885-1-dapengx.yu@intel.com>

Tested-by: Zhou, Jun <junx.w.zhou@intel.com>

-----Original Message-----
From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of dapengx.yu@intel.com
Sent: Friday, December 11, 2020 9:35 AM
To: Guo, Jia <jia.guo@intel.com>
Cc: dev@dpdk.org; Yu, DapengX <dapengx.yu@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>
Subject: [dpdk-dev] [PATCH] net/ixgbe: fix fdirctrl register setting

From: YU DAPENG <dapengx.yu@intel.com>

The function ixgbe_fdir_set_flexbytes_offset is used when create FDir rule for flexbytes. It set a register: FDIRCTRL.FLEX_OFFSET, which cause that even if the FDir flexbytes rule is destroyed, the rule still direct the packet and transfer it to the wrong place. It is because Setting FDIRCTRL shall only be permitted on Flow Director initialization flow or Clearing the Flow Director table, otherwise unexpected happens. In order to evade the limit, add code to make setting FDIRCTRL work without unexpected effects.

Fixes: f35fec63dde1 ("net/ixgbe: enable flex bytes for generic flow API")
Cc: qi.z.zhang@intel.com

Signed-off-by: YU DAPENG <dapengx.yu@intel.com>
---
 drivers/net/ixgbe/ixgbe_fdir.c | 23 +++++++++++++++++++++++  drivers/net/ixgbe/ixgbe_flow.c |  7 +++----
 2 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_fdir.c b/drivers/net/ixgbe/ixgbe_fdir.c index a0fab5070..56dddd56b 100644
--- a/drivers/net/ixgbe/ixgbe_fdir.c
+++ b/drivers/net/ixgbe/ixgbe_fdir.c
@@ -503,9 +503,32 @@ ixgbe_fdir_set_flexbytes_offset(struct rte_eth_dev *dev,
 				uint16_t offset)
 {
 	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct ixgbe_hw_fdir_info *fdir_info =
+		IXGBE_DEV_PRIVATE_TO_FDIR_INFO(dev->data->dev_private);
 	uint32_t fdirctrl;
 	int i;
 
+	if (fdir_info->flex_bytes_offset == offset)
+		return 0;
+
+	fdir_info->flex_bytes_offset = offset;
+
+	/*
+	 * 82599 adapters flow director init flow cannot be restarted,
+	 * Workaround 82599 silicon errata by performing the following steps
+	 * before re-writing the FDIRCTRL control register with the same value.
+	 * - write 1 to bit 8 of FDIRCMD register &
+	 * - write 0 to bit 8 of FDIRCMD register
+	 */
+	IXGBE_WRITE_REG(hw, IXGBE_FDIRCMD,
+			(IXGBE_READ_REG(hw, IXGBE_FDIRCMD) |
+			 IXGBE_FDIRCMD_CLEARHT));
+	IXGBE_WRITE_FLUSH(hw);
+	IXGBE_WRITE_REG(hw, IXGBE_FDIRCMD,
+			(IXGBE_READ_REG(hw, IXGBE_FDIRCMD) &
+			 ~IXGBE_FDIRCMD_CLEARHT));
+	IXGBE_WRITE_FLUSH(hw);
+
 	fdirctrl = IXGBE_READ_REG(hw, IXGBE_FDIRCTRL);
 
 	fdirctrl &= ~IXGBE_FDIRCTRL_FLEX_MASK; diff --git a/drivers/net/ixgbe/ixgbe_flow.c b/drivers/net/ixgbe/ixgbe_flow.c index 39f6ed73f..b37541d9b 100644
--- a/drivers/net/ixgbe/ixgbe_flow.c
+++ b/drivers/net/ixgbe/ixgbe_flow.c
@@ -3137,8 +3137,6 @@ ixgbe_flow_create(struct rte_eth_dev *dev,
 				rte_memcpy(&fdir_info->mask,
 					&fdir_rule.mask,
 					sizeof(struct ixgbe_hw_fdir_mask));
-				fdir_info->flex_bytes_offset =
-					fdir_rule.flex_bytes_offset;
 
 				if (fdir_rule.mask.flex_bytes_mask)
 					ixgbe_fdir_set_flexbytes_offset(dev,
@@ -3161,8 +3159,9 @@ ixgbe_flow_create(struct rte_eth_dev *dev,
 				if (ret)
 					goto out;
 
-				if (fdir_info->flex_bytes_offset !=
-						fdir_rule.flex_bytes_offset)
+				if (fdir_rule.mask.flex_bytes_mask &&
+					(fdir_info->flex_bytes_offset !=
+						fdir_rule.flex_bytes_offset))
 					goto out;
 			}
 		}
--
2.26.2.windows.1


  reply	other threads:[~2020-12-15  3:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-11  1:35 dapengx.yu
2020-12-15  3:00 ` Zhou, JunX W [this message]
2020-12-15  4:36 ` Guo, Jia
2020-12-16  0:55   ` Yu, DapengX
2020-12-15 10:10 ` [dpdk-dev] [PATCH v2] " dapengx.yu
2020-12-22  6:51   ` Zhou, JunX W
2020-12-22  7:23     ` Guo, Jia
2021-01-05 12:09       ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit

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=8aca632d412e494888896f24bb8ee4d9@intel.com \
    --to=junx.w.zhou@intel.com \
    --cc=dapengx.yu@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).