From patchwork Wed Feb 14 07:06:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 136729 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 6AF2D43B27; Wed, 14 Feb 2024 08:09:30 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8C02A432A6; Wed, 14 Feb 2024 08:06:57 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id D795342F76 for ; Wed, 14 Feb 2024 08:06:26 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 31D1F20B2012; Tue, 13 Feb 2024 23:06:24 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 31D1F20B2012 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1707894385; bh=PW2rC/Y402P9iDbJjxUR8qwb9azh24dIxAb/DYGcQ3s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E+tZLa48MZ/FNy1EaqXyp9zb48MteoBzcn/XHGvU+X+GoPaX940joIshlOl71xYvw +fN2aMvPpjg2F8+I5vpniL603+1zvdUm/PXVkCOffCn9uCCzTm5cE29PNNXtU8Tdbc +d8bxqXtM2aOcE2J2+0F7sWOAgR38DCg/R+oikdk= 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 18/39] reorder: use C11 alignas Date: Tue, 13 Feb 2024 23:06:01 -0800 Message-Id: <1707894382-307-19-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/reorder/rte_reorder.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/reorder/rte_reorder.c b/lib/reorder/rte_reorder.c index ff81544..905db6c 100644 --- a/lib/reorder/rte_reorder.c +++ b/lib/reorder/rte_reorder.c @@ -36,16 +36,16 @@ int rte_reorder_seqn_dynfield_offset = -1; /* A generic circular buffer */ -struct cir_buffer { +struct __rte_cache_aligned cir_buffer { unsigned int size; /**< Number of entries that can be stored */ unsigned int mask; /**< [buffer_size - 1]: used for wrap-around */ unsigned int head; /**< insertion point in buffer */ unsigned int tail; /**< extraction point in buffer */ struct rte_mbuf **entries; -} __rte_cache_aligned; +}; /* The reorder buffer data structure itself */ -struct rte_reorder_buffer { +struct __rte_cache_aligned rte_reorder_buffer { char name[RTE_REORDER_NAMESIZE]; uint32_t min_seqn; /**< Lowest seq. number that can be in the buffer */ unsigned int memsize; /**< memory area size of reorder buffer */ @@ -53,7 +53,7 @@ struct rte_reorder_buffer { struct cir_buffer ready_buf; /**< temp buffer for dequeued entries */ struct cir_buffer order_buf; /**< buffer used to reorder entries */ -} __rte_cache_aligned; +}; static void rte_reorder_free_mbufs(struct rte_reorder_buffer *b);