A new headroom parameter is added to odp_pool_param_t when the pool is type
of ODP_POOL_PACKET, so that headroom size could be configured at pool
initialization time (ODP application runtime).

Signed-off-by: Genis Riera Perez <gri...@starflownetworks.com>
--
 include/odp/api/pool.h            |  5 +++++
 platform/linux-generic/odp_pool.c | 10 +++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/include/odp/api/pool.h b/include/odp/api/pool.h
index e5061ab..913f510 100644
--- a/include/odp/api/pool.h
+++ b/include/odp/api/pool.h
@@ -82,6 +82,11 @@ typedef struct odp_pool_param_t {
                        /** User area size in bytes. Specify as 0 if no user
                            area is needed. */
                        uint32_t uarea_size;
+
+                       /** Packet headroom size in bytes. The maximum and
the
+                           default value is defined by
ODP_CONFIG_PACKET_HEADROOM.
+                           Use 0 for default. */
+                       uint32_t headroom;
                } pkt;
                struct {
                        /** Number of timeouts in the pool */
diff --git a/platform/linux-generic/odp_pool.c
b/platform/linux-generic/odp_pool.c
index dcbdf07..9359e53 100644
--- a/platform/linux-generic/odp_pool.c
+++ b/platform/linux-generic/odp_pool.c
@@ -201,7 +201,15 @@ odp_pool_t odp_pool_create(const char *name,

        case ODP_POOL_PACKET:
                unseg = 0; /* Packets are always segmented */
-               headroom = ODP_CONFIG_PACKET_HEADROOM;
+
+               /* If headroom is not specified by params,
+                  set it to the default */
+               if (params->pkt.headroom <= 0 ||
+                   params->pkt.headroom > ODP_CONFIG_PACKET_HEADROOM)
+                       headroom = ODP_CONFIG_PACKET_HEADROOM;
+               else
+                       headroom = params->pkt.headroom;
+
                tailroom = ODP_CONFIG_PACKET_TAILROOM;
                buf_num = params->pkt.num;


Genís Riera Pérez
Software Engineer at StarFlow Networks
Edifici K2M, S103 c/ Jordi Girona 31
08034 Barcelona

E-mail: gri...@starflownetworks.com
_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to