Moved scheduler parameters into separate header file, so that both queue and packet io API can refer those.
Signed-off-by: Petri Savolainen <[email protected]> --- include/odp/api/queue.h | 94 +------------- include/odp/api/schedule.h | 12 +- include/odp/api/schedule_types.h | 141 +++++++++++++++++++++ platform/linux-generic/Makefile.am | 2 + .../linux-generic/include/odp/plat/queue_types.h | 25 ---- .../include/odp/plat/schedule_types.h | 20 +++ platform/linux-generic/include/odp/schedule.h | 1 + .../linux-generic/include/odp/schedule_types.h | 28 ++++ 8 files changed, 195 insertions(+), 128 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 6a8b15f..920b9d4 100644 --- a/include/odp/api/queue.h +++ b/include/odp/api/queue.h @@ -18,6 +18,7 @@ extern "C" { #endif +#include <odp/schedule_types.h> /** @defgroup odp_queue ODP QUEUE * Macros and operation on a queue. @@ -71,102 +72,11 @@ extern "C" { */ /** - * @typedef odp_schedule_prio_t - * ODP schedule priority - */ - -/** - * @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 - */ - - -/** - * @typedef odp_schedule_sync_t - * ODP schedule synchronisation - */ - -/** - * @def ODP_SCHED_SYNC_NONE - * Queue not synchronised - * - * The scheduler does not provide event synchronisation or ordering, only load - * balancing. Events can be scheduled freely to multiple threads for concurrent - * processing. - */ - -/** - * @def ODP_SCHED_SYNC_ATOMIC - * Atomic queue synchronisation - * - * 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 synchronisation 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 synchronisation - * - * 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 synchronisation method. - */ - -/** - * @def ODP_SCHED_SYNC_DEFAULT - * Default queue synchronisation - */ - -/** - * @typedef odp_schedule_group_t - * ODP schedule core group - */ - -/** - * @def ODP_SCHED_GROUP_ALL - * Group of all cores - */ - -/** - * @def ODP_SCHED_GROUP_DEFAULT - * Default core group - */ - -/** * ODP Queue parameters */ typedef struct odp_queue_param_t { /** Scheduler parameters */ - struct { - odp_schedule_prio_t prio; - odp_schedule_sync_t sync; - odp_schedule_group_t group; - } sched; + odp_schedule_param_t sched; /** Queue context */ void *context; } odp_queue_param_t; diff --git a/include/odp/api/schedule.h b/include/odp/api/schedule.h index 3bf0578..b23afa7 100644 --- a/include/odp/api/schedule.h +++ b/include/odp/api/schedule.h @@ -20,7 +20,7 @@ extern "C" { #include <odp/std_types.h> -#include <odp/buffer.h> +#include <odp/event.h> #include <odp/queue.h> /** @defgroup odp_scheduler ODP SCHEDULER @@ -29,16 +29,6 @@ extern "C" { */ /** - * @def ODP_SCHED_WAIT - * Wait infinitely - */ - -/** - * @def ODP_SCHED_NO_WAIT - * Do not wait - */ - -/** * Schedule wait time * * Converts nanoseconds to wait values for other schedule functions. diff --git a/include/odp/api/schedule_types.h b/include/odp/api/schedule_types.h new file mode 100644 index 0000000..6d6dee7 --- /dev/null +++ b/include/odp/api/schedule_types.h @@ -0,0 +1,141 @@ +/* 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 + * ODP schedule priority + */ + +/** + * @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 + */ + + +/** + * @typedef odp_schedule_sync_t + * ODP schedule synchronisation + */ + +/** + * @def ODP_SCHED_SYNC_NONE + * Queue not synchronised + * + * The scheduler does not provide event synchronisation or ordering, only load + * balancing. Events can be scheduled freely to multiple threads for concurrent + * processing. + */ + +/** + * @def ODP_SCHED_SYNC_ATOMIC + * Atomic queue synchronisation + * + * 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 synchronisation 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 synchronisation + * + * 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 synchronisation method. + */ + +/** + * @def ODP_SCHED_SYNC_DEFAULT + * Default queue synchronisation + */ + +/** + * @typedef odp_schedule_group_t + * ODP schedule core group + */ + +/** + * @def ODP_SCHED_GROUP_ALL + * Group of all cores + */ + +/** + * @def ODP_SCHED_GROUP_DEFAULT + * Default core group + */ + +/** + * @def ODP_SCHED_WAIT + * Wait infinitely + */ + +/** + * @def ODP_SCHED_NO_WAIT + * Do not wait + */ + +/** + * Scheduler parameters + */ +typedef struct odp_schedule_param_t { + odp_schedule_prio_t prio; /**< Priority */ + odp_schedule_sync_t sync; /**< Synchronisation mode */ + odp_schedule_group_t group; /**< Schedule group */ +} odp_schedule_param_t; + + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index e5558ac..39c88ed 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 \ @@ -94,6 +95,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 1cecc90..a7df155 100644 --- a/platform/linux-generic/include/odp/plat/queue_types.h +++ b/platform/linux-generic/include/odp/plat/queue_types.h @@ -41,31 +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 - -#define ODP_SCHED_SYNC_DEFAULT ODP_SCHED_SYNC_ATOMIC - -typedef int odp_schedule_group_t; - -#define ODP_SCHED_GROUP_ALL 0 - -#define ODP_SCHED_GROUP_DEFAULT ODP_SCHED_GROUP_ALL - /** 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..fe4060c 100644 --- a/platform/linux-generic/include/odp/plat/schedule_types.h +++ b/platform/linux-generic/include/odp/plat/schedule_types.h @@ -22,6 +22,26 @@ extern "C" { * @{ */ +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 +#define ODP_SCHED_SYNC_DEFAULT ODP_SCHED_SYNC_ATOMIC + +typedef int odp_schedule_group_t; + +#define ODP_SCHED_GROUP_ALL 0 +#define ODP_SCHED_GROUP_DEFAULT ODP_SCHED_GROUP_ALL + + #define ODP_SCHED_WAIT 0 #define ODP_SCHED_NO_WAIT 1 diff --git a/platform/linux-generic/include/odp/schedule.h b/platform/linux-generic/include/odp/schedule.h index cb4ac2f..9c9a1d2 100644 --- a/platform/linux-generic/include/odp/schedule.h +++ b/platform/linux-generic/include/odp/schedule.h @@ -27,6 +27,7 @@ extern "C" { * @} */ +#include <odp/api/schedule_types.h> #include <odp/api/schedule.h> #ifdef __cplusplus 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..6656c8c --- /dev/null +++ b/platform/linux-generic/include/odp/schedule_types.h @@ -0,0 +1,28 @@ +/* Copyright (c) 2015, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/** + * @file + * + * ODP schedule types + */ + +#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.3.4 _______________________________________________ lng-odp mailing list [email protected] https://lists.linaro.org/mailman/listinfo/lng-odp
