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 Reviewed-by: David Gibson > --- > 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