From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 157C75A026D for ; Fri, 9 Feb 2024 06:02:07 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202312; t=1707454925; bh=nB2c84JhzOrz2abeSLLX+NaKKhbpXX2mc2oPR+shdyg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=kVq7Ki8oFCuFMtGkFCbXn8pWjYwad+Q9IF6UKouiseeNs+KGlibkhCM79VObNdATe ibo74x+Hg7hht7wx67+g6octZpoYE1d/fSgiDhqg/6kDHNpKH7pMiGZHgK/oWWki1O CeOXk3oacsrD9QDhv+EhcyQ+fJz+9YOddSZOOImmjdq+ull1/4UwbhcB2TAhfwZVRX d3iEbRXzVeL170W+hhO20P4be9m3qYxJn8aMl5uQ2EJhiXB5a0sWDmqiCHR0M12JTZ kUYOqK+ThjplGxEltBaec6i/LP6k+QqkDph52mpfgKcOpAP31paIJ+TKCJTio8w4e5 wR4QLL5YGyBZQ== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4TWMCd0yL9z4wcq; Fri, 9 Feb 2024 16:02:04 +1100 (AEDT) Date: Fri, 9 Feb 2024 16:02:01 +1100 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH 12/24] tap: make tap_update_mac() generic Message-ID: References: <20240202141151.3762941-1-lvivier@redhat.com> <20240202141151.3762941-13-lvivier@redhat.com> <20240208181051.12433bf7@elisabeth> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="03wz4kRqlHTJLnEF" Content-Disposition: inline In-Reply-To: <20240208181051.12433bf7@elisabeth> Message-ID-Hash: ECQSTTX5JJIXO7UYB32LXBNGFEOUWFYB X-Message-ID-Hash: ECQSTTX5JJIXO7UYB32LXBNGFEOUWFYB 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: Laurent Vivier , 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: --03wz4kRqlHTJLnEF Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Feb 08, 2024 at 06:10:51PM +0100, Stefano Brivio wrote: > On Tue, 6 Feb 2024 12:49:40 +1100 > David Gibson wrote: >=20 > > On Fri, Feb 02, 2024 at 03:11:39PM +0100, Laurent Vivier wrote: > > > Use ethhdr rather than tap_hdr. > > >=20 > > > Signed-off-by: Laurent Vivier =20 > >=20 > > Reviewed-by: David Gibson > >=20 > > I'd be happy to see this applied immediately, in advance of the rest > > of the series. >=20 > Oh, hm, do you need this for something around the flow table? I just > have one nit below: Need? No, not really. I just think it's clearer, independent of the VU changes. >=20 > > > --- > > > tap.c | 6 +++--- > > > tap.h | 2 +- > > > tcp_buf.c | 8 ++++---- > > > udp.c | 4 ++-- > > > 4 files changed, 10 insertions(+), 10 deletions(-) > > >=20 > > > diff --git a/tap.c b/tap.c > > > index 3ea03f720d6d..29f389057ac1 100644 > > > --- a/tap.c > > > +++ b/tap.c > > > @@ -447,13 +447,13 @@ size_t tap_send_frames(const struct ctx *c, con= st struct iovec *iov, size_t n) > > > * @eth_d: Ethernet destination address, NULL if unchanged > > > * @eth_s: Ethernet source address, NULL if unchanged > > > */ > > > -void tap_update_mac(struct tap_hdr *taph, > > > +void eth_update_mac(struct ethhdr *eh, >=20 > ...function comment should be updated accordingly. >=20 > > > const unsigned char *eth_d, const unsigned char *eth_s) > > > { > > > if (eth_d) > > > - memcpy(taph->eh.h_dest, eth_d, sizeof(taph->eh.h_dest)); > > > + memcpy(eh->h_dest, eth_d, sizeof(eh->h_dest)); > > > if (eth_s) > > > - memcpy(taph->eh.h_source, eth_s, sizeof(taph->eh.h_source)); > > > + memcpy(eh->h_source, eth_s, sizeof(eh->h_source)); > > > } > > > =20 > > > PACKET_POOL_DECL(pool_l4, UIO_MAXIOV, pkt_buf); > > > diff --git a/tap.h b/tap.h > > > index 466d91466c3d..437b9aa2b43f 100644 > > > --- a/tap.h > > > +++ b/tap.h > > > @@ -74,7 +74,7 @@ void tap_icmp6_send(const struct ctx *c, > > > const void *in, size_t len); > > > int tap_send(const struct ctx *c, const void *data, size_t len); > > > size_t tap_send_frames(const struct ctx *c, const struct iovec *iov,= size_t n); > > > -void tap_update_mac(struct tap_hdr *taph, > > > +void eth_update_mac(struct ethhdr *eh, > > > const unsigned char *eth_d, const unsigned char *eth_s); > > > void tap_listen_handler(struct ctx *c, uint32_t events); > > > void tap_handler_pasta(struct ctx *c, uint32_t events, > > > diff --git a/tcp_buf.c b/tcp_buf.c > > > index d70e7f810e4a..4c1f00c1d1b2 100644 > > > --- a/tcp_buf.c > > > +++ b/tcp_buf.c > > > @@ -218,10 +218,10 @@ void tcp_buf_update_l2(const unsigned char *eth= _d, const unsigned char *eth_s) > > > struct tcp4_l2_buf_t *b4 =3D &tcp4_l2_buf[i]; > > > struct tcp6_l2_buf_t *b6 =3D &tcp6_l2_buf[i]; > > > =20 > > > - tap_update_mac(&b4->taph, eth_d, eth_s); > > > - tap_update_mac(&b6->taph, eth_d, eth_s); > > > - tap_update_mac(&b4f->taph, eth_d, eth_s); > > > - tap_update_mac(&b6f->taph, eth_d, eth_s); > > > + eth_update_mac(&b4->taph.eh, eth_d, eth_s); > > > + eth_update_mac(&b6->taph.eh, eth_d, eth_s); > > > + eth_update_mac(&b4f->taph.eh, eth_d, eth_s); > > > + eth_update_mac(&b6f->taph.eh, eth_d, eth_s); > > > } > > > } > > > =20 > > > diff --git a/udp.c b/udp.c > > > index 96b4e6ca9a85..db635742319b 100644 > > > --- a/udp.c > > > +++ b/udp.c > > > @@ -283,8 +283,8 @@ void udp_update_l2_buf(const unsigned char *eth_d= , const unsigned char *eth_s) > > > struct udp4_l2_buf_t *b4 =3D &udp4_l2_buf[i]; > > > struct udp6_l2_buf_t *b6 =3D &udp6_l2_buf[i]; > > > =20 > > > - tap_update_mac(&b4->taph, eth_d, eth_s); > > > - tap_update_mac(&b6->taph, eth_d, eth_s); > > > + eth_update_mac(&b4->taph.eh, eth_d, eth_s); > > > + eth_update_mac(&b6->taph.eh, eth_d, eth_s); > > > } > > > } > > > =20 > >=20 >=20 --=20 David Gibson | 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 --03wz4kRqlHTJLnEF Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmXFscgACgkQzQJF27ox 2Gdvlw//d9faQLpos8gaolAGBmhln0ZnCt886D6NtdEAhrAxSfW2eClnLgIZflbR NZKTvh0lPkc9jV6QnxNCTHky113T47zxnvGmwqo9L4YJlMpch0jvL4hbwHHPAhkG eTE1szXZNSBqbeTTmqalApM497dQiMCuDjTExjWvzeJab8oRpdt7fokTV6idcS1M fRqQ8bruyQAThpIvUTgaiX/rtBaFo7/eQ3IuzPwVd4mw+rBNt5sJ7brHttNqxEg8 WYAXEjaX70vnAzx/klsMXNC0lhFmomsrv42t/JI8PQ+jiyIXniIX8lylhu0Tq9Nz dBjKacfFW21+1sOuki8Re24Uweyooc1PmPHZkbbYLROG44IFm3OX6B2NOuYiuCPK c70+Vth6UK1/FYgebLBMuHVEa1X3JBTDQehKCTwsNCtBRPwDt76j/vFY77EKepql gK3e1BpT/0Yft5I6mUboiX3cxuBcSUUrHdJEtaEA3L2GcMb+Ewg+/vaHQwUOJftV YRzhI/BXK0iOwIiUMj/f8y4E35Yw8TAcnGLL1GCd0BAhdH8ZRWG/Nj4ppOyqoEVl +B/Bx2kc4HME0tNXUBmtGhCvhfUXCGo1KHhfx6tRhmLa6lTon7WyrSnCMkiz+Pi4 jOgU65wcRKsFq1AU8CDhXJUxsJyFlAnEA1l141QBE+rMbmR1p/c= =3fqD -----END PGP SIGNATURE----- --03wz4kRqlHTJLnEF--