aboutsummaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorPetri Savolainen <petri.savolainen@nokia.com>2016-06-02 10:06:48 +0300
committerMaxim Uvarov <maxim.uvarov@linaro.org>2016-06-07 18:24:58 +0300
commit51dcde6b92b05c650c284cb24dffdf209062ba24 (patch)
tree35245d1996fc4464127c697a0dc7fad089052362 /platform
parent4c4bca38e65120c628f9d02b8fe05c1134979d60 (diff)
linux-generic: sched: bind default scheduler api calls
Bound default scheduler implementation API calls to API structure. Signed-off-by: Petri Savolainen <petri.savolainen@nokia.com> Reviewed-and-tested-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Diffstat (limited to 'platform')
-rw-r--r--platform/linux-generic/include/odp_schedule_internal.h4
-rw-r--r--platform/linux-generic/odp_schedule.c78
-rw-r--r--platform/linux-generic/odp_schedule_if.c105
-rw-r--r--platform/linux-generic/odp_schedule_ordered.c4
4 files changed, 156 insertions, 35 deletions
diff --git a/platform/linux-generic/include/odp_schedule_internal.h b/platform/linux-generic/include/odp_schedule_internal.h
index 85afc31a2..4a04b154c 100644
--- a/platform/linux-generic/include/odp_schedule_internal.h
+++ b/platform/linux-generic/include/odp_schedule_internal.h
@@ -40,6 +40,10 @@ void cache_order_info(uint32_t queue_index);
int release_order(void *origin_qe, uint64_t order,
odp_pool_t pool, int enq_called);
+/* API functions implemented in odp_schedule_ordered.c */
+void schedule_order_lock(unsigned lock_index);
+void schedule_order_unlock(unsigned lock_index);
+
#ifdef __cplusplus
}
#endif
diff --git a/platform/linux-generic/odp_schedule.c b/platform/linux-generic/odp_schedule.c
index c5e47fc55..b8d0d2af8 100644
--- a/platform/linux-generic/odp_schedule.c
+++ b/platform/linux-generic/odp_schedule.c
@@ -454,7 +454,7 @@ static void schedule_pktio_stop(sched_cmd_t *sched_cmd)
odp_spinlock_unlock(&sched->poll_cmd_lock);
}
-void odp_schedule_release_atomic(void)
+static void schedule_release_atomic(void)
{
if (sched_local.pri_queue != ODP_QUEUE_INVALID &&
sched_local.num == 0) {
@@ -465,7 +465,7 @@ void odp_schedule_release_atomic(void)
}
}
-void odp_schedule_release_ordered(void)
+static void schedule_release_ordered(void)
{
if (sched_local.origin_qe) {
int rc = release_order(sched_local.origin_qe,
@@ -495,8 +495,8 @@ static inline int copy_events(odp_event_t out_ev[], unsigned int max)
/*
* Schedule queues
*/
-static int schedule(odp_queue_t *out_queue, odp_event_t out_ev[],
- unsigned int max_num, unsigned int max_deq)
+static int do_schedule(odp_queue_t *out_queue, odp_event_t out_ev[],
+ unsigned int max_num, unsigned int max_deq)
{
int i, j;
int ret;
@@ -694,7 +694,7 @@ static int schedule_loop(odp_queue_t *out_queue, uint64_t wait,
int ret;
while (1) {
- ret = schedule(out_queue, out_ev, max_num, max_deq);
+ ret = do_schedule(out_queue, out_ev, max_num, max_deq);
if (ret)
break;
@@ -719,8 +719,7 @@ static int schedule_loop(odp_queue_t *out_queue, uint64_t wait,
return ret;
}
-
-odp_event_t odp_schedule(odp_queue_t *out_queue, uint64_t wait)
+static odp_event_t schedule(odp_queue_t *out_queue, uint64_t wait)
{
odp_event_t ev;
@@ -731,39 +730,34 @@ odp_event_t odp_schedule(odp_queue_t *out_queue, uint64_t wait)
return ev;
}
-
-int odp_schedule_multi(odp_queue_t *out_queue, uint64_t wait,
- odp_event_t events[], int num)
+static int schedule_multi(odp_queue_t *out_queue, uint64_t wait,
+ odp_event_t events[], int num)
{
return schedule_loop(out_queue, wait, events, num, MAX_DEQ);
}
-
-void odp_schedule_pause(void)
+static void schedule_pause(void)
{
sched_local.pause = 1;
}
-
-void odp_schedule_resume(void)
+static void schedule_resume(void)
{
sched_local.pause = 0;
}
-
-uint64_t odp_schedule_wait_time(uint64_t ns)
+static uint64_t schedule_wait_time(uint64_t ns)
{
return ns;
}
-
-int odp_schedule_num_prio(void)
+static int schedule_num_prio(void)
{
return NUM_PRIO;
}
-odp_schedule_group_t odp_schedule_group_create(const char *name,
- const odp_thrmask_t *mask)
+static odp_schedule_group_t schedule_group_create(const char *name,
+ const odp_thrmask_t *mask)
{
odp_schedule_group_t group = ODP_SCHED_GROUP_INVALID;
int i;
@@ -784,7 +778,7 @@ odp_schedule_group_t odp_schedule_group_create(const char *name,
return group;
}
-int odp_schedule_group_destroy(odp_schedule_group_t group)
+static int schedule_group_destroy(odp_schedule_group_t group)
{
int ret;
@@ -804,7 +798,7 @@ int odp_schedule_group_destroy(odp_schedule_group_t group)
return ret;
}
-odp_schedule_group_t odp_schedule_group_lookup(const char *name)
+static odp_schedule_group_t schedule_group_lookup(const char *name)
{
odp_schedule_group_t group = ODP_SCHED_GROUP_INVALID;
int i;
@@ -822,8 +816,8 @@ odp_schedule_group_t odp_schedule_group_lookup(const char *name)
return group;
}
-int odp_schedule_group_join(odp_schedule_group_t group,
- const odp_thrmask_t *mask)
+static int schedule_group_join(odp_schedule_group_t group,
+ const odp_thrmask_t *mask)
{
int ret;
@@ -843,8 +837,8 @@ int odp_schedule_group_join(odp_schedule_group_t group,
return ret;
}
-int odp_schedule_group_leave(odp_schedule_group_t group,
- const odp_thrmask_t *mask)
+static int schedule_group_leave(odp_schedule_group_t group,
+ const odp_thrmask_t *mask)
{
int ret;
@@ -867,8 +861,8 @@ int odp_schedule_group_leave(odp_schedule_group_t group,
return ret;
}
-int odp_schedule_group_thrmask(odp_schedule_group_t group,
- odp_thrmask_t *thrmask)
+static int schedule_group_thrmask(odp_schedule_group_t group,
+ odp_thrmask_t *thrmask)
{
int ret;
@@ -886,8 +880,8 @@ int odp_schedule_group_thrmask(odp_schedule_group_t group,
return ret;
}
-int odp_schedule_group_info(odp_schedule_group_t group,
- odp_schedule_group_info_t *info)
+static int schedule_group_info(odp_schedule_group_t group,
+ odp_schedule_group_info_t *info)
{
int ret;
@@ -935,7 +929,7 @@ static int schedule_thr_rem(odp_schedule_group_t group, int thr)
}
/* This function is a no-op */
-void odp_schedule_prefetch(int num ODP_UNUSED)
+static void schedule_prefetch(int num ODP_UNUSED)
{
}
@@ -967,3 +961,25 @@ const schedule_fn_t schedule_default_fn = {
.init_local = schedule_init_local,
.term_local = schedule_term_local
};
+
+/* Fill in scheduler API calls */
+const schedule_api_t schedule_default_api = {
+ .schedule_wait_time = schedule_wait_time,
+ .schedule = schedule,
+ .schedule_multi = schedule_multi,
+ .schedule_pause = schedule_pause,
+ .schedule_resume = schedule_resume,
+ .schedule_release_atomic = schedule_release_atomic,
+ .schedule_release_ordered = schedule_release_ordered,
+ .schedule_prefetch = schedule_prefetch,
+ .schedule_num_prio = schedule_num_prio,
+ .schedule_group_create = schedule_group_create,
+ .schedule_group_destroy = schedule_group_destroy,
+ .schedule_group_lookup = schedule_group_lookup,
+ .schedule_group_join = schedule_group_join,
+ .schedule_group_leave = schedule_group_leave,
+ .schedule_group_thrmask = schedule_group_thrmask,
+ .schedule_group_info = schedule_group_info,
+ .schedule_order_lock = schedule_order_lock,
+ .schedule_order_unlock = schedule_order_unlock
+};
diff --git a/platform/linux-generic/odp_schedule_if.c b/platform/linux-generic/odp_schedule_if.c
index b6dad51f0..daf6c98c2 100644
--- a/platform/linux-generic/odp_schedule_if.c
+++ b/platform/linux-generic/odp_schedule_if.c
@@ -7,10 +7,111 @@
#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;
#ifdef ODP_SCHEDULE_SP
-const schedule_fn_t *sched_fn = &schedule_sp_fn;
+const schedule_fn_t *sched_fn = &schedule_sp_fn;
+const schedule_api_t *sched_api = &schedule_sp_api;
#else
-const schedule_fn_t *sched_fn = &schedule_default_fn;
+const schedule_fn_t *sched_fn = &schedule_default_fn;
+const schedule_api_t *sched_api = &schedule_default_api;
#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_ordered.c b/platform/linux-generic/odp_schedule_ordered.c
index 626c35187..17d3825ca 100644
--- a/platform/linux-generic/odp_schedule_ordered.c
+++ b/platform/linux-generic/odp_schedule_ordered.c
@@ -771,7 +771,7 @@ int release_order(void *origin_qe_ptr, uint64_t order,
return 0;
}
-void odp_schedule_order_lock(unsigned lock_index)
+void schedule_order_lock(unsigned lock_index)
{
queue_entry_t *origin_qe;
uint64_t sync, sync_out;
@@ -795,7 +795,7 @@ void odp_schedule_order_lock(unsigned lock_index)
}
}
-void odp_schedule_order_unlock(unsigned lock_index)
+void schedule_order_unlock(unsigned lock_index)
{
queue_entry_t *origin_qe;