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)
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);
......
......@@ -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",
......
......@@ -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;
}
......
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