From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 0017A5A0275 for ; Tue, 6 Feb 2024 02:52:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202312; t=1707184366; bh=xJNlBj/i7b74sj9V53jsJiv1cZ0Z9PoEAShuyYJ6/YQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=nQWwYUuILRqb6XTdIB4QBnFZeJZxRqVJU9eF5gZBzLmD05u2u/jd04qoK2LwlmYvP fTaFmBn0ERxU2SlIZRgJEtbGnFIursNsv+kWdGAkYBqPL0fqY3F3LpCVtO3HfOAQfV iVOTn/PsCtzE9RsyIKnglT79PT5o9sXZhmqbTp++6We9eiBj88o+o/ArDiMBFi8onf cZi6FC8Ijyg8fUToIUWYTSgUc8iSJv2MWzmkQiCciRONKCwoug+Anw5+LRpeVF5STE bcAVYqO7yAVE+Wc9U7CPOPXbwHgPwBUTxnqHVm8ZpIPv+Fbvc9UPZwjEacWdEBhCdp z+Itbs6G7/vAA== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4TTR8Z04Y9z4wxx; Tue, 6 Feb 2024 12:52:46 +1100 (AEDT) Date: Tue, 6 Feb 2024 12:49:40 +1100 From: David Gibson To: Laurent Vivier 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> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="EhECtfQ3b6JenuXH" Content-Disposition: inline In-Reply-To: <20240202141151.3762941-13-lvivier@redhat.com> Message-ID-Hash: OJPIT4UBIVLEZIXA5EM62EN2BLIAAH6C X-Message-ID-Hash: OJPIT4UBIVLEZIXA5EM62EN2BLIAAH6C 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: --EhECtfQ3b6JenuXH Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 Reviewed-by: David Gibson I'd be happy to see this applied immediately, in advance of the rest of the series. > --- > 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, const s= truct 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, > 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, siz= e_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, co= nst 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 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 --EhECtfQ3b6JenuXH Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmXBkDMACgkQzQJF27ox 2GdrIRAAk8b7JSFlj4Wi4db37YI+ud/ScxyLyBL8eclnCVIZ/mcFF6OdhxSYAS8d ROsBqGlM1a17C2tfa5rDKQ6BJInVBZFi1xZo7ewOl9gd+sVhR/fqvwkDJmUZ4npd 9TPqzYjQWZJyWi/qsyNmdSdCcOGRvk3Lc0Dw9Mui1g8Hrkis6Be+ZffveeC+FeFZ FtPWNVTAbOnr5i7GQizWr/XzjxE2CGY8Swibf3wNCyBvDmc4+4hgwEZgZ+rS3eF3 L7hhrfufwZz44PdQsucxLnwGM4YCO5lS2hJGHT2LHM/Y4gkvjNZD731Ke1MaulPX cD8kGlqJz4+RoW5O+74v3q7NvWpLvACoUvi7WogxA288nH6UoHkWRwr7zKULzcGc B6ziUbhuFdj6ca1ww4XQCb8+YN4HC9rmRZDNyPgrExo7CTYV50ngih6VInKNd+EE dkLLRUyRGB5kcf1yYPGOHKQz0gtwuM/3YYgWOtRZ31McuJsIjww5wMHcWZhsCVJo 3cpvYRrlmHdO9b7ahEcnllFS1B9bR7pxuH0Ums+zOJBp6U0Txr5hZc/tXb25lma0 ssaIei9qtAu+12HiI6U13u+RsqiENz3dwXQyFu+MBRa3mxYP7Ct3CxIZToRekVKu o7iYRl52i1IWXgRayxx8l/OexngHgRv7xujT3M05TeuV6rxwajo= =CiaZ -----END PGP SIGNATURE----- --EhECtfQ3b6JenuXH--