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 CEB8343D5B; Thu, 28 Mar 2024 00:09:31 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9147F410FC; Thu, 28 Mar 2024 00:09:23 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 17960402D8 for ; Thu, 28 Mar 2024 00:09:20 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 4210C20E67DF; Wed, 27 Mar 2024 16:09:19 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 4210C20E67DF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1711580959; bh=kp0voLVlsgnm3SiFtSQj+udwRi2MiyRQcwM5S0HhLJY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pZhkPPPlwz5L7khcjeJNjjIQnOp9IggSmUw6R/ArJzoDQPnYOcnEWNVbWmsxx5taP WMp5fbhV9e4ylQkWOACpGfRpxL1bSYVHC72sJtf1jw1SjidjivyjNsUA/20RXd3RiJ N8CbjeLHK1Q5Sj3UzoTBxd0ZMbxV5fnTPwk2BMps= From: Tyler Retzlaff To: dev@dpdk.org Cc: Akhil Goyal , Aman Singh , Anatoly Burakov , Bruce Richardson , Byron Marohn , Conor Walsh , Cristian Dumitrescu , Dariusz Sosnowski , David Hunt , Jerin Jacob , Jingjing Wu , Kirill Rybalchenko , Konstantin Ananyev , Matan Azrad , Ori Kam , Radu Nicolau , Ruifeng Wang , Sameh Gobriel , Sivaprasad Tummala , Suanming Mou , Sunil Kumar Kori , Vamsi Attunuru , Viacheslav Ovsiienko , Vladimir Medvedkin , Yipeng Wang , Yuying Zhang , Yuying Zhang , Tyler Retzlaff Subject: [PATCH v2 02/15] eal: pack structures when building with MSVC Date: Wed, 27 Mar 2024 16:09:05 -0700 Message-Id: <1711580958-20808-3-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1711580958-20808-1-git-send-email-roretzla@linux.microsoft.com> References: <1710968771-16435-1-git-send-email-roretzla@linux.microsoft.com> <1711580958-20808-1-git-send-email-roretzla@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 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 71523cf..4c929fb 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 842362d..73bb00d 100644 --- a/lib/eal/include/rte_memory.h +++ b/lib/eal/include/rte_memory.h @@ -46,6 +46,7 @@ /** * 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 931497f..ca312c0 100644 --- a/lib/eal/include/rte_memzone.h +++ b/lib/eal/include/rte_memzone.h @@ -45,6 +45,7 @@ * 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 41e2a7f..e786ee3 100644 --- a/lib/eal/include/rte_trace_point.h +++ b/lib/eal/include/rte_trace_point.h @@ -297,7 +297,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 72a9229..fdc5df0 100644 --- a/lib/eal/x86/include/rte_memcpy.h +++ b/lib/eal/x86/include/rte_memcpy.h @@ -57,12 +57,15 @@ * 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; -- 1.8.3.1