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 C2CFEA00E6 for ; Sat, 15 Jun 2019 08:43:59 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B8D291D57F; Sat, 15 Jun 2019 08:43:21 +0200 (CEST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 30B9C1D53F; Sat, 15 Jun 2019 08:43:20 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9F4EB308213A; Sat, 15 Jun 2019 06:43:19 +0000 (UTC) Received: from dmarchan.remote.csb (unknown [10.40.205.71]) by smtp.corp.redhat.com (Postfix) with ESMTP id 29F205C1A1; Sat, 15 Jun 2019 06:43:12 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: thomas@monjalon.net, aconole@redhat.com, msantana@redhat.com, stable@dpdk.org, Honnappa Nagarahalli Date: Sat, 15 Jun 2019 08:42:23 +0200 Message-Id: <1560580950-16754-9-git-send-email-david.marchand@redhat.com> In-Reply-To: <1560580950-16754-1-git-send-email-david.marchand@redhat.com> References: <1559638792-8608-1-git-send-email-david.marchand@redhat.com> <1560580950-16754-1-git-send-email-david.marchand@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Sat, 15 Jun 2019 06:43:19 +0000 (UTC) Subject: [dpdk-dev] [PATCH v2 08/15] test/rcu: remove arbitrary limit on max core count 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" We can have up to RTE_MAX_LCORE in a dpdk application. Remove the limit on 128 cores and tests that are now always false. Fixes: b87089b0bb19 ("test/rcu: add API and functional tests") Cc: stable@dpdk.org Signed-off-by: David Marchand --- Changelog since v1: - new patch added to remove the local TEST_RCU_MAX_LCORE limit - changed some integer types to accomodate with the change --- app/test/test_rcu_qsbr.c | 133 ++++++++++++++++++------------------------ app/test/test_rcu_qsbr_perf.c | 63 +++++++------------- 2 files changed, 79 insertions(+), 117 deletions(-) diff --git a/app/test/test_rcu_qsbr.c b/app/test/test_rcu_qsbr.c index 5f0b138..97af087 100644 --- a/app/test/test_rcu_qsbr.c +++ b/app/test/test_rcu_qsbr.c @@ -26,19 +26,18 @@ /* Make sure that this has the same value as __RTE_QSBR_CNT_INIT */ #define TEST_RCU_QSBR_CNT_INIT 1 -#define TEST_RCU_MAX_LCORE 128 -uint16_t enabled_core_ids[TEST_RCU_MAX_LCORE]; +uint16_t enabled_core_ids[RTE_MAX_LCORE]; uint8_t num_cores; static uint32_t *keys; #define TOTAL_ENTRY (1024 * 8) #define COUNTER_VALUE 4096 -static uint32_t *hash_data[TEST_RCU_MAX_LCORE][TOTAL_ENTRY]; +static uint32_t *hash_data[RTE_MAX_LCORE][TOTAL_ENTRY]; static uint8_t writer_done; -static struct rte_rcu_qsbr *t[TEST_RCU_MAX_LCORE]; -struct rte_hash *h[TEST_RCU_MAX_LCORE]; -char hash_name[TEST_RCU_MAX_LCORE][8]; +static struct rte_rcu_qsbr *t[RTE_MAX_LCORE]; +struct rte_hash *h[RTE_MAX_LCORE]; +char hash_name[RTE_MAX_LCORE][8]; struct test_rcu_thread_info { /* Index in RCU array */ @@ -48,28 +47,7 @@ struct test_rcu_thread_info { /* lcore IDs registered on the RCU variable */ uint16_t r_core_ids[2]; }; -struct test_rcu_thread_info thread_info[TEST_RCU_MAX_LCORE/4]; - -static inline int -get_enabled_cores_mask(void) -{ - uint16_t core_id; - uint32_t max_cores = rte_lcore_count(); - - if (max_cores > TEST_RCU_MAX_LCORE) { - printf("Number of cores exceed %d\n", TEST_RCU_MAX_LCORE); - return -1; - } - - core_id = 0; - num_cores = 0; - RTE_LCORE_FOREACH_SLAVE(core_id) { - enabled_core_ids[num_cores] = core_id; - num_cores++; - } - - return 0; -} +struct test_rcu_thread_info thread_info[RTE_MAX_LCORE/4]; static int alloc_rcu(void) @@ -77,9 +55,9 @@ struct test_rcu_thread_info { int i; uint32_t sz; - sz = rte_rcu_qsbr_get_memsize(TEST_RCU_MAX_LCORE); + sz = rte_rcu_qsbr_get_memsize(RTE_MAX_LCORE); - for (i = 0; i < TEST_RCU_MAX_LCORE; i++) + for (i = 0; i < RTE_MAX_LCORE; i++) t[i] = (struct rte_rcu_qsbr *)rte_zmalloc(NULL, sz, RTE_CACHE_LINE_SIZE); @@ -91,7 +69,7 @@ struct test_rcu_thread_info { { int i; - for (i = 0; i < TEST_RCU_MAX_LCORE; i++) + for (i = 0; i < RTE_MAX_LCORE; i++) rte_free(t[i]); return 0; @@ -111,7 +89,7 @@ struct test_rcu_thread_info { sz = rte_rcu_qsbr_get_memsize(0); TEST_RCU_QSBR_RETURN_IF_ERROR((sz != 1), "Get Memsize for 0 threads"); - sz = rte_rcu_qsbr_get_memsize(TEST_RCU_MAX_LCORE); + sz = rte_rcu_qsbr_get_memsize(RTE_MAX_LCORE); /* For 128 threads, * for machines with cache line size of 64B - 8384 * for machines with cache line size of 128 - 16768 @@ -132,7 +110,7 @@ struct test_rcu_thread_info { printf("\nTest rte_rcu_qsbr_init()\n"); - r = rte_rcu_qsbr_init(NULL, TEST_RCU_MAX_LCORE); + r = rte_rcu_qsbr_init(NULL, RTE_MAX_LCORE); TEST_RCU_QSBR_RETURN_IF_ERROR((r != 1), "NULL variable"); return 0; @@ -156,7 +134,7 @@ struct test_rcu_thread_info { TEST_RCU_QSBR_RETURN_IF_ERROR((ret == 0), "NULL variable, invalid thread id"); - rte_rcu_qsbr_init(t[0], TEST_RCU_MAX_LCORE); + rte_rcu_qsbr_init(t[0], RTE_MAX_LCORE); /* Register valid thread id */ ret = rte_rcu_qsbr_thread_register(t[0], enabled_core_ids[0]); @@ -168,7 +146,7 @@ struct test_rcu_thread_info { "Already registered thread id"); /* Register valid thread id - max allowed thread id */ - ret = rte_rcu_qsbr_thread_register(t[0], TEST_RCU_MAX_LCORE - 1); + ret = rte_rcu_qsbr_thread_register(t[0], RTE_MAX_LCORE - 1); TEST_RCU_QSBR_RETURN_IF_ERROR((ret == 1), "Max thread id"); ret = rte_rcu_qsbr_thread_register(t[0], 100000); @@ -185,9 +163,10 @@ struct test_rcu_thread_info { static int test_rcu_qsbr_thread_unregister(void) { - int i, j, ret; + unsigned int num_threads[3] = {1, RTE_MAX_LCORE, 1}; + unsigned int i, j; uint64_t token; - uint8_t num_threads[3] = {1, TEST_RCU_MAX_LCORE, 1}; + int ret; printf("\nTest rte_rcu_qsbr_thread_unregister()\n"); @@ -198,7 +177,7 @@ struct test_rcu_thread_info { TEST_RCU_QSBR_RETURN_IF_ERROR((ret == 0), "NULL variable, invalid thread id"); - rte_rcu_qsbr_init(t[0], TEST_RCU_MAX_LCORE); + rte_rcu_qsbr_init(t[0], RTE_MAX_LCORE); rte_rcu_qsbr_thread_register(t[0], enabled_core_ids[0]); @@ -207,7 +186,7 @@ struct test_rcu_thread_info { "NULL variable, invalid thread id"); /* Find first disabled core */ - for (i = 0; i < TEST_RCU_MAX_LCORE; i++) { + for (i = 0; i < RTE_MAX_LCORE; i++) { if (enabled_core_ids[i] == 0) break; } @@ -232,15 +211,15 @@ struct test_rcu_thread_info { /* * Test with different thread_ids: * 1 - thread_id = 0 - * 2 - All possible thread_ids, from 0 to TEST_RCU_MAX_LCORE - * 3 - thread_id = TEST_RCU_MAX_LCORE - 1 + * 2 - All possible thread_ids, from 0 to RTE_MAX_LCORE + * 3 - thread_id = RTE_MAX_LCORE - 1 */ for (j = 0; j < 3; j++) { - rte_rcu_qsbr_init(t[0], TEST_RCU_MAX_LCORE); + rte_rcu_qsbr_init(t[0], RTE_MAX_LCORE); for (i = 0; i < num_threads[j]; i++) rte_rcu_qsbr_thread_register(t[0], - (j == 2) ? (TEST_RCU_MAX_LCORE - 1) : i); + (j == 2) ? (RTE_MAX_LCORE - 1) : i); token = rte_rcu_qsbr_start(t[0]); TEST_RCU_QSBR_RETURN_IF_ERROR( @@ -248,10 +227,10 @@ struct test_rcu_thread_info { /* Update quiescent state counter */ for (i = 0; i < num_threads[j]; i++) { /* Skip one update */ - if (i == (TEST_RCU_MAX_LCORE - 10)) + if (i == (RTE_MAX_LCORE - 10)) continue; rte_rcu_qsbr_quiescent(t[0], - (j == 2) ? (TEST_RCU_MAX_LCORE - 1) : i); + (j == 2) ? (RTE_MAX_LCORE - 1) : i); } if (j == 1) { @@ -260,7 +239,7 @@ struct test_rcu_thread_info { TEST_RCU_QSBR_RETURN_IF_ERROR((ret == 0), "Non-blocking QSBR check"); /* Update the previously skipped thread */ - rte_rcu_qsbr_quiescent(t[0], TEST_RCU_MAX_LCORE - 10); + rte_rcu_qsbr_quiescent(t[0], RTE_MAX_LCORE - 10); } /* Validate the updates */ @@ -270,7 +249,7 @@ struct test_rcu_thread_info { for (i = 0; i < num_threads[j]; i++) rte_rcu_qsbr_thread_unregister(t[0], - (j == 2) ? (TEST_RCU_MAX_LCORE - 1) : i); + (j == 2) ? (RTE_MAX_LCORE - 1) : i); /* Check with no thread registered */ ret = rte_rcu_qsbr_check(t[0], token, true); @@ -292,7 +271,7 @@ struct test_rcu_thread_info { printf("\nTest rte_rcu_qsbr_start()\n"); - rte_rcu_qsbr_init(t[0], TEST_RCU_MAX_LCORE); + rte_rcu_qsbr_init(t[0], RTE_MAX_LCORE); for (i = 0; i < 3; i++) rte_rcu_qsbr_thread_register(t[0], enabled_core_ids[i]); @@ -331,7 +310,7 @@ struct test_rcu_thread_info { printf("\nTest rte_rcu_qsbr_check()\n"); - rte_rcu_qsbr_init(t[0], TEST_RCU_MAX_LCORE); + rte_rcu_qsbr_init(t[0], RTE_MAX_LCORE); token = rte_rcu_qsbr_start(t[0]); TEST_RCU_QSBR_RETURN_IF_ERROR( @@ -365,7 +344,7 @@ struct test_rcu_thread_info { ret = rte_rcu_qsbr_check(t[0], token, true); TEST_RCU_QSBR_RETURN_IF_ERROR((ret == 0), "Blocking QSBR check"); - rte_rcu_qsbr_init(t[0], TEST_RCU_MAX_LCORE); + rte_rcu_qsbr_init(t[0], RTE_MAX_LCORE); for (i = 0; i < 4; i++) rte_rcu_qsbr_thread_register(t[0], enabled_core_ids[i]); @@ -414,7 +393,7 @@ struct test_rcu_thread_info { printf("\nTest rte_rcu_qsbr_synchronize()\n"); - rte_rcu_qsbr_init(t[0], TEST_RCU_MAX_LCORE); + rte_rcu_qsbr_init(t[0], RTE_MAX_LCORE); /* Test if the API returns when there are no threads reporting * QS on the variable. @@ -424,7 +403,7 @@ struct test_rcu_thread_info { /* Test if the API returns when there are threads registered * but not online. */ - for (i = 0; i < TEST_RCU_MAX_LCORE; i++) + for (i = 0; i < RTE_MAX_LCORE; i++) rte_rcu_qsbr_thread_register(t[0], i); rte_rcu_qsbr_synchronize(t[0], RTE_QSBR_THRID_INVALID); @@ -436,12 +415,12 @@ struct test_rcu_thread_info { rte_rcu_qsbr_thread_offline(t[0], 0); /* Check the other boundary */ - rte_rcu_qsbr_thread_online(t[0], TEST_RCU_MAX_LCORE - 1); - rte_rcu_qsbr_synchronize(t[0], TEST_RCU_MAX_LCORE - 1); - rte_rcu_qsbr_thread_offline(t[0], TEST_RCU_MAX_LCORE - 1); + rte_rcu_qsbr_thread_online(t[0], RTE_MAX_LCORE - 1); + rte_rcu_qsbr_synchronize(t[0], RTE_MAX_LCORE - 1); + rte_rcu_qsbr_thread_offline(t[0], RTE_MAX_LCORE - 1); /* Test if the API returns after unregisterng all the threads */ - for (i = 0; i < TEST_RCU_MAX_LCORE; i++) + for (i = 0; i < RTE_MAX_LCORE; i++) rte_rcu_qsbr_thread_unregister(t[0], i); rte_rcu_qsbr_synchronize(t[0], RTE_QSBR_THRID_INVALID); @@ -474,7 +453,7 @@ struct test_rcu_thread_info { printf("Test rte_rcu_qsbr_thread_online()\n"); - rte_rcu_qsbr_init(t[0], TEST_RCU_MAX_LCORE); + rte_rcu_qsbr_init(t[0], RTE_MAX_LCORE); /* Register 2 threads to validate that only the * online thread is waited upon. @@ -501,9 +480,9 @@ struct test_rcu_thread_info { TEST_RCU_QSBR_RETURN_IF_ERROR((ret == 0), "thread update"); /* Make all the threads online */ - rte_rcu_qsbr_init(t[0], TEST_RCU_MAX_LCORE); + rte_rcu_qsbr_init(t[0], RTE_MAX_LCORE); token = rte_rcu_qsbr_start(t[0]); - for (i = 0; i < TEST_RCU_MAX_LCORE; i++) { + for (i = 0; i < RTE_MAX_LCORE; i++) { rte_rcu_qsbr_thread_register(t[0], i); rte_rcu_qsbr_thread_online(t[0], i); } @@ -512,7 +491,7 @@ struct test_rcu_thread_info { TEST_RCU_QSBR_RETURN_IF_ERROR((ret == 0), "thread online"); /* Check if all the online threads can report QS */ token = rte_rcu_qsbr_start(t[0]); - for (i = 0; i < TEST_RCU_MAX_LCORE; i++) + for (i = 0; i < RTE_MAX_LCORE; i++) rte_rcu_qsbr_quiescent(t[0], i); ret = rte_rcu_qsbr_check(t[0], token, true); TEST_RCU_QSBR_RETURN_IF_ERROR((ret == 0), "thread update"); @@ -532,7 +511,7 @@ struct test_rcu_thread_info { printf("\nTest rte_rcu_qsbr_thread_offline()\n"); - rte_rcu_qsbr_init(t[0], TEST_RCU_MAX_LCORE); + rte_rcu_qsbr_init(t[0], RTE_MAX_LCORE); rte_rcu_qsbr_thread_register(t[0], enabled_core_ids[0]); @@ -560,10 +539,10 @@ struct test_rcu_thread_info { /* * Check a sequence of online/status/offline/status/online/status */ - rte_rcu_qsbr_init(t[0], TEST_RCU_MAX_LCORE); + rte_rcu_qsbr_init(t[0], RTE_MAX_LCORE); token = rte_rcu_qsbr_start(t[0]); /* Make the threads online */ - for (i = 0; i < TEST_RCU_MAX_LCORE; i++) { + for (i = 0; i < RTE_MAX_LCORE; i++) { rte_rcu_qsbr_thread_register(t[0], i); rte_rcu_qsbr_thread_online(t[0], i); } @@ -574,13 +553,13 @@ struct test_rcu_thread_info { /* Check if all the online threads can report QS */ token = rte_rcu_qsbr_start(t[0]); - for (i = 0; i < TEST_RCU_MAX_LCORE; i++) + for (i = 0; i < RTE_MAX_LCORE; i++) rte_rcu_qsbr_quiescent(t[0], i); ret = rte_rcu_qsbr_check(t[0], token, true); TEST_RCU_QSBR_RETURN_IF_ERROR((ret == 0), "report QS"); /* Make all the threads offline */ - for (i = 0; i < TEST_RCU_MAX_LCORE; i++) + for (i = 0; i < RTE_MAX_LCORE; i++) rte_rcu_qsbr_thread_offline(t[0], i); /* Make sure these threads are not being waited on */ token = rte_rcu_qsbr_start(t[0]); @@ -588,11 +567,11 @@ struct test_rcu_thread_info { TEST_RCU_QSBR_RETURN_IF_ERROR((ret == 0), "offline QS"); /* Make the threads online */ - for (i = 0; i < TEST_RCU_MAX_LCORE; i++) + for (i = 0; i < RTE_MAX_LCORE; i++) rte_rcu_qsbr_thread_online(t[0], i); /* Check if all the online threads can report QS */ token = rte_rcu_qsbr_start(t[0]); - for (i = 0; i < TEST_RCU_MAX_LCORE; i++) + for (i = 0; i < RTE_MAX_LCORE; i++) rte_rcu_qsbr_quiescent(t[0], i); ret = rte_rcu_qsbr_check(t[0], token, true); TEST_RCU_QSBR_RETURN_IF_ERROR((ret == 0), "online again"); @@ -615,8 +594,8 @@ struct test_rcu_thread_info { rte_rcu_qsbr_dump(stdout, NULL); rte_rcu_qsbr_dump(NULL, NULL); - rte_rcu_qsbr_init(t[0], TEST_RCU_MAX_LCORE); - rte_rcu_qsbr_init(t[1], TEST_RCU_MAX_LCORE); + rte_rcu_qsbr_init(t[0], RTE_MAX_LCORE); + rte_rcu_qsbr_init(t[1], RTE_MAX_LCORE); /* QS variable with 0 core mask */ rte_rcu_qsbr_dump(stdout, t[0]); @@ -738,8 +717,7 @@ struct test_rcu_thread_info { for (i = 0; i < TOTAL_ENTRY; i++) { hash_data[hash_id][i] = - rte_zmalloc(NULL, - sizeof(uint32_t) * TEST_RCU_MAX_LCORE, 0); + rte_zmalloc(NULL, sizeof(uint32_t) * RTE_MAX_LCORE, 0); if (hash_data[hash_id][i] == NULL) { printf("No memory\n"); return NULL; @@ -781,7 +759,7 @@ struct test_rcu_thread_info { printf("Test: 1 writer, 1 QSBR variable, simultaneous QSBR queries\n"); - rte_rcu_qsbr_init(t[0], TEST_RCU_MAX_LCORE); + rte_rcu_qsbr_init(t[0], RTE_MAX_LCORE); /* Shared data structure created */ h[0] = init_hash(0); @@ -924,7 +902,7 @@ struct test_rcu_thread_info { for (i = 0; i < test_cores / 4; i++) { j = i * 4; - rte_rcu_qsbr_init(t[i], TEST_RCU_MAX_LCORE); + rte_rcu_qsbr_init(t[i], RTE_MAX_LCORE); h[i] = init_hash(i); if (h[i] == NULL) { printf("Hash init failed\n"); @@ -998,8 +976,13 @@ struct test_rcu_thread_info { static int test_rcu_qsbr_main(void) { - if (get_enabled_cores_mask() != 0) - return -1; + uint16_t core_id; + + num_cores = 0; + RTE_LCORE_FOREACH_SLAVE(core_id) { + enabled_core_ids[num_cores] = core_id; + num_cores++; + } if (num_cores < 4) { printf("Test failed! Need 4 or more cores\n"); diff --git a/app/test/test_rcu_qsbr_perf.c b/app/test/test_rcu_qsbr_perf.c index 33ca36c..c918a94 100644 --- a/app/test/test_rcu_qsbr_perf.c +++ b/app/test/test_rcu_qsbr_perf.c @@ -16,8 +16,7 @@ #include "test.h" /* Check condition and return an error if true. */ -#define TEST_RCU_MAX_LCORE 128 -static uint16_t enabled_core_ids[TEST_RCU_MAX_LCORE]; +static uint16_t enabled_core_ids[RTE_MAX_LCORE]; static uint8_t num_cores; static uint32_t *keys; @@ -28,7 +27,7 @@ static volatile uint8_t all_registered; static volatile uint32_t thr_id; -static struct rte_rcu_qsbr *t[TEST_RCU_MAX_LCORE]; +static struct rte_rcu_qsbr *t[RTE_MAX_LCORE]; static struct rte_hash *h; static char hash_name[8]; static rte_atomic64_t updates, checks; @@ -39,40 +38,19 @@ */ #define RCU_SCALE_DOWN 1000 -/* Simple way to allocate thread ids in 0 to TEST_RCU_MAX_LCORE space */ +/* Simple way to allocate thread ids in 0 to RTE_MAX_LCORE space */ static inline uint32_t alloc_thread_id(void) { uint32_t tmp_thr_id; tmp_thr_id = __atomic_fetch_add(&thr_id, 1, __ATOMIC_RELAXED); - if (tmp_thr_id >= TEST_RCU_MAX_LCORE) + if (tmp_thr_id >= RTE_MAX_LCORE) printf("Invalid thread id %u\n", tmp_thr_id); return tmp_thr_id; } -static inline int -get_enabled_cores_mask(void) -{ - uint16_t core_id; - uint32_t max_cores = rte_lcore_count(); - - if (max_cores > TEST_RCU_MAX_LCORE) { - printf("Number of cores exceed %d\n", TEST_RCU_MAX_LCORE); - return -1; - } - - core_id = 0; - num_cores = 0; - RTE_LCORE_FOREACH_SLAVE(core_id) { - enabled_core_ids[num_cores] = core_id; - num_cores++; - } - - return 0; -} - static int test_rcu_qsbr_reader_perf(void *arg) { @@ -165,7 +143,7 @@ if (all_registered == 1) tmp_num_cores = num_cores - 1; else - tmp_num_cores = TEST_RCU_MAX_LCORE; + tmp_num_cores = RTE_MAX_LCORE; sz = rte_rcu_qsbr_get_memsize(tmp_num_cores); t[0] = (struct rte_rcu_qsbr *)rte_zmalloc("rcu0", sz, @@ -223,7 +201,7 @@ if (all_registered == 1) tmp_num_cores = num_cores; else - tmp_num_cores = TEST_RCU_MAX_LCORE; + tmp_num_cores = RTE_MAX_LCORE; sz = rte_rcu_qsbr_get_memsize(tmp_num_cores); t[0] = (struct rte_rcu_qsbr *)rte_zmalloc("rcu0", sz, @@ -269,11 +247,11 @@ /* Number of readers does not matter for QS variable in this test * case as no reader will be registered. */ - sz = rte_rcu_qsbr_get_memsize(TEST_RCU_MAX_LCORE); + sz = rte_rcu_qsbr_get_memsize(RTE_MAX_LCORE); t[0] = (struct rte_rcu_qsbr *)rte_zmalloc("rcu0", sz, RTE_CACHE_LINE_SIZE); /* QS variable is initialized */ - rte_rcu_qsbr_init(t[0], TEST_RCU_MAX_LCORE); + rte_rcu_qsbr_init(t[0], RTE_MAX_LCORE); /* Writer threads are launched */ for (i = 0; i < num_cores; i++) @@ -367,7 +345,7 @@ static struct rte_hash *init_hash(void) for (i = 0; i < TOTAL_ENTRY; i++) { hash_data[i] = rte_zmalloc(NULL, - sizeof(uint32_t) * TEST_RCU_MAX_LCORE, 0); + sizeof(uint32_t) * RTE_MAX_LCORE, 0); if (hash_data[i] == NULL) { printf("No memory\n"); return NULL; @@ -417,7 +395,7 @@ static struct rte_hash *init_hash(void) if (all_registered == 1) tmp_num_cores = num_cores; else - tmp_num_cores = TEST_RCU_MAX_LCORE; + tmp_num_cores = RTE_MAX_LCORE; sz = rte_rcu_qsbr_get_memsize(tmp_num_cores); t[0] = (struct rte_rcu_qsbr *)rte_zmalloc("rcu0", sz, @@ -530,7 +508,7 @@ static struct rte_hash *init_hash(void) if (all_registered == 1) tmp_num_cores = num_cores; else - tmp_num_cores = TEST_RCU_MAX_LCORE; + tmp_num_cores = RTE_MAX_LCORE; sz = rte_rcu_qsbr_get_memsize(tmp_num_cores); t[0] = (struct rte_rcu_qsbr *)rte_zmalloc("rcu0", sz, @@ -626,23 +604,24 @@ static struct rte_hash *init_hash(void) static int test_rcu_qsbr_main(void) { + uint16_t core_id; + rte_atomic64_init(&updates); rte_atomic64_init(&update_cycles); rte_atomic64_init(&checks); rte_atomic64_init(&check_cycles); - if (get_enabled_cores_mask() != 0) - return -1; + num_cores = 0; + RTE_LCORE_FOREACH_SLAVE(core_id) { + enabled_core_ids[num_cores] = core_id; + num_cores++; + } printf("Number of cores provided = %d\n", num_cores); if (num_cores < 2) { printf("Test failed! Need 2 or more cores\n"); goto test_fail; } - if (num_cores > TEST_RCU_MAX_LCORE) { - printf("Test failed! %d cores supported\n", TEST_RCU_MAX_LCORE); - goto test_fail; - } printf("Perf test with all reader threads registered\n"); printf("--------------------------------------------\n"); @@ -664,12 +643,12 @@ static struct rte_hash *init_hash(void) goto test_fail; /* Make sure the actual number of cores provided is less than - * TEST_RCU_MAX_LCORE. This will allow for some threads not + * RTE_MAX_LCORE. This will allow for some threads not * to be registered on the QS variable. */ - if (num_cores >= TEST_RCU_MAX_LCORE) { + if (num_cores >= RTE_MAX_LCORE) { printf("Test failed! number of cores provided should be less than %d\n", - TEST_RCU_MAX_LCORE); + RTE_MAX_LCORE); goto test_fail; } -- 1.8.3.1