net/virtio: fix vhost_kernel_set_owner for multi-queue devices
PATCH 1/1 net/virtio: fix vhost_kernel_set_owner for multi-queue devices
Restore the original code, where VHOST_SET_OWNER is applied to all vhostfds of the device.
--- drivers/net/virtio/virtio_user/vhost_kernel.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/net/virtio/virtio_user/vhost_kernel.c +12 -1
@@ -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
Signature · 1 line
2.29.2
Hi Thierry,
Quoted 28 lines · Thierry Herbelot
Restore the original code, where
VHOST_SET_OWNERis applied to all vhostfds of the device.Fixes 06856cabb89b0 ("net/virtio: add virtio-user ops to set owner")Cc Maxime Coquelin <[email protected]>Cc Chenbo Xia <[email protected]>Signed-off-by Thierry Herbelot <[email protected]>--- drivers/net/virtio/virtio_user/vhost_kernel.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)drivers/net/virtio/virtio_user/vhost_kernel.c +5
-1@@ -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 ;
drivers/net/virtio/virtio_user/vhost_kernel.c vhost_kernel_ioctl(int fd, uint64_t request, void *arg) · line 120
Quoted 10 lines
drivers/net/virtio/virtio_user/vhost_kernel.c +7
-0+ + ret =vhost_kernel_ioctl (data->vhostfds[i],VHOST_SET_OWNER ,NULL ); +if (ret <0 ) +return ret; + } + +return 0 ; } static int
Thanks for the fix, we indeed have to set owner for all the queue pairs.
Thanks,
Maxime
Ferruh Yigit
AppliedQuoted 39 lines · Maxime Coquelin
Hi Thierry,
Quoted 36 lines · Thierry Herbelot
Restore the original code, where
VHOST_SET_OWNERis applied to all vhostfds of the device.Fixes 06856cabb89b0 ("net/virtio: add virtio-user ops to set owner")Cc Maxime Coquelin <[email protected]>Cc Chenbo Xia <[email protected]>Signed-off-by Thierry Herbelot <[email protected]>--- drivers/net/virtio/virtio_user/vhost_kernel.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)drivers/net/virtio/virtio_user/vhost_kernel.c +12
-1@@ -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 ; }
Quoted 7 lines
drivers/net/virtio/virtio_user/vhost_kernel.c vhost_kernel_ioctl(int fd, uint64_t request, void *arg) · line 120
Quoted 2 lines
drivers/net/virtio/virtio_user/vhost_kernel.c +0
-0static intThanks for the fix, we indeed have to set owner for all the queue pairs.
Reviewed-by Maxime Coquelin <[email protected]>
Applied to dpdk-next-net/main, thanks.