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, api-next has been updated via 1ee7da08721452033dd7b0537e62ec1191291120 (commit) via eb9f47e9ce077e089575183abbfe00f2fce2fd41 (commit) via 37bb9253fe0951f6dba10349e4ff472890615006 (commit) via 70cf3e1941797acc0c3f1e2990f4490c249ee1a8 (commit) via 7d457a070d8fd304262f28da9f86712b136ab0c0 (commit) via 5c1c8bca96169bb3ce312b0d5cca39f7d9bc4372 (commit) via 9bdb18d5ee876212bdac3098266a522f7bd25efb (commit) via 044b9ed53fa1845d99f0aee3f402a5dcfed3c16e (commit) via d901665b489d0470af24e757208488011515e0ad (commit) via f36139ea56706df2534a269039b3effca7169234 (commit) from 27b0ca668ec90730f6329185e23a026caf0b9064 (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 1ee7da08721452033dd7b0537e62ec1191291120 Author: Matias Elo matias.elo@nokia.com Date: Mon Oct 15 13:45:30 2018 +0300
linux-gen: shm: remove single_va configuration option
Process mode is now enabled by setting odp_init_global() parameter odp_init_t.mem_model to ODP_MEM_MODEL_PROCESS.
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
diff --git a/config/odp-linux-generic.conf b/config/odp-linux-generic.conf index 4585a896..bca123bc 100644 --- a/config/odp-linux-generic.conf +++ b/config/odp-linux-generic.conf @@ -16,7 +16,7 @@
# Mandatory fields odp_implementation = "linux-generic" -config_file_version = "0.1.3" +config_file_version = "0.1.4"
# Shared memory options shm: { @@ -33,10 +33,6 @@ shm: { # When using process mode threads, this value should be set to 0 # because the current implementation won't work properly otherwise. num_cached_hp = 0 - - # Allocate internal shared memory using a single virtual address space. - # Set to 1 to enable using process mode. - single_va = 0 }
# Pool options diff --git a/platform/linux-generic/odp_ishm.c b/platform/linux-generic/odp_ishm.c index cf37bd9b..4a481397 100644 --- a/platform/linux-generic/odp_ishm.c +++ b/platform/linux-generic/odp_ishm.c @@ -301,15 +301,8 @@ static void hp_init(void) char filename[ISHM_FILENAME_MAXLEN]; char dir[ISHM_FILENAME_MAXLEN]; int count; - int single_va = 0; void *addr;
- if (_odp_libconfig_lookup_ext_int("shm", NULL, "single_va", - &single_va)) { - odp_global_ro.shm_single_va = single_va; - ODP_DBG("Shm single VA: %d\n", odp_global_ro.shm_single_va); - } - if (!_odp_libconfig_lookup_ext_int("shm", NULL, "num_cached_hp", &count)) { return; diff --git a/platform/linux-generic/test/process-mode.conf b/platform/linux-generic/test/process-mode.conf index f631f54b..4bda6933 100644 --- a/platform/linux-generic/test/process-mode.conf +++ b/platform/linux-generic/test/process-mode.conf @@ -1,10 +1,7 @@ # Mandatory fields odp_implementation = "linux-generic" -config_file_version = "0.1.3" +config_file_version = "0.1.4"
# Shared memory options shm: { - # Override default option and allocate internal shms using single - # virtual address space. - single_va = 1 }
commit eb9f47e9ce077e089575183abbfe00f2fce2fd41 Author: Matias Elo matias.elo@nokia.com Date: Mon Oct 15 15:27:11 2018 +0300
validation: use 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
diff --git a/test/common/odp_cunit_common.c b/test/common/odp_cunit_common.c index ed0651ad..7f345fba 100644 --- a/test/common/odp_cunit_common.c +++ b/test/common/odp_cunit_common.c @@ -79,7 +79,18 @@ int odp_cunit_thread_exit(pthrd_arg *arg)
static int tests_global_init(odp_instance_t *inst) { - if (0 != odp_init_global(inst, NULL, NULL)) { + 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; } diff --git a/test/validation/api/atomic/atomic.c b/test/validation/api/atomic/atomic.c index a755aef9..9530df9c 100644 --- a/test/validation/api/atomic/atomic.c +++ b/test/validation/api/atomic/atomic.c @@ -8,6 +8,7 @@
#include <malloc.h> #include <odp_api.h> +#include <odp/helper/odph_api.h> #include <CUnit/Basic.h> #include <odp_cunit_common.h> #include <unistd.h> @@ -554,8 +555,18 @@ static int atomic_init(odp_instance_t *inst) uint32_t workers_count, max_threads; int ret = 0; odp_cpumask_t mask; + odp_init_t init_param; + odph_helper_options_t helper_options;
- if (0 != odp_init_global(inst, NULL, NULL)) { + 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; } diff --git a/test/validation/api/barrier/barrier.c b/test/validation/api/barrier/barrier.c index a3be4be4..806f2486 100644 --- a/test/validation/api/barrier/barrier.c +++ b/test/validation/api/barrier/barrier.c @@ -8,6 +8,7 @@
#include <malloc.h> #include <odp_api.h> +#include <odp/helper/odph_api.h> #include <CUnit/Basic.h> #include <odp_cunit_common.h> #include <unistd.h> @@ -329,8 +330,18 @@ static int barrier_init(odp_instance_t *inst) uint32_t workers_count, max_threads; int ret = 0; odp_cpumask_t mask; + odp_init_t init_param; + odph_helper_options_t helper_options;
- if (0 != odp_init_global(inst, NULL, NULL)) { + 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; } diff --git a/test/validation/api/crypto/odp_crypto_test_inp.c b/test/validation/api/crypto/odp_crypto_test_inp.c index 5b395c2a..e8cc1547 100644 --- a/test/validation/api/crypto/odp_crypto_test_inp.c +++ b/test/validation/api/crypto/odp_crypto_test_inp.c @@ -7,6 +7,7 @@ #include "config.h"
#include <odp_api.h> +#include <odp/helper/odph_api.h> #include <CUnit/Basic.h> #include <odp_cunit_common.h> #include "test_vectors.h" @@ -2029,8 +2030,18 @@ static int crypto_init(odp_instance_t *inst) odp_pool_t pool; odp_queue_t out_queue; odp_pool_capability_t pool_capa; + odp_init_t init_param; + odph_helper_options_t helper_options;
- if (0 != odp_init_global(inst, NULL, NULL)) { + 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; } diff --git a/test/validation/api/ipsec/ipsec.c b/test/validation/api/ipsec/ipsec.c index f10c4c29..f82c561a 100644 --- a/test/validation/api/ipsec/ipsec.c +++ b/test/validation/api/ipsec/ipsec.c @@ -910,8 +910,18 @@ int ipsec_init(odp_instance_t *inst) odp_queue_t out_queue; odp_pool_capability_t pool_capa; odp_pktio_t pktio; + odp_init_t init_param; + odph_helper_options_t helper_options;
- if (0 != odp_init_global(inst, NULL, NULL)) { + 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; } diff --git a/test/validation/api/lock/lock.c b/test/validation/api/lock/lock.c index 67e1e3c8..b8502f01 100644 --- a/test/validation/api/lock/lock.c +++ b/test/validation/api/lock/lock.c @@ -8,6 +8,7 @@
#include <malloc.h> #include <odp_api.h> +#include <odp/helper/odph_api.h> #include <CUnit/Basic.h> #include <odp_cunit_common.h> #include <unistd.h> @@ -1163,8 +1164,18 @@ static int lock_init(odp_instance_t *inst) uint32_t workers_count, max_threads; int ret = 0; odp_cpumask_t mask; + odp_init_t init_param; + odph_helper_options_t helper_options;
- if (0 != odp_init_global(inst, NULL, NULL)) { + 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; } diff --git a/test/validation/api/thread/thread.c b/test/validation/api/thread/thread.c index d977f977..7b40cda6 100644 --- a/test/validation/api/thread/thread.c +++ b/test/validation/api/thread/thread.c @@ -7,6 +7,7 @@ #include "config.h"
#include <odp_api.h> +#include <odp/helper/odph_api.h> #include <odp_cunit_common.h> #include <mask_common.h> #include <test_debug.h> @@ -24,8 +25,18 @@ static global_shared_mem_t *global_mem; static int thread_global_init(odp_instance_t *inst) { odp_shm_t global_shm; + odp_init_t init_param; + odph_helper_options_t helper_options;
- if (0 != odp_init_global(inst, NULL, NULL)) { + 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; } diff --git a/test/validation/api/timer/timer.c b/test/validation/api/timer/timer.c index 968812c8..ab5bc2de 100644 --- a/test/validation/api/timer/timer.c +++ b/test/validation/api/timer/timer.c @@ -61,8 +61,18 @@ static global_shared_mem_t *global_mem; static int timer_global_init(odp_instance_t *inst) { odp_shm_t global_shm; + odp_init_t init_param; + odph_helper_options_t helper_options;
- if (0 != odp_init_global(inst, NULL, NULL)) { + 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; }
commit 37bb9253fe0951f6dba10349e4ff472890615006 Author: Matias Elo matias.elo@nokia.com Date: Fri Oct 12 15:51:07 2018 +0300
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
diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c index b8e1c897..274ffaf4 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 34543cd2..98a89211 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 aff6de0a..1bbf7a00 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 08840d63..ab0fa3c5 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 8daeec4c..f7e7ba53 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 f71ae537..b1c4a79c 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 a67fa180..a0162145 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 317f9a27..6c56d6c6 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 68970078..ca3e8ddf 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;
commit 70cf3e1941797acc0c3f1e2990f4490c249ee1a8 Author: Matias Elo matias.elo@nokia.com Date: Fri Oct 12 16:14:26 2018 +0300
test: performance: 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
diff --git a/platform/linux-generic/test/mmap_vlan_ins/mmap_vlan_ins.c b/platform/linux-generic/test/mmap_vlan_ins/mmap_vlan_ins.c index faa51dad..75ea0a7a 100644 --- a/platform/linux-generic/test/mmap_vlan_ins/mmap_vlan_ins.c +++ b/platform/linux-generic/test/mmap_vlan_ins/mmap_vlan_ins.c @@ -135,14 +135,20 @@ int main(int argc, char **argv) odp_pool_t pool; odp_pool_param_t params; odp_cpumask_t cpumask; + odph_helper_options_t helper_options; odph_odpthread_t thd[MAX_WORKERS]; odp_instance_t instance; + odp_init_t init_param; odph_odpthread_params_t thr_params; odp_shm_t shm; int ret;
- /* let helper collect its own arguments (e.g. --odph_proc) */ + /* 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); + }
if (argc < 3) { printf("Too few arguments (%i).\n" @@ -150,7 +156,10 @@ int main(int argc, char **argv) exit(0); }
- if (odp_init_global(&instance, NULL, NULL)) { + 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); } diff --git a/test/performance/odp_bench_packet.c b/test/performance/odp_bench_packet.c index a4493139..9b779e98 100644 --- a/test/performance/odp_bench_packet.c +++ b/test/performance/odp_bench_packet.c @@ -1315,9 +1315,6 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args)
static const char *shortopts = "b:i:h";
- /* Let helper collect its own arguments (e.g. --odph_proc) */ - argc = odph_parse_options(argc, argv); - appl_args->bench_idx = 0; /* Run all benchmarks */ appl_args->burst_size = TEST_DEF_BURST;
@@ -1511,6 +1508,7 @@ bench_info_t test_suite[] = { */ int main(int argc, char *argv[]) { + odph_helper_options_t helper_options; odph_odpthread_t worker_thread; int cpu; odp_shm_t shm; @@ -1519,11 +1517,22 @@ int main(int argc, char *argv[]) odp_pool_capability_t capa; odp_pool_param_t params; odp_instance_t instance; + odp_init_t init_param; uint32_t pkt_num; uint8_t ret;
+ /* Let helper collect its own arguments (e.g. --odph_proc) */ + argc = odph_parse_options(argc, argv); + if (odph_options(&helper_options)) { + LOG_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)) { LOG_ERR("Error: ODP global init failed.\n"); exit(EXIT_FAILURE); } diff --git a/test/performance/odp_cpu_bench.c b/test/performance/odp_cpu_bench.c index ceabc5b8..852ed308 100644 --- a/test/performance/odp_cpu_bench.c +++ b/test/performance/odp_cpu_bench.c @@ -382,9 +382,6 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args)
static const char *shortopts = "+a:+c:+l:+t:h";
- /* Let helper collect its own arguments (e.g. --odph_proc) */ - argc = odph_parse_options(argc, argv); - appl_args->accuracy = 1; /* Get and print pps stats second */ appl_args->cpu_count = 1; appl_args->lookup_tbl_size = DEF_LOOKUP_TBL_SIZE; @@ -524,6 +521,7 @@ static void gbl_args_init(args_t *args) int main(int argc, char *argv[]) { stats_t *stats[MAX_WORKERS]; + odph_helper_options_t helper_options; odph_odpthread_t thread_tbl[MAX_WORKERS]; odp_cpumask_t cpumask; odp_pool_capability_t pool_capa; @@ -546,6 +544,13 @@ int main(int argc, char *argv[]) int cpu; int ret = 0;
+ /* Let helper collect its own arguments (e.g. --odph_proc) */ + argc = odph_parse_options(argc, argv); + if (odph_options(&helper_options)) { + LOG_ERR("Error: reading ODP helper options failed.\n"); + exit(EXIT_FAILURE); + } + odp_init_param_init(&init);
/* List features not to be used (may optimize performance) */ @@ -555,6 +560,8 @@ int main(int argc, char *argv[]) init.not_used.feat.timer = 1; init.not_used.feat.tm = 1;
+ init.mem_model = helper_options.mem_model; + /* Signal handler has to be registered before global init in case ODP * implementation creates internal threads/processes. */ signal(SIGINT, sig_handler); diff --git a/test/performance/odp_crypto.c b/test/performance/odp_crypto.c index 635b69f7..665268be 100644 --- a/test/performance/odp_crypto.c +++ b/test/performance/odp_crypto.c @@ -1033,20 +1033,32 @@ int main(int argc, char *argv[]) odp_cpumask_t cpumask; char cpumaskstr[ODP_CPUMASK_STR_SIZE]; int num_workers = 1; + odph_helper_options_t helper_options; odph_odpthread_t thr[num_workers]; odp_instance_t instance; + odp_init_t init_param; odp_pool_capability_t pool_capa; odp_crypto_capability_t crypto_capa; uint32_t max_seg_len; unsigned i;
+ /* Let helper collect its own arguments (e.g. --odph_proc) */ + argc = odph_parse_options(argc, argv); + if (odph_options(&helper_options)) { + app_err("Reading ODP helper options failed.\n"); + exit(EXIT_FAILURE); + } + + odp_init_param_init(&init_param); + init_param.mem_model = helper_options.mem_model; + memset(&cargs, 0, sizeof(cargs));
/* Parse and store the application arguments */ parse_args(argc, argv, &cargs);
/* Init ODP before calling anything else */ - if (odp_init_global(&instance, NULL, NULL)) { + if (odp_init_global(&instance, &init_param, NULL)) { app_err("ODP global init failed.\n"); exit(EXIT_FAILURE); } @@ -1197,9 +1209,6 @@ static void parse_args(int argc, char *argv[], crypto_args_t *cargs)
static const char *shortopts = "+a:c:df:hi:m:nl:spr";
- /* let helper collect its own arguments (e.g. --odph_proc) */ - argc = odph_parse_options(argc, argv); - cargs->in_place = 0; cargs->in_flight = 1; cargs->debug_packets = 0; diff --git a/test/performance/odp_ipsec.c b/test/performance/odp_ipsec.c index e5d53931..e388916c 100644 --- a/test/performance/odp_ipsec.c +++ b/test/performance/odp_ipsec.c @@ -936,9 +936,6 @@ static void parse_args(int argc, char *argv[], ipsec_args_t *cargs)
static const char *shortopts = "+a:c:df:hi:m:nl:sptu";
- /* let helper collect its own arguments (e.g. --odph_proc) */ - argc = odph_parse_options(argc, argv); - cargs->in_place = 0; cargs->in_flight = 1; cargs->debug_packets = 0; @@ -1020,20 +1017,32 @@ int main(int argc, char *argv[]) odp_cpumask_t cpumask; char cpumaskstr[ODP_CPUMASK_STR_SIZE]; int num_workers = 1; + odph_helper_options_t helper_options; odph_odpthread_t thr[num_workers]; odp_instance_t instance; + odp_init_t init_param; odp_pool_capability_t capa; odp_ipsec_config_t config; uint32_t max_seg_len; unsigned int i;
+ /* Let helper collect its own arguments (e.g. --odph_proc) */ + argc = odph_parse_options(argc, argv); + if (odph_options(&helper_options)) { + app_err("Reading ODP helper options failed.\n"); + exit(EXIT_FAILURE); + } + + odp_init_param_init(&init_param); + init_param.mem_model = helper_options.mem_model; + memset(&cargs, 0, sizeof(cargs));
/* Parse and store the application arguments */ parse_args(argc, argv, &cargs);
/* Init ODP before calling anything else */ - if (odp_init_global(&instance, NULL, NULL)) { + if (odp_init_global(&instance, &init_param, NULL)) { app_err("ODP global init failed.\n"); exit(EXIT_FAILURE); } diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c index cdd67206..78e3920f 100644 --- a/test/performance/odp_l2fwd.c +++ b/test/performance/odp_l2fwd.c @@ -1184,9 +1184,6 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args)
static const char *shortopts = "+c:+t:+a:i:m:o:r:d:s:e:k:g:vh";
- /* let helper collect its own arguments (e.g. --odph_proc) */ - argc = odph_parse_options(argc, argv); - appl_args->time = 0; /* loop forever if time to run is 0 */ appl_args->accuracy = 1; /* get and print pps stats second */ appl_args->cpu_count = 1; /* use one worker by default */ @@ -1428,6 +1425,7 @@ static void create_groups(int num, odp_schedule_group_t *group) */ int main(int argc, char *argv[]) { + odph_helper_options_t helper_options; odph_odpthread_t thread_tbl[MAX_WORKERS]; odp_pool_t pool; int i; @@ -1449,6 +1447,13 @@ int main(int argc, char *argv[]) odp_pool_capability_t pool_capa; uint32_t pkt_len, pkt_num;
+ /* Let helper collect its own arguments (e.g. --odph_proc) */ + argc = odph_parse_options(argc, argv); + if (odph_options(&helper_options)) { + LOG_ERR("Error: reading ODP helper options failed.\n"); + exit(EXIT_FAILURE); + } + odp_init_param_init(&init);
/* List features not to be used (may optimize performance) */ @@ -1458,6 +1463,8 @@ int main(int argc, char *argv[]) init.not_used.feat.timer = 1; init.not_used.feat.tm = 1;
+ init.mem_model = helper_options.mem_model; + /* Signal handler has to be registered before global init in case ODP * implementation creates internal threads/processes. */ signal(SIGINT, sig_handler); diff --git a/test/performance/odp_pktio_ordered.c b/test/performance/odp_pktio_ordered.c index ce4925f5..15229aeb 100644 --- a/test/performance/odp_pktio_ordered.c +++ b/test/performance/odp_pktio_ordered.c @@ -866,9 +866,6 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args)
static const char *shortopts = "+c:+t:+a:i:m:d:r:f:e:h";
- /* let helper collect its own arguments (e.g. --odph_proc) */ - argc = odph_parse_options(argc, argv); - appl_args->time = 0; /* loop forever if time to run is 0 */ appl_args->accuracy = DEF_STATS_INT; appl_args->cpu_count = 1; /* use one worker by default */ @@ -1060,6 +1057,7 @@ int main(int argc, char *argv[]) { odp_cpumask_t cpumask; odp_instance_t instance; + odp_init_t init_param; odp_pool_t pool; odp_pool_param_t params; odp_shm_t shm; @@ -1067,6 +1065,7 @@ int main(int argc, char *argv[]) odp_schedule_config_t schedule_config; odp_pool_capability_t pool_capa; odph_ethaddr_t new_addr; + odph_helper_options_t helper_options; odph_odpthread_t thread_tbl[MAX_WORKERS]; stats_t *stats; char cpumaskstr[ODP_CPUMASK_STR_SIZE]; @@ -1078,8 +1077,18 @@ int main(int argc, char *argv[]) int in_mode; uint32_t queue_size, pool_size;
+ /* Let helper collect its own arguments (e.g. --odph_proc) */ + argc = odph_parse_options(argc, argv); + if (odph_options(&helper_options)) { + LOG_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)) { LOG_ERR("Error: ODP global init failed.\n"); exit(EXIT_FAILURE); } diff --git a/test/performance/odp_pktio_perf.c b/test/performance/odp_pktio_perf.c index 0e1af0c4..2ed2c352 100644 --- a/test/performance/odp_pktio_perf.c +++ b/test/performance/odp_pktio_perf.c @@ -960,9 +960,6 @@ static void parse_args(int argc, char *argv[], test_args_t *args)
static const char *shortopts = "+c:t:b:pR:l:r:i:d:vh";
- /* let helper collect its own arguments (e.g. --odph_proc) */ - argc = odph_parse_options(argc, argv); - args->cpu_count = 2; args->num_tx_workers = 0; /* defaults to cpu_count+1/2 */ args->tx_batch_len = BATCH_LEN_MAX; @@ -1043,9 +1040,21 @@ int main(int argc, char **argv) int ret; odp_shm_t shm; int max_thrs; + odph_helper_options_t helper_options; odp_instance_t instance; + odp_init_t init_param; + + /* Let helper collect its own arguments (e.g. --odph_proc) */ + argc = odph_parse_options(argc, argv); + if (odph_options(&helper_options)) { + LOG_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, NULL, NULL) != 0) + if (odp_init_global(&instance, &init_param, NULL) != 0) LOG_ABORT("Failed global init.\n");
if (odp_init_local(instance, ODP_THREAD_CONTROL) != 0) diff --git a/test/performance/odp_sched_latency.c b/test/performance/odp_sched_latency.c index c0792fa4..b5be1a16 100644 --- a/test/performance/odp_sched_latency.c +++ b/test/performance/odp_sched_latency.c @@ -549,9 +549,6 @@ static void parse_args(int argc, char *argv[], test_args_t *args)
static const char *shortopts = "+c:s:l:t:m:n:o:p:rh";
- /* Let helper collect its own arguments (e.g. --odph_proc) */ - argc = odph_parse_options(argc, argv); - args->cpu_count = 1; args->sync_type = ODP_SCHED_SYNC_PARALLEL; args->sample_per_prio = SAMPLE_EVENT_PER_PRIO; @@ -637,6 +634,8 @@ static void parse_args(int argc, char *argv[], test_args_t *args) int main(int argc, char *argv[]) { odp_instance_t instance; + odp_init_t init_param; + odph_helper_options_t helper_options; odph_odpthread_t *thread_tbl; odph_odpthread_params_t thr_params; odp_cpumask_t cpumask; @@ -654,11 +653,21 @@ int main(int argc, char *argv[])
printf("\nODP scheduling latency benchmark starts\n\n");
+ /* Let helper collect its own arguments (e.g. --odph_proc) */ + argc = odph_parse_options(argc, argv); + if (odph_options(&helper_options)) { + LOG_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; + memset(&args, 0, sizeof(args)); parse_args(argc, argv, &args);
/* ODP global init */ - if (odp_init_global(&instance, NULL, NULL)) { + if (odp_init_global(&instance, &init_param, NULL)) { LOG_ERR("ODP global init failed.\n"); return -1; } diff --git a/test/performance/odp_sched_pktio.c b/test/performance/odp_sched_pktio.c index 42f879eb..239e12e9 100644 --- a/test/performance/odp_sched_pktio.c +++ b/test/performance/odp_sched_pktio.c @@ -580,9 +580,6 @@ static int parse_options(int argc, char *argv[], test_options_t *test_options) test_options->burst_size = 32; test_options->pipe_queue_size = 256;
- /* let helper collect its own arguments (e.g. --odph_proc) */ - argc = odph_parse_options(argc, argv); - while (1) { opt = getopt_long(argc, argv, shortopts, longopts, &long_index);
@@ -1430,10 +1427,18 @@ int main(int argc, char *argv[]) odp_init_t init; odp_shm_t shm; odp_time_t t1, t2; + odph_helper_options_t helper_options; odph_odpthread_t thread[MAX_WORKERS]; test_options_t test_options; int ret = 0;
+ /* 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); + } + signal(SIGINT, sig_handler);
if (parse_options(argc, argv, &test_options)) @@ -1450,6 +1455,8 @@ int main(int argc, char *argv[]) if (test_options.timeout_us) init.not_used.feat.timer = 0;
+ init.mem_model = helper_options.mem_model; + /* Init ODP before calling anything else */ if (odp_init_global(&instance, &init, NULL)) { printf("Error: Global init failed.\n"); diff --git a/test/performance/odp_scheduling.c b/test/performance/odp_scheduling.c index f17e1aed..afe5b73b 100644 --- a/test/performance/odp_scheduling.c +++ b/test/performance/odp_scheduling.c @@ -762,9 +762,6 @@ static void parse_args(int argc, char *argv[], test_args_t *args)
static const char *shortopts = "+c:fh";
- /* let helper collect its own arguments (e.g. --odph_proc) */ - argc = odph_parse_options(argc, argv); - args->cpu_count = 1; /* use one worker by default */
while (1) { @@ -798,6 +795,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; test_args_t args; int num_workers; @@ -811,6 +809,7 @@ int main(int argc, char *argv[]) odp_pool_param_t params; int ret = 0; odp_instance_t instance; + odp_init_t init_param; odph_odpthread_params_t thr_params; odp_queue_capability_t capa; odp_pool_capability_t pool_capa; @@ -819,11 +818,21 @@ int main(int argc, char *argv[])
printf("\nODP example starts\n\n");
+ /* Let helper collect its own arguments (e.g. --odph_proc) */ + argc = odph_parse_options(argc, argv); + if (odph_options(&helper_options)) { + LOG_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; + memset(&args, 0, sizeof(args)); parse_args(argc, argv, &args);
/* ODP global init */ - if (odp_init_global(&instance, NULL, NULL)) { + if (odp_init_global(&instance, &init_param, NULL)) { LOG_ERR("ODP global init failed.\n"); return -1; }
commit 7d457a070d8fd304262f28da9f86712b136ab0c0 Author: Matias Elo matias.elo@nokia.com Date: Fri Oct 12 13:02:05 2018 +0300
helper: test: add test for new odph_options() function
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
diff --git a/helper/test/odpthreads.c b/helper/test/odpthreads.c index ad48ec2d..55db37e0 100644 --- a/helper/test/odpthreads.c +++ b/helper/test/odpthreads.c @@ -64,18 +64,27 @@ static int worker_fn(void *arg ODPH_UNUSED) /* Create additional dataplane opdthreads */ int main(int argc, char *argv[]) { + odph_helper_options_t helper_options; odph_odpthread_params_t thr_params; odph_odpthread_t thread_tbl[NUMBER_WORKERS]; odp_cpumask_t cpu_mask; + odp_init_t init_param; int num_workers; int cpu, affinity; int ret; char cpumaskstr[ODP_CPUMASK_STR_SIZE];
- /* let helper collect its own arguments (e.g. --odph_proc) */ + /* Let helper collect its own arguments (e.g. --odph_proc) */ argc = odph_parse_options(argc, argv); + if (odph_options(&helper_options)) { + ODPH_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(&odp_instance, NULL, NULL)) { + if (odp_init_global(&odp_instance, &init_param, NULL)) { ODPH_ERR("Error: ODP global init failed.\n"); exit(EXIT_FAILURE); }
commit 5c1c8bca96169bb3ce312b0d5cca39f7d9bc4372 Author: Matias Elo matias.elo@nokia.com Date: Fri Oct 12 10:43:34 2018 +0300
helper: threads: add odph_options() getter function
Add function for reading parsed linux 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
diff --git a/helper/include/odp/helper/threads.h b/helper/include/odp/helper/threads.h index f4e8a785..6cee2522 100644 --- a/helper/include/odp/helper/threads.h +++ b/helper/include/odp/helper/threads.h @@ -88,6 +88,11 @@ typedef struct { }; } odph_odpthread_t;
+/** Linux helper options */ +typedef struct { + odp_mem_model_t mem_model; /**< Process or thread */ +} odph_helper_options_t; + /** * Creates and launches odpthreads (as linux threads or processes) * @@ -153,6 +158,18 @@ int odph_odpthread_getaffinity(void); */ int odph_parse_options(int argc, char *argv[]);
+/** + * Get linux helper options + * + * Return used ODP helper options. odph_parse_options() must be called before + * using this function. + * + * @param[out] options ODP helper options + * + * @return 0 on success, -1 on failure + */ +int odph_options(odph_helper_options_t *options); + /** * @} */ diff --git a/helper/threads.c b/helper/threads.c index 1e03ce02..01bc33ea 100644 --- a/helper/threads.c +++ b/helper/threads.c @@ -23,9 +23,7 @@
#define FAILED_CPU -1
-static struct { - int proc; /* true when process mode is required, false otherwise */ -} helper_options; +static odph_helper_options_t helper_options;
/* * wrapper for odpthreads, either implemented as linux threads or processes. @@ -181,7 +179,7 @@ int odph_odpthreads_create(odph_odpthread_t *thread_tbl,
cpu = odp_cpumask_first(mask); for (i = 0; i < num; i++) { - if (!helper_options.proc) { + if (helper_options.mem_model == ODP_MEM_MODEL_THREAD) { if (odph_linux_thread_create(&thread_tbl[i], cpu, thr_params)) @@ -330,19 +328,19 @@ int odph_parse_options(int argc, char *argv[]) char *env; int i, j;
- helper_options.proc = 0; + helper_options.mem_model = ODP_MEM_MODEL_THREAD;
/* Enable process mode using environment variable. Setting environment * variable is easier for CI testing compared to command line * argument. */ env = getenv("ODPH_PROC_MODE"); if (env && atoi(env)) - helper_options.proc = 1; + helper_options.mem_model = ODP_MEM_MODEL_PROCESS;
/* Find and remove option */ for (i = 0; i < argc;) { if (strcmp(argv[i], "--odph_proc") == 0) { - helper_options.proc = 1; + helper_options.mem_model = ODP_MEM_MODEL_PROCESS;
for (j = i; j < argc - 1; j++) argv[j] = argv[j + 1]; @@ -356,3 +354,12 @@ int odph_parse_options(int argc, char *argv[])
return argc; } + +int odph_options(odph_helper_options_t *options) +{ + memset(options, 0, sizeof(odph_helper_options_t)); + + options->mem_model = helper_options.mem_model; + + return 0; +}
commit 9bdb18d5ee876212bdac3098266a522f7bd25efb Author: Matias Elo matias.elo@nokia.com Date: Thu Oct 11 17:00:27 2018 +0300
helper: threads: replace odph_linux_thread_type_t with odp_mem_model_t
Replace enum odph_odpthread_linuxtype_t with odp_mem_model_t.
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
diff --git a/helper/include/odp/helper/threads.h b/helper/include/odp/helper/threads.h index 9d03c719..f4e8a785 100644 --- a/helper/include/odp/helper/threads.h +++ b/helper/include/odp/helper/threads.h @@ -54,13 +54,6 @@ typedef struct { int status; /**< Process state change status */ } odph_linux_process_t;
-/** odpthread linux type: whether an ODP thread is a linux thread or process */ -typedef enum odph_odpthread_linuxtype_e { - ODPTHREAD_NOT_STARTED = 0, - ODPTHREAD_PROCESS, - ODPTHREAD_PTHREAD -} odph_odpthread_linuxtype_t; - /** odpthread parameters for odp threads (pthreads and processes) */ typedef struct { int (*start)(void *); /**< Thread entry point function */ @@ -71,7 +64,7 @@ typedef struct {
/** The odpthread starting arguments, used both in process or thread mode */ typedef struct { - odph_odpthread_linuxtype_t linuxtype; /**< process or pthread */ + odp_mem_model_t mem_model; /**< process or thread */ odph_odpthread_params_t thr_params; /**< odpthread start parameters */ } odph_odpthread_start_args_t;
diff --git a/helper/threads.c b/helper/threads.c index f1f63875..1e03ce02 100644 --- a/helper/threads.c +++ b/helper/threads.c @@ -21,6 +21,8 @@ #include <odp/helper/threads.h> #include "odph_debug.h"
+#define FAILED_CPU -1 + static struct { int proc; /* true when process mode is required, false otherwise */ } helper_options; @@ -42,7 +44,7 @@ static void *_odph_thread_run_start_routine(void *arg) /* ODP thread local init */ if (odp_init_local(thr_params->instance, thr_params->thr_type)) { ODPH_ERR("Local init failed\n"); - if (start_args->linuxtype == ODPTHREAD_PROCESS) + if (start_args->mem_model == ODP_MEM_MODEL_PROCESS) _exit(EXIT_FAILURE); return (void *)-1; } @@ -50,7 +52,7 @@ static void *_odph_thread_run_start_routine(void *arg) ODPH_DBG("helper: ODP %s thread started as linux %s. (pid=%d)\n", thr_params->thr_type == ODP_THREAD_WORKER ? "worker" : "control", - (start_args->linuxtype == ODPTHREAD_PTHREAD) ? + (start_args->mem_model == ODP_MEM_MODEL_THREAD) ? "pthread" : "process", (int)getpid());
@@ -61,7 +63,7 @@ static void *_odph_thread_run_start_routine(void *arg) ODPH_ERR("Local term failed\n");
/* for process implementation of odp threads, just return status... */ - if (start_args->linuxtype == ODPTHREAD_PROCESS) + if (start_args->mem_model == ODP_MEM_MODEL_PROCESS) _exit(status);
/* threads implementation return void* pointers: cast status to that. */ @@ -81,14 +83,14 @@ static int _odph_linux_process_create(odph_odpthread_t *thread_tbl, CPU_ZERO(&cpu_set); CPU_SET(cpu, &cpu_set);
- thread_tbl->start_args.thr_params = *thr_params; /* copy */ - thread_tbl->start_args.linuxtype = ODPTHREAD_PROCESS; + thread_tbl->start_args.thr_params = *thr_params; /* copy */ + thread_tbl->start_args.mem_model = ODP_MEM_MODEL_PROCESS; thread_tbl->cpu = cpu;
pid = fork(); if (pid < 0) { ODPH_ERR("fork() failed\n"); - thread_tbl->start_args.linuxtype = ODPTHREAD_NOT_STARTED; + thread_tbl->cpu = FAILED_CPU; return -1; }
@@ -136,8 +138,8 @@ static int odph_linux_thread_create(odph_odpthread_t *thread_tbl, pthread_attr_setaffinity_np(&thread_tbl->thread.attr, sizeof(cpu_set_t), &cpu_set);
- thread_tbl->start_args.thr_params = *thr_params; /* copy */ - thread_tbl->start_args.linuxtype = ODPTHREAD_PTHREAD; + thread_tbl->start_args.thr_params = *thr_params; /* copy */ + thread_tbl->start_args.mem_model = ODP_MEM_MODEL_THREAD;
ret = pthread_create(&thread_tbl->thread.thread_id, &thread_tbl->thread.attr, @@ -145,7 +147,7 @@ static int odph_linux_thread_create(odph_odpthread_t *thread_tbl, &thread_tbl->start_args); if (ret != 0) { ODPH_ERR("Failed to start thread on cpu #%d\n", cpu); - thread_tbl->start_args.linuxtype = ODPTHREAD_NOT_STARTED; + thread_tbl->cpu = FAILED_CPU; return ret; }
@@ -215,9 +217,13 @@ int odph_odpthreads_join(odph_odpthread_t *thread_tbl)
/* joins linux threads or wait for processes */ do { + if (thread_tbl[i].cpu == FAILED_CPU) { + ODPH_DBG("ODP thread %d not started.\n", i); + continue; + } /* pthreads: */ - switch (thread_tbl[i].start_args.linuxtype) { - case ODPTHREAD_PTHREAD: + if (thread_tbl[i].start_args.mem_model == + ODP_MEM_MODEL_THREAD) { /* Wait thread to exit */ ret = pthread_join(thread_tbl[i].thread.thread_id, &thread_ret); @@ -234,10 +240,7 @@ int odph_odpthreads_join(odph_odpthread_t *thread_tbl) } } pthread_attr_destroy(&thread_tbl[i].thread.attr); - break; - - case ODPTHREAD_PROCESS: - + } else { /* processes: */ pid = waitpid(thread_tbl[i].proc.pid, &status, 0);
@@ -263,16 +266,7 @@ int odph_odpthreads_join(odph_odpthread_t *thread_tbl) signo, strsignal(signo), (int)pid); retval = -1; } - break; - - case ODPTHREAD_NOT_STARTED: - ODPH_DBG("No join done on not started ODPthread.\n"); - break; - default: - ODPH_DBG("Invalid case statement value!\n"); - break; } - } while (!thread_tbl[i++].last);
return (retval < 0) ? retval : terminated;
commit 044b9ed53fa1845d99f0aee3f402a5dcfed3c16e Author: Matias Elo matias.elo@nokia.com Date: Fri Oct 12 13:40:33 2018 +0300
validation: init: add test for odp_init_t.mem_model
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
diff --git a/test/validation/api/init/init_main_ok.c b/test/validation/api/init/init_main_ok.c index a97db8e7..651989ae 100644 --- a/test/validation/api/init/init_main_ok.c +++ b/test/validation/api/init/init_main_ok.c @@ -14,8 +14,12 @@ static void init_test_odp_init_global(void) { int status; odp_instance_t instance; + odp_init_t init_data;
- status = odp_init_global(&instance, NULL, NULL); + odp_init_param_init(&init_data); + init_data.mem_model = ODP_MEM_MODEL_THREAD; + + status = odp_init_global(&instance, &init_data, NULL); CU_ASSERT_FATAL(status == 0);
status = odp_term_global(instance);
commit d901665b489d0470af24e757208488011515e0ad Author: Matias Elo matias.elo@nokia.com Date: Fri Oct 12 13:07:29 2018 +0300
linux-gen: init: use new odp_init_t.mem_model parameter
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
diff --git a/platform/linux-generic/odp_init.c b/platform/linux-generic/odp_init.c index 0f7e0df2..98b46fca 100644 --- a/platform/linux-generic/odp_init.c +++ b/platform/linux-generic/odp_init.c @@ -274,6 +274,8 @@ int odp_init_global(odp_instance_t *instance, odp_global_ro.log_fn = params->log_fn; if (params->abort_fn != NULL) odp_global_ro.abort_fn = params->abort_fn; + if (params->mem_model == ODP_MEM_MODEL_PROCESS) + odp_global_ro.shm_single_va = 1; }
if (_odp_libconfig_init_global()) {
commit f36139ea56706df2534a269039b3effca7169234 Author: Matias Elo matias.elo@nokia.com Date: Fri Oct 12 11:08:34 2018 +0300
api: init: add new mem_model member to odp_init_t
Add new odp_mem_model_t enum for configuring application memory model. This enables an application to operate in process mode without the need to modify ODP configuration file.
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
diff --git a/include/odp/api/spec/init.h b/include/odp/api/spec/init.h index ee33e7cd..c37af464 100644 --- a/include/odp/api/spec/init.h +++ b/include/odp/api/spec/init.h @@ -106,6 +106,32 @@ typedef int (*odp_log_func_t)(odp_log_level_t level, const char *fmt, ...); /** Replaceable abort function */ typedef void (*odp_abort_func_t)(void) ODP_NORETURN;
+/** + * Application memory model + */ +typedef enum { + /** Thread memory model: by default all memory is shareable between + * threads. + * + * Within a single ODP instance all ODP handles and pointers to ODP + * allocated data may be shared amongst threads independent of data + * allocation time (e.g. before or after thread creation). */ + ODP_MEM_MODEL_THREAD = 0, + + /** Process memory model: by default all memory is not shareable between + * processes. + * + * Within a single ODP instance all ODP handles and pointers to ODP + * allocated data (excluding non-single VA SHM blocks) may be shared + * amongst processes independent of data allocation time (e.g. before + * or after fork). + * + * @see ODP_SHM_SINGLE_VA + */ + ODP_MEM_MODEL_PROCESS + +} odp_mem_model_t; + /** * Global initialization parameters * @@ -172,6 +198,12 @@ typedef struct odp_init_t { */ odp_feature_t not_used;
+ /** Application memory model. The main application thread has to call + * odp_init_global() and odp_init_local() before creating threads that + * share ODP data. The default value is ODP_MEM_MODEL_THREAD. + */ + odp_mem_model_t mem_model; + /** Shared memory parameters */ struct { /** Maximum memory usage in bytes. This is the maximum
-----------------------------------------------------------------------
Summary of changes: config/odp-linux-generic.conf | 6 +-- example/classifier/odp_classifier.c | 17 ++++-- example/generator/odp_generator.c | 17 ++++-- example/ipsec/odp_ipsec.c | 17 ++++-- example/ipsec_api/odp_ipsec.c | 17 ++++-- example/l2fwd_simple/odp_l2fwd_simple.c | 17 ++++-- example/packet/odp_pktio.c | 17 ++++-- example/switch/odp_switch.c | 17 ++++-- example/time/time_global_test.c | 15 ++++-- example/timer/odp_timer_test.c | 17 ++++-- helper/include/odp/helper/threads.h | 26 ++++++--- helper/test/odpthreads.c | 13 ++++- helper/threads.c | 63 +++++++++++----------- include/odp/api/spec/init.h | 32 +++++++++++ platform/linux-generic/odp_init.c | 2 + platform/linux-generic/odp_ishm.c | 7 --- .../test/mmap_vlan_ins/mmap_vlan_ins.c | 13 ++++- platform/linux-generic/test/process-mode.conf | 5 +- test/common/odp_cunit_common.c | 13 ++++- test/performance/odp_bench_packet.c | 17 ++++-- test/performance/odp_cpu_bench.c | 13 +++-- test/performance/odp_crypto.c | 17 ++++-- test/performance/odp_ipsec.c | 17 ++++-- test/performance/odp_l2fwd.c | 13 +++-- test/performance/odp_pktio_ordered.c | 17 ++++-- test/performance/odp_pktio_perf.c | 17 ++++-- test/performance/odp_sched_latency.c | 17 ++++-- test/performance/odp_sched_pktio.c | 13 +++-- test/performance/odp_scheduling.c | 17 ++++-- test/validation/api/atomic/atomic.c | 13 ++++- test/validation/api/barrier/barrier.c | 13 ++++- test/validation/api/crypto/odp_crypto_test_inp.c | 13 ++++- test/validation/api/init/init_main_ok.c | 6 ++- test/validation/api/ipsec/ipsec.c | 12 ++++- test/validation/api/lock/lock.c | 13 ++++- test/validation/api/thread/thread.c | 13 ++++- test/validation/api/timer/timer.c | 12 ++++- 37 files changed, 444 insertions(+), 140 deletions(-)
hooks/post-receive