Skip to content

Commit 99fc105

Browse files
bcreeley13Jeff Kirsher
authored andcommitted
ice: Call pci_disable_sriov before stopping queues for VF
Previous to this commit the driver was immediately stopping Tx/Rx queues when doing the following "echo 0 > sriov_numvfs" and then it was calling pci_disable_sriov if the VFs are not assigned. This was causing the VIRTCHNL_OP_DISABLE_QUEUES to fail because it was trying to stop the queues for a second time. Fix this by calling pci_disable_sriov before stopping the Tx/Rx queues. This allows the VIRTCHNL_OP_DISABLE_QUEUES to get processed before the driver tries to stop the Rx/Tx queues in ice_free_vfs. Signed-off-by: Brett Creeley <[email protected]> Signed-off-by: Anirudh Venkataramanan <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent 7b8ff0f commit 99fc105

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,15 @@ void ice_free_vfs(struct ice_pf *pf)
215215
while (test_and_set_bit(__ICE_VF_DIS, pf->state))
216216
usleep_range(1000, 2000);
217217

218+
/* Disable IOV before freeing resources. This lets any VF drivers
219+
* running in the host get themselves cleaned up before we yank
220+
* the carpet out from underneath their feet.
221+
*/
222+
if (!pci_vfs_assigned(pf->pdev))
223+
pci_disable_sriov(pf->pdev);
224+
else
225+
dev_warn(&pf->pdev->dev, "VFs are assigned - not disabling SR-IOV\n");
226+
218227
/* Avoid wait time by stopping all VFs at the same time */
219228
for (i = 0; i < pf->num_alloc_vfs; i++) {
220229
if (!test_bit(ICE_VF_STATE_ENA, pf->vf[i].vf_states))
@@ -228,15 +237,6 @@ void ice_free_vfs(struct ice_pf *pf)
228237
clear_bit(ICE_VF_STATE_ENA, pf->vf[i].vf_states);
229238
}
230239

231-
/* Disable IOV before freeing resources. This lets any VF drivers
232-
* running in the host get themselves cleaned up before we yank
233-
* the carpet out from underneath their feet.
234-
*/
235-
if (!pci_vfs_assigned(pf->pdev))
236-
pci_disable_sriov(pf->pdev);
237-
else
238-
dev_warn(&pf->pdev->dev, "VFs are assigned - not disabling SR-IOV\n");
239-
240240
tmp = pf->num_alloc_vfs;
241241
pf->num_vf_qps = 0;
242242
pf->num_alloc_vfs = 0;

0 commit comments

Comments
 (0)