From patchwork Mon Apr 15 20:04:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 139350 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 B1D0343E7E; Mon, 15 Apr 2024 22:11:12 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 60CA740DF5; Mon, 15 Apr 2024 22:06:05 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 9801140C35 for ; Mon, 15 Apr 2024 22:05:02 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 8863820FD896; Mon, 15 Apr 2024 13:04:48 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 8863820FD896 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1713211490; bh=oeLNh4oPizN4MSMDQMUbKr1A92nden66/3a+d2szccY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b7alsULgjYppMToS3OfdMLPACJ/v+13yRMP/kLAnWOF6ZTDtQ3gUr02IiTWpxjDpU 5Zhm1oubN71onOFW4R5sOLAYcf+I02eZtBKeH8Vo3sfDIQZeFtJ0xjJ4DpB6e86Byd jHuxBL96fUxFJGYqOnqBOrg8IUaKdhz+Ro2dUXjA= From: Tyler Retzlaff To: dev@dpdk.org Cc: =?utf-8?q?Mattias_R=C3=B6nnblom?= , "Min Hu (Connor)" , =?utf-8?q?Morten_Br=C3=B8rup?= , Abdullah Sevincer , Ajit Khaparde , Akhil Goyal , Alok Prasad , Amit Bernstein , Anatoly Burakov , Andrew Boyer , Andrew Rybchenko , Ankur Dwivedi , Anoob Joseph , Ashish Gupta , Ashwin Sekhar T K , Bruce Richardson , Byron Marohn , Chaoyong He , Chas Williams , Chenbo Xia , Chengwen Feng , Conor Walsh , Cristian Dumitrescu , Dariusz Sosnowski , David Hunt , Devendra Singh Rawat , Ed Czeck , Evgeny Schemeilin , Fan Zhang , Gagandeep Singh , Guoyang Zhou , Harman Kalra , Harry van Haaren , Hemant Agrawal , Honnappa Nagarahalli , Hyong Youb Kim , Jakub Grajciar , Jerin Jacob , Jian Wang , Jiawen Wu , Jie Hai , Jingjing Wu , John Daley , John Miller , Joyce Kong , Kai Ji , Kevin Laatz , Kiran Kumar K , Konstantin Ananyev , Lee Daly , Liang Ma , Liron Himi , Long Li , Maciej Czekaj , Matan Azrad , Matt Peters , Maxime Coquelin , Michael Shamis , Nagadheeraj Rottela , Nicolas Chautru , Nithin Dabilpuram , Ori Kam , Pablo de Lara , Pavan Nikhilesh , Peter Mccarthy , Radu Nicolau , Rahul Lakkireddy , Rakesh Kudurumalla , Raveendra Padasalagi , Reshma Pattan , Ron Beider , Ruifeng Wang , Sachin Saxena , Selwin Sebastian , Shai Brandes , Shepard Siegel , Shijith Thotton , Sivaprasad Tummala , Somnath Kotur , Srikanth Yalavarthi , Stephen Hemminger , Steven Webster , Suanming Mou , Sunil Kumar Kori , Sunil Uttarwar , Sunila Sahu , Tejasree Kondoj , Viacheslav Ovsiienko , Vikas Gupta , Volodymyr Fialko , Wajeeh Atrash , Wisam Jaddo , Xiaoyun Wang , Yipeng Wang , Yisen Zhuang , Yuying Zhang , Zhangfei Gao , Zhirun Yan , Ziyang Xuan , Tyler Retzlaff Subject: [PATCH v2 80/83] app/test-eventdev: move alignment attribute on types Date: Mon, 15 Apr 2024 13:04:42 -0700 Message-Id: <1713211485-9021-81-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1713211485-9021-1-git-send-email-roretzla@linux.microsoft.com> References: <1710949096-5786-1-git-send-email-roretzla@linux.microsoft.com> <1713211485-9021-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 location of __rte_aligned(a) to new conventional location. The new placement between {struct,union} and the tag allows the desired alignment to be imparted on the type regardless of the toolchain being used for both C and C++. Additionally, it avoids confusion by Doxygen when generating documentation. Signed-off-by: Tyler Retzlaff Acked-by: Morten Brørup --- app/test-eventdev/test_order_common.h | 4 ++-- app/test-eventdev/test_perf_common.h | 24 ++++++++++++------------ app/test-eventdev/test_pipeline_common.h | 18 +++++++++--------- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/app/test-eventdev/test_order_common.h b/app/test-eventdev/test_order_common.h index 1507265..d4cbc5c 100644 --- a/app/test-eventdev/test_order_common.h +++ b/app/test-eventdev/test_order_common.h @@ -39,7 +39,7 @@ struct prod_data { struct test_order *t; }; -struct test_order { +struct __rte_cache_aligned test_order { /* Don't change the offset of "err". Signal handler use this memory * to terminate all lcores work. */ @@ -60,7 +60,7 @@ struct test_order { uint32_t *producer_flow_seq; uint32_t *expected_flow_seq; struct evt_options *opt; -} __rte_cache_aligned; +}; static inline void order_flow_id_copy_from_mbuf(struct test_order *t, struct rte_event *event) diff --git a/app/test-eventdev/test_perf_common.h b/app/test-eventdev/test_perf_common.h index 2b4f572..bc627de 100644 --- a/app/test-eventdev/test_perf_common.h +++ b/app/test-eventdev/test_perf_common.h @@ -31,13 +31,13 @@ struct test_perf; -struct worker_data { +struct __rte_cache_aligned worker_data { uint64_t processed_pkts; uint64_t latency; uint8_t dev_id; uint8_t port_id; struct test_perf *t; -} __rte_cache_aligned; +}; struct crypto_adptr_data { uint8_t cdev_id; @@ -51,16 +51,16 @@ struct dma_adptr_data { void **dma_op; }; -struct prod_data { +struct __rte_cache_aligned prod_data { uint8_t dev_id; uint8_t port_id; uint8_t queue_id; struct crypto_adptr_data ca; struct dma_adptr_data da; struct test_perf *t; -} __rte_cache_aligned; +}; -struct test_perf { +struct __rte_cache_aligned test_perf { /* Don't change the offset of "done". Signal handler use this memory * to terminate all lcores work. */ @@ -74,17 +74,17 @@ struct test_perf { struct prod_data prod[EVT_MAX_PORTS]; struct worker_data worker[EVT_MAX_PORTS]; struct evt_options *opt; - uint8_t sched_type_list[EVT_MAX_STAGES] __rte_cache_aligned; - struct rte_event_timer_adapter *timer_adptr[ - RTE_EVENT_TIMER_ADAPTER_NUM_MAX] __rte_cache_aligned; + alignas(RTE_CACHE_LINE_SIZE) uint8_t sched_type_list[EVT_MAX_STAGES]; + alignas(RTE_CACHE_LINE_SIZE) struct rte_event_timer_adapter *timer_adptr[ + RTE_EVENT_TIMER_ADAPTER_NUM_MAX]; struct rte_mempool *ca_op_pool; struct rte_mempool *ca_sess_pool; struct rte_mempool *ca_asym_sess_pool; struct rte_mempool *ca_vector_pool; struct rte_mempool *da_op_pool; -} __rte_cache_aligned; +}; -struct perf_elt { +struct __rte_cache_aligned perf_elt { union { struct rte_event_timer tim; struct { @@ -92,7 +92,7 @@ struct perf_elt { uint64_t timestamp; }; }; -} __rte_cache_aligned; +}; #define BURST_SIZE 16 #define MAX_PROD_ENQ_BURST_SIZE 128 @@ -111,7 +111,7 @@ struct perf_elt { const uint8_t nb_stages = t->opt->nb_stages;\ const uint8_t laststage = nb_stages - 1;\ uint8_t cnt = 0;\ - void *bufs[16] __rte_cache_aligned;\ + alignas(RTE_CACHE_LINE_SIZE) void *bufs[16];\ int const sz = RTE_DIM(bufs);\ uint8_t stage;\ struct perf_elt *pe = NULL;\ diff --git a/app/test-eventdev/test_pipeline_common.h b/app/test-eventdev/test_pipeline_common.h index 2b7f3e7..cb6375f 100644 --- a/app/test-eventdev/test_pipeline_common.h +++ b/app/test-eventdev/test_pipeline_common.h @@ -31,14 +31,14 @@ struct test_pipeline; -struct worker_data { +struct __rte_cache_aligned worker_data { uint64_t processed_pkts; uint8_t dev_id; uint8_t port_id; struct test_pipeline *t; -} __rte_cache_aligned; +}; -struct test_pipeline { +struct __rte_cache_aligned test_pipeline { /* Don't change the offset of "done". Signal handler use this memory * to terminate all lcores work. */ @@ -52,8 +52,8 @@ struct test_pipeline { struct rte_mempool *pool[RTE_MAX_ETHPORTS]; struct worker_data worker[EVT_MAX_PORTS]; struct evt_options *opt; - uint8_t sched_type_list[EVT_MAX_STAGES] __rte_cache_aligned; -} __rte_cache_aligned; + alignas(RTE_CACHE_LINE_SIZE) uint8_t sched_type_list[EVT_MAX_STAGES]; +}; #define BURST_SIZE 16 @@ -62,7 +62,7 @@ struct test_pipeline { struct test_pipeline *t = w->t; \ const uint8_t dev = w->dev_id; \ const uint8_t port = w->port_id; \ - struct rte_event ev __rte_cache_aligned + alignas(RTE_CACHE_LINE_SIZE) struct rte_event ev #define PIPELINE_WORKER_SINGLE_STAGE_BURST_INIT \ int i; \ @@ -70,7 +70,7 @@ struct test_pipeline { struct test_pipeline *t = w->t; \ const uint8_t dev = w->dev_id; \ const uint8_t port = w->port_id; \ - struct rte_event ev[BURST_SIZE + 1] __rte_cache_aligned + alignas(RTE_CACHE_LINE_SIZE) struct rte_event ev[BURST_SIZE + 1] #define PIPELINE_WORKER_MULTI_STAGE_INIT \ struct worker_data *w = arg; \ @@ -81,7 +81,7 @@ struct test_pipeline { const uint8_t last_queue = t->opt->nb_stages - 1; \ uint8_t *const sched_type_list = &t->sched_type_list[0]; \ const uint8_t nb_stages = t->opt->nb_stages + 1; \ - struct rte_event ev __rte_cache_aligned + alignas(RTE_CACHE_LINE_SIZE) struct rte_event ev #define PIPELINE_WORKER_MULTI_STAGE_BURST_INIT \ int i; \ @@ -93,7 +93,7 @@ struct test_pipeline { const uint8_t last_queue = t->opt->nb_stages - 1; \ uint8_t *const sched_type_list = &t->sched_type_list[0]; \ const uint8_t nb_stages = t->opt->nb_stages + 1; \ - struct rte_event ev[BURST_SIZE + 1] __rte_cache_aligned + alignas(RTE_CACHE_LINE_SIZE) struct rte_event ev[BURST_SIZE + 1] static __rte_always_inline void pipeline_fwd_event(struct rte_event *ev, uint8_t sched)