On Wed, Jan 12, 2022 at 2:51 PM Jakub Kicinski [off-list ref] wrote:
On Sun, 9 Jan 2022 17:56:31 -0800 Dimitris Michailidis wrote:
quoted
+static int funeth_sriov_configure(struct pci_dev *pdev, int nvfs)
+{
+ struct fun_dev *fdev = pci_get_drvdata(pdev);
+ struct fun_ethdev *ed = to_fun_ethdev(fdev);
+ int rc;
+
+ if (nvfs == 0) {
+ if (pci_vfs_assigned(pdev)) {
+ dev_warn(&pdev->dev,
+ "Cannot disable SR-IOV while VFs are assigned\n");
+ return -EPERM;
+ }
+
+ pci_disable_sriov(pdev);
+ fun_free_vports(ed);
+ return 0;
+ }
+
+ rc = fun_init_vports(ed, nvfs);
+ if (rc)
+ return rc;
Also likely needs locking, not that sriov callback is called with
device lock held and VF configuration with rtnl_lock(), they can
run in parallel.
Yes, I think you're right. I am adding locking.