From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 60F5BC55A for ; Fri, 19 Feb 2016 12:08:48 +0100 (CET) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 19 Feb 2016 03:07:46 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,470,1449561600"; d="scan'208";a="889481611" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by orsmga001.jf.intel.com with ESMTP; 19 Feb 2016 03:07:45 -0800 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id u1JB7goa028247; Fri, 19 Feb 2016 19:07:42 +0800 Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1]) by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id u1JB7eDG007052; Fri, 19 Feb 2016 19:07:42 +0800 Received: (from xiaowan1@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id u1JB7eOk007048; Fri, 19 Feb 2016 19:07:40 +0800 From: Wang Xiao W To: jing.d.chen@intel.com Date: Fri, 19 Feb 2016 19:07:02 +0800 Message-Id: <1455880025-6912-16-git-send-email-xiao.w.wang@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1455880025-6912-1-git-send-email-xiao.w.wang@intel.com> References: <1453866647-16215-2-git-send-email-xiao.w.wang@intel.com> <1455880025-6912-1-git-send-email-xiao.w.wang@intel.com> Cc: dev@dpdk.org Subject: [dpdk-dev] [PATCH v3 15/18] fm10k/base: fix TLV structures alignment X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Feb 2016 11:08:49 -0000 Per comments from an upstream 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: e24fed68236a ("fm10k: pack TLV overlay structures correctly") Signed-off-by: Wang Xiao W --- drivers/net/fm10k/base/fm10k_pf.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/fm10k/base/fm10k_pf.h b/drivers/net/fm10k/base/fm10k_pf.h index 92e2962..ee8527a 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 { -- 1.9.3