diff mbox

[v7] Add-global_init-parameters

Message ID 1409864808-21007-1-git-send-email-mike.holmes@linaro.org
State Rejected
Headers show

Commit Message

Mike Holmes Sept. 4, 2014, 9:06 p.m. UTC
Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
---

v7:
Fix netmap build

 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/packet_netmap/odp_pktio_netmap.c           |  2 +-
 example/timer/odp_timer_test.c                     |  2 +-
 platform/linux-dpdk/Makefile.am                    |  4 +-
 platform/linux-dpdk/{odp_init.c => odp_platform.c} | 66 +------------------
 platform/linux-generic/Makefile.am                 |  1 +
 platform/linux-generic/include/api/odp.h           |  1 +
 platform/linux-generic/include/api/odp_init.h      | 34 +++++++---
 platform/linux-generic/include/odp_internal.h      |  3 +
 platform/linux-generic/odp_init.c                  |  9 ++-
 platform/linux-generic/odp_platform.c              | 14 ++++
 platform/linux-keystone2/Makefile.am               |  4 +-
 .../linux-keystone2/{odp_init.c => odp_platform.c} | 74 ++--------------------
 test/api_test/odp_common.c                         |  2 +-
 17 files changed, 73 insertions(+), 151 deletions(-)
 rename platform/linux-dpdk/{odp_init.c => odp_platform.c} (50%)
 create mode 100644 platform/linux-generic/odp_platform.c
 rename platform/linux-keystone2/{odp_init.c => odp_platform.c} (72%)

Comments

Savolainen, Petri (NSN - FI/Espoo) Sept. 18, 2014, 12:09 a.m. UTC | #1
Reviewed-by: Petri Savolainen <petri.savolainen@linaro.org>


... after rebase since keystone implementation has changed. There's now implantation specific init functions since ODP_ERR was replaced with odp_pr_err (which is keystone specific).


-Petri



> -----Original Message-----
> From: lng-odp-bounces@lists.linaro.org [mailto:lng-odp-
> bounces@lists.linaro.org] On Behalf Of ext Mike Holmes
> Sent: Friday, September 05, 2014 12:07 AM
> To: lng-odp@lists.linaro.org
> Subject: [lng-odp] [PATCH v7] Add-global_init-parameters
> 
> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
> ---
> 
> v7:
> Fix netmap build
> 
>  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/packet_netmap/odp_pktio_netmap.c           |  2 +-
>  example/timer/odp_timer_test.c                     |  2 +-
>  platform/linux-dpdk/Makefile.am                    |  4 +-
>  platform/linux-dpdk/{odp_init.c => odp_platform.c} | 66 +----------------
> --
>  platform/linux-generic/Makefile.am                 |  1 +
>  platform/linux-generic/include/api/odp.h           |  1 +
>  platform/linux-generic/include/api/odp_init.h      | 34 +++++++---
>  platform/linux-generic/include/odp_internal.h      |  3 +
>  platform/linux-generic/odp_init.c                  |  9 ++-
>  platform/linux-generic/odp_platform.c              | 14 ++++
>  platform/linux-keystone2/Makefile.am               |  4 +-
>  .../linux-keystone2/{odp_init.c => odp_platform.c} | 74 ++---------------
> -----
>  test/api_test/odp_common.c                         |  2 +-
>  17 files changed, 73 insertions(+), 151 deletions(-)
>  rename platform/linux-dpdk/{odp_init.c => odp_platform.c} (50%)
>  create mode 100644 platform/linux-generic/odp_platform.c
>  rename platform/linux-keystone2/{odp_init.c => odp_platform.c} (72%)
> 
> diff --git a/example/generator/odp_generator.c
> b/example/generator/odp_generator.c
> index 65c2034..af3b819 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 6a38c1b..df87a9e 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 40d237b..0aa08f7 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 88ce575..a349054 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/packet_netmap/odp_pktio_netmap.c
> b/example/packet_netmap/odp_pktio_netmap.c
> index 88af2e5..2d6344c 100644
> --- a/example/packet_netmap/odp_pktio_netmap.c
> +++ b/example/packet_netmap/odp_pktio_netmap.c
> @@ -227,7 +227,7 @@ int main(int argc, char *argv[])
>  	int i;
> 
>  	/* 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 1061190..7e1c7a0 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-dpdk/Makefile.am b/platform/linux-
> dpdk/Makefile.am
> index a59435f..98d4ab4 100644
> --- a/platform/linux-dpdk/Makefile.am
> +++ b/platform/linux-dpdk/Makefile.am
> @@ -67,13 +67,15 @@ __LIB__libodp_la_SOURCES = \
>  			   odp_buffer.c \
>  			   odp_buffer_pool.c \
>  			   ../linux-generic/odp_coremask.c \
> -			   odp_init.c \
> +			   ../linux-generic/odp_init.c \
>  			   odp_linux.c \
>  			   odp_packet.c \
>  			   odp_packet_dpdk.c \
>  			   ../linux-generic/odp_packet_flags.c \
>  			   odp_packet_io.c \
>  			   ../linux-generic/odp_packet_socket.c \
> +			   ../linux-generic/odp_crypto.c \
> +			   odp_platform.c \
>  			   odp_queue.c \
>  			   ../linux-generic/odp_ring.c \
>  			   ../linux-generic/odp_rwlock.c \
> diff --git a/platform/linux-dpdk/odp_init.c b/platform/linux-
> dpdk/odp_platform.c
> similarity index 50%
> rename from platform/linux-dpdk/odp_init.c
> rename to platform/linux-dpdk/odp_platform.c
> index ecc2066..3162c05 100644
> --- a/platform/linux-dpdk/odp_init.c
> +++ b/platform/linux-dpdk/odp_platform.c
> @@ -1,4 +1,4 @@
> -/* Copyright (c) 2013, Linaro Limited
> +/* Copyright (c) 2014, Linaro Limited
>   * All rights reserved.
>   *
>   * SPDX-License-Identifier:     BSD-3-Clause
> @@ -9,7 +9,7 @@
>  #include <odp_debug.h>
>  #include <odp_packet_dpdk.h>
> 
> -int odp_init_dpdk(void)
> +int odp_init_platform(odp_global_platform_init_t *platform_params
> ODP_UNUSED)
>  {
>  	int test_argc = 5;
>  	char *test_argv[6];
> @@ -49,65 +49,3 @@ int odp_init_dpdk(void)
> 
>  	return 0;
>  }
> -
> -int odp_init_global(void)
> -{
> -	odp_thread_init_global();
> -
> -	odp_system_info_init();
> -
> -	if (odp_init_dpdk()) {
> -		ODP_ERR("ODP dpdk init failed.\n");
> -		return -1;
> -	}
> -
> -	if (odp_shm_init_global()) {
> -		ODP_ERR("ODP shm init failed.\n");
> -		return -1;
> -	}
> -
> -	if (odp_buffer_pool_init_global()) {
> -		ODP_ERR("ODP buffer pool init failed.\n");
> -		return -1;
> -	}
> -
> -	if (odp_queue_init_global()) {
> -		ODP_ERR("ODP queue init failed.\n");
> -		return -1;
> -	}
> -
> -	if (odp_schedule_init_global()) {
> -		ODP_ERR("ODP schedule init failed.\n");
> -		return -1;
> -	}
> -
> -	if (odp_pktio_init_global()) {
> -		ODP_ERR("ODP packet io init failed.\n");
> -		return -1;
> -	}
> -
> -	if (odp_timer_init_global()) {
> -		ODP_ERR("ODP timer init failed.\n");
> -		return -1;
> -	}
> -
> -	return 0;
> -}
> -
> -
> -int odp_init_local(int thr_id)
> -{
> -	odp_thread_init_local(thr_id);
> -
> -	if (odp_pktio_init_local()) {
> -		ODP_ERR("ODP packet io local init failed.\n");
> -		return -1;
> -	}
> -
> -	if (odp_schedule_init_local()) {
> -		ODP_ERR("ODP schedule local init failed.\n");
> -		return -1;
> -	}
> -
> -	return 0;
> -}
> diff --git a/platform/linux-generic/Makefile.am b/platform/linux-
> generic/Makefile.am
> index 25c82ea..1b4fd13 100644
> --- a/platform/linux-generic/Makefile.am
> +++ b/platform/linux-generic/Makefile.am
> @@ -62,6 +62,7 @@ __LIB__libodp_la_SOURCES = \
>  			   odp_packet_flags.c \
>  			   odp_packet_io.c \
>  			   odp_packet_socket.c \
> +			   odp_platform.c \
>  			   odp_queue.c \
>  			   odp_ring.c \
>  			   odp_rwlock.c \
> diff --git a/platform/linux-generic/include/api/odp.h b/platform/linux-
> generic/include/api/odp.h
> index 0ee3faf..99e2ae0 100644
> --- a/platform/linux-generic/include/api/odp.h
> +++ b/platform/linux-generic/include/api/odp.h
> @@ -48,6 +48,7 @@ extern "C" {
>  #include <odp_packet.h>
>  #include <odp_packet_flags.h>
>  #include <odp_packet_io.h>
> +#include <odp_crypto.h>
> 
>  #ifdef __cplusplus
>  }
> diff --git a/platform/linux-generic/include/api/odp_init.h
> b/platform/linux-generic/include/api/odp_init.h
> index 490324a..f89b7d4 100644
> --- a/platform/linux-generic/include/api/odp_init.h
> +++ b/platform/linux-generic/include/api/odp_init.h
> @@ -22,23 +22,39 @@ extern "C" {
> 
>  #include <odp_std_types.h>
> 
> -
> -
> +/** ODP initialisation 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 initialisation.
>   *
> + * 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 initialisation.
>   * All threads must call this function before calling
>   * any other ODP API functions.
>   * @param thr_id Thread id
> diff --git a/platform/linux-generic/include/odp_internal.h
> b/platform/linux-generic/include/odp_internal.h
> index aa79493..29fb3b5 100644
> --- a/platform/linux-generic/include/odp_internal.h
> +++ b/platform/linux-generic/include/odp_internal.h
> @@ -4,6 +4,7 @@
>   * SPDX-License-Identifier:     BSD-3-Clause
>   */
> 
> +#include <odp_init.h>
> 
>  /**
>   * @file
> @@ -42,6 +43,8 @@ int odp_schedule_init_local(void);
>  int odp_timer_init_global(void);
>  int odp_timer_disarm_all(void);
> 
> +int odp_init_platform(odp_platform_init_t *platform_params);
> +
>  #ifdef __cplusplus
>  }
>  #endif
> diff --git a/platform/linux-generic/odp_init.c b/platform/linux-
> generic/odp_init.c
> index 5b7e192..834c3bf 100644
> --- a/platform/linux-generic/odp_init.c
> +++ b/platform/linux-generic/odp_init.c
> @@ -8,13 +8,18 @@
>  #include <odp_internal.h>
>  #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_thread_init_global();
> 
>  	odp_system_info_init();
> 
> +	if (odp_init_platform(platform_params)) {
> +		ODP_ERR("ODP platform init failed.\n");
> +		return -1;
> +	}
> +
>  	if (odp_shm_init_global()) {
>  		ODP_ERR("ODP shm init failed.\n");
>  		return -1;
> diff --git a/platform/linux-generic/odp_platform.c b/platform/linux-
> generic/odp_platform.c
> new file mode 100644
> index 0000000..679913d
> --- /dev/null
> +++ b/platform/linux-generic/odp_platform.c
> @@ -0,0 +1,14 @@
> +/* Copyright (c) 2014, Linaro Limited
> + * All rights reserved.
> + *
> + * SPDX-License-Identifier:     BSD-3-Clause
> + */
> +
> +#include <odp_init.h>
> +#include <odp_internal.h>
> +#include <odp_debug.h>
> +
> +int odp_init_platform(odp_platform_init_t *platform_params ODP_UNUSED)
> +{
> +	return 0;
> +}
> diff --git a/platform/linux-keystone2/Makefile.am b/platform/linux-
> keystone2/Makefile.am
> index 027c035..3751be9 100644
> --- a/platform/linux-keystone2/Makefile.am
> +++ b/platform/linux-keystone2/Makefile.am
> @@ -70,13 +70,15 @@ __LIB__libodp_la_SOURCES = \
>  			   odp_buffer.c \
>  			   odp_buffer_pool.c \
>  			   ../linux-generic/odp_coremask.c \
> -			   odp_init.c \
> +			   ../linux-generic/odp_init.c \
>  			   ../linux-generic/odp_linux.c \
>  			   odp_packet.c \
>  			   ../linux-generic/odp_packet_flags.c \
>  			   odp_packet_io.c \
>  			   ../linux-generic/odp_packet_socket.c \
> +			   odp_platform.c \
>  			   odp_queue.c \
> +			   ../linux-generic/odp_crypto.c \
>  			   ../linux-generic/odp_ring.c \
>  			   ../linux-generic/odp_rwlock.c \
>  			   ../linux-generic/odp_schedule.c \
> diff --git a/platform/linux-keystone2/odp_init.c b/platform/linux-
> keystone2/odp_platform.c
> similarity index 72%
> rename from platform/linux-keystone2/odp_init.c
> rename to platform/linux-keystone2/odp_platform.c
> index f832551..e966627 100644
> --- a/platform/linux-keystone2/odp_init.c
> +++ b/platform/linux-keystone2/odp_platform.c
> @@ -1,4 +1,4 @@
> -/* Copyright (c) 2013, Linaro Limited
> +/* Copyright (c) 2014, Linaro Limited
>   * All rights reserved.
>   *
>   * SPDX-License-Identifier:     BSD-3-Clause
> @@ -15,17 +15,19 @@
>  #include <odp_packet_internal.h>
> 
>  /*
> - * Make region_configs[] global, because hw_config is saved in
> - * ti_em_rh_init_global() and it references region_configs[].
> - */
> + *  * Make region_configs[] global, because hw_config is saved in
> + *   * ti_em_rh_init_global() and it references region_configs[].
> + *    */
>  static ti_em_osal_hw_region_config_t region_configs[TI_ODP_REGION_NUM];
> 
> -static int ti_init_hw_config(void)
> +int odp_init_platform(odp_platform_init_t *platform_params ODP_UNUSED)
>  {
>  	ti_em_rh_hw_config_t           hw_config;
>  	ti_em_osal_hw_region_config_t *reg_config;
>  	memset(&hw_config, 0, sizeof(ti_em_rh_hw_config_t));
> 
> +	ti_em_osal_core_init_global();
> +
>  	/* Set ODP initialization parameters */
>  	hw_config.private_free_queue_idx = MY_EM_PRIVATE_FREE_QUEUE_IDX;
>  	hw_config.hw_queue_base_idx      = MY_EM_SCHED_QUEUE_IDX;
> @@ -89,65 +91,3 @@ static int ti_init_hw_config(void)
>  	return 0;
>  }
> 
> -
> -int odp_init_global(void)
> -{
> -	odp_thread_init_global();
> -
> -	odp_system_info_init();
> -
> -	ti_em_osal_core_init_global();
> -	ti_init_hw_config();
> -
> -	if (odp_shm_init_global()) {
> -		ODP_ERR("ODP shm init failed.\n");
> -		return -1;
> -	}
> -
> -	if (odp_buffer_pool_init_global()) {
> -		ODP_ERR("ODP buffer pool init failed.\n");
> -		return -1;
> -	}
> -
> -	if (odp_queue_init_global()) {
> -		ODP_ERR("ODP queue init failed.\n");
> -		return -1;
> -	}
> -
> -	if (odp_schedule_init_global()) {
> -		ODP_ERR("ODP schedule init failed.\n");
> -		return -1;
> -	}
> -
> -	if (odp_pktio_init_global()) {
> -		ODP_ERR("ODP packet io init failed.\n");
> -		return -1;
> -	}
> -
> -	if (odp_timer_init_global()) {
> -		ODP_ERR("ODP timer init failed.\n");
> -		return -1;
> -	}
> -
> -	return 0;
> -}
> -
> -
> -int odp_init_local(int thr_id)
> -{
> -	odp_thread_init_local(thr_id);
> -
> -	ti_em_rh_init_local();
> -
> -	if (odp_pktio_init_local()) {
> -		ODP_ERR("ODP packet io local init failed.\n");
> -		return -1;
> -	}
> -
> -	if (odp_schedule_init_local()) {
> -		ODP_ERR("ODP schedule local init failed.\n");
> -		return -1;
> -	}
> -
> -	return 0;
> -}
> 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 Sept. 22, 2014, 9:09 a.m. UTC | #2
Mike, can you up this patch?

Maxim.

On 09/18/2014 04:09 AM, Savolainen, Petri (NSN - FI/Espoo) wrote:
>
> Reviewed-by: Petri Savolainen <petri.savolainen@linaro.org>
>
>
> ... after rebase since keystone implementation has changed. There's now implantation specific init functions since ODP_ERR was replaced with odp_pr_err (which is keystone specific).
>
>
> -Petri
>
>
>
>> -----Original Message-----
>> From: lng-odp-bounces@lists.linaro.org [mailto:lng-odp-
>> bounces@lists.linaro.org] On Behalf Of ext Mike Holmes
>> Sent: Friday, September 05, 2014 12:07 AM
>> To: lng-odp@lists.linaro.org
>> Subject: [lng-odp] [PATCH v7] Add-global_init-parameters
>>
>> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
>> ---
>>
>> v7:
>> Fix netmap build
>>
>>   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/packet_netmap/odp_pktio_netmap.c           |  2 +-
>>   example/timer/odp_timer_test.c                     |  2 +-
>>   platform/linux-dpdk/Makefile.am                    |  4 +-
>>   platform/linux-dpdk/{odp_init.c => odp_platform.c} | 66 +----------------
>> --
>>   platform/linux-generic/Makefile.am                 |  1 +
>>   platform/linux-generic/include/api/odp.h           |  1 +
>>   platform/linux-generic/include/api/odp_init.h      | 34 +++++++---
>>   platform/linux-generic/include/odp_internal.h      |  3 +
>>   platform/linux-generic/odp_init.c                  |  9 ++-
>>   platform/linux-generic/odp_platform.c              | 14 ++++
>>   platform/linux-keystone2/Makefile.am               |  4 +-
>>   .../linux-keystone2/{odp_init.c => odp_platform.c} | 74 ++---------------
>> -----
>>   test/api_test/odp_common.c                         |  2 +-
>>   17 files changed, 73 insertions(+), 151 deletions(-)
>>   rename platform/linux-dpdk/{odp_init.c => odp_platform.c} (50%)
>>   create mode 100644 platform/linux-generic/odp_platform.c
>>   rename platform/linux-keystone2/{odp_init.c => odp_platform.c} (72%)
>>
>> diff --git a/example/generator/odp_generator.c
>> b/example/generator/odp_generator.c
>> index 65c2034..af3b819 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 6a38c1b..df87a9e 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 40d237b..0aa08f7 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 88ce575..a349054 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/packet_netmap/odp_pktio_netmap.c
>> b/example/packet_netmap/odp_pktio_netmap.c
>> index 88af2e5..2d6344c 100644
>> --- a/example/packet_netmap/odp_pktio_netmap.c
>> +++ b/example/packet_netmap/odp_pktio_netmap.c
>> @@ -227,7 +227,7 @@ int main(int argc, char *argv[])
>>   	int i;
>>
>>   	/* 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 1061190..7e1c7a0 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-dpdk/Makefile.am b/platform/linux-
>> dpdk/Makefile.am
>> index a59435f..98d4ab4 100644
>> --- a/platform/linux-dpdk/Makefile.am
>> +++ b/platform/linux-dpdk/Makefile.am
>> @@ -67,13 +67,15 @@ __LIB__libodp_la_SOURCES = \
>>   			   odp_buffer.c \
>>   			   odp_buffer_pool.c \
>>   			   ../linux-generic/odp_coremask.c \
>> -			   odp_init.c \
>> +			   ../linux-generic/odp_init.c \
>>   			   odp_linux.c \
>>   			   odp_packet.c \
>>   			   odp_packet_dpdk.c \
>>   			   ../linux-generic/odp_packet_flags.c \
>>   			   odp_packet_io.c \
>>   			   ../linux-generic/odp_packet_socket.c \
>> +			   ../linux-generic/odp_crypto.c \
>> +			   odp_platform.c \
>>   			   odp_queue.c \
>>   			   ../linux-generic/odp_ring.c \
>>   			   ../linux-generic/odp_rwlock.c \
>> diff --git a/platform/linux-dpdk/odp_init.c b/platform/linux-
>> dpdk/odp_platform.c
>> similarity index 50%
>> rename from platform/linux-dpdk/odp_init.c
>> rename to platform/linux-dpdk/odp_platform.c
>> index ecc2066..3162c05 100644
>> --- a/platform/linux-dpdk/odp_init.c
>> +++ b/platform/linux-dpdk/odp_platform.c
>> @@ -1,4 +1,4 @@
>> -/* Copyright (c) 2013, Linaro Limited
>> +/* Copyright (c) 2014, Linaro Limited
>>    * All rights reserved.
>>    *
>>    * SPDX-License-Identifier:     BSD-3-Clause
>> @@ -9,7 +9,7 @@
>>   #include <odp_debug.h>
>>   #include <odp_packet_dpdk.h>
>>
>> -int odp_init_dpdk(void)
>> +int odp_init_platform(odp_global_platform_init_t *platform_params
>> ODP_UNUSED)
>>   {
>>   	int test_argc = 5;
>>   	char *test_argv[6];
>> @@ -49,65 +49,3 @@ int odp_init_dpdk(void)
>>
>>   	return 0;
>>   }
>> -
>> -int odp_init_global(void)
>> -{
>> -	odp_thread_init_global();
>> -
>> -	odp_system_info_init();
>> -
>> -	if (odp_init_dpdk()) {
>> -		ODP_ERR("ODP dpdk init failed.\n");
>> -		return -1;
>> -	}
>> -
>> -	if (odp_shm_init_global()) {
>> -		ODP_ERR("ODP shm init failed.\n");
>> -		return -1;
>> -	}
>> -
>> -	if (odp_buffer_pool_init_global()) {
>> -		ODP_ERR("ODP buffer pool init failed.\n");
>> -		return -1;
>> -	}
>> -
>> -	if (odp_queue_init_global()) {
>> -		ODP_ERR("ODP queue init failed.\n");
>> -		return -1;
>> -	}
>> -
>> -	if (odp_schedule_init_global()) {
>> -		ODP_ERR("ODP schedule init failed.\n");
>> -		return -1;
>> -	}
>> -
>> -	if (odp_pktio_init_global()) {
>> -		ODP_ERR("ODP packet io init failed.\n");
>> -		return -1;
>> -	}
>> -
>> -	if (odp_timer_init_global()) {
>> -		ODP_ERR("ODP timer init failed.\n");
>> -		return -1;
>> -	}
>> -
>> -	return 0;
>> -}
>> -
>> -
>> -int odp_init_local(int thr_id)
>> -{
>> -	odp_thread_init_local(thr_id);
>> -
>> -	if (odp_pktio_init_local()) {
>> -		ODP_ERR("ODP packet io local init failed.\n");
>> -		return -1;
>> -	}
>> -
>> -	if (odp_schedule_init_local()) {
>> -		ODP_ERR("ODP schedule local init failed.\n");
>> -		return -1;
>> -	}
>> -
>> -	return 0;
>> -}
>> diff --git a/platform/linux-generic/Makefile.am b/platform/linux-
>> generic/Makefile.am
>> index 25c82ea..1b4fd13 100644
>> --- a/platform/linux-generic/Makefile.am
>> +++ b/platform/linux-generic/Makefile.am
>> @@ -62,6 +62,7 @@ __LIB__libodp_la_SOURCES = \
>>   			   odp_packet_flags.c \
>>   			   odp_packet_io.c \
>>   			   odp_packet_socket.c \
>> +			   odp_platform.c \
>>   			   odp_queue.c \
>>   			   odp_ring.c \
>>   			   odp_rwlock.c \
>> diff --git a/platform/linux-generic/include/api/odp.h b/platform/linux-
>> generic/include/api/odp.h
>> index 0ee3faf..99e2ae0 100644
>> --- a/platform/linux-generic/include/api/odp.h
>> +++ b/platform/linux-generic/include/api/odp.h
>> @@ -48,6 +48,7 @@ extern "C" {
>>   #include <odp_packet.h>
>>   #include <odp_packet_flags.h>
>>   #include <odp_packet_io.h>
>> +#include <odp_crypto.h>
>>
>>   #ifdef __cplusplus
>>   }
>> diff --git a/platform/linux-generic/include/api/odp_init.h
>> b/platform/linux-generic/include/api/odp_init.h
>> index 490324a..f89b7d4 100644
>> --- a/platform/linux-generic/include/api/odp_init.h
>> +++ b/platform/linux-generic/include/api/odp_init.h
>> @@ -22,23 +22,39 @@ extern "C" {
>>
>>   #include <odp_std_types.h>
>>
>> -
>> -
>> +/** ODP initialisation 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 initialisation.
>>    *
>> + * 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 initialisation.
>>    * All threads must call this function before calling
>>    * any other ODP API functions.
>>    * @param thr_id Thread id
>> diff --git a/platform/linux-generic/include/odp_internal.h
>> b/platform/linux-generic/include/odp_internal.h
>> index aa79493..29fb3b5 100644
>> --- a/platform/linux-generic/include/odp_internal.h
>> +++ b/platform/linux-generic/include/odp_internal.h
>> @@ -4,6 +4,7 @@
>>    * SPDX-License-Identifier:     BSD-3-Clause
>>    */
>>
>> +#include <odp_init.h>
>>
>>   /**
>>    * @file
>> @@ -42,6 +43,8 @@ int odp_schedule_init_local(void);
>>   int odp_timer_init_global(void);
>>   int odp_timer_disarm_all(void);
>>
>> +int odp_init_platform(odp_platform_init_t *platform_params);
>> +
>>   #ifdef __cplusplus
>>   }
>>   #endif
>> diff --git a/platform/linux-generic/odp_init.c b/platform/linux-
>> generic/odp_init.c
>> index 5b7e192..834c3bf 100644
>> --- a/platform/linux-generic/odp_init.c
>> +++ b/platform/linux-generic/odp_init.c
>> @@ -8,13 +8,18 @@
>>   #include <odp_internal.h>
>>   #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_thread_init_global();
>>
>>   	odp_system_info_init();
>>
>> +	if (odp_init_platform(platform_params)) {
>> +		ODP_ERR("ODP platform init failed.\n");
>> +		return -1;
>> +	}
>> +
>>   	if (odp_shm_init_global()) {
>>   		ODP_ERR("ODP shm init failed.\n");
>>   		return -1;
>> diff --git a/platform/linux-generic/odp_platform.c b/platform/linux-
>> generic/odp_platform.c
>> new file mode 100644
>> index 0000000..679913d
>> --- /dev/null
>> +++ b/platform/linux-generic/odp_platform.c
>> @@ -0,0 +1,14 @@
>> +/* Copyright (c) 2014, Linaro Limited
>> + * All rights reserved.
>> + *
>> + * SPDX-License-Identifier:     BSD-3-Clause
>> + */
>> +
>> +#include <odp_init.h>
>> +#include <odp_internal.h>
>> +#include <odp_debug.h>
>> +
>> +int odp_init_platform(odp_platform_init_t *platform_params ODP_UNUSED)
>> +{
>> +	return 0;
>> +}
>> diff --git a/platform/linux-keystone2/Makefile.am b/platform/linux-
>> keystone2/Makefile.am
>> index 027c035..3751be9 100644
>> --- a/platform/linux-keystone2/Makefile.am
>> +++ b/platform/linux-keystone2/Makefile.am
>> @@ -70,13 +70,15 @@ __LIB__libodp_la_SOURCES = \
>>   			   odp_buffer.c \
>>   			   odp_buffer_pool.c \
>>   			   ../linux-generic/odp_coremask.c \
>> -			   odp_init.c \
>> +			   ../linux-generic/odp_init.c \
>>   			   ../linux-generic/odp_linux.c \
>>   			   odp_packet.c \
>>   			   ../linux-generic/odp_packet_flags.c \
>>   			   odp_packet_io.c \
>>   			   ../linux-generic/odp_packet_socket.c \
>> +			   odp_platform.c \
>>   			   odp_queue.c \
>> +			   ../linux-generic/odp_crypto.c \
>>   			   ../linux-generic/odp_ring.c \
>>   			   ../linux-generic/odp_rwlock.c \
>>   			   ../linux-generic/odp_schedule.c \
>> diff --git a/platform/linux-keystone2/odp_init.c b/platform/linux-
>> keystone2/odp_platform.c
>> similarity index 72%
>> rename from platform/linux-keystone2/odp_init.c
>> rename to platform/linux-keystone2/odp_platform.c
>> index f832551..e966627 100644
>> --- a/platform/linux-keystone2/odp_init.c
>> +++ b/platform/linux-keystone2/odp_platform.c
>> @@ -1,4 +1,4 @@
>> -/* Copyright (c) 2013, Linaro Limited
>> +/* Copyright (c) 2014, Linaro Limited
>>    * All rights reserved.
>>    *
>>    * SPDX-License-Identifier:     BSD-3-Clause
>> @@ -15,17 +15,19 @@
>>   #include <odp_packet_internal.h>
>>
>>   /*
>> - * Make region_configs[] global, because hw_config is saved in
>> - * ti_em_rh_init_global() and it references region_configs[].
>> - */
>> + *  * Make region_configs[] global, because hw_config is saved in
>> + *   * ti_em_rh_init_global() and it references region_configs[].
>> + *    */
>>   static ti_em_osal_hw_region_config_t region_configs[TI_ODP_REGION_NUM];
>>
>> -static int ti_init_hw_config(void)
>> +int odp_init_platform(odp_platform_init_t *platform_params ODP_UNUSED)
>>   {
>>   	ti_em_rh_hw_config_t           hw_config;
>>   	ti_em_osal_hw_region_config_t *reg_config;
>>   	memset(&hw_config, 0, sizeof(ti_em_rh_hw_config_t));
>>
>> +	ti_em_osal_core_init_global();
>> +
>>   	/* Set ODP initialization parameters */
>>   	hw_config.private_free_queue_idx = MY_EM_PRIVATE_FREE_QUEUE_IDX;
>>   	hw_config.hw_queue_base_idx      = MY_EM_SCHED_QUEUE_IDX;
>> @@ -89,65 +91,3 @@ static int ti_init_hw_config(void)
>>   	return 0;
>>   }
>>
>> -
>> -int odp_init_global(void)
>> -{
>> -	odp_thread_init_global();
>> -
>> -	odp_system_info_init();
>> -
>> -	ti_em_osal_core_init_global();
>> -	ti_init_hw_config();
>> -
>> -	if (odp_shm_init_global()) {
>> -		ODP_ERR("ODP shm init failed.\n");
>> -		return -1;
>> -	}
>> -
>> -	if (odp_buffer_pool_init_global()) {
>> -		ODP_ERR("ODP buffer pool init failed.\n");
>> -		return -1;
>> -	}
>> -
>> -	if (odp_queue_init_global()) {
>> -		ODP_ERR("ODP queue init failed.\n");
>> -		return -1;
>> -	}
>> -
>> -	if (odp_schedule_init_global()) {
>> -		ODP_ERR("ODP schedule init failed.\n");
>> -		return -1;
>> -	}
>> -
>> -	if (odp_pktio_init_global()) {
>> -		ODP_ERR("ODP packet io init failed.\n");
>> -		return -1;
>> -	}
>> -
>> -	if (odp_timer_init_global()) {
>> -		ODP_ERR("ODP timer init failed.\n");
>> -		return -1;
>> -	}
>> -
>> -	return 0;
>> -}
>> -
>> -
>> -int odp_init_local(int thr_id)
>> -{
>> -	odp_thread_init_local(thr_id);
>> -
>> -	ti_em_rh_init_local();
>> -
>> -	if (odp_pktio_init_local()) {
>> -		ODP_ERR("ODP packet io local init failed.\n");
>> -		return -1;
>> -	}
>> -
>> -	if (odp_schedule_init_local()) {
>> -		ODP_ERR("ODP schedule local init failed.\n");
>> -		return -1;
>> -	}
>> -
>> -	return 0;
>> -}
>> 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
Mike Holmes Sept. 22, 2014, 11:06 a.m. UTC | #3
Yes, it was done last week.
I was waiting for DPDK to build so that I can run all the platforms before
submitting, your patch worked for me but I only ran the normal examples not
ipsec and I heard that has an issue still.

On 22 September 2014 05:09, Maxim Uvarov <maxim.uvarov@linaro.org> wrote:

> Mike, can you up this patch?
>
> Maxim.
>
>
> On 09/18/2014 04:09 AM, Savolainen, Petri (NSN - FI/Espoo) wrote:
>
>>
>> Reviewed-by: Petri Savolainen <petri.savolainen@linaro.org>
>>
>>
>> ... after rebase since keystone implementation has changed. There's now
>> implantation specific init functions since ODP_ERR was replaced with
>> odp_pr_err (which is keystone specific).
>>
>>
>> -Petri
>>
>>
>>
>>  -----Original Message-----
>>> From: lng-odp-bounces@lists.linaro.org [mailto:lng-odp-
>>> bounces@lists.linaro.org] On Behalf Of ext Mike Holmes
>>> Sent: Friday, September 05, 2014 12:07 AM
>>> To: lng-odp@lists.linaro.org
>>> Subject: [lng-odp] [PATCH v7] Add-global_init-parameters
>>>
>>> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
>>> ---
>>>
>>> v7:
>>> Fix netmap build
>>>
>>>   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/packet_netmap/odp_pktio_netmap.c           |  2 +-
>>>   example/timer/odp_timer_test.c                     |  2 +-
>>>   platform/linux-dpdk/Makefile.am                    |  4 +-
>>>   platform/linux-dpdk/{odp_init.c => odp_platform.c} | 66
>>> +----------------
>>> --
>>>   platform/linux-generic/Makefile.am                 |  1 +
>>>   platform/linux-generic/include/api/odp.h           |  1 +
>>>   platform/linux-generic/include/api/odp_init.h      | 34 +++++++---
>>>   platform/linux-generic/include/odp_internal.h      |  3 +
>>>   platform/linux-generic/odp_init.c                  |  9 ++-
>>>   platform/linux-generic/odp_platform.c              | 14 ++++
>>>   platform/linux-keystone2/Makefile.am               |  4 +-
>>>   .../linux-keystone2/{odp_init.c => odp_platform.c} | 74
>>> ++---------------
>>> -----
>>>   test/api_test/odp_common.c                         |  2 +-
>>>   17 files changed, 73 insertions(+), 151 deletions(-)
>>>   rename platform/linux-dpdk/{odp_init.c => odp_platform.c} (50%)
>>>   create mode 100644 platform/linux-generic/odp_platform.c
>>>   rename platform/linux-keystone2/{odp_init.c => odp_platform.c} (72%)
>>>
>>> diff --git a/example/generator/odp_generator.c
>>> b/example/generator/odp_generator.c
>>> index 65c2034..af3b819 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 6a38c1b..df87a9e 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 40d237b..0aa08f7 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 88ce575..a349054 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/packet_netmap/odp_pktio_netmap.c
>>> b/example/packet_netmap/odp_pktio_netmap.c
>>> index 88af2e5..2d6344c 100644
>>> --- a/example/packet_netmap/odp_pktio_netmap.c
>>> +++ b/example/packet_netmap/odp_pktio_netmap.c
>>> @@ -227,7 +227,7 @@ int main(int argc, char *argv[])
>>>         int i;
>>>
>>>         /* 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 1061190..7e1c7a0 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-dpdk/Makefile.am b/platform/linux-
>>> dpdk/Makefile.am
>>> index a59435f..98d4ab4 100644
>>> --- a/platform/linux-dpdk/Makefile.am
>>> +++ b/platform/linux-dpdk/Makefile.am
>>> @@ -67,13 +67,15 @@ __LIB__libodp_la_SOURCES = \
>>>                            odp_buffer.c \
>>>                            odp_buffer_pool.c \
>>>                            ../linux-generic/odp_coremask.c \
>>> -                          odp_init.c \
>>> +                          ../linux-generic/odp_init.c \
>>>                            odp_linux.c \
>>>                            odp_packet.c \
>>>                            odp_packet_dpdk.c \
>>>                            ../linux-generic/odp_packet_flags.c \
>>>                            odp_packet_io.c \
>>>                            ../linux-generic/odp_packet_socket.c \
>>> +                          ../linux-generic/odp_crypto.c \
>>> +                          odp_platform.c \
>>>                            odp_queue.c \
>>>                            ../linux-generic/odp_ring.c \
>>>                            ../linux-generic/odp_rwlock.c \
>>> diff --git a/platform/linux-dpdk/odp_init.c b/platform/linux-
>>> dpdk/odp_platform.c
>>> similarity index 50%
>>> rename from platform/linux-dpdk/odp_init.c
>>> rename to platform/linux-dpdk/odp_platform.c
>>> index ecc2066..3162c05 100644
>>> --- a/platform/linux-dpdk/odp_init.c
>>> +++ b/platform/linux-dpdk/odp_platform.c
>>> @@ -1,4 +1,4 @@
>>> -/* Copyright (c) 2013, Linaro Limited
>>> +/* Copyright (c) 2014, Linaro Limited
>>>    * All rights reserved.
>>>    *
>>>    * SPDX-License-Identifier:     BSD-3-Clause
>>> @@ -9,7 +9,7 @@
>>>   #include <odp_debug.h>
>>>   #include <odp_packet_dpdk.h>
>>>
>>> -int odp_init_dpdk(void)
>>> +int odp_init_platform(odp_global_platform_init_t *platform_params
>>> ODP_UNUSED)
>>>   {
>>>         int test_argc = 5;
>>>         char *test_argv[6];
>>> @@ -49,65 +49,3 @@ int odp_init_dpdk(void)
>>>
>>>         return 0;
>>>   }
>>> -
>>> -int odp_init_global(void)
>>> -{
>>> -       odp_thread_init_global();
>>> -
>>> -       odp_system_info_init();
>>> -
>>> -       if (odp_init_dpdk()) {
>>> -               ODP_ERR("ODP dpdk init failed.\n");
>>> -               return -1;
>>> -       }
>>> -
>>> -       if (odp_shm_init_global()) {
>>> -               ODP_ERR("ODP shm init failed.\n");
>>> -               return -1;
>>> -       }
>>> -
>>> -       if (odp_buffer_pool_init_global()) {
>>> -               ODP_ERR("ODP buffer pool init failed.\n");
>>> -               return -1;
>>> -       }
>>> -
>>> -       if (odp_queue_init_global()) {
>>> -               ODP_ERR("ODP queue init failed.\n");
>>> -               return -1;
>>> -       }
>>> -
>>> -       if (odp_schedule_init_global()) {
>>> -               ODP_ERR("ODP schedule init failed.\n");
>>> -               return -1;
>>> -       }
>>> -
>>> -       if (odp_pktio_init_global()) {
>>> -               ODP_ERR("ODP packet io init failed.\n");
>>> -               return -1;
>>> -       }
>>> -
>>> -       if (odp_timer_init_global()) {
>>> -               ODP_ERR("ODP timer init failed.\n");
>>> -               return -1;
>>> -       }
>>> -
>>> -       return 0;
>>> -}
>>> -
>>> -
>>> -int odp_init_local(int thr_id)
>>> -{
>>> -       odp_thread_init_local(thr_id);
>>> -
>>> -       if (odp_pktio_init_local()) {
>>> -               ODP_ERR("ODP packet io local init failed.\n");
>>> -               return -1;
>>> -       }
>>> -
>>> -       if (odp_schedule_init_local()) {
>>> -               ODP_ERR("ODP schedule local init failed.\n");
>>> -               return -1;
>>> -       }
>>> -
>>> -       return 0;
>>> -}
>>> diff --git a/platform/linux-generic/Makefile.am b/platform/linux-
>>> generic/Makefile.am
>>> index 25c82ea..1b4fd13 100644
>>> --- a/platform/linux-generic/Makefile.am
>>> +++ b/platform/linux-generic/Makefile.am
>>> @@ -62,6 +62,7 @@ __LIB__libodp_la_SOURCES = \
>>>                            odp_packet_flags.c \
>>>                            odp_packet_io.c \
>>>                            odp_packet_socket.c \
>>> +                          odp_platform.c \
>>>                            odp_queue.c \
>>>                            odp_ring.c \
>>>                            odp_rwlock.c \
>>> diff --git a/platform/linux-generic/include/api/odp.h b/platform/linux-
>>> generic/include/api/odp.h
>>> index 0ee3faf..99e2ae0 100644
>>> --- a/platform/linux-generic/include/api/odp.h
>>> +++ b/platform/linux-generic/include/api/odp.h
>>> @@ -48,6 +48,7 @@ extern "C" {
>>>   #include <odp_packet.h>
>>>   #include <odp_packet_flags.h>
>>>   #include <odp_packet_io.h>
>>> +#include <odp_crypto.h>
>>>
>>>   #ifdef __cplusplus
>>>   }
>>> diff --git a/platform/linux-generic/include/api/odp_init.h
>>> b/platform/linux-generic/include/api/odp_init.h
>>> index 490324a..f89b7d4 100644
>>> --- a/platform/linux-generic/include/api/odp_init.h
>>> +++ b/platform/linux-generic/include/api/odp_init.h
>>> @@ -22,23 +22,39 @@ extern "C" {
>>>
>>>   #include <odp_std_types.h>
>>>
>>> -
>>> -
>>> +/** ODP initialisation 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 initialisation.
>>>    *
>>> + * 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 initialisation.
>>>    * All threads must call this function before calling
>>>    * any other ODP API functions.
>>>    * @param thr_id Thread id
>>> diff --git a/platform/linux-generic/include/odp_internal.h
>>> b/platform/linux-generic/include/odp_internal.h
>>> index aa79493..29fb3b5 100644
>>> --- a/platform/linux-generic/include/odp_internal.h
>>> +++ b/platform/linux-generic/include/odp_internal.h
>>> @@ -4,6 +4,7 @@
>>>    * SPDX-License-Identifier:     BSD-3-Clause
>>>    */
>>>
>>> +#include <odp_init.h>
>>>
>>>   /**
>>>    * @file
>>> @@ -42,6 +43,8 @@ int odp_schedule_init_local(void);
>>>   int odp_timer_init_global(void);
>>>   int odp_timer_disarm_all(void);
>>>
>>> +int odp_init_platform(odp_platform_init_t *platform_params);
>>> +
>>>   #ifdef __cplusplus
>>>   }
>>>   #endif
>>> diff --git a/platform/linux-generic/odp_init.c b/platform/linux-
>>> generic/odp_init.c
>>> index 5b7e192..834c3bf 100644
>>> --- a/platform/linux-generic/odp_init.c
>>> +++ b/platform/linux-generic/odp_init.c
>>> @@ -8,13 +8,18 @@
>>>   #include <odp_internal.h>
>>>   #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_thread_init_global();
>>>
>>>         odp_system_info_init();
>>>
>>> +       if (odp_init_platform(platform_params)) {
>>> +               ODP_ERR("ODP platform init failed.\n");
>>> +               return -1;
>>> +       }
>>> +
>>>         if (odp_shm_init_global()) {
>>>                 ODP_ERR("ODP shm init failed.\n");
>>>                 return -1;
>>> diff --git a/platform/linux-generic/odp_platform.c b/platform/linux-
>>> generic/odp_platform.c
>>> new file mode 100644
>>> index 0000000..679913d
>>> --- /dev/null
>>> +++ b/platform/linux-generic/odp_platform.c
>>> @@ -0,0 +1,14 @@
>>> +/* Copyright (c) 2014, Linaro Limited
>>> + * All rights reserved.
>>> + *
>>> + * SPDX-License-Identifier:     BSD-3-Clause
>>> + */
>>> +
>>> +#include <odp_init.h>
>>> +#include <odp_internal.h>
>>> +#include <odp_debug.h>
>>> +
>>> +int odp_init_platform(odp_platform_init_t *platform_params ODP_UNUSED)
>>> +{
>>> +       return 0;
>>> +}
>>> diff --git a/platform/linux-keystone2/Makefile.am b/platform/linux-
>>> keystone2/Makefile.am
>>> index 027c035..3751be9 100644
>>> --- a/platform/linux-keystone2/Makefile.am
>>> +++ b/platform/linux-keystone2/Makefile.am
>>> @@ -70,13 +70,15 @@ __LIB__libodp_la_SOURCES = \
>>>                            odp_buffer.c \
>>>                            odp_buffer_pool.c \
>>>                            ../linux-generic/odp_coremask.c \
>>> -                          odp_init.c \
>>> +                          ../linux-generic/odp_init.c \
>>>                            ../linux-generic/odp_linux.c \
>>>                            odp_packet.c \
>>>                            ../linux-generic/odp_packet_flags.c \
>>>                            odp_packet_io.c \
>>>                            ../linux-generic/odp_packet_socket.c \
>>> +                          odp_platform.c \
>>>                            odp_queue.c \
>>> +                          ../linux-generic/odp_crypto.c \
>>>                            ../linux-generic/odp_ring.c \
>>>                            ../linux-generic/odp_rwlock.c \
>>>                            ../linux-generic/odp_schedule.c \
>>> diff --git a/platform/linux-keystone2/odp_init.c b/platform/linux-
>>> keystone2/odp_platform.c
>>> similarity index 72%
>>> rename from platform/linux-keystone2/odp_init.c
>>> rename to platform/linux-keystone2/odp_platform.c
>>> index f832551..e966627 100644
>>> --- a/platform/linux-keystone2/odp_init.c
>>> +++ b/platform/linux-keystone2/odp_platform.c
>>> @@ -1,4 +1,4 @@
>>> -/* Copyright (c) 2013, Linaro Limited
>>> +/* Copyright (c) 2014, Linaro Limited
>>>    * All rights reserved.
>>>    *
>>>    * SPDX-License-Identifier:     BSD-3-Clause
>>> @@ -15,17 +15,19 @@
>>>   #include <odp_packet_internal.h>
>>>
>>>   /*
>>> - * Make region_configs[] global, because hw_config is saved in
>>> - * ti_em_rh_init_global() and it references region_configs[].
>>> - */
>>> + *  * Make region_configs[] global, because hw_config is saved in
>>> + *   * ti_em_rh_init_global() and it references region_configs[].
>>> + *    */
>>>   static ti_em_osal_hw_region_config_t region_configs[TI_ODP_REGION_
>>> NUM];
>>>
>>> -static int ti_init_hw_config(void)
>>> +int odp_init_platform(odp_platform_init_t *platform_params ODP_UNUSED)
>>>   {
>>>         ti_em_rh_hw_config_t           hw_config;
>>>         ti_em_osal_hw_region_config_t *reg_config;
>>>         memset(&hw_config, 0, sizeof(ti_em_rh_hw_config_t));
>>>
>>> +       ti_em_osal_core_init_global();
>>> +
>>>         /* Set ODP initialization parameters */
>>>         hw_config.private_free_queue_idx = MY_EM_PRIVATE_FREE_QUEUE_IDX;
>>>         hw_config.hw_queue_base_idx      = MY_EM_SCHED_QUEUE_IDX;
>>> @@ -89,65 +91,3 @@ static int ti_init_hw_config(void)
>>>         return 0;
>>>   }
>>>
>>> -
>>> -int odp_init_global(void)
>>> -{
>>> -       odp_thread_init_global();
>>> -
>>> -       odp_system_info_init();
>>> -
>>> -       ti_em_osal_core_init_global();
>>> -       ti_init_hw_config();
>>> -
>>> -       if (odp_shm_init_global()) {
>>> -               ODP_ERR("ODP shm init failed.\n");
>>> -               return -1;
>>> -       }
>>> -
>>> -       if (odp_buffer_pool_init_global()) {
>>> -               ODP_ERR("ODP buffer pool init failed.\n");
>>> -               return -1;
>>> -       }
>>> -
>>> -       if (odp_queue_init_global()) {
>>> -               ODP_ERR("ODP queue init failed.\n");
>>> -               return -1;
>>> -       }
>>> -
>>> -       if (odp_schedule_init_global()) {
>>> -               ODP_ERR("ODP schedule init failed.\n");
>>> -               return -1;
>>> -       }
>>> -
>>> -       if (odp_pktio_init_global()) {
>>> -               ODP_ERR("ODP packet io init failed.\n");
>>> -               return -1;
>>> -       }
>>> -
>>> -       if (odp_timer_init_global()) {
>>> -               ODP_ERR("ODP timer init failed.\n");
>>> -               return -1;
>>> -       }
>>> -
>>> -       return 0;
>>> -}
>>> -
>>> -
>>> -int odp_init_local(int thr_id)
>>> -{
>>> -       odp_thread_init_local(thr_id);
>>> -
>>> -       ti_em_rh_init_local();
>>> -
>>> -       if (odp_pktio_init_local()) {
>>> -               ODP_ERR("ODP packet io local init failed.\n");
>>> -               return -1;
>>> -       }
>>> -
>>> -       if (odp_schedule_init_local()) {
>>> -               ODP_ERR("ODP schedule local init failed.\n");
>>> -               return -1;
>>> -       }
>>> -
>>> -       return 0;
>>> -}
>>> 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
>>
>
>
> _______________________________________________
> 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 65c2034..af3b819 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 6a38c1b..df87a9e 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 40d237b..0aa08f7 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 88ce575..a349054 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/packet_netmap/odp_pktio_netmap.c b/example/packet_netmap/odp_pktio_netmap.c
index 88af2e5..2d6344c 100644
--- a/example/packet_netmap/odp_pktio_netmap.c
+++ b/example/packet_netmap/odp_pktio_netmap.c
@@ -227,7 +227,7 @@  int main(int argc, char *argv[])
 	int i;
 
 	/* 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 1061190..7e1c7a0 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-dpdk/Makefile.am b/platform/linux-dpdk/Makefile.am
index a59435f..98d4ab4 100644
--- a/platform/linux-dpdk/Makefile.am
+++ b/platform/linux-dpdk/Makefile.am
@@ -67,13 +67,15 @@  __LIB__libodp_la_SOURCES = \
 			   odp_buffer.c \
 			   odp_buffer_pool.c \
 			   ../linux-generic/odp_coremask.c \
-			   odp_init.c \
+			   ../linux-generic/odp_init.c \
 			   odp_linux.c \
 			   odp_packet.c \
 			   odp_packet_dpdk.c \
 			   ../linux-generic/odp_packet_flags.c \
 			   odp_packet_io.c \
 			   ../linux-generic/odp_packet_socket.c \
+			   ../linux-generic/odp_crypto.c \
+			   odp_platform.c \
 			   odp_queue.c \
 			   ../linux-generic/odp_ring.c \
 			   ../linux-generic/odp_rwlock.c \
diff --git a/platform/linux-dpdk/odp_init.c b/platform/linux-dpdk/odp_platform.c
similarity index 50%
rename from platform/linux-dpdk/odp_init.c
rename to platform/linux-dpdk/odp_platform.c
index ecc2066..3162c05 100644
--- a/platform/linux-dpdk/odp_init.c
+++ b/platform/linux-dpdk/odp_platform.c
@@ -1,4 +1,4 @@ 
-/* Copyright (c) 2013, Linaro Limited
+/* Copyright (c) 2014, Linaro Limited
  * All rights reserved.
  *
  * SPDX-License-Identifier:     BSD-3-Clause
@@ -9,7 +9,7 @@ 
 #include <odp_debug.h>
 #include <odp_packet_dpdk.h>
 
-int odp_init_dpdk(void)
+int odp_init_platform(odp_global_platform_init_t *platform_params ODP_UNUSED)
 {
 	int test_argc = 5;
 	char *test_argv[6];
@@ -49,65 +49,3 @@  int odp_init_dpdk(void)
 
 	return 0;
 }
-
-int odp_init_global(void)
-{
-	odp_thread_init_global();
-
-	odp_system_info_init();
-
-	if (odp_init_dpdk()) {
-		ODP_ERR("ODP dpdk init failed.\n");
-		return -1;
-	}
-
-	if (odp_shm_init_global()) {
-		ODP_ERR("ODP shm init failed.\n");
-		return -1;
-	}
-
-	if (odp_buffer_pool_init_global()) {
-		ODP_ERR("ODP buffer pool init failed.\n");
-		return -1;
-	}
-
-	if (odp_queue_init_global()) {
-		ODP_ERR("ODP queue init failed.\n");
-		return -1;
-	}
-
-	if (odp_schedule_init_global()) {
-		ODP_ERR("ODP schedule init failed.\n");
-		return -1;
-	}
-
-	if (odp_pktio_init_global()) {
-		ODP_ERR("ODP packet io init failed.\n");
-		return -1;
-	}
-
-	if (odp_timer_init_global()) {
-		ODP_ERR("ODP timer init failed.\n");
-		return -1;
-	}
-
-	return 0;
-}
-
-
-int odp_init_local(int thr_id)
-{
-	odp_thread_init_local(thr_id);
-
-	if (odp_pktio_init_local()) {
-		ODP_ERR("ODP packet io local init failed.\n");
-		return -1;
-	}
-
-	if (odp_schedule_init_local()) {
-		ODP_ERR("ODP schedule local init failed.\n");
-		return -1;
-	}
-
-	return 0;
-}
diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am
index 25c82ea..1b4fd13 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -62,6 +62,7 @@  __LIB__libodp_la_SOURCES = \
 			   odp_packet_flags.c \
 			   odp_packet_io.c \
 			   odp_packet_socket.c \
+			   odp_platform.c \
 			   odp_queue.c \
 			   odp_ring.c \
 			   odp_rwlock.c \
diff --git a/platform/linux-generic/include/api/odp.h b/platform/linux-generic/include/api/odp.h
index 0ee3faf..99e2ae0 100644
--- a/platform/linux-generic/include/api/odp.h
+++ b/platform/linux-generic/include/api/odp.h
@@ -48,6 +48,7 @@  extern "C" {
 #include <odp_packet.h>
 #include <odp_packet_flags.h>
 #include <odp_packet_io.h>
+#include <odp_crypto.h>
 
 #ifdef __cplusplus
 }
diff --git a/platform/linux-generic/include/api/odp_init.h b/platform/linux-generic/include/api/odp_init.h
index 490324a..f89b7d4 100644
--- a/platform/linux-generic/include/api/odp_init.h
+++ b/platform/linux-generic/include/api/odp_init.h
@@ -22,23 +22,39 @@  extern "C" {
 
 #include <odp_std_types.h>
 
-
-
+/** ODP initialisation 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 initialisation.
  *
+ * 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 initialisation.
  * All threads must call this function before calling
  * any other ODP API functions.
  * @param thr_id Thread id
diff --git a/platform/linux-generic/include/odp_internal.h b/platform/linux-generic/include/odp_internal.h
index aa79493..29fb3b5 100644
--- a/platform/linux-generic/include/odp_internal.h
+++ b/platform/linux-generic/include/odp_internal.h
@@ -4,6 +4,7 @@ 
  * SPDX-License-Identifier:     BSD-3-Clause
  */
 
+#include <odp_init.h>
 
 /**
  * @file
@@ -42,6 +43,8 @@  int odp_schedule_init_local(void);
 int odp_timer_init_global(void);
 int odp_timer_disarm_all(void);
 
+int odp_init_platform(odp_platform_init_t *platform_params);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/platform/linux-generic/odp_init.c b/platform/linux-generic/odp_init.c
index 5b7e192..834c3bf 100644
--- a/platform/linux-generic/odp_init.c
+++ b/platform/linux-generic/odp_init.c
@@ -8,13 +8,18 @@ 
 #include <odp_internal.h>
 #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_thread_init_global();
 
 	odp_system_info_init();
 
+	if (odp_init_platform(platform_params)) {
+		ODP_ERR("ODP platform init failed.\n");
+		return -1;
+	}
+
 	if (odp_shm_init_global()) {
 		ODP_ERR("ODP shm init failed.\n");
 		return -1;
diff --git a/platform/linux-generic/odp_platform.c b/platform/linux-generic/odp_platform.c
new file mode 100644
index 0000000..679913d
--- /dev/null
+++ b/platform/linux-generic/odp_platform.c
@@ -0,0 +1,14 @@ 
+/* Copyright (c) 2014, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#include <odp_init.h>
+#include <odp_internal.h>
+#include <odp_debug.h>
+
+int odp_init_platform(odp_platform_init_t *platform_params ODP_UNUSED)
+{
+	return 0;
+}
diff --git a/platform/linux-keystone2/Makefile.am b/platform/linux-keystone2/Makefile.am
index 027c035..3751be9 100644
--- a/platform/linux-keystone2/Makefile.am
+++ b/platform/linux-keystone2/Makefile.am
@@ -70,13 +70,15 @@  __LIB__libodp_la_SOURCES = \
 			   odp_buffer.c \
 			   odp_buffer_pool.c \
 			   ../linux-generic/odp_coremask.c \
-			   odp_init.c \
+			   ../linux-generic/odp_init.c \
 			   ../linux-generic/odp_linux.c \
 			   odp_packet.c \
 			   ../linux-generic/odp_packet_flags.c \
 			   odp_packet_io.c \
 			   ../linux-generic/odp_packet_socket.c \
+			   odp_platform.c \
 			   odp_queue.c \
+			   ../linux-generic/odp_crypto.c \
 			   ../linux-generic/odp_ring.c \
 			   ../linux-generic/odp_rwlock.c \
 			   ../linux-generic/odp_schedule.c \
diff --git a/platform/linux-keystone2/odp_init.c b/platform/linux-keystone2/odp_platform.c
similarity index 72%
rename from platform/linux-keystone2/odp_init.c
rename to platform/linux-keystone2/odp_platform.c
index f832551..e966627 100644
--- a/platform/linux-keystone2/odp_init.c
+++ b/platform/linux-keystone2/odp_platform.c
@@ -1,4 +1,4 @@ 
-/* Copyright (c) 2013, Linaro Limited
+/* Copyright (c) 2014, Linaro Limited
  * All rights reserved.
  *
  * SPDX-License-Identifier:     BSD-3-Clause
@@ -15,17 +15,19 @@ 
 #include <odp_packet_internal.h>
 
 /*
- * Make region_configs[] global, because hw_config is saved in
- * ti_em_rh_init_global() and it references region_configs[].
- */
+ *  * Make region_configs[] global, because hw_config is saved in
+ *   * ti_em_rh_init_global() and it references region_configs[].
+ *    */
 static ti_em_osal_hw_region_config_t region_configs[TI_ODP_REGION_NUM];
 
-static int ti_init_hw_config(void)
+int odp_init_platform(odp_platform_init_t *platform_params ODP_UNUSED)
 {
 	ti_em_rh_hw_config_t           hw_config;
 	ti_em_osal_hw_region_config_t *reg_config;
 	memset(&hw_config, 0, sizeof(ti_em_rh_hw_config_t));
 
+	ti_em_osal_core_init_global();
+
 	/* Set ODP initialization parameters */
 	hw_config.private_free_queue_idx = MY_EM_PRIVATE_FREE_QUEUE_IDX;
 	hw_config.hw_queue_base_idx      = MY_EM_SCHED_QUEUE_IDX;
@@ -89,65 +91,3 @@  static int ti_init_hw_config(void)
 	return 0;
 }
 
-
-int odp_init_global(void)
-{
-	odp_thread_init_global();
-
-	odp_system_info_init();
-
-	ti_em_osal_core_init_global();
-	ti_init_hw_config();
-
-	if (odp_shm_init_global()) {
-		ODP_ERR("ODP shm init failed.\n");
-		return -1;
-	}
-
-	if (odp_buffer_pool_init_global()) {
-		ODP_ERR("ODP buffer pool init failed.\n");
-		return -1;
-	}
-
-	if (odp_queue_init_global()) {
-		ODP_ERR("ODP queue init failed.\n");
-		return -1;
-	}
-
-	if (odp_schedule_init_global()) {
-		ODP_ERR("ODP schedule init failed.\n");
-		return -1;
-	}
-
-	if (odp_pktio_init_global()) {
-		ODP_ERR("ODP packet io init failed.\n");
-		return -1;
-	}
-
-	if (odp_timer_init_global()) {
-		ODP_ERR("ODP timer init failed.\n");
-		return -1;
-	}
-
-	return 0;
-}
-
-
-int odp_init_local(int thr_id)
-{
-	odp_thread_init_local(thr_id);
-
-	ti_em_rh_init_local();
-
-	if (odp_pktio_init_local()) {
-		ODP_ERR("ODP packet io local init failed.\n");
-		return -1;
-	}
-
-	if (odp_schedule_init_local()) {
-		ODP_ERR("ODP schedule local init failed.\n");
-		return -1;
-	}
-
-	return 0;
-}
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;
 	}