summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/sfc/ef10_sriov.h
diff options
context:
space:
mode:
authorDaniel Pieczko <dpieczko@solarflare.com>2015-06-02 11:41:00 +0100
committerDavid S. Miller <davem@davemloft.net>2015-06-02 12:57:32 -0700
commit6598dad26b7fa39003e4de85d68c584666d5bc21 (patch)
tree32658405b90be80707ef5210749ab684a9dd9131 /drivers/net/ethernet/sfc/ef10_sriov.h
parent2a3fc3112275e93df2e7e09b37b002ffddfd4ba1 (diff)
downloadlinux-6598dad26b7fa39003e4de85d68c584666d5bc21.tar.bz2
sfc: leak vports if a VF is assigned during PF unload
If any VF is assigned as the PF is unloaded, do not attempt to remove its vport or the vswitch. These will be removed if the driver binds to the PF again, as an entity reset occurs during probe. A 'force' flag is added to efx_ef10_pci_sriov_disable() to distinguish between disabling SR-IOV and driver unload. SR-IOV cannot be disabled if VFs are assigned to guests. If the PF driver is unloaded while VFs are assigned, the driver may try to bind to the VF again at a later point if the driver has been reloaded and the VF returns to the same domain as the PF. In this case, the PF will not have a VF data structure, so the VF can check this and drop out of probe early. In this case, efx->vf_count will be zero but VFs will be present. The user is advised to remove the VF and re-create it. The check at the beginning of efx_ef10_pci_sriov_disable() that efx->vf_count is non-zero is removed to allow SR-IOV to be disabled in this case. Also, if the PF driver is unloaded, it will disable SR-IOV to remove these unknown VFs. By not disabling bus-mastering if VFs are still assigned, the VF will continue to pass traffic after the PF has been removed. When using the max_vfs module parameter, if VFs are already present do not try to initialise any more. 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.h')
-rw-r--r--drivers/net/ethernet/sfc/ef10_sriov.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/net/ethernet/sfc/ef10_sriov.h b/drivers/net/ethernet/sfc/ef10_sriov.h
index ffc92a504c3f..db4ef537c610 100644
--- a/drivers/net/ethernet/sfc/ef10_sriov.h
+++ b/drivers/net/ethernet/sfc/ef10_sriov.h
@@ -15,6 +15,7 @@
/**
* struct ef10_vf - PF's store of VF data
* @efx: efx_nic struct for the current VF
+ * @pci_dev: the pci_dev struct for the VF, retained while the VF is assigned
* @vport_id: vport ID for the VF
* @vport_assigned: record whether the vport is currently assigned to the VF
* @mac: MAC address for the VF, zero when address is removed from the vport
@@ -22,6 +23,7 @@
*/
struct ef10_vf {
struct efx_nic *efx;
+ struct pci_dev *pci_dev;
unsigned int vport_id;
unsigned int vport_assigned;
u8 mac[ETH_ALEN];