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 55aa86ea0804385395b16f990956e11660c0d8ab (commit) via d4633c8ab77e6c05ad71b6edb92e13c0b8d9ef16 (commit) via 293f76cb2582c4aef7d246c953c3a9ceb0607e87 (commit) via 069c761cc6bd07a05791b72f88bf94c4c7d2aa83 (commit) via 44962738f4d72ac8c969ed48775f869674f080cb (commit) via c4f4dbcb0c224e65244112c1d918c7e256b2d539 (commit) via bab44af796bbacb6945de590c8dbc1055d45bd5a (commit) via f22c4bf1bf192a2929b3eeae0de889e13feaaeba (commit) via e3f8c24f860f9edf8a5abb6703c3ab93e53a5fcc (commit) via 6a80556e88763be7dbbdf0eda195d68444cbe683 (commit) via a51eaeca2eac68d65ab89a1417b98d0225ebf86a (commit) via 0e1e2f891bd6d68e71a8ca6475dea6a2217a95a4 (commit) via 2e927d35cb368611d2684caee633dbff733cebe5 (commit) from 9dced3ede96b81f883172bad827054bd796c13b4 (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 55aa86ea0804385395b16f990956e11660c0d8ab Author: Matias Elo matias.elo@nokia.com Date: Tue Apr 30 15:18:22 2019 +0300
validation: ipsec: check pktio device level inline support
The inline tests would fail if the test interface type didn't support inline IPsec processing. Check pktio level inline IPsec support before running tests.
Signed-off-by: Matias Elo matias.elo@nokia.com Reviewed-by: Petri Savolainen petri.savolainen@nokia.com
diff --git a/test/validation/api/ipsec/ipsec.c b/test/validation/api/ipsec/ipsec.c index f82c561a0..31776bd29 100644 --- a/test/validation/api/ipsec/ipsec.c +++ b/test/validation/api/ipsec/ipsec.c @@ -1,4 +1,5 @@ /* Copyright (c) 2017-2018, Linaro Limited + * Copyright (c) 2019, Nokia * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause @@ -149,6 +150,13 @@ int ipsec_check(odp_bool_t ah, ODP_SUPPORT_NO == capa.op_mode_inline_out)) return ODP_TEST_INACTIVE;
+ /* suite_context.pktio is set to ODP_PKTIO_INVALID in ipsec_suite_init() + * if the pktio device doesn't support inline IPsec processing. */ + if (suite_context.pktio == ODP_PKTIO_INVALID && + (ODP_IPSEC_OP_MODE_INLINE == suite_context.inbound_op_mode || + ODP_IPSEC_OP_MODE_INLINE == suite_context.outbound_op_mode)) + return ODP_TEST_INACTIVE; + if (ah && (ODP_SUPPORT_NO == capa.proto_ah)) return ODP_TEST_INACTIVE;
commit d4633c8ab77e6c05ad71b6edb92e13c0b8d9ef16 Author: Petri Savolainen petri.savolainen@nokia.com Date: Tue May 7 14:42:53 2019 +0300
test: scheduling: use new thread helpers
Change to use the new thread create and join helpers.
Signed-off-by: Petri Savolainen petri.savolainen@nokia.com Reviewed-by: Matias Elo matias.elo@nokia.com Reviewed-by: Stanislaw Kardach skardach@marvell.com
diff --git a/test/performance/odp_scheduling.c b/test/performance/odp_scheduling.c index afe5b73b1..9b9981a44 100644 --- a/test/performance/odp_scheduling.c +++ b/test/performance/odp_scheduling.c @@ -796,7 +796,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; + odph_thread_t *thread_tbl; test_args_t args; int num_workers; odp_cpumask_t cpumask; @@ -810,7 +810,8 @@ int main(int argc, char *argv[]) int ret = 0; odp_instance_t instance; odp_init_t init_param; - odph_odpthread_params_t thr_params; + odph_thread_common_param_t thr_common; + odph_thread_param_t thr_param; odp_queue_capability_t capa; odp_pool_capability_t pool_capa; odp_schedule_config_t schedule_config; @@ -857,7 +858,7 @@ int main(int argc, char *argv[]) printf("first CPU: %i\n", odp_cpumask_first(&cpumask)); printf("cpu mask: %s\n", cpumaskstr);
- thread_tbl = calloc(sizeof(odph_odpthread_t), num_workers); + thread_tbl = calloc(sizeof(odph_thread_t), num_workers); if (!thread_tbl) { LOG_ERR("no memory for thread_tbl\n"); return -1; @@ -997,15 +998,21 @@ int main(int argc, char *argv[]) globals->first_thr = -1;
/* Create and launch worker threads */ - memset(&thr_params, 0, sizeof(thr_params)); - thr_params.thr_type = ODP_THREAD_WORKER; - thr_params.instance = instance; - thr_params.start = run_thread; - thr_params.arg = NULL; - odph_odpthreads_create(thread_tbl, &cpumask, &thr_params); + memset(&thr_common, 0, sizeof(thr_common)); + memset(&thr_param, 0, sizeof(thr_param)); + + thr_param.thr_type = ODP_THREAD_WORKER; + thr_param.start = run_thread; + thr_param.arg = NULL; + + thr_common.instance = instance; + thr_common.cpumask = &cpumask; + thr_common.share_param = 1; + + odph_thread_create(thread_tbl, &thr_common, &thr_param, num_workers);
/* Wait for worker threads to terminate */ - odph_odpthreads_join(thread_tbl); + odph_thread_join(thread_tbl, num_workers); free(thread_tbl);
printf("ODP example complete\n\n");
commit 293f76cb2582c4aef7d246c953c3a9ceb0607e87 Author: Petri Savolainen petri.savolainen@nokia.com Date: Tue May 7 14:36:09 2019 +0300
example: time: use new thread helpers
Change to use the new thread create and join helpers.
Signed-off-by: Petri Savolainen petri.savolainen@nokia.com Reviewed-by: Matias Elo matias.elo@nokia.com Reviewed-by: Stanislaw Kardach skardach@marvell.com
diff --git a/example/time/time_global_test.c b/example/time/time_global_test.c index 6c56d6c6e..0c4b5286c 100644 --- a/example/time/time_global_test.c +++ b/example/time/time_global_test.c @@ -255,10 +255,11 @@ int main(int argc, char *argv[]) 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]; + odph_thread_t thread_tbl[MAX_WORKERS]; odp_instance_t instance; odp_init_t init_param; - odph_odpthread_params_t thr_params; + odph_thread_common_param_t thr_common; + odph_thread_param_t thr_param;
printf("\nODP global time test starts\n");
@@ -330,17 +331,22 @@ int main(int argc, char *argv[]) goto err; }
- memset(&thr_params, 0, sizeof(thr_params)); - thr_params.start = run_thread; - thr_params.arg = gbls; - thr_params.thr_type = ODP_THREAD_WORKER; - thr_params.instance = instance; + memset(&thr_common, 0, sizeof(thr_common)); + memset(&thr_param, 0, sizeof(thr_param)); + + thr_param.start = run_thread; + thr_param.arg = gbls; + thr_param.thr_type = ODP_THREAD_WORKER; + + thr_common.instance = instance; + thr_common.cpumask = &cpumask; + thr_common.share_param = 1;
/* Create and launch worker threads */ - odph_odpthreads_create(thread_tbl, &cpumask, &thr_params); + odph_thread_create(thread_tbl, &thr_common, &thr_param, num_workers);
/* Wait for worker threads to exit */ - odph_odpthreads_join(thread_tbl); + odph_thread_join(thread_tbl, num_workers);
print_log(gbls);
commit 069c761cc6bd07a05791b72f88bf94c4c7d2aa83 Author: Petri Savolainen petri.savolainen@nokia.com Date: Tue May 7 14:23:13 2019 +0300
example: generator: use new thread helpers
Change to use the new thread create and join helpers.
Signed-off-by: Petri Savolainen petri.savolainen@nokia.com Reviewed-by: Matias Elo matias.elo@nokia.com Reviewed-by: Stanislaw Kardach skardach@marvell.com
diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index 482927024..313305f01 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -1100,7 +1100,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]; + odph_thread_t thread_tbl[MAX_WORKERS]; odp_pool_t pool; int num_workers; unsigned num_rx_queues, num_tx_queues; @@ -1112,7 +1112,8 @@ int main(int argc, char *argv[]) interface_t *ifs; odp_instance_t instance; odp_init_t init_param; - odph_odpthread_params_t thr_params; + odph_thread_common_param_t thr_common; + odph_thread_param_t thr_param;
/* Signal handler has to be registered before global init in case ODP * implementation creates internal threads/processes. */ @@ -1253,9 +1254,11 @@ int main(int argc, char *argv[]) memset(thread_tbl, 0, sizeof(thread_tbl));
/* Init threads params */ - memset(&thr_params, 0, sizeof(thr_params)); - thr_params.thr_type = ODP_THREAD_WORKER; - thr_params.instance = instance; + memset(&thr_param, 0, sizeof(thr_param)); + thr_param.thr_type = ODP_THREAD_WORKER; + + memset(&thr_common, 0, sizeof(thr_common)); + thr_common.instance = instance;
/* num workers + print thread */ odp_barrier_init(&args->barrier, num_workers + 1); @@ -1275,17 +1278,17 @@ int main(int argc, char *argv[]) thr_args->pool = pool; thr_args->mode = args->appl.mode;
- memset(&thr_params, 0, sizeof(thr_params)); if (args->appl.sched) - thr_params.start = gen_recv_thread; + thr_param.start = gen_recv_thread; else - thr_params.start = gen_recv_direct_thread; - thr_params.arg = thr_args; - thr_params.thr_type = ODP_THREAD_WORKER; - thr_params.instance = instance; + thr_param.start = gen_recv_direct_thread; + + thr_param.arg = thr_args;
- odph_odpthreads_create(&thread_tbl[PING_THR_RX], - &cpu_mask, &thr_params); + thr_common.cpumask = &cpu_mask; + + odph_thread_create(&thread_tbl[PING_THR_RX], &thr_common, + &thr_param, 1);
thr_args = &args->thread[PING_THR_TX]; thr_args->tx.pktout = ifs[0].pktout[0]; @@ -1296,11 +1299,11 @@ int main(int argc, char *argv[]) odp_cpumask_zero(&cpu_mask); odp_cpumask_set(&cpu_mask, cpu_next);
- thr_params.start = gen_send_thread; - thr_params.arg = thr_args; + thr_param.start = gen_send_thread; + thr_param.arg = thr_args;
- odph_odpthreads_create(&thread_tbl[PING_THR_TX], - &cpu_mask, &thr_params); + odph_thread_create(&thread_tbl[PING_THR_TX], &thr_common, + &thr_param, 1);
} else { int cpu = odp_cpumask_first(&cpumask); @@ -1381,11 +1384,13 @@ int main(int argc, char *argv[]) odp_cpumask_zero(&thd_mask); odp_cpumask_set(&thd_mask, cpu);
- thr_params.start = thr_run_func; - thr_params.arg = &args->thread[i]; + thr_param.start = thr_run_func; + thr_param.arg = &args->thread[i]; + + thr_common.cpumask = &thd_mask;
- odph_odpthreads_create(&thread_tbl[i], - &thd_mask, &thr_params); + odph_thread_create(&thread_tbl[i], &thr_common, + &thr_param, 1); cpu = odp_cpumask_next(&cpumask, cpu); } } @@ -1393,8 +1398,7 @@ int main(int argc, char *argv[]) print_global_stats(num_workers);
/* Master thread waits for other threads to exit */ - for (i = 0; i < num_workers; ++i) - odph_odpthreads_join(&thread_tbl[i]); + odph_thread_join(thread_tbl, num_workers);
for (i = 0; i < args->appl.if_count; ++i) odp_pktio_stop(ifs[i].pktio);
commit 44962738f4d72ac8c969ed48775f869674f080cb Author: Petri Savolainen petri.savolainen@nokia.com Date: Tue May 7 14:01:19 2019 +0300
example: classifier: use new thread helpers
Change to use the new thread create and join helpers.
Signed-off-by: Petri Savolainen petri.savolainen@nokia.com Reviewed-by: Matias Elo matias.elo@nokia.com Reviewed-by: Stanislaw Kardach skardach@marvell.com
diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c index 274ffaf41..a6c959a7f 100644 --- a/example/classifier/odp_classifier.c +++ b/example/classifier/odp_classifier.c @@ -469,7 +469,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]; + odph_thread_t thread_tbl[MAX_WORKERS]; odp_pool_t pool; int num_workers; int i; @@ -483,7 +483,8 @@ int main(int argc, char *argv[]) int ret; odp_instance_t instance; odp_init_t init_param; - odph_odpthread_params_t thr_params; + odph_thread_common_param_t thr_common; + odph_thread_param_t thr_param;
/* Let helper collect its own arguments (e.g. --odph_proc) */ argc = odph_parse_options(argc, argv); @@ -577,19 +578,24 @@ int main(int argc, char *argv[])
/* Create and init worker threads */ memset(thread_tbl, 0, sizeof(thread_tbl)); + memset(&thr_common, 0, sizeof(thr_common)); + memset(&thr_param, 0, sizeof(thr_param));
- memset(&thr_params, 0, sizeof(thr_params)); - thr_params.start = pktio_receive_thread; - thr_params.arg = args; - thr_params.thr_type = ODP_THREAD_WORKER; - thr_params.instance = instance; - odph_odpthreads_create(thread_tbl, &cpumask, &thr_params); + thr_param.start = pktio_receive_thread; + thr_param.arg = args; + thr_param.thr_type = ODP_THREAD_WORKER; + + thr_common.instance = instance; + thr_common.cpumask = &cpumask; + thr_common.share_param = 1; + + odph_thread_create(thread_tbl, &thr_common, &thr_param, num_workers);
print_cls_statistics(args);
odp_pktio_stop(pktio); args->shutdown = 1; - odph_odpthreads_join(thread_tbl); + odph_thread_join(thread_tbl, num_workers);
for (i = 0; i < args->policy_count; i++) { if ((i != args->policy_count - 1) &&
commit c4f4dbcb0c224e65244112c1d918c7e256b2d539 Author: Petri Savolainen petri.savolainen@nokia.com Date: Mon May 6 17:07:43 2019 +0300
example: simple_pipeline: use new thread helpers
Change to use the new thread create and join helpers.
Signed-off-by: Petri Savolainen petri.savolainen@nokia.com Reviewed-by: Matias Elo matias.elo@nokia.com Reviewed-by: Stanislaw Kardach skardach@marvell.com
diff --git a/example/simple_pipeline/odp_simple_pipeline.c b/example/simple_pipeline/odp_simple_pipeline.c index a8a548e65..9beb8a78d 100644 --- a/example/simple_pipeline/odp_simple_pipeline.c +++ b/example/simple_pipeline/odp_simple_pipeline.c @@ -690,15 +690,14 @@ int main(int argc, char **argv) odp_queue_param_t queue_param; odp_shm_t shm; odph_helper_options_t helper_options; - odph_odpthread_t thr_tbl[ODP_THREAD_COUNT_MAX]; + odph_thread_t thr_tbl[ODP_THREAD_COUNT_MAX]; + odph_thread_param_t thr_param[ODP_THREAD_COUNT_MAX]; + odph_thread_common_param_t thr_common; odph_ethaddr_t new_addr; - odph_odpthread_params_t thr_params; stats_t *stats[ODP_THREAD_COUNT_MAX]; thread_args_t *thr_args; uint32_t pkt_len, seg_len, pkt_num; - int qid; - int cpu; - int num_threads; + int num_threads, num_workers; int i; int ret;
@@ -746,6 +745,7 @@ int main(int argc, char **argv) num_threads = setup_thread_masks(&thr_mask_rx, &thr_mask_tx, &thr_mask_worker, global->appl.num_workers); + num_workers = num_threads - 2;
/* Print both system and application information */ print_info(NO_PATH(argv[0]), &global->appl); @@ -852,43 +852,46 @@ int main(int argc, char **argv) stats[i] = &global->thread[i].stats;
memset(thr_tbl, 0, sizeof(thr_tbl)); - memset(&thr_params, 0, sizeof(thr_params)); - thr_params.thr_type = ODP_THREAD_WORKER; - thr_params.instance = instance; + memset(thr_param, 0, sizeof(thr_param)); + memset(&thr_common, 0, sizeof(thr_common)); + + thr_common.instance = instance;
/* RX thread */ thr_args = &global->thread[0]; thr_args->tx_queue = global->queue[0]; - thr_params.start = rx_thread; - thr_params.arg = thr_args; - odph_odpthreads_create(&thr_tbl[0], &thr_mask_rx, &thr_params); + thr_param[0].start = rx_thread; + thr_param[0].arg = thr_args; + thr_param[0].thr_type = ODP_THREAD_WORKER; + thr_common.cpumask = &thr_mask_rx; + odph_thread_create(thr_tbl, &thr_common, thr_param, 1);
/* Worker threads */ - cpu = odp_cpumask_first(&thr_mask_worker); - for (i = 1, qid = 0; i < (num_threads - 1); i++, qid++) { - odp_cpumask_t thr_mask; - - thr_args = &global->thread[i]; - thr_args->rx_queue = global->queue[qid]; - thr_args->tx_queue = global->queue[qid + 1]; + for (i = 0; i < num_workers; i++) { + thr_args = &global->thread[i + 1]; + thr_args->rx_queue = global->queue[i]; + thr_args->tx_queue = global->queue[i + 1];
- thr_params.start = worker_thread; - thr_params.arg = &global->thread[i]; + thr_param[i].start = worker_thread; + thr_param[i].arg = thr_args; + thr_param[i].thr_type = ODP_THREAD_WORKER; + }
- odp_cpumask_zero(&thr_mask); - odp_cpumask_set(&thr_mask, cpu); - odph_odpthreads_create(&thr_tbl[i], &thr_mask, - &thr_params); - cpu = odp_cpumask_next(&thr_mask_worker, cpu); + if (num_workers) { + thr_common.cpumask = &thr_mask_worker; + odph_thread_create(&thr_tbl[1], &thr_common, thr_param, + num_workers); }
/* TX thread */ thr_args = &global->thread[num_threads - 1]; - thr_args->rx_queue = global->queue[global->appl.num_workers]; - thr_params.start = tx_thread; - thr_params.arg = thr_args; - odph_odpthreads_create(&thr_tbl[num_threads - 1], &thr_mask_tx, - &thr_params); + thr_args->rx_queue = global->queue[num_workers]; + thr_param[0].start = tx_thread; + thr_param[0].arg = thr_args; + thr_param[0].thr_type = ODP_THREAD_WORKER; + thr_common.cpumask = &thr_mask_tx; + odph_thread_create(&thr_tbl[num_threads - 1], &thr_common, thr_param, + 1);
ret = print_speed_stats(num_threads, stats, global->appl.time, global->appl.accuracy); @@ -905,8 +908,7 @@ int main(int argc, char **argv) global->exit_threads = 1; odp_barrier_wait(&global->term_barrier);
- for (i = 0; i < num_threads; i++) - odph_odpthreads_join(&thr_tbl[i]); + odph_thread_join(thr_tbl, num_threads);
if (odp_pktio_close(global->if0)) { printf("Error: failed to close interface %s\n", argv[1]);
commit bab44af796bbacb6945de590c8dbc1055d45bd5a Author: Petri Savolainen petri.savolainen@nokia.com Date: Mon May 6 16:34:00 2019 +0300
example: l2fwd_simple: use new thread helpers
Change to use the new thread create and join helpers.
Signed-off-by: Petri Savolainen petri.savolainen@nokia.com Reviewed-by: Matias Elo matias.elo@nokia.com Reviewed-by: Stanislaw Kardach skardach@marvell.com
diff --git a/example/l2fwd_simple/odp_l2fwd_simple.c b/example/l2fwd_simple/odp_l2fwd_simple.c index fab00e7e7..7bfa73b75 100644 --- a/example/l2fwd_simple/odp_l2fwd_simple.c +++ b/example/l2fwd_simple/odp_l2fwd_simple.c @@ -143,10 +143,11 @@ int main(int argc, char **argv) odp_pool_t pool; odp_pool_param_t params; odp_cpumask_t cpumask; - odph_odpthread_t thd[MAX_WORKERS]; + odph_thread_t thd[MAX_WORKERS]; odp_instance_t instance; odp_init_t init_param; - odph_odpthread_params_t thr_params; + odph_thread_common_param_t thr_common; + odph_thread_param_t thr_param; odph_ethaddr_t correct_src; uint32_t mtu1, mtu2; odp_shm_t shm; @@ -243,16 +244,28 @@ int main(int argc, char **argv)
odp_cpumask_default_worker(&cpumask, MAX_WORKERS);
- memset(&thr_params, 0, sizeof(thr_params)); - thr_params.start = run_worker; - thr_params.arg = NULL; - thr_params.thr_type = ODP_THREAD_WORKER; - thr_params.instance = instance; + memset(&thr_common, 0, sizeof(thr_common)); + memset(&thr_param, 0, sizeof(thr_param)); + + thr_param.start = run_worker; + thr_param.thr_type = ODP_THREAD_WORKER; + + thr_common.instance = instance; + thr_common.cpumask = &cpumask; + thr_common.share_param = 1;
signal(SIGINT, sig_handler);
- odph_odpthreads_create(thd, &cpumask, &thr_params); - odph_odpthreads_join(thd); + if (odph_thread_create(thd, &thr_common, &thr_param, MAX_WORKERS) != + MAX_WORKERS) { + printf("Error: failed to create threads\n"); + exit(EXIT_FAILURE); + } + + if (odph_thread_join(thd, MAX_WORKERS) != MAX_WORKERS) { + printf("Error: failed to join threads\n"); + exit(EXIT_FAILURE); + }
if (odp_pktio_stop(global->if0) || odp_pktio_close(global->if0)) { printf("Error: failed to close interface %s\n", argv[1]);
commit f22c4bf1bf192a2929b3eeae0de889e13feaaeba Author: Petri Savolainen petri.savolainen@nokia.com Date: Mon May 6 15:51:26 2019 +0300
validation: common: use new thread helpers
Signed-off-by: Petri Savolainen petri.savolainen@nokia.com Reviewed-by: Matias Elo matias.elo@nokia.com Reviewed-by: Stanislaw Kardach skardach@marvell.com
diff --git a/test/common/odp_cunit_common.c b/test/common/odp_cunit_common.c index 7f345fba3..eceff6537 100644 --- a/test/common/odp_cunit_common.c +++ b/test/common/odp_cunit_common.c @@ -29,7 +29,7 @@
/* Globals */ static int allow_skip_result; -static odph_odpthread_t thread_tbl[MAX_WORKERS]; +static odph_thread_t thread_tbl[MAX_WORKERS]; static odp_instance_t instance; static char *progname;
@@ -50,27 +50,41 @@ static odp_suiteinfo_t *global_testsuites; int odp_cunit_thread_create(int func_ptr(void *), pthrd_arg *arg) { odp_cpumask_t cpumask; - odph_odpthread_params_t thr_params; + odph_thread_common_param_t thr_common; + int ret; + int num = arg->numthrds; + odph_thread_param_t thr_param; + + memset(&thr_common, 0, sizeof(thr_common)); + memset(&thr_param, 0, sizeof(thr_param)); + + thr_param.start = func_ptr; + thr_param.arg = arg; + thr_param.thr_type = ODP_THREAD_WORKER; + + odp_cpumask_default_worker(&cpumask, num);
- memset(&thr_params, 0, sizeof(thr_params)); - thr_params.start = func_ptr; - thr_params.arg = arg; - thr_params.thr_type = ODP_THREAD_WORKER; - thr_params.instance = instance; + thr_common.instance = instance; + thr_common.cpumask = &cpumask; + thr_common.share_param = 1;
- /* Create and init additional threads */ - odp_cpumask_default_worker(&cpumask, arg->numthrds); + /* Create and start additional threads */ + ret = odph_thread_create(thread_tbl, &thr_common, &thr_param, num);
- return odph_odpthreads_create(thread_tbl, &cpumask, &thr_params); + if (ret != num) + fprintf(stderr, "error: odph_thread_create() failed.\n"); + + return ret; }
/** exit from test thread */ int odp_cunit_thread_exit(pthrd_arg *arg) { + int num = arg->numthrds; + /* Wait for other threads to exit */ - if (odph_odpthreads_join(thread_tbl) != arg->numthrds) { - fprintf(stderr, - "error: odph_odpthreads_join() failed.\n"); + if (odph_thread_join(thread_tbl, num) != num) { + fprintf(stderr, "error: odph_thread_join() failed.\n"); return -1; }
commit e3f8c24f860f9edf8a5abb6703c3ab93e53a5fcc Author: Petri Savolainen petri.savolainen@nokia.com Date: Fri May 3 16:20:10 2019 +0300
test: l2fwd: use new thread helpers
Change to use the new thread create and join helpers.
Signed-off-by: Petri Savolainen petri.savolainen@nokia.com Reviewed-by: Matias Elo matias.elo@nokia.com Reviewed-by: Stanislaw Kardach skardach@marvell.com
diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c index 15a0cb0e4..89c979324 100644 --- a/test/performance/odp_l2fwd.c +++ b/test/performance/odp_l2fwd.c @@ -1426,11 +1426,12 @@ 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]; + odph_thread_t thread_tbl[MAX_WORKERS]; + odph_thread_param_t thr_param[MAX_WORKERS]; + odph_thread_common_param_t thr_common; odp_pool_t pool; int i; - int cpu; - int num_workers; + int num_workers, num_thr; odp_shm_t shm; odp_cpumask_t cpumask; char cpumaskstr[ODP_CPUMASK_STR_SIZE]; @@ -1637,8 +1638,6 @@ int main(int argc, char *argv[]) if (!gbl_args->appl.sched_mode) print_port_mapping();
- memset(thread_tbl, 0, sizeof(thread_tbl)); - odp_barrier_init(&gbl_args->init_barrier, num_workers + 1); odp_barrier_init(&gbl_args->term_barrier, num_workers + 1);
@@ -1650,28 +1649,34 @@ int main(int argc, char *argv[]) thr_run_func = run_worker_sched_mode;
/* Create worker threads */ - cpu = odp_cpumask_first(&cpumask); - for (i = 0; i < num_workers; ++i) { - odp_cpumask_t thd_mask; - odph_odpthread_params_t thr_params; + memset(thread_tbl, 0, sizeof(thread_tbl)); + memset(thr_param, 0, sizeof(thr_param)); + memset(&thr_common, 0, sizeof(thr_common)); + + thr_common.instance = instance; + thr_common.cpumask = &cpumask; + /* Synchronize thread start up. Test runs are more repeatable when + * thread / thread ID / CPU ID mapping stays constant. */ + thr_common.sync = 1;
- memset(&thr_params, 0, sizeof(thr_params)); - thr_params.start = thr_run_func; - thr_params.arg = &gbl_args->thread[i]; - thr_params.thr_type = ODP_THREAD_WORKER; - thr_params.instance = instance; + for (i = 0; i < num_workers; ++i) { + thr_param[i].start = thr_run_func; + thr_param[i].arg = &gbl_args->thread[i]; + thr_param[i].thr_type = ODP_THREAD_WORKER;
/* Round robin threads to groups */ gbl_args->thread[i].num_groups = 1; gbl_args->thread[i].group[0] = group[i % num_groups];
stats[i] = &gbl_args->thread[i].stats; + } + + num_thr = odph_thread_create(thread_tbl, &thr_common, thr_param, + num_workers);
- odp_cpumask_zero(&thd_mask); - odp_cpumask_set(&thd_mask, cpu); - odph_odpthreads_create(&thread_tbl[i], &thd_mask, - &thr_params); - cpu = odp_cpumask_next(&cpumask, cpu); + if (num_thr != num_workers) { + LOG_ERR("Error: worker create failed %i\n", num_thr); + exit(EXIT_FAILURE); }
/* Start packet receive and transmit */ @@ -1703,8 +1708,11 @@ int main(int argc, char *argv[]) odp_barrier_wait(&gbl_args->term_barrier);
/* Master thread waits for other threads to exit */ - for (i = 0; i < num_workers; ++i) - odph_odpthreads_join(&thread_tbl[i]); + num_thr = odph_thread_join(thread_tbl, num_workers); + if (num_thr != num_workers) { + LOG_ERR("Error: worker join failed %i\n", num_thr); + exit(EXIT_FAILURE); + }
for (i = 0; i < if_count; ++i) { if (odp_pktio_close(gbl_args->pktios[i].pktio)) {
commit 6a80556e88763be7dbbdf0eda195d68444cbe683 Author: Petri Savolainen petri.savolainen@nokia.com Date: Mon May 6 15:53:32 2019 +0300
helper: increment library version to 1.0.1
Increment version number to reflect addition of the new thread create and join functions.
Signed-off-by: Petri Savolainen petri.savolainen@nokia.com Reviewed-by: Matias Elo matias.elo@nokia.com Reviewed-by: Stanislaw Kardach skardach@marvell.com
diff --git a/configure.ac b/configure.ac index fa8dcce79..9b20fcc28 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ AC_SUBST(ODP_VERSION_API_MINOR) ########################################################################## m4_define([odph_version_generation], [1]) m4_define([odph_version_major], [0]) -m4_define([odph_version_minor], [0]) +m4_define([odph_version_minor], [1])
m4_define([odph_version], [odph_version_generation.odph_version_major.odph_version_minor])
commit a51eaeca2eac68d65ab89a1417b98d0225ebf86a Author: Petri Savolainen petri.savolainen@nokia.com Date: Fri May 3 15:18:44 2019 +0300
helper: thread: implement new thread create and join
Implemented new thread create and join functions.
Signed-off-by: Petri Savolainen petri.savolainen@nokia.com Reviewed-by: Matias Elo matias.elo@nokia.com Reviewed-by: Stanislaw Kardach skardach@marvell.com
diff --git a/helper/include/odp/helper/threads.h b/helper/include/odp/helper/threads.h index 5a2a21157..34f539f1a 100644 --- a/helper/include/odp/helper/threads.h +++ b/helper/include/odp/helper/threads.h @@ -1,4 +1,5 @@ /* Copyright (c) 2013-2018, Linaro Limited + * Copyright (c) 2019, Nokia * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause @@ -70,17 +71,34 @@ typedef struct {
} odph_thread_param_t;
-/** The odpthread starting arguments, used both in process or thread mode */ +/** Helper internal thread start arguments. Used both in process and thread + * mode */ typedef struct { - odp_mem_model_t mem_model; /**< process or thread */ - odph_thread_param_t thr_params; /**< odpthread start parameters */ -} odph_odpthread_start_args_t; + /** Atomic variable to sync status */ + odp_atomic_u32_t status;
-/** Linux odpthread state information, used both in process or thread mode */ + /** Process or thread */ + odp_mem_model_t mem_model; + + /** ODP instance handle */ + odp_instance_t instance; + + /** Thread parameters */ + odph_thread_param_t thr_params; + +} odph_thread_start_args_t; + +/** Thread state information. Used both in process and thread mode */ typedef struct { - odph_odpthread_start_args_t start_args; /**< start arguments */ - int cpu; /**< CPU ID */ - int last; /**< true if last table entry */ + /** Start arguments */ + odph_thread_start_args_t start_args; + + /** CPU ID */ + int cpu; + + /** 1: last table entry */ + uint8_t last; + /** Variant field mappings for thread/process modes */ union { /** For thread implementation */ @@ -88,12 +106,14 @@ typedef struct { pthread_t thread_id; /**< Pthread ID */ pthread_attr_t attr; /**< Pthread attributes */ } thread; + /** For process implementation */ struct { pid_t pid; /**< Process ID */ int status; /**< Process state chge status*/ } proc; }; + } odph_thread_t;
/** Linux helper options */ diff --git a/helper/threads.c b/helper/threads.c index 01bc33eac..e30c9f29d 100644 --- a/helper/threads.c +++ b/helper/threads.c @@ -1,4 +1,5 @@ /* Copyright (c) 2013-2018, Linaro Limited + * Copyright (c) 2019, Nokia * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause @@ -23,24 +24,32 @@
#define FAILED_CPU -1
+/* Thread status codes */ +#define NOT_STARTED 0 +#define SYNC_INIT 1 +#define INIT_DONE 2 +#define STARTED 3 + static odph_helper_options_t helper_options;
/* - * wrapper for odpthreads, either implemented as linux threads or processes. - * (in process mode, if start_routine returns NULL, the process return FAILURE). + * Run a thread, either as Linux pthread or process. + * In process mode, if start_routine returns NULL, the process return FAILURE. */ -static void *_odph_thread_run_start_routine(void *arg) +static void *run_thread(void *arg) { int status; int ret; + odp_instance_t instance; odph_odpthread_params_t *thr_params;
- odph_odpthread_start_args_t *start_args = arg; + odph_thread_start_args_t *start_args = arg;
thr_params = &start_args->thr_params; + instance = start_args->instance;
/* ODP thread local init */ - if (odp_init_local(thr_params->instance, thr_params->thr_type)) { + if (odp_init_local(instance, thr_params->thr_type)) { ODPH_ERR("Local init failed\n"); if (start_args->mem_model == ODP_MEM_MODEL_PROCESS) _exit(EXIT_FAILURE); @@ -54,6 +63,9 @@ static void *_odph_thread_run_start_routine(void *arg) "pthread" : "process", (int)getpid());
+ if (odp_atomic_load_u32(&start_args->status) == SYNC_INIT) + odp_atomic_store_rel_u32(&start_args->status, INIT_DONE); + status = thr_params->start(thr_params->arg); ret = odp_term_local();
@@ -69,11 +81,9 @@ static void *_odph_thread_run_start_routine(void *arg) }
/* - * Create a single ODPthread as a linux process + * Create a single linux process */ -static int _odph_linux_process_create(odph_odpthread_t *thread_tbl, - int cpu, - const odph_odpthread_params_t *thr_params) +static int create_process(odph_thread_t *thread, int cpu) { cpu_set_t cpu_set; pid_t pid; @@ -81,20 +91,19 @@ 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.mem_model = ODP_MEM_MODEL_PROCESS; - thread_tbl->cpu = cpu; + thread->start_args.mem_model = ODP_MEM_MODEL_PROCESS; + thread->cpu = cpu;
pid = fork(); if (pid < 0) { ODPH_ERR("fork() failed\n"); - thread_tbl->cpu = FAILED_CPU; + thread->cpu = FAILED_CPU; return -1; }
/* Parent continues to fork */ if (pid > 0) { - thread_tbl->proc.pid = pid; + thread->proc.pid = pid; return 0; }
@@ -111,17 +120,49 @@ static int _odph_linux_process_create(odph_odpthread_t *thread_tbl, return -2; }
- _odph_thread_run_start_routine(&thread_tbl->start_args); + run_thread(&thread->start_args);
return 0; /* never reached */ }
/* - * Create a single ODPthread as a linux thread + * Wait single process to exit */ -static int odph_linux_thread_create(odph_odpthread_t *thread_tbl, - int cpu, - const odph_odpthread_params_t *thr_params) +static int wait_process(odph_thread_t *thread) +{ + pid_t pid; + int status = 0; + + pid = waitpid(thread->proc.pid, &status, 0); + + if (pid < 0) { + ODPH_ERR("waitpid() failed\n"); + return -1; + } + + /* Examine the child process' termination status */ + if (WIFEXITED(status) && + WEXITSTATUS(status) != EXIT_SUCCESS) { + ODPH_ERR("Child exit status:%d (pid:%d)\n", + WEXITSTATUS(status), (int)pid); + return -1; + } + + if (WIFSIGNALED(status)) { + int signo = WTERMSIG(status); + + ODPH_ERR("Child term signo:%d - %s (pid:%d)\n", + signo, strsignal(signo), (int)pid); + return -1; + } + + return 0; +} + +/* + * Create a single linux pthread + */ +static int create_pthread(odph_thread_t *thread, int cpu) { int ret; cpu_set_t cpu_set; @@ -129,29 +170,177 @@ static int odph_linux_thread_create(odph_odpthread_t *thread_tbl, CPU_ZERO(&cpu_set); CPU_SET(cpu, &cpu_set);
- pthread_attr_init(&thread_tbl->thread.attr); + pthread_attr_init(&thread->thread.attr);
- thread_tbl->cpu = cpu; + thread->cpu = cpu;
- pthread_attr_setaffinity_np(&thread_tbl->thread.attr, + pthread_attr_setaffinity_np(&thread->thread.attr, sizeof(cpu_set_t), &cpu_set);
- thread_tbl->start_args.thr_params = *thr_params; /* copy */ - thread_tbl->start_args.mem_model = ODP_MEM_MODEL_THREAD; + thread->start_args.mem_model = ODP_MEM_MODEL_THREAD;
- ret = pthread_create(&thread_tbl->thread.thread_id, - &thread_tbl->thread.attr, - _odph_thread_run_start_routine, - &thread_tbl->start_args); + ret = pthread_create(&thread->thread.thread_id, + &thread->thread.attr, + run_thread, + &thread->start_args); if (ret != 0) { ODPH_ERR("Failed to start thread on cpu #%d\n", cpu); - thread_tbl->cpu = FAILED_CPU; + thread->cpu = FAILED_CPU; return ret; }
return 0; }
+/* + * Wait single pthread to exit + */ +static int wait_pthread(odph_thread_t *thread) +{ + int ret; + void *thread_ret = NULL; + + /* Wait thread to exit */ + ret = pthread_join(thread->thread.thread_id, &thread_ret); + + if (ret) { + ODPH_ERR("pthread_join failed (%i) from cpu #%i\n", + ret, thread->cpu); + return -1; + } + + if (thread_ret) { + ODPH_ERR("Bad exit status cpu #%i %p\n", + thread->cpu, thread_ret); + return -1; + } + + ret = pthread_attr_destroy(&thread->thread.attr); + + if (ret) { + ODPH_ERR("pthread_attr_destroy failed (%i) from cpu #%i\n", + ret, thread->cpu); + return -1; + } + + return 0; +} + +int odph_thread_create(odph_thread_t thread[], + const odph_thread_common_param_t *param, + const odph_thread_param_t thr_param[], + int num) +{ + int i, num_cpu, cpu; + const odp_cpumask_t *cpumask = param->cpumask; + int use_pthread = 1; + + if (param->thread_model == 1) + use_pthread = 0; + + if (helper_options.mem_model == ODP_MEM_MODEL_PROCESS) + use_pthread = 0; + + if (num < 1) { + ODPH_ERR("Bad number of threads (%i)\n", num); + return -1; + } + + num_cpu = odp_cpumask_count(cpumask); + + if (num_cpu != num) { + ODPH_ERR("Number of threads (%i) and CPUs (%i) does not match" + "\n", num, num_cpu); + return -1; + } + + memset(thread, 0, num * sizeof(odph_thread_t)); + + cpu = odp_cpumask_first(cpumask); + for (i = 0; i < num; i++) { + odph_thread_start_args_t *start_args = &thread[i].start_args; + + /* Copy thread parameters */ + if (param->share_param) + start_args->thr_params = thr_param[0]; + else + start_args->thr_params = thr_param[i]; + + start_args->instance = param->instance; + + if (param->sync) + odp_atomic_init_u32(&start_args->status, SYNC_INIT); + else + odp_atomic_init_u32(&start_args->status, NOT_STARTED); + + if (use_pthread) { + if (create_pthread(&thread[i], cpu)) + break; + } else { + if (create_process(&thread[i], cpu)) + break; + } + + /* Wait newly created thread to update status */ + if (param->sync) { + odp_time_t t1, t2; + uint64_t diff_ns; + uint32_t status; + int timeout = 0; + odp_atomic_u32_t *atomic = &start_args->status; + + t1 = odp_time_local(); + + do { + odp_cpu_pause(); + t2 = odp_time_local(); + diff_ns = odp_time_diff_ns(t2, t1); + timeout = diff_ns > ODP_TIME_SEC_IN_NS; + status = odp_atomic_load_acq_u32(atomic); + + } while (status != INIT_DONE && timeout == 0); + + if (timeout) { + ODPH_ERR("Thread (i:%i) start up timeout\n", i); + break; + } + } + + odp_atomic_store_u32(&start_args->status, STARTED); + + cpu = odp_cpumask_next(cpumask, cpu); + } + + return i; +} + +int odph_thread_join(odph_thread_t thread[], int num) +{ + odph_thread_start_args_t *start_args; + int i; + + for (i = 0; i < num; i++) { + start_args = &thread[i].start_args; + + if (odp_atomic_load_u32(&start_args->status) != STARTED) { + ODPH_DBG("Thread (i:%i) not started.\n", i); + break; + } + + if (thread[i].start_args.mem_model == ODP_MEM_MODEL_THREAD) { + if (wait_pthread(&thread[i])) + break; + } else { + if (wait_process(&thread[i])) + break; + } + + odp_atomic_store_u32(&start_args->status, NOT_STARTED); + } + + return i; +} + /* * create an odpthread set (as linux processes or linux threads or both) */ @@ -179,15 +368,19 @@ int odph_odpthreads_create(odph_odpthread_t *thread_tbl,
cpu = odp_cpumask_first(mask); for (i = 0; i < num; i++) { + odph_thread_start_args_t *start_args; + + start_args = &thread_tbl[i].start_args; + + /* Copy thread parameters */ + start_args->thr_params = *thr_params; + start_args->instance = thr_params->instance; + if (helper_options.mem_model == ODP_MEM_MODEL_THREAD) { - if (odph_linux_thread_create(&thread_tbl[i], - cpu, - thr_params)) + if (create_pthread(&thread_tbl[i], cpu)) break; } else { - if (_odph_linux_process_create(&thread_tbl[i], - cpu, - thr_params)) + if (create_process(&thread_tbl[i], cpu)) break; }
commit 0e1e2f891bd6d68e71a8ca6475dea6a2217a95a4 Author: Petri Savolainen petri.savolainen@nokia.com Date: Thu May 2 15:47:38 2019 +0300
helper: thread: new thread create and join calls
Defined new versions of thread create and join calls. New calls explicitly support thread create and join in multiple steps. Also per thread and common parameters are improved.
Signed-off-by: Petri Savolainen petri.savolainen@nokia.com Reviewed-by: Matias Elo matias.elo@nokia.com Reviewed-by: Stanislaw Kardach skardach@marvell.com
diff --git a/helper/include/odp/helper/threads.h b/helper/include/odp/helper/threads.h index 6cee2522d..5a2a21157 100644 --- a/helper/include/odp/helper/threads.h +++ b/helper/include/odp/helper/threads.h @@ -54,18 +54,26 @@ typedef struct { int status; /**< Process state change status */ } odph_linux_process_t;
-/** odpthread parameters for odp threads (pthreads and processes) */ +/** Thread parameters (pthreads and processes) */ typedef struct { - int (*start)(void *); /**< Thread entry point function */ - void *arg; /**< Argument for the function */ - odp_thread_type_t thr_type; /**< ODP thread type */ - odp_instance_t instance; /**< ODP instance handle */ -} odph_odpthread_params_t; + /** Thread entry point function */ + int (*start)(void *arg); + + /** Argument for the function */ + void *arg; + + /** ODP thread type */ + odp_thread_type_t thr_type; + + /** @deprecated ODP instance handle for odph_odpthreads_create(). */ + odp_instance_t instance; + +} odph_thread_param_t;
/** The odpthread starting arguments, used both in process or thread mode */ typedef struct { odp_mem_model_t mem_model; /**< process or thread */ - odph_odpthread_params_t thr_params; /**< odpthread start parameters */ + odph_thread_param_t thr_params; /**< odpthread start parameters */ } odph_odpthread_start_args_t;
/** Linux odpthread state information, used both in process or thread mode */ @@ -86,13 +94,130 @@ typedef struct { int status; /**< Process state chge status*/ } proc; }; -} odph_odpthread_t; +} odph_thread_t;
/** Linux helper options */ typedef struct { odp_mem_model_t mem_model; /**< Process or thread */ } odph_helper_options_t;
+/** Legacy thread table entry */ +typedef odph_thread_t odph_odpthread_t; + +/** Legacy thread parameters */ +typedef odph_thread_param_t odph_odpthread_params_t; + +/** Common parameters for odph_thread_create() call */ +typedef struct { + /** + * ODP instance handle + * + * This is used for all threads, instead of 'instance' field of per + * thread parameters (odph_thread_param_t). + */ + odp_instance_t instance; + + /** + * CPU mask for thread pinning + */ + const odp_cpumask_t *cpumask; + + /** + * Select between Linux pthreads and processes + * + * 0: Use pthreads + * 1: Use processes + * + * Default value is 0. + */ + int thread_model; + + /** + * Synchronized thread creation + * + * 0: Don't synchronize thread creation + * 1: Create threads in series so that the next thread is created + * only after the previous thread have signaled that it has passed + * ODP local initialization. + * + * Default value is 0. + */ + int sync; + + /** + * Thread parameter sharing + * + * 0: Thread parameters are not shared. The thread parameter table + * contains 'num' elements. + * 1: The thread parameter table contains a single element, which is + * used for creating all 'num' threads. + * + * Default value is 0. + */ + int share_param; + +} odph_thread_common_param_t; + +/** + * Create and pin threads (as Linux pthreads or processes) + * + * This is an updated version of odph_odpthreads_create() call. It may be called + * multiple times to create threads in steps. Each call launches 'num' threads + * and pins those to separate CPUs based on the cpumask. Use 'thread_model' + * parameter to select if Linux pthreads or processes are used. This selection + * may be overridden with ODP helper options. See e.g. --odph_proc under + * odph_options() documentation. + * + * Thread creation may be synchronized by setting 'sync' parameter. It + * serializes thread start up (odp_init_local() calls), which helps to + * stabilize application start up sequence. + * + * By default, the thread parameter table contains 'num' elements, one for + * each thread to be created. However, all threads may be created + * with a single thread parameter table element by setting 'share_param' + * parameter. + * + * Thread table must be large enough to hold 'num' elements. Also the cpumask + * must contain 'num' CPUs. Threads are pinned to CPUs in order - the first + * thread goes to the smallest CPU number of the mask, etc. + * + * Launched threads may be waited for exit with odph_thread_join(), or with + * direct Linux system calls. + * + * @param[out] thread Thread table for output + * @param param Common parameters for all threads to be created + * @param thr_param Table of thread parameters + * @param num Number of threads to create + * + * @return Number of threads created + * @retval -1 On failure + * + * @see odph_thread_join() + */ +int odph_thread_create(odph_thread_t thread[], + const odph_thread_common_param_t *param, + const odph_thread_param_t thr_param[], + int num); + +/** + * Wait previously launched threads to exit + * + * This is an updated version of odph_odpthreads_join() call. It waits for + * threads launched with odph_thread_create() to exit. Threads may be waited to + * exit in a different order than those were created. A function call may be + * used to wait any number of launched threads to exit. A particular thread + * may be waited only once. + * + * @param thread Table of threads to exit + * @param num Number of threads to exit + * + * @return Number of threads exited + * @retval -1 On failure + * + * @see odph_thread_create() + */ +int odph_thread_join(odph_thread_t thread[], int num); + /** * Creates and launches odpthreads (as linux threads or processes) * @@ -103,6 +228,8 @@ typedef struct { * @param thr_params ODP thread parameters * * @return Number of threads created + * + * @deprecated Use odph_thread_create() instead. */ int odph_odpthreads_create(odph_odpthread_t *thread_tbl, const odp_cpumask_t *mask, @@ -118,6 +245,7 @@ int odph_odpthreads_create(odph_odpthread_t *thread_tbl, * (error occurs if any of the start_routine return non-zero or if * the thread join/process wait itself failed -e.g. as the result of a kill) * + * @deprecated Use odph_thread_join() instead. */ int odph_odpthreads_join(odph_odpthread_t *thread_tbl);
@@ -150,6 +278,14 @@ int odph_odpthread_getaffinity(void); * the helper itself. When helper options are found, those are removed from * argv[] and remaining options are packed to the beginning of the array. * + * <table> <caption> Currently supported options </caption> + * + * <tr><th>Command line <th>Environment variable <th>Description + * <tr><td>--odph_proc <td>ODPH_PROC_MODE <td>When defined, threads are + * Linux processes. Otherwise, + * pthreads are used instead. + * </table> + * * @param argc Argument count * @param argv Argument vector *
commit 2e927d35cb368611d2684caee633dbff733cebe5 Author: Petri Savolainen petri.savolainen@nokia.com Date: Thu May 2 11:26:34 2019 +0300
helper: add helper version defines
Added helper library version defines, so that application can track helper version independent of ODP API version. Added also function for easy print out of the versions number.
Signed-off-by: Petri Savolainen petri.savolainen@nokia.com Reviewed-by: Matias Elo matias.elo@nokia.com Reviewed-by: Stanislaw Kardach skardach@marvell.com
diff --git a/configure.ac b/configure.ac index 29ffef29e..fa8dcce79 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ AC_PREREQ([2.5]) ########################################################################## -# Set correct API version +# ODP API version ########################################################################## m4_define([odpapi_generation_version], [1]) m4_define([odpapi_major_version], [21]) @@ -16,6 +16,24 @@ ODP_VERSION_API_MAJOR=odpapi_major_version AC_SUBST(ODP_VERSION_API_MAJOR) ODP_VERSION_API_MINOR=odpapi_minor_version AC_SUBST(ODP_VERSION_API_MINOR) + +########################################################################## +# Helper library version +########################################################################## +m4_define([odph_version_generation], [1]) +m4_define([odph_version_major], [0]) +m4_define([odph_version_minor], [0]) + +m4_define([odph_version], + [odph_version_generation.odph_version_major.odph_version_minor]) + +ODPH_VERSION_GENERATION=odph_version_generation +AC_SUBST(ODPH_VERSION_GENERATION) +ODPH_VERSION_MAJOR=odph_version_major +AC_SUBST(ODPH_VERSION_MAJOR) +ODPH_VERSION_MINOR=odph_version_minor +AC_SUBST(ODPH_VERSION_MINOR) + AM_INIT_AUTOMAKE([1.9 tar-pax subdir-objects foreign nostdinc -Wall -Werror]) AC_CONFIG_SRCDIR([include/odp/api/spec/init.h]) AM_CONFIG_HEADER([include/config.h]) @@ -360,6 +378,7 @@ AC_CONFIG_FILES([include/Makefile include/odp/api/spec/version.h include/odp/api/spec/deprecated.h])
+AC_CONFIG_FILES([helper/include/odp/helper/version.h])
########################################################################## # distribute the changed variables among the Makefiles diff --git a/helper/Makefile.am b/helper/Makefile.am index 518a6a944..a7d5132df 100644 --- a/helper/Makefile.am +++ b/helper/Makefile.am @@ -27,7 +27,8 @@ helperinclude_HEADERS = \ include/odp/helper/tcp.h\ include/odp/helper/table.h\ include/odp/helper/threads.h \ - include/odp/helper/udp.h + include/odp/helper/udp.h \ + include/odp/helper/version.h
if helper_linux helperinclude_HEADERS += \ @@ -51,7 +52,8 @@ __LIB__libodphelper_la_SOURCES = \ lineartable.c \ cuckootable.c \ iplookuptable.c \ - threads.c + threads.c \ + version.c
if helper_linux __LIB__libodphelper_la_SOURCES += \ diff --git a/helper/include/odp/helper/.gitignore b/helper/include/odp/helper/.gitignore new file mode 100644 index 000000000..67020331b --- /dev/null +++ b/helper/include/odp/helper/.gitignore @@ -0,0 +1 @@ +version.h diff --git a/helper/include/odp/helper/odph_api.h b/helper/include/odp/helper/odph_api.h index d46ab2ad2..4bd10bf46 100644 --- a/helper/include/odp/helper/odph_api.h +++ b/helper/include/odp/helper/odph_api.h @@ -33,6 +33,7 @@ extern "C" { #include <odp/helper/table.h> #include <odp/helper/threads.h> #include <odp/helper/udp.h> +#include <odp/helper/version.h>
#ifdef __cplusplus } diff --git a/helper/include/odp/helper/version.h.in b/helper/include/odp/helper/version.h.in new file mode 100644 index 000000000..127b3ff9d --- /dev/null +++ b/helper/include/odp/helper/version.h.in @@ -0,0 +1,72 @@ +/* Copyright (c) 2019, Nokia + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + + +/** + * @file + * + * ODP helper version + */ + +#ifndef ODPH_VERSION_H_ +#define ODPH_VERSION_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @defgroup odph_version VERSION + * @{ + */ + +/** + * ODP helper generation version + * + * Introduction of major new features or changes that make very significant + * changes to the helper library. + */ +#define ODPH_VERSION_GENERATION @ODPH_VERSION_GENERATION@ + +/** + * ODP helper major version + * + * Introduction of major new features or changes. Helper libraries with common + * generation, but with different major version numbers are likely not backward + * compatible. + */ +#define ODPH_VERSION_MAJOR @ODPH_VERSION_MAJOR@ + +/** + * ODP helper minor version + * + * Minor version is incremented when introducing backward compatible changes. + * Helper libraries with common generation and major version, but with + * different minor version numbers are backward compatible. + */ +#define ODPH_VERSION_MINOR @ODPH_VERSION_MINOR@ + +/** + * ODP helper version string + * + * The version string defines the helper library version in this format: + * @verbatim <generation>.<major>.<minor> @endverbatim + * + * The string is null terminated. + * + * @return Pointer to helper library version string + */ +const char *odph_version_str(void); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/helper/test/.gitignore b/helper/test/.gitignore index 1a81e0047..5a6c60bcc 100644 --- a/helper/test/.gitignore +++ b/helper/test/.gitignore @@ -9,3 +9,4 @@ process table thread pthread +version diff --git a/helper/test/Makefile.am b/helper/test/Makefile.am index 662d6c758..bf3aa862c 100644 --- a/helper/test/Makefile.am +++ b/helper/test/Makefile.am @@ -1,6 +1,7 @@ include $(top_srcdir)/test/Makefile.inc
-EXECUTABLES = chksum \ +EXECUTABLES = version \ + chksum \ cuckootable \ parse\ table \ @@ -36,3 +37,4 @@ odpthreads_SOURCES = odpthreads.c parse_SOURCES = parse.c table_SOURCES = table.c iplookuptable_SOURCES = iplookuptable.c +version_SOURCES = version.c diff --git a/helper/test/version.c b/helper/test/version.c new file mode 100644 index 000000000..bd817bb47 --- /dev/null +++ b/helper/test/version.c @@ -0,0 +1,22 @@ +/* Copyright (c) 2019, Nokia + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include "config.h" + +#include <odph_debug.h> + +#include <odp_api.h> +#include <odp/helper/odph_api.h> + +#include <stdio.h> +#include <string.h> + +int main(void) +{ + printf("\nHelper library versions is: %s\n\n", odph_version_str()); + + return 0; +} diff --git a/helper/version.c b/helper/version.c new file mode 100644 index 000000000..586abbe41 --- /dev/null +++ b/helper/version.c @@ -0,0 +1,20 @@ +/* Copyright (c) 2019, Nokia + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include <odp/helper/version.h> + +#define VERSION_STR_EXPAND(x) #x +#define VERSION_TO_STR(x) VERSION_STR_EXPAND(x) + +#define VERSION_STR \ +VERSION_TO_STR(ODPH_VERSION_GENERATION) "." \ +VERSION_TO_STR(ODPH_VERSION_MAJOR) "." \ +VERSION_TO_STR(ODPH_VERSION_MINOR) + +const char *odph_version_str(void) +{ + return VERSION_STR; +}
-----------------------------------------------------------------------
Summary of changes: configure.ac | 21 +- example/classifier/odp_classifier.c | 24 ++- example/generator/odp_generator.c | 50 ++--- example/l2fwd_simple/odp_l2fwd_simple.c | 31 ++- example/simple_pipeline/odp_simple_pipeline.c | 66 +++---- example/time/time_global_test.c | 24 ++- helper/Makefile.am | 6 +- helper/include/odp/helper/.gitignore | 1 + helper/include/odp/helper/odph_api.h | 1 + helper/include/odp/helper/threads.h | 186 ++++++++++++++++-- helper/include/odp/helper/version.h.in | 72 +++++++ helper/test/.gitignore | 1 + helper/test/Makefile.am | 4 +- helper/test/version.c | 22 +++ helper/threads.c | 263 ++++++++++++++++++++++---- helper/version.c | 20 ++ test/common/odp_cunit_common.c | 40 ++-- test/performance/odp_l2fwd.c | 50 +++-- test/performance/odp_scheduling.c | 27 ++- test/validation/api/ipsec/ipsec.c | 8 + 20 files changed, 737 insertions(+), 180 deletions(-) create mode 100644 helper/include/odp/helper/.gitignore create mode 100644 helper/include/odp/helper/version.h.in create mode 100644 helper/test/version.c create mode 100644 helper/version.c
hooks/post-receive