diff options
author | Matias Elo <matias.elo@nokia.com> | 2018-09-10 17:08:59 +0300 |
---|---|---|
committer | Matias Elo <matias.elo@nokia.com> | 2018-09-11 15:00:29 +0300 |
commit | a3c03da21f9c17394ad2ae7c38c20b8e00ecb1e0 (patch) | |
tree | d4f8af5b71b089413245e57eccac4b4ebff57dca | |
parent | be628dda790280dc9a4a8e3f0b9c96694f1a13c6 (diff) |
Port 0cf079bb "linux-gen: queue: remove internal queue handle conversions"
Signed-off-by: Matias Elo <matias.elo@nokia.com>
-rw-r--r-- | platform/linux-dpdk/include/odp_packet_internal.h | 2 | ||||
-rw-r--r-- | platform/linux-dpdk/include/odp_packet_io_internal.h | 1 | ||||
-rw-r--r-- | platform/linux-dpdk/odp_queue_basic.c | 89 | ||||
-rw-r--r-- | platform/linux-dpdk/odp_queue_spsc.c | 28 |
4 files changed, 50 insertions, 70 deletions
diff --git a/platform/linux-dpdk/include/odp_packet_internal.h b/platform/linux-dpdk/include/odp_packet_internal.h index baaa2e668..213e292f9 100644 --- a/platform/linux-dpdk/include/odp_packet_internal.h +++ b/platform/linux-dpdk/include/odp_packet_internal.h @@ -115,7 +115,7 @@ typedef struct { odp_time_t timestamp; /* Classifier destination queue */ - void *dst_queue; + odp_queue_t dst_queue; /* Result for crypto packet op */ odp_crypto_packet_result_t crypto_op_result; diff --git a/platform/linux-dpdk/include/odp_packet_io_internal.h b/platform/linux-dpdk/include/odp_packet_io_internal.h index a9a83a489..a6a93ba18 100644 --- a/platform/linux-dpdk/include/odp_packet_io_internal.h +++ b/platform/linux-dpdk/include/odp_packet_io_internal.h @@ -86,7 +86,6 @@ struct pktio_entry { struct { odp_queue_t queue; - void *queue_int; odp_pktin_queue_t pktin; } in_queue[PKTIO_MAX_QUEUES]; diff --git a/platform/linux-dpdk/odp_queue_basic.c b/platform/linux-dpdk/odp_queue_basic.c index 420393086..c579edcfe 100644 --- a/platform/linux-dpdk/odp_queue_basic.c +++ b/platform/linux-dpdk/odp_queue_basic.c @@ -48,11 +48,6 @@ static int queue_init(queue_entry_t *queue, const char *name, queue_global_t *queue_glb; extern _odp_queue_inline_offset_t _odp_queue_inline_offset; -static inline queue_entry_t *qentry_from_handle(odp_queue_t handle) -{ - return (queue_entry_t *)(uintptr_t)handle; -} - static int queue_capa(odp_queue_capability_t *capa, int sched) { memset(capa, 0, sizeof(odp_queue_capability_t)); @@ -457,7 +452,7 @@ static odp_queue_t queue_lookup(const char *name) return ODP_QUEUE_INVALID; } -static inline int enq_multi(void *q_int, odp_buffer_hdr_t *buf_hdr[], +static inline int enq_multi(odp_queue_t handle, odp_buffer_hdr_t *buf_hdr[], int num) { int sched = 0; @@ -465,9 +460,9 @@ static inline int enq_multi(void *q_int, odp_buffer_hdr_t *buf_hdr[], queue_entry_t *queue; int num_enq; - queue = q_int; + queue = qentry_from_handle(handle); - if (sched_fn->ord_enq_multi(q_int, (void **)buf_hdr, num, &ret)) + if (sched_fn->ord_enq_multi(handle, (void **)buf_hdr, num, &ret)) return ret; LOCK(queue); @@ -499,17 +494,17 @@ static inline int enq_multi(void *q_int, odp_buffer_hdr_t *buf_hdr[], return num_enq; } -static int queue_int_enq_multi(void *q_int, odp_buffer_hdr_t *buf_hdr[], +static int queue_int_enq_multi(odp_queue_t handle, odp_buffer_hdr_t *buf_hdr[], int num) { - return enq_multi(q_int, buf_hdr, num); + return enq_multi(handle, buf_hdr, num); } -static int queue_int_enq(void *q_int, odp_buffer_hdr_t *buf_hdr) +static int queue_int_enq(odp_queue_t handle, odp_buffer_hdr_t *buf_hdr) { int ret; - ret = enq_multi(q_int, &buf_hdr, 1); + ret = enq_multi(handle, &buf_hdr, 1); if (ret == 1) return 0; @@ -527,21 +522,24 @@ static int queue_enq_multi(odp_queue_t handle, const odp_event_t ev[], int num) if (num > QUEUE_MULTI_MAX) num = QUEUE_MULTI_MAX; - return queue->s.enqueue_multi(queue, (odp_buffer_hdr_t **)(uintptr_t)ev, - num); + return queue->s.enqueue_multi(handle, + (odp_buffer_hdr_t **)(uintptr_t)ev, num); } static int queue_enq(odp_queue_t handle, odp_event_t ev) { queue_entry_t *queue = qentry_from_handle(handle); - return queue->s.enqueue(queue, (odp_buffer_hdr_t *)(uintptr_t)ev); + return queue->s.enqueue(handle, (odp_buffer_hdr_t *)(uintptr_t)ev); } -static inline int plain_queue_deq(queue_entry_t *queue, +static inline int plain_queue_deq(odp_queue_t handle, odp_buffer_hdr_t *buf_hdr[], int num) { int num_deq; + queue_entry_t *queue; + + queue = qentry_from_handle(handle); LOCK(queue); @@ -558,21 +556,18 @@ static inline int plain_queue_deq(queue_entry_t *queue, return num_deq; } -static int queue_int_deq_multi(void *q_int, odp_buffer_hdr_t *buf_hdr[], +static int queue_int_deq_multi(odp_queue_t handle, odp_buffer_hdr_t *buf_hdr[], int num) { - queue_entry_t *queue = q_int; - - return plain_queue_deq(queue, buf_hdr, num); + return plain_queue_deq(handle, buf_hdr, num); } -static odp_buffer_hdr_t *queue_int_deq(void *q_int) +static odp_buffer_hdr_t *queue_int_deq(odp_queue_t handle) { - queue_entry_t *queue = q_int; odp_buffer_hdr_t *buf_hdr = NULL; int ret; - ret = plain_queue_deq(queue, &buf_hdr, 1); + ret = plain_queue_deq(handle, &buf_hdr, 1); if (ret == 1) return buf_hdr; @@ -587,29 +582,29 @@ static int queue_deq_multi(odp_queue_t handle, odp_event_t ev[], int num) if (num > QUEUE_MULTI_MAX) num = QUEUE_MULTI_MAX; - return queue->s.dequeue_multi(queue, (odp_buffer_hdr_t **)ev, num); + return queue->s.dequeue_multi(handle, (odp_buffer_hdr_t **)ev, num); } static odp_event_t queue_deq(odp_queue_t handle) { queue_entry_t *queue = qentry_from_handle(handle); - return (odp_event_t)queue->s.dequeue(queue); + return (odp_event_t)queue->s.dequeue(handle); } -static int timer_queue_deq_multi(void *q_int, odp_buffer_hdr_t *buf_hdr[], - int num) +static int timer_queue_deq_multi(odp_queue_t handle, + odp_buffer_hdr_t *buf_hdr[], int num) { timer_run(); - return queue_int_deq_multi(q_int, buf_hdr, num); + return queue_int_deq_multi(handle, buf_hdr, num); } -static odp_buffer_hdr_t *timer_queue_deq(void *q_int) +static odp_buffer_hdr_t *timer_queue_deq(odp_queue_t handle) { timer_run(); - return queue_int_deq(q_int); + return queue_int_deq(handle); } /* Enable timer polling on dequeue call */ @@ -815,43 +810,43 @@ static uint64_t queue_to_u64(odp_queue_t hdl) return _odp_pri(hdl); } -static odp_pktout_queue_t queue_get_pktout(void *q_int) +static odp_pktout_queue_t queue_get_pktout(odp_queue_t handle) { - queue_entry_t *qentry = q_int; + queue_entry_t *qentry = qentry_from_handle(handle); return qentry->s.pktout; } -static void queue_set_pktout(void *q_int, odp_pktio_t pktio, int index) +static void queue_set_pktout(odp_queue_t handle, odp_pktio_t pktio, int index) { - queue_entry_t *qentry = q_int; + queue_entry_t *qentry = qentry_from_handle(handle); qentry->s.pktout.pktio = pktio; qentry->s.pktout.index = index; } -static odp_pktin_queue_t queue_get_pktin(void *q_int) +static odp_pktin_queue_t queue_get_pktin(odp_queue_t handle) { - queue_entry_t *qentry = q_int; + queue_entry_t *qentry = qentry_from_handle(handle); return qentry->s.pktin; } -static void queue_set_pktin(void *q_int, odp_pktio_t pktio, int index) +static void queue_set_pktin(odp_queue_t handle, odp_pktio_t pktio, int index) { - queue_entry_t *qentry = q_int; + queue_entry_t *qentry = qentry_from_handle(handle); qentry->s.pktin.pktio = pktio; qentry->s.pktin.index = index; } -static void queue_set_enq_deq_func(void *q_int, +static void queue_set_enq_deq_func(odp_queue_t handle, queue_enq_fn_t enq, queue_enq_multi_fn_t enq_multi, queue_deq_fn_t deq, queue_deq_multi_fn_t deq_multi) { - queue_entry_t *qentry = q_int; + queue_entry_t *qentry = qentry_from_handle(handle); if (enq) qentry->s.enqueue = enq; @@ -866,18 +861,6 @@ static void queue_set_enq_deq_func(void *q_int, qentry->s.dequeue_multi = deq_multi; } -static void *queue_from_ext(odp_queue_t handle) -{ - return qentry_from_handle(handle); -} - -static odp_queue_t queue_to_ext(void *q_int) -{ - queue_entry_t *qentry = q_int; - - return qentry->s.handle; -} - /* API functions */ _odp_queue_api_fn_t queue_basic_api = { .queue_create = queue_create, @@ -905,8 +888,6 @@ queue_fn_t queue_basic_fn = { .term_global = queue_term_global, .init_local = queue_init_local, .term_local = queue_term_local, - .from_ext = queue_from_ext, - .to_ext = queue_to_ext, .enq = queue_int_enq, .enq_multi = queue_int_enq_multi, .deq = queue_int_deq, diff --git a/platform/linux-dpdk/odp_queue_spsc.c b/platform/linux-dpdk/odp_queue_spsc.c index 89915eb9a..ff217df22 100644 --- a/platform/linux-dpdk/odp_queue_spsc.c +++ b/platform/linux-dpdk/odp_queue_spsc.c @@ -9,13 +9,13 @@ #include "config.h" #include <odp_debug_internal.h> -static inline int spsc_enq_multi(void *q_int, odp_buffer_hdr_t *buf_hdr[], - int num) +static inline int spsc_enq_multi(odp_queue_t handle, + odp_buffer_hdr_t *buf_hdr[], int num) { queue_entry_t *queue; ring_spsc_t ring_spsc; - queue = q_int; + queue = qentry_from_handle(handle); ring_spsc = queue->s.ring_spsc; if (odp_unlikely(queue->s.status < QUEUE_STATUS_READY)) { @@ -26,13 +26,13 @@ static inline int spsc_enq_multi(void *q_int, odp_buffer_hdr_t *buf_hdr[], return ring_spsc_enq_multi(ring_spsc, (void **)buf_hdr, num); } -static inline int spsc_deq_multi(void *q_int, odp_buffer_hdr_t *buf_hdr[], - int num) +static inline int spsc_deq_multi(odp_queue_t handle, + odp_buffer_hdr_t *buf_hdr[], int num) { queue_entry_t *queue; ring_spsc_t ring_spsc; - queue = q_int; + queue = qentry_from_handle(handle); ring_spsc = queue->s.ring_spsc; if (odp_unlikely(queue->s.status < QUEUE_STATUS_READY)) { @@ -43,17 +43,17 @@ static inline int spsc_deq_multi(void *q_int, odp_buffer_hdr_t *buf_hdr[], return ring_spsc_deq_multi(ring_spsc, (void **)buf_hdr, num); } -static int queue_spsc_enq_multi(void *q_int, odp_buffer_hdr_t *buf_hdr[], +static int queue_spsc_enq_multi(odp_queue_t handle, odp_buffer_hdr_t *buf_hdr[], int num) { - return spsc_enq_multi(q_int, buf_hdr, num); + return spsc_enq_multi(handle, buf_hdr, num); } -static int queue_spsc_enq(void *q_int, odp_buffer_hdr_t *buf_hdr) +static int queue_spsc_enq(odp_queue_t handle, odp_buffer_hdr_t *buf_hdr) { int ret; - ret = spsc_enq_multi(q_int, &buf_hdr, 1); + ret = spsc_enq_multi(handle, &buf_hdr, 1); if (ret == 1) return 0; @@ -61,18 +61,18 @@ static int queue_spsc_enq(void *q_int, odp_buffer_hdr_t *buf_hdr) return -1; } -static int queue_spsc_deq_multi(void *q_int, odp_buffer_hdr_t *buf_hdr[], +static int queue_spsc_deq_multi(odp_queue_t handle, odp_buffer_hdr_t *buf_hdr[], int num) { - return spsc_deq_multi(q_int, buf_hdr, num); + return spsc_deq_multi(handle, buf_hdr, num); } -static odp_buffer_hdr_t *queue_spsc_deq(void *q_int) +static odp_buffer_hdr_t *queue_spsc_deq(odp_queue_t handle) { odp_buffer_hdr_t *buf_hdr = NULL; int ret; - ret = spsc_deq_multi(q_int, &buf_hdr, 1); + ret = spsc_deq_multi(handle, &buf_hdr, 1); if (ret == 1) return buf_hdr; |