From: Brian Brooks <brian.bro...@arm.com> Signed-off-by: Brian Brooks <brian.bro...@arm.com> Reviewed-by: Honnappa Nagarahalli <honnappa.nagaraha...@arm.com> Reviewed-by: Yi He <yi...@linaro.org> --- /** Email created from pull request 166 (brbrooks:cloud-dev) ** https://github.com/Linaro/odp/pull/166 ** Patch: https://github.com/Linaro/odp/pull/166.patch ** Base sha: 344fe21a06ef4273f34c4441edd0caef876517d9 ** Merge commit sha: 45584e110dae85e9ed20736b254a7fdd044e6a76 **/ platform/linux-dpdk/Makefile.am | 2 + platform/linux-generic/Makefile.am | 2 + .../linux-generic/include/odp_schedule_subsystem.h | 77 ++++++++++++++++++++++ platform/linux-generic/schedule/subsystem.c | 19 ++++++ 4 files changed, 100 insertions(+) create mode 100644 platform/linux-generic/include/odp_schedule_subsystem.h create mode 100644 platform/linux-generic/schedule/subsystem.c
diff --git a/platform/linux-dpdk/Makefile.am b/platform/linux-dpdk/Makefile.am index 6e7f0b1d..8b94b7d2 100644 --- a/platform/linux-dpdk/Makefile.am +++ b/platform/linux-dpdk/Makefile.am @@ -203,6 +203,7 @@ noinst_HEADERS = \ ${top_srcdir}/platform/linux-generic/include/odp_queue_if.h \ ${top_srcdir}/platform/linux-generic/include/odp_ring_internal.h \ ${top_srcdir}/platform/linux-generic/include/odp_schedule_if.h \ + ${top_srcdir}/platform/linux-generic/include/odp_schedule_subsystem.h \ ${top_srcdir}/platform/linux-generic/include/odp_sorted_list_internal.h \ ${top_srcdir}/platform/linux-generic/include/odp_shm_internal.h \ ${top_srcdir}/platform/linux-generic/include/odp_time_internal.h \ @@ -254,6 +255,7 @@ __LIB__libodp_dpdk_la_SOURCES = \ ../linux-generic/odp_schedule.c \ ../linux-generic/odp_schedule_if.c \ ../linux-generic/odp_schedule_iquery.c \ + ../linux-generic/schedule/subsystem.c \ ../linux-generic/odp_shared_memory.c \ ../linux-generic/odp_sorted_list.c \ ../linux-generic/odp_spinlock.c \ diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index 3e3e0c22..78e95760 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -203,6 +203,7 @@ noinst_HEADERS = \ ${srcdir}/include/odp_schedule_scalable.h \ ${srcdir}/include/odp_schedule_scalable_config.h \ ${srcdir}/include/odp_schedule_scalable_ordered.h \ + ${srcdir}/include/odp_schedule_subsystem.h \ ${srcdir}/include/odp_sorted_list_internal.h \ ${srcdir}/include/odp_shm_internal.h \ ${srcdir}/include/odp_time_internal.h \ @@ -286,6 +287,7 @@ __LIB__libodp_linux_la_SOURCES = \ odp_schedule_iquery.c \ odp_schedule_scalable.c \ odp_schedule_scalable_ordered.c \ + schedule/subsystem.c \ odp_shared_memory.c \ odp_sorted_list.c \ odp_spinlock.c \ diff --git a/platform/linux-generic/include/odp_schedule_subsystem.h b/platform/linux-generic/include/odp_schedule_subsystem.h new file mode 100644 index 00000000..c3edef63 --- /dev/null +++ b/platform/linux-generic/include/odp_schedule_subsystem.h @@ -0,0 +1,77 @@ +/* Copyright (c) 2017, ARM Limited. All rights reserved. + * + * Copyright (c) 2017, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef ODP_SCHEDULE_SUBSYSTEM_H_ +#define ODP_SCHEDULE_SUBSYSTEM_H_ + +/* API header files */ +#include <odp/api/align.h> +#include <odp/api/schedule.h> + +/* Internal header files */ +#include <odp_module.h> + +#define SCHEDULE_SUBSYSTEM_VERSION 0x00010000UL + +ODP_SUBSYSTEM_DECLARE(schedule); + +ODP_SUBSYSTEM_API(schedule, uint64_t, wait_time, uint64_t ns); +ODP_SUBSYSTEM_API(schedule, odp_event_t, schedule, odp_queue_t *from, + uint64_t wait); +ODP_SUBSYSTEM_API(schedule, int, schedule_multi, odp_queue_t *from, + uint64_t wait, odp_event_t events[], int num); +ODP_SUBSYSTEM_API(schedule, void, schedule_pause, void); +ODP_SUBSYSTEM_API(schedule, void, schedule_resume, void); +ODP_SUBSYSTEM_API(schedule, void, schedule_release_atomic, void); +ODP_SUBSYSTEM_API(schedule, void, schedule_release_ordered, void); +ODP_SUBSYSTEM_API(schedule, void, schedule_prefetch, int num); +ODP_SUBSYSTEM_API(schedule, int, schedule_num_prio, void); +ODP_SUBSYSTEM_API(schedule, odp_schedule_group_t, schedule_group_create, + const char *name, const odp_thrmask_t *mask); +ODP_SUBSYSTEM_API(schedule, int, schedule_group_destroy, + odp_schedule_group_t group); +ODP_SUBSYSTEM_API(schedule, odp_schedule_group_t, schedule_group_lookup, + const char *name); +ODP_SUBSYSTEM_API(schedule, int, schedule_group_join, + odp_schedule_group_t group, const odp_thrmask_t *mask); +ODP_SUBSYSTEM_API(schedule, int, schedule_group_leave, + odp_schedule_group_t group, const odp_thrmask_t *mask); +ODP_SUBSYSTEM_API(schedule, int, schedule_group_thrmask, + odp_schedule_group_t group, odp_thrmask_t *thrmask); +ODP_SUBSYSTEM_API(schedule, int, schedule_group_info, + odp_schedule_group_t group, odp_schedule_group_info_t *info); +ODP_SUBSYSTEM_API(schedule, void, schedule_order_lock, unsigned lock_index); +ODP_SUBSYSTEM_API(schedule, void, schedule_order_unlock, unsigned lock_index); + +typedef ODP_MODULE_CLASS(schedule) { + odp_module_base_t base; + /* Called from CP threads */ + odp_api_proto(schedule, schedule_group_create) schedule_group_create; + odp_api_proto(schedule, schedule_group_destroy) schedule_group_destroy; + odp_api_proto(schedule, schedule_group_lookup) schedule_group_lookup; + odp_api_proto(schedule, schedule_group_join) schedule_group_join; + odp_api_proto(schedule, schedule_group_leave) schedule_group_leave; + odp_api_proto(schedule, schedule_group_thrmask) schedule_group_thrmask; + odp_api_proto(schedule, schedule_group_info) schedule_group_info; + odp_api_proto(schedule, schedule_num_prio) schedule_num_prio; + /* Called from DP threads */ + odp_api_proto(schedule, schedule) schedule ODP_ALIGNED_CACHE; + odp_api_proto(schedule, schedule_multi) schedule_multi; + odp_api_proto(schedule, schedule_prefetch) schedule_prefetch; + odp_api_proto(schedule, schedule_order_lock) schedule_order_lock; + odp_api_proto(schedule, schedule_order_unlock) schedule_order_unlock; + odp_api_proto(schedule, schedule_release_atomic) + schedule_release_atomic; + odp_api_proto(schedule, schedule_release_ordered) + schedule_release_ordered; + odp_api_proto(schedule, wait_time) wait_time; + odp_api_proto(schedule, schedule_pause) schedule_pause; + odp_api_proto(schedule, schedule_resume) schedule_resume; +} odp_schedule_module_t; + +#endif /* ODP_SCHEDULE_SUBSYSTEM_H_ */ diff --git a/platform/linux-generic/schedule/subsystem.c b/platform/linux-generic/schedule/subsystem.c new file mode 100644 index 00000000..ae2bf3fd --- /dev/null +++ b/platform/linux-generic/schedule/subsystem.c @@ -0,0 +1,19 @@ +/* Copyright (c) 2017, ARM Limited. All rights reserved. + * + * Copyright (c) 2017, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/* Internal header files */ +#include <odp_module.h> +#include <odp_schedule_subsystem.h> + +ODP_SUBSYSTEM_DEFINE(schedule, "schedule public APIs", + SCHEDULE_SUBSYSTEM_VERSION); + +ODP_SUBSYSTEM_CONSTRUCTOR(schedule) +{ + odp_subsystem_constructor(schedule); +}