diff mbox series

[API-NEXT,v11,2/2] linux-generic: pool: implementation for min and max headroom configuration

Message ID 1505746826-26407-3-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [API-NEXT,v11,1/2] api: pool: add min and max headroom configuration in pool | expand

Commit Message

Github ODP bot Sept. 18, 2017, 3 p.m. UTC
From: Balasubramanian Manoharan <bala.manoharan@linaro.org>


Implements pool min and max headroom configuration

Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>

---
/** Email created from pull request 152 (bala-manoharan:pool_headroom)
 ** https://github.com/Linaro/odp/pull/152
 ** Patch: https://github.com/Linaro/odp/pull/152.patch
 ** Base sha: e344e4364f771f32b86d822d0c447770588fe65d
 ** Merge commit sha: cc1bd108cea5cbf012cdde50c1ec6fb86368562e
 **/
 platform/linux-generic/odp_pool.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/platform/linux-generic/odp_pool.c b/platform/linux-generic/odp_pool.c
index 3e8ec6d85..51e8a6189 100644
--- a/platform/linux-generic/odp_pool.c
+++ b/platform/linux-generic/odp_pool.c
@@ -348,6 +348,10 @@  static odp_pool_t pool_create(const char *name, odp_pool_param_t *params,
 		break;
 
 	case ODP_POOL_PACKET:
+		if (params->pkt.headroom > CONFIG_PACKET_HEADROOM) {
+			ODP_ERR("Packet headroom size not supported.");
+			return ODP_POOL_INVALID;
+		}
 		headroom    = CONFIG_PACKET_HEADROOM;
 		tailroom    = CONFIG_PACKET_TAILROOM;
 		num         = params->pkt.num;
@@ -854,6 +858,7 @@  int odp_pool_capability(odp_pool_capability_t *capa)
 	capa->pkt.max_len          = CONFIG_PACKET_MAX_SEGS * max_seg_len;
 	capa->pkt.max_num	   = CONFIG_POOL_MAX_NUM;
 	capa->pkt.min_headroom     = CONFIG_PACKET_HEADROOM;
+	capa->pkt.max_headroom     = CONFIG_PACKET_HEADROOM;
 	capa->pkt.min_tailroom     = CONFIG_PACKET_TAILROOM;
 	capa->pkt.max_segs_per_pkt = CONFIG_PACKET_MAX_SEGS;
 	capa->pkt.min_seg_len      = max_seg_len;
@@ -913,6 +918,7 @@  odp_pool_t odp_buffer_pool(odp_buffer_t buf)
 void odp_pool_param_init(odp_pool_param_t *params)
 {
 	memset(params, 0, sizeof(odp_pool_param_t));
+	params->pkt.headroom = CONFIG_PACKET_HEADROOM;
 }
 
 uint64_t odp_pool_to_u64(odp_pool_t hdl)