@@ -12,6 +12,7 @@ extern "C" {
#endif
#include <stdint.h>
+#include <odp/api/spec/queue_types.h>
/** @cond _ODP_HIDE_FROM_DOXYGEN_ */
@@ -26,6 +27,31 @@ typedef struct _odp_queue_inline_offset_t {
} _odp_queue_inline_offset_t;
+/* Queue API functions */
+typedef struct {
+ odp_queue_t (*queue_create)(const char *name,
+ const odp_queue_param_t *param);
+ int (*queue_destroy)(odp_queue_t queue);
+ odp_queue_t (*queue_lookup)(const char *name);
+ int (*queue_capability)(odp_queue_capability_t *capa);
+ int (*queue_context_set)(odp_queue_t queue, void *context,
+ uint32_t len);
+ int (*queue_enq)(odp_queue_t queue, odp_event_t ev);
+ int (*queue_enq_multi)(odp_queue_t queue, const odp_event_t events[],
+ int num);
+ odp_event_t (*queue_deq)(odp_queue_t queue);
+ int (*queue_deq_multi)(odp_queue_t queue, odp_event_t events[],
+ int num);
+ odp_queue_type_t (*queue_type)(odp_queue_t queue);
+ odp_schedule_sync_t (*queue_sched_type)(odp_queue_t queue);
+ odp_schedule_prio_t (*queue_sched_prio)(odp_queue_t queue);
+ odp_schedule_group_t (*queue_sched_group)(odp_queue_t queue);
+ uint32_t (*queue_lock_count)(odp_queue_t queue);
+ uint64_t (*queue_to_u64)(odp_queue_t queue);
+ void (*queue_param_init)(odp_queue_param_t *param);
+ int (*queue_info)(odp_queue_t queue, odp_queue_info_t *info);
+} _odp_queue_api_fn_t;
+
/** @endcond */
#ifdef __cplusplus
@@ -12,11 +12,16 @@
/** @cond _ODP_HIDE_FROM_DOXYGEN_ */
extern _odp_queue_inline_offset_t _odp_queue_inline_offset;
+extern const _odp_queue_api_fn_t *_odp_queue_api;
#ifndef _ODP_NO_INLINE
/* Inline functions by default */
#define _ODP_INLINE static inline
- #define odp_queue_context __odp_queue_context
+ #define odp_queue_context __odp_queue_context
+ #define odp_queue_enq __odp_queue_enq
+ #define odp_queue_enq_multi __odp_queue_enq_multi
+ #define odp_queue_deq __odp_queue_deq
+ #define odp_queue_deq_multi __odp_queue_deq_multi
#else
#define _ODP_INLINE
#endif
@@ -31,6 +36,28 @@ _ODP_INLINE void *odp_queue_context(odp_queue_t handle)
return context;
}
+_ODP_INLINE int odp_queue_enq(odp_queue_t queue, odp_event_t ev)
+{
+ return _odp_queue_api->queue_enq(queue, ev);
+}
+
+_ODP_INLINE int odp_queue_enq_multi(odp_queue_t queue,
+ const odp_event_t events[], int num)
+{
+ return _odp_queue_api->queue_enq_multi(queue, events, num);
+}
+
+_ODP_INLINE odp_event_t odp_queue_deq(odp_queue_t queue)
+{
+ return _odp_queue_api->queue_deq(queue);
+}
+
+_ODP_INLINE int odp_queue_deq_multi(odp_queue_t queue,
+ odp_event_t events[], int num)
+{
+ return _odp_queue_api->queue_deq_multi(queue, events, num);
+}
+
/** @endcond */
#endif
@@ -18,31 +18,6 @@ extern "C" {
#define QUEUE_MULTI_MAX CONFIG_BURST_SIZE
-/* Queue API functions */
-typedef struct {
- odp_queue_t (*queue_create)(const char *name,
- const odp_queue_param_t *param);
- int (*queue_destroy)(odp_queue_t queue);
- odp_queue_t (*queue_lookup)(const char *name);
- int (*queue_capability)(odp_queue_capability_t *capa);
- int (*queue_context_set)(odp_queue_t queue, void *context,
- uint32_t len);
- int (*queue_enq)(odp_queue_t queue, odp_event_t ev);
- int (*queue_enq_multi)(odp_queue_t queue, const odp_event_t events[],
- int num);
- odp_event_t (*queue_deq)(odp_queue_t queue);
- int (*queue_deq_multi)(odp_queue_t queue, odp_event_t events[],
- int num);
- odp_queue_type_t (*queue_type)(odp_queue_t queue);
- odp_schedule_sync_t (*queue_sched_type)(odp_queue_t queue);
- odp_schedule_prio_t (*queue_sched_prio)(odp_queue_t queue);
- odp_schedule_group_t (*queue_sched_group)(odp_queue_t queue);
- uint32_t (*queue_lock_count)(odp_queue_t queue);
- uint64_t (*queue_to_u64)(odp_queue_t hdl);
- void (*queue_param_init)(odp_queue_param_t *param);
- int (*queue_info)(odp_queue_t queue, odp_queue_info_t *info);
-} queue_api_t;
-
typedef int (*queue_init_global_fn_t)(void);
typedef int (*queue_term_global_fn_t)(void);
typedef int (*queue_init_local_fn_t)(void);
@@ -902,7 +902,7 @@ static odp_queue_t queue_to_ext(void *q_int)
}
/* API functions */
-queue_api_t queue_basic_api = {
+_odp_queue_api_fn_t queue_basic_api = {
.queue_create = queue_create,
.queue_destroy = queue_destroy,
.queue_lookup = queue_lookup,
@@ -19,101 +19,81 @@
#include <odp/visibility_begin.h>
_odp_queue_inline_offset_t ODP_ALIGNED_CACHE _odp_queue_inline_offset;
+const _odp_queue_api_fn_t *_odp_queue_api;
#include <odp/visibility_end.h>
-extern const queue_api_t queue_scalable_api;
+extern const _odp_queue_api_fn_t queue_scalable_api;
extern const queue_fn_t queue_scalable_fn;
-extern const queue_api_t queue_basic_api;
+extern const _odp_queue_api_fn_t queue_basic_api;
extern const queue_fn_t queue_basic_fn;
-const queue_api_t *queue_api;
const queue_fn_t *queue_fn;
odp_queue_t odp_queue_create(const char *name, const odp_queue_param_t *param)
{
- return queue_api->queue_create(name, param);
+ return _odp_queue_api->queue_create(name, param);
}
int odp_queue_destroy(odp_queue_t queue)
{
- return queue_api->queue_destroy(queue);
+ return _odp_queue_api->queue_destroy(queue);
}
odp_queue_t odp_queue_lookup(const char *name)
{
- return queue_api->queue_lookup(name);
+ return _odp_queue_api->queue_lookup(name);
}
int odp_queue_capability(odp_queue_capability_t *capa)
{
- return queue_api->queue_capability(capa);
+ return _odp_queue_api->queue_capability(capa);
}
int odp_queue_context_set(odp_queue_t queue, void *context, uint32_t len)
{
- return queue_api->queue_context_set(queue, context, len);
-}
-
-int odp_queue_enq(odp_queue_t queue, odp_event_t ev)
-{
- return queue_api->queue_enq(queue, ev);
-}
-
-int odp_queue_enq_multi(odp_queue_t queue, const odp_event_t events[], int num)
-{
- return queue_api->queue_enq_multi(queue, events, num);
-}
-
-odp_event_t odp_queue_deq(odp_queue_t queue)
-{
- return queue_api->queue_deq(queue);
-}
-
-int odp_queue_deq_multi(odp_queue_t queue, odp_event_t events[], int num)
-{
- return queue_api->queue_deq_multi(queue, events, num);
+ return _odp_queue_api->queue_context_set(queue, context, len);
}
odp_queue_type_t odp_queue_type(odp_queue_t queue)
{
- return queue_api->queue_type(queue);
+ return _odp_queue_api->queue_type(queue);
}
odp_schedule_sync_t odp_queue_sched_type(odp_queue_t queue)
{
- return queue_api->queue_sched_type(queue);
+ return _odp_queue_api->queue_sched_type(queue);
}
odp_schedule_prio_t odp_queue_sched_prio(odp_queue_t queue)
{
- return queue_api->queue_sched_prio(queue);
+ return _odp_queue_api->queue_sched_prio(queue);
}
odp_schedule_group_t odp_queue_sched_group(odp_queue_t queue)
{
- return queue_api->queue_sched_group(queue);
+ return _odp_queue_api->queue_sched_group(queue);
}
uint32_t odp_queue_lock_count(odp_queue_t queue)
{
- return queue_api->queue_lock_count(queue);
+ return _odp_queue_api->queue_lock_count(queue);
}
uint64_t odp_queue_to_u64(odp_queue_t hdl)
{
- return queue_api->queue_to_u64(hdl);
+ return _odp_queue_api->queue_to_u64(hdl);
}
void odp_queue_param_init(odp_queue_param_t *param)
{
- return queue_api->queue_param_init(param);
+ return _odp_queue_api->queue_param_init(param);
}
int odp_queue_info(odp_queue_t queue, odp_queue_info_t *info)
{
- return queue_api->queue_info(queue, info);
+ return _odp_queue_api->queue_info(queue, info);
}
int _odp_queue_init_global(void)
@@ -127,10 +107,10 @@ int _odp_queue_init_global(void)
!strcmp(sched, "sp") ||
!strcmp(sched, "iquery")) {
queue_fn = &queue_basic_fn;
- queue_api = &queue_basic_api;
+ _odp_queue_api = &queue_basic_api;
} else if (!strcmp(sched, "scalable")) {
queue_fn = &queue_scalable_fn;
- queue_api = &queue_scalable_api;
+ _odp_queue_api = &queue_scalable_api;
} else {
ODP_ABORT("Unknown scheduler specified via ODP_SCHEDULER\n");
return -1;
@@ -961,7 +961,7 @@ static odp_queue_t queue_to_ext(void *handle)
}
/* API functions */
-queue_api_t queue_scalable_api = {
+_odp_queue_api_fn_t queue_scalable_api = {
.queue_create = queue_create,
.queue_destroy = queue_destroy,
.queue_lookup = queue_lookup,