From patchwork Wed Feb 14 16:35:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 136765 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 5AD4343B38; Wed, 14 Feb 2024 17:37:29 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5C9AC42FDB; Wed, 14 Feb 2024 17:36:23 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 2CD7C42E5A for ; Wed, 14 Feb 2024 17:36:08 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id DECC320B2012; Wed, 14 Feb 2024 08:36:06 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com DECC320B2012 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1707928566; bh=yWxccxg4FMSt0MaMFPA1mKi9pOWYGTEjjYom17+9jfw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NcEM/rofHPf4FWE3l+Mz/nhfbVVL98mL8pRCPCH8dmmm1wx4Xv6MqgvX5J36UxGnq kWEgXkdzfA+L+k38/b2I/5zTfolwO6E6M9n6K4fYg0/jbiUmvBoCB8Q5gokA+aBEFG 3EmPFcpQPN66UhJkAWMmloXtasQkcfUFEPR5Nvak= 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 v4 18/39] reorder: use C11 alignas Date: Wed, 14 Feb 2024 08:35:43 -0800 Message-Id: <1707928564-28796-19-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1707928564-28796-1-git-send-email-roretzla@linux.microsoft.com> References: <1707873986-29352-1-git-send-email-roretzla@linux.microsoft.com> <1707928564-28796-1-git-send-email-roretzla@linux.microsoft.com> MIME-Version: 1.0 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: Morten Brørup --- 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 c080b2c..ae97e1a 100644 --- a/lib/reorder/rte_reorder.c +++ b/lib/reorder/rte_reorder.c @@ -37,16 +37,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 */ @@ -54,7 +54,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);