linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Keith Busch <keith.busch@intel.com>
Cc: linux-nvme@lists.infradead.org, Jens Axboe <axboe@fb.com>,
	linux-pci@vger.kernel.org
Subject: Re: [PATCH] nvme/pci: Provide SR-IOV support
Date: Thu, 12 May 2016 07:38:10 -0700	[thread overview]
Message-ID: <20160512143810.GA23358@infradead.org> (raw)
In-Reply-To: <1463062410-10009-1-git-send-email-keith.busch@intel.com>

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.

           reply	other threads:[~2016-05-12 14:38 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <1463062410-10009-1-git-send-email-keith.busch@intel.com>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160512143810.GA23358@infradead.org \
    --to=hch@infradead.org \
    --cc=axboe@fb.com \
    --cc=keith.busch@intel.com \
    --cc=linux-nvme@lists.infradead.org \
    --cc=linux-pci@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).