Skip to content

Commit

Permalink
sfc: do not allow VFs to be destroyed if assigned to guests
Browse files Browse the repository at this point in the history
Signed-off-by: Shradha Shah <sshah@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Daniel Pieczko authored and David S. Miller committed Jun 2, 2015
1 parent f00bf23 commit 71158bf
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions drivers/net/ethernet/sfc/ef10_sriov.c
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,15 @@ static int efx_ef10_pci_sriov_disable(struct efx_nic *efx)
{
struct pci_dev *dev = efx->pci_dev;

if (!efx->vf_count)
return 0;

if (pci_vfs_assigned(dev)) {
netif_err(efx, drv, efx->net_dev, "VFs are assigned to guests; "
"please detach them before disabling SR-IOV\n");
return -EBUSY;
}

pci_disable_sriov(dev);
efx_ef10_sriov_free_vf_vswitching(efx);
efx->vf_count = 0;
Expand Down

0 comments on commit 71158bf

Please sign in to comment.