On init odp creates odp_sched_pool. We can not modify API to add new
parameter to odp_pool_param_t and this pool should not be shared
between different processes. To do that implemented internal linux-generic
function with parameters to created shm.
Note: create shm before and then provide it to the pool does not work
because shm argument likely will be dropped from odp_pool_create() (patch
already posted.).

Signed-off-by: Maxim Uvarov <maxim.uva...@linaro.org>
---
 platform/linux-generic/include/odp_pool_internal.h |  4 ++++
 platform/linux-generic/odp_pool.c                  | 11 +++++++++--
 platform/linux-generic/odp_schedule.c              |  3 +--
 3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/platform/linux-generic/include/odp_pool_internal.h 
b/platform/linux-generic/include/odp_pool_internal.h
index fdac606..2a8c696 100644
--- a/platform/linux-generic/include/odp_pool_internal.h
+++ b/platform/linux-generic/include/odp_pool_internal.h
@@ -352,6 +352,10 @@ static inline uint32_t odp_buffer_pool_tailroom(odp_pool_t 
pool)
        return odp_pool_to_entry(pool)->s.tailroom;
 }
 
+odp_pool_t _pool_create(const char *name,
+                       odp_pool_param_t *params,
+                       uint32_t shmflags);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/platform/linux-generic/odp_pool.c 
b/platform/linux-generic/odp_pool.c
index 64668cc..27ff907 100644
--- a/platform/linux-generic/odp_pool.c
+++ b/platform/linux-generic/odp_pool.c
@@ -150,7 +150,9 @@ int odp_pool_term_local(void)
  * Pool creation
  */
 
-odp_pool_t odp_pool_create(const char *name, odp_pool_param_t *params)
+odp_pool_t _pool_create(const char *name,
+                       odp_pool_param_t *params,
+                       uint32_t shmflags)
 {
        odp_pool_t pool_hdl = ODP_POOL_INVALID;
        pool_entry_t *pool;
@@ -296,7 +298,7 @@ odp_pool_t odp_pool_create(const char *name, 
odp_pool_param_t *params)
 
                shm = odp_shm_reserve(pool->s.name,
                                      pool->s.pool_size,
-                                     ODP_PAGE_SIZE, 0);
+                                     ODP_PAGE_SIZE, shmflags);
                if (shm == ODP_SHM_INVALID) {
                        POOL_UNLOCK(&pool->s.lock);
                        return ODP_POOL_INVALID;
@@ -409,6 +411,11 @@ odp_pool_t odp_pool_create(const char *name, 
odp_pool_param_t *params)
        return pool_hdl;
 }
 
+odp_pool_t odp_pool_create(const char *name,
+                          odp_pool_param_t *params)
+{
+       return _pool_create(name, params, ODP_SHM_PROC);
+}
 
 odp_pool_t odp_pool_lookup(const char *name)
 {
diff --git a/platform/linux-generic/odp_schedule.c 
b/platform/linux-generic/odp_schedule.c
index fc54ee5..ba80bdf 100644
--- a/platform/linux-generic/odp_schedule.c
+++ b/platform/linux-generic/odp_schedule.c
@@ -156,8 +156,7 @@ int odp_schedule_init_global(void)
        params.buf.num   = NUM_SCHED_CMD;
        params.type      = ODP_POOL_BUFFER;
 
-       pool = odp_pool_create("odp_sched_pool", &params);
-
+       pool = _pool_create("odp_sched_pool", &params, 0);
        if (pool == ODP_POOL_INVALID) {
                ODP_ERR("Schedule init: Pool create failed.\n");
                return -1;
-- 
2.7.1.250.gff4ea60

_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to