public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Laurent Vivier <lvivier@redhat.com>
Cc: passt-dev@passt.top
Subject: Re: [PATCH v2 2/3] vu_handle_tx: Pass actual remaining out_sg capacity to vu_queue_pop()
Date: Mon, 16 Mar 2026 20:15:15 +1100	[thread overview]
Message-ID: <abfKI5vaT0Ce_uBb@zatzit> (raw)
In-Reply-To: <20260313182618.4157365-3-lvivier@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1837 bytes --]

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.
> 
> This enables dynamic allocation of iovec entries to each element rather
> than reserving a fixed number of slots per descriptor.
> 
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  vu_common.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> 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"
>  
> -#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 index,
>  
>  	count = 0;
>  	out_sg_count = 0;
> -	while (count < VIRTQUEUE_MAX_SIZE &&
> -	       out_sg_count + VU_MAX_TX_BUFFER_NB <= VIRTQUEUE_MAX_SIZE) {
> -		int ret;
> +	while (count < ARRAY_SIZE(elem) &&
> +	       out_sg_count < ARRAY_SIZE(out_sg)) {
>  		struct iov_tail data;
> +		int ret;
>  
>  		ret = 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 += elem[count].out_num;
> -- 
> 2.53.0
> 

-- 
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 --]

  reply	other threads:[~2026-03-16  9:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-13 18:26 [PATCH v2 0/3] Decouple iovec management from virtqueue elements Laurent Vivier
2026-03-13 18:26 ` [PATCH v2 1/3] virtio: Pass iovec arrays as separate parameters to vu_queue_pop() Laurent Vivier
2026-03-16  8:25   ` David Gibson
2026-03-13 18:26 ` [PATCH v2 2/3] vu_handle_tx: Pass actual remaining out_sg capacity " Laurent Vivier
2026-03-16  9:15   ` David Gibson [this message]
2026-03-17  0:02   ` Stefano Brivio
2026-03-13 18:26 ` [PATCH v2 3/3] vu_common: Move iovec management into vu_collect() Laurent Vivier
2026-03-17  2:40   ` David Gibson
2026-03-17  7:25     ` Laurent Vivier
2026-03-17 15:23       ` Stefano Brivio
2026-03-17 15:23   ` Stefano Brivio
2026-03-17 16:18     ` Laurent Vivier
2026-03-17 16:21       ` 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=abfKI5vaT0Ce_uBb@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).