From patchwork Mon Apr 17 16:10:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 126185 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 89F694296F; Mon, 17 Apr 2023 18:10:45 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 763EF42BC9; Mon, 17 Apr 2023 18:10:45 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 94E5640698 for ; Mon, 17 Apr 2023 18:10:44 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id C3DF321AECFA; Mon, 17 Apr 2023 09:10:43 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com C3DF321AECFA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1681747843; bh=OKMsHs6voU+2aB6BlwmYyzsB9lUVWS0DE5o9leltMkI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jJeyJsr/rqAW1ZzXXvRlLV8kNQPuftoRYruVbW5OXXypRoh88EeukDHnmRaWylBOM XcaGagFGQ1ccjIfz4fih/AhedbBPt+PvgTtvixON290jMftIKqUBfW02aDbSyIrcVH PLZT0S30+oMo4pKnb94art4g++DTtSG0STqST4aI= 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 v7 01/14] eal: use rdtsc intrinsic Date: Mon, 17 Apr 2023 09:10:25 -0700 Message-Id: <1681747838-12778-2-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1681747838-12778-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1681747838-12778-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 Mon Apr 17 16:10:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 126186 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 32CFB4296F; Mon, 17 Apr 2023 18:10:51 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1E21842C4D; Mon, 17 Apr 2023 18:10:48 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id B61D642BC9 for ; Mon, 17 Apr 2023 18:10:44 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id D045D21C1E41; Mon, 17 Apr 2023 09:10:43 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com D045D21C1E41 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1681747843; bh=byPfLLUjMSJsBQ1JgxyTOR6ow5661BT1rTeQLtGbIts=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mgPPcxlcRVVx9y/03I3wk/5tVRXRn2UKR0GVcpqCUSrogYFcybaJHHVpW9LojdjFh Zaovwu8dqmpdqEzyrjbMXWFpDrxOeXa/AYc5zq0s1nl2heL18WH16og56QsejYawdP YBXdGP8WNc5WWYdw7sBZz72DnZIfeW+LET2IOX5E= 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 v7 02/14] eal: use rtm and xtest intrinsics Date: Mon, 17 Apr 2023 09:10:26 -0700 Message-Id: <1681747838-12778-3-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1681747838-12778-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1681747838-12778-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 Mon Apr 17 16:10:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 126187 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 5FDF74296F; Mon, 17 Apr 2023 18:10:57 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5B5E542D0E; Mon, 17 Apr 2023 18:10:49 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id B55C942BB1 for ; Mon, 17 Apr 2023 18:10:44 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id EE59021C1E42; Mon, 17 Apr 2023 09:10:43 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com EE59021C1E42 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1681747843; bh=7MuyWLqPrgllACGrADXQqvjc3As35FjdHAPbIRz7i3w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yuo3zL0/A7Ue0+ZyzZXV1x5JituGnDwArqT82axs3fpNBtNY7nQJ0ip0JV6sszG4t Jl7pZe4ue2nzqOtC7c/8mas+MSAxBCZ8FtWrm09Xk0f5xszVHNi/8BowV66uJHIVhj 9+Z5MpiqLBpiRxu4uFk9MfL7U1j+VOA+M6pGUnd4= 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 v7 03/14] eal: use barrier intrinsics Date: Mon, 17 Apr 2023 09:10:27 -0700 Message-Id: <1681747838-12778-4-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1681747838-12778-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1681747838-12778-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 Mon Apr 17 16:10: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: 126189 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 9490D4296F; Mon, 17 Apr 2023 18:11:13 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A00EE42D29; Mon, 17 Apr 2023 18:10:51 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id D106242C24 for ; Mon, 17 Apr 2023 18:10:44 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 0637F21C1E47; Mon, 17 Apr 2023 09:10:43 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 0637F21C1E47 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1681747844; bh=/n6LyB9S2KGWejOdD735duGMaOHGwfOgr77axzCuQ9U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m9s8BSy1rWL34Av9NPDAxpysfVPyto/PZjPKuKMAcZlBCml1s3zqkeWGrHxYSSpRb pusaJ/8RS63B7xakZDU1x458K2J3uo1ki53gIth0OUqI6xj4goe6n23JZp+v8Y9HdH MNmNum8fbV9gXDvdsFQlRZdWexwtRYHU4qVun2Uo= 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 v7 04/14] eal: use cpuid and cpuidex intrinsics Date: Mon, 17 Apr 2023 09:10:28 -0700 Message-Id: <1681747838-12778-5-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1681747838-12778-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1681747838-12778-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 Mon Apr 17 16:10: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: 126190 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 81C014296F; Mon, 17 Apr 2023 18:11:21 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CFBA442D35; Mon, 17 Apr 2023 18:10:52 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 632E542BB1 for ; Mon, 17 Apr 2023 18:10:45 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 125C621C1E67; Mon, 17 Apr 2023 09:10:43 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 125C621C1E67 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1681747844; bh=wspp2q4BKWnbeYaICIZiu06lkq4RzjVoxqoStBq8Mbk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b8w1KbaG2RXtNYp0McznS9BxR2wBq0cTa4yfv51BDnH28RXWaVwDLYc0vYOir6cY5 qGfE6r58YIMLOQihM1SLUyyZLLEeizMnqbnfGDwG5w0x+c6hQozHoZwqszSbEEHyrp cZ//w1AkZKzrgYIp3TIQhLYlo7XPreefgzY35YQ4= 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 v7 05/14] eal: use umonitor umwait and tpause intrinsics Date: Mon, 17 Apr 2023 09:10:29 -0700 Message-Id: <1681747838-12778-6-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1681747838-12778-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1681747838-12778-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..7d83c24 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 */ +#ifndef RTE_TOOLCHAIN_MSVC asm volatile(".byte 0xf3, 0x0f, 0xae, 0xf7;" : : "D"(pmc->addr)); +#else + _umonitor(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 */ +#ifndef RTE_TOOLCHAIN_MSVC asm volatile(".byte 0xf2, 0x0f, 0xae, 0xf7;" : /* ignore rflags */ : "D"(0), /* enter C0.2 */ "a"(tsc_l), "d"(tsc_h)); +#else + _umwait(tsc_l, tsc_h); +#endif end: /* erase sleep address */ @@ -153,10 +161,14 @@ return -ENOTSUP; /* execute TPAUSE */ +#ifndef RTE_TOOLCHAIN_MSVC asm volatile(".byte 0x66, 0x0f, 0xae, 0xf7;" : /* ignore rflags */ : "D"(0), /* enter C0.2 */ "a"(tsc_l), "d"(tsc_h)); +#else + _tpause(tsc_l, tsc_h); +#endif return 0; } From patchwork Mon Apr 17 16:10: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: 126191 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 5FF124296F; Mon, 17 Apr 2023 18:11:29 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E8ADD42D16; Mon, 17 Apr 2023 18:10:53 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 5AA1F40698 for ; Mon, 17 Apr 2023 18:10:45 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 1EEB421C1E70; Mon, 17 Apr 2023 09:10:43 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 1EEB421C1E70 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1681747844; bh=KtYgGeg9VzXfAUJPWMe+3QqpXq0+VOHMrV2zMkl4u3E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GGctOMH+xdEW1v/hb9ww4Pzi4iIlOjNf0JVEvZJNtXt8QjvOecXM4hMOCNkWKjSDZ MOamAzw5DYhA4utFDpBuDtMJ/sgeqWQDVQHcUI/yh+u83jDMz/709SlYUFW+55PTHv CpvZen8RTKJf/sI0CV3OCN3AAf/nSFF2vjdYem38= 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 v7 06/14] eal: use prefetch intrinsics Date: Mon, 17 Apr 2023 09:10:30 -0700 Message-Id: <1681747838-12778-7-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1681747838-12778-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1681747838-12778-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 Mon Apr 17 16:10: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: 126192 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 43FB84296F; Mon, 17 Apr 2023 18:11:38 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 371BA42D3C; Mon, 17 Apr 2023 18:10:55 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 7C06A42BD9 for ; Mon, 17 Apr 2023 18:10:45 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 2B38C21C1E73; Mon, 17 Apr 2023 09:10:43 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 2B38C21C1E73 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1681747844; bh=w+QVq1B9vMO46jggBj+ImzeYs3RHkEKQSzKvJNzoXs8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RYgeQzYtgtF/5EDVAkxJTATcWTjWcYBhUS1ck/bMwWE4SRVWluwtu3h8pED7sWAWg cCOZvM8X+aZH9+R7ycPk7/zPOLCLz48CpW3lSuVQ+FKa/errO7EgSIgQ7z/4MZgoYG 4V/AZ8utKWZTgGNqcaNMLQpfAhinL6OW1KvipDpY= 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 v7 07/14] eal: use byte swap intrinsics Date: Mon, 17 Apr 2023 09:10:31 -0700 Message-Id: <1681747838-12778-8-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1681747838-12778-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1681747838-12778-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 Mon Apr 17 16:10: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: 126196 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 124C74296F; Mon, 17 Apr 2023 18:12:10 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B402F42D4F; Mon, 17 Apr 2023 18:11:00 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id B4FEE42D0B for ; Mon, 17 Apr 2023 18:10:45 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 38BFC21C1E75; Mon, 17 Apr 2023 09:10:43 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 38BFC21C1E75 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1681747844; bh=hVcXjboUtlBcPclyHf4F3+vkOKa1oA7i/++NKDwFha4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hrfQEmoRjsnAS2rDO2yUpQt8WfAQmTO8dJwb28M36HlZp56ZcyjizxFyunlSAawN5 1sbUaVKR3AUak5yTZX/Z8sp0hKypq7wceEfapAYjYRQeZPHvCSMXn/et7Zeodz+REn ICZXjs1kH41Dk8yumg2ipzCrYakxBDNc3qRenZRo= 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 v7 08/14] eal: hide GCC extension based alignment markers Date: Mon, 17 Apr 2023 09:10:32 -0700 Message-Id: <1681747838-12778-9-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1681747838-12778-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1681747838-12778-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 Mon Apr 17 16:10: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: 126195 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 DBC524296F; Mon, 17 Apr 2023 18:12:02 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2F59342D49; Mon, 17 Apr 2023 18:10:59 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 8780C42C76 for ; Mon, 17 Apr 2023 18:10:45 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 4533A21C1E76; Mon, 17 Apr 2023 09:10:44 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 4533A21C1E76 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1681747844; bh=Dw4BKv8rsv/Yb3I3QkIEPM5TGSByOm5uZqTbhIua5kg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N5lj9++J9xO311oQsRHexWAS5cPlNo81WNLyL6tsyHZGwNn/gLOar89bhy/LzolbP 5Ovvp7Mts+UmYJrDXWwBXXb7z8wY6M5wyLfuJrI13816xs/hCtgaq8Li5KhVgmR+S/ N6//wjz/6zWb7CgSzFXg6fn76OHMB4rK68vjQ8uI= 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 v7 09/14] eal: hide typedefs based on GCC vector extensions Date: Mon, 17 Apr 2023 09:10:33 -0700 Message-Id: <1681747838-12778-10-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1681747838-12778-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1681747838-12778-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 Mon Apr 17 16:10: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: 126194 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 ABA2D4296F; Mon, 17 Apr 2023 18:11:54 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C6F4A42D30; Mon, 17 Apr 2023 18:10:57 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 82F2742C4D for ; Mon, 17 Apr 2023 18:10:45 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 51D2021C1E77; Mon, 17 Apr 2023 09:10:44 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 51D2021C1E77 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1681747844; bh=iyC1UwNSeYPSXon92B2Tiz0OdBBjp5N/VUs/FWLyA1Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f9/nIaboF9eP34d1eFTmTw0va/rSoEsXaDn2/UiRL+s3Hnx+qMyL9CYAULSWfK0Or ahA3EdV2HHeGfSPKKg0DI01mKq1JguH8G3cDJhGsTw50fryzjqFauNJcxM50ajVTfy Ew0K9M0JfM4/fxVdSfAAhqmL9rqtr6j8zowJOIaI= 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 v7 10/14] eal: expand most macros to empty when using MSVC Date: Mon, 17 Apr 2023 09:10:34 -0700 Message-Id: <1681747838-12778-11-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1681747838-12778-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1681747838-12778-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 Mon Apr 17 16:10: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: 126197 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 DAA6B4296F; Mon, 17 Apr 2023 18:12:16 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E6AB242D52; Mon, 17 Apr 2023 18:11:01 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id C115B42D0D for ; Mon, 17 Apr 2023 18:10:45 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 5EE8E21C1E79; Mon, 17 Apr 2023 09:10:44 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 5EE8E21C1E79 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1681747844; bh=1cCe2XKNqc07oP6Wt0YsLsOAzWyc2ZBKyfhZsqxQRJA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V8b8tC0Rh+Pp0vh5D3DVvkIRhRke08W4mioY27DoST18K/cVdBdoo80pQ/q024ZXc OpwmUHNovnvJtyyG0E562DKKH/KlxLHAf96Km7qt1zn6+QRwjVF8Z8843sT5JMy9Il rfmNscogNPYm5Tc6zwPMPbdwj/5Ulzee5+8ybBPg= 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 v7 11/14] eal: exclude exposure of rte atomic APIs for MSVC builds Date: Mon, 17 Apr 2023 09:10:35 -0700 Message-Id: <1681747838-12778-12-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1681747838-12778-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1681747838-12778-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 Mon Apr 17 16:10: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: 126193 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 22AB34296F; Mon, 17 Apr 2023 18:11:47 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6897C42D0D; Mon, 17 Apr 2023 18:10:56 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id BCFD342D0C for ; Mon, 17 Apr 2023 18:10:45 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 6B89321C1E7A; Mon, 17 Apr 2023 09:10:44 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 6B89321C1E7A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1681747844; bh=b7wpD8AMKSifeQgH+IQjkIPicDfeVQgSAAqCgVgwIbw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ko7/t1Ar/I7CWxRufQpqfQAn+9BBMXPaJ+Q/DZGWAKscxVZBjsRB/soPsgp3nMAcs FJgwbVVj9jgddqfW1UD1Qav3sbqZigKHmi8mrCYMx39Qm9Djd16p/w3ojlGZpvVqtJ qlW65ixC2+mEcenGHA1E+ONVpwP8s4sRDgkS29ZY= 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 v7 12/14] telemetry: avoid expanding versioned symbol macros on MSVC Date: Mon, 17 Apr 2023 09:10:36 -0700 Message-Id: <1681747838-12778-13-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1681747838-12778-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1681747838-12778-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 Mon Apr 17 16:10: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: 126198 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 E525F4296F; Mon, 17 Apr 2023 18:12:22 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0F44842D5C; Mon, 17 Apr 2023 18:11:03 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id C98D542D0E for ; Mon, 17 Apr 2023 18:10:45 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 77AFB21C1E7C; Mon, 17 Apr 2023 09:10:44 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 77AFB21C1E7C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1681747844; bh=f9XhpQS5bAdnk1muTr2n/HijQiaMdsp9rYFoLB1Zol8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cYsVuFsvoZdskr1IlLjQpj+zfi39qmn4BUSgH6WFZl7SdhiXpNTKVo2lAxbXOUO5p bGgYelil7V0oGGb6eSOhSPdGxAd5dPV6F9O4w1Rd1Nx3CK16cb/8/3B2awUpJwNgWn cd3CY4+Riyv948S3cXc2DbWD40TXquOh+baxe9Zw= 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 v7 13/14] eal: always define MSVC as little endian Date: Mon, 17 Apr 2023 09:10:37 -0700 Message-Id: <1681747838-12778-14-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1681747838-12778-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1681747838-12778-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 Mon Apr 17 16:10: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: 126199 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 4FE3E4296F; Mon, 17 Apr 2023 18:12:29 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 06D6442D47; Mon, 17 Apr 2023 18:11:04 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id CC3C242BB1 for ; Mon, 17 Apr 2023 18:10:45 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 843B621C1E7D; Mon, 17 Apr 2023 09:10:44 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 843B621C1E7D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1681747844; bh=IhY/ayTLIQTKNTkL9FqbjoSnWBaKvCL1ji8pnT4uJCo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xvx2a+8eNguIwMMmKQ1XNBKq9gUsapIrRvoCxQjCLoBDW4Xseum5su4kZ9ShGrTfn kKE7CNS8LJK+FYlesjzFk9OoevERUDxJAiCcdP5zx9PPqBMSe1WhhEaD+15LpBE1Jj itCQapSHT5VICvw2+TJ+PsjoobvaARv/8sOPY3ZE= 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 v7 14/14] eal: do not define typeof macro when building with MSVC Date: Mon, 17 Apr 2023 09:10:38 -0700 Message-Id: <1681747838-12778-15-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1681747838-12778-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1681747838-12778-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