On Aug 21, 2014, at 1:24 PM, Maxim Uvarov <[email protected]> wrote:

> What do you about leaving original odp_init_global() without parameters?
> 
> Something like:
> 
> int odp_init_global_param(odp_global_init_t *params,
>        odp_global_platform_init_t *platform_params);
> 
> int odp_init_global() {
>         /* init defaults */
>         odp_init_global_param(NULL, NULL);
> }

I think I understand your reason, but I feel it is not required. Adding two 
NULL parameters is not a big concern IMO.
> 
> So if some advance init is needed then app should call odp_init_global_param, 
> on other way just
> fall back to default.
> 
> Maxim.
> 
> On 08/21/2014 08:01 PM, Mike Holmes wrote:
>> Signed-off-by: Mike Holmes <[email protected]>
>> ---
>>  example/generator/odp_generator.c   |  2 +-
>>  example/l2fwd/odp_l2fwd.c           |  2 +-
>>  example/odp_example/odp_example.c   |  2 +-
>>  example/packet/odp_pktio.c          |  2 +-
>>  example/timer/odp_timer_test.c      |  2 +-
>>  include/odp_init.h                  | 22 +++++++++++++++++++---
>>  platform/linux-dpdk/odp_init.c      |  3 ++-
>>  platform/linux-generic/odp_init.c   |  3 ++-
>>  platform/linux-keystone2/odp_init.c |  3 ++-
>>  test/api_test/odp_common.c          |  2 +-
>>  10 files changed, 31 insertions(+), 12 deletions(-)
>> 
>> diff --git a/example/generator/odp_generator.c 
>> b/example/generator/odp_generator.c
>> index 9fa9b37..ba7aa68 100644
>> --- a/example/generator/odp_generator.c
>> +++ b/example/generator/odp_generator.c
>> @@ -525,7 +525,7 @@ int main(int argc, char *argv[])
>>      int core_count;
>>      /* Init ODP before calling anything else */
>> -    if (odp_init_global()) {
>> +    if (odp_init_global(NULL, NULL)) {
>>              ODP_ERR("Error: ODP global init failed.\n");
>>              exit(EXIT_FAILURE);
>>      }
>> diff --git a/example/l2fwd/odp_l2fwd.c b/example/l2fwd/odp_l2fwd.c
>> index d74449a..f8d6729 100644
>> --- a/example/l2fwd/odp_l2fwd.c
>> +++ b/example/l2fwd/odp_l2fwd.c
>> @@ -323,7 +323,7 @@ int main(int argc, char *argv[])
>>      odp_pktio_t pktio;
>>      /* Init ODP before calling anything else */
>> -    if (odp_init_global()) {
>> +    if (odp_init_global(NULL, NULL)) {
>>              ODP_ERR("Error: ODP global init failed.\n");
>>              exit(EXIT_FAILURE);
>>      }
>> diff --git a/example/odp_example/odp_example.c 
>> b/example/odp_example/odp_example.c
>> index f0bdf29..3d38ac7 100644
>> --- a/example/odp_example/odp_example.c
>> +++ b/example/odp_example/odp_example.c
>> @@ -951,7 +951,7 @@ int main(int argc, char *argv[])
>>      memset(thread_tbl, 0, sizeof(thread_tbl));
>>  -   if (odp_init_global()) {
>> +    if (odp_init_global(NULL, NULL)) {
>>              printf("ODP global init failed.\n");
>>              return -1;
>>      }
>> diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
>> index f247bd0..f3543a0 100644
>> --- a/example/packet/odp_pktio.c
>> +++ b/example/packet/odp_pktio.c
>> @@ -311,7 +311,7 @@ int main(int argc, char *argv[])
>>      int core_count;
>>      /* Init ODP before calling anything else */
>> -    if (odp_init_global()) {
>> +    if (odp_init_global(NULL, NULL)) {
>>              ODP_ERR("Error: ODP global init failed.\n");
>>              exit(EXIT_FAILURE);
>>      }
>> diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c
>> index dbe0e5b..1af8c2b 100644
>> --- a/example/timer/odp_timer_test.c
>> +++ b/example/timer/odp_timer_test.c
>> @@ -210,7 +210,7 @@ int main(int argc, char *argv[])
>>      memset(thread_tbl, 0, sizeof(thread_tbl));
>>  -   if (odp_init_global()) {
>> +    if (odp_init_global(NULL, NULL)) {
>>              printf("ODP global init failed.\n");
>>              return -1;
>>      }
>> diff --git a/include/odp_init.h b/include/odp_init.h
>> index 490324a..45db5f5 100644
>> --- a/include/odp_init.h
>> +++ b/include/odp_init.h
>> @@ -23,23 +23,39 @@ extern "C" {
>>  #include <odp_std_types.h>
>>    +/**
>> + * ODP  initialisation
>> + * Data that is required to initialize the ODP
>> + * application, such as specifying a logging callback, the log level etc.
>> + */
>> +typedef struct odp_global_init {
>> +} odp_global_init_t;
>>  +/**
>> + * ODP  platform initialization
>> + * Platform specific data. ODP does nothing with
>> + * this data.
>> + */
>> +typedef struct odp_global_platform_init {
>> +} odp_global_platform_init_t;
>>    /**
>> - * Perform global ODP initalisation.
>> + * Perform global ODP initialisation.
>>   *
>>   * This function must be called once before calling
>>   * any other ODP API functions.
>>   *
>>   * @return 0 if successful
>>   */
>> -int odp_init_global(void);
>> +int odp_init_global(odp_global_init_t *params,
>> +                odp_global_platform_init_t *platform_params);
>>      /**
>> - * Perform thread local ODP initalisation.
>> + * Perform thread local ODP initialisation.
>>   *
>>   * All threads must call this function before calling
>> + *
>>   * any other ODP API functions.
>>   * @param thr_id Thread id
>>   * @return 0 if successful
>> diff --git a/platform/linux-dpdk/odp_init.c b/platform/linux-dpdk/odp_init.c
>> index ecc2066..c3f937d 100644
>> --- a/platform/linux-dpdk/odp_init.c
>> +++ b/platform/linux-dpdk/odp_init.c
>> @@ -50,7 +50,8 @@ int odp_init_dpdk(void)
>>      return 0;
>>  }
>>  -int odp_init_global(void)
>> +int odp_init_global(odp_global_init_t *params  ODP_UNUSED,
>> +                odp_global_platform_init_t *platform_params ODP_UNUSED)
>>  {
>>      odp_thread_init_global();
>>  diff --git a/platform/linux-generic/odp_init.c 
>> b/platform/linux-generic/odp_init.c
>> index 5b7e192..8b339e4 100644
>> --- a/platform/linux-generic/odp_init.c
>> +++ b/platform/linux-generic/odp_init.c
>> @@ -9,7 +9,8 @@
>>  #include <odp_debug.h>
>>    -int odp_init_global(void)
>> +int odp_init_global(odp_global_init_t *params  ODP_UNUSED,
>> +                odp_global_platform_init_t *platform_params ODP_UNUSED)
>>  {
>>      odp_thread_init_global();
>>  diff --git a/platform/linux-keystone2/odp_init.c 
>> b/platform/linux-keystone2/odp_init.c
>> index f832551..3111b51 100644
>> --- a/platform/linux-keystone2/odp_init.c
>> +++ b/platform/linux-keystone2/odp_init.c
>> @@ -90,7 +90,8 @@ static int ti_init_hw_config(void)
>>  }
>>    -int odp_init_global(void)
>> +int odp_init_global(odp_global_init_t *init_data ODP_UNUSED,
>> +                odp_global_platform_init_t *platform_params ODP_UNUSED)
>>  {
>>      odp_thread_init_global();
>>  diff --git a/test/api_test/odp_common.c b/test/api_test/odp_common.c
>> index 89ebd2d..fc583c0 100644
>> --- a/test/api_test/odp_common.c
>> +++ b/test/api_test/odp_common.c
>> @@ -56,7 +56,7 @@ int odp_test_global_init(void)
>>  {
>>      memset(thread_tbl, 0, sizeof(thread_tbl));
>>  -   if (odp_init_global()) {
>> +    if (odp_init_global(NULL, NULL)) {
>>              ODP_ERR("ODP global init failed.\n");
>>              return -1;
>>      }
> 
> 
> _______________________________________________
> lng-odp mailing list
> [email protected]
> http://lists.linaro.org/mailman/listinfo/lng-odp

Keith Wiles, Principal Technologist with CTO office, Wind River mobile 
972-213-5533


_______________________________________________
lng-odp mailing list
[email protected]
http://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to