aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetri Savolainen <petri.savolainen@nokia.com>2015-07-09 16:46:16 +0300
committerMaxim Uvarov <maxim.uvarov@linaro.org>2015-07-23 19:21:51 +0300
commit3501aeea1b0316aa5e951e6e601b891a05e0d1c4 (patch)
tree842892b5b9b37e2a2158529f56ad7754211853dd
parentb16afd47225ed07360bd7574ed1970ff544c5d50 (diff)
api: init: added thread type to local init
User needs to select the thread type (worker or control) of the initialized thread. Implementation may reserve HW direct access only to worker threads, while control threads share HW access, etc. Signed-off-by: Petri Savolainen <petri.savolainen@nokia.com> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> Conflicts: helper/linux.c
-rw-r--r--example/classifier/odp_classifier.c2
-rw-r--r--example/generator/odp_generator.c2
-rw-r--r--example/ipsec/odp_ipsec.c2
-rw-r--r--example/packet/odp_pktio.c2
-rw-r--r--example/timer/odp_timer_test.c2
-rw-r--r--helper/linux.c4
-rw-r--r--helper/test/odp_chksum.c2
-rw-r--r--helper/test/odp_process.c2
-rw-r--r--helper/test/odp_thread.c2
-rw-r--r--include/odp/api/init.h5
-rw-r--r--platform/linux-generic/odp_init.c2
-rw-r--r--test/performance/odp_l2fwd.c2
-rw-r--r--test/performance/odp_pktio_perf.c2
-rw-r--r--test/performance/odp_scheduling.c2
-rw-r--r--test/validation/common/odp_cunit_common.c2
-rw-r--r--test/validation/crypto/crypto.c2
-rw-r--r--test/validation/synchronizers/synchronizers.c2
17 files changed, 21 insertions, 18 deletions
diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c
index 4f741d08b..884df6f2f 100644
--- a/example/classifier/odp_classifier.c
+++ b/example/classifier/odp_classifier.c
@@ -389,7 +389,7 @@ int main(int argc, char *argv[])
}
/* Init this thread */
- if (odp_init_local()) {
+ if (odp_init_local(ODP_THREAD_CONTROL)) {
EXAMPLE_ERR("Error: ODP local init failed.\n");
exit(EXIT_FAILURE);
}
diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c
index d6bf8807a..c38f180e8 100644
--- a/example/generator/odp_generator.c
+++ b/example/generator/odp_generator.c
@@ -600,7 +600,7 @@ int main(int argc, char *argv[])
exit(EXIT_FAILURE);
}
- if (odp_init_local()) {
+ if (odp_init_local(ODP_THREAD_CONTROL)) {
EXAMPLE_ERR("Error: ODP local init failed.\n");
exit(EXIT_FAILURE);
}
diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
index d54ac79e4..2d302ff42 100644
--- a/example/ipsec/odp_ipsec.c
+++ b/example/ipsec/odp_ipsec.c
@@ -1243,7 +1243,7 @@ main(int argc, char *argv[])
}
/* Init this thread */
- if (odp_init_local()) {
+ if (odp_init_local(ODP_THREAD_CONTROL)) {
EXAMPLE_ERR("Error: ODP local init failed.\n");
exit(EXIT_FAILURE);
}
diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
index a3a869220..9bb295985 100644
--- a/example/packet/odp_pktio.c
+++ b/example/packet/odp_pktio.c
@@ -350,7 +350,7 @@ int main(int argc, char *argv[])
}
/* Init this thread */
- if (odp_init_local()) {
+ if (odp_init_local(ODP_THREAD_CONTROL)) {
EXAMPLE_ERR("Error: ODP local init failed.\n");
exit(EXIT_FAILURE);
}
diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c
index 5090c057f..456820257 100644
--- a/example/timer/odp_timer_test.c
+++ b/example/timer/odp_timer_test.c
@@ -331,7 +331,7 @@ int main(int argc, char *argv[])
}
/* Init this thread. */
- if (odp_init_local()) {
+ if (odp_init_local(ODP_THREAD_CONTROL)) {
printf("ODP local init failed.\n");
return -1;
}
diff --git a/helper/linux.c b/helper/linux.c
index 46313f4d6..a2eacc199 100644
--- a/helper/linux.c
+++ b/helper/linux.c
@@ -58,7 +58,7 @@ static void *odp_run_start_routine(void *arg)
odp_start_args_t *start_args = arg;
/* ODP thread local init */
- if (odp_init_local()) {
+ if (odp_init_local(ODP_THREAD_WORKER)) {
ODPH_ERR("Local init failed\n");
return NULL;
}
@@ -203,7 +203,7 @@ int odph_linux_process_fork_n(odph_linux_process_t *proc_tbl,
return -2;
}
- if (odp_init_local()) {
+ if (odp_init_local(ODP_THREAD_WORKER)) {
ODPH_ERR("Local init failed\n");
return -2;
}
diff --git a/helper/test/odp_chksum.c b/helper/test/odp_chksum.c
index f3c205936..dfd578f46 100644
--- a/helper/test/odp_chksum.c
+++ b/helper/test/odp_chksum.c
@@ -126,7 +126,7 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED)
exit(EXIT_FAILURE);
}
- if (odp_init_local()) {
+ if (odp_init_local(ODP_THREAD_WORKER)) {
LOG_ERR("Error: ODP local init failed.\n");
exit(EXIT_FAILURE);
}
diff --git a/helper/test/odp_process.c b/helper/test/odp_process.c
index 3483549b7..97f46691d 100644
--- a/helper/test/odp_process.c
+++ b/helper/test/odp_process.c
@@ -33,7 +33,7 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED)
exit(EXIT_FAILURE);
}
- if (odp_init_local()) {
+ if (odp_init_local(ODP_THREAD_CONTROL)) {
LOG_ERR("Error: ODP local init failed.\n");
exit(EXIT_FAILURE);
}
diff --git a/helper/test/odp_thread.c b/helper/test/odp_thread.c
index 04c6b1e7a..634be9621 100644
--- a/helper/test/odp_thread.c
+++ b/helper/test/odp_thread.c
@@ -34,7 +34,7 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED)
exit(EXIT_FAILURE);
}
- if (odp_init_local()) {
+ if (odp_init_local(ODP_THREAD_CONTROL)) {
LOG_ERR("Error: ODP local init failed.\n");
exit(EXIT_FAILURE);
}
diff --git a/include/odp/api/init.h b/include/odp/api/init.h
index 01faedc1e..0e940fc92 100644
--- a/include/odp/api/init.h
+++ b/include/odp/api/init.h
@@ -30,6 +30,7 @@ extern "C" {
#include <odp/std_types.h>
#include <odp/hints.h>
+#include <odp/thread.h>
/** @defgroup odp_initialization ODP INITIALIZATION
* Initialisation operations.
@@ -174,10 +175,12 @@ int odp_term_global(void);
* @sa odp_term_local()
* @sa odp_init_global() which must have been called prior to this.
*
+ * @param thr_type Thread type
+ *
* @retval 0 on success
* @retval <0 on failure
*/
-int odp_init_local(void);
+int odp_init_local(odp_thread_type_t thr_type);
/**
diff --git a/platform/linux-generic/odp_init.c b/platform/linux-generic/odp_init.c
index bf36e689a..0b13a6df1 100644
--- a/platform/linux-generic/odp_init.c
+++ b/platform/linux-generic/odp_init.c
@@ -121,7 +121,7 @@ int odp_term_global(void)
return rc;
}
-int odp_init_local(void)
+int odp_init_local(odp_thread_type_t thr_type ODP_UNUSED)
{
if (odp_shm_init_local()) {
ODP_ERR("ODP shm local init failed.\n");
diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c
index 01cb077b0..c385444a2 100644
--- a/test/performance/odp_l2fwd.c
+++ b/test/performance/odp_l2fwd.c
@@ -372,7 +372,7 @@ int main(int argc, char *argv[])
}
/* Init this thread */
- if (odp_init_local()) {
+ if (odp_init_local(ODP_THREAD_CONTROL)) {
LOG_ERR("Error: ODP local init failed.\n");
exit(EXIT_FAILURE);
}
diff --git a/test/performance/odp_pktio_perf.c b/test/performance/odp_pktio_perf.c
index 3c5e35e34..bebbe2222 100644
--- a/test/performance/odp_pktio_perf.c
+++ b/test/performance/odp_pktio_perf.c
@@ -965,7 +965,7 @@ int main(int argc, char **argv)
if (odp_init_global(NULL, NULL) != 0)
LOG_ABORT("Failed global init.\n");
- if (odp_init_local() != 0)
+ if (odp_init_local(ODP_THREAD_CONTROL) != 0)
LOG_ABORT("Failed local init.\n");
shm = odp_shm_reserve("test_globals",
diff --git a/test/performance/odp_scheduling.c b/test/performance/odp_scheduling.c
index 4492742c3..99ff77244 100644
--- a/test/performance/odp_scheduling.c
+++ b/test/performance/odp_scheduling.c
@@ -871,7 +871,7 @@ int main(int argc, char *argv[])
* Init this thread. It makes also ODP calls when
* setting up resources for worker threads.
*/
- if (odp_init_local()) {
+ if (odp_init_local(ODP_THREAD_CONTROL)) {
LOG_ERR("ODP global init failed.\n");
return -1;
}
diff --git a/test/validation/common/odp_cunit_common.c b/test/validation/common/odp_cunit_common.c
index f0752c62a..753405ade 100644
--- a/test/validation/common/odp_cunit_common.c
+++ b/test/validation/common/odp_cunit_common.c
@@ -50,7 +50,7 @@ static int tests_global_init(void)
fprintf(stderr, "error: odp_init_global() failed.\n");
return -1;
}
- if (0 != odp_init_local()) {
+ if (0 != odp_init_local(ODP_THREAD_CONTROL)) {
fprintf(stderr, "error: odp_init_local() failed.\n");
return -1;
}
diff --git a/test/validation/crypto/crypto.c b/test/validation/crypto/crypto.c
index ca7e74083..996543259 100644
--- a/test/validation/crypto/crypto.c
+++ b/test/validation/crypto/crypto.c
@@ -33,7 +33,7 @@ static int crypto_init(void)
fprintf(stderr, "error: odp_init_global() failed.\n");
return -1;
}
- if (0 != odp_init_local()) {
+ if (0 != odp_init_local(ODP_THREAD_CONTROL)) {
fprintf(stderr, "error: odp_init_local() failed.\n");
return -1;
}
diff --git a/test/validation/synchronizers/synchronizers.c b/test/validation/synchronizers/synchronizers.c
index fb12a05e2..ed56c8fca 100644
--- a/test/validation/synchronizers/synchronizers.c
+++ b/test/validation/synchronizers/synchronizers.c
@@ -1061,7 +1061,7 @@ static int synchronizers_init(void)
fprintf(stderr, "error: odp_init_global() failed.\n");
return -1;
}
- if (0 != odp_init_local()) {
+ if (0 != odp_init_local(ODP_THREAD_CONTROL)) {
fprintf(stderr, "error: odp_init_local() failed.\n");
return -1;
}