git.droids-corp.org
/
dpdk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
doc: update QoS scheduler guides
[dpdk.git]
/
app
/
test
/
test_rcu_qsbr.c
diff --git
a/app/test/test_rcu_qsbr.c
b/app/test/test_rcu_qsbr.c
index
97af087
..
b60dc50
100644
(file)
--- a/
app/test/test_rcu_qsbr.c
+++ b/
app/test/test_rcu_qsbr.c
@@
-3,13
+3,13
@@
*/
#include <stdio.h>
*/
#include <stdio.h>
-#include <stdbool.h>
#include <rte_pause.h>
#include <rte_rcu_qsbr.h>
#include <rte_hash.h>
#include <rte_hash_crc.h>
#include <rte_malloc.h>
#include <rte_cycles.h>
#include <rte_pause.h>
#include <rte_rcu_qsbr.h>
#include <rte_hash.h>
#include <rte_hash_crc.h>
#include <rte_malloc.h>
#include <rte_cycles.h>
+#include <rte_random.h>
#include <unistd.h>
#include "test.h"
#include <unistd.h>
#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
/* 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];
-
uint8_
t num_cores;
+
static
uint16_t enabled_core_ids[RTE_MAX_LCORE];
+
static unsigned in
t num_cores;
static uint32_t *keys;
#define TOTAL_ENTRY (1024 * 8)
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];
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];
+st
atic st
ruct rte_hash *h[RTE_MAX_LCORE];
+
static
char hash_name[RTE_MAX_LCORE][8];
struct test_rcu_thread_info {
/* Index in RCU array */
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];
};
/* lcore IDs registered on the RCU variable */
uint16_t r_core_ids[2];
};
-struct test_rcu_thread_info thread_info[RTE_MAX_LCORE/4];
+st
atic st
ruct test_rcu_thread_info thread_info[RTE_MAX_LCORE/4];
static int
alloc_rcu(void)
{
int i;
static int
alloc_rcu(void)
{
int i;
-
uint32
_t sz;
+
size
_t sz;
sz = rte_rcu_qsbr_get_memsize(RTE_MAX_LCORE);
sz = rte_rcu_qsbr_get_memsize(RTE_MAX_LCORE);
@@
-82,20
+82,24
@@
free_rcu(void)
static int
test_rcu_qsbr_get_memsize(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");
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
*/
/* 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;
}
return 0;
}
@@
-165,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 num_threads[3] = {1, RTE_MAX_LCORE, 1};
unsigned int i, j;
+ unsigned int skip_thread_id;
uint64_t token;
int ret;
uint64_t token;
int ret;
@@
-224,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");
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 */
/* 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);
continue;
rte_rcu_qsbr_quiescent(t[0],
(j == 2) ? (RTE_MAX_LCORE - 1) : i);
@@
-239,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 */
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 */
}
/* Validate the updates */
@@
-389,7
+395,7
@@
test_rcu_qsbr_synchronize_reader(void *arg)
static int
test_rcu_qsbr_synchronize(void)
{
static int
test_rcu_qsbr_synchronize(void)
{
- int i;
+
unsigned
int i;
printf("\nTest rte_rcu_qsbr_synchronize()\n");
printf("\nTest rte_rcu_qsbr_synchronize()\n");
@@
-890,8
+896,8
@@
error:
static int
test_rcu_qsbr_mw_mv_mqs(void)
{
static int
test_rcu_qsbr_mw_mv_mqs(void)
{
- int i, j;
- u
int8_
t test_cores;
+
unsigned
int i, j;
+ u
nsigned in
t test_cores;
writer_done = 0;
test_cores = num_cores / 4;
writer_done = 0;
test_cores = num_cores / 4;
@@
-978,17
+984,17
@@
test_rcu_qsbr_main(void)
{
uint16_t core_id;
{
uint16_t core_id;
+ if (rte_lcore_count() < 5) {
+ printf("Not enough cores for rcu_qsbr_autotest, expecting at least 5\n");
+ return TEST_SKIPPED;
+ }
+
num_cores = 0;
RTE_LCORE_FOREACH_SLAVE(core_id) {
enabled_core_ids[num_cores] = core_id;
num_cores++;
}
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");
- goto test_fail;
- }
-
/* Error-checking test cases */
if (test_rcu_qsbr_get_memsize() < 0)
goto test_fail;
/* Error-checking test cases */
if (test_rcu_qsbr_get_memsize() < 0)
goto test_fail;