From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202508 header.b=pwACCE0d; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 593075A0279 for ; Mon, 08 Sep 2025 04:00:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202508; t=1757296826; bh=85/X9yBGbmHFHbr55xDJTgrxb57aJhiOSZ5msQ4ibLI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=pwACCE0dhJDuko3JoSSoewBNW64dG0ig4doybX6yTbiHtP/Nx4/7stwTU/TOV1U45 vRrOUsdtyHhNFrxlxsTqXkYxC+klEJWguUQWlTTx4/VeshlSFBxfXMCOfJQxCtrgK5 U/JyhzQgHRLimTUSn2YqpdhYBC8AOGH1S4C0PeTyAeXyho0EaPDFklr4CxDRgEjuEW +cy7k4aVdgRyd6RMMp074opvpiJRcbAVtCacVr/Wrlhi2Na/rSIn5pe9dPwyyU0Rps zfS0Yrpu/Rim6kw1fbQtXjVaUdGm1TsRVziCZTsibc+LqFiZJ7pL7flyqerHPfLgLv NAmC4Lu2ZnYIg== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4cKqsk2FCmz4wBJ; Mon, 8 Sep 2025 12:00:26 +1000 (AEST) Date: Mon, 8 Sep 2025 11:59:52 +1000 From: David Gibson To: Laurent Vivier Subject: Re: [PATCH 2/3] udp_vu: Pass virtqueue pointer to udp_vu_sock_recv() Message-ID: References: <20250905154935.389634-1-lvivier@redhat.com> <20250905154935.389634-3-lvivier@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="+qMAA1DDjioEwLf7" Content-Disposition: inline In-Reply-To: <20250905154935.389634-3-lvivier@redhat.com> Message-ID-Hash: IUYUP6O7CB2MCPVDN6ONBCZ34MNGRLHO X-Message-ID-Hash: IUYUP6O7CB2MCPVDN6ONBCZ34MNGRLHO X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --+qMAA1DDjioEwLf7 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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. >=20 > Signed-off-by: Laurent Vivier Reviewed-by: David Gibson 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(-) >=20 > 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 bu= ffers > * @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, in= t s, > + bool v6, ssize_t *dlen) > { > - struct vu_dev *vdev =3D c->vdev; > - struct vu_virtq *vq =3D &vdev->vq[VHOST_USER_RX_QUEUE]; > + const struct vu_dev *vdev =3D c->vdev; > int iov_cnt, idx, iov_used; > struct msghdr msg =3D { 0 }; > size_t off, hdrlen; > @@ -210,7 +211,7 @@ void udp_vu_sock_to_tap(const struct ctx *c, int s, i= nt n, flow_sidx_t tosidx) > ssize_t dlen; > int iov_used; > =20 > - iov_used =3D udp_vu_sock_recv(c, s, v6, &dlen); > + iov_used =3D udp_vu_sock_recv(c, vq, s, v6, &dlen); > if (iov_used <=3D 0) > break; > =20 > --=20 > 2.50.1 >=20 --=20 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 --+qMAA1DDjioEwLf7 Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmi+OJcACgkQzQJF27ox 2GfWig/8Du+wnOQLPN0lcVrb5dNlk0u+uz1TP6brRDze8VlxSATAZjfxedEWLgBC IRfYEaOI0gvPfR6ChmCjRZHTCFDOI/J3L1X9+HTvpYC9GZObpE3hKa0UYun4kfN+ RZn8snDRo+tA4J79Z7QhePrAA5ytTERiLHX6yosAQCtaVQhcPF80iKct7BZU94h1 0WtYATvVRg7ictRlcyERImzHR05PbhromURiv3sp8Zpqo3zNc3O80kYRoYrEVnc7 lBB3y3LzCEP2ecnKn/ATmMet3Uf4eWf3oMRX/ojY71RLEbYAApLriZmw3T1/0BzN J1OcRjUEUtCPG5TuyOOsDv+r/noQ3PY3bnnSJkP38JK0C6epy6QOWsy1SYIoQG5c a1HAGOPmgCunUqdQ01B/dbaz4fnHNyocR/tLPzwtVeQ2/dB2qaWLYgzc+M1DDHBT rtxiJhFdOB2a+Lf+T9moCuh7aWDxNGqW0PQQ7IRVSzppFwrMIfdDbUdyZPkwg1ix My+r4Sm26P7Q4Cl0fXKv8IvDWEH71+2EnpuaUd9XPbgI2cYLI99hWAfZclQ22UnN r6fBicX/d+dwKtX+AYmGnmyeAmGtDZkX8PfAEXpV2cOhOqFrMTq84ScG9eX7qCoZ 04oij742g1vu0PBYt4J1de6CGAOoVMkGelHQt2mzMlpt9e0NFbQ= =T5YO -----END PGP SIGNATURE----- --+qMAA1DDjioEwLf7--