net/iavf: fix VF reset

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: 676d986b4b ("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>
This commit is contained in:
Yiding Zhou 2022-06-27 15:22:32 +08:00 committed by Qi Zhang
parent b84d7eb886
commit 196f35f81c

View File

@ -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;