linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] nvme/pci: Provide SR-IOV support
       [not found] <1463062410-10009-1-git-send-email-keith.busch@intel.com>
@ 2016-05-12 14:38 ` Christoph Hellwig
  0 siblings, 0 replies; only message in thread
From: Christoph Hellwig @ 2016-05-12 14:38 UTC (permalink / raw)
  To: Keith Busch; +Cc: linux-nvme, Jens Axboe, linux-pci

On Thu, May 12, 2016 at 08:13:30AM -0600, Keith Busch wrote:
> This registers a standard boiler-plate sr-iov callback for nvme.

No real reason not to add it, but..


> +static int nvme_pci_sriov_configure(struct pci_dev *pdev, int numvfs)
> +{
> +	int ret = 0;
> +
> +	if (!pdev->is_physfn)
> +		return -EPERM;

pci_enable_sriov / pci_disable_sriov already check this.

> +	if (numvfs == 0) {
> +		if (pci_vfs_assigned(pdev)) {
> +			dev_warn(&pdev->dev,
> +				"Cannot disable SR-IOV VFs while assigned\n");
> +			return -EPERM;
> +		}

And pci_disable_sriov really should check this.

> +		pci_disable_sriov(pdev);
> +	} else
> +		ret = pci_enable_sriov(pdev, numvfs);

And these calls really should be done in common code.  At that point
there will be a whole lot less driver involvement with SR-IOV which
shouldn't exist, and we can split the callback into two for enable vs
disable instead of the overload that each driver then needs to
demultiplex.

I guess I can't just burden the second half on you, but at least
removing the first check and moving the second to the core would seem
like a good start.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-05-12 14:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1463062410-10009-1-git-send-email-keith.busch@intel.com>
2016-05-12 14:38 ` [PATCH] nvme/pci: Provide SR-IOV support Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).