Re: [lng-odp] [PATCH API-NEXT v4] api: pool subparameters

2017-11-06 Thread Github ODP bot
Petri Savolainen(psavol) replied on github web page:

include/odp/api/spec/pool.h
line 212
@@ -163,79 +172,133 @@ typedef struct odp_pool_capability_t {
 int odp_pool_capability(odp_pool_capability_t *capa);
 
 /**
+ * Packet pool subparameters
+ */
+typedef struct odp_pool_pkt_subparam_t {
+   /** Number of 'len' byte packets. */
+   uint32_t num;
+
+   /** Packet length in bytes */
+   uint32_t len;
+
+} odp_pool_pkt_subparam_t;
+
+/**
  * Pool parameters
- * Used to communicate pool creation options.
- * @note A single thread may not be able to allocate all 'num' elements
- * from the pool at any particular time, as other threads or hardware
- * blocks are allowed to keep some for caching purposes.
+ *
+ * A note for all pool types: a single thread may not be able to allocate all
+ * 'num' elements from the pool at any particular time, as implementations are
+ * allowed to store some elements (per thread and HW engine) for caching
+ * purposes.
  */
 typedef struct odp_pool_param_t {
/** Pool type */
int type;
 
-   /** Variant parameters for different pool types */
-   union {
-   /** Parameters for buffer pools */
-   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;
-
-   /** Parameters for packet pools */
-   struct {
-   /** The number of packets that the pool must provide
-   that are packet length 'len' bytes or smaller.
-   The maximum value is defined by pool capability
-   pkt.max_num. */
-   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'.
-   The maximum value is defined by pool capability
-   pkt.max_len. Use 0 for default. */
-   uint32_t len;
-
-   /** Maximum packet length that will be allocated from
-   the pool. The maximum value is defined by pool
-   capability pkt.max_len. Use 0 for default (the
-   pool maximum). */
-   uint32_t max_len;
-
-   /** Minimum number of packet data bytes that are stored
-   in the first segment of a packet. The maximum value
-   is defined by pool capability pkt.max_seg_len.
-   Use 0 for default. */
-   uint32_t seg_len;
-
-   /** User area size in bytes. The maximum value is
-   defined by pool capability pkt.max_uarea_size.
-   Specify as 0 if no user area is needed. */
-   uint32_t uarea_size;
-
-   /** Minimum Headroom size in bytes. Each newly allocated
-   packet from the pool must have at least this much
-   headroom. The maximum value is defined by pool
-   capability pkt.max_headroom.
-   Use zero if headroom is not needed. */
-   uint32_t headroom;
-   } pkt;
-
-   /** Parameters for timeout pools */
-   struct {
-   /** Number of timeouts in the pool */
-   uint32_t num;
-   } tmo;
-   };
+   /** Parameters for buffer pools */
+   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;
+
+   /** Parameters for packet pools */
+   struct {
+   /** Minimum number of 'len' byte packets.
+*
+*  The pool must contain at least this many packets that are
+*  'len' bytes or smaller. An 

Re: [lng-odp] [PATCH API-NEXT v4] api: pool subparameters

2017-11-06 Thread Github ODP bot
Petri Savolainen(psavol) replied on github web page:

include/odp/api/spec/pool.h
line 48
@@ -163,79 +172,133 @@ typedef struct odp_pool_capability_t {
 int odp_pool_capability(odp_pool_capability_t *capa);
 
 /**
+ * Packet pool subparameters
+ */
+typedef struct odp_pool_pkt_subparam_t {
+   /** Number of 'len' byte packets. */
+   uint32_t num;
+
+   /** Packet length in bytes */
+   uint32_t len;
+
+} odp_pool_pkt_subparam_t;
+
+/**
  * Pool parameters
- * Used to communicate pool creation options.
- * @note A single thread may not be able to allocate all 'num' elements
- * from the pool at any particular time, as other threads or hardware
- * blocks are allowed to keep some for caching purposes.
+ *
+ * A note for all pool types: a single thread may not be able to allocate all
+ * 'num' elements from the pool at any particular time, as implementations are
+ * allowed to store some elements (per thread and HW engine) for caching
+ * purposes.


Comment:
This text didn't change other than I removed "@note" doxygen tag.

It says that application cannot assume that all free packets are allways 
available to all threads == per thread caching is allowed. 

> NikhilA-Linaro wrote
> This limitation is implementation specific. Why API wants to impose a generic 
> limitation of APIs


>> NikhilA-Linaro wrote
>> 1. Traditionally a  pool means - a fixed size memory chunks. In case of 
>> packet buffer pool,  the buffers units are of single size. If you need 
>> packet buffer pools of different size,  different packet buffers pools shall 
>> be attached to packet io or other entity.
>> 2. These sub parameters will create ambiguity when application allocates 
>> different packets of different sizes. API needs to define the clear 
>> requirement in that case.
>> 3.  Providing info for SG allocations from application is implementation 
>> specific. I don't think this suits for a common data plane API. 


https://github.com/Linaro/odp/pull/234#discussion_r149019279
updated_at 2017-11-06 08:44:32


Re: [lng-odp] [PATCH API-NEXT v4] api: pool subparameters

2017-11-06 Thread Github ODP bot
Petri Savolainen(psavol) replied on github web page:

include/odp/api/spec/pool.h
line 48
@@ -163,79 +172,133 @@ typedef struct odp_pool_capability_t {
 int odp_pool_capability(odp_pool_capability_t *capa);
 
 /**
+ * Packet pool subparameters
+ */
+typedef struct odp_pool_pkt_subparam_t {
+   /** Number of 'len' byte packets. */
+   uint32_t num;
+
+   /** Packet length in bytes */
+   uint32_t len;
+
+} odp_pool_pkt_subparam_t;
+
+/**
  * Pool parameters
- * Used to communicate pool creation options.
- * @note A single thread may not be able to allocate all 'num' elements
- * from the pool at any particular time, as other threads or hardware
- * blocks are allowed to keep some for caching purposes.
+ *
+ * A note for all pool types: a single thread may not be able to allocate all
+ * 'num' elements from the pool at any particular time, as implementations are
+ * allowed to store some elements (per thread and HW engine) for caching
+ * purposes.


Comment:
This text didn't change other than I removed "@note" doxygen tag.

It says that application cannot assume that all free packets are allways 
available to all threads == per thread caching is allowed. 

> NikhilA-Linaro wrote
> This limitation is implementation specific. Why API wants to impose a generic 
> limitation of APIs


>> NikhilA-Linaro wrote
>> 1. Traditionally a  pool means - a fixed size memory chunks. In case of 
>> packet buffer pool,  the buffers units are of single size. If you need 
>> packet buffer pools of different size,  different packet buffers pools shall 
>> be attached to packet io or other entity.
>> 2. These sub parameters will create ambiguity when application allocates 
>> different packets of different sizes. API needs to define the clear 
>> requirement in that case.
>> 3.  Providing info for SG allocations from application is implementation 
>> specific. I don't think this suits for a common data plane API. 


https://github.com/Linaro/odp/pull/234#discussion_r149019279
updated_at 2017-11-06 08:44:32


Re: [lng-odp] [PATCH API-NEXT v4] api: pool subparameters

2017-11-01 Thread Github ODP bot
NikhilA-Linaro replied on github web page:

include/odp/api/spec/pool.h
line 48
@@ -163,79 +172,133 @@ typedef struct odp_pool_capability_t {
 int odp_pool_capability(odp_pool_capability_t *capa);
 
 /**
+ * Packet pool subparameters
+ */
+typedef struct odp_pool_pkt_subparam_t {
+   /** Number of 'len' byte packets. */
+   uint32_t num;
+
+   /** Packet length in bytes */
+   uint32_t len;
+
+} odp_pool_pkt_subparam_t;
+
+/**
  * Pool parameters
- * Used to communicate pool creation options.
- * @note A single thread may not be able to allocate all 'num' elements
- * from the pool at any particular time, as other threads or hardware
- * blocks are allowed to keep some for caching purposes.
+ *
+ * A note for all pool types: a single thread may not be able to allocate all
+ * 'num' elements from the pool at any particular time, as implementations are
+ * allowed to store some elements (per thread and HW engine) for caching
+ * purposes.


Comment:
This limitation is implementation specific. Why API wants to impose a generic 
limitation of APIs

> NikhilA-Linaro wrote
> 1. Traditionally a  pool means - a fixed size memory chunks. In case of 
> packet buffer pool,  the buffers units are of single size. If you need packet 
> buffer pools of different size,  different packet buffers pools shall be 
> attached to packet io or other entity.
> 2. These sub parameters will create ambiguity when application allocates 
> different packets of different sizes. API needs to define the clear 
> requirement in that case.
> 3.  Providing info for SG allocations from application is implementation 
> specific. I don't think this suits for a common data plane API. 


https://github.com/Linaro/odp/pull/234#discussion_r148219575
updated_at 2017-11-01 09:55:26


Re: [lng-odp] [PATCH API-NEXT v4] api: pool subparameters

2017-11-01 Thread Github ODP bot
NikhilA-Linaro replied on github web page:

include/odp/api/spec/pool.h
line 212
@@ -163,79 +172,133 @@ typedef struct odp_pool_capability_t {
 int odp_pool_capability(odp_pool_capability_t *capa);
 
 /**
+ * Packet pool subparameters
+ */
+typedef struct odp_pool_pkt_subparam_t {
+   /** Number of 'len' byte packets. */
+   uint32_t num;
+
+   /** Packet length in bytes */
+   uint32_t len;
+
+} odp_pool_pkt_subparam_t;
+
+/**
  * Pool parameters
- * Used to communicate pool creation options.
- * @note A single thread may not be able to allocate all 'num' elements
- * from the pool at any particular time, as other threads or hardware
- * blocks are allowed to keep some for caching purposes.
+ *
+ * A note for all pool types: a single thread may not be able to allocate all
+ * 'num' elements from the pool at any particular time, as implementations are
+ * allowed to store some elements (per thread and HW engine) for caching
+ * purposes.
  */
 typedef struct odp_pool_param_t {
/** Pool type */
int type;
 
-   /** Variant parameters for different pool types */
-   union {
-   /** Parameters for buffer pools */
-   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;
-
-   /** Parameters for packet pools */
-   struct {
-   /** The number of packets that the pool must provide
-   that are packet length 'len' bytes or smaller.
-   The maximum value is defined by pool capability
-   pkt.max_num. */
-   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'.
-   The maximum value is defined by pool capability
-   pkt.max_len. Use 0 for default. */
-   uint32_t len;
-
-   /** Maximum packet length that will be allocated from
-   the pool. The maximum value is defined by pool
-   capability pkt.max_len. Use 0 for default (the
-   pool maximum). */
-   uint32_t max_len;
-
-   /** Minimum number of packet data bytes that are stored
-   in the first segment of a packet. The maximum value
-   is defined by pool capability pkt.max_seg_len.
-   Use 0 for default. */
-   uint32_t seg_len;
-
-   /** User area size in bytes. The maximum value is
-   defined by pool capability pkt.max_uarea_size.
-   Specify as 0 if no user area is needed. */
-   uint32_t uarea_size;
-
-   /** Minimum Headroom size in bytes. Each newly allocated
-   packet from the pool must have at least this much
-   headroom. The maximum value is defined by pool
-   capability pkt.max_headroom.
-   Use zero if headroom is not needed. */
-   uint32_t headroom;
-   } pkt;
-
-   /** Parameters for timeout pools */
-   struct {
-   /** Number of timeouts in the pool */
-   uint32_t num;
-   } tmo;
-   };
+   /** Parameters for buffer pools */
+   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;
+
+   /** Parameters for packet pools */
+   struct {
+   /** Minimum number of 'len' byte packets.
+*
+*  The pool must contain at least this many packets that are
+*  'len' bytes or smaller. An implementation