[lng-odp] [API-NEXT PATCHv6] api: init: removed platform_init struct definition
odp_platform_init defination in standard API will conflict with platform specific defination. better to keep it in the linux-generic or other platform init header file v6: fixing the spelling to avoid doxygen warning. Signed-off-by: Hemant Agrawal Reviewed-by: Petri Savolainen --- include/odp/api/init.h | 3 +-- platform/linux-generic/Makefile.am | 1 + platform/linux-generic/include/odp/init.h | 2 ++ .../linux-generic/include/odp/plat/init_types.h| 30 ++ 4 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 platform/linux-generic/include/odp/plat/init_types.h diff --git a/include/odp/api/init.h b/include/odp/api/init.h index 4ac5216..42af481 100644 --- a/include/odp/api/init.h +++ b/include/odp/api/init.h @@ -125,6 +125,7 @@ typedef struct odp_init_t { } odp_init_t; /** + * @typedef odp_platform_init_t * ODP platform initialization data * * @note ODP API does nothing with this data. It is the underlying @@ -132,8 +133,6 @@ typedef struct odp_init_t { * It is required that the application takes care of identifying and * passing any required platform specific data. */ -typedef struct odp_platform_init_t { -} odp_platform_init_t; /** diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index 75ca703..7d0427a 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -64,6 +64,7 @@ odpplatinclude_HEADERS = \ $(srcdir)/include/odp/plat/cpumask_types.h \ $(srcdir)/include/odp/plat/crypto_types.h \ $(srcdir)/include/odp/plat/event_types.h \ + $(srcdir)/include/odp/plat/init_types.h \ $(srcdir)/include/odp/plat/packet_types.h \ $(srcdir)/include/odp/plat/packet_io_types.h \ $(srcdir)/include/odp/plat/pool_types.h \ diff --git a/platform/linux-generic/include/odp/init.h b/platform/linux-generic/include/odp/init.h index 950a4f8..3233e36 100644 --- a/platform/linux-generic/include/odp/init.h +++ b/platform/linux-generic/include/odp/init.h @@ -17,6 +17,8 @@ extern "C" { #endif +#include + /** @ingroup odp_initialization * @{ */ diff --git a/platform/linux-generic/include/odp/plat/init_types.h b/platform/linux-generic/include/odp/plat/init_types.h new file mode 100644 index 000..b240c93 --- /dev/null +++ b/platform/linux-generic/include/odp/plat/init_types.h @@ -0,0 +1,30 @@ +/* Copyright (c) 2015, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/** + * @file + * + * ODP initialization. + */ + +#ifndef ODP_INIT_TYPES_H_ +#define ODP_INIT_TYPES_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @internal platform specific data + */ +typedef struct odp_platform_init_t { +} odp_platform_init_t; + +#ifdef __cplusplus +} +#endif + +#endif -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCH v4] helper: linux: add thread type in pthread_create
The exisiting helper routine only create the worker threads. However there is a need to use the same for creating the control thread as well. e.g. CLI thread. Signed-off-by: Hemant Agrawal --- example/classifier/odp_classifier.c | 2 +- example/generator/odp_generator.c | 9 ++--- example/ipsec/odp_ipsec.c | 2 +- example/packet/odp_pktio.c| 3 ++- example/timer/odp_timer_test.c| 2 +- helper/include/odp/helper/linux.h | 5 - helper/linux.c| 6 -- helper/test/odp_thread.c | 3 ++- test/api_test/odp_common.c| 2 +- test/performance/odp_atomic.c | 2 +- test/performance/odp_l2fwd.c | 3 ++- test/performance/odp_pktio_perf.c | 4 ++-- test/performance/odp_scheduling.c | 2 +- test/validation/common/odp_cunit_common.c | 2 +- 14 files changed, 29 insertions(+), 18 deletions(-) diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c index 0da07e7..00da68a 100644 --- a/example/classifier/odp_classifier.c +++ b/example/classifier/odp_classifier.c @@ -593,7 +593,7 @@ int main(int argc, char *argv[]) odp_cpumask_set(&thd_mask, cpu); odph_linux_pthread_create(&thread_tbl[i], &thd_mask, pktio_receive_thread, - args); + args, ODP_THREAD_WORKER); cpu = odp_cpumask_next(&cpumask, cpu); } diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index 2de530d..93eefe9 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -784,7 +784,8 @@ int main(int argc, char *argv[]) abort(); args->thread[1].mode = args->appl.mode; odph_linux_pthread_create(&thread_tbl[1], &cpu_mask, - gen_recv_thread, &args->thread[1]); + gen_recv_thread, &args->thread[1], + ODP_THREAD_WORKER); tq = odp_queue_create("", ODP_QUEUE_TYPE_POLL, NULL); if (tq == ODP_QUEUE_INVALID) @@ -804,7 +805,8 @@ int main(int argc, char *argv[]) odp_cpumask_zero(&cpu_mask); odp_cpumask_set(&cpu_mask, cpu_next); odph_linux_pthread_create(&thread_tbl[0], &cpu_mask, - gen_send_thread, &args->thread[0]); + gen_send_thread, &args->thread[0], + ODP_THREAD_WORKER); } else { int cpu = odp_cpumask_first(&cpumask); @@ -849,7 +851,8 @@ int main(int argc, char *argv[]) odph_linux_pthread_create(&thread_tbl[i], &thd_mask, thr_run_func, - &args->thread[i]); + &args->thread[i], + ODP_THREAD_WORKER); cpu = odp_cpumask_next(&cpumask, cpu); } diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index d784c31..88e73ff 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -1333,7 +1333,7 @@ main(int argc, char *argv[]) * Create and init worker threads */ odph_linux_pthread_create(thread_tbl, &cpumask, - pktio_thread, NULL); + pktio_thread, NULL, ODP_THREAD_WORKER); /* * If there are streams attempt to verify them else diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c index 93c38f5..75e92ac 100644 --- a/example/packet/odp_pktio.c +++ b/example/packet/odp_pktio.c @@ -442,7 +442,8 @@ int main(int argc, char *argv[]) odp_cpumask_set(&thd_mask, cpu); odph_linux_pthread_create(&thread_tbl[i], &thd_mask, thr_run_func, - &args->thread[i]); + &args->thread[i], + ODP_THREAD_WORKER); cpu = odp_cpumask_next(&cpumask, cpu); } diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c index 0ec73b1..bd05ce4 100644 --- a/example/timer/odp_timer_test.c +++ b/example/timer/odp_timer_test.c @@ -479,7 +479,7 @@ int main(int argc, char *argv[]) /* Create and launch worker threads */ odp
[lng-odp] [API-NEXT PATCHv5] api: init: removed platform_init struct definition
odp_platform_init defination in standard API will conflict with platform specific defination. better to keep it in the linux-generic or other platform init header file Signed-off-by: Hemant Agrawal --- include/odp/api/init.h | 3 +-- platform/linux-generic/Makefile.am | 1 + platform/linux-generic/include/odp/init.h | 2 ++ .../linux-generic/include/odp/plat/init_types.h| 30 ++ 4 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 platform/linux-generic/include/odp/plat/init_types.h diff --git a/include/odp/api/init.h b/include/odp/api/init.h index 737ff6d..b11f642 100644 --- a/include/odp/api/init.h +++ b/include/odp/api/init.h @@ -125,6 +125,7 @@ typedef struct odp_init_t { } odp_init_t; /** + * @typedef odp_platform_init_t * ODP platform initialization data * * @note ODP API does nothing with this data. It is the underlying @@ -132,8 +133,6 @@ typedef struct odp_init_t { * It is required that the application takes care of identifying and * passing any required platform specific data. */ -typedef struct odp_platform_init_t { -} odp_platform_init_t; /** diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index 70bd8fe..d5a1f57 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -59,6 +59,7 @@ odpplatinclude_HEADERS = \ $(srcdir)/include/odp/plat/cpumask_types.h \ $(srcdir)/include/odp/plat/crypto_types.h \ $(srcdir)/include/odp/plat/event_types.h \ + $(srcdir)/include/odp/plat/init_types.h \ $(srcdir)/include/odp/plat/packet_types.h \ $(srcdir)/include/odp/plat/packet_io_types.h \ $(srcdir)/include/odp/plat/pool_types.h \ diff --git a/platform/linux-generic/include/odp/init.h b/platform/linux-generic/include/odp/init.h index 950a4f8..3233e36 100644 --- a/platform/linux-generic/include/odp/init.h +++ b/platform/linux-generic/include/odp/init.h @@ -17,6 +17,8 @@ extern "C" { #endif +#include + /** @ingroup odp_initialization * @{ */ diff --git a/platform/linux-generic/include/odp/plat/init_types.h b/platform/linux-generic/include/odp/plat/init_types.h new file mode 100644 index 000..ce33b67 --- /dev/null +++ b/platform/linux-generic/include/odp/plat/init_types.h @@ -0,0 +1,30 @@ +/* Copyright (c) 2015, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/** + * @file + * + * ODP initialization. + */ + +#ifndef ODP_INIT_TYPES_H_ +#define ODP_INIT_TYPES_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @intenal platform specific data + */ +typedef struct odp_platform_init_t { +} odp_platform_init_t; + +#ifdef __cplusplus +} +#endif + +#endif -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCH v3] helper: linux: add thread type in pthread_create
The exisiting helper routine only create the worker threads. However there is a need to use the same for creating the control thread as well. e.g. CLI thread. Signed-off-by: Hemant Agrawal --- example/classifier/odp_classifier.c | 2 +- example/generator/odp_generator.c | 9 ++--- example/ipsec/odp_ipsec.c | 2 +- example/packet/odp_pktio.c| 3 ++- example/timer/odp_timer_test.c| 2 +- helper/include/odp/helper/linux.h | 5 - helper/linux.c| 6 -- helper/test/odp_thread.c | 3 ++- test/api_test/odp_common.c| 2 +- test/performance/odp_atomic.c | 2 +- test/performance/odp_l2fwd.c | 3 ++- test/performance/odp_pktio_perf.c | 4 ++-- test/performance/odp_scheduling.c | 2 +- test/validation/common/odp_cunit_common.c | 2 +- 14 files changed, 29 insertions(+), 18 deletions(-) diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c index 0da07e7..00da68a 100644 --- a/example/classifier/odp_classifier.c +++ b/example/classifier/odp_classifier.c @@ -593,7 +593,7 @@ int main(int argc, char *argv[]) odp_cpumask_set(&thd_mask, cpu); odph_linux_pthread_create(&thread_tbl[i], &thd_mask, pktio_receive_thread, - args); + args, ODP_THREAD_WORKER); cpu = odp_cpumask_next(&cpumask, cpu); } diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index 2de530d..93eefe9 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -784,7 +784,8 @@ int main(int argc, char *argv[]) abort(); args->thread[1].mode = args->appl.mode; odph_linux_pthread_create(&thread_tbl[1], &cpu_mask, - gen_recv_thread, &args->thread[1]); + gen_recv_thread, &args->thread[1], + ODP_THREAD_WORKER); tq = odp_queue_create("", ODP_QUEUE_TYPE_POLL, NULL); if (tq == ODP_QUEUE_INVALID) @@ -804,7 +805,8 @@ int main(int argc, char *argv[]) odp_cpumask_zero(&cpu_mask); odp_cpumask_set(&cpu_mask, cpu_next); odph_linux_pthread_create(&thread_tbl[0], &cpu_mask, - gen_send_thread, &args->thread[0]); + gen_send_thread, &args->thread[0], + ODP_THREAD_WORKER); } else { int cpu = odp_cpumask_first(&cpumask); @@ -849,7 +851,8 @@ int main(int argc, char *argv[]) odph_linux_pthread_create(&thread_tbl[i], &thd_mask, thr_run_func, - &args->thread[i]); + &args->thread[i], + ODP_THREAD_WORKER); cpu = odp_cpumask_next(&cpumask, cpu); } diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index d784c31..88e73ff 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -1333,7 +1333,7 @@ main(int argc, char *argv[]) * Create and init worker threads */ odph_linux_pthread_create(thread_tbl, &cpumask, - pktio_thread, NULL); + pktio_thread, NULL, ODP_THREAD_WORKER); /* * If there are streams attempt to verify them else diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c index 93c38f5..75e92ac 100644 --- a/example/packet/odp_pktio.c +++ b/example/packet/odp_pktio.c @@ -442,7 +442,8 @@ int main(int argc, char *argv[]) odp_cpumask_set(&thd_mask, cpu); odph_linux_pthread_create(&thread_tbl[i], &thd_mask, thr_run_func, - &args->thread[i]); + &args->thread[i], + ODP_THREAD_WORKER); cpu = odp_cpumask_next(&cpumask, cpu); } diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c index 0ec73b1..bd05ce4 100644 --- a/example/timer/odp_timer_test.c +++ b/example/timer/odp_timer_test.c @@ -479,7 +479,7 @@ int main(int argc, char *argv[]) /* Create and launch worker threads */ odp
[lng-odp] [PATCH v2 5/6] test:performance:update the thread create proto
Updating the prototype for odph_linux_pthread_create Signed-off-by: Hemant Agrawal --- test/performance/odp_atomic.c | 2 +- test/performance/odp_l2fwd.c | 3 ++- test/performance/odp_pktio_perf.c | 4 ++-- test/performance/odp_scheduling.c | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/test/performance/odp_atomic.c b/test/performance/odp_atomic.c index 1402a0c..054f653 100644 --- a/test/performance/odp_atomic.c +++ b/test/performance/odp_atomic.c @@ -286,7 +286,7 @@ int odp_test_thread_create(void *func_ptr(void *), pthrd_arg *arg) /* Create and init additional threads */ odp_cpumask_default_worker(&cpumask, arg->numthrds); odph_linux_pthread_create(thread_tbl, &cpumask, func_ptr, - (void *)arg); + (void *)arg, ODP_THREAD_WORKER); return 0; } diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c index 3941c50..481fb01 100644 --- a/test/performance/odp_l2fwd.c +++ b/test/performance/odp_l2fwd.c @@ -598,7 +598,8 @@ int main(int argc, char *argv[]) odp_cpumask_set(&thd_mask, cpu); odph_linux_pthread_create(&thread_tbl[i], &thd_mask, thr_run_func, - &gbl_args->thread[i]); + &gbl_args->thread[i], + ODP_THREAD_WORKER); cpu = odp_cpumask_next(&cpumask, cpu); } diff --git a/test/performance/odp_pktio_perf.c b/test/performance/odp_pktio_perf.c index ffe9844..82dcf19 100644 --- a/test/performance/odp_pktio_perf.c +++ b/test/performance/odp_pktio_perf.c @@ -629,7 +629,7 @@ static int run_test_single(odp_cpumask_t *thd_mask_tx, /* start receiver threads first */ args_rx.batch_len = gbl_args->args.rx_batch_len; odph_linux_pthread_create(&thd_tbl[0], thd_mask_rx, - run_thread_rx, &args_rx); + run_thread_rx, &args_rx, ODP_THREAD_WORKER); odp_barrier_wait(&gbl_args->rx_barrier); num_rx_workers = odp_cpumask_count(thd_mask_rx); @@ -639,7 +639,7 @@ static int run_test_single(odp_cpumask_t *thd_mask_tx, args_tx.duration = gbl_args->args.duration; args_tx.batch_len = gbl_args->args.tx_batch_len; odph_linux_pthread_create(&thd_tbl[num_rx_workers], thd_mask_tx, - run_thread_tx, &args_tx); + run_thread_tx, &args_tx, ODP_THREAD_WORKER); odp_barrier_wait(&gbl_args->tx_barrier); /* wait for transmitter threads to terminate */ diff --git a/test/performance/odp_scheduling.c b/test/performance/odp_scheduling.c index cb865b3..971d19b 100644 --- a/test/performance/odp_scheduling.c +++ b/test/performance/odp_scheduling.c @@ -995,7 +995,7 @@ int main(int argc, char *argv[]) } else { /* Create and launch worker threads */ odph_linux_pthread_create(thread_tbl, &cpumask, - run_thread, NULL); + run_thread, NULL, ODP_THREAD_WORKER); /* Wait for worker threads to terminate */ odph_linux_pthread_join(thread_tbl, num_workers); -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCH v2 6/6] test:validation:common: update the thread create
Updating the prototype for odph_linux_pthread_create Signed-off-by: Hemant Agrawal --- test/validation/common/odp_cunit_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/validation/common/odp_cunit_common.c b/test/validation/common/odp_cunit_common.c index bc786ec..a886f10 100644 --- a/test/validation/common/odp_cunit_common.c +++ b/test/validation/common/odp_cunit_common.c @@ -33,7 +33,7 @@ int odp_cunit_thread_create(void *func_ptr(void *), pthrd_arg *arg) odp_cpumask_default_worker(&cpumask, arg->numthrds); return odph_linux_pthread_create(thread_tbl, &cpumask, func_ptr, -(void *)arg); +(void *)arg, ODP_THREAD_WORKER); } /** exit from test thread */ -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCH v2 3/6] helper:test:update the prototype for thread create
Updating the prototype for odph_linux_pthread_create Signed-off-by: Hemant Agrawal --- helper/test/odp_thread.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/helper/test/odp_thread.c b/helper/test/odp_thread.c index 592f856..65b5778 100644 --- a/helper/test/odp_thread.c +++ b/helper/test/odp_thread.c @@ -61,7 +61,8 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) printf("new cpu mask: %s\n", cpumaskstr); printf("new num worker threads: %i\n\n", num_workers); - odph_linux_pthread_create(&thread_tbl[0], &cpu_mask, worker_fn, NULL); + odph_linux_pthread_create(&thread_tbl[0], &cpu_mask, worker_fn, NULL, + ODP_THREAD_WORKER); odph_linux_pthread_join(thread_tbl, num_workers); -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCH v2 4/6] test:api_test:update the thread create prototype
Updating the prototype for odph_linux_pthread_create Signed-off-by: Hemant Agrawal --- test/api_test/odp_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/api_test/odp_common.c b/test/api_test/odp_common.c index 681d915..cebaa12 100644 --- a/test/api_test/odp_common.c +++ b/test/api_test/odp_common.c @@ -76,7 +76,7 @@ int odp_test_thread_create(void *func_ptr(void *), pthrd_arg *arg) /* Create and init additional threads */ odp_cpumask_default_worker(&cpumask, arg->numthrds); odph_linux_pthread_create(thread_tbl, &cpumask, func_ptr, - (void *)arg); + (void *)arg, ODP_THREAD_WORKER); return 0; } -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCH v2 2/6] example: update the prototype for thread create
Updating the prototype for odph_linux_pthread_create Signed-off-by: Hemant Agrawal --- example/classifier/odp_classifier.c | 2 +- example/generator/odp_generator.c | 9 ++--- example/ipsec/odp_ipsec.c | 2 +- example/packet/odp_pktio.c | 3 ++- example/timer/odp_timer_test.c | 2 +- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c index 81e6bf0..6cf4596 100644 --- a/example/classifier/odp_classifier.c +++ b/example/classifier/odp_classifier.c @@ -533,7 +533,7 @@ int main(int argc, char *argv[]) odp_cpumask_set(&thd_mask, cpu); odph_linux_pthread_create(&thread_tbl[i], &thd_mask, pktio_receive_thread, - args); + args, ODP_THREAD_WORKER); cpu = odp_cpumask_next(&cpumask, cpu); } diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index 01807a0..f156497 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -784,7 +784,8 @@ int main(int argc, char *argv[]) abort(); args->thread[1].mode = args->appl.mode; odph_linux_pthread_create(&thread_tbl[1], &cpu_mask, - gen_recv_thread, &args->thread[1]); + gen_recv_thread, &args->thread[1], + ODP_THREAD_WORKER); tq = odp_queue_create("", ODP_QUEUE_TYPE_POLL, NULL); if (tq == ODP_QUEUE_INVALID) @@ -804,7 +805,8 @@ int main(int argc, char *argv[]) odp_cpumask_zero(&cpu_mask); odp_cpumask_set(&cpu_mask, cpu_next); odph_linux_pthread_create(&thread_tbl[0], &cpu_mask, - gen_send_thread, &args->thread[0]); + gen_send_thread, &args->thread[0], + ODP_THREAD_WORKER); } else { int cpu = odp_cpumask_first(&cpumask); @@ -849,7 +851,8 @@ int main(int argc, char *argv[]) odph_linux_pthread_create(&thread_tbl[i], &thd_mask, thr_run_func, - &args->thread[i]); + &args->thread[i], + ODP_THREAD_WORKER); cpu = odp_cpumask_next(&cpumask, cpu); } diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index f0ff2c9..fab1035 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -1333,7 +1333,7 @@ main(int argc, char *argv[]) * Create and init worker threads */ odph_linux_pthread_create(thread_tbl, &cpumask, - pktio_thread, NULL); + pktio_thread, NULL, ODP_THREAD_WORKER); /* * If there are streams attempt to verify them else diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c index 239c1b0..c42331b 100644 --- a/example/packet/odp_pktio.c +++ b/example/packet/odp_pktio.c @@ -442,7 +442,8 @@ int main(int argc, char *argv[]) odp_cpumask_set(&thd_mask, cpu); odph_linux_pthread_create(&thread_tbl[i], &thd_mask, thr_run_func, - &args->thread[i]); + &args->thread[i], + ODP_THREAD_WORKER); cpu = odp_cpumask_next(&cpumask, cpu); } diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c index 8796b66..b7a4fd2 100644 --- a/example/timer/odp_timer_test.c +++ b/example/timer/odp_timer_test.c @@ -479,7 +479,7 @@ int main(int argc, char *argv[]) /* Create and launch worker threads */ odph_linux_pthread_create(thread_tbl, &cpumask, - run_thread, gbls); + run_thread, gbls, ODP_THREAD_WORKER); /* Wait for worker threads to exit */ odph_linux_pthread_join(thread_tbl, num_workers); -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCH v2 1/6] linux:add thread type in odph_linux_pthread_create
The exisiting helper routine only create the worker threads. However there is a need to use the same for creating the control thread as well. e.g. CLI thread. Signed-off-by: Hemant Agrawal --- helper/include/odp/helper/linux.h | 5 - helper/linux.c| 6 -- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/helper/include/odp/helper/linux.h b/helper/include/odp/helper/linux.h index ce61fdf..16b5c65 100644 --- a/helper/include/odp/helper/linux.h +++ b/helper/include/odp/helper/linux.h @@ -31,6 +31,7 @@ extern "C" { typedef struct { void *(*start_routine) (void *); /**< The function to run */ void *arg; /**< The functions arguemnts */ + odp_thread_type_t thr_type; /**< The thread type */ } odp_start_args_t; /** Linux pthread state information */ @@ -59,12 +60,14 @@ typedef struct { * @param mask CPU mask * @param start_routine Thread start function * @param arg Thread argument + * @param thr_type Thread type * * @return Number of threads created */ int odph_linux_pthread_create(odph_linux_pthread_t *thread_tbl, const odp_cpumask_t *mask, - void *(*start_routine) (void *), void *arg); + void *(*start_routine) (void *), void *arg, + odp_thread_type_t thr_type); /** * Waits pthreads to exit diff --git a/helper/linux.c b/helper/linux.c index 4a8e8b3..7904d5c 100644 --- a/helper/linux.c +++ b/helper/linux.c @@ -28,7 +28,7 @@ static void *odp_run_start_routine(void *arg) odp_start_args_t *start_args = arg; /* ODP thread local init */ - if (odp_init_local(ODP_THREAD_WORKER)) { + if (odp_init_local(start_args->thr_type)) { ODPH_ERR("Local init failed\n"); return NULL; } @@ -46,7 +46,8 @@ static void *odp_run_start_routine(void *arg) int odph_linux_pthread_create(odph_linux_pthread_t *thread_tbl, const odp_cpumask_t *mask_in, - void *(*start_routine)(void *), void *arg) + void *(*start_routine)(void *), void *arg, + odp_thread_type_t thr_type) { int i; int num; @@ -88,6 +89,7 @@ int odph_linux_pthread_create(odph_linux_pthread_t *thread_tbl, thread_tbl[i].start_args->start_routine = start_routine; thread_tbl[i].start_args->arg = arg; + thread_tbl[i].start_args->thr_type = thr_type; ret = pthread_create(&thread_tbl[i].thread, &thread_tbl[i].attr, -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [API-NEXT PATCHv4 1/2] linux-generic:adding the platform_init structure
odp_platform_init structure is platform specific data, it is up to the platform specific implementation to define it. Signed-off-by: Hemant Agrawal --- platform/linux-generic/Makefile.am | 1 + platform/linux-generic/include/odp/init.h | 2 ++ .../linux-generic/include/odp/plat/init_types.h| 30 ++ 3 files changed, 33 insertions(+) create mode 100644 platform/linux-generic/include/odp/plat/init_types.h diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index 70bd8fe..d5a1f57 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -59,6 +59,7 @@ odpplatinclude_HEADERS = \ $(srcdir)/include/odp/plat/cpumask_types.h \ $(srcdir)/include/odp/plat/crypto_types.h \ $(srcdir)/include/odp/plat/event_types.h \ + $(srcdir)/include/odp/plat/init_types.h \ $(srcdir)/include/odp/plat/packet_types.h \ $(srcdir)/include/odp/plat/packet_io_types.h \ $(srcdir)/include/odp/plat/pool_types.h \ diff --git a/platform/linux-generic/include/odp/init.h b/platform/linux-generic/include/odp/init.h index 950a4f8..3233e36 100644 --- a/platform/linux-generic/include/odp/init.h +++ b/platform/linux-generic/include/odp/init.h @@ -17,6 +17,8 @@ extern "C" { #endif +#include + /** @ingroup odp_initialization * @{ */ diff --git a/platform/linux-generic/include/odp/plat/init_types.h b/platform/linux-generic/include/odp/plat/init_types.h new file mode 100644 index 000..ce33b67 --- /dev/null +++ b/platform/linux-generic/include/odp/plat/init_types.h @@ -0,0 +1,30 @@ +/* Copyright (c) 2015, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/** + * @file + * + * ODP initialization. + */ + +#ifndef ODP_INIT_TYPES_H_ +#define ODP_INIT_TYPES_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @intenal platform specific init data + */ +typedef struct odp_platform_init_t { +} odp_platform_init_t; + +#ifdef __cplusplus +} +#endif + +#endif -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [API-NEXT PATCHv4 2/2] api: init: removed platform_init struct definition
odp_platform_init defination in standard API will conflict with platform specific defination. better to keep it in the linux-generic or other platform init header file Signed-off-by: Hemant Agrawal --- include/odp/api/init.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/odp/api/init.h b/include/odp/api/init.h index 737ff6d..b11f642 100644 --- a/include/odp/api/init.h +++ b/include/odp/api/init.h @@ -125,6 +125,7 @@ typedef struct odp_init_t { } odp_init_t; /** + * @typedef odp_platform_init_t * ODP platform initialization data * * @note ODP API does nothing with this data. It is the underlying @@ -132,8 +133,6 @@ typedef struct odp_init_t { * It is required that the application takes care of identifying and * passing any required platform specific data. */ -typedef struct odp_platform_init_t { -} odp_platform_init_t; /** -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [API-NEXT PATCHv3 2/2] api: init: removed platform_init struct definition
odp_platform_init defination in standard API will conflict with platform specific defination. better to keep it in the linux-generic or other platform init header file Signed-off-by: Hemant Agrawal --- include/odp/api/init.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/odp/api/init.h b/include/odp/api/init.h index 737ff6d..b11f642 100644 --- a/include/odp/api/init.h +++ b/include/odp/api/init.h @@ -125,6 +125,7 @@ typedef struct odp_init_t { } odp_init_t; /** + * @typedef odp_platform_init_t * ODP platform initialization data * * @note ODP API does nothing with this data. It is the underlying @@ -132,8 +133,6 @@ typedef struct odp_init_t { * It is required that the application takes care of identifying and * passing any required platform specific data. */ -typedef struct odp_platform_init_t { -} odp_platform_init_t; /** -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [API-NEXT PATCHv3 1/2] linux-generic: add the platform_init structure
odp_platform_init structure is platform specific data, it is up to the platform specific implementation to define it. Signed-off-by: Hemant Agrawal --- platform/linux-generic/include/odp/init.h | 2 ++ .../linux-generic/include/odp/plat/init_types.h| 35 ++ 2 files changed, 37 insertions(+) create mode 100644 platform/linux-generic/include/odp/plat/init_types.h diff --git a/platform/linux-generic/include/odp/init.h b/platform/linux-generic/include/odp/init.h index 950a4f8..3233e36 100644 --- a/platform/linux-generic/include/odp/init.h +++ b/platform/linux-generic/include/odp/init.h @@ -17,6 +17,8 @@ extern "C" { #endif +#include + /** @ingroup odp_initialization * @{ */ diff --git a/platform/linux-generic/include/odp/plat/init_types.h b/platform/linux-generic/include/odp/plat/init_types.h new file mode 100644 index 000..abcbe83 --- /dev/null +++ b/platform/linux-generic/include/odp/plat/init_types.h @@ -0,0 +1,35 @@ +/* Copyright (c) 2015, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/** + * @file + * + * ODP initialization. + */ + +#ifndef ODP_INIT_TYPES_H_ +#define ODP_INIT_TYPES_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * ODP platform initialization data + * + * @note ODP API does nothing with this data. It is the underlying + * implementation that requires it and any data passed here is not portable. + * It is required that the application takes care of identifying and + * passing any required platform specific data. + */ +typedef struct odp_platform_init_t { +} odp_platform_init_t; + +#ifdef __cplusplus +} +#endif + +#endif -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [API-NEXT PATCHv2 2/2] api:removing-the-platform_init-defination
odp_plaform_init defination in standard API will conflict with platform specific defination. better to keep it in the linux-generic or other platform init header file Signed-off-by: Hemant Agrawal --- include/odp/api/init.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/include/odp/api/init.h b/include/odp/api/init.h index 4ac5216..199c504 100644 --- a/include/odp/api/init.h +++ b/include/odp/api/init.h @@ -132,9 +132,6 @@ typedef struct odp_init_t { * It is required that the application takes care of identifying and * passing any required platform specific data. */ -typedef struct odp_platform_init_t { -} odp_platform_init_t; - /** * Global ODP initialization -- 1.8.2.1 ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [API-NEXT PATCHv2 1/2] linux-generic:adding the platform_init structure
odp_platform_init structure is platform specific data, it is up to the platform specific implementation to define it. Signed-off-by: Hemant Agrawal --- platform/linux-generic/include/odp/init.h | 11 +++ 1 file changed, 11 insertions(+) diff --git a/platform/linux-generic/include/odp/init.h b/platform/linux-generic/include/odp/init.h index 950a4f8..afa543c 100644 --- a/platform/linux-generic/include/odp/init.h +++ b/platform/linux-generic/include/odp/init.h @@ -22,6 +22,17 @@ extern "C" { */ /** + * ODP platform initialization data + * + * @note ODP API does nothing with this data. It is the underlying + * implementation that requires it and any data passed here is not portable. + * It is required that the application takes care of identifying and + * passing any required platform specific data. + */ +typedef struct odp_platform_init_t { +} odp_platform_init_t; + +/** * @} */ -- 1.8.2.1 ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCH 1/2] linux-generic:adding the platform_init structure
odp_platform_init structure is platform specific data, it is up to the platform specific implementation to define it. Signed-off-by: Hemant Agrawal --- platform/linux-generic/include/odp/init.h | 11 +++ 1 file changed, 11 insertions(+) diff --git a/platform/linux-generic/include/odp/init.h b/platform/linux-generic/include/odp/init.h index 950a4f8..afa543c 100644 --- a/platform/linux-generic/include/odp/init.h +++ b/platform/linux-generic/include/odp/init.h @@ -22,6 +22,17 @@ extern "C" { */ /** + * ODP platform initialization data + * + * @note ODP API does nothing with this data. It is the underlying + * implementation that requires it and any data passed here is not portable. + * It is required that the application takes care of identifying and + * passing any required platform specific data. + */ +typedef struct odp_platform_init_t { +} odp_platform_init_t; + +/** * @} */ -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCH 2/2] api: removing the platform_init defination
odp_plaform_init defination in standard API will conflict with platform specific defination. better to keep it in the linux-generic or other platform init header file. Signed-off-by: Hemant Agrawal --- include/odp/api/init.h | 12 1 file changed, 12 deletions(-) diff --git a/include/odp/api/init.h b/include/odp/api/init.h index 737ff6d..cf92f38 100644 --- a/include/odp/api/init.h +++ b/include/odp/api/init.h @@ -125,18 +125,6 @@ typedef struct odp_init_t { } odp_init_t; /** - * ODP platform initialization data - * - * @note ODP API does nothing with this data. It is the underlying - * implementation that requires it and any data passed here is not portable. - * It is required that the application takes care of identifying and - * passing any required platform specific data. - */ -typedef struct odp_platform_init_t { -} odp_platform_init_t; - - -/** * Global ODP initialization * * This function must be called once before calling any other ODP API -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCH 2/6] example: update the prototype for thread create
Updating the prototype for odph_linux_pthread_create Signed-off-by: Hemant Agrawal --- example/classifier/odp_classifier.c | 2 +- example/generator/odp_generator.c | 9 ++--- example/ipsec/odp_ipsec.c | 2 +- example/packet/odp_pktio.c | 3 ++- example/timer/odp_timer_test.c | 2 +- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c index 81e6bf0..6cf4596 100644 --- a/example/classifier/odp_classifier.c +++ b/example/classifier/odp_classifier.c @@ -533,7 +533,7 @@ int main(int argc, char *argv[]) odp_cpumask_set(&thd_mask, cpu); odph_linux_pthread_create(&thread_tbl[i], &thd_mask, pktio_receive_thread, - args); + args, ODP_THREAD_WORKER); cpu = odp_cpumask_next(&cpumask, cpu); } diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index 01807a0..f156497 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -784,7 +784,8 @@ int main(int argc, char *argv[]) abort(); args->thread[1].mode = args->appl.mode; odph_linux_pthread_create(&thread_tbl[1], &cpu_mask, - gen_recv_thread, &args->thread[1]); + gen_recv_thread, &args->thread[1], + ODP_THREAD_WORKER); tq = odp_queue_create("", ODP_QUEUE_TYPE_POLL, NULL); if (tq == ODP_QUEUE_INVALID) @@ -804,7 +805,8 @@ int main(int argc, char *argv[]) odp_cpumask_zero(&cpu_mask); odp_cpumask_set(&cpu_mask, cpu_next); odph_linux_pthread_create(&thread_tbl[0], &cpu_mask, - gen_send_thread, &args->thread[0]); + gen_send_thread, &args->thread[0], + ODP_THREAD_WORKER); } else { int cpu = odp_cpumask_first(&cpumask); @@ -849,7 +851,8 @@ int main(int argc, char *argv[]) odph_linux_pthread_create(&thread_tbl[i], &thd_mask, thr_run_func, - &args->thread[i]); + &args->thread[i], + ODP_THREAD_WORKER); cpu = odp_cpumask_next(&cpumask, cpu); } diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index f0ff2c9..fab1035 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -1333,7 +1333,7 @@ main(int argc, char *argv[]) * Create and init worker threads */ odph_linux_pthread_create(thread_tbl, &cpumask, - pktio_thread, NULL); + pktio_thread, NULL, ODP_THREAD_WORKER); /* * If there are streams attempt to verify them else diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c index 239c1b0..c42331b 100644 --- a/example/packet/odp_pktio.c +++ b/example/packet/odp_pktio.c @@ -442,7 +442,8 @@ int main(int argc, char *argv[]) odp_cpumask_set(&thd_mask, cpu); odph_linux_pthread_create(&thread_tbl[i], &thd_mask, thr_run_func, - &args->thread[i]); + &args->thread[i], + ODP_THREAD_WORKER); cpu = odp_cpumask_next(&cpumask, cpu); } diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c index 8796b66..b7a4fd2 100644 --- a/example/timer/odp_timer_test.c +++ b/example/timer/odp_timer_test.c @@ -479,7 +479,7 @@ int main(int argc, char *argv[]) /* Create and launch worker threads */ odph_linux_pthread_create(thread_tbl, &cpumask, - run_thread, gbls); + run_thread, gbls, ODP_THREAD_WORKER); /* Wait for worker threads to exit */ odph_linux_pthread_join(thread_tbl, num_workers); -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCH 5/6] test:performance:update the thread create proto
Updating the prototype for odph_linux_pthread_create Signed-off-by: Hemant Agrawal --- test/performance/odp_atomic.c | 2 +- test/performance/odp_l2fwd.c | 3 ++- test/performance/odp_pktio_perf.c | 4 ++-- test/performance/odp_scheduling.c | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/test/performance/odp_atomic.c b/test/performance/odp_atomic.c index 1402a0c..054f653 100644 --- a/test/performance/odp_atomic.c +++ b/test/performance/odp_atomic.c @@ -286,7 +286,7 @@ int odp_test_thread_create(void *func_ptr(void *), pthrd_arg *arg) /* Create and init additional threads */ odp_cpumask_default_worker(&cpumask, arg->numthrds); odph_linux_pthread_create(thread_tbl, &cpumask, func_ptr, - (void *)arg); + (void *)arg, ODP_THREAD_WORKER); return 0; } diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c index 3941c50..481fb01 100644 --- a/test/performance/odp_l2fwd.c +++ b/test/performance/odp_l2fwd.c @@ -598,7 +598,8 @@ int main(int argc, char *argv[]) odp_cpumask_set(&thd_mask, cpu); odph_linux_pthread_create(&thread_tbl[i], &thd_mask, thr_run_func, - &gbl_args->thread[i]); + &gbl_args->thread[i], + ODP_THREAD_WORKER); cpu = odp_cpumask_next(&cpumask, cpu); } diff --git a/test/performance/odp_pktio_perf.c b/test/performance/odp_pktio_perf.c index ffe9844..82dcf19 100644 --- a/test/performance/odp_pktio_perf.c +++ b/test/performance/odp_pktio_perf.c @@ -629,7 +629,7 @@ static int run_test_single(odp_cpumask_t *thd_mask_tx, /* start receiver threads first */ args_rx.batch_len = gbl_args->args.rx_batch_len; odph_linux_pthread_create(&thd_tbl[0], thd_mask_rx, - run_thread_rx, &args_rx); + run_thread_rx, &args_rx, ODP_THREAD_WORKER); odp_barrier_wait(&gbl_args->rx_barrier); num_rx_workers = odp_cpumask_count(thd_mask_rx); @@ -639,7 +639,7 @@ static int run_test_single(odp_cpumask_t *thd_mask_tx, args_tx.duration = gbl_args->args.duration; args_tx.batch_len = gbl_args->args.tx_batch_len; odph_linux_pthread_create(&thd_tbl[num_rx_workers], thd_mask_tx, - run_thread_tx, &args_tx); + run_thread_tx, &args_tx, ODP_THREAD_WORKER); odp_barrier_wait(&gbl_args->tx_barrier); /* wait for transmitter threads to terminate */ diff --git a/test/performance/odp_scheduling.c b/test/performance/odp_scheduling.c index cb865b3..971d19b 100644 --- a/test/performance/odp_scheduling.c +++ b/test/performance/odp_scheduling.c @@ -995,7 +995,7 @@ int main(int argc, char *argv[]) } else { /* Create and launch worker threads */ odph_linux_pthread_create(thread_tbl, &cpumask, - run_thread, NULL); + run_thread, NULL, ODP_THREAD_WORKER); /* Wait for worker threads to terminate */ odph_linux_pthread_join(thread_tbl, num_workers); -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCH 6/6] test:validation:common: update the thread create
Updating the prototype for odph_linux_pthread_create Signed-off-by: Hemant Agrawal --- test/validation/common/odp_cunit_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/validation/common/odp_cunit_common.c b/test/validation/common/odp_cunit_common.c index bc786ec..a886f10 100644 --- a/test/validation/common/odp_cunit_common.c +++ b/test/validation/common/odp_cunit_common.c @@ -33,7 +33,7 @@ int odp_cunit_thread_create(void *func_ptr(void *), pthrd_arg *arg) odp_cpumask_default_worker(&cpumask, arg->numthrds); return odph_linux_pthread_create(thread_tbl, &cpumask, func_ptr, -(void *)arg); +(void *)arg, ODP_THREAD_WORKER); } /** exit from test thread */ -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCH 1/6] linux:add thread type in odph_linux_pthread_create
The exisiting helper routine only create the worker threads. However there is a need to use the same for creating the control thread as well. e.g. CLI thread. Signed-off-by: Hemant Agrawal --- helper/include/odp/helper/linux.h | 4 +++- helper/linux.c| 31 +++ 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/helper/include/odp/helper/linux.h b/helper/include/odp/helper/linux.h index ce61fdf..72f8f10 100644 --- a/helper/include/odp/helper/linux.h +++ b/helper/include/odp/helper/linux.h @@ -59,12 +59,14 @@ typedef struct { * @param mask CPU mask * @param start_routine Thread start function * @param arg Thread argument + * @param thr_type Thread type * * @return Number of threads created */ int odph_linux_pthread_create(odph_linux_pthread_t *thread_tbl, const odp_cpumask_t *mask, - void *(*start_routine) (void *), void *arg); + void *(*start_routine) (void *), void *arg, + odp_thread_type_t thr_type); /** * Waits pthreads to exit diff --git a/helper/linux.c b/helper/linux.c index 4a8e8b3..497bd8c 100644 --- a/helper/linux.c +++ b/helper/linux.c @@ -44,9 +44,31 @@ static void *odp_run_start_routine(void *arg) return ret_ptr; } +static void *odp_run_start_contorl_routine(void *arg) +{ + odp_start_args_t *start_args = arg; + + /* ODP thread local init for control thread */ + if (odp_init_local(ODP_THREAD_CONTROL)) { + ODPH_ERR("Local init failed for control\n"); + return NULL; + } + + void *ret_ptr = start_args->start_routine(start_args->arg); + int ret = odp_term_local(); + + if (ret < 0) + ODPH_ERR("Local term failed for control\n"); + else if (ret == 0 && odp_term_global()) + ODPH_ERR("Global term failed for control\n"); + + return ret_ptr; +} + int odph_linux_pthread_create(odph_linux_pthread_t *thread_tbl, const odp_cpumask_t *mask_in, - void *(*start_routine)(void *), void *arg) + void *(*start_routine)(void *), void *arg, + odp_thread_type_t thr_type) { int i; int num; @@ -90,9 +112,10 @@ int odph_linux_pthread_create(odph_linux_pthread_t *thread_tbl, thread_tbl[i].start_args->arg = arg; ret = pthread_create(&thread_tbl[i].thread, -&thread_tbl[i].attr, -odp_run_start_routine, -thread_tbl[i].start_args); + &thread_tbl[i].attr, + thr_type == ODP_THREAD_WORKER ? + odp_run_start_routine : odp_run_start_contorl_routine, + thread_tbl[i].start_args); if (ret != 0) { ODPH_ERR("Failed to start thread on cpu #%d\n", cpu); free(thread_tbl[i].start_args); -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCH 4/6] test:api_test:update the thread create prototype
Updating the prototype for odph_linux_pthread_create Signed-off-by: Hemant Agrawal --- test/api_test/odp_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/api_test/odp_common.c b/test/api_test/odp_common.c index 681d915..cebaa12 100644 --- a/test/api_test/odp_common.c +++ b/test/api_test/odp_common.c @@ -76,7 +76,7 @@ int odp_test_thread_create(void *func_ptr(void *), pthrd_arg *arg) /* Create and init additional threads */ odp_cpumask_default_worker(&cpumask, arg->numthrds); odph_linux_pthread_create(thread_tbl, &cpumask, func_ptr, - (void *)arg); + (void *)arg, ODP_THREAD_WORKER); return 0; } -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp
[lng-odp] [PATCH 3/6] helper:test:update the prototype for thread create
Updating the prototype for odph_linux_pthread_create Signed-off-by: Hemant Agrawal --- helper/test/odp_thread.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/helper/test/odp_thread.c b/helper/test/odp_thread.c index 592f856..65b5778 100644 --- a/helper/test/odp_thread.c +++ b/helper/test/odp_thread.c @@ -61,7 +61,8 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) printf("new cpu mask: %s\n", cpumaskstr); printf("new num worker threads: %i\n\n", num_workers); - odph_linux_pthread_create(&thread_tbl[0], &cpu_mask, worker_fn, NULL); + odph_linux_pthread_create(&thread_tbl[0], &cpu_mask, worker_fn, NULL, + ODP_THREAD_WORKER); odph_linux_pthread_join(thread_tbl, num_workers); -- 1.9.1 ___ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp