net/virtio: fix kernel set owner for multi-queue devices
authorThierry Herbelot <thierry.herbelot@6wind.com>
Thu, 8 Apr 2021 12:37:29 +0000 (14:37 +0200)
committerFerruh Yigit <ferruh.yigit@intel.com>
Thu, 15 Apr 2021 12:46:43 +0000 (14:46 +0200)
Restore the original code, where VHOST_SET_OWNER is applied to
all vhostfds of the device.

Fixes: 06856cabb89b ("net/virtio: add virtio-user ops to set owner")
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 768db55..58e66bb 100644 (file)
@@ -101,9 +101,20 @@ vhost_kernel_ioctl(int fd, uint64_t request, void *arg)
 static int
 vhost_kernel_set_owner(struct virtio_user_dev *dev)
 {
+       int ret;
+       uint32_t i;
        struct vhost_kernel_data *data = dev->backend_data;
 
-       return vhost_kernel_ioctl(data->vhostfds[0], VHOST_SET_OWNER, NULL);
+       for (i = 0; i < dev->max_queue_pairs; ++i) {
+               if (data->vhostfds[i] < 0)
+                       continue;
+
+               ret = vhost_kernel_ioctl(data->vhostfds[i], VHOST_SET_OWNER, NULL);
+               if (ret < 0)
+                       return ret;
+       }
+
+       return 0;
 }
 
 static int