[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <c16273f9-f6e9-492d-a902-64604f3e40c2@app.fastmail.com>
Date: Thu, 22 Jun 2023 13:38:54 +0200
From: "Arnd Bergmann" <arnd@...db.de>
To: edward.cree@....com, linux-net-drivers@....com,
"David S . Miller" <davem@...emloft.net>, "Jakub Kicinski" <kuba@...nel.org>,
"Eric Dumazet" <edumazet@...gle.com>, "Paolo Abeni" <pabeni@...hat.com>
Cc: "Edward Cree" <ecree.xilinx@...il.com>, Netdev <netdev@...r.kernel.org>,
"Martin Habets" <habetsm.xilinx@...il.com>
Subject: Re: [PATCH net-next 1/3] sfc: use padding to fix alignment in loopback test
On Thu, Jun 22, 2023, at 12:18, edward.cree@....com wrote:
> drivers/net/ethernet/sfc/selftest.c | 45 +++++++++++++++++------------
> 1 file changed, 27 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/net/ethernet/sfc/selftest.c
> b/drivers/net/ethernet/sfc/selftest.c
> index 3c5227afd497..74b42efe7267 100644
> --- a/drivers/net/ethernet/sfc/selftest.c
> +++ b/drivers/net/ethernet/sfc/selftest.c
> @@ -42,12 +42,16 @@
> * Falcon only performs RSS on TCP/UDP packets.
> */
> struct efx_loopback_payload {
> + char pad[2]; /* Ensures ip is 4-byte aligned */
> struct ethhdr header;
> struct iphdr ip;
> struct udphdr udp;
> __be16 iteration;
> char msg[64];
> } __packed;
There should probably be an extra __aligned(4) after the __packed,
so that the compiler knows the start of the structure is aligned,
otherwise (depending on the architecture and compiler), any access
to a member can still turn into multiple single-byte accesses.
I would also expect to still see a warning without that extra
attribute. Aside from this, the patch looks good to me.
Arnd
Powered by blists - more mailing lists