Skip to content

Commit

Permalink
net: ena: Use pci_sriov_configure_simple() to enable VFs
Browse files Browse the repository at this point in the history
Instead of implementing our own version of a SR-IOV configuration stub in
the ena driver, use the existing pci_sriov_configure_simple() function.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
  • Loading branch information
Alexander Duyck authored and Bjorn Helgaas committed Apr 24, 2018
1 parent a8ccf8a commit 115ddc4
Showing 1 changed file with 1 addition and 27 deletions.
28 changes: 1 addition & 27 deletions drivers/net/ethernet/amazon/ena/ena_netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -3385,32 +3385,6 @@ static int ena_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
return rc;
}

/*****************************************************************************/
static int ena_sriov_configure(struct pci_dev *dev, int numvfs)
{
int rc;

if (numvfs > 0) {
rc = pci_enable_sriov(dev, numvfs);
if (rc != 0) {
dev_err(&dev->dev,
"pci_enable_sriov failed to enable: %d vfs with the error: %d\n",
numvfs, rc);
return rc;
}

return numvfs;
}

if (numvfs == 0) {
pci_disable_sriov(dev);
return 0;
}

return -EINVAL;
}

/*****************************************************************************/
/*****************************************************************************/

/* ena_remove - Device Removal Routine
Expand Down Expand Up @@ -3526,7 +3500,7 @@ static struct pci_driver ena_pci_driver = {
.suspend = ena_suspend,
.resume = ena_resume,
#endif
.sriov_configure = ena_sriov_configure,
.sriov_configure = pci_sriov_configure_simple,
};

static int __init ena_init(void)
Expand Down

0 comments on commit 115ddc4

Please sign in to comment.