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 031325A027A for ; Thu, 15 Feb 2024 04:13:56 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202312; t=1707966832; bh=Lj/vLxCLHUHBqLDTzLQOKwu95sfTlb310nh+fqYM6nU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=sFC95TdoIFs1jZVDD5fEwz2VrCEErzIcZJW24BMhZCxfKpLpAStIIsHynohTq5JqN ajglDV4xQwiU4pmcaL3+AJVVpRc1XKhnK+IFsgQyo0jJOEt1Bw1ma/GBQwFAW1ZW75 uQfMKkCMG9wsBg/ecgRIJ44xKWOKltpFp1d+Wci8D0j7jP0BZPTfzXyCkMDftC2Tmt BZmrGLzuPDse2MXHMull8pLaoeOsozTJG0OL5OF2+WUr+2eWJ2Mfc01OuPWfLDqvLW 1K+l0bA8+/ICFRXloTzljiXQq0pKitVpLpz9Cv9UNcSnaYYZw0f7N5ripnLhdjE377 Ov+ie2H3uA1lQ== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4Tb0X05l73z4wxv; Thu, 15 Feb 2024 14:13:52 +1100 (AEDT) Date: Thu, 15 Feb 2024 14:13:47 +1100 From: David Gibson To: Laurent Vivier Subject: Re: [PATCH v2 8/8] tap: make tap_update_mac() generic Message-ID: References: <20240214085628.210783-1-lvivier@redhat.com> <20240214085628.210783-9-lvivier@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="xMmhCz73/iQuQmJD" Content-Disposition: inline In-Reply-To: <20240214085628.210783-9-lvivier@redhat.com> Message-ID-Hash: J2QVVWJX3BVKAQEAZNHS4TRG6K4E4ZXO X-Message-ID-Hash: J2QVVWJX3BVKAQEAZNHS4TRG6K4E4ZXO 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: --xMmhCz73/iQuQmJD Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Feb 14, 2024 at 09:56:28AM +0100, Laurent Vivier wrote: > Use ethhdr rather than tap_hdr. >=20 > Signed-off-by: Laurent Vivier Reviewed-by: David Gibson > --- >=20 > Notes: > v2: > - update function comment > - move the patch earlier in the series >=20 > tap.c | 10 +++++----- > tap.h | 2 +- > tcp.c | 8 ++++---- > udp.c | 4 ++-- > 4 files changed, 12 insertions(+), 12 deletions(-) >=20 > diff --git a/tap.c b/tap.c > index 02b51100d089..9ffb0f0a88d4 100644 > --- a/tap.c > +++ b/tap.c > @@ -457,18 +457,18 @@ size_t tap_send_frames(const struct ctx *c, const s= truct iovec *iov, size_t n) > } > =20 > /** > - * tap_update_mac() - Update tap L2 header with new Ethernet addresses > - * @taph: Tap headers to update > + * eth_update_mac() - Update tap L2 header with new Ethernet addresses > + * @eh: Ethernet headers to update > * @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.c b/tcp.c > index 6a0020f708c0..1c80299111f3 100644 > --- a/tcp.c > +++ b/tcp.c > @@ -974,10 +974,10 @@ void tcp_update_l2_buf(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 bf24288d5751..97c1292f6b59 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 --xMmhCz73/iQuQmJD Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmXNgWoACgkQzQJF27ox 2GflmQ/+PXvlhE5cyMtJiYry8wHl0wjUx31557J/DQN0sRYQHwimsM5KgLDKDwUy Xub2bmXF268XDyY4GTWwpHHwaqJ07KGArBT/vkKXyUJPw/I3hW+0UApGA1gKeL4J F42WsKuZj03Bhh8C2AhqDhaHIn091dYROhB39uYuCfDlprBwS6UJCUP+RFHy/9gE xZ+qPrB3bYU8OXJn5s8xCNWTESMtAaY5+SmCwrnwsEhPoUhUsacYpb/CaudgNmyI Ih/34Ozd15ARWWQwPrim8nOkyQi5VS0OeJOB1ykTCfhNOT/NqmTRVsnBNmIvHFMg 7+f5mTqGmkYL0ZWT+53peOws3twHyvh6k7mWrysphMlXcKakI8EURrcDn1wHHKoa hgrT6qv7myJ9KXa0fcsObklK8TYk3HpGT7nZzFikRzaW6c6dHl4mWoBuLl9yl0v+ gxEKoAne8n3Y06rNuMAU9eB0IO2g0HhybUtSfozMmgLcTU08EG+fwHhIqBWdVmVF gWb2uAUceBKBWE4r1fGIgDev9LHwVD5ubXhV88Ahu/jtpH6qO6/wFLEBFnQnFNeO mP1VmHhYPdMfSxDPCTnhLKrV/Re8SSpSKLQTYPk1CaREZHvP+d68DUYECnDSWwFx 1ue70uqZuLv51hNLeoXkl6ojgl3IiLd2lXYm9alKztfdZrIqHu4= =JmGt -----END PGP SIGNATURE----- --xMmhCz73/iQuQmJD--