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 v3 2/6] vhost-user: Enable multiqueue
Date: Wed, 10 Dec 2025 11:04:33 +1100	[thread overview]
Message-ID: <aTi5EbbcNWcylyTo@zatzit> (raw)
In-Reply-To: <20251203185435.582096-3-lvivier@redhat.com>

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

On Wed, Dec 03, 2025 at 07:54:30PM +0100, Laurent Vivier wrote:
> Advertise multi-queue support in vhost-user by setting VIRTIO_NET_F_MQ
> and VHOST_USER_PROTOCOL_F_MQ feature flags, and increase
> VHOST_USER_MAX_VQS from 2 to 32, supporting up to 16 queue pairs.
> 
> Currently, only the first RX queue (queue 0) is used for receiving
> packets. The guest kernel selects which TX queue to use for
> transmission. Full multi-RX queue load balancing will be implemented in
> future work.
> 
> Update the QEMU usage hint to show the required parameters for enabling
> multiqueue: queues parameter on the netdev, and mq=true on the
> virtio-net device.
> 
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>

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

> ---
>  tap.c        |  7 +++++--
>  vhost_user.c | 10 ++++++----
>  virtio.h     |  2 +-
>  3 files changed, 12 insertions(+), 7 deletions(-)
> 
> diff --git a/tap.c b/tap.c
> index 2cda8c9772b8..591b49491aa3 100644
> --- a/tap.c
> +++ b/tap.c
> @@ -1314,8 +1314,11 @@ static void tap_backend_show_hints(struct ctx *c)
>  		break;
>  	case MODE_VU:
>  		info("You can start qemu with:");
> -		info("    kvm ... -chardev socket,id=chr0,path=%s -netdev vhost-user,id=netdev0,chardev=chr0 -device virtio-net,netdev=netdev0 -object memory-backend-memfd,id=memfd0,share=on,size=$RAMSIZE -numa node,memdev=memfd0\n",
> -		     c->sock_path);
> +		info("    kvm ... -chardev socket,id=chr0,path=%s "
> +		     "-netdev vhost-user,id=netdev0,chardev=chr0,queues=$QUEUES "
> +		     "-device virtio-net,netdev=netdev0,mq=true "
> +		     "-object memory-backend-memfd,id=memfd0,share=on,size=$RAMSIZE "
> +		     "-numa node,memdev=memfd0\n", c->sock_path);
>  		break;
>  	}
>  }
> diff --git a/vhost_user.c b/vhost_user.c
> index aa7c869d9e56..845fdb551c84 100644
> --- a/vhost_user.c
> +++ b/vhost_user.c
> @@ -323,6 +323,7 @@ static bool vu_get_features_exec(struct vu_dev *vdev,
>  	uint64_t features =
>  		1ULL << VIRTIO_F_VERSION_1 |
>  		1ULL << VIRTIO_NET_F_MRG_RXBUF |
> +		1ULL << VIRTIO_NET_F_MQ |
>  		1ULL << VHOST_F_LOG_ALL |
>  		1ULL << VHOST_USER_F_PROTOCOL_FEATURES;
>  
> @@ -767,7 +768,8 @@ static void vu_check_queue_msg_file(struct vhost_user_msg *vmsg)
>  	int idx = vmsg->payload.u64 & VHOST_USER_VRING_IDX_MASK;
>  
>  	if (idx >= VHOST_USER_MAX_VQS)
> -		die("Invalid vhost-user queue index: %u", idx);
> +		die("Invalid vhost-user queue index: %u (maximum %u)", idx,
> +		    VHOST_USER_MAX_VQS);
>  
>  	if (nofd) {
>  		vmsg_close_fds(vmsg);
> @@ -896,7 +898,8 @@ static bool vu_get_protocol_features_exec(struct vu_dev *vdev,
>  	uint64_t features = 1ULL << VHOST_USER_PROTOCOL_F_REPLY_ACK |
>  			    1ULL << VHOST_USER_PROTOCOL_F_LOG_SHMFD |
>  			    1ULL << VHOST_USER_PROTOCOL_F_DEVICE_STATE |
> -			    1ULL << VHOST_USER_PROTOCOL_F_RARP;
> +			    1ULL << VHOST_USER_PROTOCOL_F_RARP |
> +			    1ULL << VHOST_USER_PROTOCOL_F_MQ;
>  
>  	(void)vdev;
>  	vmsg_set_reply_u64(vmsg, features);
> @@ -935,10 +938,9 @@ static bool vu_get_queue_num_exec(struct vu_dev *vdev,
>  {
>  	(void)vdev;
>  
> -	/* NOLINTNEXTLINE(misc-redundant-expression) */
>  	vmsg_set_reply_u64(vmsg, VHOST_USER_MAX_VQS / 2);
>  
> -	debug("VHOST_USER_MAX_VQS  %u", VHOST_USER_MAX_VQS / 2);
> +	debug("queue num  %u", VHOST_USER_MAX_VQS / 2);
>  
>  	return true;
>  }
> diff --git a/virtio.h b/virtio.h
> index 12caaa0b6def..176c935cecc7 100644
> --- a/virtio.h
> +++ b/virtio.h
> @@ -88,7 +88,7 @@ struct vu_dev_region {
>  	uint64_t mmap_addr;
>  };
>  
> -#define VHOST_USER_MAX_VQS 2
> +#define VHOST_USER_MAX_VQS 32
>  
>  /*
>   * Set a reasonable maximum number of ram slots, which will be supported by
> -- 
> 2.51.1
> 

-- 
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:[~2025-12-10  0:04 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-03 18:54 [PATCH v3 0/6] vhost-user: Add multiqueue support Laurent Vivier
2025-12-03 18:54 ` [PATCH v3 1/6] tap: Remove pool parameter from tap4_handler() and tap6_handler() Laurent Vivier
2025-12-05  4:14   ` David Gibson
2025-12-03 18:54 ` [PATCH v3 2/6] vhost-user: Enable multiqueue Laurent Vivier
2025-12-10  0:04   ` David Gibson [this message]
2025-12-11  7:01   ` Stefano Brivio
2025-12-11  8:29     ` Laurent Vivier
2025-12-03 18:54 ` [PATCH v3 3/6] test: Add multiqueue support to vhost-user test infrastructure Laurent Vivier
2025-12-10  0:05   ` David Gibson
2025-12-03 18:54 ` [PATCH v3 4/6] vhost-user: Add queue pair parameter throughout the network stack Laurent Vivier
2025-12-11  7:01   ` Stefano Brivio
2025-12-11  8:48     ` Laurent Vivier
2025-12-11 12:16       ` Stefano Brivio
2025-12-11 13:26         ` Laurent Vivier
2025-12-11 15:27           ` Stefano Brivio
2025-12-11 16:06             ` Laurent Vivier
2025-12-03 18:54 ` [PATCH v3 5/6] tap: Convert packet pools to per-queue-pair arrays for multiqueue Laurent Vivier
2025-12-03 18:54 ` [PATCH v3 6/6] flow: Add queue pair tracking to flow management Laurent Vivier

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=aTi5EbbcNWcylyTo@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).