diff mbox

[v5,02/17] api: event: odp_schedule and odp_queue_enq

Message ID 1422277551-16417-3-git-send-email-petri.savolainen@linaro.org
State Accepted
Commit a49b7b64fe4835eabe0d27804bd84417a635292b
Headers show

Commit Message

Petri Savolainen Jan. 26, 2015, 1:05 p.m. UTC
Changed odp_schedule() and odp_queue_enq() to use events
instead of buffers.

Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>
---
 example/generator/odp_generator.c                 |  8 ++---
 example/ipsec/odp_ipsec.c                         | 10 +++----
 example/ipsec/odp_ipsec_stream.c                  |  2 +-
 example/l2fwd/odp_l2fwd.c                         |  8 ++---
 example/packet/odp_pktio.c                        |  8 ++---
 example/timer/odp_timer_test.c                    | 18 ++++++------
 platform/linux-generic/include/api/odp_queue.h    |  4 +--
 platform/linux-generic/include/api/odp_schedule.h | 16 +++++-----
 platform/linux-generic/odp_crypto.c               |  3 +-
 platform/linux-generic/odp_queue.c                |  4 +--
 platform/linux-generic/odp_schedule.c             | 13 ++++----
 platform/linux-generic/odp_timer.c                |  3 +-
 test/performance/odp_scheduling.c                 | 36 ++++++++++++-----------
 test/validation/odp_pktio.c                       | 12 +++++---
 test/validation/odp_queue.c                       |  2 +-
 test/validation/odp_schedule.c                    | 23 ++++++++++-----
 16 files changed, 94 insertions(+), 76 deletions(-)
diff mbox

Patch

diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c
index 4b911a6..547366a 100644
--- a/example/generator/odp_generator.c
+++ b/example/generator/odp_generator.c
@@ -372,7 +372,7 @@  static void *gen_send_thread(void *arg)
 			return NULL;
 		}
 
-		err = odp_queue_enq(outq_def, odp_packet_to_buffer(pkt));
+		err = odp_queue_enq(outq_def, odp_packet_to_event(pkt));
 		if (err != 0) {
 			EXAMPLE_ERR("  [%02i] send pkt err!\n", thr);
 			return NULL;
@@ -502,7 +502,7 @@  static void *gen_recv_thread(void *arg)
 	odp_pktio_t pktio;
 	thread_args_t *thr_args;
 	odp_packet_t pkt;
-	odp_buffer_t buf;
+	odp_event_t ev;
 
 	thr = odp_thread_id();
 	thr_args = arg;
@@ -518,9 +518,9 @@  static void *gen_recv_thread(void *arg)
 
 	for (;;) {
 		/* Use schedule to get buf from any input queue */
-		buf = odp_schedule(NULL, ODP_SCHED_WAIT);
+		ev = odp_schedule(NULL, ODP_SCHED_WAIT);
 
-		pkt = odp_packet_from_buffer(buf);
+		pkt = odp_packet_from_event(ev);
 		/* Drop packets with errors */
 		if (odp_unlikely(odp_packet_error(pkt))) {
 			odp_packet_free(pkt);
diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
index f2fac8a..a59794a 100644
--- a/example/ipsec/odp_ipsec.c
+++ b/example/ipsec/odp_ipsec.c
@@ -1037,7 +1037,7 @@  void *pktio_thread(void *arg EXAMPLE_UNUSED)
 {
 	int thr;
 	odp_packet_t pkt;
-	odp_buffer_t buf;
+	odp_event_t ev;
 	unsigned long pkt_cnt = 0;
 
 	thr = odp_thread_id();
@@ -1053,8 +1053,8 @@  void *pktio_thread(void *arg EXAMPLE_UNUSED)
 		odp_queue_t  dispatchq;
 
 		/* Use schedule to get buf from any input queue */
-		buf = SCHEDULE(&dispatchq, ODP_SCHED_WAIT);
-		pkt = odp_packet_from_buffer(buf);
+		ev  = SCHEDULE(&dispatchq, ODP_SCHED_WAIT);
+		pkt = odp_packet_from_event(ev);
 
 		/* Determine new work versus completion or sequence number */
 		if ((completionq != dispatchq) && (seqnumq != dispatchq)) {
@@ -1113,7 +1113,7 @@  void *pktio_thread(void *arg EXAMPLE_UNUSED)
 					ctx->state = PKT_STATE_TRANSMIT;
 				} else {
 					ctx->state = PKT_STATE_IPSEC_OUT_SEQ;
-					odp_queue_enq(seqnumq, buf);
+					odp_queue_enq(seqnumq, ev);
 				}
 				break;
 
@@ -1131,7 +1131,7 @@  void *pktio_thread(void *arg EXAMPLE_UNUSED)
 
 			case PKT_STATE_TRANSMIT:
 
-				odp_queue_enq(ctx->outq, buf);
+				odp_queue_enq(ctx->outq, ev);
 				rc = PKT_DONE;
 				break;
 
diff --git a/example/ipsec/odp_ipsec_stream.c b/example/ipsec/odp_ipsec_stream.c
index 1e932df..8900483 100644
--- a/example/ipsec/odp_ipsec_stream.c
+++ b/example/ipsec/odp_ipsec_stream.c
@@ -497,7 +497,7 @@  int create_stream_db_inputs(void)
 				break;
 			}
 			stream->created++;
-			odp_queue_enq(queue, pkt);
+			odp_queue_enq(queue, odp_packet_to_event(pkt));
 
 			/* Count this stream when we create first packet */
 			if (1 == stream->created)
diff --git a/example/l2fwd/odp_l2fwd.c b/example/l2fwd/odp_l2fwd.c
index 10d5d32..445e869 100644
--- a/example/l2fwd/odp_l2fwd.c
+++ b/example/l2fwd/odp_l2fwd.c
@@ -111,7 +111,7 @@  static void *pktio_queue_thread(void *arg)
 	int thr;
 	odp_queue_t outq_def;
 	odp_packet_t pkt;
-	odp_buffer_t buf;
+	odp_event_t ev;
 	unsigned long pkt_cnt = 0;
 	unsigned long err_cnt = 0;
 
@@ -124,8 +124,8 @@  static void *pktio_queue_thread(void *arg)
 	/* Loop packets */
 	for (;;) {
 		/* Use schedule to get buf from any input queue */
-		buf = odp_schedule(NULL, ODP_SCHED_WAIT);
-		pkt = odp_packet_from_buffer(buf);
+		ev  = odp_schedule(NULL, ODP_SCHED_WAIT);
+		pkt = odp_packet_from_event(ev);
 
 		/* Drop packets with errors */
 		if (odp_unlikely(drop_err_pkts(&pkt, 1) == 0)) {
@@ -136,7 +136,7 @@  static void *pktio_queue_thread(void *arg)
 		outq_def = lookup_dest_q(pkt);
 
 		/* Enqueue the packet for output */
-		odp_queue_enq(outq_def, buf);
+		odp_queue_enq(outq_def, ev);
 
 		/* Print packet counts every once in a while */
 		if (odp_unlikely(pkt_cnt++ % 100000 == 0)) {
diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
index 0fc51e8..a1d0fe4 100644
--- a/example/packet/odp_pktio.c
+++ b/example/packet/odp_pktio.c
@@ -151,7 +151,7 @@  static void *pktio_queue_thread(void *arg)
 	thread_args_t *thr_args;
 	odp_queue_t outq_def;
 	odp_packet_t pkt;
-	odp_buffer_t buf;
+	odp_event_t ev;
 	unsigned long pkt_cnt = 0;
 	unsigned long err_cnt = 0;
 
@@ -175,7 +175,7 @@  static void *pktio_queue_thread(void *arg)
 
 #if 1
 		/* Use schedule to get buf from any input queue */
-		buf = odp_schedule(NULL, ODP_SCHED_WAIT);
+		ev = odp_schedule(NULL, ODP_SCHED_WAIT);
 #else
 		/* Always dequeue from the same input queue */
 		buf = odp_queue_deq(inq_def);
@@ -183,7 +183,7 @@  static void *pktio_queue_thread(void *arg)
 			continue;
 #endif
 
-		pkt = odp_packet_from_buffer(buf);
+		pkt = odp_packet_from_event(ev);
 
 		/* Drop packets with errors */
 		if (odp_unlikely(drop_err_pkts(&pkt, 1) == 0)) {
@@ -204,7 +204,7 @@  static void *pktio_queue_thread(void *arg)
 		swap_pkt_addrs(&pkt, 1);
 
 		/* Enqueue the packet for output */
-		odp_queue_enq(outq_def, buf);
+		odp_queue_enq(outq_def, ev);
 
 		/* Print packet counts every once in a while */
 		if (odp_unlikely(pkt_cnt++ % 100000 == 0)) {
diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c
index fdfe305..49e1451 100644
--- a/example/timer/odp_timer_test.c
+++ b/example/timer/odp_timer_test.c
@@ -114,7 +114,7 @@  static void test_abs_timeouts(int thr, test_args_t *args)
 	tick = odp_timer_current_tick(tp);
 
 	while ((int)odp_atomic_load_u32(&remain) > 0) {
-		odp_buffer_t buf;
+		odp_event_t ev;
 		odp_timer_set_t rc;
 
 		tick += period;
@@ -134,23 +134,23 @@  static void test_abs_timeouts(int thr, test_args_t *args)
 		uint64_t sched_tmo =
 			odp_schedule_wait_time(1500000000ULL);
 		do {
-			buf = odp_schedule(&queue, sched_tmo);
+			ev = odp_schedule(&queue, sched_tmo);
 			/* Check if odp_schedule() timed out, possibly there
 			 * are no remaining timeouts to receive */
-		} while (buf == ODP_BUFFER_INVALID &&
+		} while (ev == ODP_EVENT_INVALID &&
 			 (int)odp_atomic_load_u32(&remain) > 0);
 
-		if (buf == ODP_BUFFER_INVALID)
+		if (ev == ODP_EVENT_INVALID)
 			break; /* No more timeouts */
-		if (odp_buffer_type(buf) != ODP_BUFFER_TYPE_TIMEOUT) {
+		if (odp_event_type(ev) != ODP_EVENT_TIMEOUT) {
 			/* Not a default timeout buffer */
-			EXAMPLE_ABORT("Unexpected buffer type (%u) received\n",
-				      odp_buffer_type(buf));
+			EXAMPLE_ABORT("Unexpected event type (%u) received\n",
+				      odp_event_type(ev));
 		}
-		odp_timeout_t tmo = odp_timeout_from_buf(buf);
+		odp_timeout_t tmo = odp_timeout_from_event(ev);
 		tick = odp_timeout_tick(tmo);
 		ttp = odp_timeout_user_ptr(tmo);
-		ttp->buf = buf;
+		ttp->buf = odp_buffer_from_event(ev);
 		if (!odp_timeout_fresh(tmo)) {
 			/* Not the expected expiration tick, timer has
 			 * been reset or cancelled or freed */
diff --git a/platform/linux-generic/include/api/odp_queue.h b/platform/linux-generic/include/api/odp_queue.h
index b0f7185..3caa7c1 100644
--- a/platform/linux-generic/include/api/odp_queue.h
+++ b/platform/linux-generic/include/api/odp_queue.h
@@ -174,11 +174,11 @@  void *odp_queue_get_context(odp_queue_t queue);
  * Queue enqueue
  *
  * @param queue   Queue handle
- * @param buf     Buffer handle
+ * @param ev      Event handle
  *
  * @return 0 if succesful
  */
-int odp_queue_enq(odp_queue_t queue, odp_buffer_t buf);
+int odp_queue_enq(odp_queue_t queue, odp_event_t ev);
 
 /**
  * Enqueue multiple buffers to a queue
diff --git a/platform/linux-generic/include/api/odp_schedule.h b/platform/linux-generic/include/api/odp_schedule.h
index cdf6705..45fa48c 100644
--- a/platform/linux-generic/include/api/odp_schedule.h
+++ b/platform/linux-generic/include/api/odp_schedule.h
@@ -47,21 +47,21 @@  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
diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c
index 2f95cbe..bee6fe5 100644
--- a/platform/linux-generic/odp_crypto.c
+++ b/platform/linux-generic/odp_crypto.c
@@ -391,7 +391,8 @@  odp_crypto_operation(odp_crypto_op_params_t *params,
 
 	/* If specified during creation post event to completion queue */
 	if (ODP_QUEUE_INVALID != session->compl_queue) {
-		odp_queue_enq(session->compl_queue, completion_event);
+		odp_queue_enq(session->compl_queue,
+			      odp_buffer_to_event(completion_event));
 		*posted = 1;
 	}
 	return 0;
diff --git a/platform/linux-generic/odp_queue.c b/platform/linux-generic/odp_queue.c
index 70c006d..c027f23 100644
--- a/platform/linux-generic/odp_queue.c
+++ b/platform/linux-generic/odp_queue.c
@@ -403,13 +403,13 @@  int odp_queue_enq_multi(odp_queue_t handle, odp_buffer_t buf[], int num)
 }
 
 
-int odp_queue_enq(odp_queue_t handle, odp_buffer_t buf)
+int odp_queue_enq(odp_queue_t handle, odp_event_t ev)
 {
 	odp_buffer_hdr_t *buf_hdr;
 	queue_entry_t *queue;
 
 	queue   = queue_to_qentry(handle);
-	buf_hdr = odp_buf_to_hdr(buf);
+	buf_hdr = odp_buf_to_hdr(odp_buffer_from_event(ev));
 
 	return queue->s.enqueue(queue, buf_hdr);
 }
diff --git a/platform/linux-generic/odp_schedule.c b/platform/linux-generic/odp_schedule.c
index a3bbfb1..90e0484 100644
--- a/platform/linux-generic/odp_schedule.c
+++ b/platform/linux-generic/odp_schedule.c
@@ -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;
 	}
 }
@@ -302,7 +303,7 @@  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;
 				}
@@ -319,7 +320,7 @@  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 */
@@ -372,7 +373,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;
 
@@ -380,7 +381,7 @@  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);
 }
 
 
diff --git a/platform/linux-generic/odp_timer.c b/platform/linux-generic/odp_timer.c
index d926ada..029e8c2 100644
--- a/platform/linux-generic/odp_timer.c
+++ b/platform/linux-generic/odp_timer.c
@@ -567,7 +567,8 @@  static unsigned timer_expire(odp_timer_pool *tp, uint32_t idx, uint64_t tick)
 		}
 		/* Else ignore buffers of other types */
 		/* Post the timeout to the destination queue */
-		int rc = odp_queue_enq(tim->queue, tmo_buf);
+		int rc = odp_queue_enq(tim->queue,
+				       odp_buffer_to_event(tmo_buf));
 		if (odp_unlikely(rc != 0))
 			ODP_ABORT("Failed to enqueue timeout buffer (%d)\n",
 				  rc);
diff --git a/test/performance/odp_scheduling.c b/test/performance/odp_scheduling.c
index bb005d7..09f5db1 100644
--- a/test/performance/odp_scheduling.c
+++ b/test/performance/odp_scheduling.c
@@ -65,14 +65,16 @@  typedef struct {
  */
 static void clear_sched_queues(void)
 {
+	odp_event_t ev;
 	odp_buffer_t buf;
 
 	while (1) {
-		buf = odp_schedule(NULL, ODP_SCHED_NO_WAIT);
+		ev = odp_schedule(NULL, ODP_SCHED_NO_WAIT);
 
-		if (buf == ODP_BUFFER_INVALID)
+		if (ev == ODP_EVENT_INVALID)
 			break;
 
+		buf = odp_buffer_from_event(ev);
 		odp_buffer_free(buf);
 	}
 }
@@ -109,7 +111,7 @@  static int create_queue(int thr, odp_buffer_pool_t msg_pool, int prio)
 		return -1;
 	}
 
-	if (odp_queue_enq(queue, buf)) {
+	if (odp_queue_enq(queue, odp_buffer_to_event(buf))) {
 		LOG_ERR("  [%i] Queue enqueue failed.\n", thr);
 		return -1;
 	}
@@ -156,7 +158,7 @@  static int create_queues(int thr, odp_buffer_pool_t msg_pool, int prio)
 			return -1;
 		}
 
-		if (odp_queue_enq(queue, buf)) {
+		if (odp_queue_enq(queue, odp_buffer_to_event(buf))) {
 			LOG_ERR("  [%i] Queue enqueue failed.\n", thr);
 			return -1;
 		}
@@ -286,7 +288,7 @@  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, buf)) {
+		if (odp_queue_enq(queue, odp_buffer_to_event(buf))) {
 			LOG_ERR("  [%i] Queue enqueue failed.\n", thr);
 			return -1;
 		}
@@ -328,7 +330,7 @@  static int test_schedule_single(const char *str, int thr,
 				odp_buffer_pool_t msg_pool,
 				int prio, odp_barrier_t *barrier)
 {
-	odp_buffer_t buf;
+	odp_event_t ev;
 	odp_queue_t queue;
 	uint64_t t1, t2, cycles, ns;
 	uint32_t i;
@@ -340,9 +342,9 @@  static int test_schedule_single(const char *str, int thr,
 	t1 = odp_time_cycles();
 
 	for (i = 0; i < QUEUE_ROUNDS; i++) {
-		buf = odp_schedule(&queue, ODP_SCHED_WAIT);
+		ev = odp_schedule(&queue, ODP_SCHED_WAIT);
 
-		if (odp_queue_enq(queue, buf)) {
+		if (odp_queue_enq(queue, ev)) {
 			LOG_ERR("  [%i] Queue enqueue failed.\n", thr);
 			return -1;
 		}
@@ -354,14 +356,14 @@  static int test_schedule_single(const char *str, int thr,
 	tot = i;
 
 	while (1) {
-		buf = odp_schedule(&queue, ODP_SCHED_NO_WAIT);
+		ev = odp_schedule(&queue, ODP_SCHED_NO_WAIT);
 
-		if (buf == ODP_BUFFER_INVALID)
+		if (ev == ODP_EVENT_INVALID)
 			break;
 
 		tot++;
 
-		if (odp_queue_enq(queue, buf)) {
+		if (odp_queue_enq(queue, ev)) {
 			LOG_ERR("  [%i] Queue enqueue failed.\n", thr);
 			return -1;
 		}
@@ -404,7 +406,7 @@  static int test_schedule_many(const char *str, int thr,
 			      odp_buffer_pool_t msg_pool,
 			      int prio, odp_barrier_t *barrier)
 {
-	odp_buffer_t buf;
+	odp_event_t ev;
 	odp_queue_t queue;
 	uint64_t t1 = 0;
 	uint64_t t2 = 0;
@@ -419,9 +421,9 @@  static int test_schedule_many(const char *str, int thr,
 	t1 = odp_time_cycles();
 
 	for (i = 0; i < QUEUE_ROUNDS; i++) {
-		buf = odp_schedule(&queue, ODP_SCHED_WAIT);
+		ev = odp_schedule(&queue, ODP_SCHED_WAIT);
 
-		if (odp_queue_enq(queue, buf)) {
+		if (odp_queue_enq(queue, ev)) {
 			LOG_ERR("  [%i] Queue enqueue failed.\n", thr);
 			return -1;
 		}
@@ -433,14 +435,14 @@  static int test_schedule_many(const char *str, int thr,
 	tot = i;
 
 	while (1) {
-		buf = odp_schedule(&queue, ODP_SCHED_NO_WAIT);
+		ev = odp_schedule(&queue, ODP_SCHED_NO_WAIT);
 
-		if (buf == ODP_BUFFER_INVALID)
+		if (ev == ODP_EVENT_INVALID)
 			break;
 
 		tot++;
 
-		if (odp_queue_enq(queue, buf)) {
+		if (odp_queue_enq(queue, ev)) {
 			LOG_ERR("  [%i] Queue enqueue failed.\n", thr);
 			return -1;
 		}
diff --git a/test/validation/odp_pktio.c b/test/validation/odp_pktio.c
index 03e954a..f28969f 100644
--- a/test/validation/odp_pktio.c
+++ b/test/validation/odp_pktio.c
@@ -266,16 +266,19 @@  static odp_packet_t wait_for_packet(odp_queue_t queue,
 				    uint32_t seq, uint64_t ns)
 {
 	uint64_t start, now, diff;
+	odp_event_t ev;
 	odp_buffer_t buf;
 	odp_packet_t pkt = ODP_PACKET_INVALID;
 
 	start = odp_time_cycles();
 
 	do {
-		if (queue != ODP_QUEUE_INVALID)
+		if (queue != ODP_QUEUE_INVALID) {
 			buf = queue_deq_wait_time(queue, ns);
-		else
-			buf = odp_schedule(NULL, ns);
+		} else {
+			ev  = odp_schedule(NULL, ns);
+			buf = odp_buffer_from_event(ev);
+		}
 
 		if (buf != ODP_BUFFER_INVALID &&
 		    odp_buffer_type(buf) == ODP_BUFFER_TYPE_PACKET) {
@@ -326,7 +329,8 @@  static void pktio_txrx_multi(pktio_info_t *pktio_a, pktio_info_t *pktio_b,
 
 	/* send packet(s) out */
 	if (num_pkts == 1)
-		ret = odp_queue_enq(pktio_a->outq, tx_buf[0]);
+		ret = odp_queue_enq(pktio_a->outq,
+				    odp_buffer_to_event(tx_buf[0]));
 	else
 		ret = odp_queue_enq_multi(pktio_a->outq, tx_buf, num_pkts);
 
diff --git a/test/validation/odp_queue.c b/test/validation/odp_queue.c
index 0613fd0..a083c26 100644
--- a/test/validation/odp_queue.c
+++ b/test/validation/odp_queue.c
@@ -68,7 +68,7 @@  static void test_odp_queue_sunnyday(void)
 	msg_pool = odp_buffer_pool_lookup("msg_pool");
 	buf = odp_buffer_alloc(msg_pool);
 
-	odp_queue_enq(queue_id, buf);
+	odp_queue_enq(queue_id, odp_buffer_to_event(buf));
 	CU_ASSERT_EQUAL(buf, odp_queue_deq(queue_id));
 	odp_buffer_free(buf);
 
diff --git a/test/validation/odp_schedule.c b/test/validation/odp_schedule.c
index 159081b..7a9fd1f 100644
--- a/test/validation/odp_schedule.c
+++ b/test/validation/odp_schedule.c
@@ -104,6 +104,7 @@  static void *schedule_common_(void *arg)
 		odp_barrier_wait(&globals->barrier);
 
 	while (1) {
+		odp_event_t ev;
 		odp_buffer_t buf;
 		odp_queue_t from;
 		int num = 0;
@@ -129,7 +130,8 @@  static void *schedule_common_(void *arg)
 			for (j = 0; j < num; j++)
 				odp_buffer_free(bufs[j]);
 		} else {
-			buf = odp_schedule(&from, ODP_SCHED_NO_WAIT);
+			ev  = odp_schedule(&from, ODP_SCHED_NO_WAIT);
+			buf = odp_buffer_from_event(ev);
 			if (buf == ODP_BUFFER_INVALID)
 				continue;
 			num = 1;
@@ -205,9 +207,11 @@  static void fill_queues(thread_args_t *args)
 
 			for (k = 0; k < args->num_bufs; k++) {
 				odp_buffer_t buf;
+				odp_event_t ev;
 				buf = odp_buffer_alloc(pool);
 				CU_ASSERT(buf != ODP_BUFFER_INVALID);
-				CU_ASSERT(odp_queue_enq(queue, buf) == 0);
+				ev = odp_buffer_to_event(buf);
+				CU_ASSERT(odp_queue_enq(queue, ev) == 0);
 			}
 		}
 	}
@@ -465,6 +469,7 @@  static void test_schedule_pause_resume(void)
 {
 	odp_queue_t queue;
 	odp_buffer_t buf;
+	odp_event_t ev;
 	odp_queue_t from;
 	int i;
 	int local_bufs = 0;
@@ -479,23 +484,26 @@  static void test_schedule_pause_resume(void)
 	for (i = 0; i < NUM_BUFS_PAUSE; i++) {
 		buf = odp_buffer_alloc(pool);
 		CU_ASSERT(buf != ODP_BUFFER_INVALID);
-		odp_queue_enq(queue, buf);
+		ev = odp_buffer_to_event(buf);
+		odp_queue_enq(queue, ev);
 	}
 
 	for (i = 0; i < NUM_BUFS_BEFORE_PAUSE; i++) {
-		buf = odp_schedule(&from, ODP_SCHED_NO_WAIT);
+		ev = odp_schedule(&from, ODP_SCHED_NO_WAIT);
 		CU_ASSERT(from == queue);
+		buf = odp_buffer_from_event(ev);
 		odp_buffer_free(buf);
 	}
 
 	odp_schedule_pause();
 
 	while (1) {
-		buf = odp_schedule(&from, ODP_SCHED_NO_WAIT);
-		if (buf == ODP_BUFFER_INVALID)
+		ev = odp_schedule(&from, ODP_SCHED_NO_WAIT);
+		if (ev == ODP_EVENT_INVALID)
 			break;
 
 		CU_ASSERT(from == queue);
+		buf = odp_buffer_from_event(ev);
 		odp_buffer_free(buf);
 		local_bufs++;
 	}
@@ -505,8 +513,9 @@  static void test_schedule_pause_resume(void)
 	odp_schedule_resume();
 
 	for (i = local_bufs + NUM_BUFS_BEFORE_PAUSE; i < NUM_BUFS_PAUSE; i++) {
-		buf = odp_schedule(&from, ODP_SCHED_WAIT);
+		ev = odp_schedule(&from, ODP_SCHED_WAIT);
 		CU_ASSERT(from == queue);
+		buf = odp_buffer_from_event(ev);
 		odp_buffer_free(buf);
 	}
 }