From patchwork Wed Feb 14 01:26:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 136679 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 2FB9A43B21; Wed, 14 Feb 2024 02:26:36 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8C52542E56; Wed, 14 Feb 2024 02:26:32 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id F2D2A42DF9 for ; Wed, 14 Feb 2024 02:26:28 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 198F820B2001; Tue, 13 Feb 2024 17:26:28 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 198F820B2001 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1707873988; bh=hfAtSjq/K1fK0h2rxr+rCrcDr5skYGN5ajG3Dgor7io=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HNWEwxfzPedQPbRyjRFRfDgyClhVtTvirpGH2fjMvTbaN7pZGILf0e3Y5msmbPs+r WlcaRY8oipJIhwGIxKlmwJkKbz4gBPl6xhsMVlqeLrxELGpxkhXRN05Uy+kecauHL/ CcKIvklZ2SCsTTunZ/t44zvRfrxap+R8T2h3k1Ew= 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 01/14] eal: use C11 alignas Date: Tue, 13 Feb 2024 17:26:13 -0800 Message-Id: <1707873986-29352-2-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1707873986-29352-1-git-send-email-roretzla@linux.microsoft.com> References: <1707873986-29352-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 01:26:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 136680 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 B1FB143B21; Wed, 14 Feb 2024 02:26:43 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B37CD42E7E; Wed, 14 Feb 2024 02:26:33 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 41E0F42E25 for ; Wed, 14 Feb 2024 02:26:29 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 27DA120B2002; Tue, 13 Feb 2024 17:26:28 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 27DA120B2002 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1707873988; bh=it/p/VucsivXNUIW/WbXsuaq9QBswo3Gr4RXOZH8brc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jffD0JBtEDiHDqC2eZtZRG4fyq5qk1ckcB6dn6IlyxV5ZmI5wZPHxVNvocCcoCfIY 8HuAo8Vz/ilnF31Jv5OH0j08EwmV1QkmGN1c6XUHLxouylWcaf4hCiwrosfWgcthAR ZzSnpWVJR1VEyYr2TYF8AS3CgY+szddzKEp22bvY= 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 02/14] stack: use C11 alignas Date: Tue, 13 Feb 2024 17:26:14 -0800 Message-Id: <1707873986-29352-3-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1707873986-29352-1-git-send-email-roretzla@linux.microsoft.com> References: <1707873986-29352-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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/stack/rte_stack.h b/lib/stack/rte_stack.h index a379300..277fc27 100644 --- a/lib/stack/rte_stack.h +++ b/lib/stack/rte_stack.h @@ -42,7 +42,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 01:26:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 136682 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 B7E5143B21; Wed, 14 Feb 2024 02:26:58 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1A66A42ED6; Wed, 14 Feb 2024 02:26:36 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 47CC942E38 for ; Wed, 14 Feb 2024 02:26:29 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 36ECA20B2003; Tue, 13 Feb 2024 17:26:28 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 36ECA20B2003 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1707873988; bh=zhzgCAx/pNran5H/ShMDNsgSs4HAMCAvdTk+7eabmQ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TCt+PcMnvkV0kbMHe406UWyET0NBppMoozJZ16/25kFLzybTv5EVabjNu5DmXOBAK sPxVAgn5aYKbw49qwHO/53xSGZIzSchNTWztqqsqqwHmGc3yn3qOUIXU0W6qnnhJXM iIBZVxyg8ji5wwAE3HdaO7CJVeSpebqhhlApskes= 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 03/14] sched: use C11 alignas Date: Tue, 13 Feb 2024 17:26:15 -0800 Message-Id: <1707873986-29352-4-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1707873986-29352-1-git-send-email-roretzla@linux.microsoft.com> References: <1707873986-29352-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 | 2 +- lib/sched/rte_sched_common.h | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/sched/rte_sched.c b/lib/sched/rte_sched.c index d90aa53..2ce7baa 100644 --- a/lib/sched/rte_sched.c +++ b/lib/sched/rte_sched.c @@ -193,7 +193,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 01:26:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 136681 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 116C743B21; Wed, 14 Feb 2024 02:26:52 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E637242ECC; Wed, 14 Feb 2024 02:26:34 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 358DF42E1C for ; Wed, 14 Feb 2024 02:26:29 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 44F7D20B2004; Tue, 13 Feb 2024 17:26:28 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 44F7D20B2004 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1707873988; bh=56ITGK5IqE8hAllehk+pSG8e0+SqQdwsT5u3Z8tNZ4Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cHIsEU+XVxnQrNE4T6QEzfGHSYpJdPPxqmMNWx+bQ9PIoozECCbtP1KyP1zILezcG fFns8UO/ElVKLFGgAw/PHjhWUH6iC45gOwwcMOvNYQhs02qS6ujj2KnwDd+OKQFw0K LainoTYIA1e2GQOiYMVf8xR48iv0x2YHG2jBhPH8= 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 04/14] ring: remove unnecessary explicit alignment Date: Tue, 13 Feb 2024 17:26:16 -0800 Message-Id: <1707873986-29352-5-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1707873986-29352-1-git-send-email-roretzla@linux.microsoft.com> References: <1707873986-29352-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 01:26:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 136684 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 E61B843B21; Wed, 14 Feb 2024 02:27:12 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 70C2442EE5; Wed, 14 Feb 2024 02:26:38 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id C1DE340278 for ; Wed, 14 Feb 2024 02:26:29 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 52D6420B2005; Tue, 13 Feb 2024 17:26:28 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 52D6420B2005 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1707873988; bh=L1ZnXSfMFHkQ9EvVoxwPvpfe0MCNUFV9AKEjTyS4vGQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A+a28yLC3nEXfaLal5/1oU0OYlTyd3iUaDHALeAKqxt8yij+BOtFduAUK6mZLmWua kA1pjDZZWA179OdF2kZ7TYUKa34O6Zwuhok9UZvXPnUIVsgG/BX1Thnr21VNFQjguc DJ3Nzt1PLo1gLVIoD/He5lPGKg4au4WeLsPGyfO8= 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 05/14] pipeline: use C11 alignas Date: Tue, 13 Feb 2024 17:26:17 -0800 Message-Id: <1707873986-29352-6-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1707873986-29352-1-git-send-email-roretzla@linux.microsoft.com> References: <1707873986-29352-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 01:26:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 136688 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 0F12143B21; Wed, 14 Feb 2024 02:27:40 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AA4E842F08; Wed, 14 Feb 2024 02:26:42 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id EC9B142E1C for ; Wed, 14 Feb 2024 02:26:29 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 62A3A20B2006; Tue, 13 Feb 2024 17:26:28 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 62A3A20B2006 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1707873988; bh=eYB31fJ766LpIikZENtv1bPZYqsc+hPhqQGffeWV6PY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KZ/8GGOF5oj6CjFvcm0Wx3Ut0Xkbu27DCFKSgWOgfp0EGbRSdozv2Y7MDaZQ1sqLu 0JG9zhLH9+wMXTFi2WUHfQIvC/vnxzq1nA4YkCr++R4mMG1WHVqzuRj/rOFFJTK4LC Tr6xtqYoHF21yPodn5Qb4/wmvoraDbbaOb6WAs7Y= 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 06/14] net: use C11 alignas Date: Tue, 13 Feb 2024 17:26:18 -0800 Message-Id: <1707873986-29352-7-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1707873986-29352-1-git-send-email-roretzla@linux.microsoft.com> References: <1707873986-29352-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 | 12 ++++++------ lib/net/net_crc_neon.c | 10 +++++----- lib/net/net_crc_sse.c | 16 ++++++++-------- lib/net/rte_arp.h | 8 ++++---- lib/net/rte_ether.h | 8 ++++---- 5 files changed, 27 insertions(+), 27 deletions(-) diff --git a/lib/net/net_crc_avx512.c b/lib/net/net_crc_avx512.c index f6a3ce9..c65bf54 100644 --- a/lib/net/net_crc_avx512.c +++ b/lib/net/net_crc_avx512.c @@ -20,8 +20,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 +30,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 +93,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..9966d09 100644 --- a/lib/net/net_crc_neon.c +++ b/lib/net/net_crc_neon.c @@ -19,8 +19,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 +96,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 +148,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..37ac248 100644 --- a/lib/net/net_crc_sse.c +++ b/lib/net/net_crc_sse.c @@ -18,8 +18,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 +96,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 +118,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 +175,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 +212,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 01:26:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 136690 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 0BB7043B21; Wed, 14 Feb 2024 02:27:53 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AB45042F17; Wed, 14 Feb 2024 02:26:44 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 25ED142E63 for ; Wed, 14 Feb 2024 02:26:30 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 70EB420B2007; Tue, 13 Feb 2024 17:26:28 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 70EB420B2007 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1707873988; bh=49/lPPUSW7N5gZB/Z+n58VU1o+fOoZFicR1hYcHeVt4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P3/phPzoT0HMm5G7fjcivnpUizJawyYpq+WgX3ecVYn1GYVfNrH4cfrpsyCuBX1JA eMLNlodRvFaPPECg/yJnXek9+MvkyP8nDokv9kkkn4w6V7j3IQGeOASLLC8iUCJCNt amJaAF2WeXG6BvygtCX37U0lIl49ldT2OIljhM0c= 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 07/14] mbuf: remove unnecessary explicit alignment Date: Tue, 13 Feb 2024 17:26:19 -0800 Message-Id: <1707873986-29352-8-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1707873986-29352-1-git-send-email-roretzla@linux.microsoft.com> References: <1707873986-29352-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 01:26:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 136683 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 B5F4A43B21; Wed, 14 Feb 2024 02:27:05 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3D29B42EDD; Wed, 14 Feb 2024 02:26:37 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id E3AFB42DF9 for ; Wed, 14 Feb 2024 02:26:29 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 7FB9320B2008; Tue, 13 Feb 2024 17:26:28 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 7FB9320B2008 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1707873988; bh=D27G0YOytnikS6aI+nNkZxgMLQTrfV8INWTTbuwujBg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R2mDigLpSGfjxJ1+XuaGWCAOoIYD+UHoNNWQTK4NxAszVteAqBVPC5msGCrM08ItQ RQMhcLkdfje8YeCok3Lw/q2QTlfXviHtrggJidYc7XIPXdq+NdjZrg04iwzjJgtzsp GyZ/sH+dromR9CbBe5o9S9mFwHKcaFCJrgZbTCcw= 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 08/14] hash: use C11 alignas Date: Tue, 13 Feb 2024 17:26:20 -0800 Message-Id: <1707873986-29352-9-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1707873986-29352-1-git-send-email-roretzla@linux.microsoft.com> References: <1707873986-29352-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 01:26:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 136685 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 3A5DB43B21; Wed, 14 Feb 2024 02:27:19 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 98C1442EED; Wed, 14 Feb 2024 02:26:39 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 0369842E25 for ; Wed, 14 Feb 2024 02:26:30 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 8DFF820B2009; Tue, 13 Feb 2024 17:26:28 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 8DFF820B2009 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1707873988; bh=DzUNLFvzgUljzJC1lDjpuo+aktN+hcZYbm+VmhE4wTw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jSCJpC37zWgdHgAd1ESxTucN5FSGFgRGY2gW26yCk3T+ZNxnPc1oDu9w7Q1lvZkoo NubdywR+BsMjvQfbgoWyLu7eO2vmdvk2RecxaRnFSs68PWv+gijZvT8emWYXSZC8x5 a2FRwgtZg9sFwQG5Vkyz0l7RdNq+nU73Gix6dDIM= 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 09/14] eventdev: use C11 alignas Date: Tue, 13 Feb 2024 17:26:21 -0800 Message-Id: <1707873986-29352-10-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1707873986-29352-1-git-send-email-roretzla@linux.microsoft.com> References: <1707873986-29352-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 01:26:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 136692 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 2592643B21; Wed, 14 Feb 2024 02:28:06 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9925542F27; Wed, 14 Feb 2024 02:26:46 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 2E7FB42E76 for ; Wed, 14 Feb 2024 02:26:30 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 9D0E520B200A; Tue, 13 Feb 2024 17:26:28 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 9D0E520B200A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1707873988; bh=uf05fKr8e3MjtIOstPHr6rG8ICzwl3PhBVvDHMVxdDI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XlR3WF+Z51NVE0N2NgSwZ3Ru0DV88yC96aZUgGd1OH2mvcbZe2RN+//JZjvLJ+5Tm 19z2Zobfx3ifhjouon0QHfdIb9o554aUT/IdQt/18G2PE2iNh4uTS98UfuTcFjsafJ wO0T7Bf3fKz49o6K3bbVXKI2Br8Z8i+kpEoCgzOo= 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 10/14] ethdev: use C11 alignas Date: Tue, 13 Feb 2024 17:26:22 -0800 Message-Id: <1707873986-29352-11-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1707873986-29352-1-git-send-email-roretzla@linux.microsoft.com> References: <1707873986-29352-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 01:26:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 136686 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 94A4743B21; Wed, 14 Feb 2024 02:27:25 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9609542EF6; Wed, 14 Feb 2024 02:26:40 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 0AB6042E38 for ; Wed, 14 Feb 2024 02:26:30 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id AB37020B200B; Tue, 13 Feb 2024 17:26:28 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com AB37020B200B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1707873988; bh=DyOI//Fxk6rng2+OXJT9bfZYBZbc1U7xcZFKYPZbX6k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gcWx/7LAGSROatQ/520kykuMT1AhQP0oCQJevBWMX8wmaYRl8ZA73bOJfwEm1AEO8 Hp2nYjHZmtvYdzfZ19thZasi6eWZ0OJRFhaXblNlg6yj+IHy1PiXf3wzVQEai6cD9R V/lV02z9C1RUyne7tjlY78d+m8bQgok5IG68uetk= 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 11/14] dmadev: use C11 alignas Date: Tue, 13 Feb 2024 17:26:23 -0800 Message-Id: <1707873986-29352-12-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1707873986-29352-1-git-send-email-roretzla@linux.microsoft.com> References: <1707873986-29352-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 01:26:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 136687 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 36BA243B21; Wed, 14 Feb 2024 02:27:32 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B344A42F02; Wed, 14 Feb 2024 02:26:41 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 0EC8342E53 for ; Wed, 14 Feb 2024 02:26:30 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id B92FE20B200C; Tue, 13 Feb 2024 17:26:28 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com B92FE20B200C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1707873988; bh=+WaN5uCu8H8CbuX8Ek2sFHIVVMm+0ANDVG4fpwpzLN0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SZMRR5plqMb10emNfTbRMYS+jWt3b/ej/ouhfSnZravWx1UtYM1wwuTkmf47E9yqW eyf5YK7t5m/z1rKiHE97tzNTfgf0cJXORai58spd5UpySNrKR3+sYXYPdXof8SlmX3 wwlzGHfNhzU0qkQWrL5fNT2Gz6yr5gNcWk4G2Rug= 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 12/14] distributor: use C11 alignas Date: Tue, 13 Feb 2024 17:26:24 -0800 Message-Id: <1707873986-29352-13-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1707873986-29352-1-git-send-email-roretzla@linux.microsoft.com> References: <1707873986-29352-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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/distributor/rte_distributor.c b/lib/distributor/rte_distributor.c index 2ecb95c..8672a05 100644 --- a/lib/distributor/rte_distributor.c +++ b/lib/distributor/rte_distributor.c @@ -477,7 +477,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 01:26:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 136691 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 61E8743B21; Wed, 14 Feb 2024 02:27:59 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A1C6E42F21; Wed, 14 Feb 2024 02:26:45 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 4391F42E7B for ; Wed, 14 Feb 2024 02:26:30 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id C7BE220B200D; Tue, 13 Feb 2024 17:26:28 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com C7BE220B200D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1707873988; bh=gluwpaUukjGHcv0B5ZlcKGiyvva/tWuRDiCoKaLB+E8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E6T455mvEHsZx4ibjTIuL8lv8Z0n/y8zfC3xnkOO56gQDsCcUsB1njX72M7Szugjd IAybIkZAVQ1SapYaO2qc/dM0tSLUOkhaejcQiV6J4InX57XzhPHFI7puPG1Gmrd3TB dB55GPUSlqRC2yy2PyrUTvM+bjV01Ut0So5jVgHk= 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 13/14] acl: use C11 alignas Date: Tue, 13 Feb 2024 17:26:25 -0800 Message-Id: <1707873986-29352-14-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1707873986-29352-1-git-send-email-roretzla@linux.microsoft.com> References: <1707873986-29352-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 01:26:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 136689 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 CB04743B21; Wed, 14 Feb 2024 02:27:46 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AF52842F0D; Wed, 14 Feb 2024 02:26:43 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 1A52142E56 for ; Wed, 14 Feb 2024 02:26:30 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id D5E1520B200E; Tue, 13 Feb 2024 17:26:28 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com D5E1520B200E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1707873988; bh=WEgs7UDGrCCcrwdChvxjaIAIReMbnxUKKCAy727sGLc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o7whYVyFQ23HIkzZdvVsSR95Oa0i6BkuMDHMxEtehyNpl03E6YvfrgkgMaql2lv6B Fpexotk1F2ZwsK+ZSqxybeX2CLefKtw2I78C9mNfdkhssiLoYqqv/7qsIsh73ML1D2 NQlTI5weBP1kQfjpHTUnPqbT8ObvXuRsPW3ejWjs= 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 14/14] eal: redefine macro to be integer literal for MSVC Date: Tue, 13 Feb 2024 17:26:26 -0800 Message-Id: <1707873986-29352-15-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1707873986-29352-1-git-send-email-roretzla@linux.microsoft.com> References: <1707873986-29352-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)];