From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: passt.top; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ccyfFjWc; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTPS id 7F7305A0627 for ; Fri, 31 Jul 2026 18:16:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1785514593; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0I3zGGmhmGTf9juN+MKFZs7CAuMcnYe6wbuROqLLduM=; b=ccyfFjWc7Y1NVpU/ls8xZ5lt84oyY3g3PLTi0VvvolPw06LLxA3ANqgCfNxrp6EUCHOrOU /SbyFQj1U0E+71GjDkKXyzWVGD87s1ksZxoWYqTn2NRomE0cOMBdfgCDSuI0rS/ZqyrQrE McWw8QkA45PUgZ+X2cRDpmmO5NwFra0= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-423-ir6SWY3RMy2nq965_f3Lnw-1; Fri, 31 Jul 2026 12:16:31 -0400 X-MC-Unique: ir6SWY3RMy2nq965_f3Lnw-1 X-Mimecast-MFC-AGG-ID: ir6SWY3RMy2nq965_f3Lnw_1785514591 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 19AF8180044F for ; Fri, 31 Jul 2026 16:16:31 +0000 (UTC) Received: from lenovo-t14s.redhat.corp (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 580FF18004AD; Fri, 31 Jul 2026 16:16:30 +0000 (UTC) From: Laurent Vivier To: passt-dev@passt.top Subject: [PATCH v6 09/12] icmp: Pass queue pair explicitly through ICMP send path Date: Fri, 31 Jul 2026 18:16:14 +0200 Message-ID: <20260731161617.3550626-10-lvivier@redhat.com> In-Reply-To: <20260731161617.3550626-1-lvivier@redhat.com> References: <20260731161617.3550626-1-lvivier@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 823TJdP9FU2vthR0Yvx9VIV8-NA2ssJrEULHUqYaW5Y_1785514591 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true Message-ID-Hash: 2LPVI7CCJR552QUAFUJPDTRCL4JTC4B4 X-Message-ID-Hash: 2LPVI7CCJR552QUAFUJPDTRCL4JTC4B4 X-MailFrom: lvivier@redhat.com 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: Laurent Vivier 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: 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 --- icmp.c | 20 ++++++++++++-------- icmp.h | 7 ++++--- passt.c | 2 +- tap.c | 4 ++-- 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/icmp.c b/icmp.c index a1015fe9f5c2..92cb48dfaafe 100644 --- a/icmp.c +++ b/icmp.c @@ -67,9 +67,10 @@ static struct icmp_ping_flow *ping_at_sidx(flow_sidx_t sidx) * @c: Execution context * @ref: epoll reference * @now: Current timestamp + * @qpair: Queue pair to process */ void icmp_sock_handler(const struct ctx *c, union epoll_ref ref, - const struct timespec *now) + const struct timespec *now, unsigned int qpair) { struct icmp_ping_flow *pingf = ping_at_sidx(ref.flowside); const struct flowside *ini = &pingf->f.side[INISIDE]; @@ -134,13 +135,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; @@ -165,6 +166,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 @@ -174,8 +176,8 @@ 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, + unsigned int qpair, sa_family_t af, + uint16_t id, const void *saddr, const void *daddr, const struct timespec *now) { @@ -185,6 +187,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; @@ -240,6 +243,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 @@ -249,8 +253,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]; @@ -307,7 +311,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, now))) + else if (!(pingf = icmp_ping_new(c, qpair, af, id, saddr, daddr, now))) return 1; tgt = &pingf->f.side[TGTSIDE]; diff --git a/icmp.h b/icmp.h index 8b8fa403cc91..0dd69328591a 100644 --- a/icmp.h +++ b/icmp.h @@ -14,9 +14,10 @@ struct ctx; struct icmp_ping_flow; void icmp_sock_handler(const struct ctx *c, union epoll_ref ref, - const struct timespec *now); -int icmp_tap_handler(const struct ctx *c, uint8_t pif, sa_family_t af, - const void *saddr, const void *daddr, + const struct timespec *now, + 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 a26653db7763..55708d96fb06 100644 --- a/passt.c +++ b/passt.c @@ -283,7 +283,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, &now); + icmp_sock_handler(c, ref, &now, 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 84ac111d7a11..8bd1db427721 100644 --- a/tap.c +++ b/tap.c @@ -788,7 +788,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; @@ -1034,7 +1034,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