lkml.org 
[lkml]   [2017]   [Sep]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    SubjectRe: [PATCH v2 02/16] thunderbolt: Add support for XDomain properties
    From
    From: Mika Westerberg <mika.westerberg@linux.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.

    \
     
     \ /
      Last update: 2017-09-27 18:23    [W:2.220 / U:0.224 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site