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 DD52145C45; Tue, 31 Dec 2024 19:40:55 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DD32340B8F; Tue, 31 Dec 2024 19:39:04 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id DE8E54060F for ; Tue, 31 Dec 2024 19:38:30 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id AE8AD204677F; Tue, 31 Dec 2024 10:38:28 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com AE8AD204677F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1735670309; bh=IjGisHNaE/xjpKOF8iuEXzxyBzqwP76PKWmzNm6cT+g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=paTbpnsffgThM194JZY5R8x05Pt9fFV1ywIrJfvLM0SKPUweWpSNDNJAqb6YDRY/r wwJpvJj8b9u/AAo7LvEHx9riBwEQoBDSgcNfNIe1Jfy7oEOFm4gdHP1PbrMrXRPP+g 0KYPA3Qj0iwMz4lX8O8W9dLarcA+ZTJE4aa4oPtY= From: Andre Muezerie To: roretzla@linux.microsoft.com Cc: 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, mb@smartsharesystems.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, Andre Muezerie Subject: [PATCH v8 25/29] lib/eal: replace packed attributes Date: Tue, 31 Dec 2024 10:38:07 -0800 Message-Id: <1735670291-23224-26-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1735670291-23224-1-git-send-email-andremue@linux.microsoft.com> References: <1710968771-16435-1-git-send-email-roretzla@linux.microsoft.com> <1735670291-23224-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 MSVC struct packing is not compatible with GCC. Replace macro __rte_packed with __rte_packed_begin to push existing pack value and set packing to 1-byte and macro __rte_packed_end to restore the pack value prior to the push. Macro __rte_packed_end is deliberately utilized to trigger a MSVC compiler warning if no existing packing has been pushed allowing easy identification of locations where the __rte_packed_begin is missing. Removed the packed attributes from some structures that don't need them. Signed-off-by: Andre Muezerie --- lib/eal/common/eal_private.h | 2 +- lib/eal/include/rte_memory.h | 4 ++-- lib/eal/include/rte_memzone.h | 4 ++-- lib/eal/include/rte_trace_point.h | 2 +- lib/eal/x86/include/rte_memcpy.h | 12 ++++++------ 5 files changed, 12 insertions(+), 12 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..249e0f5690 100644 --- a/lib/eal/include/rte_memory.h +++ b/lib/eal/include/rte_memory.h @@ -46,7 +46,7 @@ extern "C" { /** * Physical memory segment descriptor. */ -struct rte_memseg { +struct __rte_packed_begin rte_memseg { rte_iova_t iova; /**< Start IO address. */ union { void *addr; /**< Start virtual address. */ @@ -58,7 +58,7 @@ struct rte_memseg { uint32_t nchannel; /**< Number of channels. */ uint32_t nrank; /**< Number of ranks. */ uint32_t flags; /**< Memseg-specific flags */ -} __rte_packed; +} __rte_packed_end; /** * memseg list is a special case as we need to store a bunch of other data diff --git a/lib/eal/include/rte_memzone.h b/lib/eal/include/rte_memzone.h index e1563994d5..5a0e1b8a15 100644 --- a/lib/eal/include/rte_memzone.h +++ b/lib/eal/include/rte_memzone.h @@ -45,7 +45,7 @@ extern "C" { * A structure describing a memzone, which is a contiguous portion of * physical memory identified by a name. */ -struct rte_memzone { +struct __rte_packed_begin rte_memzone { #define RTE_MEMZONE_NAMESIZE 32 /**< Maximum length of memory zone name.*/ char name[RTE_MEMZONE_NAMESIZE]; /**< Name of the memory zone. */ @@ -62,7 +62,7 @@ struct rte_memzone { int32_t socket_id; /**< NUMA socket ID. */ uint32_t flags; /**< Characteristics of this memzone. */ -} __rte_packed; +} __rte_packed_end; /** * Set the maximum number of memzones. 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..46d34b8081 100644 --- a/lib/eal/x86/include/rte_memcpy.h +++ b/lib/eal/x86/include/rte_memcpy.h @@ -67,15 +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 */ - struct rte_uint64_alias { + struct __rte_packed_begin rte_uint64_alias { uint64_t val; - } __rte_packed __rte_may_alias; - struct rte_uint32_alias { + } __rte_packed_end __rte_may_alias; + struct __rte_packed_begin rte_uint32_alias { uint32_t val; - } __rte_packed __rte_may_alias; - struct rte_uint16_alias { + } __rte_packed_end __rte_may_alias; + struct __rte_packed_begin rte_uint16_alias { uint16_t val; - } __rte_packed __rte_may_alias; + } __rte_packed_end __rte_may_alias; void *ret = dst; if (n & 8) { -- 2.47.0.vfs.0.3