net/virtio: fix kernel set features for multi-queue device
authorThierry Herbelot <thierry.herbelot@6wind.com>
Fri, 28 May 2021 13:20:38 +0000 (15:20 +0200)
committerChenbo Xia <chenbo.xia@intel.com>
Wed, 23 Jun 2021 07:55:27 +0000 (09:55 +0200)
Restore the original code, where VHOST_SET_FEATURES is applied to
all vhostfds of the device.

Fixes: cc0151b34dee ("net/virtio: add virtio-user features ops")
Cc: stable@dpdk.org
Signed-off-by: Thierry Herbelot <thierry.herbelot@6wind.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
drivers/net/virtio/virtio_user/vhost_kernel.c

index ad46f10..d65f89e 100644 (file)
@@ -158,6 +158,8 @@ static int
 vhost_kernel_set_features(struct virtio_user_dev *dev, uint64_t features)
 {
        struct vhost_kernel_data *data = dev->backend_data;
+       uint32_t i;
+       int ret;
 
        /* We don't need memory protection here */
        features &= ~(1ULL << VIRTIO_F_IOMMU_PLATFORM);
@@ -166,7 +168,16 @@ vhost_kernel_set_features(struct virtio_user_dev *dev, uint64_t features)
        features &= ~VHOST_KERNEL_HOST_OFFLOADS_MASK;
        features &= ~(1ULL << VIRTIO_NET_F_MQ);
 
-       return vhost_kernel_ioctl(data->vhostfds[0], VHOST_SET_FEATURES, &features);
+       for (i = 0; i < dev->max_queue_pairs; ++i) {
+               if (data->vhostfds[i] < 0)
+                       continue;
+
+               ret = vhost_kernel_ioctl(data->vhostfds[i], VHOST_SET_FEATURES, &features);
+               if (ret < 0)
+                       return ret;
+       }
+
+       return 0;
 }
 
 static int