diff mbox

[1/2] test/example changes for v1.0 buffer pool APIs

Message ID 1416360067-13278-1-git-send-email-bill.fischofer@linaro.org
State New
Headers show

Commit Message

Bill Fischofer Nov. 19, 2014, 1:21 a.m. UTC
Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
---
 example/generator/odp_generator.c | 19 +++++--------
 example/ipsec/odp_ipsec.c         | 56 ++++++++++++---------------------------
 example/l2fwd/odp_l2fwd.c         | 19 +++++--------
 example/odp_example/odp_example.c | 18 +++++--------
 example/packet/odp_pktio.c        | 19 +++++--------
 example/timer/odp_timer_test.c    | 13 ++++-----
 test/api_test/odp_timer_ping.c    | 19 +++++++------
 7 files changed, 57 insertions(+), 106 deletions(-)

Comments

Anders Roxell Nov. 19, 2014, 10:30 a.m. UTC | #1
Change the short log, not needed to say anything about v1.0

add a longer description as well what you have changed.

this patch didn't build.

We shall be able to build every patch.

This patch do not build!

Cheers,
Anders

On 2014-11-18 19:21, Bill Fischofer wrote:
> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
> ---
>  example/generator/odp_generator.c | 19 +++++--------
>  example/ipsec/odp_ipsec.c         | 56 ++++++++++++---------------------------
>  example/l2fwd/odp_l2fwd.c         | 19 +++++--------
>  example/odp_example/odp_example.c | 18 +++++--------
>  example/packet/odp_pktio.c        | 19 +++++--------
>  example/timer/odp_timer_test.c    | 13 ++++-----
>  test/api_test/odp_timer_ping.c    | 19 +++++++------
>  7 files changed, 57 insertions(+), 106 deletions(-)
> 
> diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c
> index ffa5e62..480ddd5 100644
> --- a/example/generator/odp_generator.c
> +++ b/example/generator/odp_generator.c
> @@ -512,11 +512,11 @@ int main(int argc, char *argv[])
>  	odph_linux_pthread_t thread_tbl[MAX_WORKERS];
>  	odp_buffer_pool_t pool;
>  	int num_workers;
> -	void *pool_base;
>  	int i;
>  	int first_core;
>  	int core_count;
>  	odp_shm_t shm;
> +	odp_buffer_pool_param_t params;
>  
>  	/* Init ODP before calling anything else */
>  	if (odp_init_global(NULL, NULL)) {
> @@ -579,20 +579,13 @@ int main(int argc, char *argv[])
>  	printf("First core:         %i\n\n", first_core);
>  
>  	/* Create packet pool */
> -	shm = odp_shm_reserve("shm_packet_pool",
> -			      SHM_PKT_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);
> -	pool_base = odp_shm_addr(shm);
> +	params.buf_size  = SHM_PKT_POOL_BUF_SIZE;
> +	params.buf_align = 0;
> +	params.num_bufs  = SHM_PKT_POOL_SIZE/SHM_PKT_POOL_BUF_SIZE;
> +	params.buf_type  = ODP_BUFFER_TYPE_PACKET;
>  
> -	if (pool_base == NULL) {
> -		ODP_ERR("Error: packet pool mem alloc failed.\n");
> -		exit(EXIT_FAILURE);
> -	}
> +	pool = odp_buffer_pool_create("packet_pool", ODP_SHM_NULL, &params);
>  
> -	pool = odp_buffer_pool_create("packet_pool", pool_base,
> -				      SHM_PKT_POOL_SIZE,
> -				      SHM_PKT_POOL_BUF_SIZE,
> -				      ODP_CACHE_LINE_SIZE,
> -				      ODP_BUFFER_TYPE_PACKET);
>  	if (pool == ODP_BUFFER_POOL_INVALID) {
>  		ODP_ERR("Error: packet pool create failed.\n");
>  		exit(EXIT_FAILURE);
> diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
> index 37ad34d..0d015bb 100644
> --- a/example/ipsec/odp_ipsec.c
> +++ b/example/ipsec/odp_ipsec.c
> @@ -365,8 +365,7 @@ static
>  void ipsec_init_pre(void)
>  {
>  	odp_queue_param_t qparam;
> -	void *pool_base;
> -	odp_shm_t shm;
> +	odp_buffer_pool_param_t params;
>  
>  	/*
>  	 * Create queues
> @@ -399,16 +398,12 @@ void ipsec_init_pre(void)
>  	}
>  
>  	/* Create output buffer pool */
> -	shm = odp_shm_reserve("shm_out_pool",
> -			      SHM_OUT_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);
> -
> -	pool_base = odp_shm_addr(shm);
> +	params.buf_size  = SHM_OUT_POOL_BUF_SIZE;
> +	params.buf_align = 0;
> +	params.num_bufs  = SHM_PKT_POOL_BUF_COUNT;
> +	params.buf_type  = ODP_BUFFER_TYPE_PACKET;
>  
> -	out_pool = odp_buffer_pool_create("out_pool", pool_base,
> -					  SHM_OUT_POOL_SIZE,
> -					  SHM_OUT_POOL_BUF_SIZE,
> -					  ODP_CACHE_LINE_SIZE,
> -					  ODP_BUFFER_TYPE_PACKET);
> +	out_pool = odp_buffer_pool_create("out_pool", ODP_SHM_NULL, &params);
>  
>  	if (ODP_BUFFER_POOL_INVALID == out_pool) {
>  		ODP_ERR("Error: message pool create failed.\n");
> @@ -1168,12 +1163,12 @@ main(int argc, char *argv[])
>  {
>  	odph_linux_pthread_t thread_tbl[MAX_WORKERS];
>  	int num_workers;
> -	void *pool_base;
>  	int i;
>  	int first_core;
>  	int core_count;
>  	int stream_count;
>  	odp_shm_t shm;
> +	odp_buffer_pool_param_t params;
>  
>  	/* Init ODP before calling anything else */
>  	if (odp_init_global(NULL, NULL)) {
> @@ -1233,42 +1228,25 @@ main(int argc, char *argv[])
>  	printf("First core:         %i\n\n", first_core);
>  
>  	/* Create packet buffer pool */
> -	shm = odp_shm_reserve("shm_packet_pool",
> -			      SHM_PKT_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);
> -
> -	pool_base = odp_shm_addr(shm);
> +	params.buf_size  = SHM_PKT_POOL_BUF_SIZE;
> +	params.buf_align = 0;
> +	params.num_bufs  = SHM_PKT_POOL_BUF_COUNT;
> +	params.buf_type  = ODP_BUFFER_TYPE_PACKET;
>  
> -	if (NULL == pool_base) {
> -		ODP_ERR("Error: packet pool mem alloc failed.\n");
> -		exit(EXIT_FAILURE);
> -	}
> +	pkt_pool = odp_buffer_pool_create("packet_pool", ODP_SHM_NULL,
> +					  &params);
>  
> -	pkt_pool = odp_buffer_pool_create("packet_pool", pool_base,
> -					  SHM_PKT_POOL_SIZE,
> -					  SHM_PKT_POOL_BUF_SIZE,
> -					  ODP_CACHE_LINE_SIZE,
> -					  ODP_BUFFER_TYPE_PACKET);
>  	if (ODP_BUFFER_POOL_INVALID == pkt_pool) {
>  		ODP_ERR("Error: packet pool create failed.\n");
>  		exit(EXIT_FAILURE);
>  	}
>  
>  	/* Create context buffer pool */
> -	shm = odp_shm_reserve("shm_ctx_pool",
> -			      SHM_CTX_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);
> -
> -	pool_base = odp_shm_addr(shm);
> -
> -	if (NULL == pool_base) {
> -		ODP_ERR("Error: context pool mem alloc failed.\n");
> -		exit(EXIT_FAILURE);
> -	}
> +	params.buf_size  = SHM_CTX_POOL_BUF_SIZE;
> +	params.buf_align = 0;
> +	params.num_bufs  = SHM_CTX_POOL_BUF_COUNT;
> +	params.buf_type  = ODP_BUFFER_TYPE_RAW;
>  
> -	ctx_pool = odp_buffer_pool_create("ctx_pool", pool_base,
> -					  SHM_CTX_POOL_SIZE,
> -					  SHM_CTX_POOL_BUF_SIZE,
> -					  ODP_CACHE_LINE_SIZE,
> -					  ODP_BUFFER_TYPE_RAW);
>  	if (ODP_BUFFER_POOL_INVALID == ctx_pool) {
>  		ODP_ERR("Error: context pool create failed.\n");
>  		exit(EXIT_FAILURE);
> diff --git a/example/l2fwd/odp_l2fwd.c b/example/l2fwd/odp_l2fwd.c
> index 57037cd..026627d 100644
> --- a/example/l2fwd/odp_l2fwd.c
> +++ b/example/l2fwd/odp_l2fwd.c
> @@ -311,12 +311,12 @@ int main(int argc, char *argv[])
>  {
>  	odph_linux_pthread_t thread_tbl[MAX_WORKERS];
>  	odp_buffer_pool_t pool;
> -	void *pool_base;
>  	int i;
>  	int first_core;
>  	int core_count;
>  	odp_pktio_t pktio;
>  	odp_shm_t shm;
> +	odp_buffer_pool_param_t params;
>  
>  	/* Init ODP before calling anything else */
>  	if (odp_init_global(NULL, NULL)) {
> @@ -380,20 +380,13 @@ int main(int argc, char *argv[])
>  	printf("First core:         %i\n\n", first_core);
>  
>  	/* Create packet pool */
> -	shm = odp_shm_reserve("shm_packet_pool",
> -			      SHM_PKT_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);
> -	pool_base = odp_shm_addr(shm);
> +	params.buf_size  = SHM_PKT_POOL_BUF_SIZE;
> +	params.buf_align = 0;
> +	params.num_bufs  = SHM_PKT_POOL_SIZE/SHM_PKT_POOL_BUF_SIZE;
> +	params.buf_type  = ODP_BUFFER_TYPE_PACKET;
>  
> -	if (pool_base == NULL) {
> -		ODP_ERR("Error: packet pool mem alloc failed.\n");
> -		exit(EXIT_FAILURE);
> -	}
> +	pool = odp_buffer_pool_create("packet pool", ODP_SHM_NULL, &params);
>  
> -	pool = odp_buffer_pool_create("packet_pool", pool_base,
> -				      SHM_PKT_POOL_SIZE,
> -				      SHM_PKT_POOL_BUF_SIZE,
> -				      ODP_CACHE_LINE_SIZE,
> -				      ODP_BUFFER_TYPE_PACKET);
>  	if (pool == ODP_BUFFER_POOL_INVALID) {
>  		ODP_ERR("Error: packet pool create failed.\n");
>  		exit(EXIT_FAILURE);
> diff --git a/example/odp_example/odp_example.c b/example/odp_example/odp_example.c
> index d0ec977..515fe33 100644
> --- a/example/odp_example/odp_example.c
> +++ b/example/odp_example/odp_example.c
> @@ -949,13 +949,13 @@ int main(int argc, char *argv[])
>  	test_args_t args;
>  	int num_workers;
>  	odp_buffer_pool_t pool;
> -	void *pool_base;
>  	odp_queue_t queue;
>  	int i, j;
>  	int prios;
>  	int first_core;
>  	odp_shm_t shm;
>  	test_globals_t *globals;
> +	odp_buffer_pool_param_t params;
>  
>  	printf("\nODP example starts\n\n");
>  
> @@ -1037,19 +1037,13 @@ int main(int argc, char *argv[])
>  	/*
>  	 * Create message pool
>  	 */
> -	shm = odp_shm_reserve("msg_pool",
> -			      MSG_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);
>  
> -	pool_base = odp_shm_addr(shm);
> +	params.buf_size  = sizeof(test_message_t);
> +	params.buf_align = 0;
> +	params.num_bufs  = MSG_POOL_SIZE/sizeof(test_message_t);
> +	params.buf_type  = ODP_BUFFER_TYPE_RAW;
>  
> -	if (pool_base == NULL) {
> -		ODP_ERR("Shared memory reserve failed.\n");
> -		return -1;
> -	}
> -
> -	pool = odp_buffer_pool_create("msg_pool", pool_base, MSG_POOL_SIZE,
> -				      sizeof(test_message_t),
> -				      ODP_CACHE_LINE_SIZE, ODP_BUFFER_TYPE_RAW);
> +	pool = odp_buffer_pool_create("msg_pool", ODP_SHM_NULL, &params);
>  
>  	if (pool == ODP_BUFFER_POOL_INVALID) {
>  		ODP_ERR("Pool create failed.\n");
> diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
> index 2cf3f0d..00e5374 100644
> --- a/example/packet/odp_pktio.c
> +++ b/example/packet/odp_pktio.c
> @@ -292,11 +292,11 @@ int main(int argc, char *argv[])
>  	odph_linux_pthread_t thread_tbl[MAX_WORKERS];
>  	odp_buffer_pool_t pool;
>  	int num_workers;
> -	void *pool_base;
>  	int i;
>  	int first_core;
>  	int core_count;
>  	odp_shm_t shm;
> +	odp_buffer_pool_param_t params;
>  
>  	/* Init ODP before calling anything else */
>  	if (odp_init_global(NULL, NULL)) {
> @@ -350,20 +350,13 @@ int main(int argc, char *argv[])
>  	printf("First core:         %i\n\n", first_core);
>  
>  	/* Create packet pool */
> -	shm = odp_shm_reserve("shm_packet_pool",
> -			      SHM_PKT_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);
> -	pool_base = odp_shm_addr(shm);
> +	params.buf_size  = SHM_PKT_POOL_BUF_SIZE;
> +	params.buf_align = 0;
> +	params.num_bufs  = SHM_PKT_POOL_SIZE/SHM_PKT_POOL_BUF_SIZE;
> +	params.buf_type  = ODP_BUFFER_TYPE_PACKET;
>  
> -	if (pool_base == NULL) {
> -		ODP_ERR("Error: packet pool mem alloc failed.\n");
> -		exit(EXIT_FAILURE);
> -	}
> +	pool = odp_buffer_pool_create("packet_pool", ODP_SHM_NULL, &params);
>  
> -	pool = odp_buffer_pool_create("packet_pool", pool_base,
> -				      SHM_PKT_POOL_SIZE,
> -				      SHM_PKT_POOL_BUF_SIZE,
> -				      ODP_CACHE_LINE_SIZE,
> -				      ODP_BUFFER_TYPE_PACKET);
>  	if (pool == ODP_BUFFER_POOL_INVALID) {
>  		ODP_ERR("Error: packet pool create failed.\n");
>  		exit(EXIT_FAILURE);
> diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c
> index 78b2ae2..12e9c8d 100644
> --- a/example/timer/odp_timer_test.c
> +++ b/example/timer/odp_timer_test.c
> @@ -242,12 +242,12 @@ int main(int argc, char *argv[])
>  	test_args_t args;
>  	int num_workers;
>  	odp_buffer_pool_t pool;
> -	void *pool_base;
>  	odp_queue_t queue;
>  	int first_core;
>  	uint64_t cycles, ns;
>  	odp_queue_param_t param;
>  	odp_shm_t shm;
> +	odp_buffer_pool_param_t params;
>  
>  	printf("\nODP timer example starts\n");
>  
> @@ -311,12 +311,13 @@ int main(int argc, char *argv[])
>  	 */
>  	shm = odp_shm_reserve("msg_pool",
>  			      MSG_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);
> -	pool_base = odp_shm_addr(shm);
>  
> -	pool = odp_buffer_pool_create("msg_pool", pool_base, MSG_POOL_SIZE,
> -				      0,
> -				      ODP_CACHE_LINE_SIZE,
> -				      ODP_BUFFER_TYPE_TIMEOUT);
> +	params.buf_size  = 0;
> +	params.buf_align = 0;
> +	params.num_bufs  = MSG_POOL_SIZE;
> +	params.buf_type  = ODP_BUFFER_TYPE_TIMEOUT;
> +
> +	pool = odp_buffer_pool_create("msg_pool", shm, &params);
>  
>  	if (pool == ODP_BUFFER_POOL_INVALID) {
>  		ODP_ERR("Pool create failed.\n");
> diff --git a/test/api_test/odp_timer_ping.c b/test/api_test/odp_timer_ping.c
> index 7704181..1566f4f 100644
> --- a/test/api_test/odp_timer_ping.c
> +++ b/test/api_test/odp_timer_ping.c
> @@ -319,9 +319,8 @@ int main(int argc ODP_UNUSED, char *argv[] ODP_UNUSED)
>  	ping_arg_t pingarg;
>  	odp_queue_t queue;
>  	odp_buffer_pool_t pool;
> -	void *pool_base;
>  	int i;
> -	odp_shm_t shm;
> +	odp_buffer_pool_param_t params;
>  
>  	if (odp_test_global_init() != 0)
>  		return -1;
> @@ -334,14 +333,14 @@ int main(int argc ODP_UNUSED, char *argv[] ODP_UNUSED)
>  	/*
>  	 * Create message pool
>  	 */
> -	shm = odp_shm_reserve("msg_pool",
> -			      MSG_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);
> -	pool_base = odp_shm_addr(shm);
> -
> -	pool = odp_buffer_pool_create("msg_pool", pool_base, MSG_POOL_SIZE,
> -				      BUF_SIZE,
> -				      ODP_CACHE_LINE_SIZE,
> -				      ODP_BUFFER_TYPE_RAW);
> +
> +	params.buf_size  = BUF_SIZE;
> +	params.buf_align = 0;
> +	params.num_bufs  = MSG_POOL_SIZE/BUF_SIZE;
> +	params.buf_type  = ODP_BUFFER_TYPE_RAW;
> +
> +	pool = odp_buffer_pool_create("msg_pool", ODP_SHM_NULL, &params);
> +
>  	if (pool == ODP_BUFFER_POOL_INVALID) {
>  		LOG_ERR("Pool create failed.\n");
>  		return -1;
> -- 
> 1.8.3.2
> 
> 
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
Ciprian Barbu Nov. 19, 2014, 11:16 a.m. UTC | #2
On Wed, Nov 19, 2014 at 3:21 AM, Bill Fischofer
<bill.fischofer@linaro.org> wrote:
> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
> ---
>  example/generator/odp_generator.c | 19 +++++--------
>  example/ipsec/odp_ipsec.c         | 56 ++++++++++++---------------------------
>  example/l2fwd/odp_l2fwd.c         | 19 +++++--------
>  example/odp_example/odp_example.c | 18 +++++--------
>  example/packet/odp_pktio.c        | 19 +++++--------
>  example/timer/odp_timer_test.c    | 13 ++++-----
>  test/api_test/odp_timer_ping.c    | 19 +++++++------
>  7 files changed, 57 insertions(+), 106 deletions(-)
>
> diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c
> index ffa5e62..480ddd5 100644
> --- a/example/generator/odp_generator.c
> +++ b/example/generator/odp_generator.c
> @@ -512,11 +512,11 @@ int main(int argc, char *argv[])
>         odph_linux_pthread_t thread_tbl[MAX_WORKERS];
>         odp_buffer_pool_t pool;
>         int num_workers;
> -       void *pool_base;
>         int i;
>         int first_core;
>         int core_count;
>         odp_shm_t shm;
> +       odp_buffer_pool_param_t params;
>
>         /* Init ODP before calling anything else */
>         if (odp_init_global(NULL, NULL)) {
> @@ -579,20 +579,13 @@ int main(int argc, char *argv[])
>         printf("First core:         %i\n\n", first_core);
>
>         /* Create packet pool */
> -       shm = odp_shm_reserve("shm_packet_pool",
> -                             SHM_PKT_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);
> -       pool_base = odp_shm_addr(shm);
> +       params.buf_size  = SHM_PKT_POOL_BUF_SIZE;
> +       params.buf_align = 0;
> +       params.num_bufs  = SHM_PKT_POOL_SIZE/SHM_PKT_POOL_BUF_SIZE;

I think we should do the right thing and drop the SHM_PKT_POOL_SIZE
nonsense. It's confusing to see SHM_PKT_POOL_SIZE = (512 * 20148) and
SHM_PKT_POOL_BUF_SIZE = 1856 and then do the math above. Just drop
SHM_PKT_POOL_SIZE and replace it with a SHM_PKT_POOL_BUF_COUNT, 512 in
this case. Also for all the other apps.

> +       params.buf_type  = ODP_BUFFER_TYPE_PACKET;
>
> -       if (pool_base == NULL) {
> -               ODP_ERR("Error: packet pool mem alloc failed.\n");
> -               exit(EXIT_FAILURE);
> -       }
> +       pool = odp_buffer_pool_create("packet_pool", ODP_SHM_NULL, &params);
>
> -       pool = odp_buffer_pool_create("packet_pool", pool_base,
> -                                     SHM_PKT_POOL_SIZE,
> -                                     SHM_PKT_POOL_BUF_SIZE,
> -                                     ODP_CACHE_LINE_SIZE,
> -                                     ODP_BUFFER_TYPE_PACKET);
>         if (pool == ODP_BUFFER_POOL_INVALID) {
>                 ODP_ERR("Error: packet pool create failed.\n");
>                 exit(EXIT_FAILURE);
> diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
> index 37ad34d..0d015bb 100644
> --- a/example/ipsec/odp_ipsec.c
> +++ b/example/ipsec/odp_ipsec.c
> @@ -365,8 +365,7 @@ static
>  void ipsec_init_pre(void)
>  {
>         odp_queue_param_t qparam;
> -       void *pool_base;
> -       odp_shm_t shm;
> +       odp_buffer_pool_param_t params;
>
>         /*
>          * Create queues
> @@ -399,16 +398,12 @@ void ipsec_init_pre(void)
>         }
>
>         /* Create output buffer pool */
> -       shm = odp_shm_reserve("shm_out_pool",
> -                             SHM_OUT_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);
> -
> -       pool_base = odp_shm_addr(shm);
> +       params.buf_size  = SHM_OUT_POOL_BUF_SIZE;
> +       params.buf_align = 0;
> +       params.num_bufs  = SHM_PKT_POOL_BUF_COUNT;
> +       params.buf_type  = ODP_BUFFER_TYPE_PACKET;
>
> -       out_pool = odp_buffer_pool_create("out_pool", pool_base,
> -                                         SHM_OUT_POOL_SIZE,
> -                                         SHM_OUT_POOL_BUF_SIZE,
> -                                         ODP_CACHE_LINE_SIZE,
> -                                         ODP_BUFFER_TYPE_PACKET);
> +       out_pool = odp_buffer_pool_create("out_pool", ODP_SHM_NULL, &params);
>
>         if (ODP_BUFFER_POOL_INVALID == out_pool) {
>                 ODP_ERR("Error: message pool create failed.\n");
> @@ -1168,12 +1163,12 @@ main(int argc, char *argv[])
>  {
>         odph_linux_pthread_t thread_tbl[MAX_WORKERS];
>         int num_workers;
> -       void *pool_base;
>         int i;
>         int first_core;
>         int core_count;
>         int stream_count;
>         odp_shm_t shm;
> +       odp_buffer_pool_param_t params;
>
>         /* Init ODP before calling anything else */
>         if (odp_init_global(NULL, NULL)) {
> @@ -1233,42 +1228,25 @@ main(int argc, char *argv[])
>         printf("First core:         %i\n\n", first_core);
>
>         /* Create packet buffer pool */
> -       shm = odp_shm_reserve("shm_packet_pool",
> -                             SHM_PKT_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);
> -
> -       pool_base = odp_shm_addr(shm);
> +       params.buf_size  = SHM_PKT_POOL_BUF_SIZE;
> +       params.buf_align = 0;
> +       params.num_bufs  = SHM_PKT_POOL_BUF_COUNT;
> +       params.buf_type  = ODP_BUFFER_TYPE_PACKET;
>
> -       if (NULL == pool_base) {
> -               ODP_ERR("Error: packet pool mem alloc failed.\n");
> -               exit(EXIT_FAILURE);
> -       }
> +       pkt_pool = odp_buffer_pool_create("packet_pool", ODP_SHM_NULL,
> +                                         &params);
>
> -       pkt_pool = odp_buffer_pool_create("packet_pool", pool_base,
> -                                         SHM_PKT_POOL_SIZE,
> -                                         SHM_PKT_POOL_BUF_SIZE,
> -                                         ODP_CACHE_LINE_SIZE,
> -                                         ODP_BUFFER_TYPE_PACKET);
>         if (ODP_BUFFER_POOL_INVALID == pkt_pool) {
>                 ODP_ERR("Error: packet pool create failed.\n");
>                 exit(EXIT_FAILURE);
>         }
>
>         /* Create context buffer pool */
> -       shm = odp_shm_reserve("shm_ctx_pool",
> -                             SHM_CTX_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);
> -
> -       pool_base = odp_shm_addr(shm);
> -
> -       if (NULL == pool_base) {
> -               ODP_ERR("Error: context pool mem alloc failed.\n");
> -               exit(EXIT_FAILURE);
> -       }
> +       params.buf_size  = SHM_CTX_POOL_BUF_SIZE;
> +       params.buf_align = 0;
> +       params.num_bufs  = SHM_CTX_POOL_BUF_COUNT;
> +       params.buf_type  = ODP_BUFFER_TYPE_RAW;
>
> -       ctx_pool = odp_buffer_pool_create("ctx_pool", pool_base,
> -                                         SHM_CTX_POOL_SIZE,
> -                                         SHM_CTX_POOL_BUF_SIZE,
> -                                         ODP_CACHE_LINE_SIZE,
> -                                         ODP_BUFFER_TYPE_RAW);
>         if (ODP_BUFFER_POOL_INVALID == ctx_pool) {
>                 ODP_ERR("Error: context pool create failed.\n");
>                 exit(EXIT_FAILURE);
> diff --git a/example/l2fwd/odp_l2fwd.c b/example/l2fwd/odp_l2fwd.c
> index 57037cd..026627d 100644
> --- a/example/l2fwd/odp_l2fwd.c
> +++ b/example/l2fwd/odp_l2fwd.c
> @@ -311,12 +311,12 @@ int main(int argc, char *argv[])
>  {
>         odph_linux_pthread_t thread_tbl[MAX_WORKERS];
>         odp_buffer_pool_t pool;
> -       void *pool_base;
>         int i;
>         int first_core;
>         int core_count;
>         odp_pktio_t pktio;
>         odp_shm_t shm;
> +       odp_buffer_pool_param_t params;
>
>         /* Init ODP before calling anything else */
>         if (odp_init_global(NULL, NULL)) {
> @@ -380,20 +380,13 @@ int main(int argc, char *argv[])
>         printf("First core:         %i\n\n", first_core);
>
>         /* Create packet pool */
> -       shm = odp_shm_reserve("shm_packet_pool",
> -                             SHM_PKT_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);
> -       pool_base = odp_shm_addr(shm);
> +       params.buf_size  = SHM_PKT_POOL_BUF_SIZE;
> +       params.buf_align = 0;
> +       params.num_bufs  = SHM_PKT_POOL_SIZE/SHM_PKT_POOL_BUF_SIZE;
> +       params.buf_type  = ODP_BUFFER_TYPE_PACKET;
>
> -       if (pool_base == NULL) {
> -               ODP_ERR("Error: packet pool mem alloc failed.\n");
> -               exit(EXIT_FAILURE);
> -       }
> +       pool = odp_buffer_pool_create("packet pool", ODP_SHM_NULL, &params);
>
> -       pool = odp_buffer_pool_create("packet_pool", pool_base,
> -                                     SHM_PKT_POOL_SIZE,
> -                                     SHM_PKT_POOL_BUF_SIZE,
> -                                     ODP_CACHE_LINE_SIZE,
> -                                     ODP_BUFFER_TYPE_PACKET);
>         if (pool == ODP_BUFFER_POOL_INVALID) {
>                 ODP_ERR("Error: packet pool create failed.\n");
>                 exit(EXIT_FAILURE);
> diff --git a/example/odp_example/odp_example.c b/example/odp_example/odp_example.c
> index d0ec977..515fe33 100644
> --- a/example/odp_example/odp_example.c
> +++ b/example/odp_example/odp_example.c
> @@ -949,13 +949,13 @@ int main(int argc, char *argv[])
>         test_args_t args;
>         int num_workers;
>         odp_buffer_pool_t pool;
> -       void *pool_base;
>         odp_queue_t queue;
>         int i, j;
>         int prios;
>         int first_core;
>         odp_shm_t shm;
>         test_globals_t *globals;
> +       odp_buffer_pool_param_t params;
>
>         printf("\nODP example starts\n\n");
>
> @@ -1037,19 +1037,13 @@ int main(int argc, char *argv[])
>         /*
>          * Create message pool
>          */
> -       shm = odp_shm_reserve("msg_pool",
> -                             MSG_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);
>
> -       pool_base = odp_shm_addr(shm);
> +       params.buf_size  = sizeof(test_message_t);
> +       params.buf_align = 0;
> +       params.num_bufs  = MSG_POOL_SIZE/sizeof(test_message_t);
> +       params.buf_type  = ODP_BUFFER_TYPE_RAW;
>
> -       if (pool_base == NULL) {
> -               ODP_ERR("Shared memory reserve failed.\n");
> -               return -1;
> -       }
> -
> -       pool = odp_buffer_pool_create("msg_pool", pool_base, MSG_POOL_SIZE,
> -                                     sizeof(test_message_t),
> -                                     ODP_CACHE_LINE_SIZE, ODP_BUFFER_TYPE_RAW);
> +       pool = odp_buffer_pool_create("msg_pool", ODP_SHM_NULL, &params);
>
>         if (pool == ODP_BUFFER_POOL_INVALID) {
>                 ODP_ERR("Pool create failed.\n");
> diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
> index 2cf3f0d..00e5374 100644
> --- a/example/packet/odp_pktio.c
> +++ b/example/packet/odp_pktio.c
> @@ -292,11 +292,11 @@ int main(int argc, char *argv[])
>         odph_linux_pthread_t thread_tbl[MAX_WORKERS];
>         odp_buffer_pool_t pool;
>         int num_workers;
> -       void *pool_base;
>         int i;
>         int first_core;
>         int core_count;
>         odp_shm_t shm;
> +       odp_buffer_pool_param_t params;
>
>         /* Init ODP before calling anything else */
>         if (odp_init_global(NULL, NULL)) {
> @@ -350,20 +350,13 @@ int main(int argc, char *argv[])
>         printf("First core:         %i\n\n", first_core);
>
>         /* Create packet pool */
> -       shm = odp_shm_reserve("shm_packet_pool",
> -                             SHM_PKT_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);
> -       pool_base = odp_shm_addr(shm);
> +       params.buf_size  = SHM_PKT_POOL_BUF_SIZE;
> +       params.buf_align = 0;
> +       params.num_bufs  = SHM_PKT_POOL_SIZE/SHM_PKT_POOL_BUF_SIZE;
> +       params.buf_type  = ODP_BUFFER_TYPE_PACKET;
>
> -       if (pool_base == NULL) {
> -               ODP_ERR("Error: packet pool mem alloc failed.\n");
> -               exit(EXIT_FAILURE);
> -       }
> +       pool = odp_buffer_pool_create("packet_pool", ODP_SHM_NULL, &params);
>
> -       pool = odp_buffer_pool_create("packet_pool", pool_base,
> -                                     SHM_PKT_POOL_SIZE,
> -                                     SHM_PKT_POOL_BUF_SIZE,
> -                                     ODP_CACHE_LINE_SIZE,
> -                                     ODP_BUFFER_TYPE_PACKET);
>         if (pool == ODP_BUFFER_POOL_INVALID) {
>                 ODP_ERR("Error: packet pool create failed.\n");
>                 exit(EXIT_FAILURE);
> diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c
> index 78b2ae2..12e9c8d 100644
> --- a/example/timer/odp_timer_test.c
> +++ b/example/timer/odp_timer_test.c
> @@ -242,12 +242,12 @@ int main(int argc, char *argv[])
>         test_args_t args;
>         int num_workers;
>         odp_buffer_pool_t pool;
> -       void *pool_base;
>         odp_queue_t queue;
>         int first_core;
>         uint64_t cycles, ns;
>         odp_queue_param_t param;
>         odp_shm_t shm;
> +       odp_buffer_pool_param_t params;
>
>         printf("\nODP timer example starts\n");
>
> @@ -311,12 +311,13 @@ int main(int argc, char *argv[])
>          */
>         shm = odp_shm_reserve("msg_pool",
>                               MSG_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);
> -       pool_base = odp_shm_addr(shm);
>
> -       pool = odp_buffer_pool_create("msg_pool", pool_base, MSG_POOL_SIZE,
> -                                     0,
> -                                     ODP_CACHE_LINE_SIZE,
> -                                     ODP_BUFFER_TYPE_TIMEOUT);
> +       params.buf_size  = 0;
> +       params.buf_align = 0;
> +       params.num_bufs  = MSG_POOL_SIZE;
> +       params.buf_type  = ODP_BUFFER_TYPE_TIMEOUT;
> +
> +       pool = odp_buffer_pool_create("msg_pool", shm, &params);
>
>         if (pool == ODP_BUFFER_POOL_INVALID) {
>                 ODP_ERR("Pool create failed.\n");
> diff --git a/test/api_test/odp_timer_ping.c b/test/api_test/odp_timer_ping.c
> index 7704181..1566f4f 100644
> --- a/test/api_test/odp_timer_ping.c
> +++ b/test/api_test/odp_timer_ping.c
> @@ -319,9 +319,8 @@ int main(int argc ODP_UNUSED, char *argv[] ODP_UNUSED)
>         ping_arg_t pingarg;
>         odp_queue_t queue;
>         odp_buffer_pool_t pool;
> -       void *pool_base;
>         int i;
> -       odp_shm_t shm;
> +       odp_buffer_pool_param_t params;
>
>         if (odp_test_global_init() != 0)
>                 return -1;
> @@ -334,14 +333,14 @@ int main(int argc ODP_UNUSED, char *argv[] ODP_UNUSED)
>         /*
>          * Create message pool
>          */
> -       shm = odp_shm_reserve("msg_pool",
> -                             MSG_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);
> -       pool_base = odp_shm_addr(shm);
> -
> -       pool = odp_buffer_pool_create("msg_pool", pool_base, MSG_POOL_SIZE,
> -                                     BUF_SIZE,
> -                                     ODP_CACHE_LINE_SIZE,
> -                                     ODP_BUFFER_TYPE_RAW);
> +
> +       params.buf_size  = BUF_SIZE;
> +       params.buf_align = 0;
> +       params.num_bufs  = MSG_POOL_SIZE/BUF_SIZE;
> +       params.buf_type  = ODP_BUFFER_TYPE_RAW;
> +
> +       pool = odp_buffer_pool_create("msg_pool", ODP_SHM_NULL, &params);
> +
>         if (pool == ODP_BUFFER_POOL_INVALID) {
>                 LOG_ERR("Pool create failed.\n");
>                 return -1;
> --
> 1.8.3.2
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
Bill Fischofer Nov. 19, 2014, 12:15 p.m. UTC | #3
Anders: Please be specific about what isn't building.  These build and run
against the current tip for me.

Thanks.

Bill

On Wed, Nov 19, 2014 at 5:16 AM, Ciprian Barbu <ciprian.barbu@linaro.org>
wrote:

> On Wed, Nov 19, 2014 at 3:21 AM, Bill Fischofer
> <bill.fischofer@linaro.org> wrote:
> > Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
> > ---
> >  example/generator/odp_generator.c | 19 +++++--------
> >  example/ipsec/odp_ipsec.c         | 56
> ++++++++++++---------------------------
> >  example/l2fwd/odp_l2fwd.c         | 19 +++++--------
> >  example/odp_example/odp_example.c | 18 +++++--------
> >  example/packet/odp_pktio.c        | 19 +++++--------
> >  example/timer/odp_timer_test.c    | 13 ++++-----
> >  test/api_test/odp_timer_ping.c    | 19 +++++++------
> >  7 files changed, 57 insertions(+), 106 deletions(-)
> >
> > diff --git a/example/generator/odp_generator.c
> b/example/generator/odp_generator.c
> > index ffa5e62..480ddd5 100644
> > --- a/example/generator/odp_generator.c
> > +++ b/example/generator/odp_generator.c
> > @@ -512,11 +512,11 @@ int main(int argc, char *argv[])
> >         odph_linux_pthread_t thread_tbl[MAX_WORKERS];
> >         odp_buffer_pool_t pool;
> >         int num_workers;
> > -       void *pool_base;
> >         int i;
> >         int first_core;
> >         int core_count;
> >         odp_shm_t shm;
> > +       odp_buffer_pool_param_t params;
> >
> >         /* Init ODP before calling anything else */
> >         if (odp_init_global(NULL, NULL)) {
> > @@ -579,20 +579,13 @@ int main(int argc, char *argv[])
> >         printf("First core:         %i\n\n", first_core);
> >
> >         /* Create packet pool */
> > -       shm = odp_shm_reserve("shm_packet_pool",
> > -                             SHM_PKT_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);
> > -       pool_base = odp_shm_addr(shm);
> > +       params.buf_size  = SHM_PKT_POOL_BUF_SIZE;
> > +       params.buf_align = 0;
> > +       params.num_bufs  = SHM_PKT_POOL_SIZE/SHM_PKT_POOL_BUF_SIZE;
>
> I think we should do the right thing and drop the SHM_PKT_POOL_SIZE
> nonsense. It's confusing to see SHM_PKT_POOL_SIZE = (512 * 20148) and
> SHM_PKT_POOL_BUF_SIZE = 1856 and then do the math above. Just drop
> SHM_PKT_POOL_SIZE and replace it with a SHM_PKT_POOL_BUF_COUNT, 512 in
> this case. Also for all the other apps.
>
> > +       params.buf_type  = ODP_BUFFER_TYPE_PACKET;
> >
> > -       if (pool_base == NULL) {
> > -               ODP_ERR("Error: packet pool mem alloc failed.\n");
> > -               exit(EXIT_FAILURE);
> > -       }
> > +       pool = odp_buffer_pool_create("packet_pool", ODP_SHM_NULL,
> &params);
> >
> > -       pool = odp_buffer_pool_create("packet_pool", pool_base,
> > -                                     SHM_PKT_POOL_SIZE,
> > -                                     SHM_PKT_POOL_BUF_SIZE,
> > -                                     ODP_CACHE_LINE_SIZE,
> > -                                     ODP_BUFFER_TYPE_PACKET);
> >         if (pool == ODP_BUFFER_POOL_INVALID) {
> >                 ODP_ERR("Error: packet pool create failed.\n");
> >                 exit(EXIT_FAILURE);
> > diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
> > index 37ad34d..0d015bb 100644
> > --- a/example/ipsec/odp_ipsec.c
> > +++ b/example/ipsec/odp_ipsec.c
> > @@ -365,8 +365,7 @@ static
> >  void ipsec_init_pre(void)
> >  {
> >         odp_queue_param_t qparam;
> > -       void *pool_base;
> > -       odp_shm_t shm;
> > +       odp_buffer_pool_param_t params;
> >
> >         /*
> >          * Create queues
> > @@ -399,16 +398,12 @@ void ipsec_init_pre(void)
> >         }
> >
> >         /* Create output buffer pool */
> > -       shm = odp_shm_reserve("shm_out_pool",
> > -                             SHM_OUT_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);
> > -
> > -       pool_base = odp_shm_addr(shm);
> > +       params.buf_size  = SHM_OUT_POOL_BUF_SIZE;
> > +       params.buf_align = 0;
> > +       params.num_bufs  = SHM_PKT_POOL_BUF_COUNT;
> > +       params.buf_type  = ODP_BUFFER_TYPE_PACKET;
> >
> > -       out_pool = odp_buffer_pool_create("out_pool", pool_base,
> > -                                         SHM_OUT_POOL_SIZE,
> > -                                         SHM_OUT_POOL_BUF_SIZE,
> > -                                         ODP_CACHE_LINE_SIZE,
> > -                                         ODP_BUFFER_TYPE_PACKET);
> > +       out_pool = odp_buffer_pool_create("out_pool", ODP_SHM_NULL,
> &params);
> >
> >         if (ODP_BUFFER_POOL_INVALID == out_pool) {
> >                 ODP_ERR("Error: message pool create failed.\n");
> > @@ -1168,12 +1163,12 @@ main(int argc, char *argv[])
> >  {
> >         odph_linux_pthread_t thread_tbl[MAX_WORKERS];
> >         int num_workers;
> > -       void *pool_base;
> >         int i;
> >         int first_core;
> >         int core_count;
> >         int stream_count;
> >         odp_shm_t shm;
> > +       odp_buffer_pool_param_t params;
> >
> >         /* Init ODP before calling anything else */
> >         if (odp_init_global(NULL, NULL)) {
> > @@ -1233,42 +1228,25 @@ main(int argc, char *argv[])
> >         printf("First core:         %i\n\n", first_core);
> >
> >         /* Create packet buffer pool */
> > -       shm = odp_shm_reserve("shm_packet_pool",
> > -                             SHM_PKT_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);
> > -
> > -       pool_base = odp_shm_addr(shm);
> > +       params.buf_size  = SHM_PKT_POOL_BUF_SIZE;
> > +       params.buf_align = 0;
> > +       params.num_bufs  = SHM_PKT_POOL_BUF_COUNT;
> > +       params.buf_type  = ODP_BUFFER_TYPE_PACKET;
> >
> > -       if (NULL == pool_base) {
> > -               ODP_ERR("Error: packet pool mem alloc failed.\n");
> > -               exit(EXIT_FAILURE);
> > -       }
> > +       pkt_pool = odp_buffer_pool_create("packet_pool", ODP_SHM_NULL,
> > +                                         &params);
> >
> > -       pkt_pool = odp_buffer_pool_create("packet_pool", pool_base,
> > -                                         SHM_PKT_POOL_SIZE,
> > -                                         SHM_PKT_POOL_BUF_SIZE,
> > -                                         ODP_CACHE_LINE_SIZE,
> > -                                         ODP_BUFFER_TYPE_PACKET);
> >         if (ODP_BUFFER_POOL_INVALID == pkt_pool) {
> >                 ODP_ERR("Error: packet pool create failed.\n");
> >                 exit(EXIT_FAILURE);
> >         }
> >
> >         /* Create context buffer pool */
> > -       shm = odp_shm_reserve("shm_ctx_pool",
> > -                             SHM_CTX_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);
> > -
> > -       pool_base = odp_shm_addr(shm);
> > -
> > -       if (NULL == pool_base) {
> > -               ODP_ERR("Error: context pool mem alloc failed.\n");
> > -               exit(EXIT_FAILURE);
> > -       }
> > +       params.buf_size  = SHM_CTX_POOL_BUF_SIZE;
> > +       params.buf_align = 0;
> > +       params.num_bufs  = SHM_CTX_POOL_BUF_COUNT;
> > +       params.buf_type  = ODP_BUFFER_TYPE_RAW;
> >
> > -       ctx_pool = odp_buffer_pool_create("ctx_pool", pool_base,
> > -                                         SHM_CTX_POOL_SIZE,
> > -                                         SHM_CTX_POOL_BUF_SIZE,
> > -                                         ODP_CACHE_LINE_SIZE,
> > -                                         ODP_BUFFER_TYPE_RAW);
> >         if (ODP_BUFFER_POOL_INVALID == ctx_pool) {
> >                 ODP_ERR("Error: context pool create failed.\n");
> >                 exit(EXIT_FAILURE);
> > diff --git a/example/l2fwd/odp_l2fwd.c b/example/l2fwd/odp_l2fwd.c
> > index 57037cd..026627d 100644
> > --- a/example/l2fwd/odp_l2fwd.c
> > +++ b/example/l2fwd/odp_l2fwd.c
> > @@ -311,12 +311,12 @@ int main(int argc, char *argv[])
> >  {
> >         odph_linux_pthread_t thread_tbl[MAX_WORKERS];
> >         odp_buffer_pool_t pool;
> > -       void *pool_base;
> >         int i;
> >         int first_core;
> >         int core_count;
> >         odp_pktio_t pktio;
> >         odp_shm_t shm;
> > +       odp_buffer_pool_param_t params;
> >
> >         /* Init ODP before calling anything else */
> >         if (odp_init_global(NULL, NULL)) {
> > @@ -380,20 +380,13 @@ int main(int argc, char *argv[])
> >         printf("First core:         %i\n\n", first_core);
> >
> >         /* Create packet pool */
> > -       shm = odp_shm_reserve("shm_packet_pool",
> > -                             SHM_PKT_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);
> > -       pool_base = odp_shm_addr(shm);
> > +       params.buf_size  = SHM_PKT_POOL_BUF_SIZE;
> > +       params.buf_align = 0;
> > +       params.num_bufs  = SHM_PKT_POOL_SIZE/SHM_PKT_POOL_BUF_SIZE;
> > +       params.buf_type  = ODP_BUFFER_TYPE_PACKET;
> >
> > -       if (pool_base == NULL) {
> > -               ODP_ERR("Error: packet pool mem alloc failed.\n");
> > -               exit(EXIT_FAILURE);
> > -       }
> > +       pool = odp_buffer_pool_create("packet pool", ODP_SHM_NULL,
> &params);
> >
> > -       pool = odp_buffer_pool_create("packet_pool", pool_base,
> > -                                     SHM_PKT_POOL_SIZE,
> > -                                     SHM_PKT_POOL_BUF_SIZE,
> > -                                     ODP_CACHE_LINE_SIZE,
> > -                                     ODP_BUFFER_TYPE_PACKET);
> >         if (pool == ODP_BUFFER_POOL_INVALID) {
> >                 ODP_ERR("Error: packet pool create failed.\n");
> >                 exit(EXIT_FAILURE);
> > diff --git a/example/odp_example/odp_example.c
> b/example/odp_example/odp_example.c
> > index d0ec977..515fe33 100644
> > --- a/example/odp_example/odp_example.c
> > +++ b/example/odp_example/odp_example.c
> > @@ -949,13 +949,13 @@ int main(int argc, char *argv[])
> >         test_args_t args;
> >         int num_workers;
> >         odp_buffer_pool_t pool;
> > -       void *pool_base;
> >         odp_queue_t queue;
> >         int i, j;
> >         int prios;
> >         int first_core;
> >         odp_shm_t shm;
> >         test_globals_t *globals;
> > +       odp_buffer_pool_param_t params;
> >
> >         printf("\nODP example starts\n\n");
> >
> > @@ -1037,19 +1037,13 @@ int main(int argc, char *argv[])
> >         /*
> >          * Create message pool
> >          */
> > -       shm = odp_shm_reserve("msg_pool",
> > -                             MSG_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);
> >
> > -       pool_base = odp_shm_addr(shm);
> > +       params.buf_size  = sizeof(test_message_t);
> > +       params.buf_align = 0;
> > +       params.num_bufs  = MSG_POOL_SIZE/sizeof(test_message_t);
> > +       params.buf_type  = ODP_BUFFER_TYPE_RAW;
> >
> > -       if (pool_base == NULL) {
> > -               ODP_ERR("Shared memory reserve failed.\n");
> > -               return -1;
> > -       }
> > -
> > -       pool = odp_buffer_pool_create("msg_pool", pool_base,
> MSG_POOL_SIZE,
> > -                                     sizeof(test_message_t),
> > -                                     ODP_CACHE_LINE_SIZE,
> ODP_BUFFER_TYPE_RAW);
> > +       pool = odp_buffer_pool_create("msg_pool", ODP_SHM_NULL, &params);
> >
> >         if (pool == ODP_BUFFER_POOL_INVALID) {
> >                 ODP_ERR("Pool create failed.\n");
> > diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
> > index 2cf3f0d..00e5374 100644
> > --- a/example/packet/odp_pktio.c
> > +++ b/example/packet/odp_pktio.c
> > @@ -292,11 +292,11 @@ int main(int argc, char *argv[])
> >         odph_linux_pthread_t thread_tbl[MAX_WORKERS];
> >         odp_buffer_pool_t pool;
> >         int num_workers;
> > -       void *pool_base;
> >         int i;
> >         int first_core;
> >         int core_count;
> >         odp_shm_t shm;
> > +       odp_buffer_pool_param_t params;
> >
> >         /* Init ODP before calling anything else */
> >         if (odp_init_global(NULL, NULL)) {
> > @@ -350,20 +350,13 @@ int main(int argc, char *argv[])
> >         printf("First core:         %i\n\n", first_core);
> >
> >         /* Create packet pool */
> > -       shm = odp_shm_reserve("shm_packet_pool",
> > -                             SHM_PKT_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);
> > -       pool_base = odp_shm_addr(shm);
> > +       params.buf_size  = SHM_PKT_POOL_BUF_SIZE;
> > +       params.buf_align = 0;
> > +       params.num_bufs  = SHM_PKT_POOL_SIZE/SHM_PKT_POOL_BUF_SIZE;
> > +       params.buf_type  = ODP_BUFFER_TYPE_PACKET;
> >
> > -       if (pool_base == NULL) {
> > -               ODP_ERR("Error: packet pool mem alloc failed.\n");
> > -               exit(EXIT_FAILURE);
> > -       }
> > +       pool = odp_buffer_pool_create("packet_pool", ODP_SHM_NULL,
> &params);
> >
> > -       pool = odp_buffer_pool_create("packet_pool", pool_base,
> > -                                     SHM_PKT_POOL_SIZE,
> > -                                     SHM_PKT_POOL_BUF_SIZE,
> > -                                     ODP_CACHE_LINE_SIZE,
> > -                                     ODP_BUFFER_TYPE_PACKET);
> >         if (pool == ODP_BUFFER_POOL_INVALID) {
> >                 ODP_ERR("Error: packet pool create failed.\n");
> >                 exit(EXIT_FAILURE);
> > diff --git a/example/timer/odp_timer_test.c
> b/example/timer/odp_timer_test.c
> > index 78b2ae2..12e9c8d 100644
> > --- a/example/timer/odp_timer_test.c
> > +++ b/example/timer/odp_timer_test.c
> > @@ -242,12 +242,12 @@ int main(int argc, char *argv[])
> >         test_args_t args;
> >         int num_workers;
> >         odp_buffer_pool_t pool;
> > -       void *pool_base;
> >         odp_queue_t queue;
> >         int first_core;
> >         uint64_t cycles, ns;
> >         odp_queue_param_t param;
> >         odp_shm_t shm;
> > +       odp_buffer_pool_param_t params;
> >
> >         printf("\nODP timer example starts\n");
> >
> > @@ -311,12 +311,13 @@ int main(int argc, char *argv[])
> >          */
> >         shm = odp_shm_reserve("msg_pool",
> >                               MSG_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);
> > -       pool_base = odp_shm_addr(shm);
> >
> > -       pool = odp_buffer_pool_create("msg_pool", pool_base,
> MSG_POOL_SIZE,
> > -                                     0,
> > -                                     ODP_CACHE_LINE_SIZE,
> > -                                     ODP_BUFFER_TYPE_TIMEOUT);
> > +       params.buf_size  = 0;
> > +       params.buf_align = 0;
> > +       params.num_bufs  = MSG_POOL_SIZE;
> > +       params.buf_type  = ODP_BUFFER_TYPE_TIMEOUT;
> > +
> > +       pool = odp_buffer_pool_create("msg_pool", shm, &params);
> >
> >         if (pool == ODP_BUFFER_POOL_INVALID) {
> >                 ODP_ERR("Pool create failed.\n");
> > diff --git a/test/api_test/odp_timer_ping.c
> b/test/api_test/odp_timer_ping.c
> > index 7704181..1566f4f 100644
> > --- a/test/api_test/odp_timer_ping.c
> > +++ b/test/api_test/odp_timer_ping.c
> > @@ -319,9 +319,8 @@ int main(int argc ODP_UNUSED, char *argv[]
> ODP_UNUSED)
> >         ping_arg_t pingarg;
> >         odp_queue_t queue;
> >         odp_buffer_pool_t pool;
> > -       void *pool_base;
> >         int i;
> > -       odp_shm_t shm;
> > +       odp_buffer_pool_param_t params;
> >
> >         if (odp_test_global_init() != 0)
> >                 return -1;
> > @@ -334,14 +333,14 @@ int main(int argc ODP_UNUSED, char *argv[]
> ODP_UNUSED)
> >         /*
> >          * Create message pool
> >          */
> > -       shm = odp_shm_reserve("msg_pool",
> > -                             MSG_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);
> > -       pool_base = odp_shm_addr(shm);
> > -
> > -       pool = odp_buffer_pool_create("msg_pool", pool_base,
> MSG_POOL_SIZE,
> > -                                     BUF_SIZE,
> > -                                     ODP_CACHE_LINE_SIZE,
> > -                                     ODP_BUFFER_TYPE_RAW);
> > +
> > +       params.buf_size  = BUF_SIZE;
> > +       params.buf_align = 0;
> > +       params.num_bufs  = MSG_POOL_SIZE/BUF_SIZE;
> > +       params.buf_type  = ODP_BUFFER_TYPE_RAW;
> > +
> > +       pool = odp_buffer_pool_create("msg_pool", ODP_SHM_NULL, &params);
> > +
> >         if (pool == ODP_BUFFER_POOL_INVALID) {
> >                 LOG_ERR("Pool create failed.\n");
> >                 return -1;
> > --
> > 1.8.3.2
> >
> >
> > _______________________________________________
> > lng-odp mailing list
> > lng-odp@lists.linaro.org
> > http://lists.linaro.org/mailman/listinfo/lng-odp
>
yan.songming Nov. 19, 2014, 1:28 p.m. UTC | #4
Hi Bill,

I have commit the cunit test of queue a few days ago,  it use the buffer pool api,  so this file may need to be change.

test/cunit/odp_queue.c




yan.songming@linaro.org
 
From: Bill Fischofer

Date: 2014-11-19 20:15
To: Ciprian Barbu
CC: lng-odp
Subject: Re: [lng-odp] [PATCH 1/2] test/example changes for v1.0 buffer pool APIs
Anders: Please be specific about what isn't building.  These build and run against the current tip for me.

Thanks.

Bill

On Wed, Nov 19, 2014 at 5:16 AM, Ciprian Barbu <ciprian.barbu@linaro.org> wrote:
On Wed, Nov 19, 2014 at 3:21 AM, Bill Fischofer
<bill.fischofer@linaro.org> wrote:
> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>

> ---

>  example/generator/odp_generator.c | 19 +++++--------

>  example/ipsec/odp_ipsec.c         | 56 ++++++++++++---------------------------

>  example/l2fwd/odp_l2fwd.c         | 19 +++++--------

>  example/odp_example/odp_example.c | 18 +++++--------

>  example/packet/odp_pktio.c        | 19 +++++--------

>  example/timer/odp_timer_test.c    | 13 ++++-----

>  test/api_test/odp_timer_ping.c    | 19 +++++++------

>  7 files changed, 57 insertions(+), 106 deletions(-)

>

> diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c

> index ffa5e62..480ddd5 100644

> --- a/example/generator/odp_generator.c

> +++ b/example/generator/odp_generator.c

> @@ -512,11 +512,11 @@ int main(int argc, char *argv[])

>         odph_linux_pthread_t thread_tbl[MAX_WORKERS];

>         odp_buffer_pool_t pool;

>         int num_workers;

> -       void *pool_base;

>         int i;

>         int first_core;

>         int core_count;

>         odp_shm_t shm;

> +       odp_buffer_pool_param_t params;

>

>         /* Init ODP before calling anything else */

>         if (odp_init_global(NULL, NULL)) {

> @@ -579,20 +579,13 @@ int main(int argc, char *argv[])

>         printf("First core:         %i\n\n", first_core);

>

>         /* Create packet pool */

> -       shm = odp_shm_reserve("shm_packet_pool",

> -                             SHM_PKT_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);

> -       pool_base = odp_shm_addr(shm);

> +       params.buf_size  = SHM_PKT_POOL_BUF_SIZE;

> +       params.buf_align = 0;

> +       params.num_bufs  = SHM_PKT_POOL_SIZE/SHM_PKT_POOL_BUF_SIZE;


I think we should do the right thing and drop the SHM_PKT_POOL_SIZE
nonsense. It's confusing to see SHM_PKT_POOL_SIZE = (512 * 20148) and
SHM_PKT_POOL_BUF_SIZE = 1856 and then do the math above. Just drop
SHM_PKT_POOL_SIZE and replace it with a SHM_PKT_POOL_BUF_COUNT, 512 in
this case. Also for all the other apps.

> +       params.buf_type  = ODP_BUFFER_TYPE_PACKET;

>

> -       if (pool_base == NULL) {

> -               ODP_ERR("Error: packet pool mem alloc failed.\n");

> -               exit(EXIT_FAILURE);

> -       }

> +       pool = odp_buffer_pool_create("packet_pool", ODP_SHM_NULL, &params);

>

> -       pool = odp_buffer_pool_create("packet_pool", pool_base,

> -                                     SHM_PKT_POOL_SIZE,

> -                                     SHM_PKT_POOL_BUF_SIZE,

> -                                     ODP_CACHE_LINE_SIZE,

> -                                     ODP_BUFFER_TYPE_PACKET);

>         if (pool == ODP_BUFFER_POOL_INVALID) {

>                 ODP_ERR("Error: packet pool create failed.\n");

>                 exit(EXIT_FAILURE);

> diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c

> index 37ad34d..0d015bb 100644

> --- a/example/ipsec/odp_ipsec.c

> +++ b/example/ipsec/odp_ipsec.c

> @@ -365,8 +365,7 @@ static

>  void ipsec_init_pre(void)

>  {

>         odp_queue_param_t qparam;

> -       void *pool_base;

> -       odp_shm_t shm;

> +       odp_buffer_pool_param_t params;

>

>         /*

>          * Create queues

> @@ -399,16 +398,12 @@ void ipsec_init_pre(void)

>         }

>

>         /* Create output buffer pool */

> -       shm = odp_shm_reserve("shm_out_pool",

> -                             SHM_OUT_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);

> -

> -       pool_base = odp_shm_addr(shm);

> +       params.buf_size  = SHM_OUT_POOL_BUF_SIZE;

> +       params.buf_align = 0;

> +       params.num_bufs  = SHM_PKT_POOL_BUF_COUNT;

> +       params.buf_type  = ODP_BUFFER_TYPE_PACKET;

>

> -       out_pool = odp_buffer_pool_create("out_pool", pool_base,

> -                                         SHM_OUT_POOL_SIZE,

> -                                         SHM_OUT_POOL_BUF_SIZE,

> -                                         ODP_CACHE_LINE_SIZE,

> -                                         ODP_BUFFER_TYPE_PACKET);

> +       out_pool = odp_buffer_pool_create("out_pool", ODP_SHM_NULL, &params);

>

>         if (ODP_BUFFER_POOL_INVALID == out_pool) {

>                 ODP_ERR("Error: message pool create failed.\n");

> @@ -1168,12 +1163,12 @@ main(int argc, char *argv[])

>  {

>         odph_linux_pthread_t thread_tbl[MAX_WORKERS];

>         int num_workers;

> -       void *pool_base;

>         int i;

>         int first_core;

>         int core_count;

>         int stream_count;

>         odp_shm_t shm;

> +       odp_buffer_pool_param_t params;

>

>         /* Init ODP before calling anything else */

>         if (odp_init_global(NULL, NULL)) {

> @@ -1233,42 +1228,25 @@ main(int argc, char *argv[])

>         printf("First core:         %i\n\n", first_core);

>

>         /* Create packet buffer pool */

> -       shm = odp_shm_reserve("shm_packet_pool",

> -                             SHM_PKT_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);

> -

> -       pool_base = odp_shm_addr(shm);

> +       params.buf_size  = SHM_PKT_POOL_BUF_SIZE;

> +       params.buf_align = 0;

> +       params.num_bufs  = SHM_PKT_POOL_BUF_COUNT;

> +       params.buf_type  = ODP_BUFFER_TYPE_PACKET;

>

> -       if (NULL == pool_base) {

> -               ODP_ERR("Error: packet pool mem alloc failed.\n");

> -               exit(EXIT_FAILURE);

> -       }

> +       pkt_pool = odp_buffer_pool_create("packet_pool", ODP_SHM_NULL,

> +                                         &params);

>

> -       pkt_pool = odp_buffer_pool_create("packet_pool", pool_base,

> -                                         SHM_PKT_POOL_SIZE,

> -                                         SHM_PKT_POOL_BUF_SIZE,

> -                                         ODP_CACHE_LINE_SIZE,

> -                                         ODP_BUFFER_TYPE_PACKET);

>         if (ODP_BUFFER_POOL_INVALID == pkt_pool) {

>                 ODP_ERR("Error: packet pool create failed.\n");

>                 exit(EXIT_FAILURE);

>         }

>

>         /* Create context buffer pool */

> -       shm = odp_shm_reserve("shm_ctx_pool",

> -                             SHM_CTX_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);

> -

> -       pool_base = odp_shm_addr(shm);

> -

> -       if (NULL == pool_base) {

> -               ODP_ERR("Error: context pool mem alloc failed.\n");

> -               exit(EXIT_FAILURE);

> -       }

> +       params.buf_size  = SHM_CTX_POOL_BUF_SIZE;

> +       params.buf_align = 0;

> +       params.num_bufs  = SHM_CTX_POOL_BUF_COUNT;

> +       params.buf_type  = ODP_BUFFER_TYPE_RAW;

>

> -       ctx_pool = odp_buffer_pool_create("ctx_pool", pool_base,

> -                                         SHM_CTX_POOL_SIZE,

> -                                         SHM_CTX_POOL_BUF_SIZE,

> -                                         ODP_CACHE_LINE_SIZE,

> -                                         ODP_BUFFER_TYPE_RAW);

>         if (ODP_BUFFER_POOL_INVALID == ctx_pool) {

>                 ODP_ERR("Error: context pool create failed.\n");

>                 exit(EXIT_FAILURE);

> diff --git a/example/l2fwd/odp_l2fwd.c b/example/l2fwd/odp_l2fwd.c

> index 57037cd..026627d 100644

> --- a/example/l2fwd/odp_l2fwd.c

> +++ b/example/l2fwd/odp_l2fwd.c

> @@ -311,12 +311,12 @@ int main(int argc, char *argv[])

>  {

>         odph_linux_pthread_t thread_tbl[MAX_WORKERS];

>         odp_buffer_pool_t pool;

> -       void *pool_base;

>         int i;

>         int first_core;

>         int core_count;

>         odp_pktio_t pktio;

>         odp_shm_t shm;

> +       odp_buffer_pool_param_t params;

>

>         /* Init ODP before calling anything else */

>         if (odp_init_global(NULL, NULL)) {

> @@ -380,20 +380,13 @@ int main(int argc, char *argv[])

>         printf("First core:         %i\n\n", first_core);

>

>         /* Create packet pool */

> -       shm = odp_shm_reserve("shm_packet_pool",

> -                             SHM_PKT_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);

> -       pool_base = odp_shm_addr(shm);

> +       params.buf_size  = SHM_PKT_POOL_BUF_SIZE;

> +       params.buf_align = 0;

> +       params.num_bufs  = SHM_PKT_POOL_SIZE/SHM_PKT_POOL_BUF_SIZE;

> +       params.buf_type  = ODP_BUFFER_TYPE_PACKET;

>

> -       if (pool_base == NULL) {

> -               ODP_ERR("Error: packet pool mem alloc failed.\n");

> -               exit(EXIT_FAILURE);

> -       }

> +       pool = odp_buffer_pool_create("packet pool", ODP_SHM_NULL, &params);

>

> -       pool = odp_buffer_pool_create("packet_pool", pool_base,

> -                                     SHM_PKT_POOL_SIZE,

> -                                     SHM_PKT_POOL_BUF_SIZE,

> -                                     ODP_CACHE_LINE_SIZE,

> -                                     ODP_BUFFER_TYPE_PACKET);

>         if (pool == ODP_BUFFER_POOL_INVALID) {

>                 ODP_ERR("Error: packet pool create failed.\n");

>                 exit(EXIT_FAILURE);

> diff --git a/example/odp_example/odp_example.c b/example/odp_example/odp_example.c

> index d0ec977..515fe33 100644

> --- a/example/odp_example/odp_example.c

> +++ b/example/odp_example/odp_example.c

> @@ -949,13 +949,13 @@ int main(int argc, char *argv[])

>         test_args_t args;

>         int num_workers;

>         odp_buffer_pool_t pool;

> -       void *pool_base;

>         odp_queue_t queue;

>         int i, j;

>         int prios;

>         int first_core;

>         odp_shm_t shm;

>         test_globals_t *globals;

> +       odp_buffer_pool_param_t params;

>

>         printf("\nODP example starts\n\n");

>

> @@ -1037,19 +1037,13 @@ int main(int argc, char *argv[])

>         /*

>          * Create message pool

>          */

> -       shm = odp_shm_reserve("msg_pool",

> -                             MSG_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);

>

> -       pool_base = odp_shm_addr(shm);

> +       params.buf_size  = sizeof(test_message_t);

> +       params.buf_align = 0;

> +       params.num_bufs  = MSG_POOL_SIZE/sizeof(test_message_t);

> +       params.buf_type  = ODP_BUFFER_TYPE_RAW;

>

> -       if (pool_base == NULL) {

> -               ODP_ERR("Shared memory reserve failed.\n");

> -               return -1;

> -       }

> -

> -       pool = odp_buffer_pool_create("msg_pool", pool_base, MSG_POOL_SIZE,

> -                                     sizeof(test_message_t),

> -                                     ODP_CACHE_LINE_SIZE, ODP_BUFFER_TYPE_RAW);

> +       pool = odp_buffer_pool_create("msg_pool", ODP_SHM_NULL, &params);

>

>         if (pool == ODP_BUFFER_POOL_INVALID) {

>                 ODP_ERR("Pool create failed.\n");

> diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c

> index 2cf3f0d..00e5374 100644

> --- a/example/packet/odp_pktio.c

> +++ b/example/packet/odp_pktio.c

> @@ -292,11 +292,11 @@ int main(int argc, char *argv[])

>         odph_linux_pthread_t thread_tbl[MAX_WORKERS];

>         odp_buffer_pool_t pool;

>         int num_workers;

> -       void *pool_base;

>         int i;

>         int first_core;

>         int core_count;

>         odp_shm_t shm;

> +       odp_buffer_pool_param_t params;

>

>         /* Init ODP before calling anything else */

>         if (odp_init_global(NULL, NULL)) {

> @@ -350,20 +350,13 @@ int main(int argc, char *argv[])

>         printf("First core:         %i\n\n", first_core);

>

>         /* Create packet pool */

> -       shm = odp_shm_reserve("shm_packet_pool",

> -                             SHM_PKT_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);

> -       pool_base = odp_shm_addr(shm);

> +       params.buf_size  = SHM_PKT_POOL_BUF_SIZE;

> +       params.buf_align = 0;

> +       params.num_bufs  = SHM_PKT_POOL_SIZE/SHM_PKT_POOL_BUF_SIZE;

> +       params.buf_type  = ODP_BUFFER_TYPE_PACKET;

>

> -       if (pool_base == NULL) {

> -               ODP_ERR("Error: packet pool mem alloc failed.\n");

> -               exit(EXIT_FAILURE);

> -       }

> +       pool = odp_buffer_pool_create("packet_pool", ODP_SHM_NULL, &params);

>

> -       pool = odp_buffer_pool_create("packet_pool", pool_base,

> -                                     SHM_PKT_POOL_SIZE,

> -                                     SHM_PKT_POOL_BUF_SIZE,

> -                                     ODP_CACHE_LINE_SIZE,

> -                                     ODP_BUFFER_TYPE_PACKET);

>         if (pool == ODP_BUFFER_POOL_INVALID) {

>                 ODP_ERR("Error: packet pool create failed.\n");

>                 exit(EXIT_FAILURE);

> diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c

> index 78b2ae2..12e9c8d 100644

> --- a/example/timer/odp_timer_test.c

> +++ b/example/timer/odp_timer_test.c

> @@ -242,12 +242,12 @@ int main(int argc, char *argv[])

>         test_args_t args;

>         int num_workers;

>         odp_buffer_pool_t pool;

> -       void *pool_base;

>         odp_queue_t queue;

>         int first_core;

>         uint64_t cycles, ns;

>         odp_queue_param_t param;

>         odp_shm_t shm;

> +       odp_buffer_pool_param_t params;

>

>         printf("\nODP timer example starts\n");

>

> @@ -311,12 +311,13 @@ int main(int argc, char *argv[])

>          */

>         shm = odp_shm_reserve("msg_pool",

>                               MSG_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);

> -       pool_base = odp_shm_addr(shm);

>

> -       pool = odp_buffer_pool_create("msg_pool", pool_base, MSG_POOL_SIZE,

> -                                     0,

> -                                     ODP_CACHE_LINE_SIZE,

> -                                     ODP_BUFFER_TYPE_TIMEOUT);

> +       params.buf_size  = 0;

> +       params.buf_align = 0;

> +       params.num_bufs  = MSG_POOL_SIZE;

> +       params.buf_type  = ODP_BUFFER_TYPE_TIMEOUT;

> +

> +       pool = odp_buffer_pool_create("msg_pool", shm, &params);

>

>         if (pool == ODP_BUFFER_POOL_INVALID) {

>                 ODP_ERR("Pool create failed.\n");

> diff --git a/test/api_test/odp_timer_ping.c b/test/api_test/odp_timer_ping.c

> index 7704181..1566f4f 100644

> --- a/test/api_test/odp_timer_ping.c

> +++ b/test/api_test/odp_timer_ping.c

> @@ -319,9 +319,8 @@ int main(int argc ODP_UNUSED, char *argv[] ODP_UNUSED)

>         ping_arg_t pingarg;

>         odp_queue_t queue;

>         odp_buffer_pool_t pool;

> -       void *pool_base;

>         int i;

> -       odp_shm_t shm;

> +       odp_buffer_pool_param_t params;

>

>         if (odp_test_global_init() != 0)

>                 return -1;

> @@ -334,14 +333,14 @@ int main(int argc ODP_UNUSED, char *argv[] ODP_UNUSED)

>         /*

>          * Create message pool

>          */

> -       shm = odp_shm_reserve("msg_pool",

> -                             MSG_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);

> -       pool_base = odp_shm_addr(shm);

> -

> -       pool = odp_buffer_pool_create("msg_pool", pool_base, MSG_POOL_SIZE,

> -                                     BUF_SIZE,

> -                                     ODP_CACHE_LINE_SIZE,

> -                                     ODP_BUFFER_TYPE_RAW);

> +

> +       params.buf_size  = BUF_SIZE;

> +       params.buf_align = 0;

> +       params.num_bufs  = MSG_POOL_SIZE/BUF_SIZE;

> +       params.buf_type  = ODP_BUFFER_TYPE_RAW;

> +

> +       pool = odp_buffer_pool_create("msg_pool", ODP_SHM_NULL, &params);

> +

>         if (pool == ODP_BUFFER_POOL_INVALID) {

>                 LOG_ERR("Pool create failed.\n");

>                 return -1;

> --

> 1.8.3.2

>

>

> _______________________________________________

> lng-odp mailing list

> lng-odp@lists.linaro.org

> http://lists.linaro.org/mailman/listinfo/lng-odp
Bill Fischofer Nov. 19, 2014, 1:59 p.m. UTC | #5
Yes, any code that uses odp_buffer_pool_create() will need updating.  I've
included the deltas for all files in the tip with this patch.  I've not
done anything for patches that are in-flight but not yet merged.

One of the reasons we need to be merging the tests (and other patches) on a
timely basis.

Bill

On Wed, Nov 19, 2014 at 7:28 AM, yan.songming@linaro.org <
yan.songming@linaro.org> wrote:

> Hi Bill,
>
> I have commit the cunit test of queue a few days ago,  it use the buffer
> pool api,  so this file may need to be change.
>
> test/cunit/odp_queue.c
>
>
> ------------------------------
> yan.songming@linaro.org
>
>
> *From:* Bill Fischofer <bill.fischofer@linaro.org>
> *Date:* 2014-11-19 20:15
> *To:* Ciprian Barbu <ciprian.barbu@linaro.org>
> *CC:* lng-odp <lng-odp@lists.linaro.org>
> *Subject:* Re: [lng-odp] [PATCH 1/2] test/example changes for v1.0 buffer
> pool APIs
> Anders: Please be specific about what isn't building.  These build and run
> against the current tip for me.
>
> Thanks.
>
> Bill
>
> On Wed, Nov 19, 2014 at 5:16 AM, Ciprian Barbu <ciprian.barbu@linaro.org>
> wrote:
>
>> On Wed, Nov 19, 2014 at 3:21 AM, Bill Fischofer
>> <bill.fischofer@linaro.org> wrote:
>> > Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
>> > ---
>> >  example/generator/odp_generator.c | 19 +++++--------
>> >  example/ipsec/odp_ipsec.c         | 56
>> ++++++++++++---------------------------
>> >  example/l2fwd/odp_l2fwd.c         | 19 +++++--------
>> >  example/odp_example/odp_example.c | 18 +++++--------
>> >  example/packet/odp_pktio.c        | 19 +++++--------
>> >  example/timer/odp_timer_test.c    | 13 ++++-----
>> >  test/api_test/odp_timer_ping.c    | 19 +++++++------
>> >  7 files changed, 57 insertions(+), 106 deletions(-)
>> >
>> > diff --git a/example/generator/odp_generator.c
>> b/example/generator/odp_generator.c
>> > index ffa5e62..480ddd5 100644
>> > --- a/example/generator/odp_generator.c
>> > +++ b/example/generator/odp_generator.c
>> > @@ -512,11 +512,11 @@ int main(int argc, char *argv[])
>> >         odph_linux_pthread_t thread_tbl[MAX_WORKERS];
>> >         odp_buffer_pool_t pool;
>> >         int num_workers;
>> > -       void *pool_base;
>> >         int i;
>> >         int first_core;
>> >         int core_count;
>> >         odp_shm_t shm;
>> > +       odp_buffer_pool_param_t params;
>> >
>> >         /* Init ODP before calling anything else */
>> >         if (odp_init_global(NULL, NULL)) {
>> > @@ -579,20 +579,13 @@ int main(int argc, char *argv[])
>> >         printf("First core:         %i\n\n", first_core);
>> >
>> >         /* Create packet pool */
>> > -       shm = odp_shm_reserve("shm_packet_pool",
>> > -                             SHM_PKT_POOL_SIZE, ODP_CACHE_LINE_SIZE,
>> 0);
>> > -       pool_base = odp_shm_addr(shm);
>> > +       params.buf_size  = SHM_PKT_POOL_BUF_SIZE;
>> > +       params.buf_align = 0;
>> > +       params.num_bufs  = SHM_PKT_POOL_SIZE/SHM_PKT_POOL_BUF_SIZE;
>>
>> I think we should do the right thing and drop the SHM_PKT_POOL_SIZE
>> nonsense. It's confusing to see SHM_PKT_POOL_SIZE = (512 * 20148) and
>> SHM_PKT_POOL_BUF_SIZE = 1856 and then do the math above. Just drop
>> SHM_PKT_POOL_SIZE and replace it with a SHM_PKT_POOL_BUF_COUNT, 512 in
>> this case. Also for all the other apps.
>>
>> > +       params.buf_type  = ODP_BUFFER_TYPE_PACKET;
>> >
>> > -       if (pool_base == NULL) {
>> > -               ODP_ERR("Error: packet pool mem alloc failed.\n");
>> > -               exit(EXIT_FAILURE);
>> > -       }
>> > +       pool = odp_buffer_pool_create("packet_pool", ODP_SHM_NULL,
>> &params);
>> >
>> > -       pool = odp_buffer_pool_create("packet_pool", pool_base,
>> > -                                     SHM_PKT_POOL_SIZE,
>> > -                                     SHM_PKT_POOL_BUF_SIZE,
>> > -                                     ODP_CACHE_LINE_SIZE,
>> > -                                     ODP_BUFFER_TYPE_PACKET);
>> >         if (pool == ODP_BUFFER_POOL_INVALID) {
>> >                 ODP_ERR("Error: packet pool create failed.\n");
>> >                 exit(EXIT_FAILURE);
>> > diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
>> > index 37ad34d..0d015bb 100644
>> > --- a/example/ipsec/odp_ipsec.c
>> > +++ b/example/ipsec/odp_ipsec.c
>> > @@ -365,8 +365,7 @@ static
>> >  void ipsec_init_pre(void)
>> >  {
>> >         odp_queue_param_t qparam;
>> > -       void *pool_base;
>> > -       odp_shm_t shm;
>> > +       odp_buffer_pool_param_t params;
>> >
>> >         /*
>> >          * Create queues
>> > @@ -399,16 +398,12 @@ void ipsec_init_pre(void)
>> >         }
>> >
>> >         /* Create output buffer pool */
>> > -       shm = odp_shm_reserve("shm_out_pool",
>> > -                             SHM_OUT_POOL_SIZE, ODP_CACHE_LINE_SIZE,
>> 0);
>> > -
>> > -       pool_base = odp_shm_addr(shm);
>> > +       params.buf_size  = SHM_OUT_POOL_BUF_SIZE;
>> > +       params.buf_align = 0;
>> > +       params.num_bufs  = SHM_PKT_POOL_BUF_COUNT;
>> > +       params.buf_type  = ODP_BUFFER_TYPE_PACKET;
>> >
>> > -       out_pool = odp_buffer_pool_create("out_pool", pool_base,
>> > -                                         SHM_OUT_POOL_SIZE,
>> > -                                         SHM_OUT_POOL_BUF_SIZE,
>> > -                                         ODP_CACHE_LINE_SIZE,
>> > -                                         ODP_BUFFER_TYPE_PACKET);
>> > +       out_pool = odp_buffer_pool_create("out_pool", ODP_SHM_NULL,
>> &params);
>> >
>> >         if (ODP_BUFFER_POOL_INVALID == out_pool) {
>> >                 ODP_ERR("Error: message pool create failed.\n");
>> > @@ -1168,12 +1163,12 @@ main(int argc, char *argv[])
>> >  {
>> >         odph_linux_pthread_t thread_tbl[MAX_WORKERS];
>> >         int num_workers;
>> > -       void *pool_base;
>> >         int i;
>> >         int first_core;
>> >         int core_count;
>> >         int stream_count;
>> >         odp_shm_t shm;
>> > +       odp_buffer_pool_param_t params;
>> >
>> >         /* Init ODP before calling anything else */
>> >         if (odp_init_global(NULL, NULL)) {
>> > @@ -1233,42 +1228,25 @@ main(int argc, char *argv[])
>> >         printf("First core:         %i\n\n", first_core);
>> >
>> >         /* Create packet buffer pool */
>> > -       shm = odp_shm_reserve("shm_packet_pool",
>> > -                             SHM_PKT_POOL_SIZE, ODP_CACHE_LINE_SIZE,
>> 0);
>> > -
>> > -       pool_base = odp_shm_addr(shm);
>> > +       params.buf_size  = SHM_PKT_POOL_BUF_SIZE;
>> > +       params.buf_align = 0;
>> > +       params.num_bufs  = SHM_PKT_POOL_BUF_COUNT;
>> > +       params.buf_type  = ODP_BUFFER_TYPE_PACKET;
>> >
>> > -       if (NULL == pool_base) {
>> > -               ODP_ERR("Error: packet pool mem alloc failed.\n");
>> > -               exit(EXIT_FAILURE);
>> > -       }
>> > +       pkt_pool = odp_buffer_pool_create("packet_pool", ODP_SHM_NULL,
>> > +                                         &params);
>> >
>> > -       pkt_pool = odp_buffer_pool_create("packet_pool", pool_base,
>> > -                                         SHM_PKT_POOL_SIZE,
>> > -                                         SHM_PKT_POOL_BUF_SIZE,
>> > -                                         ODP_CACHE_LINE_SIZE,
>> > -                                         ODP_BUFFER_TYPE_PACKET);
>> >         if (ODP_BUFFER_POOL_INVALID == pkt_pool) {
>> >                 ODP_ERR("Error: packet pool create failed.\n");
>> >                 exit(EXIT_FAILURE);
>> >         }
>> >
>> >         /* Create context buffer pool */
>> > -       shm = odp_shm_reserve("shm_ctx_pool",
>> > -                             SHM_CTX_POOL_SIZE, ODP_CACHE_LINE_SIZE,
>> 0);
>> > -
>> > -       pool_base = odp_shm_addr(shm);
>> > -
>> > -       if (NULL == pool_base) {
>> > -               ODP_ERR("Error: context pool mem alloc failed.\n");
>> > -               exit(EXIT_FAILURE);
>> > -       }
>> > +       params.buf_size  = SHM_CTX_POOL_BUF_SIZE;
>> > +       params.buf_align = 0;
>> > +       params.num_bufs  = SHM_CTX_POOL_BUF_COUNT;
>> > +       params.buf_type  = ODP_BUFFER_TYPE_RAW;
>> >
>> > -       ctx_pool = odp_buffer_pool_create("ctx_pool", pool_base,
>> > -                                         SHM_CTX_POOL_SIZE,
>> > -                                         SHM_CTX_POOL_BUF_SIZE,
>> > -                                         ODP_CACHE_LINE_SIZE,
>> > -                                         ODP_BUFFER_TYPE_RAW);
>> >         if (ODP_BUFFER_POOL_INVALID == ctx_pool) {
>> >                 ODP_ERR("Error: context pool create failed.\n");
>> >                 exit(EXIT_FAILURE);
>> > diff --git a/example/l2fwd/odp_l2fwd.c b/example/l2fwd/odp_l2fwd.c
>> > index 57037cd..026627d 100644
>> > --- a/example/l2fwd/odp_l2fwd.c
>> > +++ b/example/l2fwd/odp_l2fwd.c
>> > @@ -311,12 +311,12 @@ int main(int argc, char *argv[])
>> >  {
>> >         odph_linux_pthread_t thread_tbl[MAX_WORKERS];
>> >         odp_buffer_pool_t pool;
>> > -       void *pool_base;
>> >         int i;
>> >         int first_core;
>> >         int core_count;
>> >         odp_pktio_t pktio;
>> >         odp_shm_t shm;
>> > +       odp_buffer_pool_param_t params;
>> >
>> >         /* Init ODP before calling anything else */
>> >         if (odp_init_global(NULL, NULL)) {
>> > @@ -380,20 +380,13 @@ int main(int argc, char *argv[])
>> >         printf("First core:         %i\n\n", first_core);
>> >
>> >         /* Create packet pool */
>> > -       shm = odp_shm_reserve("shm_packet_pool",
>> > -                             SHM_PKT_POOL_SIZE, ODP_CACHE_LINE_SIZE,
>> 0);
>> > -       pool_base = odp_shm_addr(shm);
>> > +       params.buf_size  = SHM_PKT_POOL_BUF_SIZE;
>> > +       params.buf_align = 0;
>> > +       params.num_bufs  = SHM_PKT_POOL_SIZE/SHM_PKT_POOL_BUF_SIZE;
>> > +       params.buf_type  = ODP_BUFFER_TYPE_PACKET;
>> >
>> > -       if (pool_base == NULL) {
>> > -               ODP_ERR("Error: packet pool mem alloc failed.\n");
>> > -               exit(EXIT_FAILURE);
>> > -       }
>> > +       pool = odp_buffer_pool_create("packet pool", ODP_SHM_NULL,
>> &params);
>> >
>> > -       pool = odp_buffer_pool_create("packet_pool", pool_base,
>> > -                                     SHM_PKT_POOL_SIZE,
>> > -                                     SHM_PKT_POOL_BUF_SIZE,
>> > -                                     ODP_CACHE_LINE_SIZE,
>> > -                                     ODP_BUFFER_TYPE_PACKET);
>> >         if (pool == ODP_BUFFER_POOL_INVALID) {
>> >                 ODP_ERR("Error: packet pool create failed.\n");
>> >                 exit(EXIT_FAILURE);
>> > diff --git a/example/odp_example/odp_example.c
>> b/example/odp_example/odp_example.c
>> > index d0ec977..515fe33 100644
>> > --- a/example/odp_example/odp_example.c
>> > +++ b/example/odp_example/odp_example.c
>> > @@ -949,13 +949,13 @@ int main(int argc, char *argv[])
>> >         test_args_t args;
>> >         int num_workers;
>> >         odp_buffer_pool_t pool;
>> > -       void *pool_base;
>> >         odp_queue_t queue;
>> >         int i, j;
>> >         int prios;
>> >         int first_core;
>> >         odp_shm_t shm;
>> >         test_globals_t *globals;
>> > +       odp_buffer_pool_param_t params;
>> >
>> >         printf("\nODP example starts\n\n");
>> >
>> > @@ -1037,19 +1037,13 @@ int main(int argc, char *argv[])
>> >         /*
>> >          * Create message pool
>> >          */
>> > -       shm = odp_shm_reserve("msg_pool",
>> > -                             MSG_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);
>> >
>> > -       pool_base = odp_shm_addr(shm);
>> > +       params.buf_size  = sizeof(test_message_t);
>> > +       params.buf_align = 0;
>> > +       params.num_bufs  = MSG_POOL_SIZE/sizeof(test_message_t);
>> > +       params.buf_type  = ODP_BUFFER_TYPE_RAW;
>> >
>> > -       if (pool_base == NULL) {
>> > -               ODP_ERR("Shared memory reserve failed.\n");
>> > -               return -1;
>> > -       }
>> > -
>> > -       pool = odp_buffer_pool_create("msg_pool", pool_base,
>> MSG_POOL_SIZE,
>> > -                                     sizeof(test_message_t),
>> > -                                     ODP_CACHE_LINE_SIZE,
>> ODP_BUFFER_TYPE_RAW);
>> > +       pool = odp_buffer_pool_create("msg_pool", ODP_SHM_NULL,
>> &params);
>> >
>> >         if (pool == ODP_BUFFER_POOL_INVALID) {
>> >                 ODP_ERR("Pool create failed.\n");
>> > diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
>> > index 2cf3f0d..00e5374 100644
>> > --- a/example/packet/odp_pktio.c
>> > +++ b/example/packet/odp_pktio.c
>> > @@ -292,11 +292,11 @@ int main(int argc, char *argv[])
>> >         odph_linux_pthread_t thread_tbl[MAX_WORKERS];
>> >         odp_buffer_pool_t pool;
>> >         int num_workers;
>> > -       void *pool_base;
>> >         int i;
>> >         int first_core;
>> >         int core_count;
>> >         odp_shm_t shm;
>> > +       odp_buffer_pool_param_t params;
>> >
>> >         /* Init ODP before calling anything else */
>> >         if (odp_init_global(NULL, NULL)) {
>> > @@ -350,20 +350,13 @@ int main(int argc, char *argv[])
>> >         printf("First core:         %i\n\n", first_core);
>> >
>> >         /* Create packet pool */
>> > -       shm = odp_shm_reserve("shm_packet_pool",
>> > -                             SHM_PKT_POOL_SIZE, ODP_CACHE_LINE_SIZE,
>> 0);
>> > -       pool_base = odp_shm_addr(shm);
>> > +       params.buf_size  = SHM_PKT_POOL_BUF_SIZE;
>> > +       params.buf_align = 0;
>> > +       params.num_bufs  = SHM_PKT_POOL_SIZE/SHM_PKT_POOL_BUF_SIZE;
>> > +       params.buf_type  = ODP_BUFFER_TYPE_PACKET;
>> >
>> > -       if (pool_base == NULL) {
>> > -               ODP_ERR("Error: packet pool mem alloc failed.\n");
>> > -               exit(EXIT_FAILURE);
>> > -       }
>> > +       pool = odp_buffer_pool_create("packet_pool", ODP_SHM_NULL,
>> &params);
>> >
>> > -       pool = odp_buffer_pool_create("packet_pool", pool_base,
>> > -                                     SHM_PKT_POOL_SIZE,
>> > -                                     SHM_PKT_POOL_BUF_SIZE,
>> > -                                     ODP_CACHE_LINE_SIZE,
>> > -                                     ODP_BUFFER_TYPE_PACKET);
>> >         if (pool == ODP_BUFFER_POOL_INVALID) {
>> >                 ODP_ERR("Error: packet pool create failed.\n");
>> >                 exit(EXIT_FAILURE);
>> > diff --git a/example/timer/odp_timer_test.c
>> b/example/timer/odp_timer_test.c
>> > index 78b2ae2..12e9c8d 100644
>> > --- a/example/timer/odp_timer_test.c
>> > +++ b/example/timer/odp_timer_test.c
>> > @@ -242,12 +242,12 @@ int main(int argc, char *argv[])
>> >         test_args_t args;
>> >         int num_workers;
>> >         odp_buffer_pool_t pool;
>> > -       void *pool_base;
>> >         odp_queue_t queue;
>> >         int first_core;
>> >         uint64_t cycles, ns;
>> >         odp_queue_param_t param;
>> >         odp_shm_t shm;
>> > +       odp_buffer_pool_param_t params;
>> >
>> >         printf("\nODP timer example starts\n");
>> >
>> > @@ -311,12 +311,13 @@ int main(int argc, char *argv[])
>> >          */
>> >         shm = odp_shm_reserve("msg_pool",
>> >                               MSG_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);
>> > -       pool_base = odp_shm_addr(shm);
>> >
>> > -       pool = odp_buffer_pool_create("msg_pool", pool_base,
>> MSG_POOL_SIZE,
>> > -                                     0,
>> > -                                     ODP_CACHE_LINE_SIZE,
>> > -                                     ODP_BUFFER_TYPE_TIMEOUT);
>> > +       params.buf_size  = 0;
>> > +       params.buf_align = 0;
>> > +       params.num_bufs  = MSG_POOL_SIZE;
>> > +       params.buf_type  = ODP_BUFFER_TYPE_TIMEOUT;
>> > +
>> > +       pool = odp_buffer_pool_create("msg_pool", shm, &params);
>> >
>> >         if (pool == ODP_BUFFER_POOL_INVALID) {
>> >                 ODP_ERR("Pool create failed.\n");
>> > diff --git a/test/api_test/odp_timer_ping.c
>> b/test/api_test/odp_timer_ping.c
>> > index 7704181..1566f4f 100644
>> > --- a/test/api_test/odp_timer_ping.c
>> > +++ b/test/api_test/odp_timer_ping.c
>> > @@ -319,9 +319,8 @@ int main(int argc ODP_UNUSED, char *argv[]
>> ODP_UNUSED)
>> >         ping_arg_t pingarg;
>> >         odp_queue_t queue;
>> >         odp_buffer_pool_t pool;
>> > -       void *pool_base;
>> >         int i;
>> > -       odp_shm_t shm;
>> > +       odp_buffer_pool_param_t params;
>> >
>> >         if (odp_test_global_init() != 0)
>> >                 return -1;
>> > @@ -334,14 +333,14 @@ int main(int argc ODP_UNUSED, char *argv[]
>> ODP_UNUSED)
>> >         /*
>> >          * Create message pool
>> >          */
>> > -       shm = odp_shm_reserve("msg_pool",
>> > -                             MSG_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);
>> > -       pool_base = odp_shm_addr(shm);
>> > -
>> > -       pool = odp_buffer_pool_create("msg_pool", pool_base,
>> MSG_POOL_SIZE,
>> > -                                     BUF_SIZE,
>> > -                                     ODP_CACHE_LINE_SIZE,
>> > -                                     ODP_BUFFER_TYPE_RAW);
>> > +
>> > +       params.buf_size  = BUF_SIZE;
>> > +       params.buf_align = 0;
>> > +       params.num_bufs  = MSG_POOL_SIZE/BUF_SIZE;
>> > +       params.buf_type  = ODP_BUFFER_TYPE_RAW;
>> > +
>> > +       pool = odp_buffer_pool_create("msg_pool", ODP_SHM_NULL,
>> &params);
>> > +
>> >         if (pool == ODP_BUFFER_POOL_INVALID) {
>> >                 LOG_ERR("Pool create failed.\n");
>> >                 return -1;
>> > --
>> > 1.8.3.2
>> >
>> >
>> > _______________________________________________
>> > 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 ffa5e62..480ddd5 100644
--- a/example/generator/odp_generator.c
+++ b/example/generator/odp_generator.c
@@ -512,11 +512,11 @@  int main(int argc, char *argv[])
 	odph_linux_pthread_t thread_tbl[MAX_WORKERS];
 	odp_buffer_pool_t pool;
 	int num_workers;
-	void *pool_base;
 	int i;
 	int first_core;
 	int core_count;
 	odp_shm_t shm;
+	odp_buffer_pool_param_t params;
 
 	/* Init ODP before calling anything else */
 	if (odp_init_global(NULL, NULL)) {
@@ -579,20 +579,13 @@  int main(int argc, char *argv[])
 	printf("First core:         %i\n\n", first_core);
 
 	/* Create packet pool */
-	shm = odp_shm_reserve("shm_packet_pool",
-			      SHM_PKT_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);
-	pool_base = odp_shm_addr(shm);
+	params.buf_size  = SHM_PKT_POOL_BUF_SIZE;
+	params.buf_align = 0;
+	params.num_bufs  = SHM_PKT_POOL_SIZE/SHM_PKT_POOL_BUF_SIZE;
+	params.buf_type  = ODP_BUFFER_TYPE_PACKET;
 
-	if (pool_base == NULL) {
-		ODP_ERR("Error: packet pool mem alloc failed.\n");
-		exit(EXIT_FAILURE);
-	}
+	pool = odp_buffer_pool_create("packet_pool", ODP_SHM_NULL, &params);
 
-	pool = odp_buffer_pool_create("packet_pool", pool_base,
-				      SHM_PKT_POOL_SIZE,
-				      SHM_PKT_POOL_BUF_SIZE,
-				      ODP_CACHE_LINE_SIZE,
-				      ODP_BUFFER_TYPE_PACKET);
 	if (pool == ODP_BUFFER_POOL_INVALID) {
 		ODP_ERR("Error: packet pool create failed.\n");
 		exit(EXIT_FAILURE);
diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
index 37ad34d..0d015bb 100644
--- a/example/ipsec/odp_ipsec.c
+++ b/example/ipsec/odp_ipsec.c
@@ -365,8 +365,7 @@  static
 void ipsec_init_pre(void)
 {
 	odp_queue_param_t qparam;
-	void *pool_base;
-	odp_shm_t shm;
+	odp_buffer_pool_param_t params;
 
 	/*
 	 * Create queues
@@ -399,16 +398,12 @@  void ipsec_init_pre(void)
 	}
 
 	/* Create output buffer pool */
-	shm = odp_shm_reserve("shm_out_pool",
-			      SHM_OUT_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);
-
-	pool_base = odp_shm_addr(shm);
+	params.buf_size  = SHM_OUT_POOL_BUF_SIZE;
+	params.buf_align = 0;
+	params.num_bufs  = SHM_PKT_POOL_BUF_COUNT;
+	params.buf_type  = ODP_BUFFER_TYPE_PACKET;
 
-	out_pool = odp_buffer_pool_create("out_pool", pool_base,
-					  SHM_OUT_POOL_SIZE,
-					  SHM_OUT_POOL_BUF_SIZE,
-					  ODP_CACHE_LINE_SIZE,
-					  ODP_BUFFER_TYPE_PACKET);
+	out_pool = odp_buffer_pool_create("out_pool", ODP_SHM_NULL, &params);
 
 	if (ODP_BUFFER_POOL_INVALID == out_pool) {
 		ODP_ERR("Error: message pool create failed.\n");
@@ -1168,12 +1163,12 @@  main(int argc, char *argv[])
 {
 	odph_linux_pthread_t thread_tbl[MAX_WORKERS];
 	int num_workers;
-	void *pool_base;
 	int i;
 	int first_core;
 	int core_count;
 	int stream_count;
 	odp_shm_t shm;
+	odp_buffer_pool_param_t params;
 
 	/* Init ODP before calling anything else */
 	if (odp_init_global(NULL, NULL)) {
@@ -1233,42 +1228,25 @@  main(int argc, char *argv[])
 	printf("First core:         %i\n\n", first_core);
 
 	/* Create packet buffer pool */
-	shm = odp_shm_reserve("shm_packet_pool",
-			      SHM_PKT_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);
-
-	pool_base = odp_shm_addr(shm);
+	params.buf_size  = SHM_PKT_POOL_BUF_SIZE;
+	params.buf_align = 0;
+	params.num_bufs  = SHM_PKT_POOL_BUF_COUNT;
+	params.buf_type  = ODP_BUFFER_TYPE_PACKET;
 
-	if (NULL == pool_base) {
-		ODP_ERR("Error: packet pool mem alloc failed.\n");
-		exit(EXIT_FAILURE);
-	}
+	pkt_pool = odp_buffer_pool_create("packet_pool", ODP_SHM_NULL,
+					  &params);
 
-	pkt_pool = odp_buffer_pool_create("packet_pool", pool_base,
-					  SHM_PKT_POOL_SIZE,
-					  SHM_PKT_POOL_BUF_SIZE,
-					  ODP_CACHE_LINE_SIZE,
-					  ODP_BUFFER_TYPE_PACKET);
 	if (ODP_BUFFER_POOL_INVALID == pkt_pool) {
 		ODP_ERR("Error: packet pool create failed.\n");
 		exit(EXIT_FAILURE);
 	}
 
 	/* Create context buffer pool */
-	shm = odp_shm_reserve("shm_ctx_pool",
-			      SHM_CTX_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);
-
-	pool_base = odp_shm_addr(shm);
-
-	if (NULL == pool_base) {
-		ODP_ERR("Error: context pool mem alloc failed.\n");
-		exit(EXIT_FAILURE);
-	}
+	params.buf_size  = SHM_CTX_POOL_BUF_SIZE;
+	params.buf_align = 0;
+	params.num_bufs  = SHM_CTX_POOL_BUF_COUNT;
+	params.buf_type  = ODP_BUFFER_TYPE_RAW;
 
-	ctx_pool = odp_buffer_pool_create("ctx_pool", pool_base,
-					  SHM_CTX_POOL_SIZE,
-					  SHM_CTX_POOL_BUF_SIZE,
-					  ODP_CACHE_LINE_SIZE,
-					  ODP_BUFFER_TYPE_RAW);
 	if (ODP_BUFFER_POOL_INVALID == ctx_pool) {
 		ODP_ERR("Error: context pool create failed.\n");
 		exit(EXIT_FAILURE);
diff --git a/example/l2fwd/odp_l2fwd.c b/example/l2fwd/odp_l2fwd.c
index 57037cd..026627d 100644
--- a/example/l2fwd/odp_l2fwd.c
+++ b/example/l2fwd/odp_l2fwd.c
@@ -311,12 +311,12 @@  int main(int argc, char *argv[])
 {
 	odph_linux_pthread_t thread_tbl[MAX_WORKERS];
 	odp_buffer_pool_t pool;
-	void *pool_base;
 	int i;
 	int first_core;
 	int core_count;
 	odp_pktio_t pktio;
 	odp_shm_t shm;
+	odp_buffer_pool_param_t params;
 
 	/* Init ODP before calling anything else */
 	if (odp_init_global(NULL, NULL)) {
@@ -380,20 +380,13 @@  int main(int argc, char *argv[])
 	printf("First core:         %i\n\n", first_core);
 
 	/* Create packet pool */
-	shm = odp_shm_reserve("shm_packet_pool",
-			      SHM_PKT_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);
-	pool_base = odp_shm_addr(shm);
+	params.buf_size  = SHM_PKT_POOL_BUF_SIZE;
+	params.buf_align = 0;
+	params.num_bufs  = SHM_PKT_POOL_SIZE/SHM_PKT_POOL_BUF_SIZE;
+	params.buf_type  = ODP_BUFFER_TYPE_PACKET;
 
-	if (pool_base == NULL) {
-		ODP_ERR("Error: packet pool mem alloc failed.\n");
-		exit(EXIT_FAILURE);
-	}
+	pool = odp_buffer_pool_create("packet pool", ODP_SHM_NULL, &params);
 
-	pool = odp_buffer_pool_create("packet_pool", pool_base,
-				      SHM_PKT_POOL_SIZE,
-				      SHM_PKT_POOL_BUF_SIZE,
-				      ODP_CACHE_LINE_SIZE,
-				      ODP_BUFFER_TYPE_PACKET);
 	if (pool == ODP_BUFFER_POOL_INVALID) {
 		ODP_ERR("Error: packet pool create failed.\n");
 		exit(EXIT_FAILURE);
diff --git a/example/odp_example/odp_example.c b/example/odp_example/odp_example.c
index d0ec977..515fe33 100644
--- a/example/odp_example/odp_example.c
+++ b/example/odp_example/odp_example.c
@@ -949,13 +949,13 @@  int main(int argc, char *argv[])
 	test_args_t args;
 	int num_workers;
 	odp_buffer_pool_t pool;
-	void *pool_base;
 	odp_queue_t queue;
 	int i, j;
 	int prios;
 	int first_core;
 	odp_shm_t shm;
 	test_globals_t *globals;
+	odp_buffer_pool_param_t params;
 
 	printf("\nODP example starts\n\n");
 
@@ -1037,19 +1037,13 @@  int main(int argc, char *argv[])
 	/*
 	 * Create message pool
 	 */
-	shm = odp_shm_reserve("msg_pool",
-			      MSG_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);
 
-	pool_base = odp_shm_addr(shm);
+	params.buf_size  = sizeof(test_message_t);
+	params.buf_align = 0;
+	params.num_bufs  = MSG_POOL_SIZE/sizeof(test_message_t);
+	params.buf_type  = ODP_BUFFER_TYPE_RAW;
 
-	if (pool_base == NULL) {
-		ODP_ERR("Shared memory reserve failed.\n");
-		return -1;
-	}
-
-	pool = odp_buffer_pool_create("msg_pool", pool_base, MSG_POOL_SIZE,
-				      sizeof(test_message_t),
-				      ODP_CACHE_LINE_SIZE, ODP_BUFFER_TYPE_RAW);
+	pool = odp_buffer_pool_create("msg_pool", ODP_SHM_NULL, &params);
 
 	if (pool == ODP_BUFFER_POOL_INVALID) {
 		ODP_ERR("Pool create failed.\n");
diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
index 2cf3f0d..00e5374 100644
--- a/example/packet/odp_pktio.c
+++ b/example/packet/odp_pktio.c
@@ -292,11 +292,11 @@  int main(int argc, char *argv[])
 	odph_linux_pthread_t thread_tbl[MAX_WORKERS];
 	odp_buffer_pool_t pool;
 	int num_workers;
-	void *pool_base;
 	int i;
 	int first_core;
 	int core_count;
 	odp_shm_t shm;
+	odp_buffer_pool_param_t params;
 
 	/* Init ODP before calling anything else */
 	if (odp_init_global(NULL, NULL)) {
@@ -350,20 +350,13 @@  int main(int argc, char *argv[])
 	printf("First core:         %i\n\n", first_core);
 
 	/* Create packet pool */
-	shm = odp_shm_reserve("shm_packet_pool",
-			      SHM_PKT_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);
-	pool_base = odp_shm_addr(shm);
+	params.buf_size  = SHM_PKT_POOL_BUF_SIZE;
+	params.buf_align = 0;
+	params.num_bufs  = SHM_PKT_POOL_SIZE/SHM_PKT_POOL_BUF_SIZE;
+	params.buf_type  = ODP_BUFFER_TYPE_PACKET;
 
-	if (pool_base == NULL) {
-		ODP_ERR("Error: packet pool mem alloc failed.\n");
-		exit(EXIT_FAILURE);
-	}
+	pool = odp_buffer_pool_create("packet_pool", ODP_SHM_NULL, &params);
 
-	pool = odp_buffer_pool_create("packet_pool", pool_base,
-				      SHM_PKT_POOL_SIZE,
-				      SHM_PKT_POOL_BUF_SIZE,
-				      ODP_CACHE_LINE_SIZE,
-				      ODP_BUFFER_TYPE_PACKET);
 	if (pool == ODP_BUFFER_POOL_INVALID) {
 		ODP_ERR("Error: packet pool create failed.\n");
 		exit(EXIT_FAILURE);
diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c
index 78b2ae2..12e9c8d 100644
--- a/example/timer/odp_timer_test.c
+++ b/example/timer/odp_timer_test.c
@@ -242,12 +242,12 @@  int main(int argc, char *argv[])
 	test_args_t args;
 	int num_workers;
 	odp_buffer_pool_t pool;
-	void *pool_base;
 	odp_queue_t queue;
 	int first_core;
 	uint64_t cycles, ns;
 	odp_queue_param_t param;
 	odp_shm_t shm;
+	odp_buffer_pool_param_t params;
 
 	printf("\nODP timer example starts\n");
 
@@ -311,12 +311,13 @@  int main(int argc, char *argv[])
 	 */
 	shm = odp_shm_reserve("msg_pool",
 			      MSG_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);
-	pool_base = odp_shm_addr(shm);
 
-	pool = odp_buffer_pool_create("msg_pool", pool_base, MSG_POOL_SIZE,
-				      0,
-				      ODP_CACHE_LINE_SIZE,
-				      ODP_BUFFER_TYPE_TIMEOUT);
+	params.buf_size  = 0;
+	params.buf_align = 0;
+	params.num_bufs  = MSG_POOL_SIZE;
+	params.buf_type  = ODP_BUFFER_TYPE_TIMEOUT;
+
+	pool = odp_buffer_pool_create("msg_pool", shm, &params);
 
 	if (pool == ODP_BUFFER_POOL_INVALID) {
 		ODP_ERR("Pool create failed.\n");
diff --git a/test/api_test/odp_timer_ping.c b/test/api_test/odp_timer_ping.c
index 7704181..1566f4f 100644
--- a/test/api_test/odp_timer_ping.c
+++ b/test/api_test/odp_timer_ping.c
@@ -319,9 +319,8 @@  int main(int argc ODP_UNUSED, char *argv[] ODP_UNUSED)
 	ping_arg_t pingarg;
 	odp_queue_t queue;
 	odp_buffer_pool_t pool;
-	void *pool_base;
 	int i;
-	odp_shm_t shm;
+	odp_buffer_pool_param_t params;
 
 	if (odp_test_global_init() != 0)
 		return -1;
@@ -334,14 +333,14 @@  int main(int argc ODP_UNUSED, char *argv[] ODP_UNUSED)
 	/*
 	 * Create message pool
 	 */
-	shm = odp_shm_reserve("msg_pool",
-			      MSG_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);
-	pool_base = odp_shm_addr(shm);
-
-	pool = odp_buffer_pool_create("msg_pool", pool_base, MSG_POOL_SIZE,
-				      BUF_SIZE,
-				      ODP_CACHE_LINE_SIZE,
-				      ODP_BUFFER_TYPE_RAW);
+
+	params.buf_size  = BUF_SIZE;
+	params.buf_align = 0;
+	params.num_bufs  = MSG_POOL_SIZE/BUF_SIZE;
+	params.buf_type  = ODP_BUFFER_TYPE_RAW;
+
+	pool = odp_buffer_pool_create("msg_pool", ODP_SHM_NULL, &params);
+
 	if (pool == ODP_BUFFER_POOL_INVALID) {
 		LOG_ERR("Pool create failed.\n");
 		return -1;