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: Rajesh Borundia <rajesh.borundia@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Rajesh Borundia 2014-05-09 02:51:29 -04:00 committed by David S. Miller
parent a3ab3c13f1
commit 132a3f2bee
3 changed files with 24 additions and 17 deletions

View File

@ -2398,9 +2398,6 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
int err, pci_using_dac = -1;
char board_name[QLCNIC_MAX_BOARD_NAME_LEN + 19]; /* MAC + ": " + name */
if (pdev->is_virtfn)
return -ENODEV;
err = pci_enable_device(pdev);
if (err)
return err;
@ -2680,9 +2677,9 @@ static void qlcnic_remove(struct pci_dev *pdev)
return;
netdev = adapter->netdev;
qlcnic_sriov_pf_disable(adapter);
qlcnic_cancel_idc_work(adapter);
qlcnic_sriov_pf_disable(adapter);
ahw = adapter->ahw;
unregister_netdev(netdev);

View File

@ -198,7 +198,7 @@ int qlcnic_sriov_init(struct qlcnic_adapter *adapter, int num_vfs)
}
sriov->vf_info[i].vp = vp;
vp->max_tx_bw = MAX_BW;
vp->spoofchk = true;
vp->spoofchk = false;
random_ether_addr(vp->mac);
dev_info(&adapter->pdev->dev,
"MAC Address %pM is configured for VF %d\n",

View File

@ -472,12 +472,12 @@ static int qlcnic_pci_sriov_disable(struct qlcnic_adapter *adapter)
return -EPERM;
}
qlcnic_sriov_pf_disable(adapter);
rtnl_lock();
if (netif_running(netdev))
__qlcnic_down(adapter, netdev);
qlcnic_sriov_pf_disable(adapter);
qlcnic_sriov_free_vlans(adapter);
qlcnic_sriov_pf_cleanup(adapter);
@ -596,7 +596,6 @@ static int __qlcnic_pci_sriov_enable(struct qlcnic_adapter *adapter,
qlcnic_sriov_alloc_vlans(adapter);
err = qlcnic_sriov_pf_enable(adapter, num_vfs);
return err;
del_flr_queue:
@ -627,25 +626,36 @@ static int qlcnic_pci_sriov_enable(struct qlcnic_adapter *adapter, int num_vfs)
__qlcnic_down(adapter, netdev);
err = __qlcnic_pci_sriov_enable(adapter, num_vfs);
if (err) {
netdev_info(netdev, "Failed to enable SR-IOV on port %d\n",
adapter->portnum);
if (err)
goto error;
err = -EIO;
if (qlcnic_83xx_configure_opmode(adapter))
goto error;
} else {
if (netif_running(netdev))
__qlcnic_up(adapter, netdev);
rtnl_unlock();
err = qlcnic_sriov_pf_enable(adapter, num_vfs);
if (!err) {
netdev_info(netdev,
"SR-IOV is enabled successfully on port %d\n",
adapter->portnum);
/* Return number of vfs enabled */
err = num_vfs;
return num_vfs;
}
rtnl_lock();
if (netif_running(netdev))
__qlcnic_up(adapter, netdev);
__qlcnic_down(adapter, netdev);
error:
if (!qlcnic_83xx_configure_opmode(adapter)) {
if (netif_running(netdev))
__qlcnic_up(adapter, netdev);
}
rtnl_unlock();
netdev_info(netdev, "Failed to enable SR-IOV on port %d\n",
adapter->portnum);
return err;
}