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=202608 header.b=caicn0q0; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 6D96A5A0262 for ; Mon, 03 Aug 2026 05:46:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202608; t=1785728795; bh=S0fHXschwVXdDHlxIZymEyl2RQytnxMNyQ4mX1m5VPs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=caicn0q0DirRp//Rwrr1AfMd+n5gdWmIEhTBeS/3kQvsCWXIhvcjJGcQAsEcc9bf9 GTA2b4xjYg0/j385CZH9sKzWPm6rkVML4oQS9w1Qt3jsD8F1lq45NOPX/Wb5dnEiau gq/XTy4MaT8upnnrnjYQtT9pdXmAR7RfnxezPIdhrDa3T03nwQy2Slk+1w95aeH62P LoIeVF9dJi2ri+1XsGba/5vrLpg441Ru+TInZyHWL3o1+T3n124U0xWcesGHkkgK9B 2hDGeMOsQWl+QV03eGsbEOVvmmj8RGHNuPVbOYt+LSqPi2sanaRKsuo+8llIHpuZdK 5HmJp2Hq1/jUA== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4hD2fM13r1z4wCP; Mon, 03 Aug 2026 13:46:35 +1000 (AEST) Date: Mon, 3 Aug 2026 12:03:00 +1000 From: David Gibson To: Laurent Vivier Subject: Re: [PATCH v6 02/12] vhost-user: Advertise multiqueue support Message-ID: References: <20260731161617.3550626-1-lvivier@redhat.com> <20260731161617.3550626-3-lvivier@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="aZXDHwLQMLg3cPgg" Content-Disposition: inline In-Reply-To: <20260731161617.3550626-3-lvivier@redhat.com> Message-ID-Hash: 5YH2LS2WMBMFN7AT7NKR4RZADXJZMDAQ X-Message-ID-Hash: 5YH2LS2WMBMFN7AT7NKR4RZADXJZMDAQ 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: --aZXDHwLQMLg3cPgg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jul 31, 2026 at 06:16:07PM +0200, Laurent Vivier wrote: > Allow the guest to negotiate multiple virtqueue pairs by advertising > 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. >=20 > Replace the VHOST_USER_RX_QUEUE, VHOST_USER_TX_QUEUE, > VHOST_USER_IS_QUEUE_TX(), and VHOST_USER_IS_QUEUE_RX() macros with a > general set of QPAIR_* macros in passt.h that translate between queue > pair numbers and virtqueue indices. These are needed now that queue > indices are no longer limited to 0 and 1. >=20 > Add a queue pair parameter to vu_send_single(), propagating it to the > virtqueue selection. All callers currently pass QPAIR_DEFAULT (0): > only the first RX queue is used for receiving. The guest kernel > selects which TX queue to use for transmission. Full multi-RX-queue > load balancing will be implemented separately. >=20 > Signed-off-by: Laurent Vivier Reviewed-by: David Gibson [snip] > /** > - * vu_send_single() - Send a buffer to the front-end using the RX virtqu= eue > - * @c: execution context > + * vu_send_single() - Send a buffer to the front-end using a specified v= irtqueue > + * @c: Execution context > + * @qpair: Queue pair on which to send the buffer > * @buf: address of the buffer > * @size: size of the buffer > * > * Return: number of bytes sent, -1 if there is an error > */ > -int vu_send_single(const struct ctx *c, const void *buf, size_t size) > +int vu_send_single(const struct ctx *c, unsigned int qpair, const void *= buf, size_t size) > { > struct vu_dev *vdev =3D c->vdev; > - struct vu_virtq *vq =3D &vdev->vq[VHOST_USER_RX_QUEUE]; > struct vu_virtq_element elem[VIRTQUEUE_MAX_SIZE]; > struct iovec in_sg[VIRTQUEUE_MAX_SIZE]; > + struct vu_virtq *vq; Nit: belongs one line lower down... > size_t total, in_total; > int elem_cnt; > int i; > =20 > + vq =3D &vdev->vq[QPAIR_TOGUEST_QUEUE(qpair)]; > + =2E.. or you could put this expression in the initialiser and it wouldn't move at all. > trace("vu_send_single size %zu", size); > =20 > if (!vu_queue_enabled(vq) || !vu_queue_started(vq)) { > diff --git a/vu_common.h b/vu_common.h > index 817384175a1d..f5603d9ddeb6 100644 > --- a/vu_common.h > +++ b/vu_common.h > @@ -23,7 +23,8 @@ void vu_flush(const struct vu_dev *vdev, struct vu_virt= q *vq, > struct vu_virtq_element *elem, int elem_cnt, size_t frame_len); > void vu_kick_cb(struct vu_dev *vdev, union epoll_ref ref, > const struct timespec *now); > -int vu_send_single(const struct ctx *c, const void *buf, size_t size); > +int vu_send_single(const struct ctx *c, unsigned int qpair, const void *= buf, > + size_t size); > void vu_pad(const struct iovec *iov, size_t cnt, size_t frame_len); > =20 > #endif /* VU_COMMON_H */ > --=20 > 2.54.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 --aZXDHwLQMLg3cPgg Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmpv9sgACgkQzQJF27ox 2GelIhAAguNu13j3Ap+beO2Grqx/MAL5b1nchgikYdhn5W+XG9ceq3a+6yTUTXvB oEjUfFEpq+E9x5I4/lP5mFnQ4wtkSa1/aSQ48s10Tb/0yIIhITt87S7oFU6QNvpV sDN1bf9ek8O5SlNMPNXuFsnNwm+Go0PARNX0MzpCTSox4JFWcGU+Gi4wgirR89VA 8zN+iG8PvyDFMMvol9tIhGOQPrQvDbEhcEJ7HcPeQz7pwMyqgWYv0FnbQUpc9q0K 2glphFWoxhnQzYo1dVwx7hxLaBncEU4iz6luNCOYCN5vP1kp/FWQfUSkJMGMLo7v n/zz52gZYLpMkYKvihLSeVW88fqq+fMwelefB3bNRU0QSdO2iPMNJPhD7au/6vpz 9FzupmjuH1ZMVyNQJM/6AAz/GT5lImEkCYdHts+jEIHuHgVE0ww3zjSEh0I+h8V+ VewtdcRQpiDk9QmAfLGliVBjj7LzZI27XayB3HOCDNApPGfRVpUbD63m95kiIfVe owVj/7jkuv52PT4bs+H52QAygYtuov2LA6AR+YNFVplZO65fl3uoIKykS4J+QIEi QUeR6vqnXJGBVSKxGByDKUxgUb88ZRGRn3MoXpVvuIC4h0xjD4m7cUvxljTv7u1u OvCkJPT1PlfBMaK4CLVNPKX2T0WfVQjlXURrruFT6xq9V2AZhgM= =4iS7 -----END PGP SIGNATURE----- --aZXDHwLQMLg3cPgg--