@@ -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
@@ -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)
{
@@ -129,8 +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", ¶ms);
-
+ pool = _pool_create("odp_sched_pool", ¶ms, 0);
if (pool == ODP_POOL_INVALID) {
ODP_ERR("Schedule init: Pool create failed.\n");
return -1;
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(-)