From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 96172A3160 for ; Fri, 11 Oct 2019 06:07:16 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 702BF1E877; Fri, 11 Oct 2019 06:07:16 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 5017823D for ; Fri, 11 Oct 2019 06:07:15 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x9B46KMu021729; Thu, 10 Oct 2019 21:07:14 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0818; bh=sA4wsG/wlk2pDmG7aybo0btvrR2BxCWzmNV3k3dZOGg=; b=G+1DcP7nGbK1u+bM1Q4JAXmAr1l4MXlzRshE2pmLuz7HdKJzevi6KSaipRyCf0nULoSU oB8xSUOIJnRBzXwQMDVdxLizj1eIG1WeTKuO708MjKxK4cB5JTVal7499shIhe30rlln zXxllkFWhk8tqxX7SBwe30qzx60NTMlQlpCIzWNOcAfpYlTvz684fa64dZg3K9oAC2JD 0U9tCX2b5/V/cGOgT5dMhjku3hA1LUvEZbuuS9K9BNbVjQb8TF9rx1/WBi4JMKhZUXHM ddEYYt+KUA183oWhN3Hp1YPDRX0/mE91VEzFUhzKxDZWH4TWcxEaEUq8xJRENKr0wfCC wQ== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0b-0016f401.pphosted.com with ESMTP id 2vhdxc0394-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 10 Oct 2019 21:07:13 -0700 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 10 Oct 2019 21:07:12 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Thu, 10 Oct 2019 21:07:12 -0700 Received: from BG-LT7430.marvell.com (unknown [10.28.17.84]) by maili.marvell.com (Postfix) with ESMTP id 5F4EC3F703F; Thu, 10 Oct 2019 21:07:10 -0700 (PDT) From: To: Declan Doherty , Gage Eads , Olivier Matz CC: , Pavan Nikhilesh Date: Fri, 11 Oct 2019 09:37:06 +0530 Message-ID: <20191011040709.8344-1-pbhagavatula@marvell.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,1.0.8 definitions=2019-10-11_02:2019-10-10,2019-10-11 signatures=0 Subject: [dpdk-dev] [PATCH 1/3] app/test: use RTE_DIM instead of ARRAY_SIZE X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Pavan Nikhilesh Use RTE_DIM instead of re-defining ARRAY_SIZE. Signed-off-by: Pavan Nikhilesh --- 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