Adds threshold limit of the pool to the pool parameters.
This threshold limit is a percentage of total size of the pool.

Signed-off-by: Balasubramanian Manoharan <bala.manoha...@linaro.org>
---
 include/odp/api/spec/pool.h | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/include/odp/api/spec/pool.h b/include/odp/api/spec/pool.h
index 6fc5b6b..1c1ebe4 100644
--- a/include/odp/api/spec/pool.h
+++ b/include/odp/api/spec/pool.h
@@ -20,6 +20,7 @@ extern "C" {
 #endif
 
 #include <odp/api/std_types.h>
+#include <odp/api/support.h>
 
 /** @defgroup odp_pool ODP POOL
  *  Operations on a pool.
@@ -127,6 +128,9 @@ 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;
+
+               /** Pool Threshold limit support */
+               odp_support_t pool_threshold_limit;
        } pkt;
 
        /** Timeout pool capabilities  */
@@ -214,6 +218,17 @@ typedef struct odp_pool_param_t {
                            defined by pool capability pkt.max_uarea_size.
                            Specify as 0 if no user area is needed. */
                        uint32_t uarea_size;
+
+                       /** Pool threshold limit in percentage
+                        *
+                        * This value denotes the threshold limit of the pool in
+                        * percentage of the total size of the pool and is used
+                        * to configure the Random Early Discard (RED).
+                        * When the number of packets in the pool is greater
+                        * than this value RED is initiated in the pool and
+                        * further incoming packets to the pool are dropped in
+                        * a random sequence. */
+                       uint8_t threshold_limit;
                } pkt;
 
                /** Parameters for timeout pools */
@@ -329,6 +344,23 @@ uint64_t odp_pool_to_u64(odp_pool_t hdl);
 void odp_pool_param_init(odp_pool_param_t *param);
 
 /**
+ * Set threshold limit of the pool
+ *
+ * Set the threshold limit of the pool as a percentage of the total
+ * size of the pool. This value is used to configure Random Early Discard(RED)
+ * parameters of the pool and any incoming packets to the pool after reaching
+ * this threshold is dropped in a random sequence.
+ *
+ * @param pool                 Pool handle
+ * @param threshold_limit      Threshold limit of the pool.
+ *
+ * @retval                     0 on success
+ * @retval                     -1 on failure
+ */
+
+int odp_pool_threshold_limit(odp_pool_t pool, uint8_t threshold_limit);
+
+/**
  * @}
  */
 
-- 
1.9.1

Reply via email to