Commit 132a3f2b authored by Rajesh Borundia's avatar Rajesh Borundia Committed by David S. Miller

qlcnic: Allow SR-IOV VF probe in hypervisor.

o Add support for SR-IOV VF probe in hypervisor to enable
  assignment of VFs within hypervisor.
o SR-IOV VF can be uplinked to bridge/macvtap device with this change.
o Refactor SR-IOV enable/disable code. We cannot take rtnl lock
  while enabling/disabling SR-IOV as VF probe will take an rtnl
  lock.
o Disable spoofchk by default.
Signed-off-by: default avatarRajesh Borundia <rajesh.borundia@qlogic.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a3ab3c13
...@@ -2398,9 +2398,6 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -2398,9 +2398,6 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
int err, pci_using_dac = -1; int err, pci_using_dac = -1;
char board_name[QLCNIC_MAX_BOARD_NAME_LEN + 19]; /* MAC + ": " + name */ char board_name[QLCNIC_MAX_BOARD_NAME_LEN + 19]; /* MAC + ": " + name */
if (pdev->is_virtfn)
return -ENODEV;
err = pci_enable_device(pdev); err = pci_enable_device(pdev);
if (err) if (err)
return err; return err;
...@@ -2680,9 +2677,9 @@ static void qlcnic_remove(struct pci_dev *pdev) ...@@ -2680,9 +2677,9 @@ static void qlcnic_remove(struct pci_dev *pdev)
return; return;
netdev = adapter->netdev; netdev = adapter->netdev;
qlcnic_sriov_pf_disable(adapter);
qlcnic_cancel_idc_work(adapter); qlcnic_cancel_idc_work(adapter);
qlcnic_sriov_pf_disable(adapter);
ahw = adapter->ahw; ahw = adapter->ahw;
unregister_netdev(netdev); unregister_netdev(netdev);
......
...@@ -198,7 +198,7 @@ int qlcnic_sriov_init(struct qlcnic_adapter *adapter, int num_vfs) ...@@ -198,7 +198,7 @@ int qlcnic_sriov_init(struct qlcnic_adapter *adapter, int num_vfs)
} }
sriov->vf_info[i].vp = vp; sriov->vf_info[i].vp = vp;
vp->max_tx_bw = MAX_BW; vp->max_tx_bw = MAX_BW;
vp->spoofchk = true; vp->spoofchk = false;
random_ether_addr(vp->mac); random_ether_addr(vp->mac);
dev_info(&adapter->pdev->dev, dev_info(&adapter->pdev->dev,
"MAC Address %pM is configured for VF %d\n", "MAC Address %pM is configured for VF %d\n",
......
...@@ -472,12 +472,12 @@ static int qlcnic_pci_sriov_disable(struct qlcnic_adapter *adapter) ...@@ -472,12 +472,12 @@ static int qlcnic_pci_sriov_disable(struct qlcnic_adapter *adapter)
return -EPERM; return -EPERM;
} }
qlcnic_sriov_pf_disable(adapter);
rtnl_lock(); rtnl_lock();
if (netif_running(netdev)) if (netif_running(netdev))
__qlcnic_down(adapter, netdev); __qlcnic_down(adapter, netdev);
qlcnic_sriov_pf_disable(adapter);
qlcnic_sriov_free_vlans(adapter); qlcnic_sriov_free_vlans(adapter);
qlcnic_sriov_pf_cleanup(adapter); qlcnic_sriov_pf_cleanup(adapter);
...@@ -596,7 +596,6 @@ static int __qlcnic_pci_sriov_enable(struct qlcnic_adapter *adapter, ...@@ -596,7 +596,6 @@ static int __qlcnic_pci_sriov_enable(struct qlcnic_adapter *adapter,
qlcnic_sriov_alloc_vlans(adapter); qlcnic_sriov_alloc_vlans(adapter);
err = qlcnic_sriov_pf_enable(adapter, num_vfs);
return err; return err;
del_flr_queue: del_flr_queue:
...@@ -627,25 +626,36 @@ static int qlcnic_pci_sriov_enable(struct qlcnic_adapter *adapter, int num_vfs) ...@@ -627,25 +626,36 @@ static int qlcnic_pci_sriov_enable(struct qlcnic_adapter *adapter, int num_vfs)
__qlcnic_down(adapter, netdev); __qlcnic_down(adapter, netdev);
err = __qlcnic_pci_sriov_enable(adapter, num_vfs); err = __qlcnic_pci_sriov_enable(adapter, num_vfs);
if (err) { if (err)
netdev_info(netdev, "Failed to enable SR-IOV on port %d\n", goto error;
adapter->portnum);
err = -EIO; if (netif_running(netdev))
if (qlcnic_83xx_configure_opmode(adapter)) __qlcnic_up(adapter, netdev);
goto error;
} else { rtnl_unlock();
err = qlcnic_sriov_pf_enable(adapter, num_vfs);
if (!err) {
netdev_info(netdev, netdev_info(netdev,
"SR-IOV is enabled successfully on port %d\n", "SR-IOV is enabled successfully on port %d\n",
adapter->portnum); adapter->portnum);
/* Return number of vfs enabled */ /* Return number of vfs enabled */
err = num_vfs; return num_vfs;
} }
rtnl_lock();
if (netif_running(netdev)) if (netif_running(netdev))
__qlcnic_up(adapter, netdev); __qlcnic_down(adapter, netdev);
error: error:
if (!qlcnic_83xx_configure_opmode(adapter)) {
if (netif_running(netdev))
__qlcnic_up(adapter, netdev);
}
rtnl_unlock(); rtnl_unlock();
netdev_info(netdev, "Failed to enable SR-IOV on port %d\n",
adapter->portnum);
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment