@@ -28,11 +28,6 @@ static inline odp_buffer_t buf_from_buf_hdr(odp_buffer_hdr_t *hdr)
return (odp_buffer_t)hdr;
}
-static inline odp_event_t event_from_buf_hdr(odp_buffer_hdr_t *hdr)
-{
- return (odp_event_t)hdr;
-}
-
#ifdef __cplusplus
}
#endif
@@ -479,31 +479,23 @@ int queue_enq(queue_entry_t *queue, odp_buffer_hdr_t *buf_hdr)
int odp_queue_enq_multi(odp_queue_t handle, const odp_event_t ev[], int num)
{
- odp_buffer_hdr_t *buf_hdr[QUEUE_MULTI_MAX];
- queue_entry_t *queue;
- int i;
+ queue_entry_t *queue = queue_to_qentry(handle);
+
+ if (odp_unlikely(num == 0))
+ return 0;
if (num > QUEUE_MULTI_MAX)
num = QUEUE_MULTI_MAX;
- queue = queue_to_qentry(handle);
-
- for (i = 0; i < num; i++)
- buf_hdr[i] = buf_hdl_to_hdr(odp_buffer_from_event(ev[i]));
-
- return num == 0 ? 0 : queue->s.enqueue_multi(queue, buf_hdr,
- num);
+ return queue->s.enqueue_multi(queue, (odp_buffer_hdr_t **)(uintptr_t)ev,
+ num);
}
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 = buf_hdl_to_hdr(odp_buffer_from_event(ev));
+ queue_entry_t *queue = queue_to_qentry(handle);
- return queue->s.enqueue(queue, buf_hdr);
+ return queue->s.enqueue(queue, (odp_buffer_hdr_t *)(uintptr_t)ev);
}
static inline int deq_multi(queue_entry_t *queue, odp_buffer_hdr_t *buf_hdr[],
@@ -596,38 +588,21 @@ odp_buffer_hdr_t *queue_deq(queue_entry_t *queue)
return NULL;
}
-int odp_queue_deq_multi(odp_queue_t handle, odp_event_t events[], int num)
+int odp_queue_deq_multi(odp_queue_t handle, odp_event_t ev[], int num)
{
- queue_entry_t *queue;
- odp_buffer_hdr_t *buf_hdr[QUEUE_MULTI_MAX];
- int i, ret;
+ queue_entry_t *queue = queue_to_qentry(handle);
if (num > QUEUE_MULTI_MAX)
num = QUEUE_MULTI_MAX;
- queue = queue_to_qentry(handle);
-
- ret = queue->s.dequeue_multi(queue, buf_hdr, num);
-
- for (i = 0; i < ret; i++)
- events[i] = event_from_buf_hdr(buf_hdr[i]);
-
- return ret;
+ return queue->s.dequeue_multi(queue, (odp_buffer_hdr_t **)ev, num);
}
-
odp_event_t odp_queue_deq(odp_queue_t handle)
{
- queue_entry_t *queue;
- odp_buffer_hdr_t *buf_hdr;
-
- queue = queue_to_qentry(handle);
- buf_hdr = queue->s.dequeue(queue);
-
- if (buf_hdr)
- return event_from_buf_hdr(buf_hdr);
+ queue_entry_t *queue = queue_to_qentry(handle);
- return ODP_EVENT_INVALID;
+ return (odp_event_t)queue->s.dequeue(queue);
}
void queue_lock(queue_entry_t *queue)
@@ -726,17 +701,9 @@ odp_queue_t sched_cb_queue_handle(uint32_t queue_index)
int sched_cb_queue_deq_multi(uint32_t queue_index, odp_event_t ev[], int num)
{
- int i, ret;
queue_entry_t *qe = get_qentry(queue_index);
- odp_buffer_hdr_t *buf_hdr[num];
- ret = deq_multi(qe, buf_hdr, num);
-
- if (ret > 0)
- for (i = 0; i < ret; i++)
- ev[i] = event_from_buf_hdr(buf_hdr[i]);
-
- return ret;
+ return deq_multi(qe, (odp_buffer_hdr_t **)ev, num);
}
int sched_cb_queue_empty(uint32_t queue_index)
Conversions are not needed as event handles are buffer header pointers. Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org> --- .../linux-generic/include/odp_buffer_inlines.h | 5 -- platform/linux-generic/odp_queue.c | 61 +++++----------------- 2 files changed, 14 insertions(+), 52 deletions(-) -- 2.13.0