From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 8B440A045E for ; Sat, 1 Jun 2019 01:28:07 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 66783378B; Sat, 1 Jun 2019 01:28:07 +0200 (CEST) Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by dpdk.org (Postfix) with ESMTP id C86941C0B; Sat, 1 Jun 2019 01:28:03 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id ECF91341; Fri, 31 May 2019 16:28:02 -0700 (PDT) Received: from dp6132.austin.arm.com (dp6132.austin.arm.com [10.118.12.38]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8F7E83F59C; Fri, 31 May 2019 16:28:02 -0700 (PDT) From: Dharmik Thakkar To: Yipeng Wang , Sameh Gobriel , Bruce Richardson , Pablo de Lara Cc: dev@dpdk.org, Dharmik Thakkar , stable@dpdk.org Date: Fri, 31 May 2019 23:27:23 +0000 Message-Id: <20190531232723.2030-1-dharmik.thakkar@arm.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-stable] [PATCH] test/hash: rectify slaveid to point to valid cores X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" This patch rectifies slave_id passed to rte_eal_wait_lcore() to point to valid cores in read-write lock-free concurrency test. It also replaces a 'for' loop with RTE_LCORE_FOREACH API. Fixes: dfd9d5537e876 ("test/hash: use existing lcore API") Cc: stable@dpdk.org Signed-off-by: Dharmik Thakkar Reviewed-by: Ruifeng Wang --- app/test/test_hash_readwrite_lf.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/app/test/test_hash_readwrite_lf.c b/app/test/test_hash_readwrite_lf.c index 343a338b4ea8..af1ee9c34394 100644 --- a/app/test/test_hash_readwrite_lf.c +++ b/app/test/test_hash_readwrite_lf.c @@ -126,11 +126,9 @@ get_enabled_cores_list(void) uint32_t i = 0; uint16_t core_id; uint32_t max_cores = rte_lcore_count(); - for (core_id = 0; core_id < RTE_MAX_LCORE && i < max_cores; core_id++) { - if (rte_lcore_is_enabled(core_id)) { - enabled_core_ids[i] = core_id; - i++; - } + RTE_LCORE_FOREACH(core_id) { + enabled_core_ids[i] = core_id; + i++; } if (i != max_cores) { @@ -738,7 +736,7 @@ test_hash_add_no_ks_lookup_hit(struct rwc_perf *rwc_perf_results, int rwc_lf, enabled_core_ids[i]); for (i = 1; i <= rwc_core_cnt[n]; i++) - if (rte_eal_wait_lcore(i) < 0) + if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0) goto err; unsigned long long cycles_per_lookup = @@ -810,7 +808,7 @@ test_hash_add_no_ks_lookup_miss(struct rwc_perf *rwc_perf_results, int rwc_lf, if (ret < 0) goto err; for (i = 1; i <= rwc_core_cnt[n]; i++) - if (rte_eal_wait_lcore(i) < 0) + if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0) goto err; unsigned long long cycles_per_lookup = @@ -886,7 +884,7 @@ test_hash_add_ks_lookup_hit_non_sp(struct rwc_perf *rwc_perf_results, if (ret < 0) goto err; for (i = 1; i <= rwc_core_cnt[n]; i++) - if (rte_eal_wait_lcore(i) < 0) + if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0) goto err; unsigned long long cycles_per_lookup = @@ -962,7 +960,7 @@ test_hash_add_ks_lookup_hit_sp(struct rwc_perf *rwc_perf_results, int rwc_lf, if (ret < 0) goto err; for (i = 1; i <= rwc_core_cnt[n]; i++) - if (rte_eal_wait_lcore(i) < 0) + if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0) goto err; unsigned long long cycles_per_lookup = @@ -1037,7 +1035,7 @@ test_hash_add_ks_lookup_miss(struct rwc_perf *rwc_perf_results, int rwc_lf, int if (ret < 0) goto err; for (i = 1; i <= rwc_core_cnt[n]; i++) - if (rte_eal_wait_lcore(i) < 0) + if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0) goto err; unsigned long long cycles_per_lookup = @@ -1132,12 +1130,12 @@ test_hash_multi_add_lookup(struct rwc_perf *rwc_perf_results, int rwc_lf, for (i = rwc_core_cnt[n] + 1; i <= rwc_core_cnt[m] + rwc_core_cnt[n]; i++) - rte_eal_wait_lcore(i); + rte_eal_wait_lcore(enabled_core_ids[i]); writer_done = 1; for (i = 1; i <= rwc_core_cnt[n]; i++) - if (rte_eal_wait_lcore(i) < 0) + if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0) goto err; unsigned long long cycles_per_lookup = @@ -1221,7 +1219,7 @@ test_hash_add_ks_lookup_hit_extbkt(struct rwc_perf *rwc_perf_results, writer_done = 1; for (i = 1; i <= rwc_core_cnt[n]; i++) - if (rte_eal_wait_lcore(i) < 0) + if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0) goto err; unsigned long long cycles_per_lookup = -- 2.17.1