From patchwork Tue May 2 03:15:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 126640 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C8DDA42A38; Tue, 2 May 2023 05:15:46 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4E4AF40E2D; Tue, 2 May 2023 05:15:46 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 7286840E2D for ; Tue, 2 May 2023 05:15:44 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id BD9C321C3F19; Mon, 1 May 2023 20:15:43 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com BD9C321C3F19 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1682997343; bh=OKMsHs6voU+2aB6BlwmYyzsB9lUVWS0DE5o9leltMkI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DGc/9wF26sS3I56ZvTrBCIQPXsT+bBDbcGmYLLf5jWJRkHmOK1IZOq99IbKdMeX5q 9ZMSPeinZRXFAzfIbI34lr1AQGM4RTdYchV6YmhPa4smXPzT8+43evkji1d+kJS2tJ jvxArHnook0wtYtEiAJKqm39rSQBmC45qdRJvqlk= From: Tyler Retzlaff To: dev@dpdk.org Cc: bruce.richardson@intel.com, david.marchand@redhat.com, thomas@monjalon.net, mb@smartsharesystems.com, konstantin.ananyev@huawei.com, Tyler Retzlaff Subject: [PATCH v8 01/14] eal: use rdtsc intrinsic Date: Mon, 1 May 2023 20:15:28 -0700 Message-Id: <1682997341-2271-2-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1682997341-2271-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1682997341-2271-1-git-send-email-roretzla@linux.microsoft.com> MIME-Version: 1.0 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 Inline assembly is not supported for MSVC x64. Convert code to use __rdtsc intrinsic. Signed-off-by: Tyler Retzlaff Acked-by: Konstantin Ananyev Acked-by: Morten Brørup --- lib/eal/x86/include/rte_cycles.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/eal/x86/include/rte_cycles.h b/lib/eal/x86/include/rte_cycles.h index a461a4d..cca5122 100644 --- a/lib/eal/x86/include/rte_cycles.h +++ b/lib/eal/x86/include/rte_cycles.h @@ -6,6 +6,12 @@ #ifndef _RTE_CYCLES_X86_64_H_ #define _RTE_CYCLES_X86_64_H_ +#ifndef RTE_TOOLCHAIN_MSVC +#include +#else +#include +#endif + #ifdef __cplusplus extern "C" { #endif @@ -23,6 +29,7 @@ static inline uint64_t rte_rdtsc(void) { +#ifdef RTE_LIBRTE_EAL_VMWARE_TSC_MAP_SUPPORT union { uint64_t tsc_64; RTE_STD_C11 @@ -32,7 +39,6 @@ }; } tsc; -#ifdef RTE_LIBRTE_EAL_VMWARE_TSC_MAP_SUPPORT if (unlikely(rte_cycles_vmware_tsc_map)) { /* ecx = 0x10000 corresponds to the physical TSC for VMware */ asm volatile("rdpmc" : @@ -42,11 +48,7 @@ return tsc.tsc_64; } #endif - - asm volatile("rdtsc" : - "=a" (tsc.lo_32), - "=d" (tsc.hi_32)); - return tsc.tsc_64; + return __rdtsc(); } static inline uint64_t From patchwork Tue May 2 03:15:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 126642 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0922642A38; Tue, 2 May 2023 05:15:59 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A066842D0E; Tue, 2 May 2023 05:15:48 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 8361F410FB for ; Tue, 2 May 2023 05:15:44 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id CA6EB21C3F1A; Mon, 1 May 2023 20:15:43 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com CA6EB21C3F1A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1682997343; bh=byPfLLUjMSJsBQ1JgxyTOR6ow5661BT1rTeQLtGbIts=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZlN8aQMzatq1n8la5wT4uQd/q1yFtx0w36vMf09Ql4eqGnw4birSDCfN2A5WNVDJ8 1ngLirzryEHoxzd/N+0e7NCC84+al6iXUtRbjdj92p7sZ599fpsFF6HOLs6tP2puXN E5MKkwPhEHMX3lDyaHFwWlgiIk6xfxoCjDuXPjPc= From: Tyler Retzlaff To: dev@dpdk.org Cc: bruce.richardson@intel.com, david.marchand@redhat.com, thomas@monjalon.net, mb@smartsharesystems.com, konstantin.ananyev@huawei.com, Tyler Retzlaff Subject: [PATCH v8 02/14] eal: use rtm and xtest intrinsics Date: Mon, 1 May 2023 20:15:29 -0700 Message-Id: <1682997341-2271-3-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1682997341-2271-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1682997341-2271-1-git-send-email-roretzla@linux.microsoft.com> MIME-Version: 1.0 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 Inline assembly is not supported for MSVC x64. Convert code to use _xend, _xabort and _xtest intrinsics. Signed-off-by: Tyler Retzlaff Acked-by: Bruce Richardson Acked-by: Konstantin Ananyev Acked-by: Morten Brørup --- config/x86/meson.build | 6 ++++++ lib/eal/x86/include/rte_rtm.h | 18 +++++------------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/config/x86/meson.build b/config/x86/meson.build index 54345c4..4c0b06c 100644 --- a/config/x86/meson.build +++ b/config/x86/meson.build @@ -30,6 +30,12 @@ if cc.get_define('__SSE4_2__', args: machine_args) == '' machine_args += '-msse4' endif +# enable restricted transactional memory intrinsics +# https://gcc.gnu.org/onlinedocs/gcc/x86-transactional-memory-intrinsics.html +if cc.get_id() != 'msvc' + machine_args += '-mrtm' +endif + base_flags = ['SSE', 'SSE2', 'SSE3','SSSE3', 'SSE4_1', 'SSE4_2'] foreach f:base_flags compile_time_cpuflags += ['RTE_CPUFLAG_' + f] diff --git a/lib/eal/x86/include/rte_rtm.h b/lib/eal/x86/include/rte_rtm.h index 36bf498..b84e58e 100644 --- a/lib/eal/x86/include/rte_rtm.h +++ b/lib/eal/x86/include/rte_rtm.h @@ -5,6 +5,7 @@ #ifndef _RTE_RTM_H_ #define _RTE_RTM_H_ 1 +#include /* Official RTM intrinsics interface matching gcc/icc, but works on older gcc compatible compilers and binutils. */ @@ -28,31 +29,22 @@ static __rte_always_inline unsigned int rte_xbegin(void) { - unsigned int ret = RTE_XBEGIN_STARTED; - - asm volatile(".byte 0xc7,0xf8 ; .long 0" : "+a" (ret) :: "memory"); - return ret; + return _xbegin(); } static __rte_always_inline void rte_xend(void) { - asm volatile(".byte 0x0f,0x01,0xd5" ::: "memory"); + _xend(); } /* not an inline function to workaround a clang bug with -O0 */ -#define rte_xabort(status) do { \ - asm volatile(".byte 0xc6,0xf8,%P0" :: "i" (status) : "memory"); \ -} while (0) +#define rte_xabort(status) _xabort(status) static __rte_always_inline int rte_xtest(void) { - unsigned char out; - - asm volatile(".byte 0x0f,0x01,0xd6 ; setnz %0" : - "=r" (out) :: "memory"); - return out; + return _xtest(); } #ifdef __cplusplus From patchwork Tue May 2 03:15:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 126641 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6D7BD42A38; Tue, 2 May 2023 05:15:52 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6F73042B8E; Tue, 2 May 2023 05:15:47 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 8676E41144 for ; Tue, 2 May 2023 05:15:44 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id D717A21C3F1B; Mon, 1 May 2023 20:15:43 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com D717A21C3F1B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1682997343; bh=7MuyWLqPrgllACGrADXQqvjc3As35FjdHAPbIRz7i3w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mt9rR3BwRKRNyrYvHQBBh7yuYNFL01vV5uVXwT7+Cc1fgKUtGqrN8BgDI+VJlPr0v xE/2mvBD2yep1crW9VlrsiuNNz9MAASrMbcUqMTGXx3ZpifNAmHawyE4dNXdjyTXIa GzVZck8VN1ZNcZVkqS3uRz00LhUWlJIJkm1Hh5a4= From: Tyler Retzlaff To: dev@dpdk.org Cc: bruce.richardson@intel.com, david.marchand@redhat.com, thomas@monjalon.net, mb@smartsharesystems.com, konstantin.ananyev@huawei.com, Tyler Retzlaff Subject: [PATCH v8 03/14] eal: use barrier intrinsics Date: Mon, 1 May 2023 20:15:30 -0700 Message-Id: <1682997341-2271-4-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1682997341-2271-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1682997341-2271-1-git-send-email-roretzla@linux.microsoft.com> MIME-Version: 1.0 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 Inline assembly is not supported for MSVC x64 instead expand rte_compiler_barrier as _ReadWriteBarrier and for rte_smp_mb _m_mfence intrinsics. Signed-off-by: Tyler Retzlaff Acked-by: Bruce Richardson Acked-by: Konstantin Ananyev Acked-by: Morten Brørup --- lib/eal/include/generic/rte_atomic.h | 4 ++++ lib/eal/x86/include/rte_atomic.h | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/lib/eal/include/generic/rte_atomic.h b/lib/eal/include/generic/rte_atomic.h index 234b268..e973184 100644 --- a/lib/eal/include/generic/rte_atomic.h +++ b/lib/eal/include/generic/rte_atomic.h @@ -116,9 +116,13 @@ * Guarantees that operation reordering does not occur at compile time * for operations directly before and after the barrier. */ +#ifndef RTE_TOOLCHAIN_MSVC #define rte_compiler_barrier() do { \ asm volatile ("" : : : "memory"); \ } while(0) +#else +#define rte_compiler_barrier() _ReadWriteBarrier() +#endif /** * Synchronization fence between threads based on the specified memory order. diff --git a/lib/eal/x86/include/rte_atomic.h b/lib/eal/x86/include/rte_atomic.h index f2ee1a9..569d3ab 100644 --- a/lib/eal/x86/include/rte_atomic.h +++ b/lib/eal/x86/include/rte_atomic.h @@ -66,11 +66,15 @@ static __rte_always_inline void rte_smp_mb(void) { +#ifndef RTE_TOOLCHAIN_MSVC #ifdef RTE_ARCH_I686 asm volatile("lock addl $0, -128(%%esp); " ::: "memory"); #else asm volatile("lock addl $0, -128(%%rsp); " ::: "memory"); #endif +#else + _mm_mfence(); +#endif } #define rte_io_mb() rte_mb() From patchwork Tue May 2 03:15:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 126644 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4D17042A38; Tue, 2 May 2023 05:16:13 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E5B8D42D35; Tue, 2 May 2023 05:15:50 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 8DF984114B for ; Tue, 2 May 2023 05:15:44 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id E435D21C3F1C; Mon, 1 May 2023 20:15:43 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com E435D21C3F1C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1682997343; bh=/n6LyB9S2KGWejOdD735duGMaOHGwfOgr77axzCuQ9U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nBtZqAeGCggPa7ZjXW+PaZnybnQ2SVXgh10b32aX+iVOOy4CLPevYAoiZlRwZ37WX blc09dIWetcz17/dMOZWa/l64+uRftz3826fpC3PneLHGU4M9by5XN/wVcK15FrazJ EMPfPklCn+QEucsUkOH4VZUPkXBJ2fYgHj/3ggoc= From: Tyler Retzlaff To: dev@dpdk.org Cc: bruce.richardson@intel.com, david.marchand@redhat.com, thomas@monjalon.net, mb@smartsharesystems.com, konstantin.ananyev@huawei.com, Tyler Retzlaff Subject: [PATCH v8 04/14] eal: use cpuid and cpuidex intrinsics Date: Mon, 1 May 2023 20:15:31 -0700 Message-Id: <1682997341-2271-5-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1682997341-2271-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1682997341-2271-1-git-send-email-roretzla@linux.microsoft.com> MIME-Version: 1.0 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 Inline assembly is not supported for MSVC x64 instead use __cpuid and __cpuidex intrinsics. Signed-off-by: Tyler Retzlaff Acked-by: Morten Brørup --- lib/eal/x86/rte_cpuflags.c | 4 ++++ lib/eal/x86/rte_cpuid.h | 7 +++++++ lib/eal/x86/rte_cycles.c | 36 ++++++++++++++++++++++++++++++++++++ lib/eal/x86/rte_hypervisor.c | 4 ++++ 4 files changed, 51 insertions(+) diff --git a/lib/eal/x86/rte_cpuflags.c b/lib/eal/x86/rte_cpuflags.c index d6b5182..e3624e7 100644 --- a/lib/eal/x86/rte_cpuflags.c +++ b/lib/eal/x86/rte_cpuflags.c @@ -165,9 +165,13 @@ struct feature_entry { if (maxleaf < feat->leaf) return 0; +#ifndef RTE_TOOLCHAIN_MSVC __cpuid_count(feat->leaf, feat->subleaf, regs[RTE_REG_EAX], regs[RTE_REG_EBX], regs[RTE_REG_ECX], regs[RTE_REG_EDX]); +#else + __cpuidex(regs, feat->leaf, feat->subleaf); +#endif /* check if the feature is enabled */ return (regs[feat->reg] >> feat->bit) & 1; diff --git a/lib/eal/x86/rte_cpuid.h b/lib/eal/x86/rte_cpuid.h index b773ad9..c6abaad 100644 --- a/lib/eal/x86/rte_cpuid.h +++ b/lib/eal/x86/rte_cpuid.h @@ -5,7 +5,9 @@ #ifndef RTE_CPUID_H #define RTE_CPUID_H +#ifndef RTE_TOOLCHAIN_MSVC #include +#endif enum cpu_register_t { RTE_REG_EAX = 0, @@ -16,4 +18,9 @@ enum cpu_register_t { typedef uint32_t cpuid_registers_t[4]; +#ifdef RTE_TOOLCHAIN_MSVC +int +__get_cpuid_max(unsigned int e, unsigned int *s); +#endif + #endif /* RTE_CPUID_H */ diff --git a/lib/eal/x86/rte_cycles.c b/lib/eal/x86/rte_cycles.c index 0e695ca..db56d39 100644 --- a/lib/eal/x86/rte_cycles.c +++ b/lib/eal/x86/rte_cycles.c @@ -4,7 +4,11 @@ #include #include +#ifndef RTE_TOOLCHAIN_MSVC #include +#else +#define bit_AVX (1 << 28) +#endif #include "eal_private.h" @@ -82,9 +86,25 @@ return 0; } +#ifdef RTE_TOOLCHAIN_MSVC +int +__get_cpuid_max(unsigned int e, unsigned int *s) +{ + uint32_t cpuinfo[4]; + + __cpuid(cpuinfo, e); + if (s) + *s = cpuinfo[1]; + return cpuinfo[0]; +} +#endif + uint64_t get_tsc_freq_arch(void) { +#ifdef RTE_TOOLCHAIN_MSVC + int cpuinfo[4]; +#endif uint64_t tsc_hz = 0; uint32_t a, b, c, d, maxleaf; uint8_t mult, model; @@ -97,14 +117,30 @@ maxleaf = __get_cpuid_max(0, NULL); if (maxleaf >= 0x15) { +#ifndef RTE_TOOLCHAIN_MSVC __cpuid(0x15, a, b, c, d); +#else + __cpuid(cpuinfo, 0x15); + a = cpuinfo[0]; + b = cpuinfo[1]; + c = cpuinfo[2]; + d = cpuinfo[3]; +#endif /* EBX : TSC/Crystal ratio, ECX : Crystal Hz */ if (b && c) return c * (b / a); } +#ifndef RTE_TOOLCHAIN_MSVC __cpuid(0x1, a, b, c, d); +#else + __cpuid(cpuinfo, 0x1); + a = cpuinfo[0]; + b = cpuinfo[1]; + c = cpuinfo[2]; + d = cpuinfo[3]; +#endif model = rte_cpu_get_model(a); if (check_model_wsm_nhm(model)) diff --git a/lib/eal/x86/rte_hypervisor.c b/lib/eal/x86/rte_hypervisor.c index c38cfc0..a9c2017 100644 --- a/lib/eal/x86/rte_hypervisor.c +++ b/lib/eal/x86/rte_hypervisor.c @@ -23,9 +23,13 @@ enum rte_hypervisor if (!rte_cpu_get_flag_enabled(RTE_CPUFLAG_HYPERVISOR)) return RTE_HYPERVISOR_NONE; +#ifndef RTE_TOOLCHAIN_MSVC __cpuid(HYPERVISOR_INFO_LEAF, regs[RTE_REG_EAX], regs[RTE_REG_EBX], regs[RTE_REG_ECX], regs[RTE_REG_EDX]); +#else + __cpuid(regs, HYPERVISOR_INFO_LEAF); +#endif for (reg = 1; reg < 4; reg++) memcpy(name + (reg - 1) * 4, ®s[reg], 4); name[12] = '\0'; From patchwork Tue May 2 03:15:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 126647 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E853442A38; Tue, 2 May 2023 05:16:32 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7577F42D42; Tue, 2 May 2023 05:15:54 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 64C36410FB for ; Tue, 2 May 2023 05:15:45 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id F244521C3F1D; Mon, 1 May 2023 20:15:43 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com F244521C3F1D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1682997343; bh=U8fBf6+L/dc/zzYVgJ5T4l8jR24GWdImZv4rIvBjEzY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qtc+wLGPlb23gqAKJiQYSA6cjdQKe8B0RHDMc+EMZo6PNqHT5uiipn2f2ra3ofwAD af5a5WVGftSn52NnTySHKSTUuTVlhSMYuxIZNxQlZdn8mQmjBK0QDC6PaY4Wk3u0OH Lcot8uSaHV+vuBMbapC2fuXqLDkGwFJvkgTjERnQ= From: Tyler Retzlaff To: dev@dpdk.org Cc: bruce.richardson@intel.com, david.marchand@redhat.com, thomas@monjalon.net, mb@smartsharesystems.com, konstantin.ananyev@huawei.com, Tyler Retzlaff Subject: [PATCH v8 05/14] eal: use umonitor umwait and tpause intrinsics Date: Mon, 1 May 2023 20:15:32 -0700 Message-Id: <1682997341-2271-6-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1682997341-2271-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1682997341-2271-1-git-send-email-roretzla@linux.microsoft.com> MIME-Version: 1.0 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 Inline assembly is not supported for MSVC x64 instead use _umonitor, _umwait and _tpause intrinsics. Signed-off-by: Tyler Retzlaff Acked-by: Morten Brørup Acked-by: Konstantin Ananyev --- lib/eal/x86/rte_power_intrinsics.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/eal/x86/rte_power_intrinsics.c b/lib/eal/x86/rte_power_intrinsics.c index f749da9..4066d13 100644 --- a/lib/eal/x86/rte_power_intrinsics.c +++ b/lib/eal/x86/rte_power_intrinsics.c @@ -109,9 +109,13 @@ */ /* set address for UMONITOR */ +#if defined(RTE_TOOLCHAIN_MSVC) || defined(__WAITPKG__) + _umonitor(pmc->addr); +#else asm volatile(".byte 0xf3, 0x0f, 0xae, 0xf7;" : : "D"(pmc->addr)); +#endif /* now that we've put this address into monitor, we can unlock */ rte_spinlock_unlock(&s->lock); @@ -123,10 +127,14 @@ goto end; /* execute UMWAIT */ +#if defined(RTE_TOOLCHAIN_MSVC) || defined(__WAITPKG__) + _umwait(tsc_l, tsc_h); +#else asm volatile(".byte 0xf2, 0x0f, 0xae, 0xf7;" : /* ignore rflags */ : "D"(0), /* enter C0.2 */ "a"(tsc_l), "d"(tsc_h)); +#endif end: /* erase sleep address */ @@ -153,10 +161,14 @@ return -ENOTSUP; /* execute TPAUSE */ +#if defined(RTE_TOOLCHAIN_MSVC) || defined(__WAITPKG__) + _tpause(tsc_l, tsc_h); +#else asm volatile(".byte 0x66, 0x0f, 0xae, 0xf7;" : /* ignore rflags */ : "D"(0), /* enter C0.2 */ "a"(tsc_l), "d"(tsc_h)); +#endif return 0; } From patchwork Tue May 2 03:15:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 126649 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 22D3C42A38; Tue, 2 May 2023 05:16:47 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BD51042D50; Tue, 2 May 2023 05:15:56 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 7673241153 for ; Tue, 2 May 2023 05:15:45 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 0B08F21C3F1E; Mon, 1 May 2023 20:15:43 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 0B08F21C3F1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1682997344; bh=DPD8oI/3ynEnar1nYzdtEOUrk27skrB5HMXpK1gTZqw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ilVAfEqDe/Hb3B+tqdBvVpAiaGWKZcBplIM7l2smnIrKli5oEVb14lXSDYcNlnl8g 9Aowm9KZjbU+DRm28XojF8lepAUsoGSTo0Ln34vMMt1ENE3vjngovD2QI0GuTB4M5B QD92o2MrujXTziuDj10WWFw+Zf14AIxNZywhWAgk= From: Tyler Retzlaff To: dev@dpdk.org Cc: bruce.richardson@intel.com, david.marchand@redhat.com, thomas@monjalon.net, mb@smartsharesystems.com, konstantin.ananyev@huawei.com, Tyler Retzlaff Subject: [PATCH v8 06/14] eal: use prefetch intrinsics Date: Mon, 1 May 2023 20:15:33 -0700 Message-Id: <1682997341-2271-7-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1682997341-2271-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1682997341-2271-1-git-send-email-roretzla@linux.microsoft.com> MIME-Version: 1.0 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 Inline assembly is not supported for MSVC x64 instead use _mm_prefetch and _mm_cldemote intrinsics. Signed-off-by: Tyler Retzlaff Acked-by: Bruce Richardson Acked-by: Morten Brørup Acked-by: Konstantin Ananyev --- lib/eal/x86/include/rte_prefetch.h | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/lib/eal/x86/include/rte_prefetch.h b/lib/eal/x86/include/rte_prefetch.h index 7fd01c4..239e611 100644 --- a/lib/eal/x86/include/rte_prefetch.h +++ b/lib/eal/x86/include/rte_prefetch.h @@ -9,30 +9,38 @@ extern "C" { #endif +#include + #include #include #include "generic/rte_prefetch.h" +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wcast-qual" + static inline void rte_prefetch0(const volatile void *p) { - asm volatile ("prefetcht0 %[p]" : : [p] "m" (*(const volatile char *)p)); + _mm_prefetch((const void *)p, _MM_HINT_T0); } static inline void rte_prefetch1(const volatile void *p) { - asm volatile ("prefetcht1 %[p]" : : [p] "m" (*(const volatile char *)p)); + _mm_prefetch((const void *)p, _MM_HINT_T1); } static inline void rte_prefetch2(const volatile void *p) { - asm volatile ("prefetcht2 %[p]" : : [p] "m" (*(const volatile char *)p)); + _mm_prefetch((const void *)p, _MM_HINT_T2); } static inline void rte_prefetch_non_temporal(const volatile void *p) { - asm volatile ("prefetchnta %[p]" : : [p] "m" (*(const volatile char *)p)); + _mm_prefetch((const void *)p, _MM_HINT_NTA); } +#pragma GCC diagnostic pop + +#ifndef RTE_TOOLCHAIN_MSVC /* * We use raw byte codes for now as only the newest compiler * versions support this instruction natively. @@ -43,6 +51,15 @@ static inline void rte_prefetch_non_temporal(const volatile void *p) { asm volatile(".byte 0x0f, 0x1c, 0x06" :: "S" (p)); } +#else +__rte_experimental +static inline void +rte_cldemote(const volatile void *p) +{ + _mm_cldemote(p); +} +#endif + #ifdef __cplusplus } From patchwork Tue May 2 03:15:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 126646 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B343A42A38; Tue, 2 May 2023 05:16:26 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3CEAB42D3F; Tue, 2 May 2023 05:15:53 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 572BA40E2D for ; Tue, 2 May 2023 05:15:45 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 18D6821C3F1F; Mon, 1 May 2023 20:15:43 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 18D6821C3F1F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1682997344; bh=w+QVq1B9vMO46jggBj+ImzeYs3RHkEKQSzKvJNzoXs8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hR3ZRTzN0isSTU04pYFEjQ+q34Yvgq0saPQU8Gnm4/othghgNQcfEwa6N9ucVBr1T RceknSfEzy0bJcyoCCKy0c/akjDTP6+KyKymb+weFSAusnNYPSKy5jl+2SjMDrjoVA ZBMeWc6BQ9lKF+OmAsDAjBlgIp000+k9zVSbi+4c= From: Tyler Retzlaff To: dev@dpdk.org Cc: bruce.richardson@intel.com, david.marchand@redhat.com, thomas@monjalon.net, mb@smartsharesystems.com, konstantin.ananyev@huawei.com, Tyler Retzlaff Subject: [PATCH v8 07/14] eal: use byte swap intrinsics Date: Mon, 1 May 2023 20:15:34 -0700 Message-Id: <1682997341-2271-8-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1682997341-2271-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1682997341-2271-1-git-send-email-roretzla@linux.microsoft.com> MIME-Version: 1.0 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 Inline assembly is not supported for MSVC x64 instead expand use _byteswap_u{ushort,ulong,uint64} intrinsics instead. Signed-off-by: Tyler Retzlaff Acked-by: Morten Brørup --- lib/eal/include/generic/rte_byteorder.h | 11 +++++++++++ lib/eal/x86/include/rte_byteorder.h | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/lib/eal/include/generic/rte_byteorder.h b/lib/eal/include/generic/rte_byteorder.h index a67e1d7..1e32a1b 100644 --- a/lib/eal/include/generic/rte_byteorder.h +++ b/lib/eal/include/generic/rte_byteorder.h @@ -234,6 +234,7 @@ #endif /* __DOXYGEN__ */ #ifdef RTE_FORCE_INTRINSICS +#ifndef RTE_TOOLCHAIN_MSVC #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) #define rte_bswap16(x) __builtin_bswap16(x) #endif @@ -241,6 +242,16 @@ #define rte_bswap32(x) __builtin_bswap32(x) #define rte_bswap64(x) __builtin_bswap64(x) +#else +/* + * note: we may want to #pragma intrsinsic(_byteswap_u{short,long,uint64}) + */ +#define rte_bswap16(x) _byteswap_ushort(x) + +#define rte_bswap32(x) _byteswap_ulong(x) + +#define rte_bswap64(x) _byteswap_uint64(x) +#endif #endif diff --git a/lib/eal/x86/include/rte_byteorder.h b/lib/eal/x86/include/rte_byteorder.h index a2dfecc..3d6e58e 100644 --- a/lib/eal/x86/include/rte_byteorder.h +++ b/lib/eal/x86/include/rte_byteorder.h @@ -18,6 +18,7 @@ #define RTE_BYTE_ORDER RTE_LITTLE_ENDIAN #endif +#ifndef RTE_TOOLCHAIN_MSVC /* * An architecture-optimized byte swap for a 16-bit value. * @@ -69,6 +70,7 @@ static inline uint32_t rte_arch_bswap32(uint32_t _x) rte_arch_bswap16(x))) #endif #endif +#endif #define rte_cpu_to_le_16(x) (x) #define rte_cpu_to_le_32(x) (x) @@ -86,11 +88,13 @@ static inline uint32_t rte_arch_bswap32(uint32_t _x) #define rte_be_to_cpu_32(x) rte_bswap32(x) #define rte_be_to_cpu_64(x) rte_bswap64(x) +#ifndef RTE_TOOLCHAIN_MSVC #ifdef RTE_ARCH_I686 #include "rte_byteorder_32.h" #else #include "rte_byteorder_64.h" #endif +#endif #ifdef __cplusplus } From patchwork Tue May 2 03:15:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 126648 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 747D242A38; Tue, 2 May 2023 05:16:40 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A214942D4A; Tue, 2 May 2023 05:15:55 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 6A0E741144 for ; Tue, 2 May 2023 05:15:45 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 25BD121C3F20; Mon, 1 May 2023 20:15:43 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 25BD121C3F20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1682997344; bh=hVcXjboUtlBcPclyHf4F3+vkOKa1oA7i/++NKDwFha4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Iw2vV0/mgVp6qcWybG1yuqAk81W3ifU7Sy/REljwkN2IA4ZdXYvw0qLi4/J7ZjNII sIU/KlkSxDbVOeqeo1GPDF2vCUa9JneS+QGropu7IWf/vDX//Ll7MeoslV6R40TLVv h0m8ffIXnySDhstKcL6bvzn03bEPvqhWjra5wWdA= From: Tyler Retzlaff To: dev@dpdk.org Cc: bruce.richardson@intel.com, david.marchand@redhat.com, thomas@monjalon.net, mb@smartsharesystems.com, konstantin.ananyev@huawei.com, Tyler Retzlaff Subject: [PATCH v8 08/14] eal: hide GCC extension based alignment markers Date: Mon, 1 May 2023 20:15:35 -0700 Message-Id: <1682997341-2271-9-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1682997341-2271-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1682997341-2271-1-git-send-email-roretzla@linux.microsoft.com> MIME-Version: 1.0 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 When compiling with MSVC don't expose typedefs used as alignment markers. Signed-off-by: Tyler Retzlaff Acked-by: Morten Brørup --- lib/eal/include/rte_common.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h index 15765b4..2f464e3 100644 --- a/lib/eal/include/rte_common.h +++ b/lib/eal/include/rte_common.h @@ -460,6 +460,8 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void) /*********** Structure alignment markers ********/ +#ifndef RTE_TOOLCHAIN_MSVC + /** Generic marker for any place in a structure. */ __extension__ typedef void *RTE_MARKER[0]; /** Marker for 1B alignment in a structure. */ @@ -471,6 +473,8 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void) /** Marker for 8B alignment in a structure. */ __extension__ typedef uint64_t RTE_MARKER64[0]; +#endif + /** * Combines 32b inputs most significant set bits into the least * significant bits to construct a value with the same MSBs as x From patchwork Tue May 2 03:15:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 126652 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B1D5042A38; Tue, 2 May 2023 05:17:05 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3242742D63; Tue, 2 May 2023 05:16:05 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 80D2A42B8E for ; Tue, 2 May 2023 05:15:45 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 3299421C3F22; Mon, 1 May 2023 20:15:43 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 3299421C3F22 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1682997344; bh=Dw4BKv8rsv/Yb3I3QkIEPM5TGSByOm5uZqTbhIua5kg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a04YVxEfHIwzC3RZ1PXfUJGEFj2rJZ2fBadEWsyK2Mdq+MxztYuKZYME1gWnro0UD Ev4PwGIjklfFd9EjVpvKsm8hMkvaOSdrSoNGNZIjRy+1unzc3xMJAwlmi0HgmvMJWa FWBUZvKK6q6mbFQG/3/0Ljp5lsMeJVxXyxJjS0d0= From: Tyler Retzlaff To: dev@dpdk.org Cc: bruce.richardson@intel.com, david.marchand@redhat.com, thomas@monjalon.net, mb@smartsharesystems.com, konstantin.ananyev@huawei.com, Tyler Retzlaff Subject: [PATCH v8 09/14] eal: hide typedefs based on GCC vector extensions Date: Mon, 1 May 2023 20:15:36 -0700 Message-Id: <1682997341-2271-10-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1682997341-2271-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1682997341-2271-1-git-send-email-roretzla@linux.microsoft.com> MIME-Version: 1.0 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 When compiling with MSVC don't expose typedefs based on GCC vector extensions. Signed-off-by: Tyler Retzlaff Acked-by: Morten Brørup --- lib/eal/include/generic/rte_vect.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/eal/include/generic/rte_vect.h b/lib/eal/include/generic/rte_vect.h index 3fec2bf..777510c 100644 --- a/lib/eal/include/generic/rte_vect.h +++ b/lib/eal/include/generic/rte_vect.h @@ -17,6 +17,8 @@ #include +#ifndef RTE_TOOLCHAIN_MSVC + /* Unsigned vector types */ /** @@ -186,6 +188,8 @@ */ typedef int64_t rte_v256s64_t __attribute__((vector_size(32), aligned(32))); +#endif + /** * The max SIMD bitwidth value to limit vector path selection. */ From patchwork Tue May 2 03:15:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 126654 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 46A3E42A38; Tue, 2 May 2023 05:17:16 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7A3BC42D77; Tue, 2 May 2023 05:16:07 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 6A98F4114B for ; Tue, 2 May 2023 05:15:45 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 3F7F221C3F23; Mon, 1 May 2023 20:15:43 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 3F7F221C3F23 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1682997344; bh=iyC1UwNSeYPSXon92B2Tiz0OdBBjp5N/VUs/FWLyA1Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qLQsRKOZVrC6RRSA5XwMVSuPm2QbqiyvXCF4uGL7JToMOn7ST6hoBZ4JsjEfK3LMa hhAqy2zEvIHLDB5Dvqe8Lvgphpq3u+vgBZLDrYamN9+88X54vmH04pT7e8RNYBelOn XjEus3QdEIFHHrgS5GqaO1mJWQiVE7mb1b0YO0YU= From: Tyler Retzlaff To: dev@dpdk.org Cc: bruce.richardson@intel.com, david.marchand@redhat.com, thomas@monjalon.net, mb@smartsharesystems.com, konstantin.ananyev@huawei.com, Tyler Retzlaff Subject: [PATCH v8 10/14] eal: expand most macros to empty when using MSVC Date: Mon, 1 May 2023 20:15:37 -0700 Message-Id: <1682997341-2271-11-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1682997341-2271-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1682997341-2271-1-git-send-email-roretzla@linux.microsoft.com> MIME-Version: 1.0 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 For now expand a lot of common rte macros empty. The catch here is we need to test that most of the macros do what they should but at the same time they are blocking work needed to bootstrap of the unit tests. Later we will return and provide (where possible) expansions that work correctly for msvc and where not possible provide some alternate macros to achieve the same outcome. Signed-off-by: Tyler Retzlaff Acked-by: Morten Brørup --- lib/eal/include/rte_branch_prediction.h | 8 +++++ lib/eal/include/rte_common.h | 54 +++++++++++++++++++++++++++++++++ lib/eal/include/rte_compat.h | 20 ++++++++++++ 3 files changed, 82 insertions(+) diff --git a/lib/eal/include/rte_branch_prediction.h b/lib/eal/include/rte_branch_prediction.h index 0256a9d..1eff9f6 100644 --- a/lib/eal/include/rte_branch_prediction.h +++ b/lib/eal/include/rte_branch_prediction.h @@ -25,7 +25,11 @@ * */ #ifndef likely +#ifndef RTE_TOOLCHAIN_MSVC #define likely(x) __builtin_expect(!!(x), 1) +#else +#define likely(x) (!!(x)) +#endif #endif /* likely */ /** @@ -39,7 +43,11 @@ * */ #ifndef unlikely +#ifndef RTE_TOOLCHAIN_MSVC #define unlikely(x) __builtin_expect(!!(x), 0) +#else +#define unlikely(x) (!!(x)) +#endif #endif /* unlikely */ #ifdef __cplusplus diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h index 2f464e3..0c55a23 100644 --- a/lib/eal/include/rte_common.h +++ b/lib/eal/include/rte_common.h @@ -41,6 +41,10 @@ #define RTE_STD_C11 #endif +#ifdef RTE_TOOLCHAIN_MSVC +#define __extension__ +#endif + /* * RTE_TOOLCHAIN_GCC is defined if the target is built with GCC, * while a host application (like pmdinfogen) may have another compiler. @@ -65,7 +69,11 @@ /** * Force alignment */ +#ifndef RTE_TOOLCHAIN_MSVC #define __rte_aligned(a) __attribute__((__aligned__(a))) +#else +#define __rte_aligned(a) +#endif #ifdef RTE_ARCH_STRICT_ALIGN typedef uint64_t unaligned_uint64_t __rte_aligned(1); @@ -80,16 +88,29 @@ /** * Force a structure to be packed */ +#ifndef RTE_TOOLCHAIN_MSVC #define __rte_packed __attribute__((__packed__)) +#else +#define __rte_packed +#endif /** * Macro to mark a type that is not subject to type-based aliasing rules */ +#ifndef RTE_TOOLCHAIN_MSVC #define __rte_may_alias __attribute__((__may_alias__)) +#else +#define __rte_may_alias +#endif /******* Macro to mark functions and fields scheduled for removal *****/ +#ifndef RTE_TOOLCHAIN_MSVC #define __rte_deprecated __attribute__((__deprecated__)) #define __rte_deprecated_msg(msg) __attribute__((__deprecated__(msg))) +#else +#define __rte_deprecated +#define __rte_deprecated_msg(msg) +#endif /** * Macro to mark macros and defines scheduled for removal @@ -110,14 +131,22 @@ /** * Force symbol to be generated even if it appears to be unused. */ +#ifndef RTE_TOOLCHAIN_MSVC #define __rte_used __attribute__((used)) +#else +#define __rte_used +#endif /*********** Macros to eliminate unused variable warnings ********/ /** * short definition to mark a function parameter unused */ +#ifndef RTE_TOOLCHAIN_MSVC #define __rte_unused __attribute__((__unused__)) +#else +#define __rte_unused +#endif /** * Mark pointer as restricted with regard to pointer aliasing. @@ -141,6 +170,7 @@ * even if the underlying stdio implementation is ANSI-compliant, * so this must be overridden. */ +#ifndef RTE_TOOLCHAIN_MSVC #if RTE_CC_IS_GNU #define __rte_format_printf(format_index, first_arg) \ __attribute__((format(gnu_printf, format_index, first_arg))) @@ -148,6 +178,9 @@ #define __rte_format_printf(format_index, first_arg) \ __attribute__((format(printf, format_index, first_arg))) #endif +#else +#define __rte_format_printf(format_index, first_arg) +#endif /** * Tells compiler that the function returns a value that points to @@ -222,7 +255,11 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void) /** * Hint never returning function */ +#ifndef RTE_TOOLCHAIN_MSVC #define __rte_noreturn __attribute__((noreturn)) +#else +#define __rte_noreturn +#endif /** * Issue a warning in case the function's return value is ignored. @@ -247,12 +284,20 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void) * } * @endcode */ +#ifndef RTE_TOOLCHAIN_MSVC #define __rte_warn_unused_result __attribute__((warn_unused_result)) +#else +#define __rte_warn_unused_result +#endif /** * Force a function to be inlined */ +#ifndef RTE_TOOLCHAIN_MSVC #define __rte_always_inline inline __attribute__((always_inline)) +#else +#define __rte_always_inline +#endif /** * Force a function to be noinlined @@ -437,7 +482,11 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void) #define RTE_CACHE_LINE_MIN_SIZE 64 /** Force alignment to cache line. */ +#ifndef RTE_TOOLCHAIN_MSVC #define __rte_cache_aligned __rte_aligned(RTE_CACHE_LINE_SIZE) +#else +#define __rte_cache_aligned +#endif /** Force minimum cache line alignment. */ #define __rte_cache_min_aligned __rte_aligned(RTE_CACHE_LINE_MIN_SIZE) @@ -812,12 +861,17 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void) * struct wrapper *w = container_of(x, struct wrapper, c); */ #ifndef container_of +#ifndef RTE_TOOLCHAIN_MSVC #define container_of(ptr, type, member) __extension__ ({ \ const typeof(((type *)0)->member) *_ptr = (ptr); \ __rte_unused type *_target_ptr = \ (type *)(ptr); \ (type *)(((uintptr_t)_ptr) - offsetof(type, member)); \ }) +#else +#define container_of(ptr, type, member) \ + ((type *)((uintptr_t)(ptr) - offsetof(type, member))) +#endif #endif /** Swap two variables. */ diff --git a/lib/eal/include/rte_compat.h b/lib/eal/include/rte_compat.h index fc9fbaa..6a4b5ee 100644 --- a/lib/eal/include/rte_compat.h +++ b/lib/eal/include/rte_compat.h @@ -12,14 +12,22 @@ #ifndef ALLOW_EXPERIMENTAL_API +#ifndef RTE_TOOLCHAIN_MSVC #define __rte_experimental \ __attribute__((deprecated("Symbol is not yet part of stable ABI"), \ section(".text.experimental"))) +#else +#define __rte_experimental +#endif #else +#ifndef RTE_TOOLCHAIN_MSVC #define __rte_experimental \ __attribute__((section(".text.experimental"))) +#else +#define __rte_experimental +#endif #endif @@ -30,23 +38,35 @@ #if !defined ALLOW_INTERNAL_API && __has_attribute(error) /* For GCC */ +#ifndef RTE_TOOLCHAIN_MSVC #define __rte_internal \ __attribute__((error("Symbol is not public ABI"), \ section(".text.internal"))) +#else +#define __rte_internal +#endif #elif !defined ALLOW_INTERNAL_API && __has_attribute(diagnose_if) /* For clang */ +#ifndef RTE_TOOLCHAIN_MSVC #define __rte_internal \ _Pragma("GCC diagnostic push") \ _Pragma("GCC diagnostic ignored \"-Wgcc-compat\"") \ __attribute__((diagnose_if(1, "Symbol is not public ABI", "error"), \ section(".text.internal"))) \ _Pragma("GCC diagnostic pop") +#else +#define __rte_internal +#endif #else +#ifndef RTE_TOOLCHAIN_MSVC #define __rte_internal \ __attribute__((section(".text.internal"))) +#else +#define __rte_internal +#endif #endif From patchwork Tue May 2 03:15:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 126651 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E53E142A38; Tue, 2 May 2023 05:16:59 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0226742D61; Tue, 2 May 2023 05:16:04 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 8196D42BC9 for ; Tue, 2 May 2023 05:15:45 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 4D4F221C3F24; Mon, 1 May 2023 20:15:43 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 4D4F221C3F24 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1682997344; bh=1cCe2XKNqc07oP6Wt0YsLsOAzWyc2ZBKyfhZsqxQRJA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lV//RRXNtvxX2BqNV0NfyBYZvidgQHEvuEJrIa1W6dHBxnx80ZSHjm3R7rDJMMaI+ rgHs/ubuhkSIcq8lX6l5ghBR2mLexxZDAUapm69nItMzXulmTaWGBc/zc+B8p9aP8M ix7Ak3evD0MM02a8lInb9mQQAv5gpm680aPwu9Uo= From: Tyler Retzlaff To: dev@dpdk.org Cc: bruce.richardson@intel.com, david.marchand@redhat.com, thomas@monjalon.net, mb@smartsharesystems.com, konstantin.ananyev@huawei.com, Tyler Retzlaff Subject: [PATCH v8 11/14] eal: exclude exposure of rte atomic APIs for MSVC builds Date: Mon, 1 May 2023 20:15:38 -0700 Message-Id: <1682997341-2271-12-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1682997341-2271-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1682997341-2271-1-git-send-email-roretzla@linux.microsoft.com> MIME-Version: 1.0 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 It's discouraged to use rte_atomics APIs instead standard APIs should be used from C11. Since MSVC is a new toolchain/platform combination block visibility of the rte_atomic APIs from day 1. Signed-off-by: Tyler Retzlaff Acked-by: Morten Brørup --- lib/eal/include/generic/rte_atomic.h | 7 +++++++ lib/eal/x86/include/rte_atomic.h | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/lib/eal/include/generic/rte_atomic.h b/lib/eal/include/generic/rte_atomic.h index e973184..1964697 100644 --- a/lib/eal/include/generic/rte_atomic.h +++ b/lib/eal/include/generic/rte_atomic.h @@ -131,6 +131,8 @@ /*------------------------- 16 bit atomic operations -------------------------*/ +#ifndef RTE_TOOLCHAIN_MSVC + /** * Atomic compare and set. * @@ -1038,8 +1040,11 @@ static inline void rte_atomic64_clear(rte_atomic64_t *v) } #endif +#endif + /*------------------------ 128 bit atomic operations -------------------------*/ + /** * 128-bit integer structure. */ @@ -1049,8 +1054,10 @@ static inline void rte_atomic64_clear(rte_atomic64_t *v) union { uint64_t val[2]; #ifdef RTE_ARCH_64 +#ifndef RTE_TOOLCHAIN_MSVC __extension__ __int128 int128; #endif +#endif }; } __rte_aligned(16) rte_int128_t; diff --git a/lib/eal/x86/include/rte_atomic.h b/lib/eal/x86/include/rte_atomic.h index 569d3ab..adf3309 100644 --- a/lib/eal/x86/include/rte_atomic.h +++ b/lib/eal/x86/include/rte_atomic.h @@ -83,6 +83,8 @@ #define rte_io_rmb() rte_compiler_barrier() +#ifndef RTE_TOOLCHAIN_MSVC + /** * Synchronization fence between threads based on the specified memory order. * @@ -279,6 +281,8 @@ static inline int rte_atomic32_dec_and_test(rte_atomic32_t *v) #include "rte_atomic_64.h" #endif +#endif + #ifdef __cplusplus } #endif From patchwork Tue May 2 03:15:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 126645 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1679542A38; Tue, 2 May 2023 05:16:20 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1275242D3A; Tue, 2 May 2023 05:15:52 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 554C7406A2 for ; Tue, 2 May 2023 05:15:45 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 5B3A421C3F25; Mon, 1 May 2023 20:15:43 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 5B3A421C3F25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1682997344; bh=b7wpD8AMKSifeQgH+IQjkIPicDfeVQgSAAqCgVgwIbw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Irt0rguuRh6Em3kTXrBMyfar+GvFJskIQvwKZwilshpDD32rWcU2wIsyAGCnpiL+U w91NdGgJQIGQ67JU0TZi5SFd8tPJ9AE0pDtYGBLVzraQJ6XuXrOa49vOBH/MA+I4fp xTtCRR8KFhBBb0rA2RCyyqz3Igm/3fT7d6hBWjVU= From: Tyler Retzlaff To: dev@dpdk.org Cc: bruce.richardson@intel.com, david.marchand@redhat.com, thomas@monjalon.net, mb@smartsharesystems.com, konstantin.ananyev@huawei.com, Tyler Retzlaff Subject: [PATCH v8 12/14] telemetry: avoid expanding versioned symbol macros on MSVC Date: Mon, 1 May 2023 20:15:39 -0700 Message-Id: <1682997341-2271-13-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1682997341-2271-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1682997341-2271-1-git-send-email-roretzla@linux.microsoft.com> MIME-Version: 1.0 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 Windows does not support versioned symbols. Fortunately Windows also doesn't have an exported stable ABI. Export rte_tel_data_add_array_int -> rte_tel_data_add_array_int_24 and rte_tel_data_add_dict_int -> rte_tel_data_add_dict_int_v24 functions. Windows does have a way to achieve similar versioning for symbols but it is not a simple #define so it will be done as a work package later. Signed-off-by: Tyler Retzlaff Acked-by: Bruce Richardson Acked-by: Morten Brørup --- lib/telemetry/telemetry_data.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/telemetry/telemetry_data.c b/lib/telemetry/telemetry_data.c index 2bac2de..284c16e 100644 --- a/lib/telemetry/telemetry_data.c +++ b/lib/telemetry/telemetry_data.c @@ -82,8 +82,16 @@ /* mark the v23 function as the older version, and v24 as the default version */ VERSION_SYMBOL(rte_tel_data_add_array_int, _v23, 23); BIND_DEFAULT_SYMBOL(rte_tel_data_add_array_int, _v24, 24); +#ifndef RTE_TOOLCHAIN_MSVC MAP_STATIC_SYMBOL(int rte_tel_data_add_array_int(struct rte_tel_data *d, int64_t x), rte_tel_data_add_array_int_v24); +#else +int +rte_tel_data_add_array_int(struct rte_tel_data *d, int64_t x) +{ + return rte_tel_data_add_array_int_v24(d, x); +} +#endif int rte_tel_data_add_array_uint(struct rte_tel_data *d, uint64_t x) @@ -220,8 +228,16 @@ /* mark the v23 function as the older version, and v24 as the default version */ VERSION_SYMBOL(rte_tel_data_add_dict_int, _v23, 23); BIND_DEFAULT_SYMBOL(rte_tel_data_add_dict_int, _v24, 24); +#ifndef RTE_TOOLCHAIN_MSVC MAP_STATIC_SYMBOL(int rte_tel_data_add_dict_int(struct rte_tel_data *d, const char *name, int64_t val), rte_tel_data_add_dict_int_v24); +#else +int +rte_tel_data_add_dict_int(struct rte_tel_data *d, const char *name, int64_t val) +{ + return rte_tel_data_add_dict_int_v24(d, name, val); +} +#endif int rte_tel_data_add_dict_uint(struct rte_tel_data *d, From patchwork Tue May 2 03:15:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 126650 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C4AC342A38; Tue, 2 May 2023 05:16:54 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C964542D5A; Tue, 2 May 2023 05:16:02 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 82BB642C4D for ; Tue, 2 May 2023 05:15:45 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 67D6B21C3F26; Mon, 1 May 2023 20:15:44 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 67D6B21C3F26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1682997344; bh=f9XhpQS5bAdnk1muTr2n/HijQiaMdsp9rYFoLB1Zol8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A+ZjW+VltCNX0K+j4IQe51ZpGe8CiITgvu1lkQw/giTqTZoWeb5ZaIEl4ViRm/2r3 myvFEe/yE2gMuT2+ARSCj3qMSViinX40shNPRUN/kxgfPTKwJF8eJNmRmmeN+QMavV 5sp1L66SHw/zgQ0u+B2OJoLVoKeSwpHHjG1hoJnM= From: Tyler Retzlaff To: dev@dpdk.org Cc: bruce.richardson@intel.com, david.marchand@redhat.com, thomas@monjalon.net, mb@smartsharesystems.com, konstantin.ananyev@huawei.com, Tyler Retzlaff Subject: [PATCH v8 13/14] eal: always define MSVC as little endian Date: Mon, 1 May 2023 20:15:40 -0700 Message-Id: <1682997341-2271-14-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1682997341-2271-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1682997341-2271-1-git-send-email-roretzla@linux.microsoft.com> MIME-Version: 1.0 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 The MSVC compiler does not target big endian platforms so define little endian always. Signed-off-by: Tyler Retzlaff Acked-by: Morten Brørup --- lib/eal/include/generic/rte_byteorder.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/eal/include/generic/rte_byteorder.h b/lib/eal/include/generic/rte_byteorder.h index 1e32a1b..375f118 100644 --- a/lib/eal/include/generic/rte_byteorder.h +++ b/lib/eal/include/generic/rte_byteorder.h @@ -45,6 +45,8 @@ #define RTE_BYTE_ORDER RTE_BIG_ENDIAN #elif defined __LITTLE_ENDIAN__ #define RTE_BYTE_ORDER RTE_LITTLE_ENDIAN +#elif defined RTE_TOOLCHAIN_MSVC +#define RTE_BYTE_ORDER RTE_LITTLE_ENDIAN #endif #if !defined(RTE_BYTE_ORDER) #error Unknown endianness. From patchwork Tue May 2 03:15:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 126653 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C61BD42A38; Tue, 2 May 2023 05:17:10 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5F39C42D69; Tue, 2 May 2023 05:16:06 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 8620542C76 for ; Tue, 2 May 2023 05:15:45 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 74F6E21C3F27; Mon, 1 May 2023 20:15:44 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 74F6E21C3F27 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1682997344; bh=IhY/ayTLIQTKNTkL9FqbjoSnWBaKvCL1ji8pnT4uJCo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bw+34is7IyHf1/K39DPqG+3q16Mb9N7pZ+zj51HQzxQufZ1bDMGju5x7s1kKXOVNS YrKLExJv6cxmGXN4PsQllMLH+rbNwfwqy3gS0wTLI5WvJ8Iw23xVx5+hJ8TI7l5d6B KN1nydB8sr9fGpujjkqWb+s3YyBzYu8RN5Pxz750= From: Tyler Retzlaff To: dev@dpdk.org Cc: bruce.richardson@intel.com, david.marchand@redhat.com, thomas@monjalon.net, mb@smartsharesystems.com, konstantin.ananyev@huawei.com, Tyler Retzlaff Subject: [PATCH v8 14/14] eal: do not define typeof macro when building with MSVC Date: Mon, 1 May 2023 20:15:41 -0700 Message-Id: <1682997341-2271-15-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1682997341-2271-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1682997341-2271-1-git-send-email-roretzla@linux.microsoft.com> MIME-Version: 1.0 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 When building with MSVC do not assume typeof is a macro and don't define a typeof macro that conflicts with C23 typeof keyword. Signed-off-by: Tyler Retzlaff Acked-by: Morten Brørup --- lib/eal/include/rte_common.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h index 0c55a23..ce66287 100644 --- a/lib/eal/include/rte_common.h +++ b/lib/eal/include/rte_common.h @@ -24,9 +24,11 @@ /* OS specific include */ #include +#ifndef RTE_TOOLCHAIN_MSVC #ifndef typeof #define typeof __typeof__ #endif +#endif #ifndef __cplusplus #ifndef asm