aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatias Elo <matias.elo@nokia.com>2018-10-26 13:11:12 +0300
committerMaxim Uvarov <maxim.uvarov@linaro.org>2018-11-22 18:23:09 +0300
commit96a177a6322a9d8fad99d43271d1b98ecd5d12a5 (patch)
tree157e979fa8dcd320eca08a4c47b27b8226e9ad06
parent3529f3b8713021e45c7dbdd81f839d8b9049efcc (diff)
linux-gen: ishm: remove unnecessary _odp_ishm_pool_lookup() function
Ease code maintenance by removing unnecessary code. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
-rw-r--r--platform/linux-generic/include/odp_ishmpool_internal.h1
-rw-r--r--platform/linux-generic/odp_ishmpool.c20
-rw-r--r--platform/linux-generic/odp_queue_scalable.c50
-rw-r--r--platform/linux-generic/odp_schedule_scalable.c51
4 files changed, 46 insertions, 76 deletions
diff --git a/platform/linux-generic/include/odp_ishmpool_internal.h b/platform/linux-generic/include/odp_ishmpool_internal.h
index 94bcddaeb..9db5a2b4b 100644
--- a/platform/linux-generic/include/odp_ishmpool_internal.h
+++ b/platform/linux-generic/include/odp_ishmpool_internal.h
@@ -46,7 +46,6 @@ int _odp_ishm_pool_destroy(_odp_ishm_pool_t *pool);
void *_odp_ishm_pool_alloc(_odp_ishm_pool_t *pool, uint64_t size);
int _odp_ishm_pool_free(_odp_ishm_pool_t *pool, void *addr);
int _odp_ishm_pool_status(const char *title, _odp_ishm_pool_t *pool);
-_odp_ishm_pool_t *_odp_ishm_pool_lookup(const char *pool_name);
void _odp_ishm_pool_init(void);
#ifdef __cplusplus
diff --git a/platform/linux-generic/odp_ishmpool.c b/platform/linux-generic/odp_ishmpool.c
index a3a1c0596..56e59f33d 100644
--- a/platform/linux-generic/odp_ishmpool.c
+++ b/platform/linux-generic/odp_ishmpool.c
@@ -784,23 +784,3 @@ void _odp_ishm_pool_init(void)
for (i = 0; i < MAX_NB_POOL; i++)
pool_blk_idx[i] = -1;
}
-
-_odp_ishm_pool_t *_odp_ishm_pool_lookup(const char *pool_name)
-{
- int block_idx;
- int store_idx;
-
- /* search for a _ishm block with the given name */
- block_idx = _odp_ishm_lookup_by_name(pool_name);
- if (block_idx < 0)
- return NULL;
-
- /* a block with that name exists: make sure it is within
- * the registered pools */
- for (store_idx = 0; store_idx < MAX_NB_POOL; store_idx++) {
- if (pool_blk_idx[store_idx] == block_idx)
- return _odp_ishm_address(block_idx);
- }
-
- return NULL;
-}
diff --git a/platform/linux-generic/odp_queue_scalable.c b/platform/linux-generic/odp_queue_scalable.c
index 1fa0ce4f8..4f5d8b218 100644
--- a/platform/linux-generic/odp_queue_scalable.c
+++ b/platform/linux-generic/odp_queue_scalable.c
@@ -207,34 +207,30 @@ static int queue_init_global(void)
_odp_queue_inline_offset.context = offsetof(queue_entry_t,
s.param.context);
- /* Attach to the pool if it exists */
- queue_shm_pool = _odp_ishm_pool_lookup("queue_shm_pool");
+ /* Create shared memory pool to allocate shared memory for the
+ * queues. Use the default queue size.
+ */
+ /* Add size of the array holding the queues */
+ pool_size = sizeof(queue_table_t);
+ /* Add storage required for queues */
+ pool_size += (CONFIG_SCAL_QUEUE_SIZE *
+ sizeof(odp_buffer_hdr_t *)) * ODP_CONFIG_QUEUES;
+
+ /* Add the reorder window size */
+ pool_size += sizeof(reorder_window_t) * ODP_CONFIG_QUEUES;
+ /* Choose min_alloc and max_alloc such that buddy allocator is
+ * is selected.
+ */
+ min_alloc = 0;
+ max_alloc = CONFIG_SCAL_QUEUE_SIZE * sizeof(odp_buffer_hdr_t *);
+ queue_shm_pool = _odp_ishm_pool_create("queue_shm_pool",
+ pool_size,
+ min_alloc, max_alloc,
+ _ODP_ISHM_SINGLE_VA);
if (queue_shm_pool == NULL) {
- /* Create shared memory pool to allocate shared memory for the
- * queues. Use the default queue size.
- */
- /* Add size of the array holding the queues */
- pool_size = sizeof(queue_table_t);
- /* Add storage required for queues */
- pool_size += (CONFIG_SCAL_QUEUE_SIZE *
- sizeof(odp_buffer_hdr_t *)) * ODP_CONFIG_QUEUES;
-
- /* Add the reorder window size */
- pool_size += sizeof(reorder_window_t) * ODP_CONFIG_QUEUES;
- /* Choose min_alloc and max_alloc such that buddy allocator is
- * is selected.
- */
- min_alloc = 0;
- max_alloc = CONFIG_SCAL_QUEUE_SIZE * sizeof(odp_buffer_hdr_t *);
- queue_shm_pool = _odp_ishm_pool_create("queue_shm_pool",
- pool_size,
- min_alloc, max_alloc,
- _ODP_ISHM_SINGLE_VA);
- if (queue_shm_pool == NULL) {
- ODP_ERR("Failed to allocate shared memory pool for"
- " queues\n");
- goto queue_shm_pool_create_failed;
- }
+ ODP_ERR("Failed to allocate shared memory pool for"
+ " queues\n");
+ goto queue_shm_pool_create_failed;
}
queue_tbl = (queue_table_t *)
diff --git a/platform/linux-generic/odp_schedule_scalable.c b/platform/linux-generic/odp_schedule_scalable.c
index 83a2a41b0..5d83ed088 100644
--- a/platform/linux-generic/odp_schedule_scalable.c
+++ b/platform/linux-generic/odp_schedule_scalable.c
@@ -1790,6 +1790,7 @@ static int schedule_init_global(void)
odp_schedule_group_t tmp_wrkr;
odp_schedule_group_t tmp_ctrl;
odp_shm_t shm;
+ _odp_ishm_pool_t *pool;
uint32_t bits;
uint32_t pool_size;
uint64_t min_alloc;
@@ -1808,34 +1809,28 @@ static int schedule_init_global(void)
memset(global, 0, sizeof(sched_global_t));
global->shm = shm;
- /* Attach to the pool if it exists */
- global->sched_shm_pool = _odp_ishm_pool_lookup("sched_shm_pool");
- if (global->sched_shm_pool == NULL) {
- _odp_ishm_pool_t *pool;
-
- /* Add storage required for sched groups. Assume worst case
- * xfactor of MAXTHREADS.
- */
- pool_size = (sizeof(sched_group_t) +
- (ODP_SCHED_PRIO_NUM * MAXTHREADS - 1) *
- sizeof(sched_queue_t)) * MAX_SCHED_GROUP;
- /* Choose min_alloc and max_alloc such that slab allocator
- * is selected.
- */
- min_alloc = sizeof(sched_group_t) +
- (ODP_SCHED_PRIO_NUM * MAXTHREADS - 1) *
- sizeof(sched_queue_t);
- max_alloc = min_alloc;
- pool = _odp_ishm_pool_create("sched_shm_pool", pool_size,
- min_alloc, max_alloc,
- _ODP_ISHM_SINGLE_VA);
- if (pool == NULL) {
- ODP_ERR("Failed to allocate shared memory pool "
- "for sched\n");
- goto failed_sched_shm_pool_create;
- }
- global->sched_shm_pool = pool;
- }
+ /* Add storage required for sched groups. Assume worst case
+ * xfactor of MAXTHREADS.
+ */
+ pool_size = (sizeof(sched_group_t) +
+ (ODP_SCHED_PRIO_NUM * MAXTHREADS - 1) *
+ sizeof(sched_queue_t)) * MAX_SCHED_GROUP;
+ /* Choose min_alloc and max_alloc such that slab allocator
+ * is selected.
+ */
+ min_alloc = sizeof(sched_group_t) +
+ (ODP_SCHED_PRIO_NUM * MAXTHREADS - 1) *
+ sizeof(sched_queue_t);
+ max_alloc = min_alloc;
+ pool = _odp_ishm_pool_create("sched_shm_pool", pool_size,
+ min_alloc, max_alloc,
+ _ODP_ISHM_SINGLE_VA);
+ if (pool == NULL) {
+ ODP_ERR("Failed to allocate shared memory pool "
+ "for sched\n");
+ goto failed_sched_shm_pool_create;
+ }
+ global->sched_shm_pool = pool;
odp_spinlock_init(&global->sched_grp_lock);