diff mbox

[PATCHv7,3/5] linux-generic: create internal pool create function with shm flags

Message ID 1433155304-24149-4-git-send-email-maxim.uvarov@linaro.org
State Superseded
Headers show

Commit Message

Maxim Uvarov June 1, 2015, 10:41 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 |  5 +++++
 platform/linux-generic/odp_pool.c                  | 15 +++++++++++----
 platform/linux-generic/odp_schedule.c              |  2 +-
 3 files changed, 17 insertions(+), 5 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 247a75a..1599ad9 100644
--- a/platform/linux-generic/include/odp_pool_internal.h
+++ b/platform/linux-generic/include/odp_pool_internal.h
@@ -339,6 +339,11 @@  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_shm_t shm,
+			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 cd2c449..536436a 100644
--- a/platform/linux-generic/odp_pool.c
+++ b/platform/linux-generic/odp_pool.c
@@ -144,9 +144,10 @@  int odp_pool_term_local(void)
  * Pool creation
  */
 
-odp_pool_t odp_pool_create(const char *name,
-			   odp_shm_t shm,
-			   odp_pool_param_t *params)
+odp_pool_t _pool_create(const char *name,
+			odp_shm_t shm,
+			odp_pool_param_t *params,
+			uint32_t shmflags)
 {
 	odp_pool_t pool_hdl = ODP_POOL_INVALID;
 	pool_entry_t *pool;
@@ -292,7 +293,7 @@  odp_pool_t odp_pool_create(const char *name,
 		if (shm == ODP_SHM_NULL) {
 			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;
@@ -428,6 +429,12 @@  odp_pool_t odp_pool_create(const char *name,
 	return pool_hdl;
 }
 
+odp_pool_t odp_pool_create(const char *name,
+			   odp_shm_t shm,
+			   odp_pool_param_t *params)
+{
+	return _pool_create(name, shm, 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 a63f97a..78890fe 100644
--- a/platform/linux-generic/odp_schedule.c
+++ b/platform/linux-generic/odp_schedule.c
@@ -129,7 +129,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", ODP_SHM_NULL, &params);
+	pool = _pool_create("odp_sched_pool", ODP_SHM_NULL, &params, 0);
 
 	if (pool == ODP_POOL_INVALID) {
 		ODP_ERR("Schedule init: Pool create failed.\n");