On 27 April 2015 at 14:38, Petri Savolainen <[email protected]>
wrote:

> 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.
>
Why wasn't this description in a cover-letter for these two patches?

Based on the description above, it seems like the call that returns the
thread type could be a performance critical call. Or how do you expect
these calls actually be used per your example above, when accessing HW
resources in shared or private way?



> Signed-off-by: Petri Savolainen <[email protected]>
> ---
>  example/generator/odp_generator.c         | 2 +-
>  example/ipsec/odp_ipsec.c                 | 2 +-
>  example/packet/odp_pktio.c                | 2 +-
>  example/timer/odp_timer_test.c            | 2 +-
>  helper/linux.c                            | 4 ++--
>  include/odp/api/init.h                    | 5 ++++-
>  platform/linux-generic/odp_init.c         | 2 +-
>  test/performance/odp_l2fwd.c              | 2 +-
>  test/performance/odp_scheduling.c         | 2 +-
>  test/validation/common/odp_cunit_common.c | 2 +-
>  10 files changed, 14 insertions(+), 11 deletions(-)
>
> diff --git a/example/generator/odp_generator.c
> b/example/generator/odp_generator.c
> index 2ac0b47..a4cbd7e 100644
> --- a/example/generator/odp_generator.c
> +++ b/example/generator/odp_generator.c
> @@ -605,7 +605,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 cb8f535..b51f633 100644
> --- a/example/ipsec/odp_ipsec.c
> +++ b/example/ipsec/odp_ipsec.c
> @@ -1160,7 +1160,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 61af855..7383a9d 100644
> --- a/example/packet/odp_pktio.c
> +++ b/example/packet/odp_pktio.c
> @@ -343,7 +343,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 6b60ec4..10357d5 100644
> --- a/example/timer/odp_timer_test.c
> +++ b/example/timer/odp_timer_test.c
> @@ -332,7 +332,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 b753e4d..a06e1aa 100644
> --- a/helper/linux.c
> +++ b/helper/linux.c
> @@ -64,7 +64,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)) {
>                 ODP_ERR("Local init failed\n");
>                 return NULL;
>         }
> @@ -195,7 +195,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)) {
>                         ODP_ERR("Local init failed\n");
>                         return -2;
>                 }
> diff --git a/include/odp/api/init.h b/include/odp/api/init.h
> index 01faedc..e3c0bbe 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.
> @@ -171,13 +172,15 @@ int odp_term_global(void);
>   * All threads must call this function before calling
>   * any other ODP API functions.
>   *
> + * @param thr_type  Thread type
> + *
>   * @sa odp_term_local()
>   * @sa odp_init_global() which must have been called prior to this.
>   *
>   * @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 bf36e68..0b13a6d 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 5d4b833..fd6b544 100644
> --- a/test/performance/odp_l2fwd.c
> +++ b/test/performance/odp_l2fwd.c
> @@ -359,7 +359,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_scheduling.c
> b/test/performance/odp_scheduling.c
> index 99f0f9b..ee1c5da 100644
> --- a/test/performance/odp_scheduling.c
> +++ b/test/performance/odp_scheduling.c
> @@ -860,7 +860,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 2af4410..6b80413 100644
> --- a/test/validation/common/odp_cunit_common.c
> +++ b/test/validation/common/odp_cunit_common.c
> @@ -60,7 +60,7 @@ int main(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;
>         }
> --
> 2.3.6
>
> _______________________________________________
> lng-odp mailing list
> [email protected]
> https://lists.linaro.org/mailman/listinfo/lng-odp
>
_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to