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, master has been updated via 87a81d8b4feb08fdf60a960ac2b003233fc0ae3b (commit) via 9909800501e6a09654328e76496adf31f1750f68 (commit) via 3e9428c476bf8527e9c294f298fa550f634ae40b (commit) via b0d8afdb22c92c4f0974acbe30e346110b8a8fc6 (commit) via 89f4d6b463c93e2e87634f0d17f214d967b66bdd (commit) via 14f3d11428650ed3af3bfa1bf728fc1a64e52da7 (commit) via 410a0d38d13b08003d54d316868f941c5d570c54 (commit) via 9edf20ac38a6c7dc61cb00fbd776bea6afa264c7 (commit) via 9287482b9debd49de84b6ec1640604edeaa9f9e1 (commit) via b484f32b2464a53946a88013a0ee547415cdf414 (commit) via ddfe2d945b3dfe6e443acf18f86ce30f60b325a4 (commit) via e721288bf73f752015162eb594e294e58fb96a07 (commit) via 6aeb2eed6c65cb5830200c236b98b09a9a0f9245 (commit) via eded2529a711a731220322d37af569b7e08c41e9 (commit) via f27ee888c0ed07a08eafaea596094125cb9fdcc6 (commit) via 2aee8a5840602472d46ae873c9d9f87cf54461e7 (commit) via 206c476a3e4d60713a8c279eee78add66421d0e6 (commit) via eee646125e8e6ae3222268448be423a351e6043e (commit) via 930b0042689ca69851e2fe7abd0c9d35b61e76e5 (commit) via 81e5aead1d8996907911463c9025a0b852bbfae8 (commit) via 7fdf6e03af1608e476fa0296d77de50f618b1754 (commit) from 9c3f29b03dafed4ce85230297fd4e6fdc5c3323e (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 87a81d8b4feb08fdf60a960ac2b003233fc0ae3b Author: Petri Savolainen petri.savolainen@linaro.org Date: Tue Dec 18 16:37:23 2018 +0200
linux-gen: sched: dummy flow aware implementation
Implement flow aware scheduling API with least possible changes. Scheduler does not care about flow IDs, but synchronizes still on queue level. This is functionally correct, but does provide parallelism between different flows of a queue. So, application does not benefit from using flows, but functions correctly. Maximum number of flows per queue is limited to 256 just to minimize number of bytes used in buffer header.
Signed-off-by: Petri Savolainen petri.savolainen@linaro.org Reviewed-by: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/platform/linux-generic/include/odp_buffer_internal.h b/platform/linux-generic/include/odp_buffer_internal.h index c6e1345d..5e0b2bcc 100644 --- a/platform/linux-generic/include/odp_buffer_internal.h +++ b/platform/linux-generic/include/odp_buffer_internal.h @@ -54,6 +54,9 @@ ODP_STATIC_ASSERT(ODP_CONFIG_POOLS <= (0xFF + 1), "TOO_MANY_POOLS"); /* Check that buffer index fit into bit field */ ODP_STATIC_ASSERT(CONFIG_POOL_MAX_NUM <= (0xFFFFFF + 1), "TOO_LARGE_POOL");
+/* Type size limits number of flow IDs supported */ +#define BUF_HDR_MAX_FLOW_ID 255 + /* Common buffer header */ struct ODP_ALIGNED_CACHE odp_buffer_hdr_t { /* Combined pool and buffer index */ @@ -94,6 +97,9 @@ struct ODP_ALIGNED_CACHE odp_buffer_hdr_t { /* Event type. Maybe different than pool type (crypto compl event) */ int8_t event_type;
+ /* Event flow id */ + uint8_t flow_id; + /* Initial buffer tail pointer */ uint8_t *buf_end;
@@ -120,6 +126,20 @@ static inline odp_buffer_t buf_from_buf_hdr(odp_buffer_hdr_t *hdr) return (odp_buffer_t)hdr; }
+static inline uint32_t event_flow_id(odp_event_t ev) +{ + odp_buffer_hdr_t *buf_hdr = (odp_buffer_hdr_t *)(uintptr_t)ev; + + return buf_hdr->flow_id; +} + +static inline void event_flow_id_set(odp_event_t ev, uint32_t flow_id) +{ + odp_buffer_hdr_t *buf_hdr = (odp_buffer_hdr_t *)(uintptr_t)ev; + + buf_hdr->flow_id = flow_id; +} + #ifdef __cplusplus } #endif diff --git a/platform/linux-generic/odp_event.c b/platform/linux-generic/odp_event.c index bdde93e1..efcbc1e2 100644 --- a/platform/linux-generic/odp_event.c +++ b/platform/linux-generic/odp_event.c @@ -59,17 +59,14 @@ int odp_event_type_multi(const odp_event_t event[], int num, return i; }
-/* For now ODP generic does not support flow awareness, - * so all flow ids are zero. */ -uint32_t odp_event_flow_id(odp_event_t event ODP_UNUSED) +uint32_t odp_event_flow_id(odp_event_t event) { - return 0; + return event_flow_id(event); }
-void odp_event_flow_id_set(odp_event_t event ODP_UNUSED, - uint32_t flow_id ODP_UNUSED) +void odp_event_flow_id_set(odp_event_t event, uint32_t flow_id) { - /* Do nothing */ + event_flow_id_set(event, flow_id); }
void odp_event_free(odp_event_t event) diff --git a/platform/linux-generic/odp_schedule_basic.c b/platform/linux-generic/odp_schedule_basic.c index e5a9cfc7..6176c951 100644 --- a/platform/linux-generic/odp_schedule_basic.c +++ b/platform/linux-generic/odp_schedule_basic.c @@ -1579,6 +1579,7 @@ static int schedule_capability(odp_schedule_capability_t *capa) capa->max_prios = schedule_num_prio(); capa->max_queues = ODP_CONFIG_QUEUES - NUM_INTERNAL_QUEUES; capa->max_queue_size = queue_glb->config.max_queue_size; + capa->max_flow_id = BUF_HDR_MAX_FLOW_ID;
return 0; }
commit 9909800501e6a09654328e76496adf31f1750f68 Author: Petri Savolainen petri.savolainen@linaro.org Date: Tue Dec 18 09:55:12 2018 +0200
validation: sched: add flow aware test case
Move scheduler config call into the test suite as some test cases need non-default config. Scheduler configuration can be set only once, so all test cases share the config. Flow aware mode is enabled, when capability allows that.
Signed-off-by: Petri Savolainen petri.savolainen@linaro.org Reviewed-by: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/test/validation/api/scheduler/scheduler.c b/test/validation/api/scheduler/scheduler.c index 27377580..bdcd7b2d 100644 --- a/test/validation/api/scheduler/scheduler.c +++ b/test/validation/api/scheduler/scheduler.c @@ -8,6 +8,7 @@
#include <odp_api.h> #include "odp_cunit_common.h" +#include <odp/helper/odph_api.h>
#define MAX_WORKERS_THREADS 32 #define MAX_ORDERED_LOCKS 2 @@ -24,6 +25,9 @@
#define TEST_QUEUE_SIZE_NUM_EV 50
+#define MAX_FLOWS 16 +#define FLOW_TEST_NUM_EV (10 * MAX_FLOWS) + #define GLOBALS_SHM_NAME "test_globals" #define MSG_POOL_NAME "msg_pool" #define QUEUE_CTX_POOL_NAME "queue_ctx_pool" @@ -62,6 +66,7 @@ typedef struct { odp_pool_t pool; odp_pool_t queue_ctx_pool; uint32_t max_sched_queue_size; + uint64_t num_flows; odp_ticketlock_t lock; odp_spinlock_t atomic_lock; struct { @@ -1846,6 +1851,32 @@ static int scheduler_suite_init(void) odp_pool_t pool; thread_args_t *args; odp_pool_param_t params; + uint64_t num_flows; + odp_schedule_capability_t sched_capa; + odp_schedule_config_t sched_config; + + if (odp_schedule_capability(&sched_capa)) { + printf("odp_schedule_capability() failed\n"); + return -1; + } + + num_flows = 0; + odp_schedule_config_init(&sched_config); + + /* Enable flow aware scheduling */ + if (sched_capa.max_flow_id > 0) { + num_flows = MAX_FLOWS; + if ((MAX_FLOWS - 1) > sched_capa.max_flow_id) + num_flows = sched_capa.max_flow_id + 1; + + sched_config.max_flow_id = num_flows - 1; + } + + /* Configure the scheduler. All test cases share the config. */ + if (odp_schedule_config(&sched_config)) { + printf("odp_schedule_config() failed.\n"); + return -1; + }
odp_pool_param_init(¶ms); params.buf.size = BUF_SIZE; @@ -1872,6 +1903,8 @@ static int scheduler_suite_init(void)
memset(globals, 0, sizeof(test_globals_t));
+ globals->num_flows = num_flows; + globals->num_workers = odp_cpumask_default_worker(&mask, 0); if (globals->num_workers > MAX_WORKERS) globals->num_workers = MAX_WORKERS; @@ -1975,6 +2008,127 @@ static int scheduler_suite_term(void) return 0; }
+static int check_flow_aware_support(void) +{ + if (globals->num_flows == 0) { + printf("\nTest: scheduler_test_flow_aware: SKIPPED\n"); + return ODP_TEST_INACTIVE; + } + + return ODP_TEST_ACTIVE; +} + +static void scheduler_test_flow_aware(void) +{ + odp_schedule_capability_t sched_capa; + odp_schedule_config_t sched_config; + odp_pool_param_t pool_param; + odp_pool_t pool; + odp_queue_param_t queue_param; + odp_queue_t queue, from; + uint32_t j, queue_size, num, num_flows, flow_id; + odp_buffer_t buf; + odp_event_t ev; + int i, ret; + uint32_t flow_stat[MAX_FLOWS]; + odp_schedule_sync_t sync[] = {ODP_SCHED_SYNC_PARALLEL, + ODP_SCHED_SYNC_ATOMIC, + ODP_SCHED_SYNC_ORDERED}; + + /* Test should be skipped when no flows */ + CU_ASSERT_FATAL(globals->num_flows); + CU_ASSERT_FATAL(odp_schedule_capability(&sched_capa) == 0); + + num_flows = globals->num_flows; + + queue_size = FLOW_TEST_NUM_EV; + odp_schedule_config_init(&sched_config); + if (sched_config.queue_size && + queue_size > sched_config.queue_size) + queue_size = sched_config.queue_size; + + odp_pool_param_init(&pool_param); + pool_param.buf.size = 100; + pool_param.buf.align = 0; + pool_param.buf.num = FLOW_TEST_NUM_EV; + pool_param.type = ODP_POOL_BUFFER; + + pool = odp_pool_create("test_flow_aware", &pool_param); + + CU_ASSERT_FATAL(pool != ODP_POOL_INVALID); + + for (i = 0; i < 3; i++) { + memset(flow_stat, 0, sizeof(flow_stat)); + flow_id = 0; + + odp_queue_param_init(&queue_param); + queue_param.type = ODP_QUEUE_TYPE_SCHED; + queue_param.sched.prio = odp_schedule_default_prio(); + queue_param.sched.sync = sync[i]; + queue_param.sched.group = ODP_SCHED_GROUP_ALL; + queue_param.size = queue_size; + + queue = odp_queue_create("test_flow_aware", &queue_param); + + CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID); + + for (j = 0; j < queue_size; j++) { + buf = odp_buffer_alloc(pool); + CU_ASSERT_FATAL(buf != ODP_BUFFER_INVALID); + + ev = odp_buffer_to_event(buf); + + odp_event_flow_id_set(ev, flow_id); + CU_ASSERT(odp_event_flow_id(ev) == flow_id); + + ret = odp_queue_enq(queue, ev); + CU_ASSERT(ret == 0); + + if (ret) { + odp_event_free(ev); + continue; + } + + flow_stat[flow_id]++; + + flow_id++; + if (flow_id == num_flows) + flow_id = 0; + } + + num = 0; + for (j = 0; j < 100 * FLOW_TEST_NUM_EV; j++) { + ev = odp_schedule(&from, ODP_SCHED_NO_WAIT); + + if (ev == ODP_EVENT_INVALID) + continue; + + CU_ASSERT(from == queue); + + flow_id = odp_event_flow_id(ev); + flow_stat[flow_id]--; + + odp_event_free(ev); + num++; + } + + CU_ASSERT(num == queue_size); + + for (j = 0; j < num_flows; j++) { + CU_ASSERT(flow_stat[j] == 0); + if (flow_stat[j]) + printf("flow id %" PRIu32 ", missing %" PRIi32 + " events\n", j, flow_stat[j]); + } + + drain_queues(); + CU_ASSERT_FATAL(odp_queue_destroy(queue) == 0); + } + + CU_ASSERT(odp_pool_destroy(pool) == 0); +} + +/* Default scheduler config */ odp_testinfo_t scheduler_suite[] = { ODP_TEST_INFO(scheduler_test_capa), ODP_TEST_INFO(scheduler_test_wait_time), @@ -1985,6 +2139,8 @@ odp_testinfo_t scheduler_suite[] = { ODP_TEST_INFO(scheduler_test_groups), ODP_TEST_INFO(scheduler_test_pause_resume), ODP_TEST_INFO(scheduler_test_ordered_lock), + ODP_TEST_INFO_CONDITIONAL(scheduler_test_flow_aware, + check_flow_aware_support), ODP_TEST_INFO(scheduler_test_parallel), ODP_TEST_INFO(scheduler_test_atomic), ODP_TEST_INFO(scheduler_test_ordered), @@ -2025,6 +2181,32 @@ odp_suiteinfo_t scheduler_suites[] = { ODP_SUITE_INFO_NULL, };
+static int global_init(odp_instance_t *inst) +{ + odp_init_t init_param; + odph_helper_options_t helper_options; + + if (odph_options(&helper_options)) { + fprintf(stderr, "error: odph_options() failed.\n"); + return -1; + } + + odp_init_param_init(&init_param); + init_param.mem_model = helper_options.mem_model; + + if (0 != odp_init_global(inst, &init_param, NULL)) { + fprintf(stderr, "error: odp_init_global() failed.\n"); + return -1; + } + + if (0 != odp_init_local(*inst, ODP_THREAD_CONTROL)) { + fprintf(stderr, "error: odp_init_local() failed.\n"); + return -1; + } + + return 0; +} + int main(int argc, char *argv[]) { int ret; @@ -2033,6 +2215,7 @@ int main(int argc, char *argv[]) if (odp_cunit_parse_options(argc, argv)) return -1;
+ odp_cunit_register_global_init(global_init); ret = odp_cunit_register(scheduler_suites);
if (ret == 0)
commit 3e9428c476bf8527e9c294f298fa550f634ae40b Author: Petri Savolainen petri.savolainen@linaro.org Date: Tue Dec 18 12:56:10 2018 +0200
linux-gen: sched: check that config has been done
Check always on slow path functions that schedule config has been called. Fast path functions do the check only when debugging is enabled.
Signed-off-by: Petri Savolainen petri.savolainen@linaro.org Reviewed-by: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/platform/linux-generic/odp_schedule_basic.c b/platform/linux-generic/odp_schedule_basic.c index 48f232e6..e5a9cfc7 100644 --- a/platform/linux-generic/odp_schedule_basic.c +++ b/platform/linux-generic/odp_schedule_basic.c @@ -597,7 +597,10 @@ static int schedule_init_queue(uint32_t queue_index, int i; int prio = prio_level_from_api(sched_param->prio);
- ODP_ASSERT(_odp_schedule_configured); + if (_odp_schedule_configured == 0) { + ODP_ERR("Scheduler has not been configured\n"); + return -1; + }
pri_set_queue(queue_index, prio); sched->queue[queue_index].grp = sched_param->group; diff --git a/platform/linux-generic/odp_schedule_if.c b/platform/linux-generic/odp_schedule_if.c index cb52f155..ba903e58 100644 --- a/platform/linux-generic/odp_schedule_if.c +++ b/platform/linux-generic/odp_schedule_if.c @@ -24,10 +24,7 @@ extern const schedule_api_t schedule_scalable_api;
const schedule_fn_t *sched_fn; const schedule_api_t *sched_api; - -#ifdef ODP_DEBUG int _odp_schedule_configured; -#endif
uint64_t odp_schedule_wait_time(uint64_t ns) { @@ -51,7 +48,10 @@ int odp_schedule_config(const odp_schedule_config_t *config) int ret; odp_schedule_config_t defconfig;
- ODP_ASSERT(!_odp_schedule_configured); + if (_odp_schedule_configured) { + ODP_ERR("Scheduler has been configured already\n"); + return -1; + }
if (!config) { odp_schedule_config_init(&defconfig); @@ -59,10 +59,9 @@ int odp_schedule_config(const odp_schedule_config_t *config) }
ret = sched_api->schedule_config(config); -#ifdef ODP_DEBUG + if (ret >= 0) _odp_schedule_configured = 1; -#endif
return ret; } diff --git a/platform/linux-generic/odp_schedule_sp.c b/platform/linux-generic/odp_schedule_sp.c index eec88a60..e7b37895 100644 --- a/platform/linux-generic/odp_schedule_sp.c +++ b/platform/linux-generic/odp_schedule_sp.c @@ -375,10 +375,10 @@ static int init_queue(uint32_t qi, const odp_schedule_param_t *sched_param) odp_schedule_group_t group = sched_param->group; int prio = 0;
-#ifdef ODP_DEBUG - if (!_odp_schedule_configured) - ODP_ABORT("Scheduler not configured!\n"); -#endif + if (_odp_schedule_configured == 0) { + ODP_ERR("Scheduler has not been configured\n"); + return -1; + }
if (group < 0 || group >= NUM_GROUP) return -1;
commit b0d8afdb22c92c4f0974acbe30e346110b8a8fc6 Author: Petri Savolainen petri.savolainen@linaro.org Date: Mon Dec 17 16:03:02 2018 +0200
api: sched: max_flow_id capability
Change max number of flows to max flow ID. This way implementation can utilize full 32 bits of flow ID space.
Also, note explicitly that odp_schedule_config() must be called only once.
Signed-off-by: Petri Savolainen petri.savolainen@linaro.org Reviewed-by: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/include/odp/api/spec/schedule.h b/include/odp/api/spec/schedule.h index 43292124..fa66f260 100644 --- a/include/odp/api/spec/schedule.h +++ b/include/odp/api/spec/schedule.h @@ -271,8 +271,8 @@ void odp_schedule_config_init(odp_schedule_config_t *config); * * Initialize and configure scheduler with global configuration options * to schedule events across different scheduled queues. - * This function must be called before scheduler is used (any other scheduler - * function is called except odp_schedule_capability() and + * This function must be called only once and before scheduler is used + * (any other scheduler function is called except odp_schedule_capability() and * odp_schedule_config_init()) or any queues are created (by application itself * or by other ODP modules). * An application can pass NULL value to use default configuration. It will diff --git a/include/odp/api/spec/schedule_types.h b/include/odp/api/spec/schedule_types.h index 3648c64e..2acec0db 100644 --- a/include/odp/api/spec/schedule_types.h +++ b/include/odp/api/spec/schedule_types.h @@ -196,12 +196,13 @@ typedef struct odp_schedule_capability_t { * events. */ uint32_t max_queue_size;
- /** Maximum supported flows per queue. - * Specifies the maximum number of flows per queue supported by the - * implementation. A value of 0 indicates flow aware mode is not - * supported. - */ - uint32_t max_flows; + /** Maximum flow ID per queue + * + * Valid flow ID range in flow aware mode of scheduling is from 0 to + * this maximum value. So, maximum number of flows per queue is this + * value plus one. A value of 0 indicates that flow aware mode is not + * supported. */ + uint32_t max_flow_id;
/** Lock-free (ODP_NONBLOCKING_LF) queues support. * The specification is the same as for the blocking implementation. */ @@ -230,21 +231,24 @@ typedef struct odp_schedule_config_t { */ uint32_t queue_size;
- /** Number of flows per queue to be supported. Scheduler enables flow - * aware mode when flow count is configured greater than 1 (up to - * 'max_flows' capability). + /** Maximum flow ID per queue * - * Flows are lightweight entities and events can be assigned to - * specific flows by the application using odp_event_flow_id_set() - * before enqueuing the event into the scheduler. This value is ignored - * unless scheduler supports flow aware mode. + * This value must not exceed 'max_flow_id' capability. Flow aware + * mode of scheduling is enabled when the value is greater than 0. + * The default value is 0. * - * This number should be less than maximum flow supported by the - * implementation. The default value is zero. + * Application can assign events to specific flows by calling + * odp_event_flow_id_set() before enqueuing events into a scheduled + * queue. When in flow aware mode, the event flow id value affects + * scheduling of the event and synchronization is maintained per flow + * within each queue. * - * @see odp_schedule_capability_t + * Depeding on implementation, there may be much more flows supported + * than queues, as flows are lightweight entities. + * + * @see odp_schedule_capability_t, odp_event_flow_id() */ - uint32_t num_flows; + uint32_t max_flow_id;
} odp_schedule_config_t;
commit 89f4d6b463c93e2e87634f0d17f214d967b66bdd Author: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Date: Thu Nov 29 13:56:17 2018 +0300
api: event: define ODP_EVENT_PACKET_COMP
Signed-off-by: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/include/odp/api/abi-default/event.h b/include/odp/api/abi-default/event.h index b0eee9cb..3f88681b 100644 --- a/include/odp/api/abi-default/event.h +++ b/include/odp/api/abi-default/event.h @@ -36,7 +36,8 @@ typedef enum odp_event_subtype_t { ODP_EVENT_NO_SUBTYPE = 0, ODP_EVENT_PACKET_BASIC = 1, ODP_EVENT_PACKET_CRYPTO = 2, - ODP_EVENT_PACKET_IPSEC = 3 + ODP_EVENT_PACKET_IPSEC = 3, + ODP_EVENT_PACKET_COMP = 4 } odp_event_subtype_t;
/** diff --git a/include/odp/api/spec/event.h b/include/odp/api/spec/event.h index affdc7b0..a6b8fdbf 100644 --- a/include/odp/api/spec/event.h +++ b/include/odp/api/spec/event.h @@ -78,6 +78,10 @@ extern "C" { * List of event subtypes: * - ODP_EVENT_PACKET_BASIC * - Packet event (odp_packet_t) with basic packet metadata + * - ODP_EVENT_PACKET_COMP + * - Packet event (odp_packet_t) generated as a result of an compression/ + * decompression operation. It contains compression specific metadata in + * addition to the basic packet metadata. * - ODP_EVENT_PACKET_CRYPTO * - Packet event (odp_packet_t) generated as a result of a Crypto * operation. It contains crypto specific metadata in addition to the
commit 14f3d11428650ed3af3bfa1bf728fc1a64e52da7 Author: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Date: Fri Nov 23 03:24:39 2018 +0300
linux-gen: event: support flow-awareness API
Signed-off-by: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@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
diff --git a/platform/linux-generic/odp_event.c b/platform/linux-generic/odp_event.c index bb378528..bdde93e1 100644 --- a/platform/linux-generic/odp_event.c +++ b/platform/linux-generic/odp_event.c @@ -59,6 +59,19 @@ int odp_event_type_multi(const odp_event_t event[], int num, return i; }
+/* For now ODP generic does not support flow awareness, + * so all flow ids are zero. */ +uint32_t odp_event_flow_id(odp_event_t event ODP_UNUSED) +{ + return 0; +} + +void odp_event_flow_id_set(odp_event_t event ODP_UNUSED, + uint32_t flow_id ODP_UNUSED) +{ + /* Do nothing */ +} + void odp_event_free(odp_event_t event) { switch (odp_event_type(event)) {
commit 410a0d38d13b08003d54d316868f941c5d570c54 Author: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Date: Thu Nov 15 20:34:27 2018 +0300
validation: scheduler use schedule_config instead of capabilities
Since ODP test suite will use default configuration for scheduler, all comparisons should be done against it rather than maximum possible values returned by capabilities.
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
diff --git a/test/validation/api/scheduler/scheduler.c b/test/validation/api/scheduler/scheduler.c index 4fdfc243..27377580 100644 --- a/test/validation/api/scheduler/scheduler.c +++ b/test/validation/api/scheduler/scheduler.c @@ -418,7 +418,7 @@ static void scheduler_test_wait(void) static void scheduler_test_queue_size(void) { odp_queue_capability_t queue_capa; - odp_scheduler_config_t default_config; + odp_schedule_config_t default_config; odp_pool_t pool; odp_pool_param_t pool_param; odp_queue_param_t queue_param; @@ -432,8 +432,8 @@ static void scheduler_test_queue_size(void) ODP_SCHED_SYNC_ORDERED};
CU_ASSERT_FATAL(odp_queue_capability(&queue_capa) == 0); - odp_scheduler_config_init(&default_config); queue_size = TEST_QUEUE_SIZE_NUM_EV; + odp_schedule_config_init(&default_config); if (default_config.queue_size && queue_size > default_config.queue_size) queue_size = default_config.queue_size; @@ -1662,6 +1662,7 @@ static int create_queues(test_globals_t *globals) int i, j, prios, rc; odp_queue_capability_t capa; odp_schedule_capability_t sched_capa; + odp_schedule_config_t default_config; odp_pool_t queue_ctx_pool; odp_pool_param_t params; odp_buffer_t queue_ctx_buf; @@ -1691,10 +1692,11 @@ static int create_queues(test_globals_t *globals) }
globals->max_sched_queue_size = BUFS_PER_QUEUE_EXCL; - if (sched_capa.max_queue_size && sched_capa.max_queue_size < - BUFS_PER_QUEUE_EXCL) { - printf("Max sched queue size %u\n", sched_capa.max_queue_size); - globals->max_sched_queue_size = sched_capa.max_queue_size; + odp_schedule_config_init(&default_config); + if (default_config.queue_size && + globals->max_sched_queue_size > default_config.queue_size) { + printf("Max sched queue size %u\n", default_config.queue_size); + globals->max_sched_queue_size = default_config.queue_size; }
prios = odp_schedule_num_prio(); @@ -1704,7 +1706,7 @@ static int create_queues(test_globals_t *globals) queues_per_prio = QUEUES_PER_PRIO; num_sched = (prios * queues_per_prio * sched_types) + CHAOS_NUM_QUEUES; num_plain = (prios * queues_per_prio); - while ((num_sched > sched_capa.max_queues || + while ((num_sched > default_config.num_queues || num_plain > capa.plain.max_num || num_sched + num_plain > capa.max_queues) && queues_per_prio) { queues_per_prio--;
commit 9edf20ac38a6c7dc61cb00fbd776bea6afa264c7 Author: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Date: Wed Nov 7 17:41:04 2018 +0300
examples: add calls to odp_schedule_config()
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
diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c index 43d40c53..274ffaf4 100644 --- a/example/classifier/odp_classifier.c +++ b/example/classifier/odp_classifier.c @@ -556,6 +556,9 @@ int main(int argc, char *argv[]) exit(EXIT_FAILURE); }
+ /* Configure scheduler */ + odp_schedule_config(NULL); + /* odp_pool_print(pool); */ odp_atomic_init_u64(&args->total_packets, 0);
diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index 1093454c..bd6af795 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -1199,6 +1199,9 @@ int main(int argc, char *argv[]) args->rx_burst_size = args->appl.rx_burst; }
+ /* Configure scheduler */ + odp_schedule_config(NULL); + /* Create packet pool */ odp_pool_param_init(¶ms); params.pkt.seg_len = POOL_PKT_LEN; diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index 52ccce22..1bbf7a00 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -1297,6 +1297,9 @@ main(int argc, char *argv[]) exit(EXIT_FAILURE); }
+ /* Configure scheduler */ + odp_schedule_config(NULL); + /* Populate our IPsec cache */ printf("Using %s mode for crypto API\n\n", (CRYPTO_API_SYNC == global->appl.mode) ? "SYNC" : diff --git a/example/ipsec_api/odp_ipsec.c b/example/ipsec_api/odp_ipsec.c index fb0d9049..ab0fa3c5 100644 --- a/example/ipsec_api/odp_ipsec.c +++ b/example/ipsec_api/odp_ipsec.c @@ -996,6 +996,9 @@ main(int argc, char *argv[]) exit(EXIT_FAILURE); }
+ /* Configure scheduler */ + odp_schedule_config(NULL); + /* Populate our IPsec cache */ printf("Using %s mode for IPsec API\n\n", (ODP_IPSEC_OP_MODE_SYNC == global->appl.mode) ? "SYNC" : diff --git a/example/ipsec_offload/odp_ipsec_offload.c b/example/ipsec_offload/odp_ipsec_offload.c index 90b3f640..4d95b2e5 100644 --- a/example/ipsec_offload/odp_ipsec_offload.c +++ b/example/ipsec_offload/odp_ipsec_offload.c @@ -606,6 +606,9 @@ main(int argc, char *argv[])
ipsec_init_post();
+ /* Configure scheduler */ + odp_schedule_config(NULL); + /* Initialize interfaces (which resolves FWD DB entries */ for (i = 0; i < global->appl.if_count; i++) initialize_intf(global->appl.if_names[i], diff --git a/example/packet/odp_packet_dump.c b/example/packet/odp_packet_dump.c index 5dcb7893..4e3aec8f 100644 --- a/example/packet/odp_packet_dump.c +++ b/example/packet/odp_packet_dump.c @@ -640,6 +640,8 @@ int main(int argc, char *argv[])
global->pool = ODP_POOL_INVALID;
+ odp_schedule_config(NULL); + odp_sys_info_print();
if (open_pktios(global)) { diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c index e73e903c..b1c4a79c 100644 --- a/example/packet/odp_pktio.c +++ b/example/packet/odp_pktio.c @@ -424,6 +424,9 @@ int main(int argc, char *argv[]) } odp_pool_print(pool);
+ /* Config and start scheduler */ + odp_schedule_config(NULL); + /* Create a pktio instance for each interface */ for (i = 0; i < args->appl.if_count; ++i) create_pktio(args->appl.if_names[i], pool, args->appl.mode); diff --git a/example/timer/odp_timer_accuracy.c b/example/timer/odp_timer_accuracy.c index 3b0d7e38..9409e340 100644 --- a/example/timer/odp_timer_accuracy.c +++ b/example/timer/odp_timer_accuracy.c @@ -426,6 +426,9 @@ int main(int argc, char *argv[])
odp_sys_info_print();
+ /* Configure scheduler */ + odp_schedule_config(NULL); + num = test_global.opt.num;
test_global.timer = calloc(num, sizeof(odp_timer_t)); diff --git a/example/timer/odp_timer_simple.c b/example/timer/odp_timer_simple.c index 116f8ba6..ddefb0d2 100644 --- a/example/timer/odp_timer_simple.c +++ b/example/timer/odp_timer_simple.c @@ -81,6 +81,9 @@ int main(int argc ODP_UNUSED, char *argv[] ODP_UNUSED) goto err; }
+ /* Configure scheduler */ + odp_schedule_config(NULL); + /* * Create a queue for timer test */ diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c index 192a61d3..ca3e8ddf 100644 --- a/example/timer/odp_timer_test.c +++ b/example/timer/odp_timer_test.c @@ -418,6 +418,9 @@ int main(int argc, char *argv[]) printf("period: %i usec\n", gbls->args.period_us); printf("timeouts: %i\n", gbls->args.tmo_count);
+ /* Configure scheduler */ + odp_schedule_config(NULL); + /* * Create pool for timeouts */
commit 9287482b9debd49de84b6ec1640604edeaa9f9e1 Author: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Date: Wed Nov 7 17:41:04 2018 +0300
performance: add calls to odp_schedule_config()
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
diff --git a/test/performance/odp_cpu_bench.c b/test/performance/odp_cpu_bench.c index b41bc43f..852ed308 100644 --- a/test/performance/odp_cpu_bench.c +++ b/test/performance/odp_cpu_bench.c @@ -526,7 +526,7 @@ int main(int argc, char *argv[]) odp_cpumask_t cpumask; odp_pool_capability_t pool_capa; odp_pool_t pool; - odp_schedule_capability_t schedule_capa; + odp_schedule_config_t schedule_config; odp_shm_t shm; odp_shm_t lookup_tbl_shm; odp_pool_param_t params; @@ -614,26 +614,24 @@ int main(int argc, char *argv[]) printf("first CPU: %i\n", odp_cpumask_first(&cpumask)); printf("cpu mask: %s\n", cpumaskstr);
- if (odp_schedule_capability(&schedule_capa)) { - printf("Error: Schedule capa failed.\n"); - return -1; - } + odp_schedule_config_init(&schedule_config); + odp_schedule_config(&schedule_config);
/* Make sure a single queue can store all the packets in a group */ pkts_per_group = QUEUES_PER_GROUP * PKTS_PER_QUEUE; - if (schedule_capa.max_queue_size && - schedule_capa.max_queue_size < pkts_per_group) - pkts_per_group = schedule_capa.max_queue_size; + if (schedule_config.queue_size && + schedule_config.queue_size < pkts_per_group) + pkts_per_group = schedule_config.queue_size;
/* Divide queues evenly into groups */ - if (schedule_capa.max_queues < QUEUES_PER_GROUP) { + if (schedule_config.num_queues < QUEUES_PER_GROUP) { LOG_ERR("Error: min %d queues required\n", QUEUES_PER_GROUP); return -1; } - num_queues = num_workers > schedule_capa.max_queues ? - schedule_capa.max_queues : num_workers; + num_queues = num_workers > schedule_config.num_queues ? + schedule_config.num_queues : num_workers; num_groups = (num_queues + QUEUES_PER_GROUP - 1) / QUEUES_PER_GROUP; - if (num_groups * QUEUES_PER_GROUP > schedule_capa.max_queues) + if (num_groups * QUEUES_PER_GROUP > schedule_config.num_queues) num_groups--; num_queues = num_groups * QUEUES_PER_GROUP;
diff --git a/test/performance/odp_crypto.c b/test/performance/odp_crypto.c index d175bb7e..665268be 100644 --- a/test/performance/odp_crypto.c +++ b/test/performance/odp_crypto.c @@ -1101,6 +1101,7 @@ int main(int argc, char *argv[])
odp_queue_param_init(&qparam); if (cargs.schedule) { + odp_schedule_config(NULL); qparam.type = ODP_QUEUE_TYPE_SCHED; qparam.sched.prio = ODP_SCHED_PRIO_DEFAULT; qparam.sched.sync = ODP_SCHED_SYNC_PARALLEL; diff --git a/test/performance/odp_ipsec.c b/test/performance/odp_ipsec.c index 5a5824e8..e388916c 100644 --- a/test/performance/odp_ipsec.c +++ b/test/performance/odp_ipsec.c @@ -1088,6 +1088,7 @@ int main(int argc, char *argv[])
odp_queue_param_init(&qparam); if (cargs.schedule) { + odp_schedule_config(NULL); qparam.type = ODP_QUEUE_TYPE_SCHED; qparam.sched.prio = ODP_SCHED_PRIO_DEFAULT; qparam.sched.sync = ODP_SCHED_SYNC_PARALLEL; diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c index c9243184..78e3920f 100644 --- a/test/performance/odp_l2fwd.c +++ b/test/performance/odp_l2fwd.c @@ -1568,6 +1568,8 @@ int main(int argc, char *argv[])
bind_workers();
+ odp_schedule_config(NULL); + /* Default */ if (num_groups == 0) { group[0] = ODP_SCHED_GROUP_ALL; diff --git a/test/performance/odp_pktio_ordered.c b/test/performance/odp_pktio_ordered.c index da37407a..15229aeb 100644 --- a/test/performance/odp_pktio_ordered.c +++ b/test/performance/odp_pktio_ordered.c @@ -1062,6 +1062,7 @@ int main(int argc, char *argv[]) odp_pool_param_t params; odp_shm_t shm; odp_schedule_capability_t schedule_capa; + odp_schedule_config_t schedule_config; odp_pool_capability_t pool_capa; odph_ethaddr_t new_addr; odph_helper_options_t helper_options; @@ -1129,6 +1130,8 @@ int main(int argc, char *argv[]) /* Parse and store the application arguments */ parse_args(argc, argv, &gbl_args->appl);
+ odp_schedule_config(NULL); + if (gbl_args->appl.in_mode == SCHED_ORDERED) { /* At least one ordered lock required */ if (schedule_capa.max_ordered_locks < 1) { @@ -1158,9 +1161,9 @@ int main(int argc, char *argv[]) pool_size = pool_capa.pkt.max_num;
queue_size = MAX_NUM_PKT; - if (schedule_capa.max_queue_size && - schedule_capa.max_queue_size < MAX_NUM_PKT) - queue_size = schedule_capa.max_queue_size; + if (schedule_config.queue_size && + schedule_config.queue_size < MAX_NUM_PKT) + queue_size = schedule_config.queue_size;
/* Pool should not be larger than queue, otherwise queue enqueues at * packet input may fail. */ diff --git a/test/performance/odp_pktio_perf.c b/test/performance/odp_pktio_perf.c index b86d437e..2ed2c352 100644 --- a/test/performance/odp_pktio_perf.c +++ b/test/performance/odp_pktio_perf.c @@ -759,6 +759,9 @@ static int test_init(void) iface = gbl_args->args.ifaces[0]; schedule = gbl_args->args.schedule;
+ if (schedule) + odp_schedule_config(NULL); + /* create pktios and associate input/output queues */ gbl_args->pktio_tx = create_pktio(iface, schedule); if (gbl_args->args.num_ifaces > 1) { diff --git a/test/performance/odp_sched_latency.c b/test/performance/odp_sched_latency.c index b6299141..b5be1a16 100644 --- a/test/performance/odp_sched_latency.c +++ b/test/performance/odp_sched_latency.c @@ -714,6 +714,8 @@ int main(int argc, char *argv[]) memset(globals, 0, sizeof(test_globals_t)); memcpy(&globals->args, &args, sizeof(test_args_t));
+ odp_schedule_config(NULL); + /* * Create event pool */ diff --git a/test/performance/odp_sched_perf.c b/test/performance/odp_sched_perf.c index b25c3e19..c301263e 100644 --- a/test/performance/odp_sched_perf.c +++ b/test/performance/odp_sched_perf.c @@ -43,6 +43,7 @@ typedef struct test_stat_t { typedef struct test_global_t { test_options_t test_options;
+ odp_schedule_config_t schedule_config; odp_barrier_t barrier; odp_pool_t pool; odp_cpumask_t cpumask; @@ -251,7 +252,6 @@ static int create_pool(test_global_t *global)
static int create_queues(test_global_t *global) { - odp_schedule_capability_t schedule_capa; odp_queue_param_t queue_param; odp_queue_t queue; odp_buffer_t buf; @@ -279,20 +279,16 @@ static int create_queues(test_global_t *global)
printf(" queue type %s\n\n", type_str);
- if (odp_schedule_capability(&schedule_capa)) { - printf("Error: Schedule capa failed.\n"); - return -1; - } - - if (tot_queue > schedule_capa.max_queues) { + if (tot_queue > global->schedule_config.num_queues) { printf("Max queues supported %u\n", - schedule_capa.max_queues); + global->schedule_config.num_queues); return -1; }
- if (schedule_capa.max_queue_size && - queue_size > schedule_capa.max_queue_size) { - printf("Max queue size %u\n", schedule_capa.max_queue_size); + if (global->schedule_config.queue_size && + queue_size > global->schedule_config.queue_size) { + printf("Max queue size %u\n", + global->schedule_config.queue_size); return -1; }
@@ -603,6 +599,9 @@ int main(int argc, char **argv) return -1; }
+ odp_schedule_config_init(&global->schedule_config); + odp_schedule_config(&global->schedule_config); + if (set_num_cpu(global)) return -1;
diff --git a/test/performance/odp_sched_pktio.c b/test/performance/odp_sched_pktio.c index 1faa9b1d..393ea352 100644 --- a/test/performance/odp_sched_pktio.c +++ b/test/performance/odp_sched_pktio.c @@ -127,6 +127,8 @@ typedef struct { uint64_t rx_pkt_sum; uint64_t tx_pkt_sum;
+ odp_schedule_config_t schedule_config; + } test_global_t;
static test_global_t *test_global; @@ -723,6 +725,9 @@ static int config_setup(test_global_t *test_global) cpu = odp_cpumask_next(cpumask, cpu); }
+ odp_schedule_config_init(&test_global->schedule_config); + odp_schedule_config(&test_global->schedule_config); + if (odp_pool_capability(&pool_capa)) { printf("Error: Pool capability failed.\n"); return -1; @@ -1109,15 +1114,9 @@ static int create_pipeline_queues(test_global_t *test_global) int i, j, k, num_pktio, stages, queues, ctx_size; pipe_queue_context_t *ctx; odp_queue_param_t queue_param; - odp_schedule_capability_t schedule_capa; odp_schedule_sync_t sched_sync; int ret = 0;
- if (odp_schedule_capability(&schedule_capa)) { - printf("Error: Schedule capa failed.\n"); - return -1; - } - num_pktio = test_global->opt.num_pktio; stages = test_global->opt.pipe_stages; queues = test_global->opt.pipe_queues; @@ -1130,10 +1129,10 @@ static int create_pipeline_queues(test_global_t *test_global) queue_param.sched.group = ODP_SCHED_GROUP_ALL;
queue_param.size = test_global->opt.pipe_queue_size; - if (schedule_capa.max_queue_size && - queue_param.size > schedule_capa.max_queue_size) { + if (test_global->schedule_config.queue_size && + queue_param.size > test_global->schedule_config.queue_size) { printf("Error: Pipeline queue max size is %u\n", - schedule_capa.max_queue_size); + test_global->schedule_config.queue_size); return -1; }
diff --git a/test/performance/odp_scheduling.c b/test/performance/odp_scheduling.c index 655a619e..afe5b73b 100644 --- a/test/performance/odp_scheduling.c +++ b/test/performance/odp_scheduling.c @@ -813,7 +813,7 @@ int main(int argc, char *argv[]) odph_odpthread_params_t thr_params; odp_queue_capability_t capa; odp_pool_capability_t pool_capa; - odp_schedule_capability_t schedule_capa; + odp_schedule_config_t schedule_config; uint32_t num_queues, num_buf;
printf("\nODP example starts\n\n"); @@ -909,15 +909,14 @@ int main(int argc, char *argv[]) return -1; }
- if (odp_schedule_capability(&schedule_capa)) { - printf("Error: Schedule capa failed.\n"); - return -1; - } + odp_schedule_config_init(&schedule_config); + odp_schedule_config(&schedule_config);
globals->queues_per_prio = QUEUES_PER_PRIO; num_queues = globals->queues_per_prio * NUM_PRIOS; - if (num_queues > schedule_capa.max_queues) - globals->queues_per_prio = schedule_capa.max_queues / + if (schedule_config.num_queues && + num_queues > schedule_config.num_queues) + globals->queues_per_prio = schedule_config.num_queues / NUM_PRIOS;
/* One plain queue is also used */
commit b484f32b2464a53946a88013a0ee547415cdf414 Author: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Date: Wed Nov 7 17:41:04 2018 +0300
validation: add calls to odp_schedule_config()
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
diff --git a/test/common/odp_cunit_common.c b/test/common/odp_cunit_common.c index 4db6c32d..7f345fba 100644 --- a/test/common/odp_cunit_common.c +++ b/test/common/odp_cunit_common.c @@ -98,6 +98,10 @@ static int tests_global_init(odp_instance_t *inst) fprintf(stderr, "error: odp_init_local() failed.\n"); return -1; } + if (0 != odp_schedule_config(NULL)) { + fprintf(stderr, "error: odp_schedule_config(NULL) failed.\n"); + return -1; + }
return 0; } diff --git a/test/validation/api/timer/timer.c b/test/validation/api/timer/timer.c index 72294c5c..aaffd92d 100644 --- a/test/validation/api/timer/timer.c +++ b/test/validation/api/timer/timer.c @@ -92,6 +92,9 @@ static int timer_global_init(odp_instance_t *inst) global_mem = odp_shm_addr(global_shm); memset(global_mem, 0, sizeof(global_shared_mem_t));
+ /* Configure scheduler */ + odp_schedule_config(NULL); + return 0; }
commit ddfe2d945b3dfe6e443acf18f86ce30f60b325a4 Author: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Date: Wed Nov 7 17:39:48 2018 +0300
linux-gen: implement odp_schedule_config() API call
Add odp_schedule_config() stub, which does nothing at this point. Use it to actually check (in debug mode) that application call it in proper place.
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
diff --git a/platform/linux-generic/include/odp_schedule_if.h b/platform/linux-generic/include/odp_schedule_if.h index abc64d0d..15c91590 100644 --- a/platform/linux-generic/include/odp_schedule_if.h +++ b/platform/linux-generic/include/odp_schedule_if.h @@ -87,10 +87,17 @@ int sched_cb_pktin_poll(int pktio_index, int pktin_index, int sched_cb_pktin_poll_one(int pktio_index, int rx_queue, odp_event_t evts[]); void sched_cb_pktio_stop_finalize(int pktio_index);
+/* For debugging */ +#ifdef ODP_DEBUG +extern int _odp_schedule_configured; +#endif + /* API functions */ typedef struct { uint64_t (*schedule_wait_time)(uint64_t ns); int (*schedule_capability)(odp_schedule_capability_t *capa); + void (*schedule_config_init)(odp_schedule_config_t *config); + int (*schedule_config)(const odp_schedule_config_t *config); 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); diff --git a/platform/linux-generic/odp_schedule_basic.c b/platform/linux-generic/odp_schedule_basic.c index f057f468..48f232e6 100644 --- a/platform/linux-generic/odp_schedule_basic.c +++ b/platform/linux-generic/odp_schedule_basic.c @@ -597,6 +597,8 @@ static int schedule_init_queue(uint32_t queue_index, int i; int prio = prio_level_from_api(sched_param->prio);
+ ODP_ASSERT(_odp_schedule_configured); + pri_set_queue(queue_index, prio); sched->queue[queue_index].grp = sched_param->group; sched->queue[queue_index].prio = prio; @@ -797,6 +799,19 @@ static int schedule_term_local(void) return 0; }
+static void schedule_config_init(odp_schedule_config_t *config) +{ + config->num_queues = ODP_CONFIG_QUEUES - NUM_INTERNAL_QUEUES; + config->queue_size = queue_glb->config.max_queue_size; +} + +static int schedule_config(const odp_schedule_config_t *config) +{ + (void)config; + + return 0; +} + static inline int copy_from_stash(odp_event_t out_ev[], unsigned int max) { int i = 0; @@ -1589,6 +1604,8 @@ const schedule_fn_t schedule_basic_fn = { const schedule_api_t schedule_basic_api = { .schedule_wait_time = schedule_wait_time, .schedule_capability = schedule_capability, + .schedule_config_init = schedule_config_init, + .schedule_config = schedule_config, .schedule = schedule, .schedule_multi = schedule_multi, .schedule_multi_wait = schedule_multi_wait, diff --git a/platform/linux-generic/odp_schedule_if.c b/platform/linux-generic/odp_schedule_if.c index 92e0a62f..cb52f155 100644 --- a/platform/linux-generic/odp_schedule_if.c +++ b/platform/linux-generic/odp_schedule_if.c @@ -25,6 +25,10 @@ extern const schedule_api_t schedule_scalable_api; const schedule_fn_t *sched_fn; const schedule_api_t *sched_api;
+#ifdef ODP_DEBUG +int _odp_schedule_configured; +#endif + uint64_t odp_schedule_wait_time(uint64_t ns) { return sched_api->schedule_wait_time(ns); @@ -35,14 +39,46 @@ int odp_schedule_capability(odp_schedule_capability_t *capa) return sched_api->schedule_capability(capa); }
+void odp_schedule_config_init(odp_schedule_config_t *config) +{ + memset(config, 0, sizeof(*config)); + + sched_api->schedule_config_init(config); +} + +int odp_schedule_config(const odp_schedule_config_t *config) +{ + int ret; + odp_schedule_config_t defconfig; + + ODP_ASSERT(!_odp_schedule_configured); + + if (!config) { + odp_schedule_config_init(&defconfig); + config = &defconfig; + } + + ret = sched_api->schedule_config(config); +#ifdef ODP_DEBUG + if (ret >= 0) + _odp_schedule_configured = 1; +#endif + + return ret; +} + odp_event_t odp_schedule(odp_queue_t *from, uint64_t wait) { + ODP_ASSERT(_odp_schedule_configured); + return sched_api->schedule(from, wait); }
int odp_schedule_multi(odp_queue_t *from, uint64_t wait, odp_event_t events[], int num) { + ODP_ASSERT(_odp_schedule_configured); + return sched_api->schedule_multi(from, wait, events, num); }
diff --git a/platform/linux-generic/odp_schedule_scalable.c b/platform/linux-generic/odp_schedule_scalable.c index 091e5ff9..4e9dd771 100644 --- a/platform/linux-generic/odp_schedule_scalable.c +++ b/platform/linux-generic/odp_schedule_scalable.c @@ -1994,6 +1994,19 @@ static int schedule_term_local(void) return rc; }
+static void schedule_config_init(odp_schedule_config_t *config) +{ + config->num_queues = ODP_CONFIG_QUEUES - NUM_INTERNAL_QUEUES; + config->queue_size = 0; /* FIXME ? */ +} + +static int schedule_config(const odp_schedule_config_t *config) +{ + (void)config; + + return 0; +} + static int num_grps(void) { return MAX_SCHED_GROUP; @@ -2141,6 +2154,8 @@ 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_config_init = schedule_config_init, + .schedule_config = schedule_config, .schedule = schedule, .schedule_multi = schedule_multi, .schedule_multi_wait = schedule_multi_wait, diff --git a/platform/linux-generic/odp_schedule_sp.c b/platform/linux-generic/odp_schedule_sp.c index 6cc8f376..eec88a60 100644 --- a/platform/linux-generic/odp_schedule_sp.c +++ b/platform/linux-generic/odp_schedule_sp.c @@ -257,6 +257,19 @@ static int term_local(void) return 0; }
+static void schedule_config_init(odp_schedule_config_t *config) +{ + config->num_queues = ODP_CONFIG_QUEUES - NUM_INTERNAL_QUEUES; + config->queue_size = queue_glb->config.max_queue_size; +} + +static int schedule_config(const odp_schedule_config_t *config) +{ + (void)config; + + return 0; +} + static uint32_t max_ordered_locks(void) { return NUM_ORDERED_LOCKS; @@ -362,6 +375,11 @@ static int init_queue(uint32_t qi, const odp_schedule_param_t *sched_param) odp_schedule_group_t group = sched_param->group; int prio = 0;
+#ifdef ODP_DEBUG + if (!_odp_schedule_configured) + ODP_ABORT("Scheduler not configured!\n"); +#endif + if (group < 0 || group >= NUM_GROUP) return -1;
@@ -961,6 +979,8 @@ const schedule_fn_t schedule_sp_fn = { const schedule_api_t schedule_sp_api = { .schedule_wait_time = schedule_wait_time, .schedule_capability = schedule_capability, + .schedule_config_init = schedule_config_init, + .schedule_config = schedule_config, .schedule = schedule, .schedule_multi = schedule_multi, .schedule_multi_wait = schedule_multi_wait,
commit e721288bf73f752015162eb594e294e58fb96a07 Author: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Date: Wed Nov 7 16:46:50 2018 +0300
linux-gen: schedule: rename config to get_config
Rename config function to get_config to avoid collisions.
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
diff --git a/platform/linux-generic/include/odp_schedule_if.h b/platform/linux-generic/include/odp_schedule_if.h index 88961269..abc64d0d 100644 --- a/platform/linux-generic/include/odp_schedule_if.h +++ b/platform/linux-generic/include/odp_schedule_if.h @@ -53,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_config_fn_t)(schedule_config_t *config); +typedef void (*schedule_get_config_fn_t)(schedule_config_t *config);
typedef struct schedule_fn_t { schedule_pktio_start_fn_t pktio_start; @@ -74,7 +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_get_config_fn_t get_config;
} schedule_fn_t;
diff --git a/platform/linux-generic/odp_schedule_basic.c b/platform/linux-generic/odp_schedule_basic.c index b93e5c41..f057f468 100644 --- a/platform/linux-generic/odp_schedule_basic.c +++ b/platform/linux-generic/odp_schedule_basic.c @@ -1547,7 +1547,7 @@ static int schedule_num_grps(void) return NUM_SCHED_GRPS; }
-static void schedule_config(schedule_config_t *config) +static void schedule_get_config(schedule_config_t *config) { *config = *(&sched->config_if); }; @@ -1582,7 +1582,7 @@ const schedule_fn_t schedule_basic_fn = { .order_lock = order_lock, .order_unlock = order_unlock, .max_ordered_locks = schedule_max_ordered_locks, - .config = schedule_config + .get_config = schedule_get_config };
/* Fill in scheduler API calls */ diff --git a/platform/linux-generic/odp_thread.c b/platform/linux-generic/odp_thread.c index 7728929b..b30174dd 100644 --- a/platform/linux-generic/odp_thread.c +++ b/platform/linux-generic/odp_thread.c @@ -142,10 +142,10 @@ int odp_thread_init_local(odp_thread_type_t type) group_worker = 1; group_control = 1;
- if (sched_fn->config) { + if (sched_fn->get_config) { schedule_config_t schedule_config;
- sched_fn->config(&schedule_config); + sched_fn->get_config(&schedule_config); group_all = schedule_config.group_enable.all; group_worker = schedule_config.group_enable.worker; group_control = schedule_config.group_enable.control; @@ -196,10 +196,10 @@ int odp_thread_term_local(void) group_worker = 1; group_control = 1;
- if (sched_fn->config) { + if (sched_fn->get_config) { schedule_config_t schedule_config;
- sched_fn->config(&schedule_config); + sched_fn->get_config(&schedule_config); group_all = schedule_config.group_enable.all; group_worker = schedule_config.group_enable.worker; group_control = schedule_config.group_enable.control;
commit 6aeb2eed6c65cb5830200c236b98b09a9a0f9245 Author: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Date: Wed Oct 31 13:45:09 2018 +0300
api: schedule: add scheduler flow aware mode
ODP scheduler configuration to support flow aware mode
Signed-off-by: Balasubramanian Manoharan bala.manoharan@linaro.org 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
diff --git a/include/odp/api/spec/event.h b/include/odp/api/spec/event.h index d9f7ab73..affdc7b0 100644 --- a/include/odp/api/spec/event.h +++ b/include/odp/api/spec/event.h @@ -209,6 +209,44 @@ void odp_event_free_multi(const odp_event_t event[], int num); */ void odp_event_free_sp(const odp_event_t event[], int num);
+/** + * Event flow id value + * + * Returns the flow id value set in the event. + * Usage of flow id enables scheduler to maintain multiple synchronization + * contexts per single queue. For example, when multiple flows are assigned to + * an atomic queue, events of a single flow (events from the same queue with + * the same flow id value) are guaranteed to be processed by only single thread + * at a time. For packets received through packet input initial + * event flow id will be same as flow hash generated for packets. The hash + * algorithm and therefore the resulting flow id value is implementation + * specific. Use pktio API configuration options to select the fields used for + * initial flow id calculation. For all other events initial flow id is zero + * An application can change event flow id using odp_event_flow_id_set(). + * + * @param event Event handle + * + * @return Flow id of the event + * + */ +uint32_t odp_event_flow_id(odp_event_t event); + +/** + * Set event flow id value + * + * Store the event flow id for the event and sets the flow id flag. + * When scheduler is configured as flow aware, scheduled queue synchronization + * will be based on this id within each queue. + * When scheduler is configured as flow unaware, event flow id is ignored by + * the implementation. + * The value of flow id must be less than the number of flows configured in the + * scheduler. + * + * @param event Event handle + * @param flow_id Flow event id to be set. + */ +void odp_event_flow_id_set(odp_event_t event, uint32_t flow_id); + /** * @} */ diff --git a/include/odp/api/spec/schedule_types.h b/include/odp/api/spec/schedule_types.h index 0b75d17d..3648c64e 100644 --- a/include/odp/api/spec/schedule_types.h +++ b/include/odp/api/spec/schedule_types.h @@ -78,6 +78,9 @@ extern "C" { * requests another event from the scheduler, which implicitly releases the * context. User may allow the scheduler to release the context earlier than * that by calling odp_schedule_release_atomic(). + * When scheduler is enabled as flow-aware, the event flow id value affects + * scheduling of the event and synchronization is maintained per flow within + * each queue. */
/** @@ -104,6 +107,9 @@ extern "C" { * (e.g. freed or stored) within the context are considered missing from * reordering and are skipped at this time (but can be ordered again within * another context). + * When scheduler is enabled as flow-aware, the event flow id value affects + * scheduling of the event and synchronization is maintained per flow within + * each queue. */
/** @@ -190,6 +196,13 @@ typedef struct odp_schedule_capability_t { * events. */ uint32_t max_queue_size;
+ /** Maximum supported flows per queue. + * Specifies the maximum number of flows per queue supported by the + * implementation. A value of 0 indicates flow aware mode is not + * supported. + */ + uint32_t max_flows; + /** Lock-free (ODP_NONBLOCKING_LF) queues support. * The specification is the same as for the blocking implementation. */ odp_support_t lockfree_queues; @@ -217,6 +230,22 @@ typedef struct odp_schedule_config_t { */ uint32_t queue_size;
+ /** Number of flows per queue to be supported. Scheduler enables flow + * aware mode when flow count is configured greater than 1 (up to + * 'max_flows' capability). + * + * Flows are lightweight entities and events can be assigned to + * specific flows by the application using odp_event_flow_id_set() + * before enqueuing the event into the scheduler. This value is ignored + * unless scheduler supports flow aware mode. + * + * This number should be less than maximum flow supported by the + * implementation. The default value is zero. + * + * @see odp_schedule_capability_t + */ + uint32_t num_flows; + } odp_schedule_config_t;
/**
commit eded2529a711a731220322d37af569b7e08c41e9 Author: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Date: Wed Oct 24 17:55:18 2018 +0300
api: schedule: add scheduler config and start API
Add API calls to configure and start scheduler subsystem.
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
diff --git a/include/odp/api/spec/schedule.h b/include/odp/api/spec/schedule.h index 6538c509..43292124 100644 --- a/include/odp/api/spec/schedule.h +++ b/include/odp/api/spec/schedule.h @@ -257,6 +257,44 @@ int odp_schedule_default_prio(void); */ int odp_schedule_num_prio(void);
+/** + * Initialize schedule configuration options + * + * Initialize an odp_schedule_config_t to its default values. + * + * @param[out] config Pointer to schedule configuration structure + */ +void odp_schedule_config_init(odp_schedule_config_t *config); + +/** + * Global schedule configuration + * + * Initialize and configure scheduler with global configuration options + * to schedule events across different scheduled queues. + * This function must be called before scheduler is used (any other scheduler + * function is called except odp_schedule_capability() and + * odp_schedule_config_init()) or any queues are created (by application itself + * or by other ODP modules). + * An application can pass NULL value to use default configuration. It will + * have the same result as filling the structure with + * odp_schedule_config_init() and then passing it to odp_schedule_config(). + * + * The initialization sequeunce should be, + * odp_schedule_capability() + * odp_schedule_config_init() + * odp_schedule_config() + * odp_schedule() + * + * @param config Pointer to scheduler configuration structure or NULL for the + * default configuration + * + * @retval 0 on success + * @retval <0 on failure + * + * @see odp_schedule_capability(), odp_schedule_config_init() + */ +int odp_schedule_config(const odp_schedule_config_t *config); + /** * Query scheduler capabilities * diff --git a/include/odp/api/spec/schedule_types.h b/include/odp/api/spec/schedule_types.h index e7cc0479..0b75d17d 100644 --- a/include/odp/api/spec/schedule_types.h +++ b/include/odp/api/spec/schedule_types.h @@ -200,6 +200,25 @@ typedef struct odp_schedule_capability_t {
} odp_schedule_capability_t;
+/** + * Schedule configuration + */ +typedef struct odp_schedule_config_t { + /** Maximum number of scheduled queues to be supported. + * + * @see odp_schedule_capability_t + */ + uint32_t num_queues; + + /** Maximum number of events required to be stored simultaneously in + * scheduled queue. This number must not exceed 'max_queue_size' + * capability. A value of 0 configures default queue size supported by + * the implementation. + */ + uint32_t queue_size; + +} odp_schedule_config_t; + /** * @} */
commit f27ee888c0ed07a08eafaea596094125cb9fdcc6 Author: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Date: Wed Oct 31 13:47:52 2018 +0300
example, tests: move scheduled queue capabilities to sched
Move scheduled queue capabilities to odp_schedule_capability_t structure, as they logically belong to ODP scheduler module, rather than queue module.
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
diff --git a/example/sysinfo/odp_sysinfo.c b/example/sysinfo/odp_sysinfo.c index cd0c6bfd..709f25d9 100644 --- a/example/sysinfo/odp_sysinfo.c +++ b/example/sysinfo/odp_sysinfo.c @@ -401,19 +401,15 @@ int main(void) printf(" max ordered locks: %" PRIu32 "\n", schedule_capa.max_ordered_locks); printf(" max groups: %u\n", schedule_capa.max_groups); - printf(" priorities: %u\n", schedule_capa.prios); - printf(" sched.max_num: %" PRIu32 "\n", - queue_capa.sched.max_num); - printf(" sched.max_size: %" PRIu32 "\n", - queue_capa.sched.max_size); - printf(" sched.lf.max_num: %" PRIu32 "\n", - queue_capa.sched.lockfree.max_num); - printf(" sched.lf.max_size: %" PRIu32 "\n", - queue_capa.sched.lockfree.max_size); - printf(" sched.wf.max_num: %" PRIu32 "\n", - queue_capa.sched.waitfree.max_num); - printf(" sched.wf.max_size: %" PRIu32 "\n", - queue_capa.sched.waitfree.max_size); + printf(" priorities: %u\n", schedule_capa.max_prios); + printf(" sched.max_queues: %" PRIu32 "\n", + schedule_capa.max_queues); + printf(" sched.max_queue_size: %" PRIu32 "\n", + schedule_capa.max_queue_size); + printf(" sched.lf_queues: %ssupported\n", + schedule_capa.lockfree_queues ? "" : "not "); + printf(" sched.wf_queues: %ssupported\n", + schedule_capa.waitfree_queues ? "" : "not ");
printf("\n"); printf(" TIMER\n"); diff --git a/test/performance/odp_cpu_bench.c b/test/performance/odp_cpu_bench.c index 402ab4a1..b41bc43f 100644 --- a/test/performance/odp_cpu_bench.c +++ b/test/performance/odp_cpu_bench.c @@ -526,7 +526,7 @@ int main(int argc, char *argv[]) odp_cpumask_t cpumask; odp_pool_capability_t pool_capa; odp_pool_t pool; - odp_queue_capability_t queue_capa; + odp_schedule_capability_t schedule_capa; odp_shm_t shm; odp_shm_t lookup_tbl_shm; odp_pool_param_t params; @@ -614,27 +614,26 @@ int main(int argc, char *argv[]) printf("first CPU: %i\n", odp_cpumask_first(&cpumask)); printf("cpu mask: %s\n", cpumaskstr);
- /* Create application queues */ - if (odp_queue_capability(&queue_capa)) { - LOG_ERR("Error: odp_queue_capability() failed\n"); - exit(EXIT_FAILURE); + if (odp_schedule_capability(&schedule_capa)) { + printf("Error: Schedule capa failed.\n"); + return -1; }
/* Make sure a single queue can store all the packets in a group */ pkts_per_group = QUEUES_PER_GROUP * PKTS_PER_QUEUE; - if (queue_capa.sched.max_size && - queue_capa.sched.max_size < pkts_per_group) - pkts_per_group = queue_capa.sched.max_size; + if (schedule_capa.max_queue_size && + schedule_capa.max_queue_size < pkts_per_group) + pkts_per_group = schedule_capa.max_queue_size;
/* Divide queues evenly into groups */ - if (queue_capa.sched.max_num < QUEUES_PER_GROUP) { + if (schedule_capa.max_queues < QUEUES_PER_GROUP) { LOG_ERR("Error: min %d queues required\n", QUEUES_PER_GROUP); return -1; } - num_queues = num_workers > queue_capa.sched.max_num ? - queue_capa.sched.max_num : num_workers; + num_queues = num_workers > schedule_capa.max_queues ? + schedule_capa.max_queues : num_workers; num_groups = (num_queues + QUEUES_PER_GROUP - 1) / QUEUES_PER_GROUP; - if (num_groups * QUEUES_PER_GROUP > queue_capa.sched.max_num) + if (num_groups * QUEUES_PER_GROUP > schedule_capa.max_queues) num_groups--; num_queues = num_groups * QUEUES_PER_GROUP;
diff --git a/test/performance/odp_pktio_ordered.c b/test/performance/odp_pktio_ordered.c index 1b4b756a..da37407a 100644 --- a/test/performance/odp_pktio_ordered.c +++ b/test/performance/odp_pktio_ordered.c @@ -1061,7 +1061,6 @@ int main(int argc, char *argv[]) odp_pool_t pool; odp_pool_param_t params; odp_shm_t shm; - odp_queue_capability_t queue_capa; odp_schedule_capability_t schedule_capa; odp_pool_capability_t pool_capa; odph_ethaddr_t new_addr; @@ -1099,11 +1098,6 @@ int main(int argc, char *argv[]) exit(EXIT_FAILURE); }
- if (odp_queue_capability(&queue_capa)) { - LOG_ERR("Error: Queue capa failed\n"); - exit(EXIT_FAILURE); - } - if (odp_schedule_capability(&schedule_capa)) { printf("Error: Schedule capa failed.\n"); return -1; @@ -1164,9 +1158,9 @@ int main(int argc, char *argv[]) pool_size = pool_capa.pkt.max_num;
queue_size = MAX_NUM_PKT; - if (queue_capa.sched.max_size && - queue_capa.sched.max_size < MAX_NUM_PKT) - queue_size = queue_capa.sched.max_size; + if (schedule_capa.max_queue_size && + schedule_capa.max_queue_size < MAX_NUM_PKT) + queue_size = schedule_capa.max_queue_size;
/* Pool should not be larger than queue, otherwise queue enqueues at * packet input may fail. */ diff --git a/test/performance/odp_sched_perf.c b/test/performance/odp_sched_perf.c index bbd76c86..b25c3e19 100644 --- a/test/performance/odp_sched_perf.c +++ b/test/performance/odp_sched_perf.c @@ -251,7 +251,7 @@ static int create_pool(test_global_t *global)
static int create_queues(test_global_t *global) { - odp_queue_capability_t queue_capa; + odp_schedule_capability_t schedule_capa; odp_queue_param_t queue_param; odp_queue_t queue; odp_buffer_t buf; @@ -279,19 +279,20 @@ static int create_queues(test_global_t *global)
printf(" queue type %s\n\n", type_str);
- if (odp_queue_capability(&queue_capa)) { - printf("Error: Queue capa failed.\n"); + if (odp_schedule_capability(&schedule_capa)) { + printf("Error: Schedule capa failed.\n"); return -1; }
- if (tot_queue > queue_capa.sched.max_num) { - printf("Max queues supported %u\n", queue_capa.sched.max_num); + if (tot_queue > schedule_capa.max_queues) { + printf("Max queues supported %u\n", + schedule_capa.max_queues); return -1; }
- if (queue_capa.sched.max_size && - queue_size > queue_capa.sched.max_size) { - printf("Max queue size %u\n", queue_capa.sched.max_size); + if (schedule_capa.max_queue_size && + queue_size > schedule_capa.max_queue_size) { + printf("Max queue size %u\n", schedule_capa.max_queue_size); return -1; }
diff --git a/test/performance/odp_sched_pktio.c b/test/performance/odp_sched_pktio.c index 878dcad0..1faa9b1d 100644 --- a/test/performance/odp_sched_pktio.c +++ b/test/performance/odp_sched_pktio.c @@ -1109,12 +1109,12 @@ static int create_pipeline_queues(test_global_t *test_global) int i, j, k, num_pktio, stages, queues, ctx_size; pipe_queue_context_t *ctx; odp_queue_param_t queue_param; - odp_queue_capability_t queue_capa; + odp_schedule_capability_t schedule_capa; odp_schedule_sync_t sched_sync; int ret = 0;
- if (odp_queue_capability(&queue_capa)) { - printf("Error: Queue capability failed\n"); + if (odp_schedule_capability(&schedule_capa)) { + printf("Error: Schedule capa failed.\n"); return -1; }
@@ -1130,10 +1130,10 @@ static int create_pipeline_queues(test_global_t *test_global) queue_param.sched.group = ODP_SCHED_GROUP_ALL;
queue_param.size = test_global->opt.pipe_queue_size; - if (queue_capa.sched.max_size && - queue_param.size > queue_capa.sched.max_size) { + if (schedule_capa.max_queue_size && + queue_param.size > schedule_capa.max_queue_size) { printf("Error: Pipeline queue max size is %u\n", - queue_capa.sched.max_size); + schedule_capa.max_queue_size); return -1; }
diff --git a/test/performance/odp_scheduling.c b/test/performance/odp_scheduling.c index acc401e0..655a619e 100644 --- a/test/performance/odp_scheduling.c +++ b/test/performance/odp_scheduling.c @@ -813,6 +813,7 @@ int main(int argc, char *argv[]) odph_odpthread_params_t thr_params; odp_queue_capability_t capa; odp_pool_capability_t pool_capa; + odp_schedule_capability_t schedule_capa; uint32_t num_queues, num_buf;
printf("\nODP example starts\n\n"); @@ -908,10 +909,16 @@ int main(int argc, char *argv[]) return -1; }
+ if (odp_schedule_capability(&schedule_capa)) { + printf("Error: Schedule capa failed.\n"); + return -1; + } + globals->queues_per_prio = QUEUES_PER_PRIO; num_queues = globals->queues_per_prio * NUM_PRIOS; - if (num_queues > capa.sched.max_num) - globals->queues_per_prio = capa.sched.max_num / NUM_PRIOS; + if (num_queues > schedule_capa.max_queues) + globals->queues_per_prio = schedule_capa.max_queues / + NUM_PRIOS;
/* One plain queue is also used */ num_queues = (globals->queues_per_prio * NUM_PRIOS) + 1; diff --git a/test/validation/api/queue/queue.c b/test/validation/api/queue/queue.c index 99acc4bf..aab95bab 100644 --- a/test/validation/api/queue/queue.c +++ b/test/validation/api/queue/queue.c @@ -127,18 +127,15 @@ static void queue_test_capa(void) odp_queue_param_t qparams; char name[ODP_QUEUE_NAME_LEN]; odp_queue_t queue[MAX_QUEUES]; - uint32_t num_queues, min, i, j; + uint32_t num_queues, min, i;
memset(&capa, 0, sizeof(odp_queue_capability_t)); CU_ASSERT(odp_queue_capability(&capa) == 0);
CU_ASSERT(capa.max_queues != 0); CU_ASSERT(capa.plain.max_num != 0); - CU_ASSERT(capa.sched.max_num != 0);
min = capa.plain.max_num; - if (min > capa.sched.max_num) - min = capa.sched.max_num;
CU_ASSERT(capa.max_queues >= min);
@@ -150,33 +147,26 @@ static void queue_test_capa(void) odp_queue_param_init(&qparams); CU_ASSERT(qparams.nonblocking == ODP_BLOCKING);
- for (j = 0; j < 2; j++) { - if (j == 0) { - num_queues = capa.plain.max_num; - } else { - num_queues = capa.sched.max_num; - qparams.type = ODP_QUEUE_TYPE_SCHED; - } + num_queues = capa.plain.max_num;
- if (num_queues > MAX_QUEUES) - num_queues = MAX_QUEUES; + if (num_queues > MAX_QUEUES) + num_queues = MAX_QUEUES;
- for (i = 0; i < num_queues; i++) { - generate_name(name, i); - queue[i] = odp_queue_create(name, &qparams); + for (i = 0; i < num_queues; i++) { + generate_name(name, i); + queue[i] = odp_queue_create(name, &qparams);
- if (queue[i] == ODP_QUEUE_INVALID) { - CU_FAIL("Queue create failed"); - num_queues = i; - break; - } - - CU_ASSERT(odp_queue_lookup(name) != ODP_QUEUE_INVALID); + if (queue[i] == ODP_QUEUE_INVALID) { + CU_FAIL("Queue create failed"); + num_queues = i; + break; }
- for (i = 0; i < num_queues; i++) - CU_ASSERT(odp_queue_destroy(queue[i]) == 0); + CU_ASSERT(odp_queue_lookup(name) != ODP_QUEUE_INVALID); } + + for (i = 0; i < num_queues; i++) + CU_ASSERT(odp_queue_destroy(queue[i]) == 0); }
static void queue_test_mode(void) diff --git a/test/validation/api/scheduler/scheduler.c b/test/validation/api/scheduler/scheduler.c index 35c38751..4fdfc243 100644 --- a/test/validation/api/scheduler/scheduler.c +++ b/test/validation/api/scheduler/scheduler.c @@ -20,6 +20,7 @@ #define NUM_BUFS_PAUSE 1000 #define NUM_BUFS_BEFORE_PAUSE 10 #define NUM_GROUPS 2 +#define MAX_QUEUES (64 * 1024)
#define TEST_QUEUE_SIZE_NUM_EV 50
@@ -144,12 +145,16 @@ static void release_context(odp_schedule_sync_t sync) static void scheduler_test_capa(void) { odp_schedule_capability_t capa; + odp_queue_capability_t queue_capa;
memset(&capa, 0, sizeof(odp_schedule_capability_t)); CU_ASSERT_FATAL(odp_schedule_capability(&capa) == 0); + CU_ASSERT_FATAL(odp_queue_capability(&queue_capa) == 0);
CU_ASSERT(capa.max_groups != 0); CU_ASSERT(capa.max_prios != 0); + CU_ASSERT(capa.max_queues != 0); + CU_ASSERT(queue_capa.max_queues >= capa.max_queues); }
static void scheduler_test_wait_time(void) @@ -413,6 +418,7 @@ static void scheduler_test_wait(void) static void scheduler_test_queue_size(void) { odp_queue_capability_t queue_capa; + odp_scheduler_config_t default_config; odp_pool_t pool; odp_pool_param_t pool_param; odp_queue_param_t queue_param; @@ -426,10 +432,11 @@ static void scheduler_test_queue_size(void) ODP_SCHED_SYNC_ORDERED};
CU_ASSERT_FATAL(odp_queue_capability(&queue_capa) == 0); + odp_scheduler_config_init(&default_config); queue_size = TEST_QUEUE_SIZE_NUM_EV; - if (queue_capa.sched.max_size && - queue_size > queue_capa.sched.max_size) - queue_size = queue_capa.sched.max_size; + if (default_config.queue_size && + queue_size > default_config.queue_size) + queue_size = default_config.queue_size;
odp_pool_param_init(&pool_param); pool_param.buf.size = 100; @@ -1684,9 +1691,10 @@ static int create_queues(test_globals_t *globals) }
globals->max_sched_queue_size = BUFS_PER_QUEUE_EXCL; - if (capa.sched.max_size && capa.sched.max_size < BUFS_PER_QUEUE_EXCL) { - printf("Max sched queue size %u\n", capa.sched.max_size); - globals->max_sched_queue_size = capa.sched.max_size; + if (sched_capa.max_queue_size && sched_capa.max_queue_size < + BUFS_PER_QUEUE_EXCL) { + printf("Max sched queue size %u\n", sched_capa.max_queue_size); + globals->max_sched_queue_size = sched_capa.max_queue_size; }
prios = odp_schedule_num_prio(); @@ -1696,7 +1704,7 @@ static int create_queues(test_globals_t *globals) queues_per_prio = QUEUES_PER_PRIO; num_sched = (prios * queues_per_prio * sched_types) + CHAOS_NUM_QUEUES; num_plain = (prios * queues_per_prio); - while ((num_sched > capa.sched.max_num || + while ((num_sched > sched_capa.max_queues || num_plain > capa.plain.max_num || num_sched + num_plain > capa.max_queues) && queues_per_prio) { queues_per_prio--;
commit 2aee8a5840602472d46ae873c9d9f87cf54461e7 Author: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Date: Wed Oct 31 13:47:52 2018 +0300
linux-gen: queue, schedule: move scheduled queue capabilities to sched
Move scheduled queue capabilities to odp_schedule_capability_t structure, as they logically belong to ODP scheduler module, rather than queue module.
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
diff --git a/platform/linux-generic/odp_queue_basic.c b/platform/linux-generic/odp_queue_basic.c index 1d66ccc7..37a2fad1 100644 --- a/platform/linux-generic/odp_queue_basic.c +++ b/platform/linux-generic/odp_queue_basic.c @@ -57,10 +57,10 @@ static int queue_capa(odp_queue_capability_t *capa, int sched ODP_UNUSED) capa->plain.max_size = queue_glb->config.max_queue_size; capa->plain.lockfree.max_num = queue_glb->queue_lf_num; capa->plain.lockfree.max_size = queue_glb->queue_lf_size; +#if ODP_DEPRECATED_API 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(); diff --git a/platform/linux-generic/odp_queue_scalable.c b/platform/linux-generic/odp_queue_scalable.c index 4d5598a8..88abe8c7 100644 --- a/platform/linux-generic/odp_queue_scalable.c +++ b/platform/linux-generic/odp_queue_scalable.c @@ -317,11 +317,11 @@ static int queue_capability(odp_queue_capability_t *capa) capa->max_ordered_locks = sched_fn->max_ordered_locks(); capa->max_sched_groups = sched_fn->num_grps(); capa->sched_prios = odp_schedule_num_prio(); + capa->sched.max_num = ODP_CONFIG_QUEUES - NUM_INTERNAL_QUEUES; + capa->sched.max_size = 0; #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; - capa->sched.max_size = 0;
return 0; } diff --git a/platform/linux-generic/odp_schedule_basic.c b/platform/linux-generic/odp_schedule_basic.c index 85b4142c..b93e5c41 100644 --- a/platform/linux-generic/odp_schedule_basic.c +++ b/platform/linux-generic/odp_schedule_basic.c @@ -1559,6 +1559,8 @@ static int schedule_capability(odp_schedule_capability_t *capa) capa->max_ordered_locks = schedule_max_ordered_locks(); capa->max_groups = schedule_num_grps(); capa->max_prios = schedule_num_prio(); + capa->max_queues = ODP_CONFIG_QUEUES - NUM_INTERNAL_QUEUES; + capa->max_queue_size = queue_glb->config.max_queue_size;
return 0; } diff --git a/platform/linux-generic/odp_schedule_scalable.c b/platform/linux-generic/odp_schedule_scalable.c index 2c681647..091e5ff9 100644 --- a/platform/linux-generic/odp_schedule_scalable.c +++ b/platform/linux-generic/odp_schedule_scalable.c @@ -2114,6 +2114,8 @@ static int schedule_capability(odp_schedule_capability_t *capa) capa->max_ordered_locks = schedule_max_ordered_locks(); capa->max_groups = num_grps(); capa->max_prios = schedule_num_prio(); + capa->max_queues = ODP_CONFIG_QUEUES - NUM_INTERNAL_QUEUES; + capa->max_queue_size = 0;
return 0; } diff --git a/platform/linux-generic/odp_schedule_sp.c b/platform/linux-generic/odp_schedule_sp.c index 9c477d71..6cc8f376 100644 --- a/platform/linux-generic/odp_schedule_sp.c +++ b/platform/linux-generic/odp_schedule_sp.c @@ -932,6 +932,8 @@ static int schedule_capability(odp_schedule_capability_t *capa) capa->max_ordered_locks = max_ordered_locks(); capa->max_groups = num_grps(); capa->max_prios = schedule_num_prio(); + capa->max_queues = ODP_CONFIG_QUEUES - NUM_INTERNAL_QUEUES; + capa->max_queue_size = queue_glb->config.max_queue_size;
return 0; }
commit 206c476a3e4d60713a8c279eee78add66421d0e6 Author: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Date: Wed Oct 24 17:50:54 2018 +0300
api: queue, schedule: move scheduled queue capabilities to sched
Move scheduled queue capabilities to odp_schedule_capability_t structure, as they logically belong to ODP scheduler module, rather than queue module.
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
diff --git a/include/odp/api/spec/queue_types.h b/include/odp/api/spec/queue_types.h index 9c7c7de9..c8f31046 100644 --- a/include/odp/api/spec/queue_types.h +++ b/include/odp/api/spec/queue_types.h @@ -139,7 +139,8 @@ typedef struct odp_queue_capability_t { * instead */ unsigned int ODP_DEPRECATE(max_sched_groups);
- /** @deprecated Use prios field of odp_schedule_capability_t instead */ + /** @deprecated Use max_prios field of odp_schedule_capability_t + * instead */ unsigned int ODP_DEPRECATE(sched_prios);
/** Plain queue capabilities */ @@ -182,7 +183,8 @@ typedef struct odp_queue_capability_t {
} plain;
- /** Scheduled queue capabilities */ + /** @deprecated Use queue capabilities in odp_schedule_capability_t + * instead */ struct { /** Maximum number of scheduled (ODP_BLOCKING) queues of the * default size. */ @@ -220,7 +222,7 @@ typedef struct odp_queue_capability_t {
} waitfree;
- } sched; + } ODP_DEPRECATE(sched);
} odp_queue_capability_t;
diff --git a/include/odp/api/spec/schedule_types.h b/include/odp/api/spec/schedule_types.h index f55e53f3..e7cc0479 100644 --- a/include/odp/api/spec/schedule_types.h +++ b/include/odp/api/spec/schedule_types.h @@ -14,6 +14,8 @@ #define ODP_API_SPEC_SCHEDULE_TYPES_H_ #include <odp/visibility_begin.h>
+#include <odp/api/support.h> + #ifdef __cplusplus extern "C" { #endif @@ -178,6 +180,24 @@ typedef struct odp_schedule_capability_t { /** Number of scheduling priorities */ uint32_t max_prios;
+ /** Maximum number of scheduled (ODP_BLOCKING) queues of the default + * size. */ + uint32_t max_queues; + + /** Maximum number of events a scheduled (ODP_BLOCKING) queue can store + * simultaneously. The value of zero means that scheduled queues do not + * have a size limit, but a single queue can store all available + * events. */ + uint32_t max_queue_size; + + /** Lock-free (ODP_NONBLOCKING_LF) queues support. + * The specification is the same as for the blocking implementation. */ + odp_support_t lockfree_queues; + + /** Wait-free (ODP_NONBLOCKING_WF) queues support. + * The specification is the same as for the blocking implementation. */ + odp_support_t waitfree_queues; + } odp_schedule_capability_t;
/**
commit eee646125e8e6ae3222268448be423a351e6043e Author: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Date: Wed Oct 24 17:49:29 2018 +0300
example, tests: move scheduler capabilities to scheduler
Add odp_schedule_capability() call to query scheduler capabilities. Move basic scheduler capabilities to new odp_schedule_capability_t structure.
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
diff --git a/example/sysinfo/odp_sysinfo.c b/example/sysinfo/odp_sysinfo.c index ff79d893..cd0c6bfd 100644 --- a/example/sysinfo/odp_sysinfo.c +++ b/example/sysinfo/odp_sysinfo.c @@ -238,6 +238,7 @@ int main(void) odp_queue_capability_t queue_capa; odp_timer_capability_t timer_capa; odp_crypto_capability_t crypto_capa; + odp_schedule_capability_t schedule_capa; uint64_t huge_page[MAX_HUGE_PAGES]; char ava_mask_str[ODP_CPUMASK_STR_SIZE]; char work_mask_str[ODP_CPUMASK_STR_SIZE]; @@ -293,6 +294,11 @@ int main(void) return -1; }
+ if (odp_schedule_capability(&schedule_capa)) { + printf("schedule capability failed\n"); + return -1; + } + if (odp_timer_capability(ODP_CLOCK_CPU, &timer_capa)) { printf("timer capability failed\n"); return -1; @@ -393,9 +399,9 @@ int main(void) printf("\n"); printf(" SCHEDULER\n"); printf(" max ordered locks: %" PRIu32 "\n", - queue_capa.max_ordered_locks); - printf(" max groups: %u\n", queue_capa.max_sched_groups); - printf(" priorities: %u\n", queue_capa.sched_prios); + schedule_capa.max_ordered_locks); + printf(" max groups: %u\n", schedule_capa.max_groups); + printf(" priorities: %u\n", schedule_capa.prios); printf(" sched.max_num: %" PRIu32 "\n", queue_capa.sched.max_num); printf(" sched.max_size: %" PRIu32 "\n", diff --git a/test/performance/odp_pktio_ordered.c b/test/performance/odp_pktio_ordered.c index 2e0ff578..1b4b756a 100644 --- a/test/performance/odp_pktio_ordered.c +++ b/test/performance/odp_pktio_ordered.c @@ -1062,6 +1062,7 @@ int main(int argc, char *argv[]) odp_pool_param_t params; odp_shm_t shm; odp_queue_capability_t queue_capa; + odp_schedule_capability_t schedule_capa; odp_pool_capability_t pool_capa; odph_ethaddr_t new_addr; odph_helper_options_t helper_options; @@ -1103,6 +1104,11 @@ int main(int argc, char *argv[]) exit(EXIT_FAILURE); }
+ if (odp_schedule_capability(&schedule_capa)) { + printf("Error: Schedule capa failed.\n"); + return -1; + } + if (odp_pool_capability(&pool_capa)) { LOG_ERR("Error: Pool capa failed\n"); exit(EXIT_FAILURE); @@ -1131,7 +1137,7 @@ int main(int argc, char *argv[])
if (gbl_args->appl.in_mode == SCHED_ORDERED) { /* At least one ordered lock required */ - if (queue_capa.max_ordered_locks < 1) { + if (schedule_capa.max_ordered_locks < 1) { LOG_ERR("Error: Ordered locks not available.\n"); exit(EXIT_FAILURE); } diff --git a/test/validation/api/classification/odp_classification_tests.c b/test/validation/api/classification/odp_classification_tests.c index 41201d4a..4f722140 100644 --- a/test/validation/api/classification/odp_classification_tests.c +++ b/test/validation/api/classification/odp_classification_tests.c @@ -152,16 +152,16 @@ void configure_cls_pmr_chain(void) uint32_t addr; uint32_t mask; odp_pmr_param_t pmr_param; - odp_queue_capability_t queue_capa; + odp_schedule_capability_t schedule_capa;
- CU_ASSERT_FATAL(odp_queue_capability(&queue_capa) == 0); + CU_ASSERT_FATAL(odp_schedule_capability(&schedule_capa) == 0);
odp_queue_param_init(&qparam); qparam.type = ODP_QUEUE_TYPE_SCHED; qparam.sched.prio = odp_schedule_default_prio(); qparam.sched.sync = ODP_SCHED_SYNC_PARALLEL; qparam.sched.group = ODP_SCHED_GROUP_ALL; - qparam.sched.lock_count = queue_capa.max_ordered_locks; + qparam.sched.lock_count = schedule_capa.max_ordered_locks; sprintf(queuename, "%s", "SrcQueue");
queue_list[CLS_PMR_CHAIN_SRC] = odp_queue_create(queuename, &qparam); diff --git a/test/validation/api/queue/queue.c b/test/validation/api/queue/queue.c index cf081a99..99acc4bf 100644 --- a/test/validation/api/queue/queue.c +++ b/test/validation/api/queue/queue.c @@ -133,8 +133,6 @@ static void queue_test_capa(void) CU_ASSERT(odp_queue_capability(&capa) == 0);
CU_ASSERT(capa.max_queues != 0); - CU_ASSERT(capa.max_sched_groups != 0); - CU_ASSERT(capa.sched_prios != 0); CU_ASSERT(capa.plain.max_num != 0); CU_ASSERT(capa.sched.max_num != 0);
@@ -715,6 +713,7 @@ static void queue_test_info(void) odp_queue_info_t info; odp_queue_param_t param; odp_queue_capability_t capability; + odp_schedule_capability_t sched_capa; char q_plain_ctx[] = "test_q_plain context data"; char q_order_ctx[] = "test_q_order context data"; uint32_t lock_count; @@ -729,13 +728,14 @@ static void queue_test_info(void)
memset(&capability, 0, sizeof(odp_queue_capability_t)); CU_ASSERT(odp_queue_capability(&capability) == 0); + CU_ASSERT(odp_schedule_capability(&sched_capa) == 0); /* Create a scheduled ordered queue with explicitly set params */ odp_queue_param_init(¶m); param.type = ODP_QUEUE_TYPE_SCHED; param.sched.prio = odp_schedule_default_prio(); param.sched.sync = ODP_SCHED_SYNC_ORDERED; param.sched.group = ODP_SCHED_GROUP_ALL; - param.sched.lock_count = capability.max_ordered_locks; + param.sched.lock_count = sched_capa.max_ordered_locks; if (param.sched.lock_count == 0) printf("\n Ordered locks NOT supported\n"); param.context = q_order_ctx; diff --git a/test/validation/api/scheduler/scheduler.c b/test/validation/api/scheduler/scheduler.c index 2f66f526..35c38751 100644 --- a/test/validation/api/scheduler/scheduler.c +++ b/test/validation/api/scheduler/scheduler.c @@ -141,6 +141,17 @@ static void release_context(odp_schedule_sync_t sync) odp_schedule_release_ordered(); }
+static void scheduler_test_capa(void) +{ + odp_schedule_capability_t capa; + + memset(&capa, 0, sizeof(odp_schedule_capability_t)); + CU_ASSERT_FATAL(odp_schedule_capability(&capa) == 0); + + CU_ASSERT(capa.max_groups != 0); + CU_ASSERT(capa.max_prios != 0); +} + static void scheduler_test_wait_time(void) { int i; @@ -1643,6 +1654,7 @@ static int create_queues(test_globals_t *globals) { int i, j, prios, rc; odp_queue_capability_t capa; + odp_schedule_capability_t sched_capa; odp_pool_t queue_ctx_pool; odp_pool_param_t params; odp_buffer_t queue_ctx_buf; @@ -1659,11 +1671,16 @@ static int create_queues(test_globals_t *globals) return -1; }
+ if (odp_schedule_capability(&sched_capa) < 0) { + printf("Queue capability query failed\n"); + return -1; + } + /* Limit to test maximum */ - if (capa.max_ordered_locks > MAX_ORDERED_LOCKS) { - capa.max_ordered_locks = MAX_ORDERED_LOCKS; + if (sched_capa.max_ordered_locks > MAX_ORDERED_LOCKS) { + sched_capa.max_ordered_locks = MAX_ORDERED_LOCKS; printf("Testing only %u ordered locks\n", - capa.max_ordered_locks); + sched_capa.max_ordered_locks); }
globals->max_sched_queue_size = BUFS_PER_QUEUE_EXCL; @@ -1764,7 +1781,7 @@ static int create_queues(test_globals_t *globals)
snprintf(name, sizeof(name), "sched_%d_%d_o", i, j); p.sched.sync = ODP_SCHED_SYNC_ORDERED; - p.sched.lock_count = capa.max_ordered_locks; + p.sched.lock_count = sched_capa.max_ordered_locks; p.size = 0; q = odp_queue_create(name, &p);
@@ -1773,12 +1790,12 @@ static int create_queues(test_globals_t *globals) return -1; } if (odp_queue_lock_count(q) != - capa.max_ordered_locks) { + sched_capa.max_ordered_locks) { printf("Queue %" PRIu64 " created with " "%d locks instead of expected %d\n", odp_queue_to_u64(q), odp_queue_lock_count(q), - capa.max_ordered_locks); + sched_capa.max_ordered_locks); return -1; }
@@ -1795,7 +1812,7 @@ static int create_queues(test_globals_t *globals) qctx->sequence = 0;
for (ndx = 0; - ndx < capa.max_ordered_locks; + ndx < sched_capa.max_ordered_locks; ndx++) { qctx->lock_sequence[ndx] = 0; } @@ -1949,6 +1966,7 @@ static int scheduler_suite_term(void) }
odp_testinfo_t scheduler_suite[] = { + ODP_TEST_INFO(scheduler_test_capa), ODP_TEST_INFO(scheduler_test_wait_time), ODP_TEST_INFO(scheduler_test_num_prio), ODP_TEST_INFO(scheduler_test_queue_destroy),
commit 930b0042689ca69851e2fe7abd0c9d35b61e76e5 Author: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Date: Fri Oct 26 03:00:43 2018 +0300
linux-gen: queue, schedule: move scheduler capabilities to scheduler
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
diff --git a/platform/linux-generic/include/odp_schedule_if.h b/platform/linux-generic/include/odp_schedule_if.h index 5f7f2c4d..88961269 100644 --- a/platform/linux-generic/include/odp_schedule_if.h +++ b/platform/linux-generic/include/odp_schedule_if.h @@ -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); diff --git a/platform/linux-generic/odp_queue_basic.c b/platform/linux-generic/odp_queue_basic.c index b1f9bd0e..1d66ccc7 100644 --- a/platform/linux-generic/odp_queue_basic.c +++ b/platform/linux-generic/odp_queue_basic.c @@ -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));
@@ -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; } diff --git a/platform/linux-generic/odp_queue_scalable.c b/platform/linux-generic/odp_queue_scalable.c index ac85d10a..4d5598a8 100644 --- a/platform/linux-generic/odp_queue_scalable.c +++ b/platform/linux-generic/odp_queue_scalable.c @@ -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; diff --git a/platform/linux-generic/odp_schedule_basic.c b/platform/linux-generic/odp_schedule_basic.c index 0b226e4f..85b4142c 100644 --- a/platform/linux-generic/odp_schedule_basic.c +++ b/platform/linux-generic/odp_schedule_basic.c @@ -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 */ @@ -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, diff --git a/platform/linux-generic/odp_schedule_if.c b/platform/linux-generic/odp_schedule_if.c index 4d50a13f..92e0a62f 100644 --- a/platform/linux-generic/odp_schedule_if.c +++ b/platform/linux-generic/odp_schedule_if.c @@ -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); diff --git a/platform/linux-generic/odp_schedule_scalable.c b/platform/linux-generic/odp_schedule_scalable.c index 957398ca..2c681647 100644 --- a/platform/linux-generic/odp_schedule_scalable.c +++ b/platform/linux-generic/odp_schedule_scalable.c @@ -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, @@ -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, diff --git a/platform/linux-generic/odp_schedule_sp.c b/platform/linux-generic/odp_schedule_sp.c index f55e2151..9c477d71 100644 --- a/platform/linux-generic/odp_schedule_sp.c +++ b/platform/linux-generic/odp_schedule_sp.c @@ -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, @@ -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,
commit 81e5aead1d8996907911463c9025a0b852bbfae8 Author: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Date: Fri Oct 26 02:50:26 2018 +0300
linux-gen: move NUM_INTERNAL_QUEUES to config
It is really a config value, that allows one to select amount of queues to be reserved for platform internal use, so move it to config header.
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
diff --git a/platform/linux-generic/include/odp_config_internal.h b/platform/linux-generic/include/odp_config_internal.h index a06e0c97..810576b9 100644 --- a/platform/linux-generic/include/odp_config_internal.h +++ b/platform/linux-generic/include/odp_config_internal.h @@ -26,6 +26,11 @@ extern "C" { */ #define ODP_CONFIG_QUEUES 1024
+/* + * Queues reserved for ODP internal use + */ +#define NUM_INTERNAL_QUEUES 64 + /* * Maximum number of ordered locks per queue */ diff --git a/platform/linux-generic/odp_queue_basic.c b/platform/linux-generic/odp_queue_basic.c index f02a9a32..b1f9bd0e 100644 --- a/platform/linux-generic/odp_queue_basic.c +++ b/platform/linux-generic/odp_queue_basic.c @@ -30,8 +30,6 @@ #include <odp/api/plat/queue_inline_types.h> #include <odp_global_data.h>
-#define NUM_INTERNAL_QUEUES 64 - #include <odp/api/plat/ticketlock_inlines.h> #define LOCK(queue_ptr) odp_ticketlock_lock(&((queue_ptr)->s.lock)) #define UNLOCK(queue_ptr) odp_ticketlock_unlock(&((queue_ptr)->s.lock)) diff --git a/platform/linux-generic/odp_queue_scalable.c b/platform/linux-generic/odp_queue_scalable.c index 5bff1354..ac85d10a 100644 --- a/platform/linux-generic/odp_queue_scalable.c +++ b/platform/linux-generic/odp_queue_scalable.c @@ -33,8 +33,6 @@ #include <string.h> #include <inttypes.h>
-#define NUM_INTERNAL_QUEUES 64 - #define MIN(a, b) \ ({ \ __typeof__(a) tmp_a = (a); \
commit 7fdf6e03af1608e476fa0296d77de50f618b1754 Author: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Date: Wed Oct 24 17:49:29 2018 +0300
api: queue, schedule: move scheduler capabilities to scheduler
Add odp_schedule_capability() call to query scheduler capabilities. Move basic scheduler capabilities to new odp_schedule_capability_t structure.
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
diff --git a/include/odp/api/spec/queue_types.h b/include/odp/api/spec/queue_types.h index be7e79a8..9c7c7de9 100644 --- a/include/odp/api/spec/queue_types.h +++ b/include/odp/api/spec/queue_types.h @@ -19,6 +19,7 @@ extern "C" { #endif
#include <odp/api/schedule_types.h> +#include <odp/api/deprecated.h>
/** @addtogroup odp_queue * @{ @@ -130,14 +131,16 @@ typedef struct odp_queue_capability_t { * types are used simultaneously. */ uint32_t max_queues;
- /** Maximum number of ordered locks per queue */ - uint32_t max_ordered_locks; + /** @deprecated Use max_ordered_locks field of + * odp_schedule_capability_t instead */ + uint32_t ODP_DEPRECATE(max_ordered_locks);
- /** Maximum number of scheduling groups */ - unsigned max_sched_groups; + /** @deprecated Use max_groups field of odp_schedule_capability_t + * instead */ + unsigned int ODP_DEPRECATE(max_sched_groups);
- /** Number of scheduling priorities */ - unsigned sched_prios; + /** @deprecated Use prios field of odp_schedule_capability_t instead */ + unsigned int ODP_DEPRECATE(sched_prios);
/** Plain queue capabilities */ struct { diff --git a/include/odp/api/spec/schedule.h b/include/odp/api/spec/schedule.h index d9b868e3..6538c509 100644 --- a/include/odp/api/spec/schedule.h +++ b/include/odp/api/spec/schedule.h @@ -257,6 +257,18 @@ int odp_schedule_default_prio(void); */ int odp_schedule_num_prio(void);
+/** + * Query scheduler capabilities + * + * Outputs schedule capabilities on success. + * + * @param[out] capa Pointer to capability structure for output + * + * @retval 0 on success + * @retval <0 on failure + */ +int odp_schedule_capability(odp_schedule_capability_t *capa); + /** * Schedule group create * diff --git a/include/odp/api/spec/schedule_types.h b/include/odp/api/spec/schedule_types.h index 76afc6dd..f55e53f3 100644 --- a/include/odp/api/spec/schedule_types.h +++ b/include/odp/api/spec/schedule_types.h @@ -165,6 +165,21 @@ typedef struct odp_schedule_param_t { uint32_t lock_count; } odp_schedule_param_t;
+/** + * Scheduler capabilities + */ +typedef struct odp_schedule_capability_t { + /** Maximum number of ordered locks per queue */ + uint32_t max_ordered_locks; + + /** Maximum number of scheduling groups */ + uint32_t max_groups; + + /** Number of scheduling priorities */ + uint32_t max_prios; + +} odp_schedule_capability_t; + /** * @} */
-----------------------------------------------------------------------
Summary of changes: example/classifier/odp_classifier.c | 3 + example/generator/odp_generator.c | 3 + example/ipsec/odp_ipsec.c | 3 + example/ipsec_api/odp_ipsec.c | 3 + example/ipsec_offload/odp_ipsec_offload.c | 3 + example/packet/odp_packet_dump.c | 2 + example/packet/odp_pktio.c | 3 + example/sysinfo/odp_sysinfo.c | 32 +-- example/timer/odp_timer_accuracy.c | 3 + example/timer/odp_timer_simple.c | 3 + example/timer/odp_timer_test.c | 3 + include/odp/api/abi-default/event.h | 3 +- include/odp/api/spec/event.h | 42 ++++ include/odp/api/spec/queue_types.h | 21 +- include/odp/api/spec/schedule.h | 50 +++++ include/odp/api/spec/schedule_types.h | 87 ++++++++ .../linux-generic/include/odp_buffer_internal.h | 20 ++ .../linux-generic/include/odp_config_internal.h | 5 + platform/linux-generic/include/odp_schedule_if.h | 12 +- platform/linux-generic/odp_event.c | 10 + platform/linux-generic/odp_queue_basic.c | 6 +- platform/linux-generic/odp_queue_scalable.c | 8 +- platform/linux-generic/odp_schedule_basic.c | 39 +++- platform/linux-generic/odp_schedule_if.c | 40 ++++ platform/linux-generic/odp_schedule_scalable.c | 29 +++ platform/linux-generic/odp_schedule_sp.c | 34 +++ platform/linux-generic/odp_thread.c | 8 +- test/common/odp_cunit_common.c | 4 + test/performance/odp_cpu_bench.c | 23 +- test/performance/odp_crypto.c | 1 + test/performance/odp_ipsec.c | 1 + test/performance/odp_l2fwd.c | 2 + test/performance/odp_pktio_ordered.c | 19 +- test/performance/odp_pktio_perf.c | 3 + test/performance/odp_sched_latency.c | 2 + test/performance/odp_sched_perf.c | 22 +- test/performance/odp_sched_pktio.c | 17 +- test/performance/odp_scheduling.c | 10 +- .../api/classification/odp_classification_tests.c | 6 +- test/validation/api/queue/queue.c | 46 ++-- test/validation/api/scheduler/scheduler.c | 239 +++++++++++++++++++-- test/validation/api/timer/timer.c | 3 + 42 files changed, 746 insertions(+), 127 deletions(-)
hooks/post-receive