This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "".
The branch, api-next has been updated via c73aaee1959377064cecccb6158b225de3f13db5 (commit) via 7263734ca83fc439d7b491149cf07fa3f569b539 (commit) via e9e6dcaa53b16b4a081bc87ad971accd45180d8d (commit) from 33e0abebe03ed2095ff44780241e8b63166e36d9 (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- commit c73aaee1959377064cecccb6158b225de3f13db5 Author: Petri Savolainen petri.savolainen@linaro.org Date: Thu Nov 8 14:29:17 2018 +0200
validation: sched: add test case for wait and no_wait
Added a test case for the new odp_schedule_multi_wait() and _no_wait() functions.
Signed-off-by: Petri Savolainen petri.savolainen@linaro.org Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/test/validation/api/scheduler/scheduler.c b/test/validation/api/scheduler/scheduler.c index 63ceb6ea..2f66f526 100644 --- a/test/validation/api/scheduler/scheduler.c +++ b/test/validation/api/scheduler/scheduler.c @@ -291,6 +291,114 @@ static void scheduler_test_queue_destroy(void) CU_ASSERT_FATAL(odp_pool_destroy(p) == 0); }
+static void scheduler_test_wait(void) +{ + odp_pool_t p; + odp_pool_param_t pool_param; + odp_queue_param_t queue_param; + odp_queue_t queue, from; + odp_buffer_t buf; + odp_event_t ev; + uint32_t *u32; + uint32_t i, j, num_enq, retry; + int ret; + uint32_t num_ev = 50; + uint32_t num_retry = 1000; + + odp_pool_param_init(&pool_param); + pool_param.buf.size = 10; + pool_param.buf.num = num_ev; + pool_param.type = ODP_POOL_BUFFER; + + p = odp_pool_create("sched_test_wait", &pool_param); + + CU_ASSERT_FATAL(p != ODP_POOL_INVALID); + + odp_queue_param_init(&queue_param); + queue_param.type = ODP_QUEUE_TYPE_SCHED; + queue_param.sched.prio = odp_schedule_default_prio(); + queue_param.sched.sync = ODP_SCHED_SYNC_PARALLEL; + queue_param.sched.group = ODP_SCHED_GROUP_ALL; + + queue = odp_queue_create("sched_test_wait", &queue_param); + + CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID); + + for (i = 0; i < 4; i++) { + num_enq = 0; + + for (j = 0; j < num_ev; j++) { + buf = odp_buffer_alloc(p); + + CU_ASSERT_FATAL(buf != ODP_BUFFER_INVALID); + + u32 = odp_buffer_addr(buf); + u32[0] = MAGIC; + + ev = odp_buffer_to_event(buf); + if (!(CU_ASSERT(odp_queue_enq(queue, ev) == 0))) { + odp_buffer_free(buf); + continue; + } + + num_enq++; + } + + CU_ASSERT(num_enq == num_ev); + + for (j = 0; j < num_enq; j++) { + if (i == 0) { + ev = odp_schedule(&from, ODP_SCHED_WAIT); + } else if (i == 1) { + ret = odp_schedule_multi_wait(&from, &ev, 1); + CU_ASSERT_FATAL(ret == 1); + } else if (i == 2) { + retry = 0; + do { + ev = odp_schedule(&from, + ODP_SCHED_NO_WAIT); + retry++; + } while (ev == ODP_EVENT_INVALID && + retry < num_retry); + } else { + retry = 0; + do { + ret = odp_schedule_multi_no_wait(&from, + &ev, + 1); + retry++; + } while (ret == 0 && retry < num_retry); + CU_ASSERT_FATAL(ret == 1); + } + + CU_ASSERT_FATAL(ev != ODP_EVENT_INVALID); + CU_ASSERT(from == queue); + + buf = odp_buffer_from_event(ev); + u32 = odp_buffer_addr(buf); + + CU_ASSERT(u32[0] == MAGIC); + + odp_buffer_free(buf); + } + } + + /* Make sure that scheduler is empty */ + retry = 0; + do { + ret = odp_schedule_multi_no_wait(NULL, &ev, 1); + CU_ASSERT(ret == 0 || ret == 1); + + if (ret) + odp_event_free(ev); + else + retry++; + } while (ret || retry < num_retry); + + CU_ASSERT_FATAL(odp_queue_destroy(queue) == 0); + CU_ASSERT_FATAL(odp_pool_destroy(p) == 0); +} + static void scheduler_test_queue_size(void) { odp_queue_capability_t queue_capa; @@ -1844,6 +1952,7 @@ odp_testinfo_t scheduler_suite[] = { ODP_TEST_INFO(scheduler_test_wait_time), ODP_TEST_INFO(scheduler_test_num_prio), ODP_TEST_INFO(scheduler_test_queue_destroy), + ODP_TEST_INFO(scheduler_test_wait), ODP_TEST_INFO(scheduler_test_queue_size), ODP_TEST_INFO(scheduler_test_groups), ODP_TEST_INFO(scheduler_test_pause_resume),
commit 7263734ca83fc439d7b491149cf07fa3f569b539 Author: Petri Savolainen petri.savolainen@linaro.org Date: Tue Nov 6 16:27:44 2018 +0200
linux-gen: sched: implement wait and no_wait functions
Implemented the new odp_schedule_multi_wait() and _no_wait() functions.
Signed-off-by: Petri Savolainen petri.savolainen@linaro.org Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/platform/linux-generic/include/odp_schedule_if.h b/platform/linux-generic/include/odp_schedule_if.h index 8c00f922..5f7f2c4d 100644 --- a/platform/linux-generic/include/odp_schedule_if.h +++ b/platform/linux-generic/include/odp_schedule_if.h @@ -89,9 +89,14 @@ void sched_cb_pktio_stop_finalize(int pktio_index);
/* API functions */ typedef struct { - uint64_t (*schedule_wait_time)(uint64_t); - odp_event_t (*schedule)(odp_queue_t *, uint64_t); - int (*schedule_multi)(odp_queue_t *, uint64_t, odp_event_t [], int); + uint64_t (*schedule_wait_time)(uint64_t ns); + odp_event_t (*schedule)(odp_queue_t *from, uint64_t wait); + int (*schedule_multi)(odp_queue_t *from, uint64_t wait, + odp_event_t events[], int num); + int (*schedule_multi_wait)(odp_queue_t *from, odp_event_t events[], + int num); + int (*schedule_multi_no_wait)(odp_queue_t *from, odp_event_t events[], + int num); void (*schedule_pause)(void); void (*schedule_resume)(void); void (*schedule_release_atomic)(void); diff --git a/platform/linux-generic/odp_schedule_basic.c b/platform/linux-generic/odp_schedule_basic.c index 8ba120b7..a2db156f 100644 --- a/platform/linux-generic/odp_schedule_basic.c +++ b/platform/linux-generic/odp_schedule_basic.c @@ -1164,6 +1164,14 @@ static inline int do_schedule(odp_queue_t *out_queue, odp_event_t out_ev[], return 0; }
+static inline int schedule_run(odp_queue_t *out_queue, odp_event_t out_ev[], + unsigned int max_num) +{ + timer_run(); + + return do_schedule(out_queue, out_ev, max_num); +} + static inline int schedule_loop(odp_queue_t *out_queue, uint64_t wait, odp_event_t out_ev[], unsigned int max_num) { @@ -1172,9 +1180,7 @@ static inline int schedule_loop(odp_queue_t *out_queue, uint64_t wait, int ret;
while (1) { - timer_run(); - - ret = do_schedule(out_queue, out_ev, max_num); + ret = schedule_run(out_queue, out_ev, max_num);
if (ret) break; @@ -1216,6 +1222,24 @@ static int schedule_multi(odp_queue_t *out_queue, uint64_t wait, return schedule_loop(out_queue, wait, events, num); }
+static int schedule_multi_no_wait(odp_queue_t *out_queue, odp_event_t events[], + int num) +{ + return schedule_run(out_queue, events, num); +} + +static int schedule_multi_wait(odp_queue_t *out_queue, odp_event_t events[], + int num) +{ + int ret; + + do { + ret = schedule_run(out_queue, events, num); + } while (ret == 0); + + return ret; +} + static inline void order_lock(void) { if (sched_local.sync_ctx != ODP_SCHED_SYNC_ORDERED) @@ -1551,6 +1575,8 @@ const schedule_api_t schedule_basic_api = { .schedule_wait_time = schedule_wait_time, .schedule = schedule, .schedule_multi = schedule_multi, + .schedule_multi_wait = schedule_multi_wait, + .schedule_multi_no_wait = schedule_multi_no_wait, .schedule_pause = schedule_pause, .schedule_resume = schedule_resume, .schedule_release_atomic = schedule_release_atomic, diff --git a/platform/linux-generic/odp_schedule_if.c b/platform/linux-generic/odp_schedule_if.c index 084dced6..4d50a13f 100644 --- a/platform/linux-generic/odp_schedule_if.c +++ b/platform/linux-generic/odp_schedule_if.c @@ -41,6 +41,16 @@ int odp_schedule_multi(odp_queue_t *from, uint64_t wait, odp_event_t events[], return sched_api->schedule_multi(from, wait, events, num); }
+int odp_schedule_multi_wait(odp_queue_t *from, odp_event_t events[], int num) +{ + return sched_api->schedule_multi_wait(from, events, num); +} + +int odp_schedule_multi_no_wait(odp_queue_t *from, odp_event_t events[], int num) +{ + return sched_api->schedule_multi_no_wait(from, events, num); +} + void odp_schedule_pause(void) { return sched_api->schedule_pause(); diff --git a/platform/linux-generic/odp_schedule_scalable.c b/platform/linux-generic/odp_schedule_scalable.c index 548e487e..1f301bf4 100644 --- a/platform/linux-generic/odp_schedule_scalable.c +++ b/platform/linux-generic/odp_schedule_scalable.c @@ -1342,6 +1342,18 @@ static odp_event_t schedule(odp_queue_t *from, uint64_t wait) return ev; }
+static int schedule_multi_wait(odp_queue_t *from, odp_event_t events[], + int max_num) +{ + return schedule_multi(from, ODP_SCHED_WAIT, events, max_num); +} + +static int schedule_multi_no_wait(odp_queue_t *from, odp_event_t events[], + int max_num) +{ + return schedule_multi(from, ODP_SCHED_NO_WAIT, events, max_num); +} + static void schedule_pause(void) { sched_ts->pause = true; @@ -2123,6 +2135,8 @@ const schedule_api_t schedule_scalable_api = { .schedule_wait_time = schedule_wait_time, .schedule = schedule, .schedule_multi = schedule_multi, + .schedule_multi_wait = schedule_multi_wait, + .schedule_multi_no_wait = schedule_multi_no_wait, .schedule_pause = schedule_pause, .schedule_resume = schedule_resume, .schedule_release_atomic = schedule_release_atomic, diff --git a/platform/linux-generic/odp_schedule_sp.c b/platform/linux-generic/odp_schedule_sp.c index 67bfa88f..c93c5e02 100644 --- a/platform/linux-generic/odp_schedule_sp.c +++ b/platform/linux-generic/odp_schedule_sp.c @@ -644,6 +644,18 @@ static odp_event_t schedule(odp_queue_t *from, uint64_t wait) return ODP_EVENT_INVALID; }
+static int schedule_multi_wait(odp_queue_t *from, odp_event_t events[], + int max_num) +{ + return schedule_multi(from, ODP_SCHED_WAIT, events, max_num); +} + +static int schedule_multi_no_wait(odp_queue_t *from, odp_event_t events[], + int max_num) +{ + return schedule_multi(from, ODP_SCHED_NO_WAIT, events, max_num); +} + static void schedule_pause(void) { sched_local.pause = 1; @@ -935,6 +947,8 @@ const schedule_api_t schedule_sp_api = { .schedule_wait_time = schedule_wait_time, .schedule = schedule, .schedule_multi = schedule_multi, + .schedule_multi_wait = schedule_multi_wait, + .schedule_multi_no_wait = schedule_multi_no_wait, .schedule_pause = schedule_pause, .schedule_resume = schedule_resume, .schedule_release_atomic = schedule_release_atomic,
commit e9e6dcaa53b16b4a081bc87ad971accd45180d8d Author: Petri Savolainen petri.savolainen@linaro.org Date: Tue Nov 6 15:09:10 2018 +0200
api: sched: add wait and no_wait schedule functions
Schedule call is one of the most used ODP API calls. Introduce versions without the wait parameter as wait / no_wait are the most used wait options. Implementation saves a number of if-conditions per schedule call.
Signed-off-by: Petri Savolainen petri.savolainen@linaro.org Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/include/odp/api/spec/schedule.h b/include/odp/api/spec/schedule.h index ae4894fc..d9b868e3 100644 --- a/include/odp/api/spec/schedule.h +++ b/include/odp/api/spec/schedule.h @@ -112,6 +112,35 @@ odp_event_t odp_schedule(odp_queue_t *from, uint64_t wait); int odp_schedule_multi(odp_queue_t *from, uint64_t wait, odp_event_t events[], int num);
+/** + * Schedule, wait for events + * + * Like odp_schedule_multi(), but waits infinitely for events. + * + * @param[out] from Output parameter for the source queue (where the event + * was dequeued from). Ignored if NULL. + * @param[out] events Event array for output + * @param num Maximum number of events to output + * + * @return Number of events outputted (1 ... num) + */ +int odp_schedule_multi_wait(odp_queue_t *from, odp_event_t events[], int num); + +/** + * Schedule, do not wait for events + * + * Like odp_schedule_multi(), but does not wait for events. + * + * @param[out] from Output parameter for the source queue (where the event + * was dequeued from). Ignored if NULL. + * @param[out] events Event array for output + * @param num Maximum number of events to output + * + * @return Number of events outputted (0 ... num) + */ +int odp_schedule_multi_no_wait(odp_queue_t *from, odp_event_t events[], + int num); + /** * Pause scheduling *
-----------------------------------------------------------------------
Summary of changes: include/odp/api/spec/schedule.h | 29 ++++++ platform/linux-generic/include/odp_schedule_if.h | 11 ++- platform/linux-generic/odp_schedule_basic.c | 32 ++++++- platform/linux-generic/odp_schedule_if.c | 10 +++ platform/linux-generic/odp_schedule_scalable.c | 14 +++ platform/linux-generic/odp_schedule_sp.c | 14 +++ test/validation/api/scheduler/scheduler.c | 109 +++++++++++++++++++++++ 7 files changed, 213 insertions(+), 6 deletions(-)
hooks/post-receive