New file is used to avoid include loop between queue and scheduler api. Both include the new file.
Signed-off-by: Petri Savolainen <petri.savolai...@nokia.com> --- include/odp/api/queue.h | 93 +--------------- include/odp/api/schedule.h | 3 +- include/odp/api/schedule_types.h | 122 +++++++++++++++++++++ platform/linux-generic/Makefile.am | 2 + .../linux-generic/include/odp/plat/queue_types.h | 21 ---- .../include/odp/plat/schedule_types.h | 20 ++++ .../linux-generic/include/odp/schedule_types.h | 28 +++++ 7 files changed, 176 insertions(+), 113 deletions(-) create mode 100644 include/odp/api/schedule_types.h create mode 100644 platform/linux-generic/include/odp/schedule_types.h diff --git a/include/odp/api/queue.h b/include/odp/api/queue.h index bdc93e7..f4b9a44 100644 --- a/include/odp/api/queue.h +++ b/include/odp/api/queue.h @@ -18,6 +18,8 @@ extern "C" { #endif +#include <odp/schedule_types.h> +#include <odp/event.h> /** @defgroup odp_queue ODP QUEUE * Macros and operation on a queue. @@ -44,7 +46,6 @@ extern "C" { * Maximum queue name length in chars */ - /** * @typedef odp_queue_type_t * ODP queue type @@ -71,96 +72,6 @@ extern "C" { */ /** - * @typedef odp_schedule_prio_t - * Scheduler priority level - */ - -/** - * @def ODP_SCHED_PRIO_HIGHEST - * Highest scheduling priority - */ - -/** - * @def ODP_SCHED_PRIO_NORMAL - * Normal scheduling priority - */ - -/** - * @def ODP_SCHED_PRIO_LOWEST - * Lowest scheduling priority - */ - -/** - * @def ODP_SCHED_PRIO_DEFAULT - * Default scheduling priority. User does not care about the selected priority - * level - throughput, load balacing and synchronization features are more - * important than priority scheduling. - */ - -/** - * @typedef odp_schedule_sync_t - * Scheduler synchronization method - */ - -/** - * @def ODP_SCHED_SYNC_NONE - * Queue not synchronised - * - * The scheduler does not provide event synchronization or ordering, only load - * balancing. Events can be scheduled freely to multiple threads for concurrent - * processing. - */ - -/** - * @def ODP_SCHED_SYNC_ATOMIC - * Atomic queue synchronization - * - * Events from an atomic queue can be scheduled only to a single thread at a - * time. The thread is guaranteed to have exclusive (atomic) access to the - * associated queue context and event ordering is maintained. This enables the - * user to avoid SW synchronization for those two. - * - * The atomic queue is dedicated to the thread until it requests another event - * from the scheduler (which implicitly releases the queue) or calls - * odp_schedule_release_atomic(), which allows the scheduler to release the - * queue immediately. - */ - -/** - * @def ODP_SCHED_SYNC_ORDERED - * Ordered queue synchronization - * - * Events from an ordered queue can be scheduled to multiple threads for - * concurrent processing. The source queue (dequeue) ordering is maintained when - * events are enqueued to their destination queue(s) before another schedule - * call. Events from the same (source) queue appear in their original order - * when dequeued from a destination queue. The destination queue can have any - * queue type and synchronization method. - */ - -/** - * @typedef odp_schedule_group_t - * Scheduler thread group - */ - -/** - * @def ODP_SCHED_GROUP_ALL - * Group of all threads. All active worker and control threads belong to this - * group. The group is automatically updated when new threads enter or old - * threads exit ODP. - */ - -/** Scheduler parameters */ -typedef struct odp_schedule_param_t { - /** Priority level */ - odp_schedule_prio_t prio; - /** Synchronization method */ - odp_schedule_sync_t sync; - /** Thread group */ - odp_schedule_group_t group; -} odp_schedule_param_t; - -/** * ODP Queue parameters */ typedef struct odp_queue_param_t { diff --git a/include/odp/api/schedule.h b/include/odp/api/schedule.h index 3bf0578..b511fce 100644 --- a/include/odp/api/schedule.h +++ b/include/odp/api/schedule.h @@ -20,8 +20,9 @@ extern "C" { #include <odp/std_types.h> -#include <odp/buffer.h> +#include <odp/event.h> #include <odp/queue.h> +#include <odp/schedule_types.h> /** @defgroup odp_scheduler ODP SCHEDULER * Operations on the scheduler. diff --git a/include/odp/api/schedule_types.h b/include/odp/api/schedule_types.h new file mode 100644 index 0000000..3320ee1 --- /dev/null +++ b/include/odp/api/schedule_types.h @@ -0,0 +1,122 @@ +/* Copyright (c) 2015, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/** + * @file + * + * ODP schedule types + */ + +#ifndef ODP_API_SCHEDULE_TYPES_H_ +#define ODP_API_SCHEDULE_TYPES_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/** @addtogroup odp_scheduler + * @{ + */ + +/** + * @typedef odp_schedule_prio_t + * Scheduler priority level + */ + +/** + * @def ODP_SCHED_PRIO_HIGHEST + * Highest scheduling priority + */ + +/** + * @def ODP_SCHED_PRIO_NORMAL + * Normal scheduling priority + */ + +/** + * @def ODP_SCHED_PRIO_LOWEST + * Lowest scheduling priority + */ + +/** + * @def ODP_SCHED_PRIO_DEFAULT + * Default scheduling priority. User does not care about the selected priority + * level - throughput, load balacing and synchronization features are more + * important than priority scheduling. + */ + +/** + * @typedef odp_schedule_sync_t + * Scheduler synchronization method + */ + +/** + * @def ODP_SCHED_SYNC_NONE + * Queue not synchronised + * + * The scheduler does not provide event synchronization or ordering, only load + * balancing. Events can be scheduled freely to multiple threads for concurrent + * processing. + */ + +/** + * @def ODP_SCHED_SYNC_ATOMIC + * Atomic queue synchronization + * + * Events from an atomic queue can be scheduled only to a single thread at a + * time. The thread is guaranteed to have exclusive (atomic) access to the + * associated queue context and event ordering is maintained. This enables the + * user to avoid SW synchronization for those two. + * + * The atomic queue is dedicated to the thread until it requests another event + * from the scheduler (which implicitly releases the queue) or calls + * odp_schedule_release_atomic(), which allows the scheduler to release the + * queue immediately. + */ + +/** + * @def ODP_SCHED_SYNC_ORDERED + * Ordered queue synchronization + * + * Events from an ordered queue can be scheduled to multiple threads for + * concurrent processing. The source queue (dequeue) ordering is maintained when + * events are enqueued to their destination queue(s) before another schedule + * call. Events from the same (source) queue appear in their original order + * when dequeued from a destination queue. The destination queue can have any + * queue type and synchronization method. + */ + +/** + * @typedef odp_schedule_group_t + * Scheduler thread group + */ + +/** + * @def ODP_SCHED_GROUP_ALL + * Group of all threads. All active worker and control threads belong to this + * group. The group is automatically updated when new threads enter or old + * threads exit ODP. + */ + +/** Scheduler parameters */ +typedef struct odp_schedule_param_t { + /** Priority level */ + odp_schedule_prio_t prio; + /** Synchronization method */ + odp_schedule_sync_t sync; + /** Thread group */ + odp_schedule_group_t group; +} odp_schedule_param_t; + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index 65a1bbf..f78a868 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -34,6 +34,7 @@ odpinclude_HEADERS = \ $(top_srcdir)/platform/linux-generic/include/odp/random.h \ $(top_srcdir)/platform/linux-generic/include/odp/rwlock.h \ $(top_srcdir)/platform/linux-generic/include/odp/schedule.h \ + $(top_srcdir)/platform/linux-generic/include/odp/schedule_types.h \ $(top_srcdir)/platform/linux-generic/include/odp/shared_memory.h \ $(top_srcdir)/platform/linux-generic/include/odp/spinlock.h \ $(top_srcdir)/platform/linux-generic/include/odp/std_types.h \ @@ -96,6 +97,7 @@ odpapiinclude_HEADERS = \ $(top_srcdir)/include/odp/api/random.h \ $(top_srcdir)/include/odp/api/rwlock.h \ $(top_srcdir)/include/odp/api/schedule.h \ + $(top_srcdir)/include/odp/api/schedule_types.h \ $(top_srcdir)/include/odp/api/shared_memory.h \ $(top_srcdir)/include/odp/api/spinlock.h \ $(top_srcdir)/include/odp/api/std_types.h \ diff --git a/platform/linux-generic/include/odp/plat/queue_types.h b/platform/linux-generic/include/odp/plat/queue_types.h index 7ab19e6..a7df155 100644 --- a/platform/linux-generic/include/odp/plat/queue_types.h +++ b/platform/linux-generic/include/odp/plat/queue_types.h @@ -41,27 +41,6 @@ typedef int odp_queue_type_t; #define ODP_QUEUE_TYPE_PKTIN 2 #define ODP_QUEUE_TYPE_PKTOUT 3 -typedef int odp_schedule_prio_t; - -#define ODP_SCHED_PRIO_HIGHEST 0 - -#define ODP_SCHED_PRIO_NORMAL (ODP_CONFIG_SCHED_PRIOS / 2) - -#define ODP_SCHED_PRIO_LOWEST (ODP_CONFIG_SCHED_PRIOS - 1) - -#define ODP_SCHED_PRIO_DEFAULT ODP_SCHED_PRIO_NORMAL - - -typedef int odp_schedule_sync_t; - -#define ODP_SCHED_SYNC_NONE 0 -#define ODP_SCHED_SYNC_ATOMIC 1 -#define ODP_SCHED_SYNC_ORDERED 2 - -typedef int odp_schedule_group_t; - -#define ODP_SCHED_GROUP_ALL 0 - /** Get printable format of odp_queue_t */ static inline uint64_t odp_queue_to_u64(odp_queue_t hdl) { diff --git a/platform/linux-generic/include/odp/plat/schedule_types.h b/platform/linux-generic/include/odp/plat/schedule_types.h index 43c3b54..9f1c197 100644 --- a/platform/linux-generic/include/odp/plat/schedule_types.h +++ b/platform/linux-generic/include/odp/plat/schedule_types.h @@ -25,6 +25,26 @@ extern "C" { #define ODP_SCHED_WAIT 0 #define ODP_SCHED_NO_WAIT 1 +typedef int odp_schedule_prio_t; + +#define ODP_SCHED_PRIO_HIGHEST 0 + +#define ODP_SCHED_PRIO_NORMAL (ODP_CONFIG_SCHED_PRIOS / 2) + +#define ODP_SCHED_PRIO_LOWEST (ODP_CONFIG_SCHED_PRIOS - 1) + +#define ODP_SCHED_PRIO_DEFAULT ODP_SCHED_PRIO_NORMAL + +typedef int odp_schedule_sync_t; + +#define ODP_SCHED_SYNC_NONE 0 +#define ODP_SCHED_SYNC_ATOMIC 1 +#define ODP_SCHED_SYNC_ORDERED 2 + +typedef int odp_schedule_group_t; + +#define ODP_SCHED_GROUP_ALL 0 + /** * @} */ diff --git a/platform/linux-generic/include/odp/schedule_types.h b/platform/linux-generic/include/odp/schedule_types.h new file mode 100644 index 0000000..784ed85 --- /dev/null +++ b/platform/linux-generic/include/odp/schedule_types.h @@ -0,0 +1,28 @@ +/* Copyright (c) 2013, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/** + * @file + * + * ODP schedule + */ + +#ifndef ODP_PLAT_SCHEDULE_TYPES_H_ +#define ODP_PLAT_SCHEDULE_TYPES_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <odp/plat/schedule_types.h> + +#include <odp/api/schedule_types.h> + +#ifdef __cplusplus +} +#endif + +#endif -- 2.4.5 _______________________________________________ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp