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=202602 header.b=g4R6cZdz; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 7EA825A0265 for ; Mon, 11 May 2026 12:44:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202602; t=1778496287; bh=ZhlWUL3JVTmjyrDfpNrWxvV3wS6byCugnPX1Mh2beyI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=g4R6cZdzR1k1kDTMK7I+7ln4FOLW8ncYzdRVcZYyTYqdSZM/MCxEVLVQw1JNzHxqo vHritlX6FJW3MQhGJ8yR9dWBYJJsnaGPDvYo/w+9n8G2/ZRv0kzCHFHqTTjXCr7uhZ Kr5QrNc9gzItaR0T7v8X7wQtDVNTg8x/fozMwkSNVV8F1hfdHN/ZXCImHVF35TI+2f AeN/9fsVAzXxgUKhpqOtaXclfFrbyuvQ/Bd2GFNLUAxYYWULD821VGrFempTncLR5b 8t0ksA5KDg+M1CZu1bmxn0J8rd6p+sEgDcGjuINr1DPIDbmxkDLmkr7egJyGd7fp6Q 417Yr39b+PavA== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4gDbvg1LL0z4w2D; Mon, 11 May 2026 20:44:47 +1000 (AEST) Date: Mon, 11 May 2026 20:44:39 +1000 From: David Gibson To: Jon Maloy Subject: Re: [PATCH v3 04/10] udp_vu: Move virtqueue management from udp_vu_sock_recv() to its caller Message-ID: References: <20260416155721.3807225-1-lvivier@redhat.com> <20260416155721.3807225-5-lvivier@redhat.com> <93635d2b-0e17-4285-8089-cd7e3f7b6ad1@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="ss2whv3n1FvFaiaw" Content-Disposition: inline In-Reply-To: <93635d2b-0e17-4285-8089-cd7e3f7b6ad1@redhat.com> Message-ID-Hash: CW7UIOG5GTDH4LX4MOASZR3UBFKZO7AN X-Message-ID-Hash: CW7UIOG5GTDH4LX4MOASZR3UBFKZO7AN 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: Laurent Vivier , 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: --ss2whv3n1FvFaiaw Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, May 11, 2026 at 05:30:33AM -0400, Jon Maloy wrote: >=20 >=20 > On 2026-04-16 11:57, Laurent Vivier wrote: > > udp_vu_sock_recv() currently mixes two concerns: receiving data from the > > socket and managing virtqueue buffers (collecting, rewinding, releasing= ). > > This makes the function harder to reason about and couples socket I/O > > with virtqueue state. > >=20 > > Move all virtqueue operations, vu_collect(), vu_init_elem(), > > vu_queue_rewind(), vu_set_vnethdr(), and the queue-readiness check, into > > udp_vu_sock_to_tap(), which is the only caller. This turns > > udp_vu_sock_recv() into a pure socket receive function that simply reads > > into the provided iov array and adjusts its length. > >=20 > > Signed-off-by: Laurent Vivier > > Reviewed-by: David Gibson >=20 > Reviewed-by: Jon Maloy >=20 > see below. >=20 > > --- > > udp_vu.c | 98 +++++++++++++++++++++++++++++--------------------------- > > 1 file changed, 50 insertions(+), 48 deletions(-) > >=20 > > diff --git a/udp_vu.c b/udp_vu.c > > index f8629af58ab5..bd9fd5abb971 100644 > > --- a/udp_vu.c > [...] > > + > > + if (!vu_queue_enabled(vq) || !vu_queue_started(vq)) { > > + struct msghdr msg =3D { 0 }; > > + > > + debug("Got UDP packet, but RX virtqueue not usable yet"); > > + > > + for (i =3D 0; i < n; i++) { > > + if (recvmsg(s, &msg, MSG_DONTWAIT) < 0) > > + debug_perror("Failed to discard datagram"); > > + } > > + > > + return; > > + } > > + > > for (i =3D 0; i < n; i++) { > > + unsigned elem_cnt, elem_used; >=20 > unsigned int is standard in our code, I think. I think Laurent has usually used 'unsigned int', but I've usually used 'unsigned'. --=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 --ss2whv3n1FvFaiaw Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmoBswYACgkQzQJF27ox 2GdxAg/+IzqQ8zBSgBRiOyRK0ZEzF/mgeyjqAYsYn+sZStzaaKkGHaDXc8lNN/FV UBAsJs1HBsylXBj6SrgQqtAGHmxIneVkFxlKBWC/EA+rsq2iPqNSQfRU5SKW2qjC 2hegg8LA2O9f1+DWQHUYqWM+Sy9SmmsKbLrj48wYLh0eyOAMHx3zQdNRDepRzeeP qioH+wbq8kqD5RFJSlxdq8gzyXEyb95iHK74q2LprZv2ZykdIFBKcJ4wDQc65hZt oir3vXvjv9qN/gtdVTRdKILDaBNFSEfxlYskxDC9Hzi036qzEvSZjd1T8D94rZHH b9SWchHWDzc/j2J8kDt5zCwhMuI9RGIJ1pCBsfkskwkXGDFE6bAHZ1P3Z62P/K8F 5p5STfgoA4KEFwfoQCrlJheWFdafmhG31xRZH2wWUdA7kvazyFaMwBjHwPZMUfb+ uTWDYadhP87jJWUlhy0a/F/p4Tgg5k0zdaXZ6ILjcpnwFa6r6EPwWhysnru1HsX+ 4ZT7OaUSxjlfZCv3uo7gslHZvwYJT8Q4C02UGxx6b1TMDDBSutOHsC8SINApF+ki HW2bgzSyJ0GfXxp/mkXBV1MFzm97F9r6K2pK0eojAl9VjegvM3H1EH0EzOO0yXdo kUUJzn+gVXNPbg47aPK5wTed4bbBggcBS47KczrS0vCWC9G4Rk8= =Ve8E -----END PGP SIGNATURE----- --ss2whv3n1FvFaiaw--