diff mbox

[v10] Add global_init params

Message ID 1412771527-35429-1-git-send-email-mike.holmes@linaro.org
State Accepted
Commit 6f9938ee9e4ec82ea4c0ee608c6148f1aa7c1264
Headers show

Commit Message

Mike Holmes Oct. 8, 2014, 12:32 p.m. UTC
Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
---
 example/generator/odp_generator.c             |  2 +-
 example/ipsec/odp_ipsec.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 +-
 platform/linux-generic/include/api/odp_init.h | 35 +++++++++++++++++++++------
 platform/linux-generic/odp_init.c             |  3 ++-
 test/api_test/odp_common.c                    |  2 +-
 9 files changed, 36 insertions(+), 16 deletions(-)

Comments

Ciprian Barbu Oct. 9, 2014, 7:40 a.m. UTC | #1
Reviewed-by: Ciprian Barbu <ciprian.barbu@linaro.org>

On Wed, Oct 8, 2014 at 3:32 PM, Mike Holmes <mike.holmes@linaro.org> wrote:
> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
> ---
>  example/generator/odp_generator.c             |  2 +-
>  example/ipsec/odp_ipsec.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 +-
>  platform/linux-generic/include/api/odp_init.h | 35 +++++++++++++++++++++------
>  platform/linux-generic/odp_init.c             |  3 ++-
>  test/api_test/odp_common.c                    |  2 +-
>  9 files changed, 36 insertions(+), 16 deletions(-)
>
> diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c
> index 6055324..eb8b340 100644
> --- a/example/generator/odp_generator.c
> +++ b/example/generator/odp_generator.c
> @@ -519,7 +519,7 @@ int main(int argc, char *argv[])
>         odp_shm_t shm;
>
>         /* 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/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
> index ec6c87a..2f2dc19 100644
> --- a/example/ipsec/odp_ipsec.c
> +++ b/example/ipsec/odp_ipsec.c
> @@ -1176,7 +1176,7 @@ main(int argc, char *argv[])
>         odp_shm_t shm;
>
>         /* 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 8aa0ba0..57037cd 100644
> --- a/example/l2fwd/odp_l2fwd.c
> +++ b/example/l2fwd/odp_l2fwd.c
> @@ -319,7 +319,7 @@ int main(int argc, char *argv[])
>         odp_shm_t shm;
>
>         /* 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 47d764e..0e9aa3d 100644
> --- a/example/odp_example/odp_example.c
> +++ b/example/odp_example/odp_example.c
> @@ -985,7 +985,7 @@ int main(int argc, char *argv[])
>         memset(thread_tbl, 0, sizeof(thread_tbl));
>
>         /* ODP global init */
> -       if (odp_init_global()) {
> +       if (odp_init_global(NULL, NULL)) {
>                 ODP_ERR("ODP global init failed.\n");
>                 return -1;
>         }
> diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
> index 145ae47..2cf3f0d 100644
> --- a/example/packet/odp_pktio.c
> +++ b/example/packet/odp_pktio.c
> @@ -299,7 +299,7 @@ int main(int argc, char *argv[])
>         odp_shm_t shm;
>
>         /* 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 87900fc..78b2ae2 100644
> --- a/example/timer/odp_timer_test.c
> +++ b/example/timer/odp_timer_test.c
> @@ -256,7 +256,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/platform/linux-generic/include/api/odp_init.h b/platform/linux-generic/include/api/odp_init.h
> index 13c8e44..fab4f6e 100644
> --- a/platform/linux-generic/include/api/odp_init.h
> +++ b/platform/linux-generic/include/api/odp_init.h
> @@ -8,7 +8,7 @@
>  /**
>   * @file
>   *
> - * ODP initialisation
> + * ODP initialization
>   */
>
>  #ifndef ODP_INIT_H_
> @@ -24,20 +24,39 @@ extern "C" {
>
>
>
> +/** ODP initialization data.
> + * Data that is required to initialize the ODP API with the
> + * application specific data such as specifying a logging callback, the log
> + * level etc.
> + */
> +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;
> +
>
>  /**
> - * Perform global ODP initalisation.
> - *
> - * This function must be called once before calling
> - * any other ODP API functions.
> + * Perform global ODP initialization.
>   *
> + * This function must be called once before calling any other ODP API
> + * functions.
> + * @param[in] params Those parameters that are interpreted by the ODP API
> + * @param[in] platform_params Those parameters that are passed without
> + * interpretation by the ODP API to the implementation.
>   * @return 0 if successful
>   */
> -int odp_init_global(void);
> -
> +int odp_init_global(odp_init_t *params, odp_platform_init_t *platform_params);
>
>  /**
> - * Perform thread local ODP initalisation.
> + * Perform thread local ODP initialization.
>   *
>   * All threads must call this function before calling
>   * any other ODP API functions.
> diff --git a/platform/linux-generic/odp_init.c b/platform/linux-generic/odp_init.c
> index 55fa53a..c97c5aa 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_init_t *params  ODP_UNUSED,
> +                       odp_platform_init_t *platform_params ODP_UNUSED)
>  {
>         odp_system_info_init();
>
> diff --git a/test/api_test/odp_common.c b/test/api_test/odp_common.c
> index b0a6fbc..ed1fc97 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;
>         }
> --
> 1.9.1
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
Maxim Uvarov Oct. 13, 2014, 4:13 p.m. UTC | #2
Patch merged!

Maxim.

On 10/09/2014 11:40 AM, Ciprian Barbu wrote:
> Reviewed-by: Ciprian Barbu <ciprian.barbu@linaro.org>
>
> On Wed, Oct 8, 2014 at 3:32 PM, Mike Holmes <mike.holmes@linaro.org> wrote:
>> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
>> ---
>>   example/generator/odp_generator.c             |  2 +-
>>   example/ipsec/odp_ipsec.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 +-
>>   platform/linux-generic/include/api/odp_init.h | 35 +++++++++++++++++++++------
>>   platform/linux-generic/odp_init.c             |  3 ++-
>>   test/api_test/odp_common.c                    |  2 +-
>>   9 files changed, 36 insertions(+), 16 deletions(-)
>>
>> diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c
>> index 6055324..eb8b340 100644
>> --- a/example/generator/odp_generator.c
>> +++ b/example/generator/odp_generator.c
>> @@ -519,7 +519,7 @@ int main(int argc, char *argv[])
>>          odp_shm_t shm;
>>
>>          /* 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/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
>> index ec6c87a..2f2dc19 100644
>> --- a/example/ipsec/odp_ipsec.c
>> +++ b/example/ipsec/odp_ipsec.c
>> @@ -1176,7 +1176,7 @@ main(int argc, char *argv[])
>>          odp_shm_t shm;
>>
>>          /* 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 8aa0ba0..57037cd 100644
>> --- a/example/l2fwd/odp_l2fwd.c
>> +++ b/example/l2fwd/odp_l2fwd.c
>> @@ -319,7 +319,7 @@ int main(int argc, char *argv[])
>>          odp_shm_t shm;
>>
>>          /* 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 47d764e..0e9aa3d 100644
>> --- a/example/odp_example/odp_example.c
>> +++ b/example/odp_example/odp_example.c
>> @@ -985,7 +985,7 @@ int main(int argc, char *argv[])
>>          memset(thread_tbl, 0, sizeof(thread_tbl));
>>
>>          /* ODP global init */
>> -       if (odp_init_global()) {
>> +       if (odp_init_global(NULL, NULL)) {
>>                  ODP_ERR("ODP global init failed.\n");
>>                  return -1;
>>          }
>> diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
>> index 145ae47..2cf3f0d 100644
>> --- a/example/packet/odp_pktio.c
>> +++ b/example/packet/odp_pktio.c
>> @@ -299,7 +299,7 @@ int main(int argc, char *argv[])
>>          odp_shm_t shm;
>>
>>          /* 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 87900fc..78b2ae2 100644
>> --- a/example/timer/odp_timer_test.c
>> +++ b/example/timer/odp_timer_test.c
>> @@ -256,7 +256,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/platform/linux-generic/include/api/odp_init.h b/platform/linux-generic/include/api/odp_init.h
>> index 13c8e44..fab4f6e 100644
>> --- a/platform/linux-generic/include/api/odp_init.h
>> +++ b/platform/linux-generic/include/api/odp_init.h
>> @@ -8,7 +8,7 @@
>>   /**
>>    * @file
>>    *
>> - * ODP initialisation
>> + * ODP initialization
>>    */
>>
>>   #ifndef ODP_INIT_H_
>> @@ -24,20 +24,39 @@ extern "C" {
>>
>>
>>
>> +/** ODP initialization data.
>> + * Data that is required to initialize the ODP API with the
>> + * application specific data such as specifying a logging callback, the log
>> + * level etc.
>> + */
>> +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;
>> +
>>
>>   /**
>> - * Perform global ODP initalisation.
>> - *
>> - * This function must be called once before calling
>> - * any other ODP API functions.
>> + * Perform global ODP initialization.
>>    *
>> + * This function must be called once before calling any other ODP API
>> + * functions.
>> + * @param[in] params Those parameters that are interpreted by the ODP API
>> + * @param[in] platform_params Those parameters that are passed without
>> + * interpretation by the ODP API to the implementation.
>>    * @return 0 if successful
>>    */
>> -int odp_init_global(void);
>> -
>> +int odp_init_global(odp_init_t *params, odp_platform_init_t *platform_params);
>>
>>   /**
>> - * Perform thread local ODP initalisation.
>> + * Perform thread local ODP initialization.
>>    *
>>    * All threads must call this function before calling
>>    * any other ODP API functions.
>> diff --git a/platform/linux-generic/odp_init.c b/platform/linux-generic/odp_init.c
>> index 55fa53a..c97c5aa 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_init_t *params  ODP_UNUSED,
>> +                       odp_platform_init_t *platform_params ODP_UNUSED)
>>   {
>>          odp_system_info_init();
>>
>> diff --git a/test/api_test/odp_common.c b/test/api_test/odp_common.c
>> index b0a6fbc..ed1fc97 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;
>>          }
>> --
>> 1.9.1
>>
>>
>> _______________________________________________
>> lng-odp mailing list
>> lng-odp@lists.linaro.org
>> http://lists.linaro.org/mailman/listinfo/lng-odp
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
diff mbox

Patch

diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c
index 6055324..eb8b340 100644
--- a/example/generator/odp_generator.c
+++ b/example/generator/odp_generator.c
@@ -519,7 +519,7 @@  int main(int argc, char *argv[])
 	odp_shm_t shm;
 
 	/* 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/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
index ec6c87a..2f2dc19 100644
--- a/example/ipsec/odp_ipsec.c
+++ b/example/ipsec/odp_ipsec.c
@@ -1176,7 +1176,7 @@  main(int argc, char *argv[])
 	odp_shm_t shm;
 
 	/* 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 8aa0ba0..57037cd 100644
--- a/example/l2fwd/odp_l2fwd.c
+++ b/example/l2fwd/odp_l2fwd.c
@@ -319,7 +319,7 @@  int main(int argc, char *argv[])
 	odp_shm_t shm;
 
 	/* 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 47d764e..0e9aa3d 100644
--- a/example/odp_example/odp_example.c
+++ b/example/odp_example/odp_example.c
@@ -985,7 +985,7 @@  int main(int argc, char *argv[])
 	memset(thread_tbl, 0, sizeof(thread_tbl));
 
 	/* ODP global init */
-	if (odp_init_global()) {
+	if (odp_init_global(NULL, NULL)) {
 		ODP_ERR("ODP global init failed.\n");
 		return -1;
 	}
diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
index 145ae47..2cf3f0d 100644
--- a/example/packet/odp_pktio.c
+++ b/example/packet/odp_pktio.c
@@ -299,7 +299,7 @@  int main(int argc, char *argv[])
 	odp_shm_t shm;
 
 	/* 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 87900fc..78b2ae2 100644
--- a/example/timer/odp_timer_test.c
+++ b/example/timer/odp_timer_test.c
@@ -256,7 +256,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/platform/linux-generic/include/api/odp_init.h b/platform/linux-generic/include/api/odp_init.h
index 13c8e44..fab4f6e 100644
--- a/platform/linux-generic/include/api/odp_init.h
+++ b/platform/linux-generic/include/api/odp_init.h
@@ -8,7 +8,7 @@ 
 /**
  * @file
  *
- * ODP initialisation
+ * ODP initialization
  */
 
 #ifndef ODP_INIT_H_
@@ -24,20 +24,39 @@  extern "C" {
 
 
 
+/** ODP initialization data.
+ * Data that is required to initialize the ODP API with the
+ * application specific data such as specifying a logging callback, the log
+ * level etc.
+ */
+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;
+
 
 /**
- * Perform global ODP initalisation.
- *
- * This function must be called once before calling
- * any other ODP API functions.
+ * Perform global ODP initialization.
  *
+ * This function must be called once before calling any other ODP API
+ * functions.
+ * @param[in] params Those parameters that are interpreted by the ODP API
+ * @param[in] platform_params Those parameters that are passed without
+ * interpretation by the ODP API to the implementation.
  * @return 0 if successful
  */
-int odp_init_global(void);
-
+int odp_init_global(odp_init_t *params, odp_platform_init_t *platform_params);
 
 /**
- * Perform thread local ODP initalisation.
+ * Perform thread local ODP initialization.
  *
  * All threads must call this function before calling
  * any other ODP API functions.
diff --git a/platform/linux-generic/odp_init.c b/platform/linux-generic/odp_init.c
index 55fa53a..c97c5aa 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_init_t *params  ODP_UNUSED,
+			odp_platform_init_t *platform_params ODP_UNUSED)
 {
 	odp_system_info_init();
 
diff --git a/test/api_test/odp_common.c b/test/api_test/odp_common.c
index b0a6fbc..ed1fc97 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;
 	}