DPDK patches and discussions
 help / color / mirror / Atom feed
From: dapengx.yu@intel.com
To: Qiming Yang <qiming.yang@intel.com>, Qi Zhang <qi.z.zhang@intel.com>
Cc: dev@dpdk.org, Dapeng Yu <dapengx.yu@intel.com>, stable@dpdk.org
Subject: [dpdk-dev] [PATCH v2] net/ice: simplify the use of DCF device reset
Date: Mon, 25 Oct 2021 15:12:12 +0800	[thread overview]
Message-ID: <20211025071212.1230203-1-dapengx.yu@intel.com> (raw)
In-Reply-To: <20211025064118.1215220-1-dapengx.yu@intel.com>

From: Dapeng Yu <dapengx.yu@intel.com>

After DCF is reset by PF, the DCF device un-initialization cannot
function normally since the resource is already invalidated. So
reset DCF twice is necessary, the first reset re-initializes the DCF,
only then second reset can clean the filters successfully.

This patch detects the reset flag, which is set by PF on DCF reset,
if the flag is true, do DCF reset twice automatically.

Fixes: 1a86f4dbdf42 ("net/ice: support DCF device reset")
Cc: stable@dpdk.org

Signed-off-by: Dapeng Yu <dapengx.yu@intel.com>
---
V2:
* Ignore the returned error of dev_uninit when DCF is reset by PF
---
 drivers/net/ice/ice_dcf_ethdev.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c
index 7cb8066416..f51b7cbb8b 100644
--- a/drivers/net/ice/ice_dcf_ethdev.c
+++ b/drivers/net/ice/ice_dcf_ethdev.c
@@ -1031,8 +1031,27 @@ ice_dcf_tm_ops_get(struct rte_eth_dev *dev __rte_unused,
 static int
 ice_dcf_dev_reset(struct rte_eth_dev *dev)
 {
+	struct ice_dcf_adapter *ad = dev->data->dev_private;
+	struct iavf_hw *hw = &ad->real_hw.avf;
 	int ret;
 
+	if (!(IAVF_READ_REG(hw, IAVF_VF_ARQLEN1) &
+	      IAVF_VF_ARQLEN1_ARQENABLE_MASK)) {
+		if (!ad->real_hw.resetting)
+			ad->real_hw.resetting = true;
+		PMD_DRV_LOG(ERR, "The DCF has been reset by PF");
+
+		/*
+		 * Do the extra dev uninit/init to make DCF get resource.
+		 * Then the next uninit/init can clean filters successfully.
+		 */
+		ice_dcf_dev_uninit(dev);
+
+		ret = ice_dcf_dev_init(dev);
+		if (ret)
+			return ret;
+	}
+
 	ret = ice_dcf_dev_uninit(dev);
 	if (ret)
 		return ret;
-- 
2.27.0


  reply	other threads:[~2021-10-25  7:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-25  6:41 [dpdk-dev] [PATCH] " dapengx.yu
2021-10-25  7:12 ` dapengx.yu [this message]
2021-10-26  8:18   ` [dpdk-dev] [PATCH v3] " dapengx.yu
2021-10-26  8:44     ` [dpdk-dev] [PATCH v4] " dapengx.yu
2021-10-26  8:55       ` Zhang, Qi Z
2021-10-26  9:53       ` [dpdk-dev] [PATCH v5] " dapengx.yu
2021-10-27  3:24         ` Zhang, Qi Z

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=20211025071212.1230203-1-dapengx.yu@intel.com \
    --to=dapengx.yu@intel.com \
    --cc=dev@dpdk.org \
    --cc=qi.z.zhang@intel.com \
    --cc=qiming.yang@intel.com \
    --cc=stable@dpdk.org \
    /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).