On Tue, Jun 16, 2026 at 02:51:28PM +0200, Laurent Vivier wrote: > Add a qpair parameter to ndp(), ndp_send(), ndp_na(), > ndp_unsolicited_na(), ndp_ra(), and ndp_send_init_req(), forwarding > it to tap_icmp6_send() instead of hardcoding QPAIR_DEFAULT. > > ndp_timer() and fwd_neigh_table_update() have no queue pair context > and keep using QPAIR_DEFAULT. > > No functional change. > > Signed-off-by: Laurent Vivier > --- > fwd.c | 2 +- > ndp.c | 40 ++++++++++++++++++++++++---------------- > ndp.h | 7 ++++--- > tap.c | 4 ++-- > 4 files changed, 31 insertions(+), 22 deletions(-) > > diff --git a/fwd.c b/fwd.c > index 0d0e265b7dc0..1bfe024ada26 100644 > --- a/fwd.c > +++ b/fwd.c > @@ -147,7 +147,7 @@ void fwd_neigh_table_update(const struct ctx *c, const union inany_addr *addr, > if (inany_v4(addr)) > arp_announce(c, QPAIR_DEFAULT, inany_v4(addr), e->mac); > else > - ndp_unsolicited_na(c, &addr->a6); > + ndp_unsolicited_na(c, QPAIR_DEFAULT, &addr->a6); > } > > /** > diff --git a/ndp.c b/ndp.c > index 6269cb38d93f..00d1751ba100 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,26 +219,30 @@ 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)); > } > > /** > * ndp_unsolicited_na() - Send unsolicited NA > * @c: Execution context > + * @qpair: Queue pair on which to send the NA > * @addr: IPv6 address to advertise > */ > -void ndp_unsolicited_na(const struct ctx *c, const struct in6_addr *addr) > +void ndp_unsolicited_na(const struct ctx *c, unsigned int qpair, > + const struct in6_addr *addr) Since this is unsolicited, how would the caller have a better idea of the right qpair than we could here? > { > if (tap_is_ready(c)) > - ndp_na(c, &in6addr_ll_all_nodes, addr); > + ndp_na(c, qpair, &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 +350,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 +391,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 +455,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; > @@ -457,8 +464,9 @@ first: > /** > * ndp_send_init_req() - Send initial NDP NS to retrieve guest MAC address > * @c: Execution context > + * @qpair: Queue pair on which to send the request > */ > -void ndp_send_init_req(const struct ctx *c) > +void ndp_send_init_req(const struct ctx *c, unsigned int qpair) > { > struct ndp_ns ns = { > .ih = { > @@ -471,5 +479,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, &c->ip6.addr, &ns, sizeof(ns)); > } > diff --git a/ndp.h b/ndp.h > index 56b756d8400b..8c168fc199fe 100644 > --- a/ndp.h > +++ b/ndp.h > @@ -8,10 +8,11 @@ > > 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); > -void ndp_unsolicited_na(const struct ctx *c, const struct in6_addr *addr); > +void ndp_send_init_req(const struct ctx *c, unsigned int qpair); > +void ndp_unsolicited_na(const struct ctx *c, unsigned int qpair, > + const struct in6_addr *addr); > > #endif /* NDP_H */ > diff --git a/tap.c b/tap.c > index de1e5269526c..5e9c7a1701bf 100644 > --- a/tap.c > +++ b/tap.c > @@ -1030,7 +1030,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); > @@ -1470,7 +1470,7 @@ static void tap_start_connection(const struct ctx *c, unsigned int qpair) > if (c->ifi4) > arp_send_init_req(c, qpair); > if (c->ifi6 && !c->no_ndp) > - ndp_send_init_req(c); > + ndp_send_init_req(c, qpair); > } > > /** > -- > 2.54.0 > -- 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