@@ -47,39 +47,39 @@ uint64_t odp_schedule_wait_time(uint64_t ns);
* Schedule
*
* Schedules all queues created with ODP_QUEUE_TYPE_SCHED type. Returns
- * next highest priority buffer which is available for the calling thread.
- * Outputs the source queue of the buffer. If there's no buffer available, waits
- * for a buffer according to the wait parameter setting. Returns
- * ODP_BUFFER_INVALID if reaches end of the wait period.
+ * next highest priority event which is available for the calling thread.
+ * Outputs the source queue of the event. If there's no event available, waits
+ * for an event according to the wait parameter setting. Returns
+ * ODP_EVENT_INVALID if reaches end of the wait period.
*
- * @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.
*
- * @return Next highest priority buffer, or ODP_BUFFER_INVALID
+ * @return Next highest priority event, or ODP_EVENT_INVALID
*/
-odp_buffer_t odp_schedule(odp_queue_t *from, uint64_t wait);
+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);
/**
@@ -10,7 +10,7 @@
#include <odp_queue.h>
#include <odp_shared_memory.h>
#include <odp_buffer.h>
-#include <odp_buffer_pool.h>
+#include <odp_pool.h>
#include <odp_internal.h>
#include <odp_config.h>
#include <odp_debug_internal.h>
@@ -43,10 +43,10 @@ _ODP_STATIC_ASSERT((8*sizeof(pri_mask_t)) >= QUEUES_PER_PRIO,
typedef struct {
- odp_queue_t pri_queue[ODP_CONFIG_SCHED_PRIOS][QUEUES_PER_PRIO];
- pri_mask_t pri_mask[ODP_CONFIG_SCHED_PRIOS];
- odp_spinlock_t mask_lock;
- odp_buffer_pool_t pool;
+ odp_queue_t pri_queue[ODP_CONFIG_SCHED_PRIOS][QUEUES_PER_PRIO];
+ pri_mask_t pri_mask[ODP_CONFIG_SCHED_PRIOS];
+ odp_spinlock_t mask_lock;
+ odp_pool_t pool;
} sched_t;
typedef struct {
@@ -83,7 +83,7 @@ static inline odp_queue_t select_pri_queue(odp_queue_t queue, int prio)
int odp_schedule_init_global(void)
{
odp_shm_t shm;
- odp_buffer_pool_t pool;
+ odp_pool_t pool;
int i, j;
odp_buffer_pool_param_t params;
@@ -107,7 +107,7 @@ int odp_schedule_init_global(void)
pool = odp_buffer_pool_create("odp_sched_pool", ODP_SHM_NULL, ¶ms);
- if (pool == ODP_BUFFER_POOL_INVALID) {
+ if (pool == ODP_POOL_INVALID) {
ODP_ERR("Schedule init: Pool create failed.\n");
return -1;
}
@@ -198,7 +198,7 @@ void odp_schedule_queue(odp_queue_t queue, int prio)
pri_queue = select_pri_queue(queue, prio);
desc_buf = queue_sched_buf(queue);
- odp_queue_enq(pri_queue, desc_buf);
+ odp_queue_enq(pri_queue, odp_buffer_to_event(desc_buf));
}
@@ -207,7 +207,8 @@ void odp_schedule_release_atomic(void)
if (sched_local.pri_queue != ODP_QUEUE_INVALID &&
sched_local.num == 0) {
/* Release current atomic queue */
- odp_queue_enq(sched_local.pri_queue, sched_local.desc_buf);
+ odp_queue_enq(sched_local.pri_queue,
+ odp_buffer_to_event(sched_local.desc_buf));
sched_local.pri_queue = ODP_QUEUE_INVALID;
}
}
@@ -267,6 +268,7 @@ static int schedule(odp_queue_t *out_queue, odp_buffer_t out_buf[],
for (j = 0; j < QUEUES_PER_PRIO; j++, id++) {
odp_queue_t pri_q;
+ odp_event_t ev;
odp_buffer_t desc_buf;
if (id >= QUEUES_PER_PRIO)
@@ -276,7 +278,8 @@ static int schedule(odp_queue_t *out_queue, odp_buffer_t out_buf[],
continue;
pri_q = sched->pri_queue[i][id];
- desc_buf = odp_queue_deq(pri_q);
+ ev = odp_queue_deq(pri_q);
+ desc_buf = odp_buffer_from_event(ev);
if (desc_buf != ODP_BUFFER_INVALID) {
queue_desc_t *desc;
@@ -286,9 +289,10 @@ static int schedule(odp_queue_t *out_queue, odp_buffer_t out_buf[],
desc = odp_buffer_addr(desc_buf);
queue = desc->queue;
- num = odp_queue_deq_multi(queue,
- sched_local.buf,
- max_deq);
+ num = odp_queue_deq_multi
+ (queue,
+ (odp_event_t *)sched_local.buf,
+ max_deq);
if (num == 0) {
/* Remove empty queue from scheduling,
@@ -297,7 +301,10 @@ static int schedule(odp_queue_t *out_queue, odp_buffer_t out_buf[],
if (odp_queue_type(queue) ==
ODP_QUEUE_TYPE_PKTIN &&
!queue_is_destroyed(queue))
- odp_queue_enq(pri_q, desc_buf);
+ odp_queue_enq(
+ pri_q,
+ odp_buffer_to_event
+ (desc_buf));
continue;
}
@@ -314,7 +321,9 @@ static int schedule(odp_queue_t *out_queue, odp_buffer_t out_buf[],
sched_local.desc_buf = desc_buf;
} else {
/* Continue scheduling the queue */
- odp_queue_enq(pri_q, desc_buf);
+ odp_queue_enq(pri_q,
+ odp_buffer_to_event
+ (desc_buf));
}
/* Output the source queue handle */
@@ -367,7 +376,7 @@ static int schedule_loop(odp_queue_t *out_queue, uint64_t wait,
}
-odp_buffer_t odp_schedule(odp_queue_t *out_queue, uint64_t wait)
+odp_event_t odp_schedule(odp_queue_t *out_queue, uint64_t wait)
{
odp_buffer_t buf;
@@ -375,14 +384,15 @@ odp_buffer_t odp_schedule(odp_queue_t *out_queue, uint64_t wait)
schedule_loop(out_queue, wait, &buf, 1, MAX_DEQ);
- return buf;
+ return odp_buffer_to_event(buf);
}
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);
}
Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org> --- platform/linux-generic/include/api/odp_schedule.h | 32 +++++++-------- platform/linux-generic/odp_schedule.c | 48 ++++++++++++++--------- 2 files changed, 45 insertions(+), 35 deletions(-)