diff options
author | Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org> | 2018-10-31 13:47:52 +0300 |
---|---|---|
committer | Maxim Uvarov <maxim.uvarov@linaro.org> | 2018-12-26 16:48:54 +0300 |
commit | f27ee888c0ed07a08eafaea596094125cb9fdcc6 (patch) | |
tree | 5092a21719120f9906861b740d03a9a74a176e93 /test | |
parent | 2aee8a5840602472d46ae873c9d9f87cf54461e7 (diff) |
example, tests: move scheduled queue capabilities to sched
Move scheduled queue capabilities to odp_schedule_capability_t
structure, as they logically belong to ODP scheduler module, rather than
queue module.
Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>
Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>
Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>
Reviewed-by: Petri Savolainen <petri.savolainen@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/performance/odp_cpu_bench.c | 23 | ||||
-rw-r--r-- | test/performance/odp_pktio_ordered.c | 12 | ||||
-rw-r--r-- | test/performance/odp_sched_perf.c | 17 | ||||
-rw-r--r-- | test/performance/odp_sched_pktio.c | 12 | ||||
-rw-r--r-- | test/performance/odp_scheduling.c | 11 | ||||
-rw-r--r-- | test/validation/api/queue/queue.c | 40 | ||||
-rw-r--r-- | test/validation/api/scheduler/scheduler.c | 22 |
7 files changed, 68 insertions, 69 deletions
diff --git a/test/performance/odp_cpu_bench.c b/test/performance/odp_cpu_bench.c index 402ab4a18..b41bc43f2 100644 --- a/test/performance/odp_cpu_bench.c +++ b/test/performance/odp_cpu_bench.c @@ -526,7 +526,7 @@ int main(int argc, char *argv[]) odp_cpumask_t cpumask; odp_pool_capability_t pool_capa; odp_pool_t pool; - odp_queue_capability_t queue_capa; + odp_schedule_capability_t schedule_capa; odp_shm_t shm; odp_shm_t lookup_tbl_shm; odp_pool_param_t params; @@ -614,27 +614,26 @@ int main(int argc, char *argv[]) printf("first CPU: %i\n", odp_cpumask_first(&cpumask)); printf("cpu mask: %s\n", cpumaskstr); - /* Create application queues */ - if (odp_queue_capability(&queue_capa)) { - LOG_ERR("Error: odp_queue_capability() failed\n"); - exit(EXIT_FAILURE); + if (odp_schedule_capability(&schedule_capa)) { + printf("Error: Schedule capa failed.\n"); + return -1; } /* Make sure a single queue can store all the packets in a group */ pkts_per_group = QUEUES_PER_GROUP * PKTS_PER_QUEUE; - if (queue_capa.sched.max_size && - queue_capa.sched.max_size < pkts_per_group) - pkts_per_group = queue_capa.sched.max_size; + if (schedule_capa.max_queue_size && + schedule_capa.max_queue_size < pkts_per_group) + pkts_per_group = schedule_capa.max_queue_size; /* Divide queues evenly into groups */ - if (queue_capa.sched.max_num < QUEUES_PER_GROUP) { + if (schedule_capa.max_queues < QUEUES_PER_GROUP) { LOG_ERR("Error: min %d queues required\n", QUEUES_PER_GROUP); return -1; } - num_queues = num_workers > queue_capa.sched.max_num ? - queue_capa.sched.max_num : num_workers; + num_queues = num_workers > schedule_capa.max_queues ? + schedule_capa.max_queues : num_workers; num_groups = (num_queues + QUEUES_PER_GROUP - 1) / QUEUES_PER_GROUP; - if (num_groups * QUEUES_PER_GROUP > queue_capa.sched.max_num) + if (num_groups * QUEUES_PER_GROUP > schedule_capa.max_queues) num_groups--; num_queues = num_groups * QUEUES_PER_GROUP; diff --git a/test/performance/odp_pktio_ordered.c b/test/performance/odp_pktio_ordered.c index 1b4b756a1..da37407aa 100644 --- a/test/performance/odp_pktio_ordered.c +++ b/test/performance/odp_pktio_ordered.c @@ -1061,7 +1061,6 @@ int main(int argc, char *argv[]) odp_pool_t pool; odp_pool_param_t params; odp_shm_t shm; - odp_queue_capability_t queue_capa; odp_schedule_capability_t schedule_capa; odp_pool_capability_t pool_capa; odph_ethaddr_t new_addr; @@ -1099,11 +1098,6 @@ int main(int argc, char *argv[]) exit(EXIT_FAILURE); } - if (odp_queue_capability(&queue_capa)) { - LOG_ERR("Error: Queue capa failed\n"); - exit(EXIT_FAILURE); - } - if (odp_schedule_capability(&schedule_capa)) { printf("Error: Schedule capa failed.\n"); return -1; @@ -1164,9 +1158,9 @@ int main(int argc, char *argv[]) pool_size = pool_capa.pkt.max_num; queue_size = MAX_NUM_PKT; - if (queue_capa.sched.max_size && - queue_capa.sched.max_size < MAX_NUM_PKT) - queue_size = queue_capa.sched.max_size; + if (schedule_capa.max_queue_size && + schedule_capa.max_queue_size < MAX_NUM_PKT) + queue_size = schedule_capa.max_queue_size; /* Pool should not be larger than queue, otherwise queue enqueues at * packet input may fail. */ diff --git a/test/performance/odp_sched_perf.c b/test/performance/odp_sched_perf.c index bbd76c86c..b25c3e19a 100644 --- a/test/performance/odp_sched_perf.c +++ b/test/performance/odp_sched_perf.c @@ -251,7 +251,7 @@ static int create_pool(test_global_t *global) static int create_queues(test_global_t *global) { - odp_queue_capability_t queue_capa; + odp_schedule_capability_t schedule_capa; odp_queue_param_t queue_param; odp_queue_t queue; odp_buffer_t buf; @@ -279,19 +279,20 @@ static int create_queues(test_global_t *global) printf(" queue type %s\n\n", type_str); - if (odp_queue_capability(&queue_capa)) { - printf("Error: Queue capa failed.\n"); + if (odp_schedule_capability(&schedule_capa)) { + printf("Error: Schedule capa failed.\n"); return -1; } - if (tot_queue > queue_capa.sched.max_num) { - printf("Max queues supported %u\n", queue_capa.sched.max_num); + if (tot_queue > schedule_capa.max_queues) { + printf("Max queues supported %u\n", + schedule_capa.max_queues); return -1; } - if (queue_capa.sched.max_size && - queue_size > queue_capa.sched.max_size) { - printf("Max queue size %u\n", queue_capa.sched.max_size); + if (schedule_capa.max_queue_size && + queue_size > schedule_capa.max_queue_size) { + printf("Max queue size %u\n", schedule_capa.max_queue_size); return -1; } diff --git a/test/performance/odp_sched_pktio.c b/test/performance/odp_sched_pktio.c index 878dcad0e..1faa9b1d5 100644 --- a/test/performance/odp_sched_pktio.c +++ b/test/performance/odp_sched_pktio.c @@ -1109,12 +1109,12 @@ static int create_pipeline_queues(test_global_t *test_global) int i, j, k, num_pktio, stages, queues, ctx_size; pipe_queue_context_t *ctx; odp_queue_param_t queue_param; - odp_queue_capability_t queue_capa; + odp_schedule_capability_t schedule_capa; odp_schedule_sync_t sched_sync; int ret = 0; - if (odp_queue_capability(&queue_capa)) { - printf("Error: Queue capability failed\n"); + if (odp_schedule_capability(&schedule_capa)) { + printf("Error: Schedule capa failed.\n"); return -1; } @@ -1130,10 +1130,10 @@ static int create_pipeline_queues(test_global_t *test_global) queue_param.sched.group = ODP_SCHED_GROUP_ALL; queue_param.size = test_global->opt.pipe_queue_size; - if (queue_capa.sched.max_size && - queue_param.size > queue_capa.sched.max_size) { + if (schedule_capa.max_queue_size && + queue_param.size > schedule_capa.max_queue_size) { printf("Error: Pipeline queue max size is %u\n", - queue_capa.sched.max_size); + schedule_capa.max_queue_size); return -1; } diff --git a/test/performance/odp_scheduling.c b/test/performance/odp_scheduling.c index acc401e0d..655a619e2 100644 --- a/test/performance/odp_scheduling.c +++ b/test/performance/odp_scheduling.c @@ -813,6 +813,7 @@ int main(int argc, char *argv[]) odph_odpthread_params_t thr_params; odp_queue_capability_t capa; odp_pool_capability_t pool_capa; + odp_schedule_capability_t schedule_capa; uint32_t num_queues, num_buf; printf("\nODP example starts\n\n"); @@ -908,10 +909,16 @@ int main(int argc, char *argv[]) return -1; } + if (odp_schedule_capability(&schedule_capa)) { + printf("Error: Schedule capa failed.\n"); + return -1; + } + globals->queues_per_prio = QUEUES_PER_PRIO; num_queues = globals->queues_per_prio * NUM_PRIOS; - if (num_queues > capa.sched.max_num) - globals->queues_per_prio = capa.sched.max_num / NUM_PRIOS; + if (num_queues > schedule_capa.max_queues) + globals->queues_per_prio = schedule_capa.max_queues / + NUM_PRIOS; /* One plain queue is also used */ num_queues = (globals->queues_per_prio * NUM_PRIOS) + 1; diff --git a/test/validation/api/queue/queue.c b/test/validation/api/queue/queue.c index 99acc4bff..aab95bab2 100644 --- a/test/validation/api/queue/queue.c +++ b/test/validation/api/queue/queue.c @@ -127,18 +127,15 @@ static void queue_test_capa(void) odp_queue_param_t qparams; char name[ODP_QUEUE_NAME_LEN]; odp_queue_t queue[MAX_QUEUES]; - uint32_t num_queues, min, i, j; + uint32_t num_queues, min, i; memset(&capa, 0, sizeof(odp_queue_capability_t)); CU_ASSERT(odp_queue_capability(&capa) == 0); CU_ASSERT(capa.max_queues != 0); CU_ASSERT(capa.plain.max_num != 0); - CU_ASSERT(capa.sched.max_num != 0); min = capa.plain.max_num; - if (min > capa.sched.max_num) - min = capa.sched.max_num; CU_ASSERT(capa.max_queues >= min); @@ -150,33 +147,26 @@ static void queue_test_capa(void) odp_queue_param_init(&qparams); CU_ASSERT(qparams.nonblocking == ODP_BLOCKING); - for (j = 0; j < 2; j++) { - if (j == 0) { - num_queues = capa.plain.max_num; - } else { - num_queues = capa.sched.max_num; - qparams.type = ODP_QUEUE_TYPE_SCHED; - } + num_queues = capa.plain.max_num; - if (num_queues > MAX_QUEUES) - num_queues = MAX_QUEUES; + if (num_queues > MAX_QUEUES) + num_queues = MAX_QUEUES; - for (i = 0; i < num_queues; i++) { - generate_name(name, i); - queue[i] = odp_queue_create(name, &qparams); + for (i = 0; i < num_queues; i++) { + generate_name(name, i); + queue[i] = odp_queue_create(name, &qparams); - if (queue[i] == ODP_QUEUE_INVALID) { - CU_FAIL("Queue create failed"); - num_queues = i; - break; - } - - CU_ASSERT(odp_queue_lookup(name) != ODP_QUEUE_INVALID); + if (queue[i] == ODP_QUEUE_INVALID) { + CU_FAIL("Queue create failed"); + num_queues = i; + break; } - for (i = 0; i < num_queues; i++) - CU_ASSERT(odp_queue_destroy(queue[i]) == 0); + CU_ASSERT(odp_queue_lookup(name) != ODP_QUEUE_INVALID); } + + for (i = 0; i < num_queues; i++) + CU_ASSERT(odp_queue_destroy(queue[i]) == 0); } static void queue_test_mode(void) diff --git a/test/validation/api/scheduler/scheduler.c b/test/validation/api/scheduler/scheduler.c index 35c38751e..4fdfc2430 100644 --- a/test/validation/api/scheduler/scheduler.c +++ b/test/validation/api/scheduler/scheduler.c @@ -20,6 +20,7 @@ #define NUM_BUFS_PAUSE 1000 #define NUM_BUFS_BEFORE_PAUSE 10 #define NUM_GROUPS 2 +#define MAX_QUEUES (64 * 1024) #define TEST_QUEUE_SIZE_NUM_EV 50 @@ -144,12 +145,16 @@ static void release_context(odp_schedule_sync_t sync) static void scheduler_test_capa(void) { odp_schedule_capability_t capa; + odp_queue_capability_t queue_capa; memset(&capa, 0, sizeof(odp_schedule_capability_t)); CU_ASSERT_FATAL(odp_schedule_capability(&capa) == 0); + CU_ASSERT_FATAL(odp_queue_capability(&queue_capa) == 0); CU_ASSERT(capa.max_groups != 0); CU_ASSERT(capa.max_prios != 0); + CU_ASSERT(capa.max_queues != 0); + CU_ASSERT(queue_capa.max_queues >= capa.max_queues); } static void scheduler_test_wait_time(void) @@ -413,6 +418,7 @@ static void scheduler_test_wait(void) static void scheduler_test_queue_size(void) { odp_queue_capability_t queue_capa; + odp_scheduler_config_t default_config; odp_pool_t pool; odp_pool_param_t pool_param; odp_queue_param_t queue_param; @@ -426,10 +432,11 @@ static void scheduler_test_queue_size(void) ODP_SCHED_SYNC_ORDERED}; CU_ASSERT_FATAL(odp_queue_capability(&queue_capa) == 0); + odp_scheduler_config_init(&default_config); queue_size = TEST_QUEUE_SIZE_NUM_EV; - if (queue_capa.sched.max_size && - queue_size > queue_capa.sched.max_size) - queue_size = queue_capa.sched.max_size; + if (default_config.queue_size && + queue_size > default_config.queue_size) + queue_size = default_config.queue_size; odp_pool_param_init(&pool_param); pool_param.buf.size = 100; @@ -1684,9 +1691,10 @@ static int create_queues(test_globals_t *globals) } globals->max_sched_queue_size = BUFS_PER_QUEUE_EXCL; - if (capa.sched.max_size && capa.sched.max_size < BUFS_PER_QUEUE_EXCL) { - printf("Max sched queue size %u\n", capa.sched.max_size); - globals->max_sched_queue_size = capa.sched.max_size; + if (sched_capa.max_queue_size && sched_capa.max_queue_size < + BUFS_PER_QUEUE_EXCL) { + printf("Max sched queue size %u\n", sched_capa.max_queue_size); + globals->max_sched_queue_size = sched_capa.max_queue_size; } prios = odp_schedule_num_prio(); @@ -1696,7 +1704,7 @@ static int create_queues(test_globals_t *globals) queues_per_prio = QUEUES_PER_PRIO; num_sched = (prios * queues_per_prio * sched_types) + CHAOS_NUM_QUEUES; num_plain = (prios * queues_per_prio); - while ((num_sched > capa.sched.max_num || + while ((num_sched > sched_capa.max_queues || num_plain > capa.plain.max_num || num_sched + num_plain > capa.max_queues) && queues_per_prio) { queues_per_prio--; |