Changed odp_schedule_multi() and odp_queue_enq_multi() to use events instead of buffers.
Signed-off-by: Petri Savolainen <[email protected]> --- platform/linux-generic/include/api/odp_queue.h | 8 ++++---- platform/linux-generic/include/api/odp_schedule.h | 16 ++++++++-------- platform/linux-generic/odp_queue.c | 4 ++-- platform/linux-generic/odp_schedule.c | 4 ++-- test/performance/odp_scheduling.c | 22 +++++++++++++--------- 5 files changed, 29 insertions(+), 25 deletions(-) diff --git a/platform/linux-generic/include/api/odp_queue.h b/platform/linux-generic/include/api/odp_queue.h index 589d07a..b770270 100644 --- a/platform/linux-generic/include/api/odp_queue.h +++ b/platform/linux-generic/include/api/odp_queue.h @@ -181,15 +181,15 @@ void *odp_queue_get_context(odp_queue_t queue); int odp_queue_enq(odp_queue_t queue, odp_event_t ev); /** - * Enqueue multiple buffers to a queue + * Enqueue multiple events to a queue * * @param queue Queue handle - * @param buf Buffer handles - * @param num Number of buffer handles + * @param ev Event handles + * @param num Number of event handles * * @return 0 if succesful */ -int odp_queue_enq_multi(odp_queue_t queue, odp_buffer_t buf[], int num); +int odp_queue_enq_multi(odp_queue_t queue, odp_event_t ev[], int num); /** * Queue dequeue diff --git a/platform/linux-generic/include/api/odp_schedule.h b/platform/linux-generic/include/api/odp_schedule.h index 45fa48c..688a6db 100644 --- a/platform/linux-generic/include/api/odp_schedule.h +++ b/platform/linux-generic/include/api/odp_schedule.h @@ -64,22 +64,22 @@ uint64_t odp_schedule_wait_time(uint64_t ns); odp_event_t odp_schedule(odp_queue_t *from, uint64_t wait); /** - * Schedule multiple buffers + * Schedule multiple events * - * Like odp_schedule(), but returns multiple buffers from a queue. + * Like odp_schedule(), but returns multiple events from a queue. * - * @param from Output parameter for the source queue (where the buffer was + * @param from Output parameter for the source queue (where the event was * dequeued from). Ignored if NULL. - * @param wait Minimum time to wait for a buffer. Waits infinitely, if set to + * @param wait Minimum time to wait for an event. Waits infinitely, if set to * ODP_SCHED_WAIT. Does not wait, if set to ODP_SCHED_NO_WAIT. * Use odp_schedule_wait_time() to convert time to other wait * values. - * @param out_buf Buffer array for output - * @param num Maximum number of buffers to output + * @param events Event array for output + * @param num Maximum number of events to output * - * @return Number of buffers outputed (0 ... num) + * @return Number of events outputed (0 ... num) */ -int odp_schedule_multi(odp_queue_t *from, uint64_t wait, odp_buffer_t out_buf[], +int odp_schedule_multi(odp_queue_t *from, uint64_t wait, odp_event_t events[], unsigned int num); /** diff --git a/platform/linux-generic/odp_queue.c b/platform/linux-generic/odp_queue.c index c027f23..f3046e2 100644 --- a/platform/linux-generic/odp_queue.c +++ b/platform/linux-generic/odp_queue.c @@ -385,7 +385,7 @@ int queue_enq_multi_dummy(queue_entry_t *queue ODP_UNUSED, return -1; } -int odp_queue_enq_multi(odp_queue_t handle, odp_buffer_t buf[], int num) +int odp_queue_enq_multi(odp_queue_t handle, odp_event_t ev[], int num) { odp_buffer_hdr_t *buf_hdr[QUEUE_MULTI_MAX]; queue_entry_t *queue; @@ -397,7 +397,7 @@ int odp_queue_enq_multi(odp_queue_t handle, odp_buffer_t buf[], int num) queue = queue_to_qentry(handle); for (i = 0; i < num; i++) - buf_hdr[i] = odp_buf_to_hdr(buf[i]); + buf_hdr[i] = odp_buf_to_hdr(odp_buffer_from_event(ev[i])); return queue->s.enqueue_multi(queue, buf_hdr, num); } diff --git a/platform/linux-generic/odp_schedule.c b/platform/linux-generic/odp_schedule.c index 7b25e8a..1e54fd2 100644 --- a/platform/linux-generic/odp_schedule.c +++ b/platform/linux-generic/odp_schedule.c @@ -380,9 +380,9 @@ odp_event_t odp_schedule(odp_queue_t *out_queue, uint64_t wait) int odp_schedule_multi(odp_queue_t *out_queue, uint64_t wait, - odp_buffer_t out_buf[], unsigned int num) + odp_event_t events[], unsigned int num) { - return schedule_loop(out_queue, wait, out_buf, num, MAX_DEQ); + return schedule_loop(out_queue, wait, (odp_buffer_t *)events, num, MAX_DEQ); } diff --git a/test/performance/odp_scheduling.c b/test/performance/odp_scheduling.c index 1196ef9..ebf0609 100644 --- a/test/performance/odp_scheduling.c +++ b/test/performance/odp_scheduling.c @@ -481,7 +481,7 @@ static int test_schedule_multi(const char *str, int thr, odp_buffer_pool_t msg_pool, int prio, odp_barrier_t *barrier) { - odp_buffer_t buf[MULTI_BUFS_MAX]; + odp_event_t ev[MULTI_BUFS_MAX]; odp_queue_t queue; uint64_t t1 = 0; uint64_t t2 = 0; @@ -508,16 +508,20 @@ static int test_schedule_multi(const char *str, int thr, } for (j = 0; j < MULTI_BUFS_MAX; j++) { - buf[j] = odp_buffer_alloc(msg_pool); + odp_buffer_t buf; - if (!odp_buffer_is_valid(buf[j])) { + buf = odp_buffer_alloc(msg_pool); + + if (!odp_buffer_is_valid(buf)) { LOG_ERR(" [%i] msg_pool alloc failed\n", thr); return -1; } + + ev[j] = odp_buffer_to_event(buf); } - if (odp_queue_enq_multi(queue, buf, MULTI_BUFS_MAX)) { + if (odp_queue_enq_multi(queue, ev, MULTI_BUFS_MAX)) { LOG_ERR(" [%i] Queue enqueue failed.\n", thr); return -1; } @@ -527,22 +531,22 @@ static int test_schedule_multi(const char *str, int thr, t1 = odp_time_cycles(); for (i = 0; i < QUEUE_ROUNDS; i++) { - num = odp_schedule_multi(&queue, ODP_SCHED_WAIT, buf, + num = odp_schedule_multi(&queue, ODP_SCHED_WAIT, ev, MULTI_BUFS_MAX); tot += num; - if (odp_queue_enq_multi(queue, buf, num)) { + if (odp_queue_enq_multi(queue, ev, num)) { LOG_ERR(" [%i] Queue enqueue failed.\n", thr); return -1; } } - /* Clear possible locally stored buffers */ + /* Clear possible locally stored events */ odp_schedule_pause(); while (1) { - num = odp_schedule_multi(&queue, ODP_SCHED_NO_WAIT, buf, + num = odp_schedule_multi(&queue, ODP_SCHED_NO_WAIT, ev, MULTI_BUFS_MAX); if (num == 0) @@ -550,7 +554,7 @@ static int test_schedule_multi(const char *str, int thr, tot += num; - if (odp_queue_enq_multi(queue, buf, num)) { + if (odp_queue_enq_multi(queue, ev, num)) { LOG_ERR(" [%i] Queue enqueue failed.\n", thr); return -1; } -- 2.2.2 _______________________________________________ lng-odp mailing list [email protected] http://lists.linaro.org/mailman/listinfo/lng-odp
