X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=app%2Ftest%2Ftest_rcu_qsbr.c;h=b60dc5099cd138951df2b3cd73fc62248081afd8;hb=0b1e11b0b69d7f36a7d283ae3e85bf63269530da;hp=1d273e39d2f8ab7254cfa37203ad863c635a5d70;hpb=21c17c155686c6e98e70df5b2dae7bb580f4adb6;p=dpdk.git diff --git a/app/test/test_rcu_qsbr.c b/app/test/test_rcu_qsbr.c index 1d273e39d2..b60dc5099c 100644 --- a/app/test/test_rcu_qsbr.c +++ b/app/test/test_rcu_qsbr.c @@ -3,13 +3,13 @@ */ #include -#include #include #include #include #include #include #include +#include #include #include "test.h" @@ -26,8 +26,8 @@ /* Make sure that this has the same value as __RTE_QSBR_CNT_INIT */ #define TEST_RCU_QSBR_CNT_INIT 1 -uint16_t enabled_core_ids[RTE_MAX_LCORE]; -unsigned int num_cores; +static uint16_t enabled_core_ids[RTE_MAX_LCORE]; +static unsigned int num_cores; static uint32_t *keys; #define TOTAL_ENTRY (1024 * 8) @@ -36,8 +36,8 @@ static uint32_t *hash_data[RTE_MAX_LCORE][TOTAL_ENTRY]; static uint8_t writer_done; static struct rte_rcu_qsbr *t[RTE_MAX_LCORE]; -struct rte_hash *h[RTE_MAX_LCORE]; -char hash_name[RTE_MAX_LCORE][8]; +static struct rte_hash *h[RTE_MAX_LCORE]; +static char hash_name[RTE_MAX_LCORE][8]; struct test_rcu_thread_info { /* Index in RCU array */ @@ -47,13 +47,13 @@ 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[RTE_MAX_LCORE/4]; +static struct test_rcu_thread_info thread_info[RTE_MAX_LCORE/4]; static int alloc_rcu(void) { int i; - uint32_t sz; + size_t sz; sz = rte_rcu_qsbr_get_memsize(RTE_MAX_LCORE); @@ -82,7 +82,7 @@ free_rcu(void) static int test_rcu_qsbr_get_memsize(void) { - uint32_t sz; + size_t sz; printf("\nTest rte_rcu_qsbr_thread_register()\n"); @@ -169,6 +169,7 @@ test_rcu_qsbr_thread_unregister(void) { unsigned int num_threads[3] = {1, RTE_MAX_LCORE, 1}; unsigned int i, j; + unsigned int skip_thread_id; uint64_t token; int ret; @@ -228,10 +229,11 @@ test_rcu_qsbr_thread_unregister(void) token = rte_rcu_qsbr_start(t[0]); TEST_RCU_QSBR_RETURN_IF_ERROR( (token != (TEST_RCU_QSBR_CNT_INIT + 1)), "QSBR Start"); + skip_thread_id = rte_rand() % RTE_MAX_LCORE; /* Update quiescent state counter */ for (i = 0; i < num_threads[j]; i++) { /* Skip one update */ - if (i == (RTE_MAX_LCORE - 10)) + if ((j == 1) && (i == skip_thread_id)) continue; rte_rcu_qsbr_quiescent(t[0], (j == 2) ? (RTE_MAX_LCORE - 1) : i); @@ -243,7 +245,7 @@ test_rcu_qsbr_thread_unregister(void) TEST_RCU_QSBR_RETURN_IF_ERROR((ret == 0), "Non-blocking QSBR check"); /* Update the previously skipped thread */ - rte_rcu_qsbr_quiescent(t[0], RTE_MAX_LCORE - 10); + rte_rcu_qsbr_quiescent(t[0], skip_thread_id); } /* Validate the updates */