diff options
author | Matias Elo <matias.elo@nokia.com> | 2018-10-12 15:51:07 +0300 |
---|---|---|
committer | Maxim Uvarov <maxim.uvarov@linaro.org> | 2018-11-21 18:02:16 +0300 |
commit | 37bb9253fe0951f6dba10349e4ff472890615006 (patch) | |
tree | 0b6d93fa021d9a99353163c5dc8cc338d76c24ca | |
parent | 70cf3e1941797acc0c3f1e2990f4490c249ee1a8 (diff) |
example: use mem_model from helper options
Signed-off-by: Matias Elo <matias.elo@nokia.com>
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>
-rw-r--r-- | example/classifier/odp_classifier.c | 17 | ||||
-rw-r--r-- | example/generator/odp_generator.c | 17 | ||||
-rw-r--r-- | example/ipsec/odp_ipsec.c | 17 | ||||
-rw-r--r-- | example/ipsec_api/odp_ipsec.c | 17 | ||||
-rw-r--r-- | example/l2fwd_simple/odp_l2fwd_simple.c | 17 | ||||
-rw-r--r-- | example/packet/odp_pktio.c | 17 | ||||
-rw-r--r-- | example/switch/odp_switch.c | 17 | ||||
-rw-r--r-- | example/time/time_global_test.c | 15 | ||||
-rw-r--r-- | example/timer/odp_timer_test.c | 17 |
9 files changed, 116 insertions, 35 deletions
diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c index b8e1c8978..274ffaf41 100644 --- a/example/classifier/odp_classifier.c +++ b/example/classifier/odp_classifier.c @@ -468,6 +468,7 @@ static void configure_cos(odp_cos_t default_cos, appl_args_t *args) */ int main(int argc, char *argv[]) { + odph_helper_options_t helper_options; odph_odpthread_t thread_tbl[MAX_WORKERS]; odp_pool_t pool; int num_workers; @@ -481,10 +482,21 @@ int main(int argc, char *argv[]) odp_shm_t shm; int ret; odp_instance_t instance; + odp_init_t init_param; odph_odpthread_params_t thr_params; + /* Let helper collect its own arguments (e.g. --odph_proc) */ + argc = odph_parse_options(argc, argv); + if (odph_options(&helper_options)) { + EXAMPLE_ERR("Error: reading ODP helper options failed.\n"); + exit(EXIT_FAILURE); + } + + odp_init_param_init(&init_param); + init_param.mem_model = helper_options.mem_model; + /* Init ODP before calling anything else */ - if (odp_init_global(&instance, NULL, NULL)) { + if (odp_init_global(&instance, &init_param, NULL)) { EXAMPLE_ERR("Error: ODP global init failed.\n"); exit(EXIT_FAILURE); } @@ -805,9 +817,6 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) static const char *shortopts = "+c:t:i:p:m:t:h"; - /* let helper collect its own arguments (e.g. --odph_proc) */ - argc = odph_parse_options(argc, argv); - appl_args->cpu_count = 1; /* Use one worker by default */ while (1) { diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index 34543cd2e..98a892117 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -1090,6 +1090,7 @@ static void print_global_stats(int num_workers) */ int main(int argc, char *argv[]) { + odph_helper_options_t helper_options; odph_odpthread_t thread_tbl[MAX_WORKERS]; odp_pool_t pool; int num_workers; @@ -1101,10 +1102,21 @@ int main(int argc, char *argv[]) odp_pool_param_t params; interface_t *ifs; odp_instance_t instance; + odp_init_t init_param; odph_odpthread_params_t thr_params; + /* Let helper collect its own arguments (e.g. --odph_proc) */ + argc = odph_parse_options(argc, argv); + if (odph_options(&helper_options)) { + EXAMPLE_ERR("Error: reading ODP helper options failed.\n"); + exit(EXIT_FAILURE); + } + + odp_init_param_init(&init_param); + init_param.mem_model = helper_options.mem_model; + /* Init ODP before calling anything else */ - if (odp_init_global(&instance, NULL, NULL)) { + if (odp_init_global(&instance, &init_param, NULL)) { EXAMPLE_ERR("Error: ODP global init failed.\n"); exit(EXIT_FAILURE); } @@ -1427,9 +1439,6 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) static const char *shortopts = "+I:a:b:s:d:p:i:m:n:t:w:c:x:he:j:f:k" ":yr:z"; - /* let helper collect its own arguments (e.g. --odph_proc) */ - argc = odph_parse_options(argc, argv); - appl_args->mode = -1; /* Invalid, must be changed by parsing */ appl_args->number = -1; appl_args->payload = 56; diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index aff6de0a8..1bbf7a000 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -1186,6 +1186,7 @@ int pktio_thread(void *arg EXAMPLE_UNUSED) int main(int argc, char *argv[]) { + odph_helper_options_t helper_options; odph_odpthread_t thread_tbl[MAX_WORKERS]; int num_workers; int i; @@ -1195,6 +1196,7 @@ main(int argc, char *argv[]) char cpumaskstr[ODP_CPUMASK_STR_SIZE]; odp_pool_param_t params; odp_instance_t instance; + odp_init_t init_param; odph_odpthread_params_t thr_params; /* create by default scheduled queues */ @@ -1207,8 +1209,18 @@ main(int argc, char *argv[]) schedule = polled_odp_schedule_cb; } + /* Let helper collect its own arguments (e.g. --odph_proc) */ + argc = odph_parse_options(argc, argv); + if (odph_options(&helper_options)) { + EXAMPLE_ERR("Error: reading ODP helper options failed.\n"); + exit(EXIT_FAILURE); + } + + odp_init_param_init(&init_param); + init_param.mem_model = helper_options.mem_model; + /* Init ODP before calling anything else */ - if (odp_init_global(&instance, NULL, NULL)) { + if (odp_init_global(&instance, &init_param, NULL)) { EXAMPLE_ERR("Error: ODP global init failed.\n"); exit(EXIT_FAILURE); } @@ -1405,9 +1417,6 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) static const char *shortopts = "+c:i:m:h:r:p:a:e:t:s:"; - /* let helper collect its own arguments (e.g. --odph_proc) */ - argc = odph_parse_options(argc, argv); - printf("\nParsing command line options\n"); appl_args->cpu_count = 1; /* use one worker by default */ diff --git a/example/ipsec_api/odp_ipsec.c b/example/ipsec_api/odp_ipsec.c index 08840d631..ab0fa3c5c 100644 --- a/example/ipsec_api/odp_ipsec.c +++ b/example/ipsec_api/odp_ipsec.c @@ -885,6 +885,7 @@ int pktio_thread(void *arg EXAMPLE_UNUSED) int main(int argc, char *argv[]) { + odph_helper_options_t helper_options; odph_odpthread_t thread_tbl[MAX_WORKERS]; int num_workers; int i; @@ -894,6 +895,7 @@ main(int argc, char *argv[]) char cpumaskstr[ODP_CPUMASK_STR_SIZE]; odp_pool_param_t params; odp_instance_t instance; + odp_init_t init_param; odph_odpthread_params_t thr_params; /* create by default scheduled queues */ @@ -906,8 +908,18 @@ main(int argc, char *argv[]) schedule = polled_odp_schedule_cb; } + /* Let helper collect its own arguments (e.g. --odph_proc) */ + argc = odph_parse_options(argc, argv); + if (odph_options(&helper_options)) { + EXAMPLE_ERR("Error: reading ODP helper options failed.\n"); + exit(EXIT_FAILURE); + } + + odp_init_param_init(&init_param); + init_param.mem_model = helper_options.mem_model; + /* Init ODP before calling anything else */ - if (odp_init_global(&instance, NULL, NULL)) { + if (odp_init_global(&instance, &init_param, NULL)) { EXAMPLE_ERR("Error: ODP global init failed.\n"); exit(EXIT_FAILURE); } @@ -1106,9 +1118,6 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) static const char *shortopts = "+c:i:h:lm:r:p:a:e:t:s:"; - /* let helper collect its own arguments (e.g. --odph_proc) */ - argc = odph_parse_options(argc, argv); - appl_args->cpu_count = 1; /* use one worker by default */ printf("\nParsing command line options\n"); diff --git a/example/l2fwd_simple/odp_l2fwd_simple.c b/example/l2fwd_simple/odp_l2fwd_simple.c index 8daeec4c0..f7e7ba539 100644 --- a/example/l2fwd_simple/odp_l2fwd_simple.c +++ b/example/l2fwd_simple/odp_l2fwd_simple.c @@ -139,17 +139,29 @@ static int run_worker(void *arg ODP_UNUSED) int main(int argc, char **argv) { + odph_helper_options_t helper_options; odp_pool_t pool; odp_pool_param_t params; odp_cpumask_t cpumask; odph_odpthread_t thd[MAX_WORKERS]; odp_instance_t instance; + odp_init_t init_param; odph_odpthread_params_t thr_params; odph_ethaddr_t correct_src; uint32_t mtu1, mtu2; odp_shm_t shm; - if (odp_init_global(&instance, NULL, NULL)) { + /* Let helper collect its own arguments (e.g. --odph_proc) */ + argc = odph_parse_options(argc, argv); + if (odph_options(&helper_options)) { + printf("Error: reading ODP helper options failed.\n"); + exit(EXIT_FAILURE); + } + + odp_init_param_init(&init_param); + init_param.mem_model = helper_options.mem_model; + + if (odp_init_global(&instance, &init_param, NULL)) { printf("Error: ODP global init failed.\n"); exit(1); } @@ -171,9 +183,6 @@ int main(int argc, char **argv) memset(global, 0, sizeof(global_data_t)); global->shm = shm; - /* let helper collect its own arguments (e.g. --odph_proc) */ - argc = odph_parse_options(argc, argv); - if (argc > 7 || odph_eth_addr_parse(&global->dst, argv[3]) != 0 || odph_eth_addr_parse(&global->src, argv[4]) != 0) { diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c index f71ae5371..b1c4a79c8 100644 --- a/example/packet/odp_pktio.c +++ b/example/packet/odp_pktio.c @@ -343,6 +343,7 @@ static int pktio_ifburst_thread(void *arg) */ int main(int argc, char *argv[]) { + odph_helper_options_t helper_options; odph_odpthread_t thread_tbl[MAX_WORKERS]; odp_pool_t pool; int num_workers; @@ -352,11 +353,22 @@ int main(int argc, char *argv[]) char cpumaskstr[ODP_CPUMASK_STR_SIZE]; odp_pool_param_t params; odp_instance_t instance; + odp_init_t init_param; odph_odpthread_params_t thr_params; odp_shm_t shm; + /* Let helper collect its own arguments (e.g. --odph_proc) */ + argc = odph_parse_options(argc, argv); + if (odph_options(&helper_options)) { + EXAMPLE_ERR("Error: reading ODP helper options failed.\n"); + exit(EXIT_FAILURE); + } + + odp_init_param_init(&init_param); + init_param.mem_model = helper_options.mem_model; + /* Init ODP before calling anything else */ - if (odp_init_global(&instance, NULL, NULL)) { + if (odp_init_global(&instance, &init_param, NULL)) { EXAMPLE_ERR("Error: ODP global init failed.\n"); exit(EXIT_FAILURE); } @@ -585,9 +597,6 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) static const char *shortopts = "+c:i:+m:t:h"; - /* let helper collect its own arguments (e.g. --odph_proc) */ - argc = odph_parse_options(argc, argv); - appl_args->cpu_count = 1; /* use one worker by default */ appl_args->mode = APPL_MODE_PKT_SCHED; appl_args->time = 0; /**< loop forever */ diff --git a/example/switch/odp_switch.c b/example/switch/odp_switch.c index a67fa180f..a0162145b 100644 --- a/example/switch/odp_switch.c +++ b/example/switch/odp_switch.c @@ -758,9 +758,6 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) static const char *shortopts = "+c:+t:+a:i:h"; - /* let helper collect its own arguments (e.g. --odph_proc) */ - argc = odph_parse_options(argc, argv); - appl_args->cpu_count = 1; /* use one worker by default */ appl_args->time = 0; /* loop forever if time to run is 0 */ appl_args->accuracy = 10; /* get and print pps stats second */ @@ -870,6 +867,7 @@ static void gbl_args_init(args_t *args) int main(int argc, char **argv) { + odph_helper_options_t helper_options; odph_odpthread_t thread_tbl[MAX_WORKERS]; int i, j; int cpu; @@ -882,10 +880,21 @@ int main(int argc, char **argv) stats_t (*stats)[MAX_PKTIOS]; int if_count; odp_instance_t instance; + odp_init_t init_param; odph_odpthread_params_t thr_params; + /* Let helper collect its own arguments (e.g. --odph_proc) */ + argc = odph_parse_options(argc, argv); + if (odph_options(&helper_options)) { + printf("Error: reading ODP helper options failed.\n"); + exit(EXIT_FAILURE); + } + + odp_init_param_init(&init_param); + init_param.mem_model = helper_options.mem_model; + /* Init ODP before calling anything else */ - if (odp_init_global(&instance, NULL, NULL)) { + if (odp_init_global(&instance, &init_param, NULL)) { printf("Error: ODP global init failed.\n"); exit(EXIT_FAILURE); } diff --git a/example/time/time_global_test.c b/example/time/time_global_test.c index 317f9a270..6c56d6c6e 100644 --- a/example/time/time_global_test.c +++ b/example/time/time_global_test.c @@ -254,16 +254,25 @@ int main(int argc, char *argv[]) odp_shm_t shm_glbls = ODP_SHM_INVALID; odp_shm_t shm_log = ODP_SHM_INVALID; int log_size, log_enries_num; + odph_helper_options_t helper_options; odph_odpthread_t thread_tbl[MAX_WORKERS]; odp_instance_t instance; + odp_init_t init_param; odph_odpthread_params_t thr_params; - /* let helper collect its own arguments (e.g. --odph_proc) */ + printf("\nODP global time test starts\n"); + + /* Let helper collect its own arguments (e.g. --odph_proc) */ argc = odph_parse_options(argc, argv); + if (odph_options(&helper_options)) { + EXAMPLE_ERR("Error: reading ODP helper options failed.\n"); + exit(EXIT_FAILURE); + } - printf("\nODP global time test starts\n"); + odp_init_param_init(&init_param); + init_param.mem_model = helper_options.mem_model; - if (odp_init_global(&instance, NULL, NULL)) { + if (odp_init_global(&instance, &init_param, NULL)) { err = 1; EXAMPLE_ERR("ODP global init failed.\n"); goto end; diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c index 689700783..ca3e8ddf5 100644 --- a/example/timer/odp_timer_test.c +++ b/example/timer/odp_timer_test.c @@ -274,9 +274,6 @@ static void parse_args(int argc, char *argv[], test_args_t *args) static const char *shortopts = "+c:r:m:x:p:t:h"; - /* let helper collect its own arguments (e.g. --odph_proc) */ - argc = odph_parse_options(argc, argv); - /* defaults */ odp_timer_capability(ODP_CLOCK_CPU, &timer_capa); @@ -334,6 +331,7 @@ static void parse_args(int argc, char *argv[], test_args_t *args) */ int main(int argc, char *argv[]) { + odph_helper_options_t helper_options; odph_odpthread_t thread_tbl[MAX_WORKERS]; int num_workers; odp_queue_t queue; @@ -345,6 +343,7 @@ int main(int argc, char *argv[]) odp_cpumask_t cpumask; char cpumaskstr[ODP_CPUMASK_STR_SIZE]; odp_instance_t instance; + odp_init_t init_param; odph_odpthread_params_t thr_params; odp_shm_t shm = ODP_SHM_INVALID; test_globals_t *gbls = NULL; @@ -352,7 +351,17 @@ int main(int argc, char *argv[]) printf("\nODP timer example starts\n"); - if (odp_init_global(&instance, NULL, NULL)) { + /* Let helper collect its own arguments (e.g. --odph_proc) */ + argc = odph_parse_options(argc, argv); + if (odph_options(&helper_options)) { + EXAMPLE_ERR("Error: reading ODP helper options failed.\n"); + exit(EXIT_FAILURE); + } + + odp_init_param_init(&init_param); + init_param.mem_model = helper_options.mem_model; + + if (odp_init_global(&instance, &init_param, NULL)) { err = 1; printf("ODP global init failed.\n"); goto err_global; |