[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170927.092216.1164977518037321262.davem@davemloft.net>
Date: Wed, 27 Sep 2017 09:22:16 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: mika.westerberg@...ux.intel.com
Cc: gregkh@...uxfoundation.org, andreas.noever@...il.com,
michael.jamet@...el.com, yehezkel.bernat@...el.com,
amir.jer.levy@...el.com, Mario.Limonciello@...l.com,
lukas@...ner.de, andriy.shevchenko@...ux.intel.com, andrew@...n.ch,
linux-kernel@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: [PATCH v2 02/16] thunderbolt: Add support for XDomain
properties
From: Mika Westerberg <mika.westerberg@...ux.intel.com>
Date: Wed, 27 Sep 2017 14:32:41 +0300
> Just for my education, is there some rule which tells when __packed is
> to be used? For example the above structures are all 32-bit aligned but
> how about something like:
>
> struct foo {
> u32 value1;
> u8 value2;
> };
>
> If the on-wire format requires such structures I assume __packed
> is needed here?
Usually header elements are 32-bit aligned in a protocol, so it wouldn't
be specified like that.
The only legitimate case I've seen is where things are purposefully
misaligned within the header, like this:
struct foo {
u16 x;
u64 y;
u16 z;
};
Where the 'y' element is 2-byte aligned.
Fortunately, those situations are extremely rare.
Powered by blists - more mailing lists