From: Laurent Vivier <lvivier@redhat.com>
To: passt-dev@passt.top
Cc: Laurent Vivier <lvivier@redhat.com>
Subject: [PATCH v5 09/12] icmp: Pass queue pair explicitly through ICMP send path
Date: Tue, 16 Jun 2026 14:51:27 +0200 [thread overview]
Message-ID: <20260616125130.1324274-10-lvivier@redhat.com> (raw)
In-Reply-To: <20260616125130.1324274-1-lvivier@redhat.com>
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.
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.
No functional change.
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
icmp.c | 22 ++++++++++++++--------
icmp.h | 7 ++++---
passt.c | 2 +-
tap.c | 4 ++--
4 files changed, 21 insertions(+), 14 deletions(-)
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)
{
struct icmp_ping_flow *pingf = ping_at_sidx(ref.flowside);
const struct flowside *ini = &pingf->f.side[INISIDE];
@@ -132,13 +134,13 @@ void icmp_sock_handler(const struct ctx *c, union epoll_ref ref)
const struct in_addr *daddr = inany_v4(&ini->eaddr);
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 == FLOW_PING6) {
const struct in6_addr *saddr = &ini->oaddr.a6;
const struct in6_addr *daddr = &ini->eaddr.a6;
- 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 = af == AF_INET ? IPPROTO_ICMP : IPPROTO_ICMPV6;
uint8_t flowtype = af == AF_INET ? FLOW_PING4 : FLOW_PING6;
@@ -180,6 +184,7 @@ static struct icmp_ping_flow *icmp_ping_new(const struct ctx *c,
struct icmp_ping_flow *pingf;
const struct flowside *tgt;
+ (void)qpair;
if (!flow)
return NULL;
@@ -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 pif,
+ 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,
if (flow)
pingf = &flow->ping;
- else if (!(pingf = icmp_ping_new(c, af, id, saddr, daddr)))
+ else if (!(pingf = icmp_ping_new(c, qpair, af, id, saddr, daddr)))
return 1;
tgt = &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;
-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 pif,
+ sa_family_t af, const void *saddr, const void *daddr,
struct iov_tail *data, const struct timespec *now);
void icmp_init(void);
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, struct 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:
tap_packet_debug(iph, NULL, NULL, 0, NULL, 1);
- 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:
tap_packet_debug(NULL, ip6h, NULL, proto, NULL, 1);
- icmp_tap_handler(c, PIF_TAP, AF_INET6,
+ icmp_tap_handler(c, qpair, PIF_TAP, AF_INET6,
saddr, daddr, &data, now);
continue;
}
--
2.54.0
next prev parent reply other threads:[~2026-06-16 12:51 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-16 12:51 [PATCH v5 00/12] vhost-user: Add multiqueue support Laurent Vivier
2026-06-16 12:51 ` [PATCH v5 01/12] tap: Remove pool parameter from tap4_handler() and tap6_handler() Laurent Vivier
2026-06-16 12:51 ` [PATCH v5 02/12] vhost-user: Advertise multiqueue support Laurent Vivier
2026-06-16 12:51 ` [PATCH v5 03/12] test: Add multiqueue support to vhost-user test infrastructure Laurent Vivier
2026-06-16 12:51 ` [PATCH v5 04/12] tap: Thread queue pair through all remaining tap paths Laurent Vivier
2026-06-16 12:51 ` [PATCH v5 05/12] arp: Pass queue pair explicitly through ARP send path Laurent Vivier
2026-06-16 12:51 ` [PATCH v5 06/12] tcp: Pass queue pair explicitly through TCP " Laurent Vivier
2026-06-16 12:51 ` [PATCH v5 07/12] udp: Pass queue pair explicitly through UDP " Laurent Vivier
2026-06-16 12:51 ` [PATCH v5 08/12] dhcp/dhcpv6: Pass queue pair explicitly through DHCP " Laurent Vivier
2026-06-16 12:51 ` Laurent Vivier [this message]
2026-06-16 12:51 ` [PATCH v5 10/12] ndp: Pass queue pair explicitly through NDP " Laurent Vivier
2026-06-16 12:51 ` [PATCH v5 11/12] flow: Add queue pair tracking to flow management Laurent Vivier
2026-06-16 12:51 ` [PATCH v5 12/12] flow: Derive epoll fd from queue pair, removing epollid field 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=20260616125130.1324274-10-lvivier@redhat.com \
--to=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).