diff mbox series

[API-NEXT,v4,8/8] api: pool: remove union from params

Message ID 1509091212-14398-9-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [API-NEXT,v4,1/8] api: pool: relax packet pool param num | expand

Commit Message

Github ODP bot Oct. 27, 2017, 8 a.m. UTC
From: Petri Savolainen <petri.savolainen@linaro.org>


Remove anonymous union from pool parameter structure.
Union makes it impossible to initialize parameters per
pool type (use other values than all zeros). This change
is not visible to applications (union was anonymous).

Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>

---
/** Email created from pull request 234 (psavol:next-pool-param)
 ** https://github.com/Linaro/odp/pull/234
 ** Patch: https://github.com/Linaro/odp/pull/234.patch
 ** Base sha: d61d32590d1772b70b8dcd0d0ec44d29029d7443
 ** Merge commit sha: 436021e0a0bff8bda38fa420ebbc4545c97a7fc8
 **/
 include/odp/api/spec/pool.h | 211 ++++++++++++++++++++++----------------------
 1 file changed, 104 insertions(+), 107 deletions(-)
diff mbox series

Patch

diff --git a/include/odp/api/spec/pool.h b/include/odp/api/spec/pool.h
index 11feb1bc6..05f019f3d 100644
--- a/include/odp/api/spec/pool.h
+++ b/include/odp/api/spec/pool.h
@@ -195,113 +195,110 @@  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 {
-			/** Minimum number of 'len' byte packets.
-			 *
-			 *  The pool must contain at least this many packets
-			 *  that are 'len' bytes or smaller. An implementation
-			 *  may round up the value, as long as the 'max_num'
-			 *  parameter below is not violated. The maximum value
-			 *  for this field is defined by pool capability
-			 *  pkt.max_num.
-			 */
-			uint32_t num;
-
-			/** Maximum number of packets.
-			 *
-			 *  This is the maximum number of packets of any length
-			 *  that can be allocated from the pool. The maximum
-			 *  value is defined by pool capability pkt.max_num.
-			 *  Use 0 when there's no requirement for the maximum
-			 *  number of packets. The default value is 0.
-			 */
-			uint32_t max_num;
-
-			/** Minimum length of 'num' packets.
-			 *
-			 *  The pool must contain at least 'num' packets up to
-			 *  this packet length (1 ... 'len' bytes). The maximum
-			 *  value for this field 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;
-
-			/** Number of subparameters
-			 *
-			 *  The number of subparameter table entries used.
-			 *  The maximum value is defined by pool
-			 *  capability pkt.max_num_subparam. The default value
-			 *  is 0.
-			 */
-			uint8_t num_subparam;
-
-			/** Subparameter table
-			 *
-			 *  Subparameters continue pool configuration with
-			 *  additional packet length requirements. The first
-			 *  table entry follows the num/len specification above.
-			 *  So that, sub[0].len > 'len', and sub[0].num refers
-			 *  to packet lengths between 'len' + 1 and sub[0].len.
-			 *  Similarly, sub[1] follows sub[0] specification, and
-			 *  so on.
-			 *
-			 *  Each requirement is supported separately and may be
-			 *  rounded up, as long as the 'max_num' parameter is
-			 *  not violated. It's implementation specific if some
-			 *  requirements are supported simultaneously (e.g.
-			 *  due to subpool design).
-			 */
-			odp_pool_pkt_subparam_t sub[ODP_POOL_MAX_SUBPARAMS];
-		} 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 may round up the
+		 *  value, as long as the 'max_num' parameter below is not
+		 *  violated. The maximum value for this field is defined by
+		 *  pool capability pkt.max_num.
+		 */
+		uint32_t num;
+
+		/** Maximum number of packets.
+		 *
+		 *  This is the maximum number of packets of any length that can
+		 *  be allocated from the pool. The maximum value is defined by
+		 *  pool capability pkt.max_num. Use 0 when there's no
+		 *  requirement for the maximum number of packets. The default
+		 *  value is 0.
+		 */
+		uint32_t max_num;
+
+		/** Minimum length of 'num' packets.
+		 *
+		 *  The pool must contain at least 'num' packets up to this
+		 *  packet length (1 ... 'len' bytes). The maximum value for
+		 *  this field 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;
+
+		/** Number of subparameters
+		 *
+		 *  The number of subparameter table entries used. The maximum
+		 *  value is defined by pool capability pkt.max_num_subparam.
+		 *  The default value is 0.
+		 */
+		uint8_t num_subparam;
+
+		/** Subparameter table
+		 *
+		 *  Subparameters continue pool configuration with additional
+		 *  packet length requirements. The first table entry follows
+		 *  the num/len specification above. So that, sub[0].len > 'len'
+		 *  and sub[0].num refers to packet lengths between 'len' + 1
+		 *  and sub[0].len. Similarly, sub[1] follows sub[0]
+		 *  specification, and so on.
+		 *
+		 *  Each requirement is supported separately and may be rounded
+		 *  up, as long as the 'max_num' parameter is not violated. It's
+		 *  implementation specific if some requirements are supported
+		 *  simultaneously (e.g. due to subpool design).
+		 */
+		odp_pool_pkt_subparam_t sub[ODP_POOL_MAX_SUBPARAMS];
+	} pkt;
+
+	/** Parameters for timeout pools */
+	struct {
+		/** Number of timeouts in the pool */
+		uint32_t num;
+	} tmo;
+
 } odp_pool_param_t;
 
 /** Packet pool*/