diff mbox series

[API-NEXT,v4,2/8] api: pool: add packet pool subparameters

Message ID 1509091212-14398-3-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>


Additional packet length and number specification gives
more information to implementation about intended packet
length distribution in the pool. This enables e.g. correct
initialization when pool implementation is based on multiple
fixed packet / segment sizes (subpools). The specification
does require subpool implementation but allows it.

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 | 48 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)
diff mbox series

Patch

diff --git a/include/odp/api/spec/pool.h b/include/odp/api/spec/pool.h
index dc07851c4..2900fc469 100644
--- a/include/odp/api/spec/pool.h
+++ b/include/odp/api/spec/pool.h
@@ -41,6 +41,9 @@  extern "C" {
  * Maximum pool name length in chars including null char
  */
 
+/** Maximum number of packet pool subparameters */
+#define ODP_POOL_MAX_SUBPARAMS  7
+
 /**
  * Pool capabilities
  */
@@ -134,6 +137,12 @@  typedef struct odp_pool_capability_t {
 		 * The value of zero means that limited only by the available
 		 * memory size for the pool. */
 		uint32_t max_uarea_size;
+
+		/** Maximum number of subparameters
+		 *
+		 *  Maximum number of packet pool subparameters. Valid range is
+		 *  0 ... ODP_POOL_MAX_SUBPARAMS. */
+		uint8_t max_num_subparam;
 	} pkt;
 
 	/** Timeout pool capabilities  */
@@ -163,6 +172,18 @@  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
  *
  * A note for all pool types: a single thread may not be able to allocate all
@@ -246,6 +267,33 @@  typedef struct odp_pool_param_t {
 			    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 */