@@ -531,7 +531,9 @@ bool verify_stream_db_outputs(void)
buf_tbl,
LOOP_DEQ_COUNT);
#else
- buf_tbl[0] = odp_queue_deq(queue);
+ odp_event_t ev;
+ ev = odp_queue_deq(queue);
+ buf_tbl[0] = odp_buffer_from_event(ev);
count = (buf_tbl[0] != ODP_BUFFER_INVALID) ? 1 : 0;
#endif
if (!count)
@@ -194,14 +194,14 @@ int odp_queue_enq_multi(odp_queue_t queue, odp_event_t ev[], int num);
/**
* Queue dequeue
*
- * Dequeues next buffer from head of the queue. Cannot be used for
+ * Dequeues next event from head of the queue. Cannot be used for
* ODP_QUEUE_TYPE_SCHED type queues (use odp_schedule() instead).
*
* @param queue Queue handle
*
- * @return Buffer handle, or ODP_BUFFER_INVALID
+ * @return Event handle, or ODP_EVENT_INVALID
*/
-odp_buffer_t odp_queue_deq(odp_queue_t queue);
+odp_event_t odp_queue_deq(odp_queue_t queue);
/**
* Dequeue multiple buffers from a queue
@@ -514,7 +514,7 @@ int odp_queue_deq_multi(odp_queue_t handle, odp_buffer_t buf[], int num)
}
-odp_buffer_t odp_queue_deq(odp_queue_t handle)
+odp_event_t odp_queue_deq(odp_queue_t handle)
{
queue_entry_t *queue;
odp_buffer_hdr_t *buf_hdr;
@@ -523,9 +523,9 @@ odp_buffer_t odp_queue_deq(odp_queue_t handle)
buf_hdr = queue->s.dequeue(queue);
if (buf_hdr)
- return buf_hdr->handle.handle;
+ return odp_buffer_to_event(buf_hdr->handle.handle);
- return ODP_BUFFER_INVALID;
+ return ODP_EVENT_INVALID;
}
@@ -268,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)
@@ -277,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;
@@ -258,6 +258,7 @@ static int test_alloc_multi(int thr, odp_buffer_pool_t pool)
*/
static int test_poll_queue(int thr, odp_buffer_pool_t msg_pool)
{
+ odp_event_t ev;
odp_buffer_t buf;
test_message_t *t_msg;
odp_queue_t queue;
@@ -288,12 +289,16 @@ static int test_poll_queue(int thr, odp_buffer_pool_t msg_pool)
t1 = odp_time_cycles();
for (i = 0; i < QUEUE_ROUNDS; i++) {
- if (odp_queue_enq(queue, odp_buffer_to_event(buf))) {
+ ev = odp_buffer_to_event(buf);
+
+ if (odp_queue_enq(queue, ev)) {
LOG_ERR(" [%i] Queue enqueue failed.\n", thr);
return -1;
}
- buf = odp_queue_deq(queue);
+ ev = odp_queue_deq(queue);
+
+ buf = odp_buffer_from_event(ev);
if (!odp_buffer_is_valid(buf)) {
LOG_ERR(" [%i] Queue empty.\n", thr);
@@ -35,7 +35,7 @@ static void alg_test(enum odp_crypto_op op,
int rc;
enum odp_crypto_ses_create_err status;
bool posted;
- odp_buffer_t compl_event;
+ odp_event_t compl_event;
odp_queue_t compl_queue = odp_queue_lookup("crypto-out");
CU_ASSERT(compl_queue != ODP_QUEUE_INVALID);
@@ -103,15 +103,15 @@ static void alg_test(enum odp_crypto_op op,
/* Poll completion queue for results */
do {
compl_event = odp_queue_deq(compl_queue);
- } while (compl_event == ODP_BUFFER_INVALID);
+ } while (compl_event == ODP_EVENT_INVALID);
if (compl_new == ODP_BUFFER_INVALID)
- CU_ASSERT(compl_event == buf)
+ CU_ASSERT(odp_buffer_from_event(compl_event) == buf)
else
- CU_ASSERT(compl_event == compl_new)
+ CU_ASSERT(odp_buffer_from_event(compl_event) == compl_new)
struct odp_crypto_compl_status auth_status, cipher_status;
- odp_crypto_get_operation_compl_status(compl_event,
+ odp_crypto_get_operation_compl_status(odp_buffer_from_event(compl_event),
&auth_status, &cipher_status);
CU_ASSERT(auth_status.alg_err == ODP_CRYPTO_ALG_ERR_NONE);
CU_ASSERT(auth_status.hw_err == ODP_CRYPTO_HW_ERR_NONE);
@@ -119,12 +119,12 @@ static void alg_test(enum odp_crypto_op op,
CU_ASSERT(cipher_status.hw_err == ODP_CRYPTO_HW_ERR_NONE);
odp_packet_t out_pkt;
- out_pkt = odp_crypto_get_operation_compl_packet(compl_event);
+ out_pkt = odp_crypto_get_operation_compl_packet(odp_buffer_from_event(compl_event));
CU_ASSERT(out_pkt == pkt);
CU_ASSERT(!memcmp(data_addr, output_vec, output_vec_len));
- void *ctx = odp_crypto_get_operation_compl_ctx(compl_event);
+ void *ctx = odp_crypto_get_operation_compl_ctx(odp_buffer_from_event(compl_event));
CU_ASSERT(ctx == (void *)0xdeadbeef);
odp_buffer_free(buf);
@@ -247,14 +247,14 @@ static int create_inq(odp_pktio_t pktio)
static odp_buffer_t queue_deq_wait_time(odp_queue_t queue, uint64_t ns)
{
uint64_t start, now, diff;
- odp_buffer_t buf;
+ odp_event_t ev;
start = odp_time_cycles();
do {
- buf = odp_queue_deq(queue);
- if (buf != ODP_BUFFER_INVALID)
- return buf;
+ ev = odp_queue_deq(queue);
+ if (ev != ODP_EVENT_INVALID)
+ return odp_buffer_from_event(ev);
now = odp_time_cycles();
diff = odp_time_diff_cycles(start, now);
} while (odp_time_cycles_to_ns(diff) < ns);
@@ -38,6 +38,7 @@ static void test_odp_queue_sunnyday(void)
odp_event_t enev[MAX_BUFFER_QUEUE];
odp_buffer_t debuf[MAX_BUFFER_QUEUE];
odp_buffer_t buf;
+ odp_event_t ev;
odp_buffer_pool_t msg_pool;
odp_queue_param_t param;
odp_buffer_t *pbuf_tmp;
@@ -68,9 +69,10 @@ static void test_odp_queue_sunnyday(void)
msg_pool = odp_buffer_pool_lookup("msg_pool");
buf = odp_buffer_alloc(msg_pool);
+ ev = odp_buffer_to_event(buf);
- odp_queue_enq(queue_id, odp_buffer_to_event(buf));
- CU_ASSERT_EQUAL(buf, odp_queue_deq(queue_id));
+ odp_queue_enq(queue_id, ev);
+ CU_ASSERT_EQUAL(ev, odp_queue_deq(queue_id));
odp_buffer_free(buf);
for (i = 0; i < MAX_BUFFER_QUEUE; i++) {
@@ -157,8 +157,10 @@ static void *worker_entrypoint(void *arg)
uint32_t ms;
uint64_t prev_tick = odp_timer_current_tick(tp);
for (ms = 0; ms < 7 * RANGE_MS / 10; ms++) {
- odp_buffer_t buf;
- while ((buf = odp_queue_deq(queue)) != ODP_BUFFER_INVALID) {
+ odp_event_t ev;
+ while ((ev = odp_queue_deq(queue)) != ODP_EVENT_INVALID) {
+ odp_buffer_t buf;
+ buf = odp_buffer_from_event(ev);
/* Subtract one from prev_tick to allow for timeouts
* to be delivered a tick late */
handle_tmo(buf, false, prev_tick - 1);
@@ -233,8 +235,9 @@ static void *worker_entrypoint(void *arg)
* received */
usleep(1000/*1ms*/);
while (nstale != 0) {
- odp_buffer_t buf = odp_queue_deq(queue);
- if (buf != ODP_BUFFER_INVALID) {
+ odp_event_t ev = odp_queue_deq(queue);
+ if (ev != ODP_EVENT_INVALID) {
+ odp_buffer_t buf = odp_buffer_from_event(ev);
handle_tmo(buf, true, 0/*Dont' care for stale tmo's*/);
nstale--;
} else {
@@ -242,10 +245,10 @@ static void *worker_entrypoint(void *arg)
break;
}
}
- /* Check if there any more (unexpected) buffers */
- odp_buffer_t buf = odp_queue_deq(queue);
- if (buf != ODP_BUFFER_INVALID)
- CU_FAIL("Unexpected buffer received");
+ /* Check if there any more (unexpected) events */
+ odp_event_t ev = odp_queue_deq(queue);
+ if (ev != ODP_EVENT_INVALID)
+ CU_FAIL("Unexpected event received");
printf("Thread %u: exiting\n", thr);
return NULL;
Changed odp_queue_deq() to use events instead of buffers. Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org> --- example/ipsec/odp_ipsec_stream.c | 4 +++- platform/linux-generic/include/api/odp_queue.h | 6 +++--- platform/linux-generic/odp_queue.c | 6 +++--- platform/linux-generic/odp_schedule.c | 4 +++- test/performance/odp_scheduling.c | 9 +++++++-- test/validation/crypto/odp_crypto_test_async_inp.c | 14 +++++++------- test/validation/odp_pktio.c | 8 ++++---- test/validation/odp_queue.c | 6 ++++-- test/validation/odp_timer.c | 19 +++++++++++-------- 9 files changed, 45 insertions(+), 31 deletions(-)