DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 1/3] app/test: use RTE_DIM instead of ARRAY_SIZE
@ 2019-10-11  4:07 pbhagavatula
  2019-10-11  4:07 ` [dpdk-dev] [PATCH 2/3] drivers: " pbhagavatula
                   ` (3 more replies)
  0 siblings, 4 replies; 15+ messages in thread
From: pbhagavatula @ 2019-10-11  4:07 UTC (permalink / raw)
  To: Declan Doherty, Gage Eads, Olivier Matz; +Cc: dev, Pavan Nikhilesh

From: Pavan Nikhilesh <pbhagavatula@marvell.com>

Use RTE_DIM instead of re-defining ARRAY_SIZE.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
---
 app/test/test_cryptodev_asym.c |  8 ++------
 app/test/test_metrics.c        | 11 +++++------
 app/test/test_stack_perf.c     |  8 +++-----
 3 files changed, 10 insertions(+), 17 deletions(-)

diff --git a/app/test/test_cryptodev_asym.c b/app/test/test_cryptodev_asym.c
index e8177e73a..7ff631600 100644
--- a/app/test/test_cryptodev_asym.c
+++ b/app/test/test_cryptodev_asym.c
@@ -26,10 +26,6 @@
 #define TEST_NUM_BUFS 10
 #define TEST_NUM_SESSIONS 4
 
-#ifndef ARRAY_SIZE
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
-#endif
-
 #ifndef TEST_DATA_SIZE
 	#define TEST_DATA_SIZE 4096
 #endif
@@ -473,7 +469,7 @@ load_test_vectors(void)
 {
 	uint32_t i = 0, v_size = 0;
 	/* Load MODEX vector*/
-	v_size = ARRAY_SIZE(modex_test_case);
+	v_size = RTE_DIM(modex_test_case);
 	for (i = 0; i < v_size; i++) {
 		if (test_vector.size >= (TEST_VECTOR_SIZE)) {
 			RTE_LOG(DEBUG, USER1,
@@ -484,7 +480,7 @@ load_test_vectors(void)
 		test_vector.size++;
 	}
 	/* Load MODINV vector*/
-	v_size = ARRAY_SIZE(modinv_test_case);
+	v_size = RTE_DIM(modinv_test_case);
 	for (i = 0; i < v_size; i++) {
 		if (test_vector.size >= (TEST_VECTOR_SIZE)) {
 			RTE_LOG(DEBUG, USER1,
diff --git a/app/test/test_metrics.c b/app/test/test_metrics.c
index 78b3936ee..e736019ae 100644
--- a/app/test/test_metrics.c
+++ b/app/test/test_metrics.c
@@ -12,7 +12,6 @@
 
 #include "test.h"
 
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
 #define	REG_METRIC_COUNT	6
 #define	METRIC_LESSER_COUNT	3
 #define	KEY	1
@@ -106,7 +105,7 @@ test_metrics_reg_names(void)
 		};
 
 	/* Success Test: valid array and count size */
-	err = rte_metrics_reg_names(&mnames[0], ARRAY_SIZE(mnames));
+	err = rte_metrics_reg_names(&mnames[0], RTE_DIM(mnames));
 	TEST_ASSERT(err >= 0, "%s, %d", __func__, __LINE__);
 
 	return TEST_SUCCESS;
@@ -167,20 +166,20 @@ test_metrics_update_values(void)
 
 	/* Failed Test: Invalid count size */
 	err = rte_metrics_update_values(RTE_METRICS_GLOBAL,
-			 KEY, &value[0], ARRAY_SIZE(value));
+			 KEY, &value[0], RTE_DIM(value));
 	TEST_ASSERT(err < 0, "%s, %d", __func__, __LINE__);
 
 	/* Failed Test: Invalid port_id(lower value) and valid data */
-	err = rte_metrics_update_values(-2, KEY, &value[0], ARRAY_SIZE(value));
+	err = rte_metrics_update_values(-2, KEY, &value[0], RTE_DIM(value));
 	TEST_ASSERT(err == -EINVAL, "%s, %d", __func__, __LINE__);
 
 	/* Failed Test: Invalid port_id(higher value) and valid data */
-	err = rte_metrics_update_values(39, 1, &value[0], ARRAY_SIZE(value));
+	err = rte_metrics_update_values(39, 1, &value[0], RTE_DIM(value));
 	TEST_ASSERT(err == -EINVAL, "%s, %d", __func__, __LINE__);
 
 	/* Failed Test: Invalid array */
 	err = rte_metrics_update_values(RTE_METRICS_GLOBAL,
-			 KEY, NULL, ARRAY_SIZE(value));
+			 KEY, NULL, RTE_DIM(value));
 	TEST_ASSERT(err == -EINVAL, "%s, %d", __func__, __LINE__);
 
 	return TEST_SUCCESS;
diff --git a/app/test/test_stack_perf.c b/app/test/test_stack_perf.c
index 70561fecd..3ab7267b1 100644
--- a/app/test/test_stack_perf.c
+++ b/app/test/test_stack_perf.c
@@ -18,8 +18,6 @@
 #define MAX_BURST 32
 #define STACK_SIZE (RTE_MAX_LCORE * MAX_BURST)
 
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
-
 /*
  * Push/pop bulk sizes, marked volatile so they aren't treated as compile-time
  * constants.
@@ -176,7 +174,7 @@ run_on_core_pair(struct lcore_pair *cores, struct rte_stack *s,
 	struct thread_args args[2];
 	unsigned int i;
 
-	for (i = 0; i < ARRAY_SIZE(bulk_sizes); i++) {
+	for (i = 0; i < RTE_DIM(bulk_sizes); i++) {
 		rte_atomic32_set(&lcore_barrier, 2);
 
 		args[0].sz = args[1].sz = bulk_sizes[i];
@@ -205,7 +203,7 @@ run_on_n_cores(struct rte_stack *s, lcore_function_t fn, int n)
 	struct thread_args args[RTE_MAX_LCORE];
 	unsigned int i;
 
-	for (i = 0; i < ARRAY_SIZE(bulk_sizes); i++) {
+	for (i = 0; i < RTE_DIM(bulk_sizes); i++) {
 		unsigned int lcore_id;
 		int cnt = 0;
 		double avg;
@@ -280,7 +278,7 @@ test_bulk_push_pop(struct rte_stack *s)
 	void *objs[MAX_BURST];
 	unsigned int sz, i;
 
-	for (sz = 0; sz < ARRAY_SIZE(bulk_sizes); sz++) {
+	for (sz = 0; sz < RTE_DIM(bulk_sizes); sz++) {
 		uint64_t start = rte_rdtsc();
 
 		for (i = 0; i < iterations; i++) {
-- 
2.17.1


^ permalink raw reply	[flat|nested] 15+ messages in thread
* Re: [dpdk-dev] [PATCH 2/3] drivers: use RTE_DIM instead of ARRAY_SIZE
@ 2019-10-14  6:58 Pavan Nikhilesh Bhagavatula
  0 siblings, 0 replies; 15+ messages in thread
From: Pavan Nikhilesh Bhagavatula @ 2019-10-14  6:58 UTC (permalink / raw)
  To: Ferruh Yigit, Ananyev, Konstantin, Hemant Agrawal, Sachin Saxena,
	Akhil Goyal, Igor Russkikh, Pavel Belous, Ravi Kumar,
	Rasesh Mody, Shahed Shaikh, Rahul Lakkireddy, Marcin Wojtas,
	Michal Krawczyk, Guy Tzalik, Evgeny Schemeilin, Igor Chauskin,
	John Daley, Hyong Youb Kim, Wei Hu (Xavier), Min Hu (Connor),
	Yisen Zhuang, Xing, Beilei, Zhang, Qi Z, Wu, Jingjing, Lu,
	Wenzhuo, Yang, Qiming, Alejandro Lucero, Andrew Rybchenko,
	Jerin Jacob Kollanukkaran, Maciej Czekaj, Xu, Rosen, Zhang,
	Tianfei
  Cc: dev



>-----Original Message-----
>From: Ferruh Yigit <ferruh.yigit@intel.com>
>Sent: Friday, October 11, 2019 7:18 PM
>To: Ananyev, Konstantin <konstantin.ananyev@intel.com>; Hemant
>Agrawal <hemant.agrawal@nxp.com>; Pavan Nikhilesh Bhagavatula
><pbhagavatula@marvell.com>; Sachin Saxena
><sachin.saxena@nxp.com>; Akhil Goyal <akhil.goyal@nxp.com>; Igor
>Russkikh <igor.russkikh@aquantia.com>; Pavel Belous
><pavel.belous@aquantia.com>; Ravi Kumar <ravi1.kumar@amd.com>;
>Rasesh Mody <rmody@marvell.com>; Shahed Shaikh
><shshaikh@marvell.com>; Rahul Lakkireddy
><rahul.lakkireddy@chelsio.com>; Marcin Wojtas <mw@semihalf.com>;
>Michal Krawczyk <mk@semihalf.com>; Guy Tzalik
><gtzalik@amazon.com>; Evgeny Schemeilin <evgenys@amazon.com>;
>Igor Chauskin <igorch@amazon.com>; John Daley
><johndale@cisco.com>; Hyong Youb Kim <hyonkim@cisco.com>; Wei
>Hu (Xavier) <xavier.huwei@huawei.com>; Min Hu (Connor)
><humin29@huawei.com>; Yisen Zhuang <yisen.zhuang@huawei.com>;
>Xing, Beilei <beilei.xing@intel.com>; Zhang, Qi Z
><qi.z.zhang@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>; Lu,
>Wenzhuo <wenzhuo.lu@intel.com>; Yang, Qiming
><qiming.yang@intel.com>; Alejandro Lucero
><alejandro.lucero@netronome.com>; Andrew Rybchenko
><arybchenko@solarflare.com>; Jerin Jacob Kollanukkaran
><jerinj@marvell.com>; Maciej Czekaj <mczekaj@marvell.com>; Xu,
>Rosen <rosen.xu@intel.com>; Zhang, Tianfei
><tianfei.zhang@intel.com>
>Cc: dev@dpdk.org
>Subject: Re: [dpdk-dev] [PATCH 2/3] drivers: use RTE_DIM instead
>of ARRAY_SIZE
>On 10/11/2019 10:32 AM, Ananyev, Konstantin wrote:
>>
>>
>>> Hi Pavan,
>>>
>>>>
>>>> From: Pavan Nikhilesh <pbhagavatula@marvell.com>
>>>>
>>>> Use RTE_DIM instead of re-defining ARRAY_SIZE.
>>>>
>>>> Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
>>>> ---
>>>>  drivers/bus/dpaa/base/qbman/qman.c            |  6 ++--
>>>>  drivers/bus/dpaa/include/compat.h             |  5 ----
>>>>  drivers/crypto/dpaa2_sec/hw/compat.h          |  8 -----
>>>>  drivers/crypto/dpaa2_sec/hw/rta/jump_cmd.h    |  6 ++--
>>>>  drivers/crypto/dpaa2_sec/hw/rta/nfifo_cmd.h   |  2 +-
>>>>  drivers/net/atlantic/atl_hw_regs.h            |  1 -
>>>>  drivers/net/atlantic/hw_atl/hw_atl_utils.c    |  4 +--
>>>>  .../net/atlantic/hw_atl/hw_atl_utils_fw2x.c   |  2 +-
>>>>  drivers/net/axgbe/axgbe_common.h              |  3 --
>>>>  drivers/net/axgbe/axgbe_dev.c                 |  2 +-
>>>>  drivers/net/bnx2x/bnx2x.c                     |  6 ++--
>>>>  drivers/net/bnx2x/bnx2x.h                     |  6 ----
>>>>  drivers/net/bnx2x/ecore_init.h                |  8 ++---
>>>>  drivers/net/bnx2x/ecore_sp.c                  |  2 +-
>>>>  drivers/net/bnx2x/elink.c                     | 14 ++++-----
>>>>  drivers/net/bnx2x/elink.h                     |  1 -
>>>>  drivers/net/cxgbe/base/t4_hw.c                | 16 +++++-----
>>>>  drivers/net/cxgbe/base/t4vf_hw.c              |  4 +--
>>>>  drivers/net/cxgbe/cxgbe_compat.h              |  2 --
>>>>  drivers/net/cxgbe/cxgbe_flow.c                |  4 +--
>>>>  drivers/net/cxgbe/cxgbe_main.c                | 10 +++----
>>>>  drivers/net/cxgbe/sge.c                       |  2 +-
>>>>  drivers/net/ena/ena_ethdev.c                  |  8 ++---
>>>>  drivers/net/enic/base/vnic_dev.c              |  4 +--
>>>>  drivers/net/enic/base/vnic_devcmd.h           |  2 --
>>>>  drivers/net/hns3/hns3_cmd.c                   |  2 +-
>>>>  drivers/net/hns3/hns3_ethdev.h                |  2 --
>>>>  drivers/net/hns3/hns3_flow.c                  | 18 +++++------
>>>>  drivers/net/i40e/base/i40e_diag.c             |  2 +-
>>>>  drivers/net/i40e/base/i40e_osdep.h            |  2 --
>>>>  drivers/net/iavf/base/iavf_osdep.h            |  2 --
>>>>  drivers/net/ice/base/ice_fdir.c               |  2 +-
>>>>  drivers/net/ice/base/ice_flex_pipe.c          |  2 +-
>>>>  drivers/net/ice/base/ice_flow.c               |  2 +-
>>>>  drivers/net/ice/base/ice_osdep.h              |  1 -
>>>>  drivers/net/ice/base/ice_switch.c             |  2 +-
>>>>  .../net/nfp/nfpcore/nfp-common/nfp_platform.h |  4 ---
>>>>  drivers/net/nfp/nfpcore/nfp_cppcore.c         |  2 +-
>>>>  drivers/net/nfp/nfpcore/nfp_nsp.c             |  2 +-
>>>>  drivers/net/nfp/nfpcore/nfp_nsp_eth.c         |  4 +--
>>>>  drivers/net/sfc/base/ef10_ev.c                |  4 +--
>>>>  drivers/net/sfc/base/ef10_filter.c            | 12 ++++----
>>>>  drivers/net/sfc/base/ef10_mac.c               | 18 +++++------
>>>>  drivers/net/sfc/base/ef10_nic.c               |  4 +--
>>>>  drivers/net/sfc/base/ef10_nvram.c             |  6 ++--
>>>>  drivers/net/sfc/base/efx.h                    |  3 --
>>>>  drivers/net/sfc/base/efx_port.c               |  2 +-
>>>>  drivers/net/sfc/base/efx_rx.c                 |  2 +-
>>>>  drivers/net/sfc/base/siena_mac.c              |  2 +-
>>>>  drivers/net/sfc/base/siena_nic.c              | 20 ++++++-------
>>>>  drivers/net/sfc/base/siena_nvram.c            |  6 ++--
>>>>  drivers/net/thunderx/base/nicvf_hw.c          | 30 +++++++++--------
>--
>>>>  drivers/net/thunderx/base/nicvf_hw.h          |  2 --
>>>>  .../raw/ifpga/base/osdep_rte/osdep_generic.h  |  2 --
>>>>  54 files changed, 120 insertions(+), 170 deletions(-)
>>>>
>>>> diff --git a/drivers/bus/dpaa/base/qbman/qman.c
>>>> b/drivers/bus/dpaa/base/qbman/qman.c
>>>> index e43fc65ef..019be95e2 100644
>>>> --- a/drivers/bus/dpaa/base/qbman/qman.c
>>>> +++ b/drivers/bus/dpaa/base/qbman/qman.c
>>>> @@ -1956,7 +1956,7 @@ int qman_query_wq(u8
>query_dedicated, struct
>>>> qm_mcr_querywq *wq)
>>>>  		int i, array_len;
>>>>
>>>>  		wq->channel.id = be16_to_cpu(mcr-
>>querywq.channel.id);
>>>> -		array_len = ARRAY_SIZE(mcr->querywq.wq_len);
>>>> +		array_len = RTE_DIM(mcr->querywq.wq_len);
>>>
>>>  [Hemant]  some of these files are common Flibs and they are shared
>with other projects (Linux/uboot) etc. It will be more appropriate to
>>> map the ARRAY_SIZE to RTE_DIM in compat.h instead of changing
>this code inline.
>>> This way we need not to maintain diff from the common HW lib
>codes.
>>
>> +1 to this suggestion
>>
>
>What about dropping the drivers patch form this patchset but continue
>with others?

I will drop the drivers patch from this patchset and send v2 for the rest.

Pavan.

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2019-10-27 13:37 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-11  4:07 [dpdk-dev] [PATCH 1/3] app/test: use RTE_DIM instead of ARRAY_SIZE 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 ` [dpdk-dev] [PATCH 3/3] bitrate: " pbhagavatula
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
2019-10-14  6:58 [dpdk-dev] [PATCH 2/3] drivers: " Pavan Nikhilesh Bhagavatula

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).