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 a45047e728ca1cc0c97e0201eb9900daae5730b6 (commit) via 11a190a3909c06c7c2042826e6a96d2396cd4428 (commit) via 5062afae2d8dc38c1f7db8b089d22fcc9ed17fb2 (commit) via 88aff57e9b06af8919aaa01b548813f0828f9af0 (commit) via 3e7aa57be6450ed30b2e1706d3dbf9658eabf185 (commit) via f20eb25eb2300884170900c265c845740b8b51c6 (commit) from 86b4f6a67ce8c167ae960978fdb0e43e4a870c2d (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 a45047e728ca1cc0c97e0201eb9900daae5730b6 Author: Petri Savolainen petri.savolainen@nokia.com Date: Tue Apr 16 11:04:42 2019 +0300
api: update version number to 1.21.3
Update version number to reflect init API text modifications.
Signed-off-by: Petri Savolainen petri.savolainen@nokia.com Reviewed-by: Matias Elo matias.elo@nokia.com
diff --git a/configure.ac b/configure.ac index 878110ab2..ae135261e 100644 --- a/configure.ac +++ b/configure.ac @@ -4,7 +4,7 @@ AC_PREREQ([2.5]) ########################################################################## m4_define([odpapi_generation_version], [1]) m4_define([odpapi_major_version], [21]) -m4_define([odpapi_minor_version], [2]) +m4_define([odpapi_minor_version], [3]) m4_define([odpapi_point_version], [0]) m4_define([odpapi_version], [odpapi_generation_version.odpapi_major_version.odpapi_minor_version.odpapi_point_version])
commit 11a190a3909c06c7c2042826e6a96d2396cd4428 Author: Petri Savolainen petri.savolainen@nokia.com Date: Tue Apr 16 11:01:31 2019 +0300
validation: buffer: output test result
This test suite missed to output return value of odp_cunit_run().
Signed-off-by: Petri Savolainen petri.savolainen@nokia.com Reviewed-by: Matias Elo matias.elo@nokia.com
diff --git a/test/validation/api/buffer/buffer.c b/test/validation/api/buffer/buffer.c index e774c1b39..9f2049034 100644 --- a/test/validation/api/buffer/buffer.c +++ b/test/validation/api/buffer/buffer.c @@ -304,7 +304,7 @@ int main(int argc, char *argv[]) ret = odp_cunit_register(buffer_suites);
if (ret == 0) - odp_cunit_run(); + ret = odp_cunit_run();
return ret; }
commit 5062afae2d8dc38c1f7db8b089d22fcc9ed17fb2 Author: Petri Savolainen petri.savolainen@nokia.com Date: Tue Apr 16 10:50:53 2019 +0300
validation: init: add features test case
Added test case to set not used features flags in init parameters.
Signed-off-by: Petri Savolainen petri.savolainen@nokia.com Reviewed-by: Matias Elo matias.elo@nokia.com
diff --git a/test/validation/api/Makefile.am b/test/validation/api/Makefile.am index 8a57b254e..071499f18 100644 --- a/test/validation/api/Makefile.am +++ b/test/validation/api/Makefile.am @@ -47,6 +47,7 @@ TESTS = \ init/init_abort$(EXEEXT) \ init/init_log$(EXEEXT) \ init/init_num_thr$(EXEEXT) \ + init/init_feature$(EXEEXT) \ ipsec/ipsec_sync$(EXEEXT) \ ipsec/ipsec_async$(EXEEXT) \ ipsec/ipsec_inline_in$(EXEEXT) \ diff --git a/test/validation/api/init/.gitignore b/test/validation/api/init/.gitignore index e2f102ad0..8311f2c3f 100644 --- a/test/validation/api/init/.gitignore +++ b/test/validation/api/init/.gitignore @@ -2,3 +2,4 @@ init_defaults init_abort init_log init_num_thr +init_feature diff --git a/test/validation/api/init/Makefile.am b/test/validation/api/init/Makefile.am index 2f668504e..6c0ef301f 100644 --- a/test/validation/api/init/Makefile.am +++ b/test/validation/api/init/Makefile.am @@ -2,14 +2,16 @@ include ../Makefile.inc
# Keep init test cases in separate binaries. Some implementations may not allow # the same application process to call odp_init_global() multiple times. -test_PROGRAMS = init_defaults init_abort init_log init_num_thr +test_PROGRAMS = init_defaults init_abort init_log init_num_thr init_feature
init_defaults_CPPFLAGS = -DINIT_TEST=0 $(AM_CPPFLAGS) init_abort_CPPFLAGS = -DINIT_TEST=1 $(AM_CPPFLAGS) init_log_CPPFLAGS = -DINIT_TEST=2 $(AM_CPPFLAGS) init_num_thr_CPPFLAGS = -DINIT_TEST=3 $(AM_CPPFLAGS) +init_feature_CPPFLAGS = -DINIT_TEST=4 $(AM_CPPFLAGS)
init_defaults_SOURCES = init_main.c init_abort_SOURCES = init_main.c init_log_SOURCES = init_main.c init_num_thr_SOURCES = init_main.c +init_feature_SOURCES = init_main.c diff --git a/test/validation/api/init/init_main.c b/test/validation/api/init/init_main.c index 2fd3faf8c..742f02522 100644 --- a/test/validation/api/init/init_main.c +++ b/test/validation/api/init/init_main.c @@ -125,11 +125,41 @@ static void init_test_num_thr(void) CU_ASSERT(ret == 0); }
+static void init_test_feature(void) +{ + int ret; + odp_instance_t instance; + odp_init_t param; + + odp_init_param_init(¶m); + param.not_used.all_feat = 0; + param.not_used.feat.cls = 1; + param.not_used.feat.crypto = 1; + param.not_used.feat.ipsec = 1; + param.not_used.feat.schedule = 1; + param.not_used.feat.time = 1; + param.not_used.feat.timer = 1; + param.not_used.feat.tm = 1; + + ret = odp_init_global(&instance, ¶m, NULL); + CU_ASSERT_FATAL(ret == 0); + + ret = odp_init_local(instance, ODP_THREAD_CONTROL); + CU_ASSERT_FATAL(ret == 0); + + ret = odp_term_local(); + CU_ASSERT_FATAL(ret == 0); + + ret = odp_term_global(instance); + CU_ASSERT(ret == 0); +} + odp_testinfo_t testinfo[] = { ODP_TEST_INFO(init_test_defaults), ODP_TEST_INFO(init_test_abort), ODP_TEST_INFO(init_test_log), - ODP_TEST_INFO(init_test_num_thr) + ODP_TEST_INFO(init_test_num_thr), + ODP_TEST_INFO(init_test_feature) };
odp_testinfo_t init_suite[] = {
commit 88aff57e9b06af8919aaa01b548813f0828f9af0 Author: Petri Savolainen petri.savolainen@nokia.com Date: Mon Apr 15 14:41:31 2019 +0300
validation: init: add num threads test case
Added test case to set num_worker and num_control parameters.
Signed-off-by: Petri Savolainen petri.savolainen@nokia.com Reviewed-by: Matias Elo matias.elo@nokia.com
diff --git a/test/validation/api/Makefile.am b/test/validation/api/Makefile.am index eb8832f4f..8a57b254e 100644 --- a/test/validation/api/Makefile.am +++ b/test/validation/api/Makefile.am @@ -46,6 +46,7 @@ TESTS = \ init/init_defaults$(EXEEXT) \ init/init_abort$(EXEEXT) \ init/init_log$(EXEEXT) \ + init/init_num_thr$(EXEEXT) \ ipsec/ipsec_sync$(EXEEXT) \ ipsec/ipsec_async$(EXEEXT) \ ipsec/ipsec_inline_in$(EXEEXT) \ diff --git a/test/validation/api/init/.gitignore b/test/validation/api/init/.gitignore index 6a466ddac..e2f102ad0 100644 --- a/test/validation/api/init/.gitignore +++ b/test/validation/api/init/.gitignore @@ -1,3 +1,4 @@ init_defaults init_abort init_log +init_num_thr diff --git a/test/validation/api/init/Makefile.am b/test/validation/api/init/Makefile.am index 141420e82..2f668504e 100644 --- a/test/validation/api/init/Makefile.am +++ b/test/validation/api/init/Makefile.am @@ -2,12 +2,14 @@ include ../Makefile.inc
# Keep init test cases in separate binaries. Some implementations may not allow # the same application process to call odp_init_global() multiple times. -test_PROGRAMS = init_defaults init_abort init_log +test_PROGRAMS = init_defaults init_abort init_log init_num_thr
init_defaults_CPPFLAGS = -DINIT_TEST=0 $(AM_CPPFLAGS) init_abort_CPPFLAGS = -DINIT_TEST=1 $(AM_CPPFLAGS) init_log_CPPFLAGS = -DINIT_TEST=2 $(AM_CPPFLAGS) +init_num_thr_CPPFLAGS = -DINIT_TEST=3 $(AM_CPPFLAGS)
init_defaults_SOURCES = init_main.c init_abort_SOURCES = init_main.c init_log_SOURCES = init_main.c +init_num_thr_SOURCES = init_main.c diff --git a/test/validation/api/init/init_main.c b/test/validation/api/init/init_main.c index cce4dcac6..2fd3faf8c 100644 --- a/test/validation/api/init/init_main.c +++ b/test/validation/api/init/init_main.c @@ -99,10 +99,37 @@ static void init_test_log(void) CU_ASSERT(ret == 0); }
+static void init_test_num_thr(void) +{ + int ret; + odp_instance_t instance; + odp_init_t param; + + odp_init_param_init(¶m); + param.mem_model = ODP_MEM_MODEL_THREAD; + param.num_worker = 1; + param.num_control = 1; + param.worker_cpus = NULL; + param.control_cpus = NULL; + + ret = odp_init_global(&instance, ¶m, NULL); + CU_ASSERT_FATAL(ret == 0); + + ret = odp_init_local(instance, ODP_THREAD_WORKER); + CU_ASSERT_FATAL(ret == 0); + + ret = odp_term_local(); + CU_ASSERT_FATAL(ret == 0); + + ret = odp_term_global(instance); + CU_ASSERT(ret == 0); +} + odp_testinfo_t testinfo[] = { ODP_TEST_INFO(init_test_defaults), ODP_TEST_INFO(init_test_abort), ODP_TEST_INFO(init_test_log), + ODP_TEST_INFO(init_test_num_thr) };
odp_testinfo_t init_suite[] = {
commit 3e7aa57be6450ed30b2e1706d3dbf9658eabf185 Author: Petri Savolainen petri.savolainen@nokia.com Date: Mon Apr 15 14:25:35 2019 +0300
validation: init: remove separate files per test case
Combining all test cases into a single source file (init_main.c). Create (still) separate binaries per test case as some implementations may assume that an application process won't call odp_global_init() more than once.
Added missing local init/term calls to all test cases. Removed non-API compatible assumptions from log test: - ODP_DEBUG_PRINT is not defined in the API - API does not require odp_init_global() to output anything to the log
Signed-off-by: Petri Savolainen petri.savolainen@nokia.com Reviewed-by: Matias Elo matias.elo@nokia.com
diff --git a/doc/implementers-guide/implementers-guide.adoc b/doc/implementers-guide/implementers-guide.adoc index 36b143b9e..d25843f81 100644 --- a/doc/implementers-guide/implementers-guide.adoc +++ b/doc/implementers-guide/implementers-guide.adoc @@ -320,9 +320,7 @@ TESTS = validation/api/pktio/pktio_run.sh \ $(ALL_API_VALIDATION)/crypto/crypto_main$(EXEEXT) \ $(ALL_API_VALIDATION)/errno/errno_main$(EXEEXT) \ $(ALL_API_VALIDATION)/hash/hash_main$(EXEEXT) \ - $(ALL_API_VALIDATION)/init/init_main_ok$(EXEEXT) \ - $(ALL_API_VALIDATION)/init/init_main_abort$(EXEEXT) \ - $(ALL_API_VALIDATION)/init/init_main_log$(EXEEXT) \ + $(ALL_API_VALIDATION)/init/init_defaults$(EXEEXT) \ $(ALL_API_VALIDATION)/lock/lock_main$(EXEEXT) \ $(ALL_API_VALIDATION)/packet/packet_main$(EXEEXT) \ $(ALL_API_VALIDATION)/pool/pool_main$(EXEEXT) \ diff --git a/test/validation/api/Makefile.am b/test/validation/api/Makefile.am index 257764648..eb8832f4f 100644 --- a/test/validation/api/Makefile.am +++ b/test/validation/api/Makefile.am @@ -43,9 +43,9 @@ TESTS = \ errno/errno_main$(EXEEXT) \ event/event_main$(EXEEXT) \ hash/hash_main$(EXEEXT) \ - init/init_main_ok$(EXEEXT) \ - init/init_main_abort$(EXEEXT) \ - init/init_main_log$(EXEEXT) \ + init/init_defaults$(EXEEXT) \ + init/init_abort$(EXEEXT) \ + init/init_log$(EXEEXT) \ ipsec/ipsec_sync$(EXEEXT) \ ipsec/ipsec_async$(EXEEXT) \ ipsec/ipsec_inline_in$(EXEEXT) \ diff --git a/test/validation/api/init/.gitignore b/test/validation/api/init/.gitignore index f433708b0..6a466ddac 100644 --- a/test/validation/api/init/.gitignore +++ b/test/validation/api/init/.gitignore @@ -1,3 +1,3 @@ -init_main_abort -init_main_log -init_main_ok +init_defaults +init_abort +init_log diff --git a/test/validation/api/init/Makefile.am b/test/validation/api/init/Makefile.am index 5af2e00bc..141420e82 100644 --- a/test/validation/api/init/Makefile.am +++ b/test/validation/api/init/Makefile.am @@ -1,9 +1,13 @@ include ../Makefile.inc
-# most platforms are expected not to support multiple ODP inits -# following each other: therefore 3 separate binaries are -# created, each containing its ODP init test. -test_PROGRAMS = init_main_abort init_main_log init_main_ok -init_main_abort_SOURCES = init_main_abort.c -init_main_log_SOURCES = init_main_log.c -init_main_ok_SOURCES = init_main_ok.c +# Keep init test cases in separate binaries. Some implementations may not allow +# the same application process to call odp_init_global() multiple times. +test_PROGRAMS = init_defaults init_abort init_log + +init_defaults_CPPFLAGS = -DINIT_TEST=0 $(AM_CPPFLAGS) +init_abort_CPPFLAGS = -DINIT_TEST=1 $(AM_CPPFLAGS) +init_log_CPPFLAGS = -DINIT_TEST=2 $(AM_CPPFLAGS) + +init_defaults_SOURCES = init_main.c +init_abort_SOURCES = init_main.c +init_log_SOURCES = init_main.c diff --git a/test/validation/api/init/init_main.c b/test/validation/api/init/init_main.c new file mode 100644 index 000000000..cce4dcac6 --- /dev/null +++ b/test/validation/api/init/init_main.c @@ -0,0 +1,153 @@ +/* Copyright (c) 2015-2018, Linaro Limited + * Copyright (c) 2019, Nokia + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include "config.h" + +#include <odp_api.h> +#include <odp_cunit_common.h> + +#include <stdarg.h> +#include <stdlib.h> + +/* Replacement abort function */ +static void ODP_NORETURN my_abort_func(void) +{ + abort(); +} + +/* Replacement log function */ +ODP_PRINTF_FORMAT(2, 3) +static int my_log_func(odp_log_level_t level __attribute__((unused)), + const char *fmt, ...) +{ + va_list args; + int r; + + va_start(args, fmt); + r = vfprintf(stderr, fmt, args); + va_end(args); + + return r; +} + +static void init_test_defaults(void) +{ + int ret; + odp_instance_t instance; + odp_init_t param; + + odp_init_param_init(¶m); + + ret = odp_init_global(&instance, ¶m, NULL); + CU_ASSERT_FATAL(ret == 0); + + ret = odp_init_local(instance, ODP_THREAD_WORKER); + CU_ASSERT_FATAL(ret == 0); + + ret = odp_term_local(); + CU_ASSERT_FATAL(ret == 0); + + ret = odp_term_global(instance); + CU_ASSERT(ret == 0); +} + +static void init_test_abort(void) +{ + int ret; + odp_instance_t instance; + odp_init_t param; + + odp_init_param_init(¶m); + param.abort_fn = &my_abort_func; + + ret = odp_init_global(&instance, ¶m, NULL); + CU_ASSERT_FATAL(ret == 0); + + ret = odp_init_local(instance, ODP_THREAD_WORKER); + CU_ASSERT_FATAL(ret == 0); + + ret = odp_term_local(); + CU_ASSERT_FATAL(ret == 0); + + ret = odp_term_global(instance); + CU_ASSERT(ret == 0); +} + +static void init_test_log(void) +{ + int ret; + odp_instance_t instance; + odp_init_t param; + + odp_init_param_init(¶m); + param.log_fn = &my_log_func; + + ret = odp_init_global(&instance, ¶m, NULL); + CU_ASSERT_FATAL(ret == 0); + + ret = odp_init_local(instance, ODP_THREAD_WORKER); + CU_ASSERT_FATAL(ret == 0); + + ret = odp_term_local(); + CU_ASSERT_FATAL(ret == 0); + + ret = odp_term_global(instance); + CU_ASSERT(ret == 0); +} + +odp_testinfo_t testinfo[] = { + ODP_TEST_INFO(init_test_defaults), + ODP_TEST_INFO(init_test_abort), + ODP_TEST_INFO(init_test_log), +}; + +odp_testinfo_t init_suite[] = { + ODP_TEST_INFO_NULL, + ODP_TEST_INFO_NULL +}; + +odp_suiteinfo_t init_suites[] = { + {"Init", NULL, NULL, init_suite}, + ODP_SUITE_INFO_NULL, +}; + +static int fill_testinfo(odp_testinfo_t *info, unsigned int test_case) +{ + if (test_case >= (sizeof(testinfo) / sizeof(odp_testinfo_t))) { + printf("Bad test case number %u\n", test_case); + return -1; + } + + *info = testinfo[test_case]; + + return 0; +} + +int main(int argc, char *argv[]) +{ + int ret; + + if (fill_testinfo(&init_suite[0], INIT_TEST)) + return -1; + + /* Parse common options */ + if (odp_cunit_parse_options(argc, argv)) + return -1; + + /* Prevent default ODP init */ + odp_cunit_register_global_init(NULL); + odp_cunit_register_global_term(NULL); + + /* Register the tests */ + ret = odp_cunit_register(init_suites); + + /* Run the tests */ + if (ret == 0) + ret = odp_cunit_run(); + + return ret; +} diff --git a/test/validation/api/init/init_main_abort.c b/test/validation/api/init/init_main_abort.c deleted file mode 100644 index 339fba1d0..000000000 --- a/test/validation/api/init/init_main_abort.c +++ /dev/null @@ -1,65 +0,0 @@ -/* Copyright (c) 2015-2018, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#include "config.h" - -#include <stdlib.h> -#include <odp_api.h> -#include <odp_cunit_common.h> - -/* replacement abort function: */ -static void ODP_NORETURN odp_init_abort(void) -{ - abort(); -} - -/* test ODP global init, with alternate abort function */ -static void init_test_odp_init_global_replace_abort(void) -{ - int status; - odp_init_t init_data; - odp_instance_t instance; - - odp_init_param_init(&init_data); - init_data.abort_fn = &odp_init_abort; - - status = odp_init_global(&instance, &init_data, NULL); - CU_ASSERT_FATAL(status == 0); - - status = odp_term_global(instance); - CU_ASSERT(status == 0); -} - -odp_testinfo_t init_suite_abort[] = { - ODP_TEST_INFO(init_test_odp_init_global_replace_abort), - ODP_TEST_INFO_NULL, -}; - -odp_suiteinfo_t init_suites_abort[] = { - {"Init", NULL, NULL, init_suite_abort}, - ODP_SUITE_INFO_NULL, -}; - -int main(int argc, char *argv[]) -{ - int ret; - - /* parse common options: */ - if (odp_cunit_parse_options(argc, argv)) - return -1; - - /* prevent default ODP init: */ - odp_cunit_register_global_init(NULL); - odp_cunit_register_global_term(NULL); - - /* run the tests: */ - ret = odp_cunit_register(init_suites_abort); - - if (ret == 0) - ret = odp_cunit_run(); - - return ret; -} diff --git a/test/validation/api/init/init_main_log.c b/test/validation/api/init/init_main_log.c deleted file mode 100644 index 9ada02289..000000000 --- a/test/validation/api/init/init_main_log.c +++ /dev/null @@ -1,85 +0,0 @@ -/* Copyright (c) 2015-2018, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#include "config.h" - -#include <stdarg.h> -#include <odp_api.h> -#include <odp_cunit_common.h> - -/* flag set when the replacement logging function is used */ -int replacement_logging_used; - -/* replacement log function: */ -ODP_PRINTF_FORMAT(2, 3) -static int odp_init_log(odp_log_level_t level __attribute__((unused)), - const char *fmt, ...) -{ - va_list args; - int r; - - /* just set a flag to be sure the replacement fn was used */ - replacement_logging_used = 1; - - va_start(args, fmt); - r = vfprintf(stderr, fmt, args); - va_end(args); - - return r; -} - -/* test ODP global init, with alternate log function */ -static void init_test_odp_init_global_replace_log(void) -{ - int status; - odp_init_t init_data; - odp_instance_t instance; - - odp_init_param_init(&init_data); - init_data.log_fn = &odp_init_log; - - replacement_logging_used = 0; - - status = odp_init_global(&instance, &init_data, NULL); - CU_ASSERT_FATAL(status == 0); - - CU_ASSERT_TRUE(replacement_logging_used || ODP_DEBUG_PRINT == 0); - - status = odp_term_global(instance); - CU_ASSERT(status == 0); -} - -odp_testinfo_t init_suite_log[] = { - ODP_TEST_INFO(init_test_odp_init_global_replace_log), - ODP_TEST_INFO_NULL, -}; - -odp_suiteinfo_t init_suites_log[] = { - {"Init", NULL, NULL, init_suite_log}, - ODP_SUITE_INFO_NULL, -}; - -int main(int argc, char *argv[]) -{ - int ret; - - /* parse common options: */ - if (odp_cunit_parse_options(argc, argv)) - return -1; - - /* prevent default ODP init: */ - odp_cunit_register_global_init(NULL); - odp_cunit_register_global_term(NULL); - - /* register the tests: */ - ret = odp_cunit_register(init_suites_log); - - /* run the tests: */ - if (ret == 0) - ret = odp_cunit_run(); - - return ret; -} diff --git a/test/validation/api/init/init_main_ok.c b/test/validation/api/init/init_main_ok.c deleted file mode 100644 index 651989aeb..000000000 --- a/test/validation/api/init/init_main_ok.c +++ /dev/null @@ -1,59 +0,0 @@ -/* Copyright (c) 2015-2018, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#include "config.h" - -#include <odp_api.h> -#include <odp_cunit_common.h> - -/* test normal ODP global init */ -static void init_test_odp_init_global(void) -{ - int status; - odp_instance_t instance; - odp_init_t init_data; - - odp_init_param_init(&init_data); - init_data.mem_model = ODP_MEM_MODEL_THREAD; - - status = odp_init_global(&instance, &init_data, NULL); - CU_ASSERT_FATAL(status == 0); - - status = odp_term_global(instance); - CU_ASSERT(status == 0); -} - -odp_testinfo_t init_suite_ok[] = { - ODP_TEST_INFO(init_test_odp_init_global), - ODP_TEST_INFO_NULL, -}; - -odp_suiteinfo_t init_suites_ok[] = { - {"Init", NULL, NULL, init_suite_ok}, - ODP_SUITE_INFO_NULL, -}; - -int main(int argc, char *argv[]) -{ - int ret; - - /* parse common options: */ - if (odp_cunit_parse_options(argc, argv)) - return -1; - - /* prevent default ODP init: */ - odp_cunit_register_global_init(NULL); - odp_cunit_register_global_term(NULL); - - /* register the tests: */ - ret = odp_cunit_register(init_suites_ok); - - /* run the tests: */ - if (ret == 0) - ret = odp_cunit_run(); - - return ret; -}
commit f20eb25eb2300884170900c265c845740b8b51c6 Author: Petri Savolainen petri.savolainen@nokia.com Date: Fri Apr 12 17:00:32 2019 +0300
api: init: calls to cpumask functions before init
Improve specification of initialization and termination steps. Explicitly list those functions that may be used before global init (those that are needed for setting up parameters). No change to functionality.
Signed-off-by: Petri Savolainen petri.savolainen@nokia.com Reviewed-by: Bill Fischofer billf@me.com Reviewed-by: Matias Elo matias.elo@nokia.com
diff --git a/include/odp/api/spec/init.h b/include/odp/api/spec/init.h index 70249d138..916f19388 100644 --- a/include/odp/api/spec/init.h +++ b/include/odp/api/spec/init.h @@ -1,4 +1,5 @@ /* Copyright (c) 2013-2018, Linaro Limited + * Copyright (c) 2019, Nokia * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause @@ -6,16 +7,6 @@
/** * @file - * - * ODP initialization. - * ODP requires a global level init for the process and a local init per - * thread before the other ODP APIs may be called. - * - odp_init_global() - * - odp_init_local() - * - * For a graceful termination the matching termination APIs exit - * - odp_term_global() - * - odp_term_local() */
#ifndef ODP_API_SPEC_INIT_H_ @@ -234,13 +225,25 @@ void odp_init_param_init(odp_init_t *param); /** * Global ODP initialization * - * This function must be called once (per instance) before calling any other - * ODP API functions. A successful call creates a new ODP instance into the - * system and outputs a handle for it. The handle is used in other calls - * (e.g. odp_init_local()) as a reference to the instance. When user provides - * configuration parameters, the platform may configure and optimize the - * instance to match user requirements. A failure is returned if requirements - * cannot be met. + * An ODP instance is created with an odp_init_global() call. By default, each + * thread of the instance must call odp_init_local() before calling any other + * ODP API functions. Exceptions to this are functions that are needed for + * setting up parameters for odp_init_global() and odp_init_local() calls: + * - odp_init_param_init() + * - odp_cpumask_zero(), odp_cpumask_set(), etc functions to format + * odp_cpumask_t. However, these cpumask functions are excluded as their + * behaviour depend on global initialization parameters: + * odp_cpumask_default_worker(), odp_cpumask_default_control() and + * odp_cpumask_all_available() + * + * A successful odp_init_global() call outputs a handle for the new instance. + * The handle is used in other initialization and termination calls. + * For a graceful termination, odp_term_local() must be called first on each + * thread and then odp_term_global() only once. + * + * When user provides configuration parameters, the platform may configure and + * optimize the instance to match user requirements. A failure is returned if + * requirements cannot be met. * * Configuration parameters are divided into standard and platform specific * parts. Standard parameters are supported by any ODP platform, where as @@ -260,46 +263,25 @@ void odp_init_param_init(odp_init_t *param); * @retval 0 on success * @retval <0 on failure * - * @see odp_term_global() - * @see odp_init_local() which is required per thread before use. + * @see odp_init_local(), odp_term_global(), odp_init_param_init() */ int odp_init_global(odp_instance_t *instance, const odp_init_t *params, const odp_platform_init_t *platform_params);
-/** - * Global ODP termination - * - * This function is the final ODP call made when terminating - * an ODP application in a controlled way. It cannot handle exceptional - * circumstances. In general it calls the API modules terminate functions in - * the reverse order to that which the module init functions were called - * during odp_init_global(). - * - * This function must be called only after all threads of the instance have - * executed odp_term_local(). To simplify synchronization between threads - * odp_term_local() identifies which one is the last thread of an instance. - * - * @param instance Instance handle - * - * @retval 0 on success - * @retval <0 on failure - * - * @warning The unwinding of HW resources to allow them to be reused without - * resetting the device is a complex task that the application is expected to - * coordinate. This api may have platform dependent implications. - * - * @see odp_init_global() - * @see odp_term_local() which must have been called prior to this. - */ -int odp_term_global(odp_instance_t instance); - /** * Thread local ODP initialization * * All threads must call this function before calling any other ODP API - * functions. The instance parameter specifies which ODP instance the thread - * joins. A thread may be simultaneously part of single ODP instance only. + * functions. See odp_init_global() documentation for exceptions to this rule. + * Global initialization (odp_init_global()) must have completed prior calling + * this function. + * + * The instance parameter specifies which ODP instance the thread joins. + * A thread may only join a single ODP instance at a time. The thread + * type parameter indicates if the thread does most part of application + * processing (ODP_THREAD_WORKER), or if it performs mostly background + * tasks (ODP_THREAD_CONTROL). * * @param instance Instance handle * @param thr_type Thread type @@ -307,8 +289,7 @@ int odp_term_global(odp_instance_t instance); * @retval 0 on success * @retval <0 on failure * - * @see odp_term_local() - * @see odp_init_global() which must have been called prior to this. + * @see odp_init_global(), odp_term_local() */ int odp_init_local(odp_instance_t instance, odp_thread_type_t thr_type);
@@ -317,24 +298,40 @@ int odp_init_local(odp_instance_t instance, odp_thread_type_t thr_type); * * This function is the second to final ODP call made when terminating * an ODP application in a controlled way. It cannot handle exceptional - * circumstances. In general it calls the API modules per thread terminate - * functions in the reverse order to that which the module init functions were - * called during odp_init_local(). + * circumstances. It is recommended that all ODP resources are freed before + * the last thread (of the instance) calls this function. This helps ODP + * to avoid memory and other resource leaks. + * + * odp_term_global() may be called only after all threads of the instance have + * executed odp_term_local(). To simplify synchronization between threads + * a return value identifies which one is the last thread of an instance. * * @retval 1 on success and more ODP threads exist * @retval 0 on success and this is the last ODP thread * @retval <0 on failure * - * @warning The unwinding of HW resources to allow them to be reused without - * resetting the device is a complex task that the application is expected - * to coordinate. - * - * @see odp_init_local() - * @see odp_term_global() should be called by the last ODP thread before exit - * of an application. + * @see odp_init_local(), odp_term_global() */ int odp_term_local(void);
+/** + * Global ODP termination + * + * This function is the final ODP call made when terminating an ODP application + * in a controlled way. It cannot handle exceptional circumstances. + * + * This function must be called only after all threads of the instance have + * executed odp_term_local(). + * + * @param instance Instance handle + * + * @retval 0 on success + * @retval <0 on failure + * + * @see odp_init_global(), odp_term_local() + */ +int odp_term_global(odp_instance_t instance); + /** * @} */
-----------------------------------------------------------------------
Summary of changes: configure.ac | 2 +- doc/implementers-guide/implementers-guide.adoc | 4 +- include/odp/api/spec/init.h | 117 +++++++------- test/validation/api/Makefile.am | 8 +- test/validation/api/buffer/buffer.c | 2 +- test/validation/api/init/.gitignore | 8 +- test/validation/api/init/Makefile.am | 22 ++- test/validation/api/init/init_main.c | 210 +++++++++++++++++++++++++ test/validation/api/init/init_main_abort.c | 65 -------- test/validation/api/init/init_main_log.c | 85 ---------- test/validation/api/init/init_main_ok.c | 59 ------- 11 files changed, 295 insertions(+), 287 deletions(-) create mode 100644 test/validation/api/init/init_main.c delete mode 100644 test/validation/api/init/init_main_abort.c delete mode 100644 test/validation/api/init/init_main_log.c delete mode 100644 test/validation/api/init/init_main_ok.c
hooks/post-receive