From 3c503b24f8a3a7a8d3c78b90fe7f288e68012510 Mon Sep 17 00:00:00 2001 From: Thierry Herbelot Date: Thu, 8 Apr 2021 14:37:29 +0200 Subject: [PATCH] net/virtio: fix kernel set owner for multi-queue devices 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 Reviewed-by: Maxime Coquelin --- drivers/net/virtio/virtio_user/vhost_kernel.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/net/virtio/virtio_user/vhost_kernel.c b/drivers/net/virtio/virtio_user/vhost_kernel.c index 768db55a6c..58e66bb7b4 100644 --- a/drivers/net/virtio/virtio_user/vhost_kernel.c +++ b/drivers/net/virtio/virtio_user/vhost_kernel.c @@ -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 -- 2.20.1