This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "".
The branch, cloud-dev has been updated via a1f50ad720e11a54b13c4786cad4687cb5c4ec2a (commit) via 4a81959d49847df03aa11acb7bddefe78e238116 (commit) via 183376f96550b24b6601c7e07afe3eed4fe188d6 (commit) from 344fe21a06ef4273f34c4441edd0caef876517d9 (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- commit a1f50ad720e11a54b13c4786cad4687cb5c4ec2a Author: Brian Brooks brian.brooks@arm.com Date: Fri Sep 1 12:53:32 2017 -0500
linux-gen: cleanup internal schedule interface
Signed-off-by: Brian Brooks brian.brooks@arm.com Reviewed-by: Ola Liljedahl ola.liljedahl@arm.com Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Yi He yi.he@linaro.org
diff --git a/platform/linux-dpdk/include/odp_packet_io_internal.h b/platform/linux-dpdk/include/odp_packet_io_internal.h index 8e158dc9..14b6a8d3 100644 --- a/platform/linux-dpdk/include/odp_packet_io_internal.h +++ b/platform/linux-dpdk/include/odp_packet_io_internal.h @@ -207,6 +207,9 @@ extern const pktio_if_ops_t loopback_pktio_ops; extern const pktio_if_ops_t dpdk_pktio_ops; extern const pktio_if_ops_t * const pktio_if_ops[];
+int pktin_poll(int pktio_index, int num_queue, int index[]); +void pktio_stop_finalize(int pktio_index); + #ifdef __cplusplus } #endif diff --git a/platform/linux-generic/include/odp_packet_io_internal.h b/platform/linux-generic/include/odp_packet_io_internal.h index 1a4e345f..dc049f46 100644 --- a/platform/linux-generic/include/odp_packet_io_internal.h +++ b/platform/linux-generic/include/odp_packet_io_internal.h @@ -271,6 +271,9 @@ int sock_stats_fd(pktio_entry_t *pktio_entry, int fd); int sock_stats_reset_fd(pktio_entry_t *pktio_entry, int fd);
+int pktin_poll(int pktio_index, int num_queue, int index[]); +void pktio_stop_finalize(int pktio_index); + #ifdef __cplusplus } #endif diff --git a/platform/linux-generic/include/odp_queue_internal.h b/platform/linux-generic/include/odp_queue_internal.h index dd846d59..a1b2a73d 100644 --- a/platform/linux-generic/include/odp_queue_internal.h +++ b/platform/linux-generic/include/odp_queue_internal.h @@ -76,6 +76,11 @@ static inline queue_t qentry_to_int(queue_entry_t *qentry) return (queue_t)(qentry); }
+odp_queue_t queue_handle(uint32_t queue_index); +void queue_destroy_finalize(uint32_t queue_index); +int queue_idx_deq_multi(uint32_t queue_index, odp_event_t ev[], int num); +int queue_empty(uint32_t queue_index); + #ifdef __cplusplus } #endif diff --git a/platform/linux-generic/include/odp_schedule_if.h b/platform/linux-generic/include/odp_schedule_if.h index 2bcf23f2..8f39eec1 100644 --- a/platform/linux-generic/include/odp_schedule_if.h +++ b/platform/linux-generic/include/odp_schedule_if.h @@ -7,64 +7,31 @@ #ifndef ODP_SCHEDULE_IF_H_ #define ODP_SCHEDULE_IF_H_
-#ifdef __cplusplus -extern "C" { -#endif - #include <odp/api/queue.h> #include <odp_queue_if.h> #include <odp/api/schedule.h>
-typedef void (*schedule_pktio_start_fn_t)(int pktio_index, int num_in_queue, - int in_queue_idx[]); -typedef int (*schedule_thr_add_fn_t)(odp_schedule_group_t group, int thr); -typedef int (*schedule_thr_rem_fn_t)(odp_schedule_group_t group, int thr); -typedef int (*schedule_num_grps_fn_t)(void); -typedef int (*schedule_init_queue_fn_t)( - uint32_t queue_index, const odp_schedule_param_t *sched_param); -typedef void (*schedule_destroy_queue_fn_t)(uint32_t queue_index); -typedef int (*schedule_sched_queue_fn_t)(uint32_t queue_index); -typedef int (*schedule_unsched_queue_fn_t)(uint32_t queue_index); -typedef int (*schedule_ord_enq_multi_fn_t)(queue_t q_int, - void *buf_hdr[], int num, int *ret); -typedef void (*schedule_order_lock_fn_t)(void); -typedef void (*schedule_order_unlock_fn_t)(void); -typedef unsigned (*schedule_max_ordered_locks_fn_t)(void); -typedef void (*schedule_save_context_fn_t)(uint32_t queue_index); - typedef struct schedule_fn_t { - int status_sync; - schedule_pktio_start_fn_t pktio_start; - schedule_thr_add_fn_t thr_add; - schedule_thr_rem_fn_t thr_rem; - schedule_num_grps_fn_t num_grps; - schedule_init_queue_fn_t init_queue; - schedule_destroy_queue_fn_t destroy_queue; - schedule_sched_queue_fn_t sched_queue; - schedule_ord_enq_multi_fn_t ord_enq_multi; - schedule_order_lock_fn_t order_lock; - schedule_order_unlock_fn_t order_unlock; - schedule_max_ordered_locks_fn_t max_ordered_locks; + int status_sync; + void (*pktio_start)(int pktio_index, int num_in_queue, + int in_queue_idx[]); + int (*thr_add)(odp_schedule_group_t group, int thr); + int (*thr_rem)(odp_schedule_group_t group, int thr); + int (*num_grps)(void); + int (*init_queue)(uint32_t queue_index, + const odp_schedule_param_t *sched_param); + void (*destroy_queue)(uint32_t queue_index); + int (*sched_queue)(uint32_t queue_index); + int (*ord_enq_multi)(queue_t q_int, void *buf_hdr[], int num, int *ret); + void (*order_lock)(void); + void (*order_unlock)(void); + unsigned (*max_ordered_locks)(void);
/* Called only when status_sync is set */ - schedule_unsched_queue_fn_t unsched_queue; - schedule_save_context_fn_t save_context; - + int (*unsched_queue)(uint32_t queue_index); + void (*save_context)(uint32_t queue_index); } schedule_fn_t;
-/* Interface towards the scheduler */ extern const schedule_fn_t *sched_fn;
-/* Interface for the scheduler */ -int sched_cb_pktin_poll(int pktio_index, int num_queue, int index[]); -void sched_cb_pktio_stop_finalize(int pktio_index); -odp_queue_t sched_cb_queue_handle(uint32_t queue_index); -void sched_cb_queue_destroy_finalize(uint32_t queue_index); -int sched_cb_queue_deq_multi(uint32_t queue_index, odp_event_t ev[], int num); -int sched_cb_queue_empty(uint32_t queue_index); - -#ifdef __cplusplus -} -#endif - #endif diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index 066f89dc..e78c712e 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -665,7 +665,7 @@ static int pktin_deq_multi(queue_t q_int, odp_buffer_hdr_t *buf_hdr[], int num) return nbr; }
-int sched_cb_pktin_poll(int pktio_index, int num_queue, int index[]) +int pktin_poll(int pktio_index, int num_queue, int index[]) { odp_buffer_hdr_t *hdr_tbl[QUEUE_MULTI_MAX]; int num, idx; @@ -703,7 +703,7 @@ int sched_cb_pktin_poll(int pktio_index, int num_queue, int index[]) return 0; }
-void sched_cb_pktio_stop_finalize(int pktio_index) +void pktio_stop_finalize(int pktio_index) { int state; pktio_entry_t *entry = pktio_entry_by_index(pktio_index); diff --git a/platform/linux-generic/odp_queue.c b/platform/linux-generic/odp_queue.c index 7ad346ad..46197e00 100644 --- a/platform/linux-generic/odp_queue.c +++ b/platform/linux-generic/odp_queue.c @@ -234,7 +234,7 @@ static odp_queue_t queue_create(const char *name, return handle; }
-void sched_cb_queue_destroy_finalize(uint32_t queue_index) +void queue_destroy_finalize(uint32_t queue_index) { queue_entry_t *queue = get_qentry(queue_index);
@@ -643,19 +643,19 @@ static int queue_info(odp_queue_t handle, odp_queue_info_t *info) return 0; }
-odp_queue_t sched_cb_queue_handle(uint32_t queue_index) +odp_queue_t queue_handle(uint32_t queue_index) { return queue_from_id(queue_index); }
-int sched_cb_queue_deq_multi(uint32_t queue_index, odp_event_t ev[], int num) +int queue_idx_deq_multi(uint32_t queue_index, odp_event_t ev[], int num) { queue_entry_t *qe = get_qentry(queue_index);
return deq_multi(qe, (odp_buffer_hdr_t **)ev, num); }
-int sched_cb_queue_empty(uint32_t queue_index) +int queue_empty(uint32_t queue_index) { queue_entry_t *queue = get_qentry(queue_index); int ret = 0; diff --git a/platform/linux-generic/schedule/generic.c b/platform/linux-generic/schedule/generic.c index 24ab8e06..36ed857b 100644 --- a/platform/linux-generic/schedule/generic.c +++ b/platform/linux-generic/schedule/generic.c @@ -24,6 +24,7 @@ #include <odp_ring_internal.h> #include <odp_timer_internal.h> #include <odp_schedule_subsystem.h> +#include <odp_packet_io_internal.h>
/* Should remove this dependency */ #include <odp_queue_internal.h> @@ -368,11 +369,6 @@ static int schedule_init_global(void) return 0; }
-static inline void queue_destroy_finalize(uint32_t qi) -{ - sched_cb_queue_destroy_finalize(qi); -} - static int schedule_term_global(void) { int ret = 0; @@ -858,13 +854,13 @@ static inline int do_schedule_grp(odp_queue_t *out_queue, odp_event_t out_ev[], if (ordered && max_num < MAX_DEQ) max_deq = max_num;
- num = sched_cb_queue_deq_multi(qi, sched_local.ev_stash, - max_deq); + num = queue_idx_deq_multi(qi, sched_local.ev_stash, + max_deq);
if (num < 0) { /* Destroyed queue. Continue scheduling the same * priority queue. */ - sched_cb_queue_destroy_finalize(qi); + queue_destroy_finalize(qi); continue; }
@@ -874,7 +870,7 @@ static inline int do_schedule_grp(odp_queue_t *out_queue, odp_event_t out_ev[], continue; }
- handle = sched_cb_queue_handle(qi); + handle = queue_handle(qi); sched_local.num = num; sched_local.index = 0; sched_local.queue = handle; @@ -1003,15 +999,15 @@ static inline int do_schedule(odp_queue_t *out_queue, odp_event_t out_ev[], cmd = &sched->pktio_cmd[cmd_index];
/* Poll packet input */ - if (odp_unlikely(sched_cb_pktin_poll(cmd->pktio_index, - cmd->num_pktin, - cmd->pktin))){ + if (odp_unlikely(pktin_poll(cmd->pktio_index, + cmd->num_pktin, + cmd->pktin))){ /* Pktio stopped or closed. Remove poll command and call * stop_finalize when all commands of the pktio has * been removed. */ if (schedule_pktio_stop(cmd->pktio_index, cmd->pktin[0]) == 0) - sched_cb_pktio_stop_finalize(cmd->pktio_index); + pktio_stop_finalize(cmd->pktio_index);
free_pktio_cmd(cmd); } else { diff --git a/platform/linux-generic/schedule/iquery.c b/platform/linux-generic/schedule/iquery.c index f03014b8..ac0d0981 100644 --- a/platform/linux-generic/schedule/iquery.c +++ b/platform/linux-generic/schedule/iquery.c @@ -24,6 +24,7 @@ #include <odp_config_internal.h> #include <odp_timer_internal.h> #include <odp_schedule_subsystem.h> +#include <odp_packet_io_internal.h>
/* Should remove this dependency */ #include <odp_queue_internal.h> @@ -293,10 +294,10 @@ static int schedule_term_global(void) odp_event_t events[1];
if (sched->availables[i]) - count = sched_cb_queue_deq_multi(i, events, 1); + count = queue_idx_deq_multi(i, events, 1);
if (count < 0) - sched_cb_queue_destroy_finalize(i); + queue_destroy_finalize(i); else if (count > 0) ODP_ERR("Queue (%d) not empty\n", i); } @@ -673,16 +674,16 @@ static inline void pktio_poll_input(void) cmd = &sched->pktio_poll.commands[index];
/* Poll packet input */ - if (odp_unlikely(sched_cb_pktin_poll(cmd->pktio, - cmd->count, - cmd->pktin))) { + if (odp_unlikely(pktin_poll(cmd->pktio, + cmd->count, + cmd->pktin))) { /* Pktio stopped or closed. Remove poll * command and call stop_finalize when all * commands of the pktio has been removed. */ if (schedule_pktio_stop(cmd->pktio, cmd->pktin[0]) == 0) - sched_cb_pktio_stop_finalize(cmd->pktio); + pktio_stop_finalize(cmd->pktio);
free_pktio_cmd(cmd); } else { @@ -1514,12 +1515,11 @@ static inline int consume_queue(int prio, unsigned int queue_index) if (is_ordered_queue(queue_index)) max = 1;
- count = sched_cb_queue_deq_multi( - queue_index, cache->stash, max); + count = queue_idx_deq_multi(queue_index, cache->stash, max);
if (count < 0) { DO_SCHED_UNLOCK(); - sched_cb_queue_destroy_finalize(queue_index); + queue_destroy_finalize(queue_index); DO_SCHED_LOCK(); return 0; } @@ -1529,7 +1529,7 @@ static inline int consume_queue(int prio, unsigned int queue_index)
cache->top = &cache->stash[0]; cache->count = count; - cache->queue = sched_cb_queue_handle(queue_index); + cache->queue = queue_handle(queue_index); return count; }
diff --git a/platform/linux-generic/schedule/scalable.c b/platform/linux-generic/schedule/scalable.c index 787553ca..0fba38a7 100644 --- a/platform/linux-generic/schedule/scalable.c +++ b/platform/linux-generic/schedule/scalable.c @@ -693,7 +693,7 @@ static inline void _schedule_release_ordered(sched_scalable_thread_state_t *ts) ts->rctx = NULL; }
-static void pktin_poll(sched_scalable_thread_state_t *ts) +static void poll_pktin(sched_scalable_thread_state_t *ts) { uint32_t i, tag, hi, npolls = 0; int pktio_index, queue_index; @@ -715,8 +715,8 @@ static void pktin_poll(sched_scalable_thread_state_t *ts) /* Tag grabbed */ pktio_index = TAG_2_PKTIO(tag); queue_index = TAG_2_QUEUE(tag); - if (odp_unlikely(sched_cb_pktin_poll(pktio_index, - 1, &queue_index))) { + if (odp_unlikely(pktin_poll(pktio_index, + 1, &queue_index))) { /* Pktio stopped or closed * Remove tag from pktin_tags */ @@ -729,7 +729,7 @@ static void pktin_poll(sched_scalable_thread_state_t *ts) */ if (__atomic_sub_fetch(&pktin_count[pktio_index], 1, __ATOMIC_RELAXED) == 0) - sched_cb_pktio_stop_finalize(pktio_index); + pktio_stop_finalize(pktio_index); } else { /* We don't know whether any packets were found and enqueued * Write back original tag value to release pktin queue @@ -984,7 +984,7 @@ restart_same: } }
- pktin_poll(ts); + poll_pktin(ts); return 0; }
diff --git a/platform/linux-generic/schedule/sp.c b/platform/linux-generic/schedule/sp.c index 19700f90..a40d42d8 100644 --- a/platform/linux-generic/schedule/sp.c +++ b/platform/linux-generic/schedule/sp.c @@ -17,6 +17,8 @@ #include <odp_ring_internal.h> #include <odp_timer_internal.h> #include <odp_schedule_subsystem.h> +#include <odp_packet_io_internal.h> +#include <odp_queue_internal.h>
#define NUM_THREAD ODP_THREAD_COUNT_MAX #define NUM_QUEUE ODP_CONFIG_QUEUES @@ -224,7 +226,7 @@ static int term_global(void) for (qi = 0; qi < NUM_QUEUE; qi++) { if (sched_global->queue_cmd[qi].s.init) { /* todo: dequeue until empty ? */ - sched_cb_queue_destroy_finalize(qi); + queue_destroy_finalize(qi); } }
@@ -500,7 +502,7 @@ static int schedule_multi(odp_queue_t *from, uint64_t wait,
if (sched_local.cmd) { /* Continue scheduling if queue is not empty */ - if (sched_cb_queue_empty(sched_local.cmd->s.index) == 0) + if (queue_empty(sched_local.cmd->s.index) == 0) add_tail(sched_local.cmd);
sched_local.cmd = NULL; @@ -519,10 +521,10 @@ static int schedule_multi(odp_queue_t *from, uint64_t wait, cmd = sched_cmd();
if (cmd && cmd->s.type == CMD_PKTIO) { - if (sched_cb_pktin_poll(cmd->s.index, cmd->s.num_pktin, - cmd->s.pktin_idx)) { + if (pktin_poll(cmd->s.index, cmd->s.num_pktin, + cmd->s.pktin_idx)) { /* Pktio stopped or closed. */ - sched_cb_pktio_stop_finalize(cmd->s.index); + pktio_stop_finalize(cmd->s.index); } else { /* Continue polling pktio. */ add_tail(cmd); @@ -554,20 +556,20 @@ static int schedule_multi(odp_queue_t *from, uint64_t wait, }
qi = cmd->s.index; - num = sched_cb_queue_deq_multi(qi, events, 1); + num = queue_idx_deq_multi(qi, events, 1);
if (num > 0) { sched_local.cmd = cmd;
if (from) - *from = sched_cb_queue_handle(qi); + *from = queue_handle(qi);
return num; }
if (num < 0) { /* Destroyed queue */ - sched_cb_queue_destroy_finalize(qi); + queue_destroy_finalize(qi); continue; }
commit 4a81959d49847df03aa11acb7bddefe78e238116 Author: Brian Brooks brian.brooks@arm.com Date: Wed Aug 23 16:17:55 2017 -0500
linux-gen: schedule: move schedulers into modules
Signed-off-by: Brian Brooks brian.brooks@arm.com Reviewed-by: Honnappa Nagarahalli honnappa.nagarahalli@arm.com Reviewed-by: Kevin Wang kevin.wang@arm.com Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Yi He yi.he@linaro.org
diff --git a/platform/linux-dpdk/Makefile.am b/platform/linux-dpdk/Makefile.am index 8b94b7d2..587d4836 100644 --- a/platform/linux-dpdk/Makefile.am +++ b/platform/linux-dpdk/Makefile.am @@ -252,9 +252,12 @@ __LIB__libodp_dpdk_la_SOURCES = \ ../linux-generic/odp_rwlock.c \ ../linux-generic/odp_rwlock_recursive.c \ ../linux-generic/pool/subsystem.c \ - ../linux-generic/odp_schedule.c \ ../linux-generic/odp_schedule_if.c \ - ../linux-generic/odp_schedule_iquery.c \ + ../linux-generic/schedule/generic.c \ + ../linux-generic/schedule/iquery.c \ + ../linux-generic/schedule/scalable.c \ + ../linux-generic/schedule/scalable_ordered.c \ + ../linux-generic/schedule/sp.c \ ../linux-generic/schedule/subsystem.c \ ../linux-generic/odp_shared_memory.c \ ../linux-generic/odp_sorted_list.c \ @@ -297,6 +300,19 @@ __LIB__libodp_dpdk_la_SOURCES += arch/x86/cpu_flags.c \ endif
pool/dpdk.lo: AM_CFLAGS += -DIM_ACTIVE_MODULE +if ODP_SCHEDULE_SCALABLE +../linux-generic/schedule/scalable.lo: AM_CFLAGS += -DIM_ACTIVE_MODULE +else +if ODP_SCHEDULE_SP +../linux-generic/schedule/sp.lo: AM_CFLAGS += -DIM_ACTIVE_MODULE +else +if ODP_SCHEDULE_IQUERY +../linux-generic/schedule/iquery.lo: AM_CFLAGS += -DIM_ACTIVE_MODULE +else +../linux-generic/schedule/generic.lo: AM_CFLAGS += -DIM_ACTIVE_MODULE +endif +endif +endif
# Build modular framework into odp-linux library modularframeworkdir = $(top_srcdir)/frameworks/modular diff --git a/platform/linux-dpdk/odp_init.c b/platform/linux-dpdk/odp_init.c index 96c535ba..cd7abce6 100644 --- a/platform/linux-dpdk/odp_init.c +++ b/platform/linux-dpdk/odp_init.c @@ -358,7 +358,7 @@ int odp_init_global(odp_instance_t *instance, } stage = QUEUE_INIT;
- if (sched_fn->init_global()) { + if (odp_schedule_init_global()) { ODP_ERR("ODP schedule init failed.\n"); goto init_failed; } @@ -488,7 +488,7 @@ int _odp_term_global(enum init_stage stage) /* Fall through */
case SCHED_INIT: - if (sched_fn->term_global()) { + if (odp_schedule_term_global()) { ODP_ERR("ODP schedule term failed.\n"); rc = -1; } @@ -590,7 +590,7 @@ int odp_init_local(odp_instance_t instance, odp_thread_type_t thr_type) } stage = POOL_INIT;
- if (sched_fn->init_local()) { + if (odp_schedule_init_local()) { ODP_ERR("ODP schedule local init failed.\n"); goto init_fail; } @@ -617,7 +617,7 @@ int _odp_term_local(enum init_stage stage) case ALL_INIT:
case SCHED_INIT: - if (sched_fn->term_local()) { + if (odp_schedule_term_local()) { ODP_ERR("ODP schedule local term failed.\n"); rc = -1; } diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index 78e95760..cbbefa4e 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -281,12 +281,12 @@ __LIB__libodp_linux_la_SOURCES = \ odp_queue_scalable.c \ odp_rwlock.c \ odp_rwlock_recursive.c \ - odp_schedule.c \ odp_schedule_if.c \ - odp_schedule_sp.c \ - odp_schedule_iquery.c \ - odp_schedule_scalable.c \ - odp_schedule_scalable_ordered.c \ + schedule/generic.c \ + schedule/iquery.c \ + schedule/scalable.c \ + schedule/scalable_ordered.c \ + schedule/sp.c \ schedule/subsystem.c \ odp_shared_memory.c \ odp_sorted_list.c \ @@ -334,6 +334,17 @@ endif
pool/generic.lo: AM_CFLAGS += -DIM_ACTIVE_MODULE buffer/generic.lo: AM_CFLAGS += -DIM_ACTIVE_MODULE +if ODP_SCHEDULE_SCALABLE +schedule/scalable.lo: AM_CFLAGS += -DIM_ACTIVE_MODULE +else +schedule/generic.lo: AM_CFLAGS += -DIM_ACTIVE_MODULE +endif +if ODP_SCHEDULE_SP +schedule/sp.lo: AM_CFLAGS += -DIM_ACTIVE_MODULE +endif +if ODP_SCHEDULE_IQUERY +schedule/iquery.lo: AM_CFLAGS += -DIM_ACTIVE_MODULE +endif
# Build modular framework into odp-linux library modularframeworkdir = $(top_srcdir)/frameworks/modular diff --git a/platform/linux-generic/include/odp_internal.h b/platform/linux-generic/include/odp_internal.h index bb70bd72..2c935a9f 100644 --- a/platform/linux-generic/include/odp_internal.h +++ b/platform/linux-generic/include/odp_internal.h @@ -113,6 +113,11 @@ int odp_queue_term_global(void); int odp_crypto_init_global(void); int odp_crypto_term_global(void);
+int odp_schedule_init_global(void); +int odp_schedule_term_global(void); +int odp_schedule_init_local(void); +int odp_schedule_term_local(void); + int odp_timer_init_global(const odp_init_t *params); int odp_timer_term_global(void); int odp_timer_disarm_all(void); diff --git a/platform/linux-generic/include/odp_schedule_if.h b/platform/linux-generic/include/odp_schedule_if.h index 657993b1..2bcf23f2 100644 --- a/platform/linux-generic/include/odp_schedule_if.h +++ b/platform/linux-generic/include/odp_schedule_if.h @@ -20,18 +20,13 @@ typedef void (*schedule_pktio_start_fn_t)(int pktio_index, int num_in_queue, typedef int (*schedule_thr_add_fn_t)(odp_schedule_group_t group, int thr); typedef int (*schedule_thr_rem_fn_t)(odp_schedule_group_t group, int thr); typedef int (*schedule_num_grps_fn_t)(void); -typedef int (*schedule_init_queue_fn_t)(uint32_t queue_index, - const odp_schedule_param_t *sched_param - ); +typedef int (*schedule_init_queue_fn_t)( + uint32_t queue_index, const odp_schedule_param_t *sched_param); typedef void (*schedule_destroy_queue_fn_t)(uint32_t queue_index); typedef int (*schedule_sched_queue_fn_t)(uint32_t queue_index); typedef int (*schedule_unsched_queue_fn_t)(uint32_t queue_index); typedef int (*schedule_ord_enq_multi_fn_t)(queue_t q_int, void *buf_hdr[], int num, int *ret); -typedef int (*schedule_init_global_fn_t)(void); -typedef int (*schedule_term_global_fn_t)(void); -typedef int (*schedule_init_local_fn_t)(void); -typedef int (*schedule_term_local_fn_t)(void); typedef void (*schedule_order_lock_fn_t)(void); typedef void (*schedule_order_unlock_fn_t)(void); typedef unsigned (*schedule_max_ordered_locks_fn_t)(void); @@ -47,10 +42,6 @@ typedef struct schedule_fn_t { schedule_destroy_queue_fn_t destroy_queue; schedule_sched_queue_fn_t sched_queue; schedule_ord_enq_multi_fn_t ord_enq_multi; - schedule_init_global_fn_t init_global; - schedule_term_global_fn_t term_global; - schedule_init_local_fn_t init_local; - schedule_term_local_fn_t term_local; schedule_order_lock_fn_t order_lock; schedule_order_unlock_fn_t order_unlock; schedule_max_ordered_locks_fn_t max_ordered_locks; @@ -72,32 +63,6 @@ void sched_cb_queue_destroy_finalize(uint32_t queue_index); int sched_cb_queue_deq_multi(uint32_t queue_index, odp_event_t ev[], int num); int sched_cb_queue_empty(uint32_t queue_index);
-/* API functions */ -typedef struct { - uint64_t (*schedule_wait_time)(uint64_t); - odp_event_t (*schedule)(odp_queue_t *, uint64_t); - int (*schedule_multi)(odp_queue_t *, uint64_t, odp_event_t [], int); - void (*schedule_pause)(void); - void (*schedule_resume)(void); - void (*schedule_release_atomic)(void); - void (*schedule_release_ordered)(void); - void (*schedule_prefetch)(int); - int (*schedule_num_prio)(void); - odp_schedule_group_t (*schedule_group_create)(const char *, - const odp_thrmask_t *); - int (*schedule_group_destroy)(odp_schedule_group_t); - odp_schedule_group_t (*schedule_group_lookup)(const char *); - int (*schedule_group_join)(odp_schedule_group_t, const odp_thrmask_t *); - int (*schedule_group_leave)(odp_schedule_group_t, - const odp_thrmask_t *); - int (*schedule_group_thrmask)(odp_schedule_group_t, odp_thrmask_t *); - int (*schedule_group_info)(odp_schedule_group_t, - odp_schedule_group_info_t *); - void (*schedule_order_lock)(unsigned); - void (*schedule_order_unlock)(unsigned); - -} schedule_api_t; - #ifdef __cplusplus } #endif diff --git a/platform/linux-generic/odp_init.c b/platform/linux-generic/odp_init.c index 0d5ee710..340171a5 100644 --- a/platform/linux-generic/odp_init.c +++ b/platform/linux-generic/odp_init.c @@ -178,7 +178,7 @@ int odp_init_global(odp_instance_t *instance, } stage = QUEUE_INIT;
- if (sched_fn->init_global()) { + if (odp_schedule_init_global()) { ODP_ERR("ODP schedule init failed.\n"); goto init_failed; } @@ -306,7 +306,7 @@ int _odp_term_global(enum init_stage stage) /* Fall through */
case SCHED_INIT: - if (sched_fn->term_global()) { + if (odp_schedule_term_global()) { ODP_ERR("ODP schedule term failed.\n"); rc = -1; } @@ -414,7 +414,7 @@ int odp_init_local(odp_instance_t instance, odp_thread_type_t thr_type) } stage = QUEUE_INIT;
- if (sched_fn->init_local()) { + if (odp_schedule_init_local()) { ODP_ERR("ODP schedule local init failed.\n"); goto init_fail; } @@ -447,7 +447,7 @@ int _odp_term_local(enum init_stage stage) case ALL_INIT:
case SCHED_INIT: - if (sched_fn->term_local()) { + if (odp_schedule_term_local()) { ODP_ERR("ODP schedule local term failed.\n"); rc = -1; } diff --git a/platform/linux-generic/odp_schedule_if.c b/platform/linux-generic/odp_schedule_if.c index 2f07aafe..b06ab130 100644 --- a/platform/linux-generic/odp_schedule_if.c +++ b/platform/linux-generic/odp_schedule_if.c @@ -7,123 +7,16 @@ #include <odp_schedule_if.h>
extern const schedule_fn_t schedule_sp_fn; -extern const schedule_api_t schedule_sp_api; - -extern const schedule_fn_t schedule_default_fn; -extern const schedule_api_t schedule_default_api; - extern const schedule_fn_t schedule_iquery_fn; -extern const schedule_api_t schedule_iquery_api; - -extern const schedule_fn_t schedule_scalable_fn; -extern const schedule_api_t schedule_scalable_api; +extern const schedule_fn_t schedule_scalable_fn; +extern const schedule_fn_t schedule_default_fn;
-#ifdef ODP_SCHEDULE_SP -const schedule_fn_t *sched_fn = &schedule_sp_fn; -const schedule_api_t *sched_api = &schedule_sp_api; +#if defined(ODP_SCHEDULE_SP) +const schedule_fn_t *sched_fn = &schedule_sp_fn; #elif defined(ODP_SCHEDULE_IQUERY) -const schedule_fn_t *sched_fn = &schedule_iquery_fn; -const schedule_api_t *sched_api = &schedule_iquery_api; +const schedule_fn_t *sched_fn = &schedule_iquery_fn; #elif defined(ODP_SCHEDULE_SCALABLE) -const schedule_fn_t *sched_fn = &schedule_scalable_fn; -const schedule_api_t *sched_api = &schedule_scalable_api; +const schedule_fn_t *sched_fn = &schedule_scalable_fn; #else -const schedule_fn_t *sched_fn = &schedule_default_fn; -const schedule_api_t *sched_api = &schedule_default_api; +const schedule_fn_t *sched_fn = &schedule_default_fn; #endif - -uint64_t odp_schedule_wait_time(uint64_t ns) -{ - return sched_api->schedule_wait_time(ns); -} - -odp_event_t odp_schedule(odp_queue_t *from, uint64_t wait) -{ - return sched_api->schedule(from, wait); -} - -int odp_schedule_multi(odp_queue_t *from, uint64_t wait, odp_event_t events[], - int num) -{ - return sched_api->schedule_multi(from, wait, events, num); -} - -void odp_schedule_pause(void) -{ - return sched_api->schedule_pause(); -} - -void odp_schedule_resume(void) -{ - return sched_api->schedule_resume(); -} - -void odp_schedule_release_atomic(void) -{ - return sched_api->schedule_release_atomic(); -} - -void odp_schedule_release_ordered(void) -{ - return sched_api->schedule_release_ordered(); -} - -void odp_schedule_prefetch(int num) -{ - return sched_api->schedule_prefetch(num); -} - -int odp_schedule_num_prio(void) -{ - return sched_api->schedule_num_prio(); -} - -odp_schedule_group_t odp_schedule_group_create(const char *name, - const odp_thrmask_t *mask) -{ - return sched_api->schedule_group_create(name, mask); -} - -int odp_schedule_group_destroy(odp_schedule_group_t group) -{ - return sched_api->schedule_group_destroy(group); -} - -odp_schedule_group_t odp_schedule_group_lookup(const char *name) -{ - return sched_api->schedule_group_lookup(name); -} - -int odp_schedule_group_join(odp_schedule_group_t group, - const odp_thrmask_t *mask) -{ - return sched_api->schedule_group_join(group, mask); -} - -int odp_schedule_group_leave(odp_schedule_group_t group, - const odp_thrmask_t *mask) -{ - return sched_api->schedule_group_leave(group, mask); -} - -int odp_schedule_group_thrmask(odp_schedule_group_t group, - odp_thrmask_t *thrmask) -{ - return sched_api->schedule_group_thrmask(group, thrmask); -} - -int odp_schedule_group_info(odp_schedule_group_t group, - odp_schedule_group_info_t *info) -{ - return sched_api->schedule_group_info(group, info); -} - -void odp_schedule_order_lock(unsigned lock_index) -{ - return sched_api->schedule_order_lock(lock_index); -} - -void odp_schedule_order_unlock(unsigned lock_index) -{ - return sched_api->schedule_order_unlock(lock_index); -} diff --git a/platform/linux-generic/odp_schedule.c b/platform/linux-generic/schedule/generic.c similarity index 98% rename from platform/linux-generic/odp_schedule.c rename to platform/linux-generic/schedule/generic.c index a696d251..24ab8e06 100644 --- a/platform/linux-generic/odp_schedule.c +++ b/platform/linux-generic/schedule/generic.c @@ -23,6 +23,7 @@ #include <odp/api/packet_io.h> #include <odp_ring_internal.h> #include <odp_timer_internal.h> +#include <odp_schedule_subsystem.h>
/* Should remove this dependency */ #include <odp_queue_internal.h> @@ -389,9 +390,9 @@ static int schedule_term_global(void) odp_event_t events[1]; int num;
- num = sched_cb_queue_deq_multi(qi, - events, - 1); + num = queue_idx_deq_multi(qi, + events, + 1);
if (num < 0) queue_destroy_finalize(qi); @@ -1397,10 +1398,6 @@ const schedule_fn_t schedule_default_fn = { .destroy_queue = schedule_destroy_queue, .sched_queue = schedule_sched_queue, .ord_enq_multi = schedule_ord_enq_multi, - .init_global = schedule_init_global, - .term_global = schedule_term_global, - .init_local = schedule_init_local, - .term_local = schedule_term_local, .order_lock = order_lock, .order_unlock = order_unlock, .max_ordered_locks = schedule_max_ordered_locks, @@ -1409,8 +1406,15 @@ const schedule_fn_t schedule_default_fn = { };
/* Fill in scheduler API calls */ -const schedule_api_t schedule_default_api = { - .schedule_wait_time = schedule_wait_time, +odp_schedule_module_t schedule_generic = { + .base = { + .name = "schedule_generic", + .init_global = schedule_init_global, + .term_global = schedule_term_global, + .init_local = schedule_init_local, + .term_local = schedule_term_local, + }, + .wait_time = schedule_wait_time, .schedule = schedule, .schedule_multi = schedule_multi, .schedule_pause = schedule_pause, @@ -1429,3 +1433,9 @@ const schedule_api_t schedule_default_api = { .schedule_order_lock = schedule_order_lock, .schedule_order_unlock = schedule_order_unlock }; + +ODP_MODULE_CONSTRUCTOR(schedule_generic) +{ + odp_module_constructor(&schedule_generic); + odp_subsystem_register_module(schedule, &schedule_generic); +} diff --git a/platform/linux-generic/odp_schedule_iquery.c b/platform/linux-generic/schedule/iquery.c similarity index 98% rename from platform/linux-generic/odp_schedule_iquery.c rename to platform/linux-generic/schedule/iquery.c index 86f5d53e..f03014b8 100644 --- a/platform/linux-generic/odp_schedule_iquery.c +++ b/platform/linux-generic/schedule/iquery.c @@ -23,6 +23,7 @@ #include <odp/api/packet_io.h> #include <odp_config_internal.h> #include <odp_timer_internal.h> +#include <odp_schedule_subsystem.h>
/* Should remove this dependency */ #include <odp_queue_internal.h> @@ -1336,10 +1337,6 @@ const schedule_fn_t schedule_iquery_fn = { .destroy_queue = destroy_sched_queue, .sched_queue = schedule_sched_queue, .ord_enq_multi = schedule_ord_enq_multi, - .init_global = schedule_init_global, - .term_global = schedule_term_global, - .init_local = schedule_init_local, - .term_local = schedule_term_local, .order_lock = order_lock, .order_unlock = order_unlock, .max_ordered_locks = schedule_max_ordered_locks, @@ -1348,8 +1345,15 @@ const schedule_fn_t schedule_iquery_fn = { };
/* Fill in scheduler API calls */ -const schedule_api_t schedule_iquery_api = { - .schedule_wait_time = schedule_wait_time, +odp_schedule_module_t schedule_iquery = { + .base = { + .name = "schedule_iquery", + .init_global = schedule_init_global, + .term_global = schedule_term_global, + .init_local = schedule_init_local, + .term_local = schedule_term_local, + }, + .wait_time = schedule_wait_time, .schedule = schedule, .schedule_multi = schedule_multi, .schedule_pause = schedule_pause, @@ -1369,6 +1373,12 @@ const schedule_api_t schedule_iquery_api = { .schedule_order_unlock = schedule_order_unlock };
+ODP_MODULE_CONSTRUCTOR(schedule_iquery) +{ + odp_module_constructor(&schedule_iquery); + odp_subsystem_register_module(schedule, &schedule_iquery); +} + static void thread_set_interest(sched_thread_local_t *thread, unsigned int queue_index, int prio) { diff --git a/platform/linux-generic/odp_schedule_scalable.c b/platform/linux-generic/schedule/scalable.c similarity index 99% rename from platform/linux-generic/odp_schedule_scalable.c rename to platform/linux-generic/schedule/scalable.c index 78159b53..787553ca 100644 --- a/platform/linux-generic/odp_schedule_scalable.c +++ b/platform/linux-generic/schedule/scalable.c @@ -28,6 +28,7 @@ #include <odp_llqueue.h> #include <odp_queue_scalable_internal.h> #include <odp_schedule_if.h> +#include <odp_schedule_subsystem.h> #include <odp_bitset.h> #include <odp_packet_io_internal.h>
@@ -1949,17 +1950,20 @@ const schedule_fn_t schedule_scalable_fn = { .destroy_queue = destroy_queue, .sched_queue = sched_queue, .ord_enq_multi = ord_enq_multi, - .init_global = schedule_init_global, - .term_global = schedule_term_global, - .init_local = schedule_init_local, - .term_local = schedule_term_local, .order_lock = order_lock, .order_unlock = order_unlock, .max_ordered_locks = schedule_max_ordered_locks, };
-const schedule_api_t schedule_scalable_api = { - .schedule_wait_time = schedule_wait_time, +odp_schedule_module_t schedule_scalable = { + .base = { + .name = "schedule_scalable", + .init_global = schedule_init_global, + .term_global = schedule_term_global, + .init_local = schedule_init_local, + .term_local = schedule_term_local, + }, + .wait_time = schedule_wait_time, .schedule = schedule, .schedule_multi = schedule_multi, .schedule_pause = schedule_pause, @@ -1978,3 +1982,9 @@ const schedule_api_t schedule_scalable_api = { .schedule_order_lock = schedule_order_lock, .schedule_order_unlock = schedule_order_unlock, }; + +ODP_MODULE_CONSTRUCTOR(schedule_scalable) +{ + odp_module_constructor(&schedule_scalable); + odp_subsystem_register_module(schedule, &schedule_scalable); +} diff --git a/platform/linux-generic/odp_schedule_scalable_ordered.c b/platform/linux-generic/schedule/scalable_ordered.c similarity index 100% rename from platform/linux-generic/odp_schedule_scalable_ordered.c rename to platform/linux-generic/schedule/scalable_ordered.c diff --git a/platform/linux-generic/odp_schedule_sp.c b/platform/linux-generic/schedule/sp.c similarity index 97% rename from platform/linux-generic/odp_schedule_sp.c rename to platform/linux-generic/schedule/sp.c index 9829acc5..19700f90 100644 --- a/platform/linux-generic/odp_schedule_sp.c +++ b/platform/linux-generic/schedule/sp.c @@ -16,6 +16,7 @@ #include <odp_config_internal.h> #include <odp_ring_internal.h> #include <odp_timer_internal.h> +#include <odp_schedule_subsystem.h>
#define NUM_THREAD ODP_THREAD_COUNT_MAX #define NUM_QUEUE ODP_CONFIG_QUEUES @@ -836,10 +837,6 @@ const schedule_fn_t schedule_sp_fn = { .destroy_queue = destroy_queue, .sched_queue = sched_queue, .ord_enq_multi = ord_enq_multi, - .init_global = init_global, - .term_global = term_global, - .init_local = init_local, - .term_local = term_local, .order_lock = order_lock, .order_unlock = order_unlock, .max_ordered_locks = max_ordered_locks, @@ -848,8 +845,15 @@ const schedule_fn_t schedule_sp_fn = { };
/* Fill in scheduler API calls */ -const schedule_api_t schedule_sp_api = { - .schedule_wait_time = schedule_wait_time, +odp_schedule_module_t schedule_sp = { + .base = { + .name = "schedule_sp", + .init_global = init_global, + .term_global = term_global, + .init_local = init_local, + .term_local = term_local, + }, + .wait_time = schedule_wait_time, .schedule = schedule, .schedule_multi = schedule_multi, .schedule_pause = schedule_pause, @@ -868,3 +872,9 @@ const schedule_api_t schedule_sp_api = { .schedule_order_lock = schedule_order_lock, .schedule_order_unlock = schedule_order_unlock }; + +ODP_MODULE_CONSTRUCTOR(schedule_sp) +{ + odp_module_constructor(&schedule_sp); + odp_subsystem_register_module(schedule, &schedule_sp); +} diff --git a/platform/linux-generic/schedule/subsystem.c b/platform/linux-generic/schedule/subsystem.c index ae2bf3fd..6ca6459e 100644 --- a/platform/linux-generic/schedule/subsystem.c +++ b/platform/linux-generic/schedule/subsystem.c @@ -6,7 +6,12 @@ * SPDX-License-Identifier: BSD-3-Clause */
+/* API header files */ +#include <odp.h> + /* Internal header files */ +#include <odp_debug_internal.h> +#include <odp_internal.h> #include <odp_module.h> #include <odp_schedule_subsystem.h>
@@ -17,3 +22,251 @@ ODP_SUBSYSTEM_CONSTRUCTOR(schedule) { odp_subsystem_constructor(schedule); } + +int odp_schedule_init_global(void) +{ + odp_schedule_module_t *module = + odp_subsystem_active_module(schedule, module); + + ODP_ASSERT(module); + ODP_ASSERT(module->base.init_global); + + return module->base.init_global(); +} + +int odp_schedule_term_global(void) +{ + odp_schedule_module_t *module = + odp_subsystem_active_module(schedule, module); + + ODP_ASSERT(module); + ODP_ASSERT(module->base.term_global); + + return module->base.term_global(); +} + +int odp_schedule_init_local(void) +{ + odp_schedule_module_t *module = + odp_subsystem_active_module(schedule, module); + + ODP_ASSERT(module); + ODP_ASSERT(module->base.init_local); + + return module->base.init_local(); +} + +int odp_schedule_term_local(void) +{ + odp_schedule_module_t *module = + odp_subsystem_active_module(schedule, module); + + ODP_ASSERT(module); + ODP_ASSERT(module->base.term_local); + + return module->base.term_local(); +} + +uint64_t odp_schedule_wait_time(uint64_t ns) +{ + odp_schedule_module_t *module = + odp_subsystem_active_module(schedule, module); + + ODP_ASSERT(module); + ODP_ASSERT(module->wait_time); + + return module->wait_time(ns); +} + +odp_event_t odp_schedule(odp_queue_t *from, uint64_t wait) +{ + odp_schedule_module_t *module = + odp_subsystem_active_module(schedule, module); + + ODP_ASSERT(module); + ODP_ASSERT(module->schedule); + + return module->schedule(from, wait); +} + +int odp_schedule_multi(odp_queue_t *from, uint64_t wait, odp_event_t events[], + int num) +{ + odp_schedule_module_t *module = + odp_subsystem_active_module(schedule, module); + + ODP_ASSERT(module); + ODP_ASSERT(module->schedule_multi); + + return module->schedule_multi(from, wait, events, num); +} + +void odp_schedule_pause(void) +{ + odp_schedule_module_t *module = + odp_subsystem_active_module(schedule, module); + + ODP_ASSERT(module); + ODP_ASSERT(module->schedule_pause); + + return module->schedule_pause(); +} + +void odp_schedule_resume(void) +{ + odp_schedule_module_t *module = + odp_subsystem_active_module(schedule, module); + + ODP_ASSERT(module); + ODP_ASSERT(module->schedule_resume); + + return module->schedule_resume(); +} + +void odp_schedule_release_atomic(void) +{ + odp_schedule_module_t *module = + odp_subsystem_active_module(schedule, module); + + ODP_ASSERT(module); + ODP_ASSERT(module->schedule_release_atomic); + + return module->schedule_release_atomic(); +} + +void odp_schedule_release_ordered(void) +{ + odp_schedule_module_t *module = + odp_subsystem_active_module(schedule, module); + + ODP_ASSERT(module); + ODP_ASSERT(module->schedule_release_ordered); + + return module->schedule_release_ordered(); +} + +void odp_schedule_prefetch(int num) +{ + odp_schedule_module_t *module = + odp_subsystem_active_module(schedule, module); + + ODP_ASSERT(module); + ODP_ASSERT(module->schedule_prefetch); + + return module->schedule_prefetch(num); +} + +int odp_schedule_num_prio(void) +{ + odp_schedule_module_t *module = + odp_subsystem_active_module(schedule, module); + + ODP_ASSERT(module); + ODP_ASSERT(module->schedule_num_prio); + + return module->schedule_num_prio(); +} + +odp_schedule_group_t odp_schedule_group_create(const char *name, + const odp_thrmask_t *mask) +{ + odp_schedule_module_t *module = + odp_subsystem_active_module(schedule, module); + + ODP_ASSERT(module); + ODP_ASSERT(module->schedule_group_create); + + return module->schedule_group_create(name, mask); +} + +int odp_schedule_group_destroy(odp_schedule_group_t group) +{ + odp_schedule_module_t *module = + odp_subsystem_active_module(schedule, module); + + ODP_ASSERT(module); + ODP_ASSERT(module->schedule_group_destroy); + + return module->schedule_group_destroy(group); +} + +odp_schedule_group_t odp_schedule_group_lookup(const char *name) +{ + odp_schedule_module_t *module = + odp_subsystem_active_module(schedule, module); + + ODP_ASSERT(module); + ODP_ASSERT(module->schedule_group_lookup); + + return module->schedule_group_lookup(name); +} + +int odp_schedule_group_join(odp_schedule_group_t group, + const odp_thrmask_t *mask) +{ + odp_schedule_module_t *module = + odp_subsystem_active_module(schedule, module); + + ODP_ASSERT(module); + ODP_ASSERT(module->schedule_group_join); + + return module->schedule_group_join(group, mask); +} + +int odp_schedule_group_leave(odp_schedule_group_t group, + const odp_thrmask_t *mask) +{ + odp_schedule_module_t *module = + odp_subsystem_active_module(schedule, module); + + ODP_ASSERT(module); + ODP_ASSERT(module->schedule_group_leave); + + return module->schedule_group_leave(group, mask); +} + +int odp_schedule_group_thrmask(odp_schedule_group_t group, + odp_thrmask_t *thrmask) +{ + odp_schedule_module_t *module = + odp_subsystem_active_module(schedule, module); + + ODP_ASSERT(module); + ODP_ASSERT(module->schedule_group_thrmask); + + return module->schedule_group_thrmask(group, thrmask); +} + +int odp_schedule_group_info(odp_schedule_group_t group, + odp_schedule_group_info_t *info) +{ + odp_schedule_module_t *module = + odp_subsystem_active_module(schedule, module); + + ODP_ASSERT(module); + ODP_ASSERT(module->schedule_group_info); + + return module->schedule_group_info(group, info); +} + +void odp_schedule_order_lock(unsigned lock_index) +{ + odp_schedule_module_t *module = + odp_subsystem_active_module(schedule, module); + + ODP_ASSERT(module); + ODP_ASSERT(module->schedule_order_lock); + + return module->schedule_order_lock(lock_index); +} + +void odp_schedule_order_unlock(unsigned lock_index) +{ + odp_schedule_module_t *module = + odp_subsystem_active_module(schedule, module); + + ODP_ASSERT(module); + ODP_ASSERT(module->schedule_order_unlock); + + return module->schedule_order_unlock(lock_index); +}
commit 183376f96550b24b6601c7e07afe3eed4fe188d6 Author: Brian Brooks brian.brooks@arm.com Date: Wed Aug 23 14:54:49 2017 -0500
linux-gen: schedule: add subsystem
Signed-off-by: Brian Brooks brian.brooks@arm.com Reviewed-by: Honnappa Nagarahalli honnappa.nagarahalli@arm.com Reviewed-by: Yi He yi.he@linaro.org Reviewed-by: Bill Fischofer bill.fischofer@linaro.org
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); +}
-----------------------------------------------------------------------
Summary of changes: platform/linux-dpdk/Makefile.am | 22 +- .../linux-dpdk/include/odp_packet_io_internal.h | 3 + platform/linux-dpdk/odp_init.c | 8 +- platform/linux-generic/Makefile.am | 23 +- platform/linux-generic/include/odp_internal.h | 5 + .../linux-generic/include/odp_packet_io_internal.h | 3 + .../linux-generic/include/odp_queue_internal.h | 5 + platform/linux-generic/include/odp_schedule_if.h | 100 ++------ .../linux-generic/include/odp_schedule_subsystem.h | 77 ++++++ platform/linux-generic/odp_init.c | 8 +- platform/linux-generic/odp_packet_io.c | 4 +- platform/linux-generic/odp_queue.c | 8 +- platform/linux-generic/odp_schedule_if.c | 121 +-------- .../{odp_schedule.c => schedule/generic.c} | 50 ++-- .../{odp_schedule_iquery.c => schedule/iquery.c} | 42 ++-- .../scalable.c} | 32 ++- .../scalable_ordered.c} | 0 .../{odp_schedule_sp.c => schedule/sp.c} | 40 +-- platform/linux-generic/schedule/subsystem.c | 272 +++++++++++++++++++++ 19 files changed, 541 insertions(+), 282 deletions(-) create mode 100644 platform/linux-generic/include/odp_schedule_subsystem.h rename platform/linux-generic/{odp_schedule.c => schedule/generic.c} (97%) rename platform/linux-generic/{odp_schedule_iquery.c => schedule/iquery.c} (97%) rename platform/linux-generic/{odp_schedule_scalable.c => schedule/scalable.c} (98%) rename platform/linux-generic/{odp_schedule_scalable_ordered.c => schedule/scalable_ordered.c} (100%) rename platform/linux-generic/{odp_schedule_sp.c => schedule/sp.c} (96%) create mode 100644 platform/linux-generic/schedule/subsystem.c
hooks/post-receive