From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id BB46B45D3C; Tue, 19 Nov 2024 05:36:28 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0696D41104; Tue, 19 Nov 2024 05:36:20 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 48D404067E for ; Tue, 19 Nov 2024 05:36:15 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id 6D40C20BEBD4; Mon, 18 Nov 2024 20:36:14 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 6D40C20BEBD4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1731990974; bh=TvX2sMCRw7HQ/Uzk/clJKanbxUKS3M2bsnCFOVIreEQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k6gQAiJihEXGoCjQrXv9Micn+4v/5qFDkxv4DrWFAxcOP+kSUQCKk22WFMY2XT07b 7p0gDHFNLxWMGqOVVYXoFLTMALMkgPusU7GfmObiuj3hsRJ8dwZS9nFXXuYETNhM4f N6gBeAfTDZAeuA5bq8cKYeCDLeG7Rb9NGvuhjR3w= From: Andre Muezerie To: roretzla@linux.microsoft.com Cc: Yuying.Zhang@intel.com, aman.deep.singh@intel.com, anatoly.burakov@intel.com, bruce.richardson@intel.com, byron.marohn@intel.com, conor.walsh@intel.com, cristian.dumitrescu@intel.com, david.hunt@intel.com, dev@dpdk.org, dsosnowski@nvidia.com, gakhil@marvell.com, jerinj@marvell.com, jingjing.wu@intel.com, kirill.rybalchenko@intel.com, konstantin.v.ananyev@yandex.ru, matan@nvidia.com, orika@nvidia.com, radu.nicolau@intel.com, ruifeng.wang@arm.com, sameh.gobriel@intel.com, sivaprasad.tummala@amd.com, skori@marvell.com, stephen@networkplumber.org, suanmingm@nvidia.com, vattunuru@marvell.com, viacheslavo@nvidia.com, vladimir.medvedkin@intel.com, yipeng1.wang@intel.com Subject: [PATCH v5 02/16] eal: pack structures when building with MSVC Date: Mon, 18 Nov 2024 20:35:27 -0800 Message-Id: <1731990941-10001-3-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1731990941-10001-1-git-send-email-andremue@linux.microsoft.com> References: <1710968771-16435-1-git-send-email-roretzla@linux.microsoft.com> <1731990941-10001-1-git-send-email-andremue@linux.microsoft.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Tyler Retzlaff Add __rte_msvc_pack to all __rte_packed structs to cause packing when building with MSVC. Remove __rte_packed where it appears natural alignment without packing would produce the same layout or the struct is internal. Signed-off-by: Tyler Retzlaff --- lib/eal/common/eal_private.h | 2 +- lib/eal/include/rte_memory.h | 1 + lib/eal/include/rte_memzone.h | 1 + lib/eal/include/rte_trace_point.h | 2 +- lib/eal/x86/include/rte_memcpy.h | 3 +++ 5 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/eal/common/eal_private.h b/lib/eal/common/eal_private.h index bb315dab04..3b94e01b5b 100644 --- a/lib/eal/common/eal_private.h +++ b/lib/eal/common/eal_private.h @@ -62,7 +62,7 @@ struct rte_config { * DPDK instances */ struct rte_mem_config *mem_config; -} __rte_packed; +}; /** * Get the global configuration structure. diff --git a/lib/eal/include/rte_memory.h b/lib/eal/include/rte_memory.h index dbd0a6bedc..fffbd2ed65 100644 --- a/lib/eal/include/rte_memory.h +++ b/lib/eal/include/rte_memory.h @@ -46,6 +46,7 @@ extern "C" { /** * Physical memory segment descriptor. */ +__rte_msvc_pack struct rte_memseg { rte_iova_t iova; /**< Start IO address. */ union { diff --git a/lib/eal/include/rte_memzone.h b/lib/eal/include/rte_memzone.h index e1563994d5..e52bdc91b8 100644 --- a/lib/eal/include/rte_memzone.h +++ b/lib/eal/include/rte_memzone.h @@ -45,6 +45,7 @@ extern "C" { * A structure describing a memzone, which is a contiguous portion of * physical memory identified by a name. */ +__rte_msvc_pack struct rte_memzone { #define RTE_MEMZONE_NAMESIZE 32 /**< Maximum length of memory zone name.*/ diff --git a/lib/eal/include/rte_trace_point.h b/lib/eal/include/rte_trace_point.h index 87b5f43c3c..b24db3b6da 100644 --- a/lib/eal/include/rte_trace_point.h +++ b/lib/eal/include/rte_trace_point.h @@ -298,7 +298,7 @@ struct __rte_trace_stream_header { rte_uuid_t uuid; uint32_t lcore_id; char thread_name[__RTE_TRACE_EMIT_STRING_LEN_MAX]; -} __rte_packed; +}; struct __rte_trace_header { uint32_t offset; diff --git a/lib/eal/x86/include/rte_memcpy.h b/lib/eal/x86/include/rte_memcpy.h index 42058e4a3f..fed715ca33 100644 --- a/lib/eal/x86/include/rte_memcpy.h +++ b/lib/eal/x86/include/rte_memcpy.h @@ -67,12 +67,15 @@ rte_mov15_or_less(void *dst, const void *src, size_t n) * Use the following structs to avoid violating C standard * alignment requirements and to avoid strict aliasing bugs */ + __rte_msvc_pack struct rte_uint64_alias { uint64_t val; } __rte_packed __rte_may_alias; + __rte_msvc_pack struct rte_uint32_alias { uint32_t val; } __rte_packed __rte_may_alias; + __rte_msvc_pack struct rte_uint16_alias { uint16_t val; } __rte_packed __rte_may_alias; -- 2.47.0.vfs.0.3