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=202606 header.b=o7FCHnW8; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 9DCDA5A0262 for ; Fri, 19 Jun 2026 08:13:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202606; t=1781849577; bh=YzeHJj1RM788KA7WDr7YqIr3gh3x7NFVSuoyONqTYAM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=o7FCHnW8SA6PtzfbaWHBb8eBJVsrVVIJn0riYmwhELKSt2YcdoETnvbv3Od+IUM+N 8ZWtOr4vR7uFHomXtTElkCLL5hO0t9pRCT0/huMKLUQQBSBuCwINPYREmyOB3A0XIk oIlHzfJR9H5mz58zvex63I53hO62PsNiYGcoJ0x2QFKGjc4qpTZJCQAbwjkAj+ck/3 /EwVySdZ/k8ARGCmlbc++5SvcEgC7e27bFFNdIDZS3wFNzjKSv3qz5gVjuejqUJSqD l/jyiSYVBM1hj/CUmczWj1JGCC8lAWHK1yNkXnO6sybk9VEKv5YhXsYSM0uq9MCCEJ 8pK+Q3HbwK7dA== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4ghS214L5Cz58sx; Fri, 19 Jun 2026 16:12:57 +1000 (AEST) Date: Fri, 19 Jun 2026 16:12:52 +1000 From: David Gibson To: Laurent Vivier Subject: Re: [PATCH v5 09/12] icmp: Pass queue pair explicitly through ICMP send path Message-ID: References: <20260616125130.1324274-1-lvivier@redhat.com> <20260616125130.1324274-10-lvivier@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="8mS7wLdvvJKfLAe4" Content-Disposition: inline In-Reply-To: <20260616125130.1324274-10-lvivier@redhat.com> Message-ID-Hash: OFKLXNJHZISXHHVGPG3ICRRXZ33U3DK2 X-Message-ID-Hash: OFKLXNJHZISXHHVGPG3ICRRXZ33U3DK2 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: --8mS7wLdvvJKfLAe4 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jun 16, 2026 at 02:51:27PM +0200, Laurent Vivier wrote: > icmp_sock_handler() uses QPAIR_DEFAULT when calling tap_icmp4_send() > and tap_icmp6_send(). Thread a qpair parameter from the caller in > passt_worker() so the queue pair is selected at the entry point rather > than hard-coded inside the handler. >=20 > passt_worker() currently passes QPAIR_DEFAULT, preserving existing > single-queue behavior. This is a preparatory step for per-queue > worker threads in vhost-user mode. >=20 > No functional change. >=20 > Signed-off-by: Laurent Vivier > --- > icmp.c | 22 ++++++++++++++-------- > icmp.h | 7 ++++--- > passt.c | 2 +- > tap.c | 4 ++-- > 4 files changed, 21 insertions(+), 14 deletions(-) >=20 > diff --git a/icmp.c b/icmp.c > index 3705f5ce0c9b..62038f977116 100644 > --- a/icmp.c > +++ b/icmp.c > @@ -66,8 +66,10 @@ static struct icmp_ping_flow *ping_at_sidx(flow_sidx_t= sidx) > * icmp_sock_handler() - Handle new data from ICMP or ICMPv6 socket > * @c: Execution context > * @ref: epoll reference > + * @qpair: Queue pair to process > */ > -void icmp_sock_handler(const struct ctx *c, union epoll_ref ref) > +void icmp_sock_handler(const struct ctx *c, union epoll_ref ref, > + unsigned int qpair) As in previous patches, why would the caller know the queue, before we've look at the flow? > { > struct icmp_ping_flow *pingf =3D ping_at_sidx(ref.flowside); > const struct flowside *ini =3D &pingf->f.side[INISIDE]; > @@ -132,13 +134,13 @@ void icmp_sock_handler(const struct ctx *c, union e= poll_ref ref) > const struct in_addr *daddr =3D inany_v4(&ini->eaddr); > =20 > assert(saddr && daddr); /* Must have IPv4 addresses */ > - tap_icmp4_send(c, QPAIR_DEFAULT, *saddr, *daddr, buf, > + tap_icmp4_send(c, qpair, *saddr, *daddr, buf, > pingf->f.tap_omac, n); > } else if (pingf->f.type =3D=3D FLOW_PING6) { > const struct in6_addr *saddr =3D &ini->oaddr.a6; > const struct in6_addr *daddr =3D &ini->eaddr.a6; > =20 > - tap_icmp6_send(c, QPAIR_DEFAULT, saddr, daddr, buf, > + tap_icmp6_send(c, qpair, saddr, daddr, buf, > pingf->f.tap_omac, n); > } > return; > @@ -163,6 +165,7 @@ static void icmp_ping_close(const struct ctx *c, > /** > * icmp_ping_new() - Prepare a new ping socket for a new id > * @c: Execution context > + * @qpair: Queue pair of the flow > * @af: Address family, AF_INET or AF_INET6 > * @id: ICMP id for the new socket > * @saddr: Source address > @@ -171,8 +174,9 @@ static void icmp_ping_close(const struct ctx *c, > * Return: newly opened ping flow, or NULL on failure > */ > static struct icmp_ping_flow *icmp_ping_new(const struct ctx *c, > - sa_family_t af, uint16_t id, > - const void *saddr, const void *daddr) > + unsigned int qpair, sa_family_t af, > + uint16_t id, const void *saddr, > + const void *daddr) > { > uint8_t proto =3D af =3D=3D AF_INET ? IPPROTO_ICMP : IPPROTO_ICMPV6; > uint8_t flowtype =3D af =3D=3D AF_INET ? FLOW_PING4 : FLOW_PING6; > @@ -180,6 +184,7 @@ static struct icmp_ping_flow *icmp_ping_new(const str= uct ctx *c, > struct icmp_ping_flow *pingf; > const struct flowside *tgt; > =20 > + (void)qpair; > if (!flow) > return NULL; > =20 > @@ -234,6 +239,7 @@ cancel: > /** > * icmp_tap_handler() - Handle packets from tap > * @c: Execution context > + * @qpair: Queue pair to process > * @pif: pif on which the packet is arriving > * @af: Address family, AF_INET or AF_INET6 > * @saddr: Source address > @@ -243,8 +249,8 @@ cancel: > * > * Return: count of consumed packets (always 1, even if malformed) > */ > -int icmp_tap_handler(const struct ctx *c, uint8_t pif, sa_family_t af, > - const void *saddr, const void *daddr, > +int icmp_tap_handler(const struct ctx *c, unsigned int qpair, uint8_t pi= f, > + sa_family_t af, const void *saddr, const void *daddr, > struct iov_tail *data, const struct timespec *now) > { > struct iovec iov[MAX_IOV_ICMP]; > @@ -301,7 +307,7 @@ int icmp_tap_handler(const struct ctx *c, uint8_t pif= , sa_family_t af, > =20 > if (flow) > pingf =3D &flow->ping; > - else if (!(pingf =3D icmp_ping_new(c, af, id, saddr, daddr))) > + else if (!(pingf =3D icmp_ping_new(c, qpair, af, id, saddr, daddr))) > return 1; > =20 > tgt =3D &pingf->f.side[TGTSIDE]; > diff --git a/icmp.h b/icmp.h > index 556260461995..5cc067e57a9c 100644 > --- a/icmp.h > +++ b/icmp.h > @@ -13,9 +13,10 @@ > struct ctx; > struct icmp_ping_flow; > =20 > -void icmp_sock_handler(const struct ctx *c, union epoll_ref ref); > -int icmp_tap_handler(const struct ctx *c, uint8_t pif, sa_family_t af, > - const void *saddr, const void *daddr, > +void icmp_sock_handler(const struct ctx *c, union epoll_ref ref, > + unsigned int qpair); > +int icmp_tap_handler(const struct ctx *c, unsigned int qpair, uint8_t pi= f, > + sa_family_t af, const void *saddr, const void *daddr, > struct iov_tail *data, const struct timespec *now); > void icmp_init(void); > =20 > diff --git a/passt.c b/passt.c > index 41239991451f..c9e456641e85 100644 > --- a/passt.c > +++ b/passt.c > @@ -273,7 +273,7 @@ static void passt_worker(void *opaque, int nfds, stru= ct epoll_event *events) > QPAIR_DEFAULT); > break; > case EPOLL_TYPE_PING: > - icmp_sock_handler(c, ref); > + icmp_sock_handler(c, ref, QPAIR_DEFAULT); > break; > case EPOLL_TYPE_VHOST_CMD: > vu_control_handler(c->vdev, c->fd_tap, eventmask); > diff --git a/tap.c b/tap.c > index 8e19390f7273..de1e5269526c 100644 > --- a/tap.c > +++ b/tap.c > @@ -791,7 +791,7 @@ resume: > =20 > tap_packet_debug(iph, NULL, NULL, 0, NULL, 1); > =20 > - icmp_tap_handler(c, PIF_TAP, AF_INET, > + icmp_tap_handler(c, qpair, PIF_TAP, AF_INET, > &iph->saddr, &iph->daddr, > &data, now); > continue; > @@ -1035,7 +1035,7 @@ resume: > =20 > tap_packet_debug(NULL, ip6h, NULL, proto, NULL, 1); > =20 > - icmp_tap_handler(c, PIF_TAP, AF_INET6, > + icmp_tap_handler(c, qpair, PIF_TAP, AF_INET6, > saddr, daddr, &data, now); > continue; > } > --=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 --8mS7wLdvvJKfLAe4 Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmo03dgACgkQzQJF27ox 2GePmRAAks+mAOfJStAXDXHCo88adY80bW2bkk+nIN98S1cU404quAiN9o71Rmz5 B13bx/zhwPnRAyyoPLh0qOlcIoDfJdZq50BJiacCKtOmEGs38WQWp8bZYXYJ9qyH r666wD9/BFHXnlf/fEB2xUYYt4h1s8V4YArTmBuvehs71euquAoEsuVXlyY4wmg9 jpDSGw3vERrpqwbKZj1WpKZ7ZnMYiCZatK6iRXUCwqG1SlUnPibFVfoyPdwTpXMs L0nYN3HJhHSs6b5MYM+0gxAt/ldLSh4y5xf2CWq+JJM1tFitpy+xDLGdFZuaLNvg bwjV2jc3gv4IPEsdp+0BYWA0i2uY8Jc4E8Qra+jwOp1wV0ClG+BnuP/xT2Jc/ED2 bsu8tIyIk/FGyAgXFzm5usNOme088mKSfo4Dl8tSAh+Nsx+GNCz+4jXtCfTDBVXg uyGTftpeBAhQ5Xw88a52lrflMG5DSyxxLhB2vJ6xI7+h94vA2UgSS/5YzwX7iCzN XPrGw6u3o8SsWEyt2F6gvYsojNKx+1uxJ1r6cgu5Nv5pHZ8ZEEBAS3yfM7VuYDyW NluIPtSBWPgyUaqf7m3sTt4y99y6iehSR9X0WoZiMqfsyo/LX5KAL3Z52gSJ13lv hvIVixbDSjlXbfHofLKWQxUKwFKn0I4L7ZNvE+ATSqbBtdFOak0= =AFgu -----END PGP SIGNATURE----- --8mS7wLdvvJKfLAe4--