[v2] net/ice: simplify the use of DCF device reset

Message ID 20211025071212.1230203-1-dapengx.yu@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Qi Zhang
Headers
Series [v2] net/ice: simplify the use of DCF device reset |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/github-robot: build success github build: passed
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS

Commit Message

Yu, DapengX Oct. 25, 2021, 7:12 a.m. UTC
  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(+)
  

Patch

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;