Skip to content

Commit

Permalink
linux-gen: queue, schedule: move scheduler capabilities to scheduler
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>
Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>
Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>
Reviewed-by: Petri Savolainen <petri.savolainen@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
  • Loading branch information
Dmitry Eremin-Solenikov authored and muvarov committed Nov 30, 2018
1 parent 8616eb0 commit 9b1647c
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 1 deletion.
1 change: 1 addition & 0 deletions platform/linux-generic/include/odp_schedule_if.h
Expand Up @@ -90,6 +90,7 @@ void sched_cb_pktio_stop_finalize(int pktio_index);
/* API functions */
typedef struct {
uint64_t (*schedule_wait_time)(uint64_t ns);
int (*schedule_capability)(odp_schedule_capability_t *capa);
odp_event_t (*schedule)(odp_queue_t *from, uint64_t wait);
int (*schedule_multi)(odp_queue_t *from, uint64_t wait,
odp_event_t events[], int num);
Expand Down
4 changes: 3 additions & 1 deletion platform/linux-generic/odp_queue_basic.c
Expand Up @@ -47,7 +47,7 @@ static int queue_init(queue_entry_t *queue, const char *name,
queue_global_t *queue_glb;
extern _odp_queue_inline_offset_t _odp_queue_inline_offset;

static int queue_capa(odp_queue_capability_t *capa, int sched)
static int queue_capa(odp_queue_capability_t *capa, int sched ODP_UNUSED)
{
memset(capa, 0, sizeof(odp_queue_capability_t));

Expand All @@ -60,11 +60,13 @@ static int queue_capa(odp_queue_capability_t *capa, int sched)
capa->sched.max_num = capa->max_queues;
capa->sched.max_size = queue_glb->config.max_queue_size;

#if ODP_DEPRECATED_API
if (sched) {
capa->max_ordered_locks = sched_fn->max_ordered_locks();
capa->max_sched_groups = sched_fn->num_grps();
capa->sched_prios = odp_schedule_num_prio();
}
#endif

return 0;
}
Expand Down
2 changes: 2 additions & 0 deletions platform/linux-generic/odp_queue_scalable.c
Expand Up @@ -313,9 +313,11 @@ static int queue_capability(odp_queue_capability_t *capa)

/* Reserve some queues for internal use */
capa->max_queues = ODP_CONFIG_QUEUES - NUM_INTERNAL_QUEUES;
#if ODP_DEPRECATED_API
capa->max_ordered_locks = sched_fn->max_ordered_locks();
capa->max_sched_groups = sched_fn->num_grps();
capa->sched_prios = odp_schedule_num_prio();
#endif
capa->plain.max_num = ODP_CONFIG_QUEUES - NUM_INTERNAL_QUEUES;
capa->plain.max_size = 0;
capa->sched.max_num = ODP_CONFIG_QUEUES - NUM_INTERNAL_QUEUES;
Expand Down
12 changes: 12 additions & 0 deletions platform/linux-generic/odp_schedule_basic.c
Expand Up @@ -1550,6 +1550,17 @@ static int schedule_num_grps(void)
static void schedule_config(schedule_config_t *config)
{
*config = *(&sched->config_if);
};

static int schedule_capability(odp_schedule_capability_t *capa)
{
memset(capa, 0, sizeof(odp_schedule_capability_t));

capa->max_ordered_locks = schedule_max_ordered_locks();
capa->max_groups = schedule_num_grps();
capa->max_prios = schedule_num_prio();

return 0;
}

/* Fill in scheduler interface */
Expand All @@ -1575,6 +1586,7 @@ const schedule_fn_t schedule_basic_fn = {
/* Fill in scheduler API calls */
const schedule_api_t schedule_basic_api = {
.schedule_wait_time = schedule_wait_time,
.schedule_capability = schedule_capability,
.schedule = schedule,
.schedule_multi = schedule_multi,
.schedule_multi_wait = schedule_multi_wait,
Expand Down
5 changes: 5 additions & 0 deletions platform/linux-generic/odp_schedule_if.c
Expand Up @@ -30,6 +30,11 @@ uint64_t odp_schedule_wait_time(uint64_t ns)
return sched_api->schedule_wait_time(ns);
}

int odp_schedule_capability(odp_schedule_capability_t *capa)
{
return sched_api->schedule_capability(capa);
}

odp_event_t odp_schedule(odp_queue_t *from, uint64_t wait)
{
return sched_api->schedule(from, wait);
Expand Down
12 changes: 12 additions & 0 deletions platform/linux-generic/odp_schedule_scalable.c
Expand Up @@ -2107,6 +2107,17 @@ static uint32_t schedule_max_ordered_locks(void)
return CONFIG_QUEUE_MAX_ORD_LOCKS;
}

static int schedule_capability(odp_schedule_capability_t *capa)
{
memset(capa, 0, sizeof(odp_schedule_capability_t));

capa->max_ordered_locks = schedule_max_ordered_locks();
capa->max_groups = num_grps();
capa->max_prios = schedule_num_prio();

return 0;
}

const schedule_fn_t schedule_scalable_fn = {
.pktio_start = pktio_start,
.thr_add = thr_add,
Expand All @@ -2127,6 +2138,7 @@ const schedule_fn_t schedule_scalable_fn = {

const schedule_api_t schedule_scalable_api = {
.schedule_wait_time = schedule_wait_time,
.schedule_capability = schedule_capability,
.schedule = schedule,
.schedule_multi = schedule_multi,
.schedule_multi_wait = schedule_multi_wait,
Expand Down
12 changes: 12 additions & 0 deletions platform/linux-generic/odp_schedule_sp.c
Expand Up @@ -925,6 +925,17 @@ static void order_unlock(void)
{
}

static int schedule_capability(odp_schedule_capability_t *capa)
{
memset(capa, 0, sizeof(odp_schedule_capability_t));

capa->max_ordered_locks = max_ordered_locks();
capa->max_groups = num_grps();
capa->max_prios = schedule_num_prio();

return 0;
}

/* Fill in scheduler interface */
const schedule_fn_t schedule_sp_fn = {
.pktio_start = pktio_start,
Expand All @@ -947,6 +958,7 @@ 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,
.schedule_capability = schedule_capability,
.schedule = schedule,
.schedule_multi = schedule_multi,
.schedule_multi_wait = schedule_multi_wait,
Expand Down

0 comments on commit 9b1647c

Please sign in to comment.