diff mbox series

[API-NEXT,v1,1/1] api: pool: add packet headroom configuration

Message ID 1503925211-13711-2-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [API-NEXT,v1,1/1] api: pool: add packet headroom configuration | expand

Commit Message

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


Adds packet headroom configuration to pool parameters

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

---
/** Email created from pull request 148 (bala-manoharan:pool_headroom)
 ** https://github.com/Linaro/odp/pull/148
 ** Patch: https://github.com/Linaro/odp/pull/148.patch
 ** Base sha: 859293ad9b3c862264bb0fbfe8e7037b5e04d084
 ** Merge commit sha: ab1d3b5ca5cc5ad67dc6ac092a3a175a7b5ac208
 **/
 include/odp/api/spec/pool.h       | 7 +++++++
 platform/linux-generic/odp_pool.c | 5 ++++-
 2 files changed, 11 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/include/odp/api/spec/pool.h b/include/odp/api/spec/pool.h
index 6fc5b6b4..f173ab2f 100644
--- a/include/odp/api/spec/pool.h
+++ b/include/odp/api/spec/pool.h
@@ -214,6 +214,13 @@  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;
+
+			/** Headroom size in bytes. Number of bytes of
+			    space preceding packet data to reserve for
+			    use as headroom.
+			    Must not exceed the implementation defined
+			    ODP_PACKET_MAX_HEADROOM. */
+			uint32_t headroom;
 		} pkt;
 
 		/** Parameters for timeout pools */
diff --git a/platform/linux-generic/odp_pool.c b/platform/linux-generic/odp_pool.c
index d170782e..b552904a 100644
--- a/platform/linux-generic/odp_pool.c
+++ b/platform/linux-generic/odp_pool.c
@@ -346,7 +346,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.headroom < CONFIG_PACKET_HEADROOM)
+			headroom = params->pkt.headroom;
+		else
+			headroom    = CONFIG_PACKET_HEADROOM;
 		tailroom    = CONFIG_PACKET_TAILROOM;
 		num         = params->pkt.num;
 		uarea_size  = params->pkt.uarea_size;