> From: linux-usb-owner@xxxxxxxxxxxxxxx [mailto:linux-usb-owner@xxxxxxxxxxxxxxx] On Behalf Of David Laight > Sent: Monday, November 18, 2013 1:36 AM > > > It doesn't look like the networking subsystem (which seems to be the > > code you're most familiar with) uses packed, but plenty of other > > subsystems do. > > I'm necessarily trying to change the world here :-) But ... > > I suspect a few places have got caught out where 32bit values > get 16bit aligned and 64bit values are only 32bit aligned. > eg the x86 bios partition table and (IIRC) some scsi commands. > > There are also many places where C structures are used to map > device registers (for memory mapped access) - these must be > marked 'packed'. > > There are also small (and probably measurable in some network > benchmark) unnecessary costs in marking items 'packed' on systems > where unaligned accesses aren't supported. > The networking stack goes to great lengths to avoid misaligned > buffers. AFAICT very few of the 'packed' structures in the usb > headers will ever get misaligned. > > Even if a structure has (say) a 64bit item that is only 32bit > aligned then the single field can be given an alignment attribute > so that two 32bit accesses are generated - rather than the eight > 8bit ones that 'packed' required. I think you're overlooking the fact that the usb structures can come in over the wire and end up in a buffer somewhere. If there are several of these back-to-back (as in the configuration descriptor), then the start of the individual structs won't necessarily be aligned as you expect them to be. -- Paul -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html