net/iavf: fix issue of VF resetting

Message ID 20220627072232.243946-1-yidingx.zhou@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Qi Zhang
Headers
Series net/iavf: fix issue of VF resetting |

Checks

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

Commit Message

Yiding Zhou June 27, 2022, 7:22 a.m. UTC
  When the VF is in closed state, the vf_reset flag can not be reverted
if the VF is reset asynchronously. This prevents all virtchnl commands
from executing, causing subsequent calls to iavf_dev_reset() to fail.

So the vf_reset flag needs to be reverted even when VF is in closed state.

Fixes: 676d986b4b86 ("net/iavf: fix crash after VF reset failure")
Cc: stable@dpdk.org

Signed-off-by: Yiding Zhou <yidingx.zhou@intel.com>
---
 drivers/net/iavf/iavf_ethdev.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
  

Comments

Qi Zhang June 28, 2022, 6:44 a.m. UTC | #1
> -----Original Message-----
> From: Zhou, YidingX <yidingx.zhou@intel.com>
> Sent: Monday, June 27, 2022 3:23 PM
> To: dev@dpdk.org
> Cc: stable@dpdk.org; Zhou, YidingX <yidingx.zhou@intel.com>; Wu, Jingjing
> <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>; Zhang, Qi Z
> <qi.z.zhang@intel.com>
> Subject: [PATCH] net/iavf: fix issue of VF resetting
> 
> When the VF is in closed state, the vf_reset flag can not be reverted if the VF is
> reset asynchronously. This prevents all virtchnl commands from executing,
> causing subsequent calls to iavf_dev_reset() to fail.
> 
> So the vf_reset flag needs to be reverted even when VF is in closed state.
> 
> Fixes: 676d986b4b86 ("net/iavf: fix crash after VF reset failure")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Yiding Zhou <yidingx.zhou@intel.com>

Acked-by: Qi Zhang <qi.z.zhang@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi
  

Patch

diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index 7df0bf8118..506fcff6e3 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -2702,8 +2702,10 @@  iavf_dev_close(struct rte_eth_dev *dev)
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
 		return 0;
 
-	if (adapter->closed)
-		return 0;
+	if (adapter->closed) {
+		ret = 0;
+		goto out;
+	}
 
 	ret = iavf_dev_stop(dev);
 	adapter->closed = true;
@@ -2763,6 +2765,7 @@  iavf_dev_close(struct rte_eth_dev *dev)
 	 * the bus master bit will not be disabled, and this call will have no
 	 * effect.
 	 */
+out:
 	if (vf->vf_reset && !rte_pci_set_bus_master(pci_dev, true))
 		vf->vf_reset = false;