From: Xiao Wang Date: Fri, 19 Feb 2016 11:07:02 +0000 (+0800) Subject: fm10k/base: fix TLV structures alignment X-Git-Tag: spdx-start~7325 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=fbdd4dff3660de875ece3cd28fe1211967d00bb1;p=dpdk.git fm10k/base: fix TLV structures alignment Per comments from an upstream kernel patch, and looking at how TLV LE_STRUCT code works, we actually want these structures to be 4byte aligned, not 1byte aligned. In practice, 1byte alignment has worked so far because all our structures end up being a multiple of 4. But if a future TLV structure were added that had a u8 or similar sticking on the end things would break. Fix this by using 4byte alignment which will prevent the TLV LE_STRUCT code from breaking. Update the comment explaining that we need 4byte alignment of our structures. Fixes: 925c862cbc21 ("fm10k/base: pack TLV overlay structures") Signed-off-by: Wang Xiao W Tested-by: Heng Ding Acked-by: Jing Chen --- diff --git a/drivers/net/fm10k/base/fm10k_pf.h b/drivers/net/fm10k/base/fm10k_pf.h index 92e29626af..ee8527af05 100644 --- a/drivers/net/fm10k/base/fm10k_pf.h +++ b/drivers/net/fm10k/base/fm10k_pf.h @@ -91,14 +91,14 @@ enum fm10k_pf_tlv_attr_id_v1 { #define FM10K_MSG_UPDATE_PVID_PVID_SHIFT 16 #define FM10K_MSG_UPDATE_PVID_PVID_SIZE 16 -/* The following data structures are overlayed specifically to TLV mailbox - * messages, and must not have gaps between their values. They must line up - * correctly to the TLV definition. +/* The following data structures are overlayed directly onto TLV mailbox + * messages, and must not break 4 byte alignment. Ensure the structures line + * up correctly as per their TLV definition. */ #ifdef C99 -#pragma pack(push, 1) +#pragma pack(push, 4) #else -#pragma pack(1) +#pragma pack(4) #endif /* C99 */ struct fm10k_mac_update {