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=VuMedHnT; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 668B05A0262 for ; Mon, 16 Mar 2026 10:15:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202602; t=1773652521; bh=oM4n8RBgXI9EC6bXZyPWRVNOlvwtrqV/r1ol2rYpuNw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=VuMedHnT3Wl5DVj6Jjue1pZSRoSLWpjbAeUbQBJvSdE9V8yh5ut9CP/tWibfX0N+5 0l/ihIbovXQk7yarCpd3uW8q0yrsj2YG8ulkcwuP2ExXAkmHXd9ipSc8a5wtqZAKwT OdK2otcQo+4FwZwVodq0lTf9+jWnVpMMRs9wKz1czqQBQU7N/tV/JOIduWLAjL3S6P 5X79Q7PiPTBu+KaClY4Vy5HXasTUwRMoxmf2fozJse9SB2PoF/L+9DZbeBvAGFDXxW P6rdlpIJs/D4ch1rnyrP1ZCvqhkfYIj8gwD8F34nEQ+VbtcazAQZvGkIPzOCPHF6Go 5BzSNy9RbSqzQ== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4fZ8ZK47flz4wDS; Mon, 16 Mar 2026 20:15:21 +1100 (AEDT) Date: Mon, 16 Mar 2026 20:15:15 +1100 From: David Gibson To: Laurent Vivier Subject: Re: [PATCH v2 2/3] vu_handle_tx: Pass actual remaining out_sg capacity to vu_queue_pop() Message-ID: References: <20260313182618.4157365-1-lvivier@redhat.com> <20260313182618.4157365-3-lvivier@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="JB+B2ydRUnB7o36o" Content-Disposition: inline In-Reply-To: <20260313182618.4157365-3-lvivier@redhat.com> Message-ID-Hash: RNB63YTMACG3OA5R2LHULMXPTDCAJUPL X-Message-ID-Hash: RNB63YTMACG3OA5R2LHULMXPTDCAJUPL 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: --JB+B2ydRUnB7o36o Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Mar 13, 2026 at 07:26:17PM +0100, Laurent Vivier wrote: > In vu_handle_tx(), pass the actual remaining iovec capacity > (ARRAY_SIZE(out_sg) - out_sg_count) to vu_queue_pop() rather than a > fixed VU_MAX_TX_BUFFER_NB. >=20 > This enables dynamic allocation of iovec entries to each element rather > than reserving a fixed number of slots per descriptor. >=20 > Signed-off-by: Laurent Vivier Reviewed-by: David Gibson > --- > vu_common.c | 11 +++++------ > 1 file changed, 5 insertions(+), 6 deletions(-) >=20 > diff --git a/vu_common.c b/vu_common.c > index 4d809ac38a4b..ed0033d6bb11 100644 > --- a/vu_common.c > +++ b/vu_common.c > @@ -20,8 +20,6 @@ > #include "migrate.h" > #include "epoll_ctl.h" > =20 > -#define VU_MAX_TX_BUFFER_NB 2 > - > /** > * vu_packet_check_range() - Check if a given memory zone is contained in > * a mapped guest memory region > @@ -177,13 +175,14 @@ static void vu_handle_tx(struct vu_dev *vdev, int i= ndex, > =20 > count =3D 0; > out_sg_count =3D 0; > - while (count < VIRTQUEUE_MAX_SIZE && > - out_sg_count + VU_MAX_TX_BUFFER_NB <=3D VIRTQUEUE_MAX_SIZE) { > - int ret; > + while (count < ARRAY_SIZE(elem) && > + out_sg_count < ARRAY_SIZE(out_sg)) { > struct iov_tail data; > + int ret; > =20 > ret =3D vu_queue_pop(vdev, vq, &elem[count], NULL, 0, > - &out_sg[out_sg_count], VU_MAX_TX_BUFFER_NB); > + &out_sg[out_sg_count], > + ARRAY_SIZE(out_sg) - out_sg_count); > if (ret < 0) > break; > out_sg_count +=3D elem[count].out_num; > --=20 > 2.53.0 >=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 --JB+B2ydRUnB7o36o Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmm3yiIACgkQzQJF27ox 2Gd0aw//ZaplnDniw+1cThF1lg8piBcLiUJ0+3KauMptI407ZuCg7gtKx2aII/Ub e4bZIksUE47Jbc0EMCQyn4zQRuRN2vmW1igUO9bXPA/jzUZF/hzud4Hj/bNcIxCh WlttGEBDns7nmfGjesOelTPqS3RdSuijxS59r+SwjOB9buOXKF8Utb6ct0DRs5ip H/M9imoF1OR9BMHR9pPXDXxxDh8aflPiJq5BLimcBf1FfDGjMIpzvsd9+zOBntFM t1n+YVxb5MzEQiQRfrQUNZTsLcFQ6fFGzwBZ/7Zn3RpzhCY7l7+qOGOYQYRYiuEK +jSMMUrjwFW1AaQsK+vXotuXPBoJdyFWmDWPhFM9vyEA9iVe/tKVuDTV5RGTuOPL iNmhF7AepdNEqTCiW8h/UJs3hBh5w+GRf23Aq0VzH+BuFBub5a7DbbCCy6PhTREr osOOWil/z5HgcCKxqJsoaSU4zuY3MpL5T4o7IVhWOnUWUQXqaXfhDdUEFWa1q+I/ oUKA2NXZAkfucAIVeGCe0U9KOtSUA4w/3laLhgiK/umzv15/kBZk/IOVR1au3R4P 0yqQ3fyODv0Gk4EgYvEA/18uS22xtHkhNpDlu5a+Z8ATyC6iEBRlwg1yZz5+/qPO w/Lux9uqPw928Owk3lsYr5r0NUA/d23m3bL8TLxGgYlH8RYZh1k= =QKdq -----END PGP SIGNATURE----- --JB+B2ydRUnB7o36o--