aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-dpdk
diff options
context:
space:
mode:
authorMatias Elo <matias.elo@nokia.com>2023-04-13 17:13:39 +0300
committerMatias Elo <matias.elo@nokia.com>2023-04-18 14:23:54 +0300
commit2cea736667089fe18b0279dd61e1c1d3a3862ea0 (patch)
treef91b72c6b08650d33e9fe90bfffa466baad23070 /platform/linux-dpdk
parent6e5044dfaa772e02561e83f74952e743bb88ef4f (diff)
Port 14f8e6637 "linux-gen: sched: add function which returns the scheduler's API function table"
Port original commit from linux-generic. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com>
Diffstat (limited to 'platform/linux-dpdk')
-rw-r--r--platform/linux-dpdk/odp_schedule_eventdev.c10
-rw-r--r--platform/linux-dpdk/odp_schedule_if.c16
2 files changed, 15 insertions, 11 deletions
diff --git a/platform/linux-dpdk/odp_schedule_eventdev.c b/platform/linux-dpdk/odp_schedule_eventdev.c
index 8a6a1dd45..07cce4643 100644
--- a/platform/linux-dpdk/odp_schedule_eventdev.c
+++ b/platform/linux-dpdk/odp_schedule_eventdev.c
@@ -1068,6 +1068,13 @@ static void schedule_print(void)
_ODP_PRINT("\n");
}
+const _odp_schedule_api_fn_t _odp_schedule_eventdev_api;
+
+static const _odp_schedule_api_fn_t *sched_api(void)
+{
+ return &_odp_schedule_eventdev_api;
+}
+
/* Fill in scheduler interface */
const schedule_fn_t _odp_schedule_eventdev_fn = {
.pktio_start = schedule_pktio_start,
@@ -1085,7 +1092,8 @@ const schedule_fn_t _odp_schedule_eventdev_fn = {
.order_lock = order_lock,
.order_unlock = order_unlock,
.max_ordered_locks = schedule_max_ordered_locks,
- .get_config = NULL
+ .get_config = NULL,
+ .sched_api = sched_api,
};
/* Fill in scheduler API calls */
diff --git a/platform/linux-dpdk/odp_schedule_if.c b/platform/linux-dpdk/odp_schedule_if.c
index fa6a3df97..dbb098e8b 100644
--- a/platform/linux-dpdk/odp_schedule_if.c
+++ b/platform/linux-dpdk/odp_schedule_if.c
@@ -33,14 +33,8 @@ int _odp_schedule_configured(void)
#include <odp/visibility_end.h>
extern const schedule_fn_t _odp_schedule_sp_fn;
-extern const _odp_schedule_api_fn_t _odp_schedule_sp_api;
-
extern const schedule_fn_t _odp_schedule_basic_fn;
-extern const _odp_schedule_api_fn_t _odp_schedule_basic_api;
-
extern const schedule_fn_t _odp_schedule_eventdev_fn;
-extern const _odp_schedule_api_fn_t _odp_schedule_eventdev_api;
-
const schedule_fn_t *_odp_sched_fn;
int _odp_sched_id;
@@ -156,21 +150,23 @@ int _odp_schedule_init_global(void)
if (!strcmp(sched, "basic")) {
_odp_sched_id = _ODP_SCHED_ID_BASIC;
_odp_sched_fn = &_odp_schedule_basic_fn;
- _odp_sched_api = &_odp_schedule_basic_api;
} else if (!strcmp(sched, "sp")) {
_odp_sched_id = _ODP_SCHED_ID_SP;
_odp_sched_fn = &_odp_schedule_sp_fn;
- _odp_sched_api = &_odp_schedule_sp_api;
} else if (!strcmp(sched, "eventdev")) {
_odp_sched_id = _ODP_SCHED_ID_EVENTDEV;
_odp_sched_fn = &_odp_schedule_eventdev_fn;
- _odp_sched_api = &_odp_schedule_eventdev_api;
} else {
_ODP_ABORT("Unknown scheduler specified via ODP_SCHEDULER\n");
return -1;
}
- return _odp_sched_fn->init_global();
+ if (_odp_sched_fn->init_global())
+ return -1;
+
+ _odp_sched_api = _odp_sched_fn->sched_api();
+
+ return 0;
}
int _odp_schedule_term_global(void)