From patchwork Wed Feb 14 04:17:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 136693 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 A381D43B1F; Wed, 14 Feb 2024 05:17:59 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1171642F17; Wed, 14 Feb 2024 05:17:56 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 6D47B42DF9 for ; Wed, 14 Feb 2024 05:17:52 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 9848A20B2000; Tue, 13 Feb 2024 20:17:51 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 9848A20B2000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1707884271; bh=hfAtSjq/K1fK0h2rxr+rCrcDr5skYGN5ajG3Dgor7io=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oJvfwOoiYdiMYooXvRJu7uJVmk/HuE79N/oJ8T5MPbsWuiLveZ+yrsZ1i5L9gXmwa bdpa8JvOoItGqnahGQ9is8bJaTHd6G4esRM8MR0MF8yuhf48XoqOQllnPiiKM2/M+W tCJsaIczsb0hgPh7Bi2uR1zjkEnxsNunEmBWJEdw= From: Tyler Retzlaff To: dev@dpdk.org Cc: Andrew Rybchenko , Bruce Richardson , Chengwen Feng , Cristian Dumitrescu , David Christensen , David Hunt , Ferruh Yigit , Honnappa Nagarahalli , Jasvinder Singh , Jerin Jacob , Kevin Laatz , Konstantin Ananyev , Min Zhou , Ruifeng Wang , Sameh Gobriel , Stanislaw Kardach , Thomas Monjalon , Vladimir Medvedkin , Yipeng Wang , Tyler Retzlaff Subject: [PATCH v2 01/14] eal: use C11 alignas Date: Tue, 13 Feb 2024 20:17:37 -0800 Message-Id: <1707884270-27189-2-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1707884270-27189-1-git-send-email-roretzla@linux.microsoft.com> References: <1707873986-29352-1-git-send-email-roretzla@linux.microsoft.com> <1707884270-27189-1-git-send-email-roretzla@linux.microsoft.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org * Expand __rte_aligned(a) to __declspec(align(a)) when building with MSVC. * Move __rte_aligned from the end of {struct,union} definitions to be between {struct,union} and tag. The placement between {struct,union} and the tag allows the desired alignment to be imparted on the type regardless of the toolchain being used for all of GCC, LLVM, MSVC compilers building both C and C++. * Replace use of __rte_aligned(a) on variables/fields with alignas(a). Signed-off-by: Tyler Retzlaff --- lib/eal/arm/include/rte_vect.h | 4 ++-- lib/eal/include/generic/rte_atomic.h | 4 ++-- lib/eal/include/rte_common.h | 2 +- lib/eal/loongarch/include/rte_vect.h | 8 ++++---- lib/eal/ppc/include/rte_vect.h | 4 ++-- lib/eal/riscv/include/rte_vect.h | 4 ++-- lib/eal/x86/include/rte_vect.h | 4 ++-- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/eal/arm/include/rte_vect.h b/lib/eal/arm/include/rte_vect.h index 8cfe4bd..c97d299 100644 --- a/lib/eal/arm/include/rte_vect.h +++ b/lib/eal/arm/include/rte_vect.h @@ -24,14 +24,14 @@ #define XMM_SIZE (sizeof(xmm_t)) #define XMM_MASK (XMM_SIZE - 1) -typedef union rte_xmm { +typedef union __rte_aligned(16) rte_xmm { xmm_t x; uint8_t u8[XMM_SIZE / sizeof(uint8_t)]; uint16_t u16[XMM_SIZE / sizeof(uint16_t)]; uint32_t u32[XMM_SIZE / sizeof(uint32_t)]; uint64_t u64[XMM_SIZE / sizeof(uint64_t)]; double pd[XMM_SIZE / sizeof(double)]; -} __rte_aligned(16) rte_xmm_t; +} rte_xmm_t; #if defined(RTE_ARCH_ARM) && defined(RTE_ARCH_32) /* NEON intrinsic vqtbl1q_u8() is not supported in ARMv7-A(AArch32) */ diff --git a/lib/eal/include/generic/rte_atomic.h b/lib/eal/include/generic/rte_atomic.h index 0e639da..f859707 100644 --- a/lib/eal/include/generic/rte_atomic.h +++ b/lib/eal/include/generic/rte_atomic.h @@ -1094,7 +1094,7 @@ static inline void rte_atomic64_clear(rte_atomic64_t *v) /** * 128-bit integer structure. */ -typedef struct { +typedef struct __rte_aligned(16) { union { uint64_t val[2]; #ifdef RTE_ARCH_64 @@ -1103,7 +1103,7 @@ static inline void rte_atomic64_clear(rte_atomic64_t *v) #endif #endif }; -} __rte_aligned(16) rte_int128_t; +} rte_int128_t; #ifdef __DOXYGEN__ diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h index d7d6390..8367b96 100644 --- a/lib/eal/include/rte_common.h +++ b/lib/eal/include/rte_common.h @@ -65,7 +65,7 @@ * Force alignment */ #ifdef RTE_TOOLCHAIN_MSVC -#define __rte_aligned(a) +#define __rte_aligned(a) __declspec(align(a)) #else #define __rte_aligned(a) __attribute__((__aligned__(a))) #endif diff --git a/lib/eal/loongarch/include/rte_vect.h b/lib/eal/loongarch/include/rte_vect.h index 1546515..aa334e8 100644 --- a/lib/eal/loongarch/include/rte_vect.h +++ b/lib/eal/loongarch/include/rte_vect.h @@ -15,7 +15,7 @@ #define RTE_VECT_DEFAULT_SIMD_BITWIDTH RTE_VECT_SIMD_DISABLED -typedef union xmm { +typedef union __rte_aligned(16) xmm { int8_t i8[16]; int16_t i16[8]; int32_t i32[4]; @@ -25,19 +25,19 @@ uint32_t u32[4]; uint64_t u64[2]; double pd[2]; -} __rte_aligned(16) xmm_t; +} xmm_t; #define XMM_SIZE (sizeof(xmm_t)) #define XMM_MASK (XMM_SIZE - 1) -typedef union rte_xmm { +typedef union __rte_aligned(16) rte_xmm { xmm_t x; uint8_t u8[XMM_SIZE / sizeof(uint8_t)]; uint16_t u16[XMM_SIZE / sizeof(uint16_t)]; uint32_t u32[XMM_SIZE / sizeof(uint32_t)]; uint64_t u64[XMM_SIZE / sizeof(uint64_t)]; double pd[XMM_SIZE / sizeof(double)]; -} __rte_aligned(16) rte_xmm_t; +} rte_xmm_t; static inline xmm_t vect_load_128(void *p) diff --git a/lib/eal/ppc/include/rte_vect.h b/lib/eal/ppc/include/rte_vect.h index a5f009b..c8bace2 100644 --- a/lib/eal/ppc/include/rte_vect.h +++ b/lib/eal/ppc/include/rte_vect.h @@ -22,14 +22,14 @@ #define XMM_SIZE (sizeof(xmm_t)) #define XMM_MASK (XMM_SIZE - 1) -typedef union rte_xmm { +typedef union __rte_aligned(16) rte_xmm { xmm_t x; uint8_t u8[XMM_SIZE / sizeof(uint8_t)]; uint16_t u16[XMM_SIZE / sizeof(uint16_t)]; uint32_t u32[XMM_SIZE / sizeof(uint32_t)]; uint64_t u64[XMM_SIZE / sizeof(uint64_t)]; double pd[XMM_SIZE / sizeof(double)]; -} __rte_aligned(16) rte_xmm_t; +} rte_xmm_t; #ifdef __cplusplus } diff --git a/lib/eal/riscv/include/rte_vect.h b/lib/eal/riscv/include/rte_vect.h index da9092a..6df10fa 100644 --- a/lib/eal/riscv/include/rte_vect.h +++ b/lib/eal/riscv/include/rte_vect.h @@ -22,14 +22,14 @@ #define XMM_SIZE (sizeof(xmm_t)) #define XMM_MASK (XMM_SIZE - 1) -typedef union rte_xmm { +typedef union __rte_aligned(16) rte_xmm { xmm_t x; uint8_t u8[XMM_SIZE / sizeof(uint8_t)]; uint16_t u16[XMM_SIZE / sizeof(uint16_t)]; uint32_t u32[XMM_SIZE / sizeof(uint32_t)]; uint64_t u64[XMM_SIZE / sizeof(uint64_t)]; double pd[XMM_SIZE / sizeof(double)]; -} __rte_aligned(16) rte_xmm_t; +} rte_xmm_t; static inline xmm_t vect_load_128(void *p) diff --git a/lib/eal/x86/include/rte_vect.h b/lib/eal/x86/include/rte_vect.h index 560f9e4..a1a537e 100644 --- a/lib/eal/x86/include/rte_vect.h +++ b/lib/eal/x86/include/rte_vect.h @@ -91,7 +91,7 @@ #define RTE_X86_ZMM_SIZE (sizeof(__m512i)) #define RTE_X86_ZMM_MASK (RTE_X86_ZMM_SIZE - 1) -typedef union __rte_x86_zmm { +typedef union __rte_aligned(RTE_X86_ZMM_SIZE) __rte_x86_zmm { __m512i z; ymm_t y[RTE_X86_ZMM_SIZE / sizeof(ymm_t)]; xmm_t x[RTE_X86_ZMM_SIZE / sizeof(xmm_t)]; @@ -100,7 +100,7 @@ uint32_t u32[RTE_X86_ZMM_SIZE / sizeof(uint32_t)]; uint64_t u64[RTE_X86_ZMM_SIZE / sizeof(uint64_t)]; double pd[RTE_X86_ZMM_SIZE / sizeof(double)]; -} __rte_aligned(RTE_X86_ZMM_SIZE) __rte_x86_zmm_t; +} __rte_x86_zmm_t; #endif /* __AVX512F__ */ From patchwork Wed Feb 14 04:17:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 136696 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 7F6B643B1F; Wed, 14 Feb 2024 05:18:16 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A5FDD42F3F; Wed, 14 Feb 2024 05:17:59 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id BA06242F0C for ; Wed, 14 Feb 2024 05:17:52 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id A6EA920B2001; Tue, 13 Feb 2024 20:17:51 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com A6EA920B2001 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1707884271; bh=DrECQuzcft6uwZnFXtkTeQJ7+0u0JZJ5ajf20rpqio0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RRy7TRlcvP6tZYmXCAbJHvGfrD5S1ASwnL3mMgyqA4z5Jj0v92z0wPyfh4dVRduSp 5aPtvWlWkpIuH3/VfiuOivXZpBwsM2QIeb9yaAFFBwJI8Rg/elO4u3jVHdlU2Q0PJ2 M8mZWHZ+SK4FDOcadT3TiuNLtpaos3cmtDRf9bzA= From: Tyler Retzlaff To: dev@dpdk.org Cc: Andrew Rybchenko , Bruce Richardson , Chengwen Feng , Cristian Dumitrescu , David Christensen , David Hunt , Ferruh Yigit , Honnappa Nagarahalli , Jasvinder Singh , Jerin Jacob , Kevin Laatz , Konstantin Ananyev , Min Zhou , Ruifeng Wang , Sameh Gobriel , Stanislaw Kardach , Thomas Monjalon , Vladimir Medvedkin , Yipeng Wang , Tyler Retzlaff Subject: [PATCH v2 02/14] stack: use C11 alignas Date: Tue, 13 Feb 2024 20:17:38 -0800 Message-Id: <1707884270-27189-3-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1707884270-27189-1-git-send-email-roretzla@linux.microsoft.com> References: <1707873986-29352-1-git-send-email-roretzla@linux.microsoft.com> <1707884270-27189-1-git-send-email-roretzla@linux.microsoft.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org * Move __rte_aligned from the end of {struct,union} definitions to be between {struct,union} and tag. The placement between {struct,union} and the tag allows the desired alignment to be imparted on the type regardless of the toolchain being used for all of GCC, LLVM, MSVC compilers building both C and C++. * Replace use of __rte_aligned(a) on variables/fields with alignas(a). Signed-off-by: Tyler Retzlaff --- lib/stack/rte_stack.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/stack/rte_stack.h b/lib/stack/rte_stack.h index a379300..573e15c 100644 --- a/lib/stack/rte_stack.h +++ b/lib/stack/rte_stack.h @@ -15,6 +15,8 @@ #ifndef _RTE_STACK_H_ #define _RTE_STACK_H_ +#include + #ifdef __cplusplus extern "C" { #endif @@ -42,7 +44,7 @@ struct rte_stack_lf_head { struct rte_stack_lf_list { /** List head */ - struct rte_stack_lf_head head __rte_aligned(16); + alignas(16) struct rte_stack_lf_head head; /** List len */ RTE_ATOMIC(uint64_t) len; }; From patchwork Wed Feb 14 04:17:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 136695 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 927B543B1F; Wed, 14 Feb 2024 05:18:10 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8769842F33; Wed, 14 Feb 2024 05:17:58 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id AC2DA42F08 for ; Wed, 14 Feb 2024 05:17:52 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id B5B2920B2002; Tue, 13 Feb 2024 20:17:51 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com B5B2920B2002 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1707884271; bh=xV8/R+jJW62APbyXMp4pGMe9MN1XRpNg6KGR5AfVxBY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kyb+3n6UAUy1jKZgm4PvRNXVMaZ9IIrAKX3OcVOZUoVqvjf+2l+56Kcc0fNvqbqR8 vfQdDHeEe1zEZS/IFk5l1Zui+xmPqIGai/FF6ACJOr1+8uln+dGWMf+TsgLFyxlQ15 D1Oso38XFp7QZfXNs/gGat1HU9MYtihbsdOK4agU= From: Tyler Retzlaff To: dev@dpdk.org Cc: Andrew Rybchenko , Bruce Richardson , Chengwen Feng , Cristian Dumitrescu , David Christensen , David Hunt , Ferruh Yigit , Honnappa Nagarahalli , Jasvinder Singh , Jerin Jacob , Kevin Laatz , Konstantin Ananyev , Min Zhou , Ruifeng Wang , Sameh Gobriel , Stanislaw Kardach , Thomas Monjalon , Vladimir Medvedkin , Yipeng Wang , Tyler Retzlaff Subject: [PATCH v2 03/14] sched: use C11 alignas Date: Tue, 13 Feb 2024 20:17:39 -0800 Message-Id: <1707884270-27189-4-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1707884270-27189-1-git-send-email-roretzla@linux.microsoft.com> References: <1707873986-29352-1-git-send-email-roretzla@linux.microsoft.com> <1707884270-27189-1-git-send-email-roretzla@linux.microsoft.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Replace use of __rte_aligned_16 with C11 alignas(16) and garbage collect the __rte_aligned_16 macro which was only used once. Signed-off-by: Tyler Retzlaff --- lib/sched/rte_sched.c | 3 ++- lib/sched/rte_sched_common.h | 2 -- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/sched/rte_sched.c b/lib/sched/rte_sched.c index d90aa53..41ac2ac 100644 --- a/lib/sched/rte_sched.c +++ b/lib/sched/rte_sched.c @@ -2,6 +2,7 @@ * Copyright(c) 2010-2014 Intel Corporation */ +#include #include #include @@ -193,7 +194,7 @@ struct rte_sched_subport { /* Bitmap */ struct rte_bitmap *bmp; - uint32_t grinder_base_bmp_pos[RTE_SCHED_PORT_N_GRINDERS] __rte_aligned_16; + alignas(16) uint32_t grinder_base_bmp_pos[RTE_SCHED_PORT_N_GRINDERS]; /* Grinders */ struct rte_sched_grinder grinder[RTE_SCHED_PORT_N_GRINDERS]; diff --git a/lib/sched/rte_sched_common.h b/lib/sched/rte_sched_common.h index 419700b..573d164 100644 --- a/lib/sched/rte_sched_common.h +++ b/lib/sched/rte_sched_common.h @@ -12,8 +12,6 @@ #include #include -#define __rte_aligned_16 __rte_aligned(16) - #if 0 static inline uint32_t rte_min_pos_4_u16(uint16_t *x) From patchwork Wed Feb 14 04:17:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 136694 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 1FFF143B1F; Wed, 14 Feb 2024 05:18:05 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6418F42F27; Wed, 14 Feb 2024 05:17:57 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id A67B742F07 for ; Wed, 14 Feb 2024 05:17:52 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id C4B9720B2003; Tue, 13 Feb 2024 20:17:51 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com C4B9720B2003 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1707884271; bh=56ITGK5IqE8hAllehk+pSG8e0+SqQdwsT5u3Z8tNZ4Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kUw7pUK41qFajhraTRXUXbgl8QB35F+U5VxRVFsBTO5R1QcK1qjm9RSKM6BMMYdTm fMaBzRrDIPzwoOjSuDTrOmfe1NIO4Ttv0vHE+mqgbKRkWEQ329ujGXe8zswG0KuN4y ztQ2XzJdx4msn7WcN1STZB71AM3vQTizP/Zpo3fs= From: Tyler Retzlaff To: dev@dpdk.org Cc: Andrew Rybchenko , Bruce Richardson , Chengwen Feng , Cristian Dumitrescu , David Christensen , David Hunt , Ferruh Yigit , Honnappa Nagarahalli , Jasvinder Singh , Jerin Jacob , Kevin Laatz , Konstantin Ananyev , Min Zhou , Ruifeng Wang , Sameh Gobriel , Stanislaw Kardach , Thomas Monjalon , Vladimir Medvedkin , Yipeng Wang , Tyler Retzlaff Subject: [PATCH v2 04/14] ring: remove unnecessary explicit alignment Date: Tue, 13 Feb 2024 20:17:40 -0800 Message-Id: <1707884270-27189-5-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1707884270-27189-1-git-send-email-roretzla@linux.microsoft.com> References: <1707873986-29352-1-git-send-email-roretzla@linux.microsoft.com> <1707884270-27189-1-git-send-email-roretzla@linux.microsoft.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Remove explicit alignment with __rte_aligned(8) from RTE_ATOMIC(uint64_t) raw fields in the absence of packing the fields should be naturally aligned to 8. Signed-off-by: Tyler Retzlaff --- lib/ring/rte_ring_core.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ring/rte_ring_core.h b/lib/ring/rte_ring_core.h index b770873..619b69f 100644 --- a/lib/ring/rte_ring_core.h +++ b/lib/ring/rte_ring_core.h @@ -78,7 +78,7 @@ struct rte_ring_headtail { union __rte_ring_rts_poscnt { /** raw 8B value to read/write *cnt* and *pos* as one atomic op */ - RTE_ATOMIC(uint64_t) raw __rte_aligned(8); + RTE_ATOMIC(uint64_t) raw; struct { uint32_t cnt; /**< head/tail reference counter */ uint32_t pos; /**< head/tail position */ @@ -94,7 +94,7 @@ struct rte_ring_rts_headtail { union __rte_ring_hts_pos { /** raw 8B value to read/write *head* and *tail* as one atomic op */ - RTE_ATOMIC(uint64_t) raw __rte_aligned(8); + RTE_ATOMIC(uint64_t) raw; struct { RTE_ATOMIC(uint32_t) head; /**< head position */ RTE_ATOMIC(uint32_t) tail; /**< tail position */ From patchwork Wed Feb 14 04:17:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 136699 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 5945743B1F; Wed, 14 Feb 2024 05:18:33 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 11D9242F5F; Wed, 14 Feb 2024 05:18:03 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 5690A42DF9 for ; Wed, 14 Feb 2024 05:17:53 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id D390920B2004; Tue, 13 Feb 2024 20:17:51 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com D390920B2004 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1707884271; bh=L1ZnXSfMFHkQ9EvVoxwPvpfe0MCNUFV9AKEjTyS4vGQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jfdz/n8jeONJdtlIVBOFMv8fBjmP3vMlBCB/NvVWcdqwnGlzYekotS9t5dFvQsAMN BInulNElK8q8mW4fWiqZIqHEehoso92ItgbI/p/wRQoQGi761d86KbUNIyaQE0f5ln zicvad486oGmv7tvI4KT00H5V/wwJ+jlSAv5EYqQ= From: Tyler Retzlaff To: dev@dpdk.org Cc: Andrew Rybchenko , Bruce Richardson , Chengwen Feng , Cristian Dumitrescu , David Christensen , David Hunt , Ferruh Yigit , Honnappa Nagarahalli , Jasvinder Singh , Jerin Jacob , Kevin Laatz , Konstantin Ananyev , Min Zhou , Ruifeng Wang , Sameh Gobriel , Stanislaw Kardach , Thomas Monjalon , Vladimir Medvedkin , Yipeng Wang , Tyler Retzlaff Subject: [PATCH v2 05/14] pipeline: use C11 alignas Date: Tue, 13 Feb 2024 20:17:41 -0800 Message-Id: <1707884270-27189-6-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1707884270-27189-1-git-send-email-roretzla@linux.microsoft.com> References: <1707873986-29352-1-git-send-email-roretzla@linux.microsoft.com> <1707884270-27189-1-git-send-email-roretzla@linux.microsoft.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org * Move __rte_aligned from the end of {struct,union} definitions to be between {struct,union} and tag. The placement between {struct,union} and the tag allows the desired alignment to be imparted on the type regardless of the toolchain being used for all of GCC, LLVM, MSVC compilers building both C and C++. * Replace use of __rte_aligned(a) on variables/fields with alignas(a). Signed-off-by: Tyler Retzlaff --- lib/pipeline/rte_table_action.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/pipeline/rte_table_action.c b/lib/pipeline/rte_table_action.c index dfdbc66..87c3e0e 100644 --- a/lib/pipeline/rte_table_action.c +++ b/lib/pipeline/rte_table_action.c @@ -465,11 +465,11 @@ struct encap_qinq_data { ((((uint64_t)(s)) & 0x1LLU) << 8) | \ (((uint64_t)(ttl)) & 0xFFLLU))) -struct encap_mpls_data { +struct __rte_aligned(2) encap_mpls_data { struct rte_ether_hdr ether; uint32_t mpls[RTE_TABLE_ACTION_MPLS_LABELS_MAX]; uint32_t mpls_count; -} __rte_packed __rte_aligned(2); +} __rte_packed; #define PPP_PROTOCOL_IP 0x0021 @@ -487,42 +487,42 @@ struct encap_pppoe_data { #define IP_PROTO_UDP 17 -struct encap_vxlan_ipv4_data { +struct __rte_aligned(2) encap_vxlan_ipv4_data { struct rte_ether_hdr ether; struct rte_ipv4_hdr ipv4; struct rte_udp_hdr udp; struct rte_vxlan_hdr vxlan; -} __rte_packed __rte_aligned(2); +} __rte_packed; -struct encap_vxlan_ipv4_vlan_data { +struct __rte_aligned(2) encap_vxlan_ipv4_vlan_data { struct rte_ether_hdr ether; struct rte_vlan_hdr vlan; struct rte_ipv4_hdr ipv4; struct rte_udp_hdr udp; struct rte_vxlan_hdr vxlan; -} __rte_packed __rte_aligned(2); +} __rte_packed; -struct encap_vxlan_ipv6_data { +struct __rte_aligned(2) encap_vxlan_ipv6_data { struct rte_ether_hdr ether; struct rte_ipv6_hdr ipv6; struct rte_udp_hdr udp; struct rte_vxlan_hdr vxlan; -} __rte_packed __rte_aligned(2); +} __rte_packed; -struct encap_vxlan_ipv6_vlan_data { +struct __rte_aligned(2) encap_vxlan_ipv6_vlan_data { struct rte_ether_hdr ether; struct rte_vlan_hdr vlan; struct rte_ipv6_hdr ipv6; struct rte_udp_hdr udp; struct rte_vxlan_hdr vxlan; -} __rte_packed __rte_aligned(2); +} __rte_packed; -struct encap_qinq_pppoe_data { +struct __rte_aligned(2) encap_qinq_pppoe_data { struct rte_ether_hdr ether; struct rte_vlan_hdr svlan; struct rte_vlan_hdr cvlan; struct pppoe_ppp_hdr pppoe_ppp; -} __rte_packed __rte_aligned(2); +} __rte_packed; static size_t encap_data_size(struct rte_table_action_encap_config *encap) From patchwork Wed Feb 14 04:17:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 136700 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 3F39543B1F; Wed, 14 Feb 2024 05:18:39 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4351442F6B; Wed, 14 Feb 2024 05:18:04 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 5748742E51 for ; Wed, 14 Feb 2024 05:17:53 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id E28BA20B2005; Tue, 13 Feb 2024 20:17:51 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com E28BA20B2005 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1707884271; bh=RU+N1IY0miH5yG0KIFGQoT7EyMlm9UDeBgz5Jei9siI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bXVSfNW1byiD4MsV0Jk22Sc/RbzZ7KS48wBRc5tc0zd+LlxVWXnkUsXIi/5AEVfGZ 24RNTUfZthQ8bES5FpJSg5b4H/Rj0LQ9N64oa+4gbIE7UxYG0xpWH4zk+YKl53SmIO 6Lg3uxdgS7jvQR8aQgZuXZpKKZG1nL3dKK/T9YyA= From: Tyler Retzlaff To: dev@dpdk.org Cc: Andrew Rybchenko , Bruce Richardson , Chengwen Feng , Cristian Dumitrescu , David Christensen , David Hunt , Ferruh Yigit , Honnappa Nagarahalli , Jasvinder Singh , Jerin Jacob , Kevin Laatz , Konstantin Ananyev , Min Zhou , Ruifeng Wang , Sameh Gobriel , Stanislaw Kardach , Thomas Monjalon , Vladimir Medvedkin , Yipeng Wang , Tyler Retzlaff Subject: [PATCH v2 06/14] net: use C11 alignas Date: Tue, 13 Feb 2024 20:17:42 -0800 Message-Id: <1707884270-27189-7-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1707884270-27189-1-git-send-email-roretzla@linux.microsoft.com> References: <1707873986-29352-1-git-send-email-roretzla@linux.microsoft.com> <1707884270-27189-1-git-send-email-roretzla@linux.microsoft.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org * Move __rte_aligned from the end of {struct,union} definitions to be between {struct,union} and tag. The placement between {struct,union} and the tag allows the desired alignment to be imparted on the type regardless of the toolchain being used for all of GCC, LLVM, MSVC compilers building both C and C++. * Replace use of __rte_aligned(a) on variables/fields with alignas(a). Signed-off-by: Tyler Retzlaff --- lib/net/net_crc_avx512.c | 14 ++++++++------ lib/net/net_crc_neon.c | 11 ++++++----- lib/net/net_crc_sse.c | 17 +++++++++-------- lib/net/rte_arp.h | 8 ++++---- lib/net/rte_ether.h | 8 ++++---- 5 files changed, 31 insertions(+), 27 deletions(-) diff --git a/lib/net/net_crc_avx512.c b/lib/net/net_crc_avx512.c index f6a3ce9..0f48ca0 100644 --- a/lib/net/net_crc_avx512.c +++ b/lib/net/net_crc_avx512.c @@ -3,6 +3,8 @@ */ +#include + #include #include "net_crc.h" @@ -20,8 +22,8 @@ struct crc_vpclmulqdq_ctx { __m128i fold_1x128b; }; -static struct crc_vpclmulqdq_ctx crc32_eth __rte_aligned(64); -static struct crc_vpclmulqdq_ctx crc16_ccitt __rte_aligned(64); +static alignas(64) struct crc_vpclmulqdq_ctx crc32_eth; +static alignas(64) struct crc_vpclmulqdq_ctx crc16_ccitt; static uint16_t byte_len_to_mask_table[] = { 0x0000, 0x0001, 0x0003, 0x0007, @@ -30,18 +32,18 @@ struct crc_vpclmulqdq_ctx { 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff}; -static const uint8_t shf_table[32] __rte_aligned(16) = { +static const alignas(16) uint8_t shf_table[32] = { 0x00, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }; -static const uint32_t mask[4] __rte_aligned(16) = { +static const alignas(16) uint32_t mask[4] = { 0xffffffff, 0xffffffff, 0x00000000, 0x00000000 }; -static const uint32_t mask2[4] __rte_aligned(16) = { +static const alignas(16) uint32_t mask2[4] = { 0x00000000, 0xffffffff, 0xffffffff, 0xffffffff }; @@ -93,7 +95,7 @@ struct crc_vpclmulqdq_ctx { uint32_t offset; __m128i res2, res3, res4, pshufb_shf; - const uint32_t mask3[4] __rte_aligned(16) = { + const alignas(16) uint32_t mask3[4] = { 0x80808080, 0x80808080, 0x80808080, 0x80808080 }; diff --git a/lib/net/net_crc_neon.c b/lib/net/net_crc_neon.c index f61d75a..cee75dd 100644 --- a/lib/net/net_crc_neon.c +++ b/lib/net/net_crc_neon.c @@ -2,6 +2,7 @@ * Copyright(c) 2017 Cavium, Inc */ +#include #include #include @@ -19,8 +20,8 @@ struct crc_pmull_ctx { uint64x2_t rk7_rk8; }; -struct crc_pmull_ctx crc32_eth_pmull __rte_aligned(16); -struct crc_pmull_ctx crc16_ccitt_pmull __rte_aligned(16); +alignas(16) struct crc_pmull_ctx crc32_eth_pmull; +alignas(16) struct crc_pmull_ctx crc16_ccitt_pmull; /** * @brief Performs one folding round @@ -96,10 +97,10 @@ struct crc_pmull_ctx { crcr32_reduce_64_to_32(uint64x2_t data64, uint64x2_t precomp) { - static uint32_t mask1[4] __rte_aligned(16) = { + static alignas(16) uint32_t mask1[4] = { 0xffffffff, 0xffffffff, 0x00000000, 0x00000000 }; - static uint32_t mask2[4] __rte_aligned(16) = { + static alignas(16) uint32_t mask2[4] = { 0x00000000, 0xffffffff, 0xffffffff, 0xffffffff }; uint64x2_t tmp0, tmp1, tmp2; @@ -148,7 +149,7 @@ struct crc_pmull_ctx { if (unlikely(data_len < 16)) { /* 0 to 15 bytes */ - uint8_t buffer[16] __rte_aligned(16); + alignas(16) uint8_t buffer[16]; memset(buffer, 0, sizeof(buffer)); memcpy(buffer, data, data_len); diff --git a/lib/net/net_crc_sse.c b/lib/net/net_crc_sse.c index dd75845..d673ae3 100644 --- a/lib/net/net_crc_sse.c +++ b/lib/net/net_crc_sse.c @@ -2,6 +2,7 @@ * Copyright(c) 2017-2020 Intel Corporation */ +#include #include #include @@ -18,8 +19,8 @@ struct crc_pclmulqdq_ctx { __m128i rk7_rk8; }; -static struct crc_pclmulqdq_ctx crc32_eth_pclmulqdq __rte_aligned(16); -static struct crc_pclmulqdq_ctx crc16_ccitt_pclmulqdq __rte_aligned(16); +static alignas(16) struct crc_pclmulqdq_ctx crc32_eth_pclmulqdq; +static alignas(16) struct crc_pclmulqdq_ctx crc16_ccitt_pclmulqdq; /** * @brief Performs one folding round * @@ -96,11 +97,11 @@ struct crc_pclmulqdq_ctx { static __rte_always_inline uint32_t crcr32_reduce_64_to_32(__m128i data64, __m128i precomp) { - static const uint32_t mask1[4] __rte_aligned(16) = { + static const alignas(16) uint32_t mask1[4] = { 0xffffffff, 0xffffffff, 0x00000000, 0x00000000 }; - static const uint32_t mask2[4] __rte_aligned(16) = { + static const alignas(16) uint32_t mask2[4] = { 0x00000000, 0xffffffff, 0xffffffff, 0xffffffff }; __m128i tmp0, tmp1, tmp2; @@ -118,7 +119,7 @@ struct crc_pclmulqdq_ctx { return _mm_extract_epi32(tmp2, 2); } -static const uint8_t crc_xmm_shift_tab[48] __rte_aligned(16) = { +static const alignas(16) uint8_t crc_xmm_shift_tab[48] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, @@ -175,7 +176,7 @@ struct crc_pclmulqdq_ctx { if (unlikely(data_len < 16)) { /* 0 to 15 bytes */ - uint8_t buffer[16] __rte_aligned(16); + alignas(16) uint8_t buffer[16]; memset(buffer, 0, sizeof(buffer)); memcpy(buffer, data, data_len); @@ -212,11 +213,11 @@ struct crc_pclmulqdq_ctx { partial_bytes: if (likely(n < data_len)) { - const uint32_t mask3[4] __rte_aligned(16) = { + const alignas(16) uint32_t mask3[4] = { 0x80808080, 0x80808080, 0x80808080, 0x80808080 }; - const uint8_t shf_table[32] __rte_aligned(16) = { + const alignas(16) uint8_t shf_table[32] = { 0x00, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, diff --git a/lib/net/rte_arp.h b/lib/net/rte_arp.h index c3cd0af..668cea1 100644 --- a/lib/net/rte_arp.h +++ b/lib/net/rte_arp.h @@ -21,17 +21,17 @@ /** * ARP header IPv4 payload. */ -struct rte_arp_ipv4 { +struct __rte_aligned(2) rte_arp_ipv4 { struct rte_ether_addr arp_sha; /**< sender hardware address */ rte_be32_t arp_sip; /**< sender IP address */ struct rte_ether_addr arp_tha; /**< target hardware address */ rte_be32_t arp_tip; /**< target IP address */ -} __rte_packed __rte_aligned(2); +} __rte_packed; /** * ARP header. */ -struct rte_arp_hdr { +struct __rte_aligned(2) rte_arp_hdr { rte_be16_t arp_hardware; /**< format of hardware address */ #define RTE_ARP_HRD_ETHER 1 /**< ARP Ethernet address format */ @@ -47,7 +47,7 @@ struct rte_arp_hdr { #define RTE_ARP_OP_INVREPLY 9 /**< response identifying peer */ struct rte_arp_ipv4 arp_data; -} __rte_packed __rte_aligned(2); +} __rte_packed; /** * Make a RARP packet based on MAC addr. diff --git a/lib/net/rte_ether.h b/lib/net/rte_ether.h index ce073ea..f4c5af4 100644 --- a/lib/net/rte_ether.h +++ b/lib/net/rte_ether.h @@ -57,9 +57,9 @@ * administrator and does not contain OUIs. * See http://standards.ieee.org/regauth/groupmac/tutorial.html */ -struct rte_ether_addr { +struct __rte_aligned(2) rte_ether_addr { uint8_t addr_bytes[RTE_ETHER_ADDR_LEN]; /**< Addr bytes in tx order */ -} __rte_aligned(2); +}; #define RTE_ETHER_LOCAL_ADMIN_ADDR 0x02 /**< Locally assigned Eth. address. */ #define RTE_ETHER_GROUP_ADDR 0x01 /**< Multicast or broadcast Eth. address. */ @@ -276,11 +276,11 @@ static inline int rte_is_valid_assigned_ether_addr(const struct rte_ether_addr * * Ethernet header: Contains the destination address, source address * and frame type. */ -struct rte_ether_hdr { +struct __rte_aligned(2) rte_ether_hdr { struct rte_ether_addr dst_addr; /**< Destination address. */ struct rte_ether_addr src_addr; /**< Source address. */ rte_be16_t ether_type; /**< Frame type. */ -} __rte_aligned(2); +}; /** * Ethernet VLAN Header. From patchwork Wed Feb 14 04:17:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 136698 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 CA66E43B1F; Wed, 14 Feb 2024 05:18:27 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E18DC42F55; Wed, 14 Feb 2024 05:18:01 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 6239742F07 for ; Wed, 14 Feb 2024 05:17:53 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id F2FF620B2006; Tue, 13 Feb 2024 20:17:51 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com F2FF620B2006 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1707884272; bh=49/lPPUSW7N5gZB/Z+n58VU1o+fOoZFicR1hYcHeVt4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j5/XMmPImd79VHCEtZjIMYjDZChSx1bhe6e3ju2cp/sPnxhz21Ejf7/dPhUyqDZVk L7SLOcQGLWlZ2XuljviOhczdreoTky4IJnOqfyf5MEs3BLYXJKeWr/ZkO1tHzi3ja7 ibl4x+3xiVtFxKoUQMgKCtQ1blE4Zl7E8R2ab9+c= From: Tyler Retzlaff To: dev@dpdk.org Cc: Andrew Rybchenko , Bruce Richardson , Chengwen Feng , Cristian Dumitrescu , David Christensen , David Hunt , Ferruh Yigit , Honnappa Nagarahalli , Jasvinder Singh , Jerin Jacob , Kevin Laatz , Konstantin Ananyev , Min Zhou , Ruifeng Wang , Sameh Gobriel , Stanislaw Kardach , Thomas Monjalon , Vladimir Medvedkin , Yipeng Wang , Tyler Retzlaff Subject: [PATCH v2 07/14] mbuf: remove unnecessary explicit alignment Date: Tue, 13 Feb 2024 20:17:43 -0800 Message-Id: <1707884270-27189-8-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1707884270-27189-1-git-send-email-roretzla@linux.microsoft.com> References: <1707873986-29352-1-git-send-email-roretzla@linux.microsoft.com> <1707884270-27189-1-git-send-email-roretzla@linux.microsoft.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Remove explicit alignment with __rte_aligned(sizeof(T)) on buf_iova field in the absence of packing the field should be correctly aligned. Signed-off-by: Tyler Retzlaff --- lib/mbuf/rte_mbuf_core.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h index 5688683..eea2ea5 100644 --- a/lib/mbuf/rte_mbuf_core.h +++ b/lib/mbuf/rte_mbuf_core.h @@ -476,7 +476,7 @@ struct rte_mbuf { * same mbuf cacheline0 layout for 32-bit and 64-bit. This makes * working on vector drivers easier. */ - rte_iova_t buf_iova __rte_aligned(sizeof(rte_iova_t)); + rte_iova_t buf_iova; #else /** * Next segment of scattered packet. From patchwork Wed Feb 14 04:17:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 136704 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 401EC43B1F; Wed, 14 Feb 2024 05:19:00 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1249E42F91; Wed, 14 Feb 2024 05:18:09 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 83D7C42F0D for ; Wed, 14 Feb 2024 05:17:53 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 0D6E420B2007; Tue, 13 Feb 2024 20:17:51 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 0D6E420B2007 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1707884272; bh=D27G0YOytnikS6aI+nNkZxgMLQTrfV8INWTTbuwujBg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E+9r8y6sPlXjSSrNMDLedQTV8oV2OkxekDJQc4Ieu1hjuevGdlCwayT1cHDFidtO5 qlqrANDgMTYlhMdK0xFmMnZnjIF9HsfgHshx4mh+H5BIVjzcuXgRrnjcluqtE/JjL5 d9vUjw9UTpjMW1CJZZZvoP4T/BsNjO6Rk2CvECvY= From: Tyler Retzlaff To: dev@dpdk.org Cc: Andrew Rybchenko , Bruce Richardson , Chengwen Feng , Cristian Dumitrescu , David Christensen , David Hunt , Ferruh Yigit , Honnappa Nagarahalli , Jasvinder Singh , Jerin Jacob , Kevin Laatz , Konstantin Ananyev , Min Zhou , Ruifeng Wang , Sameh Gobriel , Stanislaw Kardach , Thomas Monjalon , Vladimir Medvedkin , Yipeng Wang , Tyler Retzlaff Subject: [PATCH v2 08/14] hash: use C11 alignas Date: Tue, 13 Feb 2024 20:17:44 -0800 Message-Id: <1707884270-27189-9-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1707884270-27189-1-git-send-email-roretzla@linux.microsoft.com> References: <1707873986-29352-1-git-send-email-roretzla@linux.microsoft.com> <1707884270-27189-1-git-send-email-roretzla@linux.microsoft.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org * Move __rte_aligned from the end of {struct,union} definitions to be between {struct,union} and tag. The placement between {struct,union} and the tag allows the desired alignment to be imparted on the type regardless of the toolchain being used for all of GCC, LLVM, MSVC compilers building both C and C++. * Replace use of __rte_aligned(a) on variables/fields with alignas(a). Signed-off-by: Tyler Retzlaff --- lib/hash/rte_thash.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/hash/rte_thash.h b/lib/hash/rte_thash.h index 2681b1b..30b657e 100644 --- a/lib/hash/rte_thash.h +++ b/lib/hash/rte_thash.h @@ -99,14 +99,14 @@ struct rte_ipv6_tuple { }; }; +#ifdef RTE_ARCH_X86 +union __rte_aligned(XMM_SIZE) rte_thash_tuple { +#else union rte_thash_tuple { +#endif struct rte_ipv4_tuple v4; struct rte_ipv6_tuple v6; -#ifdef RTE_ARCH_X86 -} __rte_aligned(XMM_SIZE); -#else }; -#endif /** * Prepare special converted key to use with rte_softrss_be() From patchwork Wed Feb 14 04:17:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 136705 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 0A8A043B1F; Wed, 14 Feb 2024 05:19:06 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4A12442F9D; Wed, 14 Feb 2024 05:18:10 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 8AFCD42F17 for ; Wed, 14 Feb 2024 05:17:53 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 1C69D20B2008; Tue, 13 Feb 2024 20:17:51 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 1C69D20B2008 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1707884272; bh=DzUNLFvzgUljzJC1lDjpuo+aktN+hcZYbm+VmhE4wTw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B+YoypEPws4VM1+I3/8mHLpUpdzD8dFVY8HCNnqPCjKH5Vd7CeqQW6StZQU9ipqDx onK2/Ek9R6lPuOfaSVMwiZCIrj2dnJDbvVuVLOTtJ+IKpbDS6ynVQtoxvs3H/WdJFv YiZKhwH3DipnKR52Uf+rJbMs/RC8Kg3IkH/rC97M= From: Tyler Retzlaff To: dev@dpdk.org Cc: Andrew Rybchenko , Bruce Richardson , Chengwen Feng , Cristian Dumitrescu , David Christensen , David Hunt , Ferruh Yigit , Honnappa Nagarahalli , Jasvinder Singh , Jerin Jacob , Kevin Laatz , Konstantin Ananyev , Min Zhou , Ruifeng Wang , Sameh Gobriel , Stanislaw Kardach , Thomas Monjalon , Vladimir Medvedkin , Yipeng Wang , Tyler Retzlaff Subject: [PATCH v2 09/14] eventdev: use C11 alignas Date: Tue, 13 Feb 2024 20:17:45 -0800 Message-Id: <1707884270-27189-10-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1707884270-27189-1-git-send-email-roretzla@linux.microsoft.com> References: <1707873986-29352-1-git-send-email-roretzla@linux.microsoft.com> <1707884270-27189-1-git-send-email-roretzla@linux.microsoft.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org * Move __rte_aligned from the end of {struct,union} definitions to be between {struct,union} and tag. The placement between {struct,union} and the tag allows the desired alignment to be imparted on the type regardless of the toolchain being used for all of GCC, LLVM, MSVC compilers building both C and C++. * Replace use of __rte_aligned(a) on variables/fields with alignas(a). Signed-off-by: Tyler Retzlaff --- lib/eventdev/rte_eventdev.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/eventdev/rte_eventdev.h b/lib/eventdev/rte_eventdev.h index ec9b024..ff143c7 100644 --- a/lib/eventdev/rte_eventdev.h +++ b/lib/eventdev/rte_eventdev.h @@ -1078,7 +1078,7 @@ int rte_event_dev_stop_flush_callback_register(uint8_t dev_id, /** * Event vector structure. */ -struct rte_event_vector { +struct __rte_aligned(16) rte_event_vector { uint16_t nb_elem; /**< Number of elements valid in this event vector. */ uint16_t elem_offset : 12; @@ -1118,19 +1118,19 @@ struct rte_event_vector { * value to share between dequeue and enqueue operation. * The application should not modify this field. */ - union { + union __rte_aligned(16) { #endif struct rte_mbuf *mbufs[0]; void *ptrs[0]; uint64_t u64s[0]; #ifndef __cplusplus - } __rte_aligned(16); + }; #endif /**< Start of the vector array union. Depending upon the event type the * vector array can be an array of mbufs or pointers or opaque u64 * values. */ -} __rte_aligned(16); +}; /* Scheduler type definitions */ #define RTE_SCHED_TYPE_ORDERED 0 From patchwork Wed Feb 14 04:17:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 136702 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 08A5043B1F; Wed, 14 Feb 2024 05:18:50 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 986E842F7D; Wed, 14 Feb 2024 05:18:06 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 8B66C42F1F for ; Wed, 14 Feb 2024 05:17:53 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 2B52720B2009; Tue, 13 Feb 2024 20:17:51 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 2B52720B2009 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1707884272; bh=uf05fKr8e3MjtIOstPHr6rG8ICzwl3PhBVvDHMVxdDI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=apA77QrgltqntTXkKAYzs0zWdx8jAhIukO41Fa46RIXhJwOWOaT/RpO2407ZWA1hn JqElsq3tvAz/8otXt1SL7DNGNiaeFKVxN4X5IoGeQ5vOKHkHqJS0ZGMzrrF78bmf79 99kLbm0BaSUbRhz9/OoSsbjj6gMRr++cSTAlmE/g= From: Tyler Retzlaff To: dev@dpdk.org Cc: Andrew Rybchenko , Bruce Richardson , Chengwen Feng , Cristian Dumitrescu , David Christensen , David Hunt , Ferruh Yigit , Honnappa Nagarahalli , Jasvinder Singh , Jerin Jacob , Kevin Laatz , Konstantin Ananyev , Min Zhou , Ruifeng Wang , Sameh Gobriel , Stanislaw Kardach , Thomas Monjalon , Vladimir Medvedkin , Yipeng Wang , Tyler Retzlaff Subject: [PATCH v2 10/14] ethdev: use C11 alignas Date: Tue, 13 Feb 2024 20:17:46 -0800 Message-Id: <1707884270-27189-11-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1707884270-27189-1-git-send-email-roretzla@linux.microsoft.com> References: <1707873986-29352-1-git-send-email-roretzla@linux.microsoft.com> <1707884270-27189-1-git-send-email-roretzla@linux.microsoft.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org * Move __rte_aligned from the end of {struct,union} definitions to be between {struct,union} and tag. The placement between {struct,union} and the tag allows the desired alignment to be imparted on the type regardless of the toolchain being used for all of GCC, LLVM, MSVC compilers building both C and C++. * Replace use of __rte_aligned(a) on variables/fields with alignas(a). Signed-off-by: Tyler Retzlaff --- lib/ethdev/rte_ethdev.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h index 21e3a21..f7ce047 100644 --- a/lib/ethdev/rte_ethdev.h +++ b/lib/ethdev/rte_ethdev.h @@ -333,12 +333,12 @@ struct rte_eth_stats { * A structure used to retrieve link-level information of an Ethernet port. */ __extension__ -struct rte_eth_link { +struct __rte_aligned(8) rte_eth_link { uint32_t link_speed; /**< RTE_ETH_SPEED_NUM_ */ uint16_t link_duplex : 1; /**< RTE_ETH_LINK_[HALF/FULL]_DUPLEX */ uint16_t link_autoneg : 1; /**< RTE_ETH_LINK_[AUTONEG/FIXED] */ uint16_t link_status : 1; /**< RTE_ETH_LINK_[DOWN/UP] */ -} __rte_aligned(8); /**< aligned for atomic64 read/write */ +}; /**< aligned for atomic64 read/write */ /**@{@name Link negotiation * Constants used in link management. From patchwork Wed Feb 14 04:17:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 136701 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 893EC43B1F; Wed, 14 Feb 2024 05:18:44 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7BD5442F76; Wed, 14 Feb 2024 05:18:05 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 75AB542F0C for ; Wed, 14 Feb 2024 05:17:53 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 3A26520B200A; Tue, 13 Feb 2024 20:17:51 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 3A26520B200A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1707884272; bh=qMsVWtEZzE8Y9ASDmYmK1l6RnXLi76f8dnyF+d2Jxp4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ca46BSB+zn+HHHmrJA9XPuPCDP9Toflb4fA4C54Z7T0mRRy6DCYM2MrTPTs1f67dg VzOS7ElvxQbRpj5M6J8qfaYMvSGiijRAwWJ6r35aspSfwgJfhZ6tzozDgm+UgWeych gTKp9mFVq1tAuaoglDwRm0X2Hvz0pwbHfuVL3sBQ= From: Tyler Retzlaff To: dev@dpdk.org Cc: Andrew Rybchenko , Bruce Richardson , Chengwen Feng , Cristian Dumitrescu , David Christensen , David Hunt , Ferruh Yigit , Honnappa Nagarahalli , Jasvinder Singh , Jerin Jacob , Kevin Laatz , Konstantin Ananyev , Min Zhou , Ruifeng Wang , Sameh Gobriel , Stanislaw Kardach , Thomas Monjalon , Vladimir Medvedkin , Yipeng Wang , Tyler Retzlaff Subject: [PATCH v2 11/14] dmadev: use C11 alignas Date: Tue, 13 Feb 2024 20:17:47 -0800 Message-Id: <1707884270-27189-12-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1707884270-27189-1-git-send-email-roretzla@linux.microsoft.com> References: <1707873986-29352-1-git-send-email-roretzla@linux.microsoft.com> <1707884270-27189-1-git-send-email-roretzla@linux.microsoft.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org * Move __rte_aligned from the end of {struct,union} definitions to be between {struct,union} and tag. The placement between {struct,union} and the tag allows the desired alignment to be imparted on the type regardless of the toolchain being used for all of GCC, LLVM, MSVC compilers building both C and C++. * Replace use of __rte_aligned(a) on variables/fields with alignas(a). Signed-off-by: Tyler Retzlaff Acked-by: Chengwen Feng --- lib/dmadev/rte_dmadev_core.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/dmadev/rte_dmadev_core.h b/lib/dmadev/rte_dmadev_core.h index 0647856..1ba2c1f 100644 --- a/lib/dmadev/rte_dmadev_core.h +++ b/lib/dmadev/rte_dmadev_core.h @@ -61,7 +61,7 @@ typedef uint16_t (*rte_dma_completed_status_t)(void *dev_private, * The 'dev_private' field was placed in the first cache line to optimize * performance because the PMD mainly depends on this field. */ -struct rte_dma_fp_object { +struct __rte_aligned(128) rte_dma_fp_object { /** PMD-specific private data. The driver should copy * rte_dma_dev.data->dev_private to this field during initialization. */ @@ -73,7 +73,7 @@ struct rte_dma_fp_object { rte_dma_completed_t completed; rte_dma_completed_status_t completed_status; rte_dma_burst_capacity_t burst_capacity; -} __rte_aligned(128); +}; extern struct rte_dma_fp_object *rte_dma_fp_objs; From patchwork Wed Feb 14 04:17:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 136697 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 4C5DE43B1F; Wed, 14 Feb 2024 05:18:22 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C8E9042F4B; Wed, 14 Feb 2024 05:18:00 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 754E442F08 for ; Wed, 14 Feb 2024 05:17:53 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 480F820B200B; Tue, 13 Feb 2024 20:17:51 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 480F820B200B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1707884272; bh=djgLpYsBL6vSJ5grJQVyQiEwck8l8Dtm50DjyuWb/08=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WOfPnR4og+JO6uRQLAUQ/F0cTWcAyLPA0qQvqI73UXortooncDd6veEN1fyv3R9qW xHzH2wl5OR+XrEUcj+yTV8Fv8Rdhnj0t8NTqpJwgRyZutpPmyTE2N6RqXiqXJ6kTbQ vN4msAjY9tDP85dgJcO8eAfb5/hNYjKE+yIbCrgU= From: Tyler Retzlaff To: dev@dpdk.org Cc: Andrew Rybchenko , Bruce Richardson , Chengwen Feng , Cristian Dumitrescu , David Christensen , David Hunt , Ferruh Yigit , Honnappa Nagarahalli , Jasvinder Singh , Jerin Jacob , Kevin Laatz , Konstantin Ananyev , Min Zhou , Ruifeng Wang , Sameh Gobriel , Stanislaw Kardach , Thomas Monjalon , Vladimir Medvedkin , Yipeng Wang , Tyler Retzlaff Subject: [PATCH v2 12/14] distributor: use C11 alignas Date: Tue, 13 Feb 2024 20:17:48 -0800 Message-Id: <1707884270-27189-13-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1707884270-27189-1-git-send-email-roretzla@linux.microsoft.com> References: <1707873986-29352-1-git-send-email-roretzla@linux.microsoft.com> <1707884270-27189-1-git-send-email-roretzla@linux.microsoft.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org * Move __rte_aligned from the end of {struct,union} definitions to be between {struct,union} and tag. The placement between {struct,union} and the tag allows the desired alignment to be imparted on the type regardless of the toolchain being used for all of GCC, LLVM, MSVC compilers building both C and C++. * Replace use of __rte_aligned(a) on variables/fields with alignas(a). Signed-off-by: Tyler Retzlaff --- lib/distributor/rte_distributor.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/distributor/rte_distributor.c b/lib/distributor/rte_distributor.c index 2ecb95c..826640a 100644 --- a/lib/distributor/rte_distributor.c +++ b/lib/distributor/rte_distributor.c @@ -2,6 +2,7 @@ * Copyright(c) 2017 Intel Corporation */ +#include #include #include #include @@ -477,7 +478,7 @@ return 0; while (next_idx < num_mbufs) { - uint16_t matches[RTE_DIST_BURST_SIZE] __rte_aligned(128); + alignas(128) uint16_t matches[RTE_DIST_BURST_SIZE]; unsigned int pkts; if ((num_mbufs - next_idx) < RTE_DIST_BURST_SIZE) From patchwork Wed Feb 14 04:17:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 136706 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 36EC843B1F; Wed, 14 Feb 2024 05:19:11 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8702C42FA1; Wed, 14 Feb 2024 05:18:11 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id C03D442F25 for ; Wed, 14 Feb 2024 05:17:53 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 570B120B200C; Tue, 13 Feb 2024 20:17:51 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 570B120B200C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1707884272; bh=gluwpaUukjGHcv0B5ZlcKGiyvva/tWuRDiCoKaLB+E8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Td4DRILSih57TKhSlpXtY/dqP5e5NoKwysfu0x5lpTgH7LmrlSUT49VnxyjKnyTNl ddD96lU/u1nUAkif4D36I5COKKiYIBBqCnPN9LDjye4vcg506IFYeh5VrCETGUiVbk 7Oi88zWXp2Og18cHe9Qv05VqI/hc6jN/zBsw5Y5c= From: Tyler Retzlaff To: dev@dpdk.org Cc: Andrew Rybchenko , Bruce Richardson , Chengwen Feng , Cristian Dumitrescu , David Christensen , David Hunt , Ferruh Yigit , Honnappa Nagarahalli , Jasvinder Singh , Jerin Jacob , Kevin Laatz , Konstantin Ananyev , Min Zhou , Ruifeng Wang , Sameh Gobriel , Stanislaw Kardach , Thomas Monjalon , Vladimir Medvedkin , Yipeng Wang , Tyler Retzlaff Subject: [PATCH v2 13/14] acl: use C11 alignas Date: Tue, 13 Feb 2024 20:17:49 -0800 Message-Id: <1707884270-27189-14-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1707884270-27189-1-git-send-email-roretzla@linux.microsoft.com> References: <1707873986-29352-1-git-send-email-roretzla@linux.microsoft.com> <1707884270-27189-1-git-send-email-roretzla@linux.microsoft.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org * Move __rte_aligned from the end of {struct,union} definitions to be between {struct,union} and tag. The placement between {struct,union} and the tag allows the desired alignment to be imparted on the type regardless of the toolchain being used for all of GCC, LLVM, MSVC compilers building both C and C++. * Replace use of __rte_aligned(a) on variables/fields with alignas(a). Signed-off-by: Tyler Retzlaff --- lib/acl/acl_run.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/acl/acl_run.h b/lib/acl/acl_run.h index 7d215de..7f09241 100644 --- a/lib/acl/acl_run.h +++ b/lib/acl/acl_run.h @@ -55,12 +55,12 @@ struct acl_flow_data { * Structure to maintain running results for * a single packet (up to 4 tries). */ -struct completion { +struct __rte_aligned(XMM_SIZE) completion { uint32_t *results; /* running results. */ int32_t priority[RTE_ACL_MAX_CATEGORIES]; /* running priorities. */ uint32_t count; /* num of remaining tries */ /* true for allocated struct */ -} __rte_aligned(XMM_SIZE); +}; /* * One parms structure for each slot in the search engine. From patchwork Wed Feb 14 04:17:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 136703 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 1AC3743B1F; Wed, 14 Feb 2024 05:18:55 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D71C542F83; Wed, 14 Feb 2024 05:18:07 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 902DD42F21 for ; Wed, 14 Feb 2024 05:17:53 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 66BC520B200D; Tue, 13 Feb 2024 20:17:51 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 66BC520B200D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1707884272; bh=WEgs7UDGrCCcrwdChvxjaIAIReMbnxUKKCAy727sGLc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sjPZ1yJYq1aqcML9i7/A9Han991uNLP1rk5XSY5ak3epV8bmmYarFj8C5SdPwkulK 8+d7auyvA2PBv8E/j6JwERbgmNRAoqvfQAcaZ/NR36afF4hAibsnJPEdK0JnDKgWJL 7w7UnPJqkbZ9bWCtbLvLXvUnx3MudYMC4VYVt6/k= From: Tyler Retzlaff To: dev@dpdk.org Cc: Andrew Rybchenko , Bruce Richardson , Chengwen Feng , Cristian Dumitrescu , David Christensen , David Hunt , Ferruh Yigit , Honnappa Nagarahalli , Jasvinder Singh , Jerin Jacob , Kevin Laatz , Konstantin Ananyev , Min Zhou , Ruifeng Wang , Sameh Gobriel , Stanislaw Kardach , Thomas Monjalon , Vladimir Medvedkin , Yipeng Wang , Tyler Retzlaff Subject: [PATCH v2 14/14] eal: redefine macro to be integer literal for MSVC Date: Tue, 13 Feb 2024 20:17:50 -0800 Message-Id: <1707884270-27189-15-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1707884270-27189-1-git-send-email-roretzla@linux.microsoft.com> References: <1707873986-29352-1-git-send-email-roretzla@linux.microsoft.com> <1707884270-27189-1-git-send-email-roretzla@linux.microsoft.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org MSVC __declspec(align(#)) is limited and accepts only integer literals as opposed to constant expressions. define XMM_SIZE to be 16 instead of sizeof(xmm_t) and static_assert that sizeof(xmm_t) == 16 for compatibility. Signed-off-by: Tyler Retzlaff --- lib/eal/x86/include/rte_vect.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/eal/x86/include/rte_vect.h b/lib/eal/x86/include/rte_vect.h index a1a537e..441f1a0 100644 --- a/lib/eal/x86/include/rte_vect.h +++ b/lib/eal/x86/include/rte_vect.h @@ -11,6 +11,7 @@ * RTE SSE/AVX related header. */ +#include #include #include #include @@ -33,9 +34,11 @@ typedef __m128i xmm_t; -#define XMM_SIZE (sizeof(xmm_t)) +#define XMM_SIZE 16 #define XMM_MASK (XMM_SIZE - 1) +static_assert(sizeof(xmm_t) == 16, ""); + typedef union rte_xmm { xmm_t x; uint8_t u8[XMM_SIZE / sizeof(uint8_t)];