[lng-odp] [API-NEXT PATCH 2/6] api: pool: split odp_pool_params to separate include file

2015-06-25 Thread Bill Fischofer
Signed-off-by: Bill Fischofer 
---
 include/odp/api/pool.h   | 57 --
 include/odp/api/pool_param.h | 95 
 2 files changed, 95 insertions(+), 57 deletions(-)
 create mode 100644 include/odp/api/pool_param.h

diff --git a/include/odp/api/pool.h b/include/odp/api/pool.h
index 0bcfb98..b95f40d 100644
--- a/include/odp/api/pool.h
+++ b/include/odp/api/pool.h
@@ -41,63 +41,6 @@ extern "C" {
 #define ODP_POOL_NAME_LEN  32
 
 /**
- * Pool parameters
- * Used to communicate pool creation options.
- */
-typedef struct odp_pool_param_t {
-   /** Pool type */
-   int type;
-
-   union {
-   struct {
-   /** Number of buffers in the pool */
-   uint32_t num;
-
-   /** Buffer size in bytes. The maximum number of bytes
-   application will store in each buffer. */
-   uint32_t size;
-
-   /** Minimum buffer alignment in bytes. Valid values are
-   powers of two. Use 0 for default alignment.
-   Default will always be a multiple of 8. */
-   uint32_t align;
-   } buf;
-   struct {
-   /** The number of packets that the pool must provide
-   that are packet length 'len' bytes or smaller. */
-   uint32_t num;
-
-   /** Minimum packet length that the pool must provide
-   'num' packets. The number of packets may be less
-   than 'num' when packets are larger than 'len'.
-   Use 0 for default. */
-   uint32_t len;
-
-   /** Minimum number of packet data bytes that are stored
-   in the first segment of a packet. The maximum value
-   is defined by ODP_CONFIG_PACKET_SEG_LEN_MAX.
-   Use 0 for default. */
-   uint32_t seg_len;
-
-   /** User area size in bytes. Specify as 0 if no user
-   area is needed. */
-   uint32_t uarea_size;
-   } pkt;
-   struct {
-   /** Number of timeouts in the pool */
-   uint32_t num;
-   } tmo;
-   };
-} odp_pool_param_t;
-
-/** Packet pool*/
-#define ODP_POOL_PACKET   ODP_EVENT_PACKET
-/** Buffer pool */
-#define ODP_POOL_BUFFER   ODP_EVENT_BUFFER
-/** Timeout pool */
-#define ODP_POOL_TIMEOUT  ODP_EVENT_TIMEOUT
-
-/**
  * Create a pool
  *
  * This routine is used to create a pool. It take two arguments: the optional
diff --git a/include/odp/api/pool_param.h b/include/odp/api/pool_param.h
new file mode 100644
index 000..0d043a4
--- /dev/null
+++ b/include/odp/api/pool_param.h
@@ -0,0 +1,95 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * ODP pool param
+ */
+
+#ifndef ODP_API_POOL_PARAM_H_
+#define ODP_API_POOL_PARAM_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include 
+
+/** @addtogroup odp_buffer
+ *  ODP Pool parameters
+ *  @{
+ */
+
+/**
+ * Pool type
+ */
+
+typedef enum odp_pool_type_e {
+   ODP_POOL_PACKET  = ODP_EVENT_PACKET,
+   ODP_POOL_BUFFER  = ODP_EVENT_BUFFER,
+   ODP_POOL_TIMEOUT = ODP_EVENT_TIMEOUT,
+} odp_pool_type_e;
+
+/**
+ * Pool parameters
+ * Used to communicate pool creation options.
+ */
+typedef struct odp_pool_param_t {
+   /** Pool type */
+   odp_pool_type_e type;
+
+   union {
+   struct {
+   /** Number of buffers in the pool */
+   uint32_t num;
+
+   /** Buffer size in bytes. The maximum number of bytes
+   application will store in each buffer. */
+   uint32_t size;
+
+   /** Minimum buffer alignment in bytes. Valid values are
+   powers of two. Use 0 for default alignment.
+   Default will always be a multiple of 8. */
+   uint32_t align;
+   } buf;
+   struct {
+   /** The number of packets that the pool must provide
+   that are packet length 'len' bytes or smaller. */
+   uint32_t num;
+
+   /** Minimum packet length that the pool must provide
+   'num' packets. The number of packets may be less
+   than 'num' when packets are larger than 'len'.
+   Use 0 for default. */
+   uint32_t len;
+
+   /** Minimum number of packet data bytes that are stored
+   

Re: [lng-odp] [API-NEXT PATCH 2/6] api: pool: split odp_pool_params to separate include file

2015-06-30 Thread Savolainen, Petri (Nokia - FI/Espoo)
I think it's better to maintain the params type in pool.h, next to 
odp_pool_create() which needs it. If motivation to move it comes from  
implementation convenience to extend the type with hidden fields, etc ... I 
think it's better to leave it for implementation to split it.

So, new file not needed.

-Petri



> -Original Message-
> From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of ext
> Bill Fischofer
> Sent: Thursday, June 25, 2015 3:09 PM
> To: lng-odp@lists.linaro.org
> Subject: [lng-odp] [API-NEXT PATCH 2/6] api: pool: split odp_pool_params
> to separate include file
> 
> Signed-off-by: Bill Fischofer 
> ---
>  include/odp/api/pool.h   | 57 --
>  include/odp/api/pool_param.h | 95
> 
>  2 files changed, 95 insertions(+), 57 deletions(-)
>  create mode 100644 include/odp/api/pool_param.h
> 
> diff --git a/include/odp/api/pool.h b/include/odp/api/pool.h
> index 0bcfb98..b95f40d 100644
> --- a/include/odp/api/pool.h
> +++ b/include/odp/api/pool.h
> @@ -41,63 +41,6 @@ extern "C" {
>  #define ODP_POOL_NAME_LEN  32
> 
>  /**
> - * Pool parameters
> - * Used to communicate pool creation options.
> - */
> -typedef struct odp_pool_param_t {
> - /** Pool type */
> - int type;
> -
> - union {
> - struct {
> - /** Number of buffers in the pool */
> - uint32_t num;
> -
> - /** Buffer size in bytes. The maximum number of bytes
> - application will store in each buffer. */
> - uint32_t size;
> -
> - /** Minimum buffer alignment in bytes. Valid values are
> - powers of two. Use 0 for default alignment.
> - Default will always be a multiple of 8. */
> - uint32_t align;
> - } buf;
> - struct {
> - /** The number of packets that the pool must provide
> - that are packet length 'len' bytes or smaller. */
> - uint32_t num;
> -
> - /** Minimum packet length that the pool must provide
> - 'num' packets. The number of packets may be less
> - than 'num' when packets are larger than 'len'.
> - Use 0 for default. */
> - uint32_t len;
> -
> - /** Minimum number of packet data bytes that are stored
> - in the first segment of a packet. The maximum value
> - is defined by ODP_CONFIG_PACKET_SEG_LEN_MAX.
> - Use 0 for default. */
> - uint32_t seg_len;
> -
> - /** User area size in bytes. Specify as 0 if no user
> - area is needed. */
> - uint32_t uarea_size;
> - } pkt;
> - struct {
> - /** Number of timeouts in the pool */
> - uint32_t num;
> - } tmo;
> - };
> -} odp_pool_param_t;
> -
> -/** Packet pool*/
> -#define ODP_POOL_PACKET   ODP_EVENT_PACKET
> -/** Buffer pool */
> -#define ODP_POOL_BUFFER   ODP_EVENT_BUFFER
> -/** Timeout pool */
> -#define ODP_POOL_TIMEOUT  ODP_EVENT_TIMEOUT
> -
> -/**
>   * Create a pool
>   *
>   * This routine is used to create a pool. It take two arguments: the
> optional
> diff --git a/include/odp/api/pool_param.h b/include/odp/api/pool_param.h
> new file mode 100644
> index 000..0d043a4
> --- /dev/null
> +++ b/include/odp/api/pool_param.h
> @@ -0,0 +1,95 @@
> +/* Copyright (c) 2015, Linaro Limited
> + * All rights reserved.
> + *
> + * SPDX-License-Identifier: BSD-3-Clause
> + */
> +
> +/**
> + * @file
> + *
> + * ODP pool param
> + */
> +
> +#ifndef ODP_API_POOL_PARAM_H_
> +#define ODP_API_POOL_PARAM_H_
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#include 
> +
> +/** @addtogroup odp_buffer
> + *  ODP Pool parameters
> + *  @{
> + */
> +
> +/**
> + * Pool type
> + */
> +
> +typedef enum odp_pool_type_e {
> + ODP_POOL_PACKET  = ODP_EVENT_PACKET,
> + ODP_POOL_BUFFER  = ODP_EVENT_BUFFER,
> + ODP_POOL_TIMEOUT = ODP_EVENT_TIMEOUT,
> +} odp_pool_type_e;
> +
> +/**
> + * Pool parameters
> + * Used to communicate pool creation options.
> + */
> +typedef struct odp_pool_param_t {
> + /** Pool type */
> + odp_pool_type_e type;

Re: [lng-odp] [API-NEXT PATCH 2/6] api: pool: split odp_pool_params to separate include file

2015-06-30 Thread Bill Fischofer
It's required to inline the odp_pool_param_init() function.  But if we
don't need to inline that function then it can remain unsplit.

On Tue, Jun 30, 2015 at 6:54 AM, Savolainen, Petri (Nokia - FI/Espoo) <
petri.savolai...@nokia.com> wrote:

> I think it's better to maintain the params type in pool.h, next to
> odp_pool_create() which needs it. If motivation to move it comes from
> implementation convenience to extend the type with hidden fields, etc ... I
> think it's better to leave it for implementation to split it.
>
> So, new file not needed.
>
> -Petri
>
>
>
> > -Original Message-
> > From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of ext
> > Bill Fischofer
> > Sent: Thursday, June 25, 2015 3:09 PM
> > To: lng-odp@lists.linaro.org
> > Subject: [lng-odp] [API-NEXT PATCH 2/6] api: pool: split odp_pool_params
> > to separate include file
> >
> > Signed-off-by: Bill Fischofer 
> > ---
> >  include/odp/api/pool.h   | 57 --
> >  include/odp/api/pool_param.h | 95
> > 
> >  2 files changed, 95 insertions(+), 57 deletions(-)
> >  create mode 100644 include/odp/api/pool_param.h
> >
> > diff --git a/include/odp/api/pool.h b/include/odp/api/pool.h
> > index 0bcfb98..b95f40d 100644
> > --- a/include/odp/api/pool.h
> > +++ b/include/odp/api/pool.h
> > @@ -41,63 +41,6 @@ extern "C" {
> >  #define ODP_POOL_NAME_LEN  32
> >
> >  /**
> > - * Pool parameters
> > - * Used to communicate pool creation options.
> > - */
> > -typedef struct odp_pool_param_t {
> > - /** Pool type */
> > - int type;
> > -
> > - union {
> > - struct {
> > - /** Number of buffers in the pool */
> > - uint32_t num;
> > -
> > - /** Buffer size in bytes. The maximum number of
> bytes
> > - application will store in each buffer. */
> > - uint32_t size;
> > -
> > - /** Minimum buffer alignment in bytes. Valid
> values are
> > - powers of two. Use 0 for default alignment.
> > - Default will always be a multiple of 8. */
> > - uint32_t align;
> > - } buf;
> > - struct {
> > - /** The number of packets that the pool must
> provide
> > - that are packet length 'len' bytes or smaller.
> */
> > - uint32_t num;
> > -
> > - /** Minimum packet length that the pool must
> provide
> > - 'num' packets. The number of packets may be
> less
> > - than 'num' when packets are larger than 'len'.
> > - Use 0 for default. */
> > - uint32_t len;
> > -
> > - /** Minimum number of packet data bytes that are
> stored
> > - in the first segment of a packet. The maximum
> value
> > - is defined by ODP_CONFIG_PACKET_SEG_LEN_MAX.
> > - Use 0 for default. */
> > - uint32_t seg_len;
> > -
> > - /** User area size in bytes. Specify as 0 if no
> user
> > - area is needed. */
> > - uint32_t uarea_size;
> > - } pkt;
> > - struct {
> > - /** Number of timeouts in the pool */
> > - uint32_t num;
> > - } tmo;
> > - };
> > -} odp_pool_param_t;
> > -
> > -/** Packet pool*/
> > -#define ODP_POOL_PACKET   ODP_EVENT_PACKET
> > -/** Buffer pool */
> > -#define ODP_POOL_BUFFER   ODP_EVENT_BUFFER
> > -/** Timeout pool */
> > -#define ODP_POOL_TIMEOUT  ODP_EVENT_TIMEOUT
> > -
> > -/**
> >   * Create a pool
> >   *
> >   * This routine is used to create a pool. It take two arguments: the
> > optional
> > diff --git a/include/odp/api/pool_param.h b/include/odp/api/pool_param.h
> > new file mode 100644
> > index 000..0d043a4
> > --- /dev/null
> > +++ b/include/odp/api/pool_param.h
> > @@ -0,0 +1,95 @@
> > +/* Copyright (c) 2015, Linaro Limited
> > + * All rights reserved.
> > + *
> > + * SPDX-License-Identifier: BSD-3-Clause
&g