DPDK patches and discussions
 help / color / mirror / Atom feed
From: <pbhagavatula@marvell.com>
Cc: <dev@dpdk.org>, Pavan Nikhilesh <pbhagavatula@marvell.com>
Subject: [dpdk-dev] [PATCH 3/3] bitrate: use RTE_DIM instead of ARRAY_SIZE
Date: Fri, 11 Oct 2019 09:37:08 +0530	[thread overview]
Message-ID: <20191011040709.8344-3-pbhagavatula@marvell.com> (raw)
In-Reply-To: <20191011040709.8344-1-pbhagavatula@marvell.com>

From: Pavan Nikhilesh <pbhagavatula@marvell.com>

Use RTE_DIM instead of re-defining ARRAY_SIZE.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
---
 lib/librte_bitratestats/rte_bitrate.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/lib/librte_bitratestats/rte_bitrate.c b/lib/librte_bitratestats/rte_bitrate.c
index 639e47547..d18152365 100644
--- a/lib/librte_bitratestats/rte_bitrate.c
+++ b/lib/librte_bitratestats/rte_bitrate.c
@@ -8,8 +8,6 @@
 #include <rte_metrics.h>
 #include <rte_bitrate.h>
 
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
-
 /*
  * Persistent bit-rate data.
  * @internal
@@ -50,7 +48,7 @@ rte_stats_bitrate_reg(struct rte_stats_bitrates *bitrate_data)
 	if (bitrate_data == NULL)
 		return -EINVAL;
 
-	return_value = rte_metrics_reg_names(&names[0], ARRAY_SIZE(names));
+	return_value = rte_metrics_reg_names(&names[0], RTE_DIM(names));
 	if (return_value >= 0)
 		bitrate_data->id_stats_set = return_value;
 	return return_value;
@@ -126,7 +124,7 @@ rte_stats_bitrate_calc(struct rte_stats_bitrates *bitrate_data,
 	values[4] = port_data->peak_ibits;
 	values[5] = port_data->peak_obits;
 	ret = rte_metrics_update_values(port_id, bitrate_data->id_stats_set,
-		values, ARRAY_SIZE(values));
+		values, RTE_DIM(values));
 	if (ret < 0)
 		return ret;
 
-- 
2.17.1


  parent reply	other threads:[~2019-10-11  4:07 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-11  4:07 [dpdk-dev] [PATCH 1/3] app/test: " pbhagavatula
2019-10-11  4:07 ` [dpdk-dev] [PATCH 2/3] drivers: " pbhagavatula
2019-10-11  4:37   ` Hemant Agrawal
2019-10-11  9:32     ` Ananyev, Konstantin
2019-10-11 13:48       ` Ferruh Yigit
2019-10-11  6:14   ` Andrew Rybchenko
2019-10-11  9:03     ` Igor Russkikh
2019-10-11  9:00   ` Hyong Youb Kim (hyonkim)
2019-10-11  4:07 ` pbhagavatula [this message]
2019-10-11 14:20 ` [dpdk-dev] [PATCH 1/3] app/test: " Eads, Gage
2019-10-17 12:09 ` [dpdk-dev] [PATCH v2 1/2] " pbhagavatula
2019-10-17 12:10   ` [dpdk-dev] [PATCH v2 2/2] bitrate: " pbhagavatula
2019-10-27 13:36     ` David Marchand
2019-10-27 13:35   ` [dpdk-dev] [PATCH v2 1/2] app/test: " David Marchand

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=20191011040709.8344-3-pbhagavatula@marvell.com \
    --to=pbhagavatula@marvell.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).