summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/sfc/ef10_sriov.c
diff options
context:
space:
mode:
authorDaniel Pieczko <dpieczko@solarflare.com>2015-06-02 13:40:31 +0300
committerDavid S. Miller <davem@davemloft.net>2015-06-02 22:57:31 +0300
commit71158bf2e748e2710616f59a823619af3c5505a7 (patch)
tree954a04778fa5872fc8ec0376b9ec2518f39e7afd /drivers/net/ethernet/sfc/ef10_sriov.c
parentf00bf2305cabc2313c70575384aee60e8f2a684d (diff)
downloadlinux-71158bf2e748e2710616f59a823619af3c5505a7.tar.xz
sfc: do not allow VFs to be destroyed if assigned to guests
Signed-off-by: Shradha Shah <sshah@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/sfc/ef10_sriov.c')
-rw-r--r--drivers/net/ethernet/sfc/ef10_sriov.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/net/ethernet/sfc/ef10_sriov.c b/drivers/net/ethernet/sfc/ef10_sriov.c
index cd524543c363..083c534bc4ec 100644
--- a/drivers/net/ethernet/sfc/ef10_sriov.c
+++ b/drivers/net/ethernet/sfc/ef10_sriov.c
@@ -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;