From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202508 header.b=VkVh/Dhp; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id D65035A0285 for ; Wed, 06 Aug 2025 08:35:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202508; t=1754462131; bh=ydgD5btzKkWQdDINfZtlAoGAneUntjZl9IfI69Qs1qw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=VkVh/Dhpezlfx3CWhNtE0OBMlo49PKh29/qawxxixmKcNCRAl4YdnIaeL3ZZZ7y/6 6NCOJueciXYM5zI1cfThp1KYmJTd9tSSvPCvXQ8/T1nV637h009S3fZwUYgpk3MWpI A5DBbUvmc+rDQjPQn3mVprOSl5Ds918SarRqZLRvjNF3SCQJ5peZV581TYx9vYf9Df 8mIzD72XE7AI1liJ6tOl33yNMHv0pOkSFGz0NTWZt4deHl4Kpu11/E8joX+oNVM4Cn fh5Se8M4xt+4jfL4qr5smbDtpzwXCUz9PaCJduBVY5tJIjMTqCnYr3NJiuRsE4Nhor MBY46PBcRDV5A== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4bxgXM1b2zz4xcw; Wed, 6 Aug 2025 16:35:31 +1000 (AEST) Date: Wed, 6 Aug 2025 16:31:03 +1000 From: David Gibson To: Laurent Vivier Subject: Re: [PATCH v8 26/30] ndp: use iov_tail rather than pool Message-ID: References: <20250805154628.301343-1-lvivier@redhat.com> <20250805154628.301343-27-lvivier@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="uVogzF9Kt1dRxY1V" Content-Disposition: inline In-Reply-To: <20250805154628.301343-27-lvivier@redhat.com> Message-ID-Hash: VEUNDK5TLZ572NE7SFTXNYSPOFACWNJT X-Message-ID-Hash: VEUNDK5TLZ572NE7SFTXNYSPOFACWNJT X-MailFrom: dgibson@gandalf.ozlabs.org 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: passt-dev@passt.top 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: --uVogzF9Kt1dRxY1V Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Aug 05, 2025 at 05:46:24PM +0200, Laurent Vivier wrote: > The ndp() function signature is changed to accept `struct iov_tail *data` > directly, replacing the previous `const struct pool *p` and > `const struct icmp6hdr *ih` parameters. >=20 > This change simplifies callers, like tap6_handler(), which now provide > the iov_tail representing the L4 ICMPv6 segment directly to ndp(). >=20 > Signed-off-by: Laurent Vivier Reviewed-by: David Gibson > --- > ndp.c | 19 +++++++++++-------- > ndp.h | 4 ++-- > tap.c | 10 +++------- > 3 files changed, 16 insertions(+), 17 deletions(-) >=20 > diff --git a/ndp.c b/ndp.c > index ba87a0aaa6e9..eb090cd2c5a7 100644 > --- a/ndp.c > +++ b/ndp.c > @@ -336,13 +336,20 @@ static void ndp_ra(const struct ctx *c, const struc= t in6_addr *dst) > * ndp() - Check for NDP solicitations, reply as needed > * @c: Execution context > * @saddr: Source IPv6 address > - * @p: Packet pool > + * @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 icmp6hdr *ih, > - const struct in6_addr *saddr, const struct pool *p) > +int ndp(const struct ctx *c, const struct in6_addr *saddr, > + struct iov_tail *data) > { > + struct icmp6hdr ih_storage; > + const struct icmp6hdr *ih; > + > + ih =3D IOV_PEEK_HEADER(data, ih_storage); > + if (!ih) > + return -1; > + > if (ih->icmp6_type < RS || ih->icmp6_type > NA) > return 0; > =20 > @@ -352,12 +359,8 @@ int ndp(const struct ctx *c, const struct icmp6hdr *= ih, > if (ih->icmp6_type =3D=3D NS) { > struct ndp_ns ns_storage; > const struct ndp_ns *ns; > - struct iov_tail data; > - > - if (!packet_get(p, 0, &data)) > - return -1; > =20 > - ns =3D IOV_REMOVE_HEADER(&data, ns_storage); > + ns =3D IOV_REMOVE_HEADER(data, ns_storage); > if (!ns) > return -1; > =20 > diff --git a/ndp.h b/ndp.h > index 41c2000356ec..b1dd5e82c085 100644 > --- a/ndp.h > +++ b/ndp.h > @@ -8,8 +8,8 @@ > =20 > struct icmp6hdr; > =20 > -int ndp(const struct ctx *c, const struct icmp6hdr *ih, > - const struct in6_addr *saddr, const struct pool *p); > +int ndp(const struct ctx *c, const struct in6_addr *saddr, > + struct iov_tail *data); > void ndp_timer(const struct ctx *c, const struct timespec *now); > =20 > #endif /* NDP_H */ > diff --git a/tap.c b/tap.c > index 48152a84674c..d327ec0c3d54 100644 > --- a/tap.c > +++ b/tap.c > @@ -942,9 +942,7 @@ resume: > } > =20 > if (proto =3D=3D IPPROTO_ICMPV6) { > - struct icmp6hdr l4h_storage; > - const struct icmp6hdr *l4h; > - PACKET_POOL_P(pkt, 1, in->buf, in->buf_size); > + struct iov_tail ndp_data; > =20 > if (c->no_icmp) > continue; > @@ -952,10 +950,8 @@ resume: > if (l4len < sizeof(struct icmp6hdr)) > continue; > =20 > - packet_add(pkt, &data); > - > - l4h =3D IOV_PEEK_HEADER(&data, l4h_storage); > - if (ndp(c, (struct icmp6hdr *)l4h, saddr, pkt)) > + ndp_data =3D data; > + if (ndp(c, saddr, &ndp_data)) > continue; > =20 > tap_packet_debug(NULL, ip6h, NULL, proto, NULL, 1); --=20 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 --uVogzF9Kt1dRxY1V Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmiS9p0ACgkQzQJF27ox 2GcIag/9FtTNqCi/iYOgkjUZjR9yJCfaYnK/EayeOGJRkMPC0Ya/ECkj2k8AoMmE exPyozLJ5Aa8ujDn6iNw9+ZbVpi3cg4Xj7rnOorbg+WRwHJomYmOmF1pUJzeHFgg PifqkeulM9/IpTov8XWrYT4x+UD+rJubUKufEloV06QSM5IWDhBIr2Syt1UDEN6Y 7QVH5/QkOfptL/vPXg4mgNwEVUYK0t+vm+R6zQr9CEb95KOdLqctjmR3V9nG42Ov 00F3HPC2sHMnDHjX1MsEPgE1dSr2VKmj8bWW9G3MUFoq7aBTlq5e3TuopvD9OGil Y0vHNv4lfWsdwu4/1WAtSk2/xXtU0QvH1YumHfwVrULRtabN1yU4ESYqCT+bGBPK ZvwsPGgB/B4yy7lURmoazelfOLiSiEv2cWScnUDdIXXHiTtCH9GaTndhhM2CSta6 oBPOuT6533lY0VUK7b8xtKtHWu3dsXdS9na7hTCYCgY/oVUBio8sGAeGvkT7djQK IxTxlVZzn/J25mHn41JPKK6Zk78jQPZ6RF73/H/tqx6r+1U9LYL5so3ANLDQdzj3 sGop+TfNXyMH994scW3Hh1dyS87gDeOPmV+ElebjAP6a+rKMim0nXYabiJ0QEN9f Xe9I0edH/3lTcMdTR0quvHbYlxin3JXnPw8Rp/KpZWB4hkZ0ju8= =QB7B -----END PGP SIGNATURE----- --uVogzF9Kt1dRxY1V--