From: David Gibson <david@gibson.dropbear.id.au>
To: Laurent Vivier <lvivier@redhat.com>
Cc: passt-dev@passt.top
Subject: Re: [PATCH 2/3] udp_vu: Pass virtqueue pointer to udp_vu_sock_recv()
Date: Mon, 8 Sep 2025 11:59:52 +1000 [thread overview]
Message-ID: <aL44mCqiPb8bwyWD@zatzit> (raw)
In-Reply-To: <20250905154935.389634-3-lvivier@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 2054 bytes --]
On Fri, Sep 05, 2025 at 05:49:34PM +0200, Laurent Vivier wrote:
> 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 <lvivier@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Regardless of future plans, I think it's cleaner to pass the vq than
to rederive it.
> ---
> udp_vu.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/udp_vu.c b/udp_vu.c
> index 2fb7b900ca31..099677f914e7 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;
>
> --
> 2.50.1
>
--
David Gibson (he or they) | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you, not the other way
| around.
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2025-09-08 2:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-05 15:49 [PATCH 0/3] This series contains fixes and improvements to the vhost-user implementation Laurent Vivier
2025-09-05 15:49 ` [PATCH 1/3] vhost-user: Fix VHOST_USER_GET_QUEUE_NUM to return number of queues Laurent Vivier
2025-09-08 1:58 ` David Gibson
2025-09-05 15:49 ` [PATCH 2/3] udp_vu: Pass virtqueue pointer to udp_vu_sock_recv() Laurent Vivier
2025-09-08 1:59 ` David Gibson [this message]
2025-09-05 15:49 ` [PATCH 3/3] tcp_vu: Pass virtqueue pointer to tcp_vu_sock_recv() Laurent Vivier
2025-09-08 2:00 ` David Gibson
2025-09-09 20:24 ` [PATCH 0/3] This series contains fixes and improvements to the vhost-user implementation Stefano Brivio
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aL44mCqiPb8bwyWD@zatzit \
--to=david@gibson.dropbear.id.au \
--cc=lvivier@redhat.com \
--cc=passt-dev@passt.top \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://passt.top/passt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).