DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Subject: [PATCH 4/5] examples _use RTE_DIM
Date: Tue, 16 Apr 2024 08:19:30 -0700	[thread overview]
Message-ID: <20240416152124.69590-5-stephen@networkplumber.org> (raw)
In-Reply-To: <20240416152124.69590-1-stephen@networkplumber.org>

Use RTE_DIM instead of computing directly with sizeof.
Patch automatically generated via cocci/rte_dim.cocci.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 examples/l3fwd/main.c     | 3 +--
 examples/qos_sched/init.c | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c
index 8d32ae1dd5..3960d85202 100644
--- a/examples/l3fwd/main.c
+++ b/examples/l3fwd/main.c
@@ -116,8 +116,7 @@ static struct lcore_params lcore_params_array_default[] = {
 };
 
 static struct lcore_params * lcore_params = lcore_params_array_default;
-static uint16_t nb_lcore_params = sizeof(lcore_params_array_default) /
-				sizeof(lcore_params_array_default[0]);
+static uint16_t nb_lcore_params = RTE_DIM(lcore_params_array_default);
 
 static struct rte_eth_conf port_conf = {
 	.rxmode = {
diff --git a/examples/qos_sched/init.c b/examples/qos_sched/init.c
index d8abae635a..75629e36ea 100644
--- a/examples/qos_sched/init.c
+++ b/examples/qos_sched/init.c
@@ -206,8 +206,7 @@ struct rte_sched_subport_params subport_params[MAX_SCHED_SUBPORTS] = {
 		.n_pipes_per_subport_enabled = 4096,
 		.qsize = {64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64},
 		.pipe_profiles = pipe_profiles,
-		.n_pipe_profiles = sizeof(pipe_profiles) /
-			sizeof(struct rte_sched_pipe_params),
+		.n_pipe_profiles = RTE_DIM(pipe_profiles),
 		.n_max_pipe_profiles = MAX_SCHED_PIPE_PROFILES,
 		.cman_params = NULL,
 	},
-- 
2.43.0


  parent reply	other threads:[~2024-04-16 15:22 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-16 15:19 [PATCH 0/5] use RTE_DIM where possible Stephen Hemminger
2024-04-16 15:19 ` [PATCH 1/5] cocci: add script to use RTE_DIM Stephen Hemminger
2024-04-16 15:19 ` [PATCH 2/5] app: " Stephen Hemminger
2024-04-16 15:30   ` Tyler Retzlaff
2024-04-17  6:13   ` [EXTERNAL] " Akhil Goyal
2024-04-16 15:19 ` [PATCH 3/5] lib: " Stephen Hemminger
2024-04-16 15:32   ` Tyler Retzlaff
2024-04-16 15:19 ` Stephen Hemminger [this message]
2024-04-16 15:32   ` [PATCH 4/5] examples _use RTE_DIM Tyler Retzlaff
2024-04-16 15:19 ` [PATCH 5/5] drivers/net: use RTE_DIM Stephen Hemminger
2024-04-16 16:29   ` Ferruh Yigit
2024-04-16 17:32     ` Stephen Hemminger
2024-04-17  8:00       ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240416152124.69590-5-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=cristian.dumitrescu@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).