net/octeontx2: fix error handling after CQ init
[dpdk.git] / app / test / test_rcu_qsbr.c
index ae359a9..85d80e0 100644 (file)
@@ -3,7 +3,6 @@
  */
 
 #include <stdio.h>
-#include <stdbool.h>
 #include <rte_pause.h>
 #include <rte_rcu_qsbr.h>
 #include <rte_hash.h>
@@ -26,8 +25,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 +35,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 +46,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,20 +81,24 @@ 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");
 
        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(RTE_MAX_LCORE);
+       sz = rte_rcu_qsbr_get_memsize(128);
        /* For 128 threads,
         * for machines with cache line size of 64B - 8384
         * for machines with cache line size of 128 - 16768
         */
-       TEST_RCU_QSBR_RETURN_IF_ERROR((sz != 8384 && sz != 16768),
-               "Get Memsize");
+       if (RTE_CACHE_LINE_SIZE == 64)
+               TEST_RCU_QSBR_RETURN_IF_ERROR((sz != 8384),
+                       "Get Memsize for 128 threads");
+       else if (RTE_CACHE_LINE_SIZE == 128)
+               TEST_RCU_QSBR_RETURN_IF_ERROR((sz != 16768),
+                       "Get Memsize for 128 threads");
 
        return 0;
 }