summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/wangxun/libwx/wx_sriov.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ethernet/wangxun/libwx/wx_sriov.c')
-rw-r--r--drivers/net/ethernet/wangxun/libwx/wx_sriov.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/drivers/net/ethernet/wangxun/libwx/wx_sriov.c b/drivers/net/ethernet/wangxun/libwx/wx_sriov.c
index c82ae137756c..c6d158cd70da 100644
--- a/drivers/net/ethernet/wangxun/libwx/wx_sriov.c
+++ b/drivers/net/ethernet/wangxun/libwx/wx_sriov.c
@@ -150,6 +150,12 @@ static int wx_pci_sriov_enable(struct pci_dev *dev,
struct wx *wx = pci_get_drvdata(dev);
int err = 0, i;
+ if (netif_is_rxfh_configured(wx->netdev)) {
+ wx_err(wx, "Cannot enable SR-IOV while RXFH is configured\n");
+ wx_err(wx, "Run 'ethtool -X <if> default' to reset RSS table\n");
+ return -EBUSY;
+ }
+
err = __wx_enable_sriov(wx, num_vfs);
if (err)
return err;
@@ -173,12 +179,20 @@ err_out:
return err;
}
-static void wx_pci_sriov_disable(struct pci_dev *dev)
+static int wx_pci_sriov_disable(struct pci_dev *dev)
{
struct wx *wx = pci_get_drvdata(dev);
+ if (netif_is_rxfh_configured(wx->netdev)) {
+ wx_err(wx, "Cannot disable SR-IOV while RXFH is configured\n");
+ wx_err(wx, "Run 'ethtool -X <if> default' to reset RSS table\n");
+ return -EBUSY;
+ }
+
wx_disable_sriov(wx);
wx_sriov_reinit(wx);
+
+ return 0;
}
int wx_pci_sriov_configure(struct pci_dev *pdev, int num_vfs)
@@ -187,10 +201,8 @@ int wx_pci_sriov_configure(struct pci_dev *pdev, int num_vfs)
int err;
if (!num_vfs) {
- if (!pci_vfs_assigned(pdev)) {
- wx_pci_sriov_disable(pdev);
- return 0;
- }
+ if (!pci_vfs_assigned(pdev))
+ return wx_pci_sriov_disable(pdev);
wx_err(wx, "can't free VFs because some are assigned to VMs.\n");
return -EBUSY;