From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 50445A0093; Tue, 19 May 2020 20:41:31 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E7A1F1D181; Tue, 19 May 2020 20:41:30 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id DFC301D17E for ; Tue, 19 May 2020 20:41:29 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE2 (envelope-from talshn@mellanox.com) with ESMTPS (AES256-SHA encrypted); 19 May 2020 21:41:27 +0300 Received: from l-wincomp04-vm.labs.mlnx (l-wincomp04-vm.mtl.labs.mlnx [10.237.1.5]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 04JIfQob018119; Tue, 19 May 2020 21:41:26 +0300 From: talshn@mellanox.com To: dev@dpdk.org Cc: thomas@monjalon.net, pallavi.kadam@intel.com, dmitry.kozliuk@gmail.com, ranjit.menon@intel.com, navasile@linux.microsoft.com, olivier.matz@6wind.com, harini.ramakrishnan@microsoft.com, ocardona@microsoft.com, Tal Shnaiderman Date: Tue, 19 May 2020 21:41:11 +0300 Message-Id: <20200519184111.4504-1-talshn@mellanox.com> X-Mailer: git-send-email 2.16.1.windows.4 Subject: [dpdk-dev] [PATCH] mbuf: align rte_mbuf for Windows X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Tal Shnaiderman Using uint32_t type bit-fields in Windows will pads the 'L2/L3/L4 and tunnel information' union with additional bits. This padding causes rte_mbuf size misalignment and the total size increases to 3 cache-lines. Changed packet_type bit-fields types from uint32_t to uint8_t to allow unified 2 cache-line structure size. Added the __extension__ attribute over the modified struct to avoid the warning: type of bit-field ... is a GCC extension [-pedantic] Signed-off-by: Tal Shnaiderman --- lib/librte_mbuf/rte_mbuf_core.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/librte_mbuf/rte_mbuf_core.h b/lib/librte_mbuf/rte_mbuf_core.h index b9a59c879..82441555e 100644 --- a/lib/librte_mbuf/rte_mbuf_core.h +++ b/lib/librte_mbuf/rte_mbuf_core.h @@ -521,11 +521,12 @@ struct rte_mbuf { RTE_STD_C11 union { uint32_t packet_type; /**< L2/L3/L4 and tunnel information. */ + __extension__ struct { - uint32_t l2_type:4; /**< (Outer) L2 type. */ - uint32_t l3_type:4; /**< (Outer) L3 type. */ - uint32_t l4_type:4; /**< (Outer) L4 type. */ - uint32_t tun_type:4; /**< Tunnel type. */ + uint8_t l2_type:4; /**< (Outer) L2 type. */ + uint8_t l3_type:4; /**< (Outer) L3 type. */ + uint8_t l4_type:4; /**< (Outer) L4 type. */ + uint8_t tun_type:4; /**< Tunnel type. */ RTE_STD_C11 union { uint8_t inner_esp_next_proto; @@ -541,7 +542,7 @@ struct rte_mbuf { /**< Inner L3 type. */ }; }; - uint32_t inner_l4_type:4; /**< Inner L4 type. */ + uint8_t inner_l4_type:4; /**< Inner L4 type. */ }; }; -- 2.16.1.windows.4