From patchwork Wed Feb 14 07:06:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 136728 X-Patchwork-Delegate: david.marchand@redhat.com 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 053EE43B27; Wed, 14 Feb 2024 08:09:25 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 688E543289; Wed, 14 Feb 2024 08:06:56 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id EADF742F83 for ; Wed, 14 Feb 2024 08:06:26 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id C0F8120B201C; Tue, 13 Feb 2024 23:06:24 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com C0F8120B201C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1707894385; bh=rsj8Kw+y/qKmKYDKhIRJWwUDSxwC6YDww7z4p/db7q4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dWETV0KaWmMurvqmTuKwjbyLQX2aMzYUuycgApwZWA2gbUIy8bQjCa+AwhQHDfN1T 9Lsmbn57ZlGm8ZthXaU6X9XcHBOgQCtAiB2NyuBj3//8TSuMpSO0fMV91ZjU1YP+Em rFgB36z41v5E6eZNzX2mPwQGnkudPyTznvmvvVL8= 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 28/39] member: use C11 alignas Date: Tue, 13 Feb 2024 23:06:11 -0800 Message-Id: <1707894382-307-29-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/member/rte_member.h | 8 ++++---- lib/member/rte_member_ht.h | 4 ++-- lib/member/rte_member_sketch.c | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/member/rte_member.h b/lib/member/rte_member.h index 3278bbb..aec192e 100644 --- a/lib/member/rte_member.h +++ b/lib/member/rte_member.h @@ -139,7 +139,7 @@ typedef void (*sketch_delete_fn_t)(const struct rte_member_setsum *ss, const void *key); /** @internal setsummary structure. */ -struct rte_member_setsum { +struct __rte_cache_aligned rte_member_setsum { enum rte_member_setsum_type type; /* Type of the set summary. */ uint32_t key_len; /* Length of key. */ uint32_t prim_hash_seed; /* Primary hash function seed. */ @@ -185,14 +185,14 @@ struct rte_member_setsum { #ifdef RTE_ARCH_X86 bool use_avx512; #endif -} __rte_cache_aligned; +}; /** * Parameters used when create the set summary table. Currently user can * specify two types of setsummary: HT based and vBF. For HT based, user can * specify cache or non-cache mode. Here is a table to describe some differences */ -struct rte_member_parameters { +struct __rte_cache_aligned rte_member_parameters { const char *name; /**< Name of the hash. */ /** @@ -326,7 +326,7 @@ struct rte_member_parameters { uint32_t extra_flag; int socket_id; /**< NUMA Socket ID for memory. */ -} __rte_cache_aligned; +}; /** * Find an existing set-summary and return a pointer to it. diff --git a/lib/member/rte_member_ht.h b/lib/member/rte_member_ht.h index 9e24ccd..c9673e3 100644 --- a/lib/member/rte_member_ht.h +++ b/lib/member/rte_member_ht.h @@ -15,10 +15,10 @@ typedef uint16_t member_sig_t; /* signature size is 16 bit */ /* The bucket struct for ht setsum */ -struct member_ht_bucket { +struct __rte_cache_aligned member_ht_bucket { member_sig_t sigs[RTE_MEMBER_BUCKET_ENTRIES]; /* 2-byte signature */ member_set_t sets[RTE_MEMBER_BUCKET_ENTRIES]; /* 2-byte set */ -} __rte_cache_aligned; +}; int rte_member_create_ht(struct rte_member_setsum *ss, diff --git a/lib/member/rte_member_sketch.c b/lib/member/rte_member_sketch.c index e006e83..15af678 100644 --- a/lib/member/rte_member_sketch.c +++ b/lib/member/rte_member_sketch.c @@ -23,7 +23,7 @@ #include "rte_member_sketch_avx512.h" #endif /* CC_AVX512_SUPPORT */ -struct sketch_runtime { +struct __rte_cache_aligned sketch_runtime { uint64_t pkt_cnt; uint32_t until_next; int converged; @@ -31,7 +31,7 @@ struct sketch_runtime { struct node *report_array; void *key_slots; struct rte_ring *free_key_slots; -} __rte_cache_aligned; +}; /* * Geometric sampling to calculate how many packets needs to be