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=sL1JVPAs; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 3D1045A027C for ; Fri, 15 Aug 2025 03:11:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202508; t=1755220300; bh=TBBdzsViHEe2cntCuSKUgc+oirb0wxkiWXqsIVknMc8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=sL1JVPAsc3giKCMVkeOtsbJ8Iqd3hvHexaDjhhd5u8PgQgdtLlMcb3fsWIjnmYXf/ kkIl9grzfz6DP51OqOG8XhbDer8GDSB8IfMXMlSaH1CbYXqrlVOLEIv6TG13m6R9eo LhHZo+Pq6AsaWb5K6tO0hcfZJ9wS5KzEXI1G/degUwMquHqXZcYrl1c3yVN5Onw2Bj YbbiQrFxEz49N1waquhTTOyLGwG4vHOq/y7ZZjWonJCYzUwI4I252dFudeWmIb54cs uV0V2VB5ZdyV3Ss5CEBsvJtxbI4nqmU+/gviGTP/p5C3qpwEMk1jIyaow8z0I3df6N DsyXpw81DY+yQ== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4c33wX5Vnpz4x5q; Fri, 15 Aug 2025 11:11:40 +1000 (AEST) Date: Fri, 15 Aug 2025 11:11:37 +1000 From: David Gibson To: Laurent Vivier Subject: Re: [PATCH v10 30/30] packet: Add support for multi-vector packets Message-ID: References: <20250814094849.919709-1-lvivier@redhat.com> <20250814094849.919709-31-lvivier@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="bSrdId8iP4OF45De" Content-Disposition: inline In-Reply-To: <20250814094849.919709-31-lvivier@redhat.com> Message-ID-Hash: JUYMO3EUMESVW3JOBU6BFEZOM22QWRO7 X-Message-ID-Hash: JUYMO3EUMESVW3JOBU6BFEZOM22QWRO7 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: --bSrdId8iP4OF45De Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Aug 14, 2025 at 11:48:49AM +0200, Laurent Vivier wrote: > The packet pool was previously limited to handling packets contained > within a single buffer. >=20 > This patch extends the packet pool to support iovec array, > allowing a single logical packet to be composed of multiple iovec. >=20 > To accommodate this, the storage format within the pool is modified. > For a multi-vector packet, a header entry is now stored first with > iov_base =3D NULL and iov_len holding the number of subsequent > vectors. The actual data vectors are then stored in the following > pool slots. >=20 > The packet_add_do() and packet_get_do() functions are updated to > manage this new format for storing and retrieving packets. The > pool_full() check is also adjusted to ensure there is enough > space for all vectors of a new packet before adding it. >=20 > Signed-off-by: Laurent Vivier > --- > packet.c | 52 ++++++++++++++++++++++++++++++++++------------------ > packet.h | 2 +- > tap.c | 4 ++-- > 3 files changed, 37 insertions(+), 21 deletions(-) >=20 > diff --git a/packet.c b/packet.c > index 27693c55a138..c88e726c94a6 100644 > --- a/packet.c > +++ b/packet.c > @@ -91,14 +91,15 @@ static int packet_check_range(const struct pool *p, c= onst char *ptr, size_t len, > return 0; > } > /** > - * pool_full() - Is a packet pool full? > + * pool_can_fit() - Is a new packet can fit in the pool? "Can a new packet fit in the pool?" > * @p: Pointer to packet pool > + * @data: check data can fit in the pool > * > - * Return: true if the pool is full, false if more packets can be added > + * Return: true if the pool is full, false if data can be added With the name changed, the sense needs to be inverted as well. Also s/data/@data/ to make it clear we're talking specifically about the parameter, not "data" in the broad sense. > */ > -bool pool_full(const struct pool *p) > +bool pool_can_fit(const struct pool *p, const struct iov_tail *data) > { > - return p->count >=3D p->size; > + return p->count + data->cnt + (data->cnt > 1) >=3D p->size; Still an off-by-one here, see comments in the other thread. =2E.and this is still only valid if @data is already pruned. I really think a bunch of things would become a bit clearer if you add a change earlier in the series clarifying that iov_tails should never be passed around unpruned. --=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 --bSrdId8iP4OF45De Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmieiUgACgkQzQJF27ox 2Gc9PQ/+KLobhwAHdVbP5vJtCxLazNLD/QAXCLgAztAa8Xl02e/eECXQ1Io5W9cI hq/T54XwxZ44Fe5ik6d116xzwJWnXvdicUb+ebFVsRBvIVywWbHDcQjaMRAVQQjq bCqntMQKs4wD8mfaX/B3dPQYLXYuFP526JySHa/AWEUP2cjB+miEzlFEpf92Wfxk aMbU/wav1g5piUjpM2wI2pcWvukmyAT2oQluyKXqQylzQylShfTCIEsl/X8jKGIn zN6DwSJdR+UGDqQXDKxCxRFF0eZUDykHID/UyFioAyJ9iN4zS4/kymtPpiKCw7mR Ex7Xo6E9A+0+OzZHrSQ0EUMkjadrY9GwIgDt5k/uvzu21tbIeeC2NZsnZYK1/2l2 O/KUXkbmlLQeqXmUHt331iyjMp4u0Q1KtttqnCuwRjUVLyPuzBlnrAehPir102g9 +7twX3nvO//kbv4FH7FkyiHyoqRe0IVLDOS4omoXBAw0FO4WCmnW8mQ0FpiZtXMr naoaiQ0nCjC4XdamOgmAIgn22N0MchYS/Kt+3wueN/z+dP9XV2WpjhlAnmlmV3CY sH4QJZPfnz4bjjwx5+VO61AJuB2y4viVfYEuEhfjkDNt4AipdFr5/x9sU1u9Vu9q KRG1EgzFZ93Wq8tphx8ith1J3gYecPgpvxNVQEruU5gPTXVpx30= =xzrZ -----END PGP SIGNATURE----- --bSrdId8iP4OF45De--