public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Laurent Vivier <lvivier@redhat.com>
Cc: passt-dev@passt.top
Subject: Re: [PATCH v6 10/12] ndp: Pass queue pair explicitly through NDP send path
Date: Mon, 3 Aug 2026 13:27:51 +1000	[thread overview]
Message-ID: <anAKqXZ6E7nUwBo-@zatzit> (raw)
In-Reply-To: <20260731161617.3550626-11-lvivier@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 6247 bytes --]

On Fri, Jul 31, 2026 at 06:16:15PM +0200, Laurent Vivier wrote:
> 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 <lvivier@redhat.com>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  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
> 

-- 
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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2026-08-03  3:46 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-31 16:16 [PATCH v6 00/12] vhost-user: Add multiqueue support Laurent Vivier
2026-07-31 16:16 ` [PATCH v6 01/12] tap: Remove pool parameter from tap4_handler() and tap6_handler() Laurent Vivier
2026-07-31 16:16 ` [PATCH v6 02/12] vhost-user: Advertise multiqueue support Laurent Vivier
2026-08-03  2:03   ` David Gibson
2026-07-31 16:16 ` [PATCH v6 03/12] test: Add multiqueue support to vhost-user test infrastructure Laurent Vivier
2026-07-31 16:16 ` [PATCH v6 04/12] tap: Thread queue pair through all remaining tap paths Laurent Vivier
2026-08-03  3:10   ` David Gibson
2026-07-31 16:16 ` [PATCH v6 05/12] arp: Pass queue pair explicitly through ARP send path Laurent Vivier
2026-08-03  3:10   ` David Gibson
2026-07-31 16:16 ` [PATCH v6 06/12] tcp: Pass queue pair explicitly through TCP " Laurent Vivier
2026-08-03  3:17   ` David Gibson
2026-07-31 16:16 ` [PATCH v6 07/12] udp: Pass queue pair explicitly through UDP " Laurent Vivier
2026-08-03  3:22   ` David Gibson
2026-07-31 16:16 ` [PATCH v6 08/12] dhcp/dhcpv6: Pass queue pair explicitly through DHCP " Laurent Vivier
2026-08-03  3:24   ` David Gibson
2026-07-31 16:16 ` [PATCH v6 09/12] icmp: Pass queue pair explicitly through ICMP " Laurent Vivier
2026-08-03  3:26   ` David Gibson
2026-07-31 16:16 ` [PATCH v6 10/12] ndp: Pass queue pair explicitly through NDP " Laurent Vivier
2026-08-03  3:27   ` David Gibson [this message]
2026-07-31 16:16 ` [PATCH v6 11/12] flow: Add queue pair tracking to flow management Laurent Vivier
2026-08-03  3:40   ` David Gibson
2026-07-31 16:16 ` [PATCH v6 12/12] flow: Derive epoll fd from queue pair, removing epollid field Laurent Vivier
2026-08-03  3:46   ` David Gibson

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=anAKqXZ6E7nUwBo-@zatzit \
    --to=david@gibson.dropbear.id.au \
    --cc=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).