diff options
author | Shradha Shah <sshah@solarflare.com> | 2015-04-08 15:25:04 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-04-08 12:21:36 -0400 |
commit | 25672dba9535b804331145379c79f835ba2205c5 (patch) | |
tree | 1737bf6dab3e63e03ae20e0f7b81b3d105b4c6a1 /drivers/net/ethernet/sfc/efx.c | |
parent | d92916f71a57582ce7276547510cedb2c10b6bd6 (diff) | |
download | lwn-25672dba9535b804331145379c79f835ba2205c5.tar.gz lwn-25672dba9535b804331145379c79f835ba2205c5.zip |
sfc: Enable VF's via a write to the sysfs file sriov_numvfs
This patch adds support for the use of sriov_configure on EF10
to enable Virtual Functions while the driver is loaded.
Signed-off-by: Shradha Shah <sshah@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/sfc/efx.c')
-rw-r--r-- | drivers/net/ethernet/sfc/efx.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c index 232c76689076..fa9ce2adf542 100644 --- a/drivers/net/ethernet/sfc/efx.c +++ b/drivers/net/ethernet/sfc/efx.c @@ -3047,6 +3047,26 @@ static int efx_pci_probe(struct pci_dev *pci_dev, return rc; } +/* efx_pci_sriov_configure returns the actual number of Virtual Functions + * enabled on success + */ +#ifdef CONFIG_SFC_SRIOV +static int efx_pci_sriov_configure(struct pci_dev *dev, int num_vfs) +{ + int rc; + struct efx_nic *efx = pci_get_drvdata(dev); + + if (efx->type->sriov_configure) { + rc = efx->type->sriov_configure(efx, num_vfs); + if (rc) + return rc; + else + return num_vfs; + } else + return -ENOSYS; +} +#endif + static int efx_pm_freeze(struct device *dev) { struct efx_nic *efx = pci_get_drvdata(to_pci_dev(dev)); @@ -3269,6 +3289,9 @@ static struct pci_driver efx_pci_driver = { .remove = efx_pci_remove, .driver.pm = &efx_pm_ops, .err_handler = &efx_err_handlers, +#ifdef CONFIG_SFC_SRIOV + .sriov_configure = efx_pci_sriov_configure, +#endif }; /************************************************************************** |