linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Duyck <alexander.h.duyck@intel.com>
To: Edward Cree <ecree@solarflare.com>, linux-pci@vger.kernel.org
Cc: Don Dutile <ddutile@redhat.com>, Bjorn Helgaas <bhelgaas@google.com>
Subject: Re: [PATCH] PCI: handle pci_sriov_set_totalvfs(dev, 0)
Date: Thu, 31 Jul 2014 08:21:24 -0700	[thread overview]
Message-ID: <53DA5EF4.1030500@intel.com> (raw)
In-Reply-To: <alpine.LFD.2.03.1407311500570.16821@solarflare.com>

On 07/31/2014 07:24 AM, Edward Cree wrote:
> Make a driver_max_VFs of 0 mean 0, instead of total_VFs as previously.
> Initialise driver_max_VFs to total_VFs instead of 0.
> 
> Signed-off-by: Edward Cree <ecree@solarflare.com>
> ---
> Only existing callers are ixgbe and igb, and neither passes 0, so this
> doesn't break existing users.
> ---
>  drivers/pci/iov.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
> index cb6f247..fb51467 100644
> --- a/drivers/pci/iov.c
> +++ b/drivers/pci/iov.c
> @@ -381,7 +381,7 @@ found:
>         iov->pos = pos;
>         iov->nres = nres;
>         iov->ctrl = ctrl;
> -       iov->total_VFs = total;
> +       iov->driver_max_VFs = iov->total_VFs = total;
>         iov->offset = offset;
>         iov->stride = stride;
>         iov->pgsz = pgsz;
> @@ -686,9 +686,6 @@ int pci_sriov_get_totalvfs(struct pci_dev *dev)
>         if (!dev->is_physfn)
>                 return 0;
> 
> -       if (dev->sriov->driver_max_VFs)
> -               return dev->sriov->driver_max_VFs;
> -
> -       return dev->sriov->total_VFs;
> +       return dev->sriov->driver_max_VFs;
>  }
>  EXPORT_SYMBOL_GPL(pci_sriov_get_totalvfs);


This change is mostly harmless so I am not concerned with any effects on
igb or ixgbe.  In the grand scheme of things it should also drop a few
lines of code which is always good.

However if you are wanting to use this as a way to disable SR-IOV for a
device I wouldn't recommend it.  Based on what you have described I
would suggest dropping the fix in drivers/pci/quirks that would clear
dev->is_physfn if you are in the PF-IOV mode.  That way the SR-IOV
functionality should be fully disabled.  In addition this solution would
also resolve the fact that the driver wouldn't actually have to be
loaded for it to work so if someone were to load a driver that didn't
contain the fix they would be blocked from enabling SR-IOV as well.

Thanks,

Alex


  reply	other threads:[~2014-07-31 15:23 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <53D9288B.5030302@solarflare.com>
2014-07-30 18:05 ` pci_sriov_set_totalvfs again Don Dutile
2014-07-30 18:24   ` Edward Cree
2014-07-30 21:14     ` Alexander Duyck
2014-07-31 12:07       ` Edward Cree
2014-07-31 14:24         ` [PATCH] PCI: handle pci_sriov_set_totalvfs(dev, 0) Edward Cree
2014-07-31 15:21           ` Alexander Duyck [this message]
2014-07-31 15:56             ` Edward Cree
2014-07-31 16:40               ` Alexander Duyck
2014-07-31 16:57                 ` Edward Cree
2014-07-31 17:53                   ` Don Dutile
2014-07-31 18:13                     ` Edward Cree
2014-08-04 14:03                       ` Edward Cree
2014-08-04 14:37                         ` Alexander Duyck
2014-08-04 15:22                           ` Edward Cree
2014-08-06  9:38                           ` Don Dutile
2014-07-31 17:55                   ` Alexander Duyck
2014-07-31 18:24                     ` Edward Cree
2014-08-01  3:18               ` Ethan Zhao
2014-08-01 11:51                 ` Edward Cree
2014-08-02  0:34                   ` Ethan Zhao
2014-08-01  3:51           ` Ethan Zhao
2014-08-01 12:15             ` Edward Cree
2014-08-02  0:25               ` Ethan Zhao
2014-08-04 15:45                 ` Edward Cree
2014-08-04 16:40                   ` Alexander Duyck
2014-08-04 17:08                     ` Edward Cree
2014-08-04  6:53               ` Sathya Perla

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=53DA5EF4.1030500@intel.com \
    --to=alexander.h.duyck@intel.com \
    --cc=bhelgaas@google.com \
    --cc=ddutile@redhat.com \
    --cc=ecree@solarflare.com \
    --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).