Skip to content

Commit

Permalink
linux-gen: sched: add config request function to interface
Browse files Browse the repository at this point in the history
Added config request function to scheduler internal interface.
Other modules may use this to examine scheduler configuration.

Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>
Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
  • Loading branch information
Petri Savolainen authored and muvarov committed Oct 31, 2018
1 parent 297cd7e commit 380fa45
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 3 deletions.
12 changes: 11 additions & 1 deletion platform/linux-generic/include/odp_schedule_if.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ extern "C" {
/* Number of ordered locks per queue */
#define SCHEDULE_ORDERED_LOCKS_PER_QUEUE 2

typedef struct schedule_config_t {
struct {
int all;
int worker;
int control;
} group_enable;

} schedule_config_t;

typedef void (*schedule_pktio_start_fn_t)(int pktio_index,
int num_in_queue,
int in_queue_idx[],
Expand All @@ -44,7 +53,7 @@ typedef void (*schedule_order_unlock_lock_fn_t)(void);
typedef void (*schedule_order_lock_start_fn_t)(void);
typedef void (*schedule_order_lock_wait_fn_t)(void);
typedef uint32_t (*schedule_max_ordered_locks_fn_t)(void);
typedef void (*schedule_save_context_fn_t)(uint32_t queue_index);
typedef void (*schedule_config_fn_t)(schedule_config_t *config);

typedef struct schedule_fn_t {
schedule_pktio_start_fn_t pktio_start;
Expand All @@ -65,6 +74,7 @@ typedef struct schedule_fn_t {
schedule_order_lock_wait_fn_t wait_order_lock;
schedule_order_unlock_lock_fn_t order_unlock_lock;
schedule_max_ordered_locks_fn_t max_ordered_locks;
schedule_config_fn_t config;

} schedule_fn_t;

Expand Down
43 changes: 41 additions & 2 deletions platform/linux-generic/odp_schedule_basic.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,9 @@ typedef struct {

order_context_t order[ODP_CONFIG_QUEUES];

/* Scheduler interface config options (not used in fast path) */
schedule_config_t config_if;

} sched_global_t;

/* Check that queue[] variables are large enough */
Expand Down Expand Up @@ -320,7 +323,37 @@ static int read_config_file(sched_global_t *sched)
return -1;
}
}
ODP_PRINT("\n\n");

ODP_PRINT("\n");

str = "sched_basic.group_enable.all";
if (!_odp_libconfig_lookup_int(str, &val)) {
ODP_ERR("Config option '%s' not found.\n", str);
return -1;
}

sched->config_if.group_enable.all = val;
ODP_PRINT(" %s: %i\n", str, val);

str = "sched_basic.group_enable.worker";
if (!_odp_libconfig_lookup_int(str, &val)) {
ODP_ERR("Config option '%s' not found.\n", str);
return -1;
}

sched->config_if.group_enable.worker = val;
ODP_PRINT(" %s: %i\n", str, val);

str = "sched_basic.group_enable.control";
if (!_odp_libconfig_lookup_int(str, &val)) {
ODP_ERR("Config option '%s' not found.\n", str);
return -1;
}

sched->config_if.group_enable.control = val;
ODP_PRINT(" %s: %i\n", str, val);

ODP_PRINT("\n");

return 0;
}
Expand Down Expand Up @@ -1474,6 +1507,11 @@ static int schedule_num_grps(void)
return NUM_SCHED_GRPS;
}

static void schedule_config(schedule_config_t *config)
{
*config = *(&sched->config_if);
}

/* Fill in scheduler interface */
const schedule_fn_t schedule_basic_fn = {
.pktio_start = schedule_pktio_start,
Expand All @@ -1490,7 +1528,8 @@ const schedule_fn_t schedule_basic_fn = {
.term_local = schedule_term_local,
.order_lock = order_lock,
.order_unlock = order_unlock,
.max_ordered_locks = schedule_max_ordered_locks
.max_ordered_locks = schedule_max_ordered_locks,
.config = schedule_config
};

/* Fill in scheduler API calls */
Expand Down

0 comments on commit 380fa45

Please sign in to comment.