diff mbox

[PATCHv17,02/10] linux-generic: create internal pool create function with shm flags

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

Commit Message

Maxim Uvarov Dec. 10, 2015, 2:24 p.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 94bf1fa..b268cde 100644
--- a/platform/linux-generic/include/odp_pool_internal.h
+++ b/platform/linux-generic/include/odp_pool_internal.h
@@ -354,6 +354,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 9859ff6..e0992db 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 884ae60..edfe4e5 100644
--- a/platform/linux-generic/odp_schedule.c
+++ b/platform/linux-generic/odp_schedule.c
@@ -141,8 +141,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;