From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id CE50643B27; Wed, 14 Feb 2024 08:10:47 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6787D43328; Wed, 14 Feb 2024 08:07:13 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id A0B8442FB9 for ; Wed, 14 Feb 2024 08:06:27 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id D254320B201D; Tue, 13 Feb 2024 23:06:24 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com D254320B201D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1707894385; bh=H8od00CMuwR3e5qGap9u5VYUeYgC53VeBOv/rawZVxY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b3S5xH9vohqLSP8ZHswLJ0RT5YqDg/F72YrD/ts7ZXoG/H/gEspYqi3TaiHuKbSo3 fivGcO6XALWy+CT/Sp4y4EyFkYXk7WIe2yhZXikv8CjJDoTNGNtIwElaTGt9hDzu5j 7BcCdQoga45n6m1Fu/Rz0+yzNdOlpl85BPa9bw6Y= 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 v3 29/39] lpm: use C11 alignas Date: Tue, 13 Feb 2024 23:06:12 -0800 Message-Id: <1707894382-307-30-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1707894382-307-1-git-send-email-roretzla@linux.microsoft.com> References: <1707873986-29352-1-git-send-email-roretzla@linux.microsoft.com> <1707894382-307-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/lpm/rte_lpm.h | 5 +++-- lib/lpm/rte_lpm6.c | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/lpm/rte_lpm.h b/lib/lpm/rte_lpm.h index f57977b..f311fd9 100644 --- a/lib/lpm/rte_lpm.h +++ b/lib/lpm/rte_lpm.h @@ -11,6 +11,7 @@ * RTE Longest Prefix Match (LPM) */ +#include #include #include @@ -118,8 +119,8 @@ struct rte_lpm_config { /** @internal LPM structure. */ struct rte_lpm { /* LPM Tables. */ - struct rte_lpm_tbl_entry tbl24[RTE_LPM_TBL24_NUM_ENTRIES] - __rte_cache_aligned; /**< LPM tbl24 table. */ + alignas(RTE_CACHE_LINE_SIZE) struct rte_lpm_tbl_entry tbl24[RTE_LPM_TBL24_NUM_ENTRIES]; + /**< LPM tbl24 table. */ struct rte_lpm_tbl_entry *tbl8; /**< LPM tbl8 table. */ }; diff --git a/lib/lpm/rte_lpm6.c b/lib/lpm/rte_lpm6.c index 271bc48..ed5970c 100644 --- a/lib/lpm/rte_lpm6.c +++ b/lib/lpm/rte_lpm6.c @@ -98,16 +98,16 @@ struct rte_lpm6 { /* LPM Tables. */ struct rte_hash *rules_tbl; /**< LPM rules. */ - struct rte_lpm6_tbl_entry tbl24[RTE_LPM6_TBL24_NUM_ENTRIES] - __rte_cache_aligned; /**< LPM tbl24 table. */ + alignas(RTE_CACHE_LINE_SIZE) struct rte_lpm6_tbl_entry tbl24[RTE_LPM6_TBL24_NUM_ENTRIES]; + /**< LPM tbl24 table. */ uint32_t *tbl8_pool; /**< pool of indexes of free tbl8s */ uint32_t tbl8_pool_pos; /**< current position in the tbl8 pool */ struct rte_lpm_tbl8_hdr *tbl8_hdrs; /* array of tbl8 headers */ - struct rte_lpm6_tbl_entry tbl8[0] - __rte_cache_aligned; /**< LPM tbl8 table. */ + alignas(RTE_CACHE_LINE_SIZE) struct rte_lpm6_tbl_entry tbl8[0]; + /**< LPM tbl8 table. */ }; /* -- 1.8.3.1