From patchwork Wed Feb 14 07:06: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: 136741 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 7E92E43B27; Wed, 14 Feb 2024 08:10:36 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 68B5343318; Wed, 14 Feb 2024 08:07:11 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 780C742FB2 for ; Wed, 14 Feb 2024 08:06:27 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 1860720B2021; Tue, 13 Feb 2024 23:06:25 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 1860720B2021 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1707894386; bh=BtPveU//G8HFK1tCYgs4Gz7pKPh2jj0/1Lnq/xV021Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ycx4UTSGVCRIXMTLeF54YUWQrJaWD7HqAkDyezC6fMUYGdEu3buWnJAMo3meV9ORo B737Ydij6eEOkVGeOLyoUufz9dvcvxdVfi2FUSR3Pb5hXz81H3F81/tyGh2SB5vpTd zRMe9J6RPJpMRzgFeWwTWmRXqSDQ5pHdeSXOADt4= 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 33/39] compressdev: use C11 alignas Date: Tue, 13 Feb 2024 23:06:16 -0800 Message-Id: <1707894382-307-34-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/compressdev/rte_comp.h | 4 ++-- lib/compressdev/rte_compressdev_internal.h | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/compressdev/rte_comp.h b/lib/compressdev/rte_comp.h index 3606ebf..830a240 100644 --- a/lib/compressdev/rte_comp.h +++ b/lib/compressdev/rte_comp.h @@ -356,7 +356,7 @@ struct rte_comp_xform { * Comp operations are enqueued and dequeued in comp PMDs using the * rte_compressdev_enqueue_burst() / rte_compressdev_dequeue_burst() APIs */ -struct rte_comp_op { +struct __rte_cache_aligned rte_comp_op { enum rte_comp_op_type op_type; union { void *private_xform; @@ -478,7 +478,7 @@ struct rte_comp_op { * will be set to RTE_COMP_OP_STATUS_SUCCESS after operation * is successfully processed by a PMD */ -} __rte_cache_aligned; +}; /** * Creates an operation pool diff --git a/lib/compressdev/rte_compressdev_internal.h b/lib/compressdev/rte_compressdev_internal.h index 01b7764..8a626d3 100644 --- a/lib/compressdev/rte_compressdev_internal.h +++ b/lib/compressdev/rte_compressdev_internal.h @@ -69,7 +69,7 @@ typedef uint16_t (*compressdev_enqueue_pkt_burst_t)(void *qp, struct rte_comp_op **ops, uint16_t nb_ops); /** The data structure associated with each comp device. */ -struct rte_compressdev { +struct __rte_cache_aligned rte_compressdev { compressdev_dequeue_pkt_burst_t dequeue_burst; /**< Pointer to PMD receive function */ compressdev_enqueue_pkt_burst_t enqueue_burst; @@ -87,7 +87,7 @@ struct rte_compressdev { __extension__ uint8_t attached : 1; /**< Flag indicating the device is attached */ -} __rte_cache_aligned; +}; /** * @@ -96,7 +96,7 @@ struct rte_compressdev { * This structure is safe to place in shared memory to be common among * different processes in a multi-process configuration. */ -struct rte_compressdev_data { +struct __rte_cache_aligned rte_compressdev_data { uint8_t dev_id; /**< Compress device identifier */ int socket_id; @@ -115,7 +115,7 @@ struct rte_compressdev_data { void *dev_private; /**< PMD-specific private data */ -} __rte_cache_aligned; +}; #ifdef __cplusplus }