lkml.org 
[lkml]   [2023]   [Jun]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH 3/3] sfc: selftest: fix struct packing
Date
...
> Duplicating the definition isn't the prettiest thing in the world; it'd
> do for a quick fix if needed but I assume W=1 warnings aren't blocking
> anyone, so maybe defer this one for now and I'll follow up soon with a
> rewrite that fixes this more cleanly? My idea is to drop the __packed
> from the containing struct, make efx_begin_loopback() copy the layers
> separately, and efx_loopback_rx_packet() similarly do something less
> direct than casting the packet data to the struct.

Maybe you can get away with adding a 16bit pad before the ethernet
header so that the IP header is actually aligned.

(Then fight all the stuff that stops you doing a memcpy()
that runs into a second field of a structure.)

Failing that maybe a single shared copy of the misaligned
IP header.

I also suspect you could just add __packed to the two 32bit
address fields.
That would generate better code on systems that care.

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
\
 
 \ /
  Last update: 2023-06-23 12:54    [W:0.069 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site