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 24143A0093; Tue, 19 May 2020 22:19:07 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 970251D454; Tue, 19 May 2020 22:19:06 +0200 (CEST) Received: from new3-smtp.messagingengine.com (new3-smtp.messagingengine.com [66.111.4.229]) by dpdk.org (Postfix) with ESMTP id 386A51D37E for ; Tue, 19 May 2020 22:19:04 +0200 (CEST) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailnew.nyi.internal (Postfix) with ESMTP id 7C4C6581A40; Tue, 19 May 2020 16:19:02 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Tue, 19 May 2020 16:19:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s=fm1; bh= ns6EqZE7tEDlPyax3Bl7m+C5PXFTobU6sy3/3c+c800=; b=N7x6PZQhJ7/IIXr+ v8lEcwBMMv3kkp7NqsxuVX1/Dqpomc2JEbZPovq2lH3JUXkidQpDORkR6JOrmv95 RdDBBwvEAaeExXxgv6emQUggPJEFmvoj2LheXj2/PrnxuQmwLrO5ylAuG6HTdzh/ hkjscKqDjWfKF6PLTfq6cpFJhXYXij/6yA47jRg+hftpUNtiyDTdRTXWZYvSLaIQ ARSISmAm6MM2oVepMb97EHZCzuxdPi3K1LoHqbglqLns4WjTju7Mu415xemrNcup UFVOpKGRCHiPaoLTDicMXVBI6IdkO0Ji4sVNSV2GaqgZRdDTD8stJ0m9Vk757rE2 5ehSVQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=ns6EqZE7tEDlPyax3Bl7m+C5PXFTobU6sy3/3c+c8 00=; b=iPWUq8Xm3hyZ8WsbUGM3WfuortQ7pNrkGSWsF7Gtbr4T1Oq3Q+BDwDHai dUbmXz+evEC47BY6F2frl+eDK5zLwjaf9Av+UM4oKSVMVOEJRqeGsceE/vZF1wKC C9kiNHd0jRuzrb3aZC62yl8AHzvG/Flq9PZzRTONcdy/pd5nyVMb8TN4mpemU7LR G7xce7BNImVLm5p2lTeff0iHlCurCeAxbm0QpgESYEcHLHd8/gb72i2yqkLNBHwT aSAHYceZNr8wbkFPcftGWGSO5e9rCr4poQAyY+HpmKjC0zxCAyToc+gUmu7+wdrF CTJMcdamBPnQKauChd+pnUd7wM0eg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedruddtjedgudeggecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkfgjfhgggfgtsehtuf ertddttddvnecuhfhrohhmpefvhhhomhgrshcuofhonhhjrghlohhnuceothhhohhmrghs sehmohhnjhgrlhhonhdrnhgvtheqnecuggftrfgrthhtvghrnhepudeggfdvfeduffdtfe eglefghfeukefgfffhueejtdetuedtjeeuieeivdffgeehnecukfhppeejjedrudefgedr vddtfedrudekgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfh hrohhmpehthhhomhgrshesmhhonhhjrghlohhnrdhnvght X-ME-Proxy: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 0AC273066426; Tue, 19 May 2020 16:18:58 -0400 (EDT) From: Thomas Monjalon To: Dmitry Kozlyuk , talshn@mellanox.com Cc: dev@dpdk.org, pallavi.kadam@intel.com, ranjit.menon@intel.com, navasile@linux.microsoft.com, olivier.matz@6wind.com, harini.ramakrishnan@microsoft.com, ocardona@microsoft.com, david.marchand@redhat.com, arybchenko@solarflare.com, bruce.richardson@intel.com, jerinj@marvell.com, drc@linux.vnet.ibm.com, ruifeng.wang@arm.com, konstantin.ananyev@intel.com Date: Tue, 19 May 2020 22:18:57 +0200 Message-ID: <1935350.G7KYNPxu0G@thomas> In-Reply-To: <20200519225753.56c663ac@sovereign> References: <20200519184111.4504-1-talshn@mellanox.com> <3106438.CAdn2TfLgq@thomas> <20200519225753.56c663ac@sovereign> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [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" 19/05/2020 21:57, Dmitry Kozlyuk: > On Tue, 19 May 2020 20:49:50 +0200 > Thomas Monjalon wrote: > > > +Cc more maintainers > > > > 19/05/2020 20:41, talshn@mellanox.com: > > > 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. */ }; > > > }; > > > > > > > > Such a clean and simple solution to what seemed to require compiler > workaround or fix! All offsets are equal on Windows and Linux for the > following toolchains, x86_64: > > * cross-compilation with MinGW-w64 6.0.0 GCC 9.3.0 > * Windows native MinGW-w64 6.0.0 GCC 8.1.0 and Clang 9.0.1 > > Tested-by: Dmitry Kozlyuk Would be interesting to see an offset comparison in little and big endian.