diff mbox

[PATCHv2,5/8] api: queue: switch queues from buffers to events

Message ID 1421816266-31223-6-git-send-email-bill.fischofer@linaro.org
State New
Headers show

Commit Message

Bill Fischofer Jan. 21, 2015, 4:57 a.m. UTC
Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
---
 platform/linux-generic/include/api/odp_queue.h | 32 +++++++++++++-------------
 platform/linux-generic/odp_queue.c             | 18 +++++++--------
 2 files changed, 25 insertions(+), 25 deletions(-)
diff mbox

Patch

diff --git a/platform/linux-generic/include/api/odp_queue.h b/platform/linux-generic/include/api/odp_queue.h
index b0f7185..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.
@@ -174,48 +174,48 @@  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
+ * Enqueue multiple events to a queue
  *
  * @param queue   Queue handle
- * @param buf     Buffer handles
- * @param num     Number of buffer handles
+ * @param ev      Event handles
+ * @param num     Number of event handles
  *
  * @return 0 if succesful
  */
-int odp_queue_enq_multi(odp_queue_t queue, odp_buffer_t buf[], int num);
+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
+ * 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 70c006d..17ff7c1 100644
--- a/platform/linux-generic/odp_queue.c
+++ b/platform/linux-generic/odp_queue.c
@@ -385,7 +385,7 @@  int queue_enq_multi_dummy(queue_entry_t *queue ODP_UNUSED,
 	return -1;
 }
 
-int odp_queue_enq_multi(odp_queue_t handle, odp_buffer_t buf[], int num)
+int odp_queue_enq_multi(odp_queue_t handle, odp_event_t ev[], int num)
 {
 	odp_buffer_hdr_t *buf_hdr[QUEUE_MULTI_MAX];
 	queue_entry_t *queue;
@@ -397,19 +397,19 @@  int odp_queue_enq_multi(odp_queue_t handle, odp_buffer_t buf[], int num)
 	queue = queue_to_qentry(handle);
 
 	for (i = 0; i < num; i++)
-		buf_hdr[i] = odp_buf_to_hdr(buf[i]);
+		buf_hdr[i] = odp_buf_to_hdr(odp_buffer_from_event(ev[i]));
 
 	return queue->s.enqueue_multi(queue, buf_hdr, 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);
 }
@@ -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,13 +508,13 @@  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;
 }
 
 
-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;
 }