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=HWe/R3oo; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by passt.top (Postfix) with ESMTPS id 723A95A065D for ; Fri, 31 Jul 2026 18:16:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1785514595; 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=7H3v4q57dnxlCqnPJfX1tCaBXg8kkEQ47S3iF/gd74Y=; b=HWe/R3ooQ4xekVMZmdJ8ctp66aklNRDyWZonlOdC+F3Od1O6hu20gKNwh69fw8CyS0RXSC sFfUyeaSUbp93q+4RKRJge7HUGji9IV4U1dKPAV7pcNu2sBtkzEJl+v1ORTdOnsBaLZHT1 wjyiqTNPFhOzBqPgL43yo1sbn7KvjIs= Received: from mx-prod-mc-08.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-412-n1eP0u17OMKfp0RDV1Zt1w-1; Fri, 31 Jul 2026 12:16:34 -0400 X-MC-Unique: n1eP0u17OMKfp0RDV1Zt1w-1 X-Mimecast-MFC-AGG-ID: n1eP0u17OMKfp0RDV1Zt1w_1785514593 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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2D2EF1800344 for ; Fri, 31 Jul 2026 16:16:33 +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 5225F18004AD; Fri, 31 Jul 2026 16:16:32 +0000 (UTC) From: Laurent Vivier To: passt-dev@passt.top Subject: [PATCH v6 10/12] ndp: Pass queue pair explicitly through NDP send path Date: Fri, 31 Jul 2026 18:16:15 +0200 Message-ID: <20260731161617.3550626-11-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: 2eLja02dAYVhdn0uzX9cTFzMKceYkSbttUZUUC06hzY_1785514593 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true Message-ID-Hash: 4FOGFVYZIFZJSJH22VWCZCDE62OVYWMQ X-Message-ID-Hash: 4FOGFVYZIFZJSJH22VWCZCDE62OVYWMQ 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: Add a qpair parameter to ndp(), ndp_send(), ndp_na(), and ndp_ra(), forwarding it to tap_icmp6_send() instead of hardcoding QPAIR_DEFAULT, so solicited replies (NA to NS, RA to RS) go out on the same queue pair the solicitation arrived on. ndp_send_init_req(), ndp_unsolicited_na(), and ndp_timer() are unsolicited, low-volume messages with no meaningful queue pair context, so they hardcode QPAIR_DEFAULT internally. No functional change. Signed-off-by: Laurent Vivier --- ndp.c | 33 +++++++++++++++++++-------------- ndp.h | 2 +- tap.c | 2 +- 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/ndp.c b/ndp.c index 6269cb38d93f..400cee3e926f 100644 --- a/ndp.c +++ b/ndp.c @@ -175,26 +175,28 @@ struct ndp_ns { /** * ndp_send() - Send an NDP message * @c: Execution context + * @qpair: Queue pair on which to send the message * @dst: IPv6 address to send the message to * @buf: ICMPv6 header + message payload * @l4len: Length of message, including ICMPv6 header */ -static void ndp_send(const struct ctx *c, const struct in6_addr *dst, - const void *buf, size_t l4len) +static void ndp_send(const struct ctx *c, unsigned int qpair, + const struct in6_addr *dst, const void *buf, size_t l4len) { const struct in6_addr *src = &c->ip6.our_tap_ll; - tap_icmp6_send(c, QPAIR_DEFAULT, src, dst, buf, c->our_tap_mac, l4len); + tap_icmp6_send(c, qpair, src, dst, buf, c->our_tap_mac, l4len); } /** * ndp_na() - Send an NDP Neighbour Advertisement (NA) message * @c: Execution context + * @qpair: Queue pair on which to send the NA * @dst: IPv6 address to send the NA to * @addr: IPv6 address to advertise */ -static void ndp_na(const struct ctx *c, const struct in6_addr *dst, - const struct in6_addr *addr) +static void ndp_na(const struct ctx *c, unsigned int qpair, + const struct in6_addr *dst, const struct in6_addr *addr) { union inany_addr tgt; struct ndp_na na = { @@ -217,7 +219,7 @@ static void ndp_na(const struct ctx *c, const struct in6_addr *dst, inany_from_af(&tgt, AF_INET6, addr); fwd_neigh_mac_get(c, &tgt, na.target_l2_addr.mac); - ndp_send(c, dst, &na, sizeof(na)); + ndp_send(c, qpair, dst, &na, sizeof(na)); } /** @@ -228,15 +230,17 @@ static void ndp_na(const struct ctx *c, const struct in6_addr *dst, void ndp_unsolicited_na(const struct ctx *c, const struct in6_addr *addr) { if (tap_is_ready(c)) - ndp_na(c, &in6addr_ll_all_nodes, addr); + ndp_na(c, QPAIR_DEFAULT, &in6addr_ll_all_nodes, addr); } /** * ndp_ra() - Send an NDP Router Advertisement (RA) message * @c: Execution context + * @qpair: Queue pair on which to send the RA * @dst: IPv6 address to send the RA to */ -static void ndp_ra(const struct ctx *c, const struct in6_addr *dst) +static void ndp_ra(const struct ctx *c, unsigned int qpair, + const struct in6_addr *dst) { struct ndp_ra ra = { .ih = { @@ -344,18 +348,19 @@ static void ndp_ra(const struct ctx *c, const struct in6_addr *dst) memcpy(&ra.source_ll.mac, c->our_tap_mac, ETH_ALEN); /* NOLINTNEXTLINE(clang-analyzer-security.PointerSub) */ - ndp_send(c, dst, &ra, ptr - (unsigned char *)&ra); + ndp_send(c, qpair, dst, &ra, ptr - (unsigned char *)&ra); } /** * ndp() - Check for NDP solicitations, reply as needed * @c: Execution context + * @qpair: Queue pair on which to send replies * @saddr: Source IPv6 address * @data: Single packet with ICMPv6 header * * Return: 0 if not handled here, 1 if handled, -1 on failure */ -int ndp(const struct ctx *c, const struct in6_addr *saddr, +int ndp(const struct ctx *c, unsigned int qpair, const struct in6_addr *saddr, struct iov_tail *data) { struct icmp6hdr ih_storage; @@ -384,13 +389,13 @@ int ndp(const struct ctx *c, const struct in6_addr *saddr, info("NDP: received NS, sending NA"); - ndp_na(c, saddr, &ns->target_addr); + ndp_na(c, qpair, saddr, &ns->target_addr); } else if (ih->icmp6_type == RS) { if (c->no_ra) return 1; info("NDP: received RS, sending RA"); - ndp_ra(c, saddr); + ndp_ra(c, qpair, saddr); } return 1; @@ -448,7 +453,7 @@ void ndp_timer(const struct ctx *c, const struct timespec *now) info("NDP: sending unsolicited RA, next in %llds", (long long)interval); - ndp_ra(c, &in6addr_ll_all_nodes); + ndp_ra(c, QPAIR_DEFAULT, &in6addr_ll_all_nodes); first: next_ra = now->tv_sec + interval; @@ -471,5 +476,5 @@ void ndp_send_init_req(const struct ctx *c) .target_addr = c->ip6.addr }; debug("Sending initial NDP NS request for guest MAC address"); - ndp_send(c, &c->ip6.addr, &ns, sizeof(ns)); + ndp_send(c, QPAIR_DEFAULT, &c->ip6.addr, &ns, sizeof(ns)); } diff --git a/ndp.h b/ndp.h index 56b756d8400b..d33f08d4b802 100644 --- a/ndp.h +++ b/ndp.h @@ -8,7 +8,7 @@ struct icmp6hdr; -int ndp(const struct ctx *c, const struct in6_addr *saddr, +int ndp(const struct ctx *c, unsigned int qpair, const struct in6_addr *saddr, struct iov_tail *data); void ndp_timer(const struct ctx *c, const struct timespec *now); void ndp_send_init_req(const struct ctx *c); diff --git a/tap.c b/tap.c index 8bd1db427721..029888e32db5 100644 --- a/tap.c +++ b/tap.c @@ -1029,7 +1029,7 @@ resume: continue; ndp_data = data; - if (ndp(c, saddr, &ndp_data)) + if (ndp(c, qpair, saddr, &ndp_data)) continue; tap_packet_debug(NULL, ip6h, NULL, proto, NULL, 1); -- 2.54.0