Re: [PATCH net-next 06/10] net/mlx4_core: Fix struct mlx4_vhcr_cmd to make implicit padding explicit

David Miller
2015-01-27T19:13:36Z

From: David Laight <David.Laight@ACULAB.COM>
Date: Tue, 27 Jan 2015 09:43:27 +0000

>> __be64 out_param;
>> __be16 token;
>> u16 reserved;
>> u8 status;
>> u8 flags;
>> __be16 opcode;
>> -};
>> +} __packed;
>
> Don't add '__packed' unless you expect the structure to be misaligned
> in memory.
> On systems that fault mis-aligned memory requests you've requested the
> compiler generate code to read/write everything using byte sized memory
> accesses and a lot of shifting and masking.

Indeed, I'm really sick of seeing these packed structures being
created all over the place.

They are to be used in absolutely extreme cases where no other
solution is possible.