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 196D943B1D; Wed, 14 Feb 2024 03:09:17 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B843442E51; Wed, 14 Feb 2024 03:09:16 +0100 (CET) Received: from szxga06-in.huawei.com (szxga06-in.huawei.com [45.249.212.32]) by mails.dpdk.org (Postfix) with ESMTP id 9BD7F42DF9 for ; Wed, 14 Feb 2024 03:09:14 +0100 (CET) Received: from mail.maildlp.com (unknown [172.19.163.44]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4TZM7B52YQz1vtYR; Wed, 14 Feb 2024 10:08:38 +0800 (CST) Received: from dggpeml500024.china.huawei.com (unknown [7.185.36.10]) by mail.maildlp.com (Postfix) with ESMTPS id AAED5140414; Wed, 14 Feb 2024 10:09:09 +0800 (CST) Received: from [10.45.33.178] (10.45.33.178) by dggpeml500024.china.huawei.com (7.185.36.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Wed, 14 Feb 2024 10:09:07 +0800 Content-Type: multipart/alternative; boundary="------------0mQRBWYzySE0Da9LTF74kasH" Message-ID: <036a0e7d-9895-631f-5a8a-07bf0c86aeac@huawei.com> Date: Wed, 14 Feb 2024 10:09:08 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.2.1 Subject: Re: [PATCH 11/14] dmadev: use C11 alignas To: Tyler Retzlaff , CC: Andrew Rybchenko , Bruce Richardson , 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 References: <1707873986-29352-1-git-send-email-roretzla@linux.microsoft.com> <1707873986-29352-12-git-send-email-roretzla@linux.microsoft.com> Content-Language: en-US From: fengchengwen In-Reply-To: <1707873986-29352-12-git-send-email-roretzla@linux.microsoft.com> X-Originating-IP: [10.45.33.178] X-ClientProxiedBy: dggpeml500010.china.huawei.com (7.185.36.155) To dggpeml500024.china.huawei.com (7.185.36.10) 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 --------------0mQRBWYzySE0Da9LTF74kasH Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit Acked-by: Chengwen Feng On 2024/2/14 9:26, Tyler Retzlaff wrote: > * 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/dmadev/rte_dmadev_core.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/lib/dmadev/rte_dmadev_core.h b/lib/dmadev/rte_dmadev_core.h > index 0647856..1ba2c1f 100644 > --- a/lib/dmadev/rte_dmadev_core.h > +++ b/lib/dmadev/rte_dmadev_core.h > @@ -61,7 +61,7 @@ typedef uint16_t (*rte_dma_completed_status_t)(void *dev_private, > * The 'dev_private' field was placed in the first cache line to optimize > * performance because the PMD mainly depends on this field. > */ > -struct rte_dma_fp_object { > +struct __rte_aligned(128) rte_dma_fp_object { > /** PMD-specific private data. The driver should copy > * rte_dma_dev.data->dev_private to this field during initialization. > */ > @@ -73,7 +73,7 @@ struct rte_dma_fp_object { > rte_dma_completed_t completed; > rte_dma_completed_status_t completed_status; > rte_dma_burst_capacity_t burst_capacity; > -} __rte_aligned(128); > +}; > > extern struct rte_dma_fp_object *rte_dma_fp_objs; > --------------0mQRBWYzySE0Da9LTF74kasH Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: 7bit

Acked-by: Chengwen Feng <fengchengwen@huawei.com>

On 2024/2/14 9:26, Tyler Retzlaff wrote:
* 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 <roretzla@linux.microsoft.com>
---
 lib/dmadev/rte_dmadev_core.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/dmadev/rte_dmadev_core.h b/lib/dmadev/rte_dmadev_core.h
index 0647856..1ba2c1f 100644
--- a/lib/dmadev/rte_dmadev_core.h
+++ b/lib/dmadev/rte_dmadev_core.h
@@ -61,7 +61,7 @@ typedef uint16_t (*rte_dma_completed_status_t)(void *dev_private,
  * The 'dev_private' field was placed in the first cache line to optimize
  * performance because the PMD mainly depends on this field.
  */
-struct rte_dma_fp_object {
+struct __rte_aligned(128) rte_dma_fp_object {
 	/** PMD-specific private data. The driver should copy
 	 * rte_dma_dev.data->dev_private to this field during initialization.
 	 */
@@ -73,7 +73,7 @@ struct rte_dma_fp_object {
 	rte_dma_completed_t        completed;
 	rte_dma_completed_status_t completed_status;
 	rte_dma_burst_capacity_t   burst_capacity;
-} __rte_aligned(128);
+};
 
 extern struct rte_dma_fp_object *rte_dma_fp_objs;
 
--------------0mQRBWYzySE0Da9LTF74kasH--