On Thu, Feb 13, 2025 at 03:06:14PM -0800, Nelson, Shannon wrote: > > > +/** > > > + * struct pds_fwctl_cmd - Firmware control command structure > > > + * @opcode: Opcode > > > + * @rsvd: Word boundary padding > > > + * @ep: Endpoint identifier. > > > + * @op: Operation identifier. > > > + */ > > > +struct pds_fwctl_cmd { > > > + u8 opcode; > > > + u8 rsvd[3]; > > > + __le32 ep; > > > + __le32 op; > > > +} __packed; > > None of these actually need to be packed given explicit padding to > > natural alignment of all fields. Arguably it does no harm though > > so up to you. > > Old belt-and-suspenders habits... In that case it is worth knowing that __packed also changes the assumed alignment of the struct. You can access a __packed struct at any byte. On x86 this is mostly meaningless, but on other arches it can effect code generation as the compiler will have to assume that, say, a 64 bit load is not naturally aligned and emit a more expensive sequence to load it. Which is why you occasionally see things like: __attribute__ ((packed,aligned(8))); Which says that there is no padding inside the struct, but also that the compiler can assume a guaranteed starting alignment for the memory. Jason