For this series: Reviewed-and-tested-by: Bill Fischofer <[email protected]>
On Wed, Jun 22, 2016 at 8:09 PM, Petri Savolainen < [email protected]> wrote: > Test queue capability API and create the maximum number of > queues. > > Signed-off-by: Petri Savolainen <[email protected]> > --- > platform/linux-generic/odp_queue.c | 5 ++- > test/validation/queue/queue.c | 62 > ++++++++++++++++++++++++++++++++++++-- > test/validation/queue/queue.h | 3 +- > 3 files changed, 66 insertions(+), 4 deletions(-) > > diff --git a/platform/linux-generic/odp_queue.c > b/platform/linux-generic/odp_queue.c > index f3e589e..1166a72 100644 > --- a/platform/linux-generic/odp_queue.c > +++ b/platform/linux-generic/odp_queue.c > @@ -25,6 +25,8 @@ > #include <odp/api/traffic_mngr.h> > #include <odp_schedule_ordered_internal.h> > > +#define NUM_INTERNAL_QUEUES 64 > + > #ifdef USE_TICKETLOCK > #include <odp/api/ticketlock.h> > #define LOCK(a) odp_ticketlock_lock(a) > @@ -184,7 +186,8 @@ int odp_queue_capability(odp_queue_capability_t *capa) > { > memset(capa, 0, sizeof(odp_queue_capability_t)); > > - capa->max_queues = ODP_CONFIG_QUEUES; > + /* Reserve some queues for internal use */ > + capa->max_queues = ODP_CONFIG_QUEUES - NUM_INTERNAL_QUEUES; > capa->max_ordered_locks = SCHEDULE_ORDERED_LOCKS_PER_QUEUE; > capa->max_sched_groups = sched_fn->num_grps(); > capa->sched_prios = odp_schedule_num_prio(); > diff --git a/test/validation/queue/queue.c b/test/validation/queue/queue.c > index 1e60cd7..b554aa3 100644 > --- a/test/validation/queue/queue.c > +++ b/test/validation/queue/queue.c > @@ -11,10 +11,22 @@ > #define MAX_BUFFER_QUEUE (8) > #define MSG_POOL_SIZE (4 * 1024 * 1024) > #define CONFIG_MAX_ITERATION (100) > +#define MAX_QUEUES (64 * 1024) > > static int queue_context = 0xff; > static odp_pool_t pool; > > +static void generate_name(char *name, uint32_t index) > +{ > + /* Uniqueue name for up to 300M queues */ > + name[0] = 'A' + ((index / (26 * 26 * 26 * 26 * 26)) % 26); > + name[1] = 'A' + ((index / (26 * 26 * 26 * 26)) % 26); > + name[2] = 'A' + ((index / (26 * 26 * 26)) % 26); > + name[3] = 'A' + ((index / (26 * 26)) % 26); > + name[4] = 'A' + ((index / 26) % 26); > + name[5] = 'A' + (index % 26); > +} > + > int queue_suite_init(void) > { > odp_pool_param_t params; > @@ -38,7 +50,52 @@ int queue_suite_term(void) > return odp_pool_destroy(pool); > } > > -void queue_test_sunnydays(void) > +void queue_test_capa(void) > +{ > + odp_queue_capability_t capa; > + odp_queue_param_t qparams; > + char name[ODP_QUEUE_NAME_LEN]; > + odp_queue_t queue[MAX_QUEUES]; > + uint32_t num_queues, 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.max_ordered_locks != 0); > + CU_ASSERT(capa.max_sched_groups != 0); > + CU_ASSERT(capa.sched_prios != 0); > + > + for (i = 0; i < ODP_QUEUE_NAME_LEN; i++) > + name[i] = 'A' + (i % 26); > + > + name[ODP_QUEUE_NAME_LEN - 1] = 0; > + > + if (capa.max_queues > MAX_QUEUES) > + num_queues = MAX_QUEUES; > + else > + num_queues = capa.max_queues; > + > + odp_queue_param_init(&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 - 1; > + break; > + } > + > + CU_ASSERT(odp_queue_lookup(name) != ODP_QUEUE_INVALID); > + } > + > + for (i = 0; i < num_queues; i++) > + CU_ASSERT(odp_queue_destroy(queue[i]) == 0); > +} > + > +void queue_test_param(void) > { > odp_queue_t queue_creat_id, queue_id; > odp_event_t enev[MAX_BUFFER_QUEUE]; > @@ -189,7 +246,8 @@ void queue_test_info(void) > } > > odp_testinfo_t queue_suite[] = { > - ODP_TEST_INFO(queue_test_sunnydays), > + ODP_TEST_INFO(queue_test_capa), > + ODP_TEST_INFO(queue_test_param), > ODP_TEST_INFO(queue_test_info), > ODP_TEST_INFO_NULL, > }; > diff --git a/test/validation/queue/queue.h b/test/validation/queue/queue.h > index 4ef52f5..1d3164d 100644 > --- a/test/validation/queue/queue.h > +++ b/test/validation/queue/queue.h > @@ -10,7 +10,8 @@ > #include <odp_cunit_common.h> > > /* test functions: */ > -void queue_test_sunnydays(void); > +void queue_test_capa(void); > +void queue_test_param(void); > void queue_test_info(void); > > /* test arrays: */ > -- > 2.8.1 > > _______________________________________________ > lng-odp mailing list > [email protected] > https://lists.linaro.org/mailman/listinfo/lng-odp > _______________________________________________ lng-odp mailing list [email protected] https://lists.linaro.org/mailman/listinfo/lng-odp
