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 98F5B43E7E; Mon, 15 Apr 2024 22:10:52 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 88B8942DCE; Mon, 15 Apr 2024 22:06:01 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id A8CE140A89 for ; Mon, 15 Apr 2024 22:05:01 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 4EE2920FD885; Mon, 15 Apr 2024 13:04:48 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 4EE2920FD885 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1713211490; bh=ha9PywKozh1sS7G6MH5GHp07OpeKuPLQFPSClslUu4M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XjvJzVxAkNTy6TYDRjtq+iaDy5KFbACDjhrPQAXMGsr+vxBuZhn5qiMICQkFDyv/C OEFmYjzdR5TL60YdhRVEPRD7dEOFfCGW0Mma8k5YavnWzN9VhxAo3HOjM6fZm4962+ JJZUf0T413ZxB4mlANSG9eM/34QnlVSeBwaqYAmQ= From: Tyler Retzlaff To: dev@dpdk.org Cc: =?UTF-8?q?Mattias=20R=C3=B6nnblom?= , "Min Hu (Connor)" , =?UTF-8?q?Morten=20Br=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 76/83] app/test: move alignment attribute on types Date: Mon, 15 Apr 2024 13:04:38 -0700 Message-Id: <1713211485-9021-77-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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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/test_cryptodev_aead_test_vectors.h | 6 +++--- app/test/test_cryptodev_blockcipher.h | 2 +- app/test/test_cryptodev_kasumi_test_vectors.h | 2 +- app/test/test_cryptodev_mixed_test_vectors.h | 2 +- app/test/test_cryptodev_security_docsis_test_vectors.h | 2 +- app/test/test_cryptodev_snow3g_test_vectors.h | 2 +- app/test/test_cryptodev_zuc_test_vectors.h | 2 +- app/test/test_distributor.c | 12 ++++++------ app/test/test_distributor_perf.c | 6 +++--- app/test/test_mempool_perf.c | 6 +++--- app/test/test_pmd_perf.c | 4 ++-- app/test/test_ring_stress_impl.h | 10 +++++----- app/test/test_rwlock.c | 8 ++++---- app/test/test_seqlock.c | 8 ++++---- app/test/test_ticketlock.c | 4 ++-- app/test/test_trace_perf.c | 8 ++++---- 16 files changed, 42 insertions(+), 42 deletions(-) diff --git a/app/test/test_cryptodev_aead_test_vectors.h b/app/test/test_cryptodev_aead_test_vectors.h index 35ae64c..e9b0590 100644 --- a/app/test/test_cryptodev_aead_test_vectors.h +++ b/app/test/test_cryptodev_aead_test_vectors.h @@ -47,7 +47,7 @@ struct aead_test_data { } key; struct { - uint8_t data[64] __rte_aligned(16); + alignas(16) uint8_t data[64]; unsigned len; } iv; @@ -79,7 +79,7 @@ struct gmac_test_data { } key; struct { - uint8_t data[64] __rte_aligned(16); + alignas(16) uint8_t data[64]; unsigned len; } iv; @@ -2025,7 +2025,7 @@ struct cryptodev_perf_test_data { } key; struct { - uint8_t data[64] __rte_aligned(16); + alignas(16) uint8_t data[64]; unsigned len; } iv; diff --git a/app/test/test_cryptodev_blockcipher.h b/app/test/test_cryptodev_blockcipher.h index e6f6c18..a73bee0 100644 --- a/app/test/test_cryptodev_blockcipher.h +++ b/app/test/test_cryptodev_blockcipher.h @@ -72,7 +72,7 @@ struct blockcipher_test_data { } cipher_key; struct { - uint8_t data[64] __rte_aligned(16); + alignas(16) uint8_t data[64]; unsigned int len; } iv; diff --git a/app/test/test_cryptodev_kasumi_test_vectors.h b/app/test/test_cryptodev_kasumi_test_vectors.h index f0a6d55..3b51704 100644 --- a/app/test/test_cryptodev_kasumi_test_vectors.h +++ b/app/test/test_cryptodev_kasumi_test_vectors.h @@ -12,7 +12,7 @@ struct kasumi_test_data { } key; struct { - uint8_t data[64] __rte_aligned(16); + alignas(16) uint8_t data[64]; unsigned int len; } cipher_iv; diff --git a/app/test/test_cryptodev_mixed_test_vectors.h b/app/test/test_cryptodev_mixed_test_vectors.h index 9c43131..25c4a48 100644 --- a/app/test/test_cryptodev_mixed_test_vectors.h +++ b/app/test/test_cryptodev_mixed_test_vectors.h @@ -32,7 +32,7 @@ struct mixed_cipher_auth_test_data { } cipher_key; struct { - uint8_t data[64] __rte_aligned(16); + alignas(16) uint8_t data[64]; unsigned int len; /* length must be in Bytes */ } cipher_iv; diff --git a/app/test/test_cryptodev_security_docsis_test_vectors.h b/app/test/test_cryptodev_security_docsis_test_vectors.h index aa7f56a..7e9909b 100644 --- a/app/test/test_cryptodev_security_docsis_test_vectors.h +++ b/app/test/test_cryptodev_security_docsis_test_vectors.h @@ -21,7 +21,7 @@ struct docsis_test_data { } key; struct { - uint8_t data[16] __rte_aligned(16); + alignas(16) uint8_t data[16]; unsigned int len; } iv; diff --git a/app/test/test_cryptodev_snow3g_test_vectors.h b/app/test/test_cryptodev_snow3g_test_vectors.h index 3b7e442..10db4f6 100644 --- a/app/test/test_cryptodev_snow3g_test_vectors.h +++ b/app/test/test_cryptodev_snow3g_test_vectors.h @@ -12,7 +12,7 @@ struct snow3g_test_data { } key; struct { - uint8_t data[64] __rte_aligned(16); + alignas(16) uint8_t data[64]; unsigned len; } cipher_iv; diff --git a/app/test/test_cryptodev_zuc_test_vectors.h b/app/test/test_cryptodev_zuc_test_vectors.h index cb1b51e..714d681 100644 --- a/app/test/test_cryptodev_zuc_test_vectors.h +++ b/app/test/test_cryptodev_zuc_test_vectors.h @@ -12,7 +12,7 @@ struct wireless_test_data { } key; struct { - uint8_t data[64] __rte_aligned(16); + alignas(16) uint8_t data[64]; unsigned len; } cipher_iv; diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c index d2037b7..13357b9 100644 --- a/app/test/test_distributor.c +++ b/app/test/test_distributor.c @@ -53,9 +53,9 @@ struct worker_params { static volatile unsigned worker_idx; static volatile unsigned zero_idx; -struct worker_stats { +struct __rte_cache_aligned worker_stats { volatile unsigned handled_packets; -} __rte_cache_aligned; +}; struct worker_stats worker_stats[RTE_MAX_LCORE]; /* returns the total count of the number of packets handled by the worker @@ -87,7 +87,7 @@ struct worker_stats { static int handle_work(void *arg) { - struct rte_mbuf *buf[8] __rte_cache_aligned; + alignas(RTE_CACHE_LINE_SIZE) struct rte_mbuf *buf[8]; struct worker_params *wp = arg; struct rte_distributor *db = wp->dist; unsigned int num; @@ -306,7 +306,7 @@ struct worker_stats { static int handle_work_with_free_mbufs(void *arg) { - struct rte_mbuf *buf[8] __rte_cache_aligned; + alignas(RTE_CACHE_LINE_SIZE) struct rte_mbuf *buf[8]; struct worker_params *wp = arg; struct rte_distributor *d = wp->dist; unsigned int i; @@ -375,7 +375,7 @@ struct worker_stats { static int handle_work_for_shutdown_test(void *arg) { - struct rte_mbuf *buf[8] __rte_cache_aligned; + alignas(RTE_CACHE_LINE_SIZE) struct rte_mbuf *buf[8]; struct worker_params *wp = arg; struct rte_distributor *d = wp->dist; unsigned int num; @@ -592,7 +592,7 @@ struct worker_stats { static int handle_and_mark_work(void *arg) { - struct rte_mbuf *buf[8] __rte_cache_aligned; + alignas(RTE_CACHE_LINE_SIZE) struct rte_mbuf *buf[8]; struct worker_params *wp = arg; struct rte_distributor *db = wp->dist; unsigned int num, i; diff --git a/app/test/test_distributor_perf.c b/app/test/test_distributor_perf.c index ca86845..c0ad39d 100644 --- a/app/test/test_distributor_perf.c +++ b/app/test/test_distributor_perf.c @@ -33,9 +33,9 @@ static volatile int quit; static volatile unsigned worker_idx; -struct worker_stats { +struct __rte_cache_aligned worker_stats { volatile unsigned handled_packets; -} __rte_cache_aligned; +}; static struct worker_stats worker_stats[RTE_MAX_LCORE]; /* @@ -122,7 +122,7 @@ struct worker_stats { unsigned int num = 0; int i; unsigned int id = __atomic_fetch_add(&worker_idx, 1, __ATOMIC_RELAXED); - struct rte_mbuf *buf[8] __rte_cache_aligned; + alignas(RTE_CACHE_LINE_SIZE) struct rte_mbuf *buf[8]; for (i = 0; i < 8; i++) buf[i] = NULL; diff --git a/app/test/test_mempool_perf.c b/app/test/test_mempool_perf.c index 96de347..a42a772 100644 --- a/app/test/test_mempool_perf.c +++ b/app/test/test_mempool_perf.c @@ -101,9 +101,9 @@ static int use_constant_values; /* number of enqueues / dequeues */ -struct mempool_test_stats { +struct __rte_cache_aligned mempool_test_stats { uint64_t enq_count; -} __rte_cache_aligned; +}; static struct mempool_test_stats stats[RTE_MAX_LCORE]; @@ -124,7 +124,7 @@ struct mempool_test_stats { test_loop(struct rte_mempool *mp, struct rte_mempool_cache *cache, unsigned int x_keep, unsigned int x_get_bulk, unsigned int x_put_bulk) { - void *obj_table[MAX_KEEP] __rte_cache_aligned; + alignas(RTE_CACHE_LINE_SIZE) void *obj_table[MAX_KEEP]; unsigned int idx; unsigned int i; int ret; diff --git a/app/test/test_pmd_perf.c b/app/test/test_pmd_perf.c index f6d97f2..35fa068 100644 --- a/app/test/test_pmd_perf.c +++ b/app/test/test_pmd_perf.c @@ -94,12 +94,12 @@ enum { LCORE_USED, }; -struct lcore_conf { +struct __rte_cache_aligned lcore_conf { uint8_t status; uint8_t socketid; uint16_t nb_ports; uint16_t portlist[RTE_MAX_ETHPORTS]; -} __rte_cache_aligned; +}; struct lcore_conf lcore_conf[RTE_MAX_LCORE]; diff --git a/app/test/test_ring_stress_impl.h b/app/test/test_ring_stress_impl.h index 2dec897..202d47d 100644 --- a/app/test/test_ring_stress_impl.h +++ b/app/test/test_ring_stress_impl.h @@ -24,7 +24,7 @@ enum { WRK_CMD_RUN, }; -static uint32_t wrk_cmd __rte_cache_aligned = WRK_CMD_STOP; +static alignas(RTE_CACHE_LINE_SIZE) uint32_t wrk_cmd = WRK_CMD_STOP; /* test run-time in seconds */ static const uint32_t run_time = 60; @@ -41,14 +41,14 @@ struct lcore_stat { } op; }; -struct lcore_arg { +struct __rte_cache_aligned lcore_arg { struct rte_ring *rng; struct lcore_stat stats; -} __rte_cache_aligned; +}; -struct ring_elem { +struct __rte_cache_aligned ring_elem { uint32_t cnt[RTE_CACHE_LINE_SIZE / sizeof(uint32_t)]; -} __rte_cache_aligned; +}; /* * redefinable functions diff --git a/app/test/test_rwlock.c b/app/test/test_rwlock.c index 5079895..e8767da 100644 --- a/app/test/test_rwlock.c +++ b/app/test/test_rwlock.c @@ -42,7 +42,7 @@ enum { LC_TYPE_WRLOCK, }; -static struct { +static alignas(RTE_CACHE_LINE_SIZE) struct { rte_rwlock_t lock; uint64_t tick; @@ -50,9 +50,9 @@ enum { uint8_t u8[RTE_CACHE_LINE_SIZE]; uint64_t u64[RTE_CACHE_LINE_SIZE / sizeof(uint64_t)]; } data; -} __rte_cache_aligned try_rwlock_data; +} try_rwlock_data; -struct try_rwlock_lcore { +struct __rte_cache_aligned try_rwlock_lcore { int32_t rc; int32_t type; struct { @@ -60,7 +60,7 @@ struct try_rwlock_lcore { uint64_t fail; uint64_t success; } stat; -} __rte_cache_aligned; +}; static struct try_rwlock_lcore try_lcore_data[RTE_MAX_LCORE]; diff --git a/app/test/test_seqlock.c b/app/test/test_seqlock.c index 873bd60..bab8b0f 100644 --- a/app/test/test_seqlock.c +++ b/app/test/test_seqlock.c @@ -12,13 +12,13 @@ #include "test.h" -struct data { +struct __rte_cache_aligned data { rte_seqlock_t lock; uint64_t a; - uint64_t b __rte_cache_aligned; - uint64_t c __rte_cache_aligned; -} __rte_cache_aligned; + alignas(RTE_CACHE_LINE_SIZE) uint64_t b; + alignas(RTE_CACHE_LINE_SIZE) uint64_t c; +}; struct reader { struct data *data; diff --git a/app/test/test_ticketlock.c b/app/test/test_ticketlock.c index 1fbbedb..7a6cb4c 100644 --- a/app/test/test_ticketlock.c +++ b/app/test/test_ticketlock.c @@ -95,8 +95,8 @@ } static rte_ticketlock_t lk = RTE_TICKETLOCK_INITIALIZER; -static uint64_t lcount __rte_cache_aligned; -static uint64_t lcore_count[RTE_MAX_LCORE] __rte_cache_aligned; +static alignas(RTE_CACHE_LINE_SIZE) uint64_t lcount; +static alignas(RTE_CACHE_LINE_SIZE) uint64_t lcore_count[RTE_MAX_LCORE]; static uint64_t time_cost[RTE_MAX_LCORE]; #define MAX_LOOP 10000 diff --git a/app/test/test_trace_perf.c b/app/test/test_trace_perf.c index a6dd075..8257cc0 100644 --- a/app/test/test_trace_perf.c +++ b/app/test/test_trace_perf.c @@ -14,17 +14,17 @@ struct test_data; -struct lcore_data { +struct __rte_cache_aligned lcore_data { volatile bool done; volatile bool started; uint64_t total_cycles; uint64_t total_calls; -} __rte_cache_aligned; +}; -struct test_data { +struct __rte_cache_aligned test_data { unsigned int nb_workers; struct lcore_data ldata[]; -} __rte_cache_aligned; +}; #define STEP 100 #define CENT_OPS(OP) do { \ -- 1.8.3.1