Thread (28 messages) flat view 28 messages, 4 authors, 2017-09-27

RE: [PATCH v2 02/16] thunderbolt: Add support for XDomain properties

From: David Laight <hidden>
Date: 2017-09-27 16:10:07
Also in: lkml

From: Mika Westerberg
Sent: 27 September 2017 12:33
...
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?
You've endianness considerations as well with on-wire formats.

__packed indicates two things:
1) There will be no padding bytes between fields.
2) The structure itself might appear on any byte boundary.

The latter causes the compiler to do byte memory accesses and
shifts to load/store the data on some architectures.
So only mark things __packed when they might be misaligned in
memory.

	David
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help