From ed18d4c7ee69140723754ae8fe381927dfaab075 Mon Sep 17 00:00:00 2001 From: Laurent Vivier Date: Fri, 5 Sep 2025 17:49:34 +0200 Subject: udp_vu: Pass virtqueue pointer to udp_vu_sock_recv() Pass the virtqueue pointer to udp_vu_sock_recv() to enable proper queue selection for multiqueue support. This ensures that received packets are processed on the same virtqueue as the caller. Signed-off-by: Laurent Vivier Reviewed-by: David Gibson Signed-off-by: Stefano Brivio --- udp_vu.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/udp_vu.c b/udp_vu.c index 2fb7b90..099677f 100644 --- a/udp_vu.c +++ b/udp_vu.c @@ -60,16 +60,17 @@ static size_t udp_vu_hdrlen(bool v6) /** * udp_vu_sock_recv() - Receive datagrams from socket into vhost-user buffers * @c: Execution context + * @vq: virtqueue to use to receive data * @s: Socket to receive from * @v6: Set for IPv6 connections * @dlen: Size of received data (output) * * Return: number of iov entries used to store the datagram */ -static int udp_vu_sock_recv(const struct ctx *c, int s, bool v6, ssize_t *dlen) +static int udp_vu_sock_recv(const struct ctx *c, struct vu_virtq *vq, int s, + bool v6, ssize_t *dlen) { - struct vu_dev *vdev = c->vdev; - struct vu_virtq *vq = &vdev->vq[VHOST_USER_RX_QUEUE]; + const struct vu_dev *vdev = c->vdev; int iov_cnt, idx, iov_used; struct msghdr msg = { 0 }; size_t off, hdrlen; @@ -210,7 +211,7 @@ void udp_vu_sock_to_tap(const struct ctx *c, int s, int n, flow_sidx_t tosidx) ssize_t dlen; int iov_used; - iov_used = udp_vu_sock_recv(c, s, v6, &dlen); + iov_used = udp_vu_sock_recv(c, vq, s, v6, &dlen); if (iov_used <= 0) break; -- cgit v1.2.3