diff mbox

[04/15] api: event: odp_queue_deq

Message ID 1421336423-19382-5-git-send-email-petri.savolainen@linaro.org
State New
Headers show

Commit Message

Petri Savolainen Jan. 15, 2015, 3:40 p.m. UTC
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 +++++++--
 5 files changed, 19 insertions(+), 10 deletions(-)
diff mbox

Patch

diff --git a/example/ipsec/odp_ipsec_stream.c b/example/ipsec/odp_ipsec_stream.c
index 8900483..dc78d77 100644
--- a/example/ipsec/odp_ipsec_stream.c
+++ b/example/ipsec/odp_ipsec_stream.c
@@ -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)
diff --git a/platform/linux-generic/include/api/odp_queue.h b/platform/linux-generic/include/api/odp_queue.h
index b770270..51ea16b 100644
--- a/platform/linux-generic/include/api/odp_queue.h
+++ b/platform/linux-generic/include/api/odp_queue.h
@@ -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
diff --git a/platform/linux-generic/odp_queue.c b/platform/linux-generic/odp_queue.c
index f3046e2..b77f3d6 100644
--- a/platform/linux-generic/odp_queue.c
+++ b/platform/linux-generic/odp_queue.c
@@ -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;
 }
 
 
diff --git a/platform/linux-generic/odp_schedule.c b/platform/linux-generic/odp_schedule.c
index 1e54fd2..e5e7ae3 100644
--- a/platform/linux-generic/odp_schedule.c
+++ b/platform/linux-generic/odp_schedule.c
@@ -267,6 +267,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 +277,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;
diff --git a/test/performance/odp_scheduling.c b/test/performance/odp_scheduling.c
index ebf0609..e12da56 100644
--- a/test/performance/odp_scheduling.c
+++ b/test/performance/odp_scheduling.c
@@ -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);