All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Duyck, Alexander H" <alexander.h.duyck@intel.com>
To: "Rustad, Mark D" <mark.d.rustad@intel.com>,
	"mst@redhat.com" <mst@redhat.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"virtualization@lists.linux-foundation.org"
	<virtualization@lists.linux-foundation.org>,
	"virtio-dev@lists.oasis-open.org"
	<virtio-dev@lists.oasis-open.org>,
	"Daly, Dan" <dan.daly@intel.com>,
	"Bie, Tiwei" <tiwei.bie@intel.com>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	"bhelgaas@google.com" <bhelgaas@google.com>,
	"Liang, Cunming" <cunming.liang@intel.com>,
	"Wang, Zhihong" <zhihong.wang@intel.com>
Subject: Re: [PATCH] virtio_pci: support enabling VFs
Date: Wed, 30 May 2018 16:54:35 +0000	[thread overview]
Message-ID: <1527699273.29907.2.camel@intel.com> (raw)
In-Reply-To: <414C18B1-30FA-4AC0-B47D-F0FBF9832737@intel.com>

On Wed, 2018-05-30 at 09:44 -0700, Rustad, Mark D wrote:
> On May 30, 2018, at 9:22 AM, Michael S. Tsirkin <mst@redhat.com> wrote:
> 
> > > +static int virtio_pci_sriov_configure(struct pci_dev *pci_dev, int  
> > > num_vfs)
> > > +{
> > > +	struct virtio_pci_device *vp_dev = pci_get_drvdata(pci_dev);
> > > +	struct virtio_device *vdev = &vp_dev->vdev;
> > > +	int (*sriov_configure)(struct pci_dev *pci_dev, int num_vfs);
> > > +
> > > +	if (!(vdev->config->get_status(vdev) & VIRTIO_CONFIG_S_DRIVER_OK))
> > > +		return -EBUSY;
> > > +
> > > +	if (!__virtio_test_bit(vdev, VIRTIO_F_SR_IOV))
> > > +		return -EINVAL;
> > > +
> > > +	sriov_configure = pci_sriov_configure_simple;
> > > +	if (sriov_configure == NULL)
> > > +		return -ENOENT;
> > 
> > BTW what is all this trickery in aid of?
> 
> When SR-IOV support is not compiled into the kernel,  
> pci_sriov_configure_simple is #defined as NULL. This allows it to compile  
> in that case, even though there is utterly no way for it to be called in  
> that case. It is an alternative to #ifs in the code.

Why even have the call though? I would wrap all of this in an #ifdef
and strip it out since you couldn't support SR-IOV if it isn't present
in the kernel anyway.

WARNING: multiple messages have this Message-ID (diff)
From: "Duyck, Alexander H" <alexander.h.duyck@intel.com>
To: "Rustad, Mark D" <mark.d.rustad@intel.com>,
	"mst@redhat.com" <mst@redhat.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"virtualization@lists.linux-foundation.org"
	<virtualization@lists.linux-foundation.org>,
	"virtio-dev@lists.oasis-open.org"
	<virtio-dev@lists.oasis-open.org>,
	"Daly, Dan" <dan.daly@intel.com>,
	"Bie, Tiwei" <tiwei.bie@intel.com>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	"bhelgaas@google.com" <bhelgaas@google.com>,
	"Liang, Cunming" <cunming.liang@intel.com>,
	"Wang, Zhihong" <zhihong.wang@intel.com>
Subject: Re: [PATCH] virtio_pci: support enabling VFs
Date: Wed, 30 May 2018 16:54:35 +0000	[thread overview]
Message-ID: <1527699273.29907.2.camel@intel.com> (raw)
In-Reply-To: <414C18B1-30FA-4AC0-B47D-F0FBF9832737@intel.com>

T24gV2VkLCAyMDE4LTA1LTMwIGF0IDA5OjQ0IC0wNzAwLCBSdXN0YWQsIE1hcmsgRCB3cm90ZToN
Cj4gT24gTWF5IDMwLCAyMDE4LCBhdCA5OjIyIEFNLCBNaWNoYWVsIFMuIFRzaXJraW4gPG1zdEBy
ZWRoYXQuY29tPiB3cm90ZToNCj4gDQo+ID4gPiArc3RhdGljIGludCB2aXJ0aW9fcGNpX3NyaW92
X2NvbmZpZ3VyZShzdHJ1Y3QgcGNpX2RldiAqcGNpX2RldiwgaW50ICANCj4gPiA+IG51bV92ZnMp
DQo+ID4gPiArew0KPiA+ID4gKwlzdHJ1Y3QgdmlydGlvX3BjaV9kZXZpY2UgKnZwX2RldiA9IHBj
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gYW4gYWx0ZXJuYXRpdmUgdG8gI2lmcyBpbiB0aGUg
Y29kZS4NCg0KV2h5IGV2ZW4gaGF2ZSB0aGUgY2FsbCB0aG91Z2g/IEkgd291bGQgd3JhcCBhbGwg
b2YgdGhpcyBpbiBhbiAjaWZkZWYNCmFuZCBzdHJpcCBpdCBvdXQgc2luY2UgeW91IGNvdWxkbid0
IHN1cHBvcnQgU1ItSU9WIGlmIGl0IGlzbid0IHByZXNlbnQNCmluIHRoZSBrZXJuZWwgYW55d2F5
Lg==

  reply	other threads:[~2018-05-30 16:54 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-30  8:55 [PATCH] virtio_pci: support enabling VFs Tiwei Bie
2018-05-30  8:55 ` [virtio-dev] " Tiwei Bie
2018-05-30 12:29 ` Stefan Hajnoczi
2018-05-30 12:29 ` Stefan Hajnoczi
2018-05-30 12:41 ` Michael S. Tsirkin
2018-05-30 12:41   ` [virtio-dev] " Michael S. Tsirkin
2018-05-30 12:41 ` Michael S. Tsirkin
2018-05-30 16:03 ` [virtio-dev] " Rustad, Mark D
2018-05-30 16:09   ` Michael S. Tsirkin
2018-05-30 16:09     ` Michael S. Tsirkin
2018-05-31  2:55     ` Tiwei Bie
2018-05-31  2:55       ` Tiwei Bie
2018-06-01  1:21       ` Michael S. Tsirkin
2018-06-01  1:21       ` Michael S. Tsirkin
2018-06-01  1:21         ` Michael S. Tsirkin
2018-06-01  1:36         ` Tiwei Bie
2018-06-01  1:36           ` Tiwei Bie
2018-06-01  1:36         ` Tiwei Bie
2018-05-31  2:55     ` Tiwei Bie
2018-05-30 16:09   ` Michael S. Tsirkin
2018-05-30 16:03 ` Rustad, Mark D
2018-05-30 16:10 ` Alexander Duyck
2018-05-30 16:10   ` Alexander Duyck
2018-05-30 16:22   ` Michael S. Tsirkin
2018-05-30 16:22   ` Michael S. Tsirkin
2018-05-30 16:22     ` Michael S. Tsirkin
2018-05-30 16:26     ` Duyck, Alexander H
2018-05-30 16:26     ` Duyck, Alexander H
2018-05-30 16:26       ` Duyck, Alexander H
2018-05-30 17:15       ` Michael S. Tsirkin
2018-05-30 17:15       ` Michael S. Tsirkin
2018-05-30 17:15         ` Michael S. Tsirkin
2018-05-30 16:10 ` Alexander Duyck
2018-05-30 16:22 ` Michael S. Tsirkin
2018-05-30 16:22   ` [virtio-dev] " Michael S. Tsirkin
2018-05-30 16:44   ` Rustad, Mark D
2018-05-30 16:44     ` [virtio-dev] " Rustad, Mark D
2018-05-30 16:44     ` Rustad, Mark D
2018-05-30 16:54     ` Duyck, Alexander H [this message]
2018-05-30 16:54       ` Duyck, Alexander H
2018-05-30 17:11       ` Rustad, Mark D
2018-05-30 17:11         ` [virtio-dev] " Rustad, Mark D
2018-05-30 17:11         ` Rustad, Mark D
2018-05-31  3:20         ` Tiwei Bie
2018-05-31  3:20           ` [virtio-dev] " Tiwei Bie
2018-05-31 14:27           ` Alexander Duyck
2018-05-31 14:27           ` Alexander Duyck
2018-05-31 14:27             ` [virtio-dev] " Alexander Duyck
2018-06-01  2:30             ` Tiwei Bie
2018-06-01  2:30             ` Tiwei Bie
2018-06-01  2:30               ` [virtio-dev] " Tiwei Bie
2018-05-31  3:20         ` Tiwei Bie
2018-05-30 16:54     ` Duyck, Alexander H
2018-05-30 16:22 ` Michael S. Tsirkin
  -- strict thread matches above, loose matches on Subject: below --
2018-05-30  8:55 Tiwei Bie

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=1527699273.29907.2.camel@intel.com \
    --to=alexander.h.duyck@intel.com \
    --cc=bhelgaas@google.com \
    --cc=cunming.liang@intel.com \
    --cc=dan.daly@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mark.d.rustad@intel.com \
    --cc=mst@redhat.com \
    --cc=tiwei.bie@intel.com \
    --cc=virtio-dev@lists.oasis-open.org \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=zhihong.wang@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.