diff mbox

[PATCHv11,2/7] linux-generic: create internal pool create function with shm flags

Message ID 1445507411-20556-3-git-send-email-maxim.uvarov@linaro.org
State Superseded
Headers show

Commit Message

Maxim Uvarov Oct. 22, 2015, 9:50 a.m. UTC
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.uvarov@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 mbox

Patch

diff --git a/platform/linux-generic/include/odp_pool_internal.h b/platform/linux-generic/include/odp_pool_internal.h
index 136db2c..6781703 100644
--- a/platform/linux-generic/include/odp_pool_internal.h
+++ b/platform/linux-generic/include/odp_pool_internal.h
@@ -347,6 +347,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 30d4b2b..2036c2a 100644
--- a/platform/linux-generic/odp_pool.c
+++ b/platform/linux-generic/odp_pool.c
@@ -144,7 +144,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;
@@ -290,7 +292,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;
@@ -403,6 +405,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 827fcf0..c66c177 100644
--- a/platform/linux-generic/odp_schedule.c
+++ b/platform/linux-generic/odp_schedule.c
@@ -140,8 +140,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;