diff mbox series

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

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

Commit Message

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


Adds minimum and maximum headroom in pool capability

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: 91c0b58fc87ba0431241818758cea94438cd5498
 ** Merge commit sha: c6ab16c8354a9a96ad8d4001badf3a206e95bed7
 **/
 platform/linux-generic/include/odp_config_internal.h | 9 +++++++++
 platform/linux-generic/odp_pool.c                    | 9 +++++++--
 2 files changed, 16 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/platform/linux-generic/include/odp_config_internal.h b/platform/linux-generic/include/odp_config_internal.h
index e8d0acb4..e1bc622b 100644
--- a/platform/linux-generic/include/odp_config_internal.h
+++ b/platform/linux-generic/include/odp_config_internal.h
@@ -65,6 +65,15 @@ 
 #define CONFIG_PACKET_HEADROOM 128
 
 /*
+ * Maximum packet headroom
+ *
+ * This defines the maximum number of headroom bytes that newly created packets
+ * can be configured. This value applies to both ODP packet input and user
+ * allocated packets.
+ */
+#define CONFIG_PACKET_MAX_HEADROOM 258
+
+/*
  * Default packet tailroom
  *
  * This defines the minimum number of tailroom bytes that newly created packets
diff --git a/platform/linux-generic/odp_pool.c b/platform/linux-generic/odp_pool.c
index 3e8ec6d8..efd20e25 100644
--- a/platform/linux-generic/odp_pool.c
+++ b/platform/linux-generic/odp_pool.c
@@ -348,7 +348,10 @@  static odp_pool_t pool_create(const char *name, odp_pool_param_t *params,
 		break;
 
 	case ODP_POOL_PACKET:
-		headroom    = CONFIG_PACKET_HEADROOM;
+		if (params->pkt.min_headroom < CONFIG_PACKET_MAX_HEADROOM)
+			headroom = params->pkt.min_headroom;
+		else
+			headroom    = CONFIG_PACKET_MAX_HEADROOM;
 		tailroom    = CONFIG_PACKET_TAILROOM;
 		num         = params->pkt.num;
 		uarea_size  = params->pkt.uarea_size;
@@ -853,7 +856,8 @@  int odp_pool_capability(odp_pool_capability_t *capa)
 	capa->pkt.max_pools        = ODP_CONFIG_POOLS;
 	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.min_headroom     = 0;
+	capa->pkt.max_headroom     = CONFIG_PACKET_MAX_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 +917,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.min_headroom = CONFIG_PACKET_HEADROOM;
 }
 
 uint64_t odp_pool_to_u64(odp_pool_t hdl)