diff mbox

[v5,05/17] api: event: odp_queue_deq_multi

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

Commit Message

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

Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>
---
 example/ipsec/odp_ipsec_stream.c               | 12 +++++-------
 platform/linux-generic/include/api/odp_queue.h | 14 +++++++-------
 platform/linux-generic/odp_queue.c             |  4 ++--
 platform/linux-generic/odp_schedule.c          |  2 +-
 test/validation/odp_queue.c                    | 12 ++++++------
 5 files changed, 21 insertions(+), 23 deletions(-)
diff mbox

Patch

diff --git a/example/ipsec/odp_ipsec_stream.c b/example/ipsec/odp_ipsec_stream.c
index dc78d77..7e3ad4a 100644
--- a/example/ipsec/odp_ipsec_stream.c
+++ b/example/ipsec/odp_ipsec_stream.c
@@ -518,7 +518,7 @@  bool verify_stream_db_outputs(void)
 		int idx;
 		int count;
 		odp_queue_t queue;
-		odp_buffer_t buf_tbl[LOOP_DEQ_COUNT];
+		odp_event_t ev_tbl[LOOP_DEQ_COUNT];
 
 		queue = query_loopback_db_outq(stream->output.loop);
 
@@ -528,13 +528,11 @@  bool verify_stream_db_outputs(void)
 		for (;;) {
 #if LOOP_DEQ_MULTIPLE
 			count = odp_queue_deq_multi(queue,
-						    buf_tbl,
+						    ev_tbl,
 						    LOOP_DEQ_COUNT);
 #else
-			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;
+			ev_tbl[0] = odp_queue_deq(queue);
+			count = (ev_tbl[0] != ODP_EVENT_INVALID) ? 1 : 0;
 #endif
 			if (!count)
 				break;
@@ -542,7 +540,7 @@  bool verify_stream_db_outputs(void)
 				bool good;
 				odp_packet_t pkt;
 
-				pkt = odp_packet_from_buffer(buf_tbl[idx]);
+				pkt = odp_packet_from_event(ev_tbl[idx]);
 
 				good = verify_ipv4_packet(stream, pkt);
 				if (good)
diff --git a/platform/linux-generic/include/api/odp_queue.h b/platform/linux-generic/include/api/odp_queue.h
index d502f15..fceed4d 100644
--- a/platform/linux-generic/include/api/odp_queue.h
+++ b/platform/linux-generic/include/api/odp_queue.h
@@ -20,7 +20,7 @@  extern "C" {
 
 
 #include <odp_std_types.h>
-#include <odp_buffer.h>
+#include <odp_platform_types.h>
 
 /** @defgroup odp_queue ODP QUEUE
  *  Macros and operation on a queue.
@@ -204,18 +204,18 @@  int odp_queue_enq_multi(odp_queue_t queue, odp_event_t ev[], int num);
 odp_event_t odp_queue_deq(odp_queue_t queue);
 
 /**
- * Dequeue multiple buffers from a queue
+ * Dequeue multiple events from a queue
  *
- * Dequeues multiple buffers from head of the queue. Cannot be used for
+ * Dequeues multiple events from head of the queue. Cannot be used for
  * ODP_QUEUE_TYPE_SCHED type queues (use odp_schedule() instead).
  *
  * @param queue   Queue handle
- * @param buf     Buffer handles for output
- * @param num     Maximum number of buffer handles
+ * @param events  Event handle array for output
+ * @param num     Maximum number of event handles
 
- * @return Number of buffers written (0 ... num)
+ * @return Number of events written (0 ... num)
  */
-int odp_queue_deq_multi(odp_queue_t queue, odp_buffer_t buf[], int num);
+int odp_queue_deq_multi(odp_queue_t queue, odp_event_t events[], int num);
 
 /**
  * Queue type
diff --git a/platform/linux-generic/odp_queue.c b/platform/linux-generic/odp_queue.c
index b77f3d6..17ff7c1 100644
--- a/platform/linux-generic/odp_queue.c
+++ b/platform/linux-generic/odp_queue.c
@@ -494,7 +494,7 @@  int queue_deq_multi_destroy(queue_entry_t *queue,
 	return 0;
 }
 
-int odp_queue_deq_multi(odp_queue_t handle, odp_buffer_t buf[], int num)
+int odp_queue_deq_multi(odp_queue_t handle, odp_event_t events[], int num)
 {
 	queue_entry_t *queue;
 	odp_buffer_hdr_t *buf_hdr[QUEUE_MULTI_MAX];
@@ -508,7 +508,7 @@  int odp_queue_deq_multi(odp_queue_t handle, odp_buffer_t buf[], int num)
 	ret = queue->s.dequeue_multi(queue, buf_hdr, num);
 
 	for (i = 0; i < ret; i++)
-		buf[i] = buf_hdr[i]->handle.handle;
+		events[i] = odp_buffer_to_event(buf_hdr[i]->handle.handle);
 
 	return ret;
 }
diff --git a/platform/linux-generic/odp_schedule.c b/platform/linux-generic/odp_schedule.c
index 81db458..6b2a123 100644
--- a/platform/linux-generic/odp_schedule.c
+++ b/platform/linux-generic/odp_schedule.c
@@ -295,7 +295,7 @@  static int schedule(odp_queue_t *out_queue, odp_buffer_t out_buf[],
 					continue;
 
 				num = odp_queue_deq_multi(queue,
-							  sched_local.buf,
+							  (odp_event_t *)sched_local.buf,
 							  max_deq);
 
 				if (num == 0) {
diff --git a/test/validation/odp_queue.c b/test/validation/odp_queue.c
index 00b8078..07e37ee 100644
--- a/test/validation/odp_queue.c
+++ b/test/validation/odp_queue.c
@@ -36,12 +36,12 @@  static void test_odp_queue_sunnyday(void)
 {
 	odp_queue_t queue_creat_id, queue_id;
 	odp_event_t enev[MAX_BUFFER_QUEUE];
-	odp_buffer_t debuf[MAX_BUFFER_QUEUE];
+	odp_event_t deev[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;
+	odp_event_t *pev_tmp;
 	int i, deq_ret, ret;
 	int nr_deq_entries = 0;
 	int max_iteration = CONFIG_MAX_ITERATION;
@@ -86,19 +86,19 @@  static void test_odp_queue_sunnyday(void)
 	 */
 	ret = odp_queue_enq_multi(queue_id, enev, MAX_BUFFER_QUEUE);
 	CU_ASSERT(0 == ret);
-	pbuf_tmp = debuf;
+	pev_tmp = deev;
 	do {
-		deq_ret  = odp_queue_deq_multi(queue_id, pbuf_tmp,
+		deq_ret  = odp_queue_deq_multi(queue_id, pev_tmp,
 					       MAX_BUFFER_QUEUE);
 		nr_deq_entries += deq_ret;
 		max_iteration--;
-		pbuf_tmp += deq_ret;
+		pev_tmp += deq_ret;
 		CU_ASSERT(max_iteration >= 0);
 	} while (nr_deq_entries < MAX_BUFFER_QUEUE);
 
 	for (i = 0; i < MAX_BUFFER_QUEUE; i++) {
 		odp_buffer_t enbuf = odp_buffer_from_event(enev[i]);
-		CU_ASSERT_EQUAL(enbuf, debuf[i]);
+		CU_ASSERT_EQUAL(enev[i], deev[i]);
 		odp_buffer_free(enbuf);
 	}