vhost: drop virtqueues only with built-in virtio driver
authorStefan Hajnoczi <stefanha@redhat.com>
Wed, 31 Jan 2018 17:46:51 +0000 (17:46 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Mon, 5 Feb 2018 14:11:19 +0000 (15:11 +0100)
Commit e29109323595beb3884da58126ebb3b878cb66f5 ("vhost: destroy unused
virtqueues when multiqueue not negotiated") broke vhost-scsi by removing
virtqueues when the virtio-net-specific VIRTIO_NET_F_MQ feature bit is
missing.

The vhost_user.c code shouldn't assume all devices are vhost net device
backends.  Use the new VIRTIO_DEV_BUILTIN_VIRTIO_NET flag to check
whether virtio_net.c is being used.

This fixes examples/vhost_scsi.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Acked-by: Yuanhan Liu <yliu@fridaylinux.org>
lib/librte_vhost/vhost_user.c

index 1dd1a61..65ee339 100644 (file)
@@ -187,7 +187,8 @@ vhost_user_set_features(struct virtio_net *dev, uint64_t features)
                (dev->features & (1 << VIRTIO_NET_F_MRG_RXBUF)) ? "on" : "off",
                (dev->features & (1ULL << VIRTIO_F_VERSION_1)) ? "on" : "off");
 
-       if (!(dev->features & (1ULL << VIRTIO_NET_F_MQ))) {
+       if ((dev->flags & VIRTIO_DEV_BUILTIN_VIRTIO_NET) &&
+           !(dev->features & (1ULL << VIRTIO_NET_F_MQ))) {
                /*
                 * Remove all but first queue pair if MQ hasn't been
                 * negotiated. This is safe because the device is not