Message ID | 1433104735-16668-1-git-send-email-bill.fischofer@linaro.org |
---|---|
State | New |
Headers | show |
On 05/31/15 23:38, Bill Fischofer wrote: > Implement card https://cards.linaro.org/browse/LNG-925 reference for card should go after --, it's internal information only. And here should some readable description why we do this for people who see only git logs. Thanks, Maxim. > > Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org> > --- > example/classifier/odp_classifier.c | 2 +- > example/generator/odp_generator.c | 4 +- > example/ipsec/odp_ipsec.c | 8 ++-- > example/packet/odp_pktio.c | 2 +- > example/timer/odp_timer_test.c | 2 +- > include/odp/api/pool.h | 23 +++------ > platform/linux-generic/odp_pool.c | 54 +++++----------------- > platform/linux-generic/odp_schedule.c | 2 +- > test/performance/odp_l2fwd.c | 2 +- > test/performance/odp_pktio_perf.c | 5 +- > test/performance/odp_scheduling.c | 2 +- > .../classification/odp_classification_tests.c | 3 +- > test/validation/odp_buffer.c | 6 +-- > test/validation/odp_crypto.c | 2 +- > test/validation/odp_packet.c | 4 +- > test/validation/odp_pktio.c | 5 +- > test/validation/odp_pool.c | 32 +------------ > test/validation/odp_queue.c | 2 +- > test/validation/odp_scheduler.c | 4 +- > test/validation/odp_timer.c | 8 ++-- > 20 files changed, 49 insertions(+), 123 deletions(-) > > diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c > index 48fc1ab..22f9413 100644 > --- a/example/classifier/odp_classifier.c > +++ b/example/classifier/odp_classifier.c > @@ -433,7 +433,7 @@ int main(int argc, char *argv[]) > params.pkt.num = SHM_PKT_POOL_SIZE/SHM_PKT_POOL_BUF_SIZE; > params.type = ODP_POOL_PACKET; > > - pool = odp_pool_create("packet_pool", ODP_SHM_NULL, ¶ms); > + pool = odp_pool_create("packet_pool", ¶ms); > > if (pool == ODP_POOL_INVALID) { > EXAMPLE_ERR("Error: packet pool create failed.\n"); > diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c > index 8ae5b29..ed8fd50 100644 > --- a/example/generator/odp_generator.c > +++ b/example/generator/odp_generator.c > @@ -654,7 +654,7 @@ int main(int argc, char *argv[]) > params.pkt.num = SHM_PKT_POOL_SIZE/SHM_PKT_POOL_BUF_SIZE; > params.type = ODP_POOL_PACKET; > > - pool = odp_pool_create("packet_pool", ODP_SHM_NULL, ¶ms); > + pool = odp_pool_create("packet_pool", ¶ms); > > if (pool == ODP_POOL_INVALID) { > EXAMPLE_ERR("Error: packet pool create failed.\n"); > @@ -681,7 +681,7 @@ int main(int argc, char *argv[]) > params.tmo.num = tparams.num_timers; /* One timeout per timer */ > params.type = ODP_POOL_TIMEOUT; > > - tmop = odp_pool_create("timeout_pool", ODP_SHM_NULL, ¶ms); > + tmop = odp_pool_create("timeout_pool", ¶ms); > > if (pool == ODP_POOL_INVALID) { > EXAMPLE_ERR("Error: packet pool create failed.\n"); > diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c > index cb8f535..58a9800 100644 > --- a/example/ipsec/odp_ipsec.c > +++ b/example/ipsec/odp_ipsec.c > @@ -347,7 +347,7 @@ void ipsec_init_pre(void) > params.pkt.num = SHM_PKT_POOL_BUF_COUNT; > params.type = ODP_POOL_PACKET; > > - out_pool = odp_pool_create("out_pool", ODP_SHM_NULL, ¶ms); > + out_pool = odp_pool_create("out_pool", ¶ms); > > if (ODP_POOL_INVALID == out_pool) { > EXAMPLE_ERR("Error: message pool create failed.\n"); > @@ -1215,8 +1215,7 @@ main(int argc, char *argv[]) > params.pkt.num = SHM_PKT_POOL_BUF_COUNT; > params.type = ODP_POOL_PACKET; > > - pkt_pool = odp_pool_create("packet_pool", ODP_SHM_NULL, > - ¶ms); > + pkt_pool = odp_pool_create("packet_pool", ¶ms); > > if (ODP_POOL_INVALID == pkt_pool) { > EXAMPLE_ERR("Error: packet pool create failed.\n"); > @@ -1229,8 +1228,7 @@ main(int argc, char *argv[]) > params.buf.num = SHM_CTX_POOL_BUF_COUNT; > params.type = ODP_POOL_BUFFER; > > - ctx_pool = odp_pool_create("ctx_pool", ODP_SHM_NULL, > - ¶ms); > + ctx_pool = odp_pool_create("ctx_pool", ¶ms); > > if (ODP_POOL_INVALID == ctx_pool) { > EXAMPLE_ERR("Error: context pool create failed.\n"); > diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c > index f08d9f4..937146e 100644 > --- a/example/packet/odp_pktio.c > +++ b/example/packet/odp_pktio.c > @@ -368,7 +368,7 @@ int main(int argc, char *argv[]) > params.pkt.num = SHM_PKT_POOL_SIZE/SHM_PKT_POOL_BUF_SIZE; > params.type = ODP_POOL_PACKET; > > - pool = odp_pool_create("packet_pool", ODP_SHM_NULL, ¶ms); > + pool = odp_pool_create("packet_pool", ¶ms); > > if (pool == ODP_POOL_INVALID) { > EXAMPLE_ERR("Error: packet pool create failed.\n"); > diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c > index 5e4306e..196cdf8 100644 > --- a/example/timer/odp_timer_test.c > +++ b/example/timer/odp_timer_test.c > @@ -418,7 +418,7 @@ int main(int argc, char *argv[]) > params.tmo.num = NUM_TMOS; > params.type = ODP_POOL_TIMEOUT; > > - gbls->pool = odp_pool_create("msg_pool", ODP_SHM_NULL, ¶ms); > + gbls->pool = odp_pool_create("msg_pool", ¶ms); > > if (gbls->pool == ODP_POOL_INVALID) { > EXAMPLE_ERR("Pool create failed.\n"); > diff --git a/include/odp/api/pool.h b/include/odp/api/pool.h > index e5061ab..a76563a 100644 > --- a/include/odp/api/pool.h > +++ b/include/odp/api/pool.h > @@ -99,28 +99,22 @@ typedef struct odp_pool_param_t { > > /** > * Create a pool > - * This routine is used to create a pool. It take three > - * arguments: the optional name of the pool to be created, an optional shared > - * memory handle, and a parameter struct that describes the pool to be > - * created. If a name is not specified the result is an anonymous pool that > - * cannot be referenced by odp_pool_lookup(). > + * > + * This routine is used to create a pool. It take two arguments: the optional > + * name of the pool to be created and a parameter struct that describes the > + * pool to be created. If a name is not specified the result is an anonymous > + * pool that cannot be referenced by odp_pool_lookup(). > * > * @param name Name of the pool, max ODP_POOL_NAME_LEN-1 chars. > * May be specified as NULL for anonymous pools. > * > - * @param shm The shared memory object in which to create the pool. > - * Use ODP_SHM_NULL to reserve default memory type > - * for the pool type. > - * > * @param params Pool parameters. > * > * @return Handle of the created pool > * @retval ODP_POOL_INVALID Pool could not be created > */ > > -odp_pool_t odp_pool_create(const char *name, > - odp_shm_t shm, > - odp_pool_param_t *params); > +odp_pool_t odp_pool_create(const char *name, odp_pool_param_t *params); > > /** > * Destroy a pool previously created by odp_pool_create() > @@ -160,11 +154,6 @@ odp_pool_t odp_pool_lookup(const char *name); > */ > typedef struct odp_pool_info_t { > const char *name; /**< pool name */ > - odp_shm_t shm; /**< handle of shared memory area > - supplied by application to > - contain pool, or > - ODP_SHM_INVALID if this pool is > - managed by ODP */ > odp_pool_param_t params; /**< pool parameters */ > } odp_pool_info_t; > > diff --git a/platform/linux-generic/odp_pool.c b/platform/linux-generic/odp_pool.c > index cd2c449..0a75409 100644 > --- a/platform/linux-generic/odp_pool.c > +++ b/platform/linux-generic/odp_pool.c > @@ -144,13 +144,12 @@ 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 odp_pool_create(const char *name, odp_pool_param_t *params) > { > odp_pool_t pool_hdl = ODP_POOL_INVALID; > pool_entry_t *pool; > uint32_t i, headroom = 0, tailroom = 0; > + odp_shm_t shm; > > if (params == NULL) > return ODP_POOL_INVALID; > @@ -289,38 +288,14 @@ odp_pool_t odp_pool_create(const char *name, > mdata_size + > udata_size); > > - if (shm == ODP_SHM_NULL) { > - shm = odp_shm_reserve(pool->s.name, > - pool->s.pool_size, > - ODP_PAGE_SIZE, 0); > - if (shm == ODP_SHM_INVALID) { > - POOL_UNLOCK(&pool->s.lock); > - return ODP_POOL_INVALID; > - } > - pool->s.pool_base_addr = odp_shm_addr(shm); > - } else { > - odp_shm_info_t info; > - if (odp_shm_info(shm, &info) != 0 || > - info.size < pool->s.pool_size) { > - POOL_UNLOCK(&pool->s.lock); > - return ODP_POOL_INVALID; > - } > - pool->s.pool_base_addr = odp_shm_addr(shm); > - void *page_addr = > - ODP_ALIGN_ROUNDUP_PTR(pool->s.pool_base_addr, > - ODP_PAGE_SIZE); > - if (pool->s.pool_base_addr != page_addr) { > - if (info.size < pool->s.pool_size + > - ((size_t)page_addr - > - (size_t)pool->s.pool_base_addr)) { > - POOL_UNLOCK(&pool->s.lock); > - return ODP_POOL_INVALID; > - } > - pool->s.pool_base_addr = page_addr; > - } > - pool->s.flags.user_supplied_shm = 1; > + shm = odp_shm_reserve(pool->s.name, > + pool->s.pool_size, > + ODP_PAGE_SIZE, 0); > + if (shm == ODP_SHM_INVALID) { > + POOL_UNLOCK(&pool->s.lock); > + return ODP_POOL_INVALID; > } > - > + pool->s.pool_base_addr = odp_shm_addr(shm); > pool->s.pool_shm = shm; > > /* Now safe to unlock since pool entry has been allocated */ > @@ -458,8 +433,6 @@ int odp_pool_info(odp_pool_t pool_hdl, odp_pool_info_t *info) > return -1; > > info->name = pool->s.name; > - info->shm = pool->s.flags.user_supplied_shm ? > - pool->s.pool_shm : ODP_SHM_INVALID; > info->params = pool->s.params; > > return 0; > @@ -491,9 +464,7 @@ int odp_pool_destroy(odp_pool_t pool_hdl) > return -1; > } > > - if (!pool->s.flags.user_supplied_shm) > - odp_shm_free(pool->s.pool_shm); > - > + odp_shm_free(pool->s.pool_shm); > pool->s.pool_shm = ODP_SHM_INVALID; > POOL_UNLOCK(&pool->s.lock); > > @@ -606,9 +577,8 @@ void odp_pool_print(odp_pool_t pool_hdl) > (pool->s.params.type == ODP_POOL_PACKET ? "packet" : > (pool->s.params.type == ODP_POOL_TIMEOUT ? "timeout" : > "unknown"))); > - ODP_DBG(" pool storage %sODP managed\n", > - pool->s.flags.user_supplied_shm ? > - "application provided, " : ""); > + ODP_DBG(" pool storage ODP managed shm handle %" PRIu64 "\n", > + odp_shm_to_u64(pool->s.pool_shm)); > ODP_DBG(" pool status %s\n", > pool->s.quiesced ? "quiesced" : "active"); > ODP_DBG(" pool opts %s, %s, %s\n", > diff --git a/platform/linux-generic/odp_schedule.c b/platform/linux-generic/odp_schedule.c > index 7fe42d7..d7289d0 100644 > --- a/platform/linux-generic/odp_schedule.c > +++ b/platform/linux-generic/odp_schedule.c > @@ -128,7 +128,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, ¶ms); > + pool = odp_pool_create("odp_sched_pool", ¶ms); > > if (pool == ODP_POOL_INVALID) { > ODP_ERR("Schedule init: Pool create failed.\n"); > diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c > index 5d4b833..97c932f 100644 > --- a/test/performance/odp_l2fwd.c > +++ b/test/performance/odp_l2fwd.c > @@ -415,7 +415,7 @@ int main(int argc, char *argv[]) > params.pkt.num = SHM_PKT_POOL_SIZE/SHM_PKT_POOL_BUF_SIZE; > params.type = ODP_POOL_PACKET; > > - pool = odp_pool_create("packet pool", ODP_SHM_NULL, ¶ms); > + pool = odp_pool_create("packet pool", ¶ms); > > if (pool == ODP_POOL_INVALID) { > LOG_ERR("Error: packet pool create failed.\n"); > diff --git a/test/performance/odp_pktio_perf.c b/test/performance/odp_pktio_perf.c > index fbe27a0..4cc4cb4 100644 > --- a/test/performance/odp_pktio_perf.c > +++ b/test/performance/odp_pktio_perf.c > @@ -645,7 +645,7 @@ static odp_pktio_t create_pktio(const char *iface) > params.type = ODP_POOL_PACKET; > > snprintf(pool_name, sizeof(pool_name), "pkt_pool_%s", iface); > - pool = odp_pool_create(pool_name, ODP_SHM_NULL, ¶ms); > + pool = odp_pool_create(pool_name, ¶ms); > if (pool == ODP_POOL_INVALID) > return ODP_PKTIO_INVALID; > > @@ -667,8 +667,7 @@ static int test_init(void) > params.pkt.num = PKT_BUF_NUM; > params.type = ODP_POOL_PACKET; > > - transmit_pkt_pool = odp_pool_create("pkt_pool_transmit", > - ODP_SHM_NULL, ¶ms); > + transmit_pkt_pool = odp_pool_create("pkt_pool_transmit", ¶ms); > if (transmit_pkt_pool == ODP_POOL_INVALID) > LOG_ABORT("Failed to create transmit pool\n"); > > diff --git a/test/performance/odp_scheduling.c b/test/performance/odp_scheduling.c > index 99f0f9b..609f854 100644 > --- a/test/performance/odp_scheduling.c > +++ b/test/performance/odp_scheduling.c > @@ -916,7 +916,7 @@ int main(int argc, char *argv[]) > params.buf.num = MSG_POOL_SIZE/sizeof(test_message_t); > params.type = ODP_POOL_BUFFER; > > - pool = odp_pool_create("msg_pool", ODP_SHM_NULL, ¶ms); > + pool = odp_pool_create("msg_pool", ¶ms); > > if (pool == ODP_POOL_INVALID) { > LOG_ERR("Pool create failed.\n"); > diff --git a/test/validation/classification/odp_classification_tests.c b/test/validation/classification/odp_classification_tests.c > index 131ac91..da6d29f 100644 > --- a/test/validation/classification/odp_classification_tests.c > +++ b/test/validation/classification/odp_classification_tests.c > @@ -283,8 +283,7 @@ int classification_tests_init(void) > param.pkt.num = SHM_PKT_NUM_BUFS; > param.type = ODP_POOL_PACKET; > > - pool = odp_pool_create("classification_pool", > - ODP_SHM_NULL, ¶m); > + pool = odp_pool_create("classification_pool", ¶m); > if (ODP_POOL_INVALID == pool) { > fprintf(stderr, "Packet pool creation failed.\n"); > return -1; > diff --git a/test/validation/odp_buffer.c b/test/validation/odp_buffer.c > index f2c0c9b..141ecab 100644 > --- a/test/validation/odp_buffer.c > +++ b/test/validation/odp_buffer.c > @@ -25,7 +25,7 @@ static int buffer_testsuite_init(void) > .type = ODP_POOL_BUFFER, > }; > > - raw_pool = odp_pool_create("raw_pool", ODP_SHM_INVALID, ¶ms); > + raw_pool = odp_pool_create("raw_pool", ¶ms); > if (raw_pool == ODP_POOL_INVALID) > return -1; > raw_buffer = odp_buffer_alloc(raw_pool); > @@ -60,7 +60,7 @@ static void buffer_pool_alloc(void) > .type = ODP_POOL_BUFFER, > }; > > - pool = odp_pool_create("buffer_pool_alloc", ODP_SHM_INVALID, ¶ms); > + pool = odp_pool_create("buffer_pool_alloc", ¶ms); > odp_pool_print(pool); > > /* Try to allocate num items from the pool */ > @@ -107,7 +107,7 @@ static void buffer_pool_free(void) > .type = ODP_POOL_BUFFER, > }; > > - pool = odp_pool_create("buffer_pool_free", ODP_SHM_INVALID, ¶ms); > + pool = odp_pool_create("buffer_pool_free", ¶ms); > > /* Allocate the only buffer from the pool */ > buffer = odp_buffer_alloc(pool); > diff --git a/test/validation/odp_crypto.c b/test/validation/odp_crypto.c > index 2a20ea1..3070fd5 100644 > --- a/test/validation/odp_crypto.c > +++ b/test/validation/odp_crypto.c > @@ -43,7 +43,7 @@ int tests_global_init(void) > params.pkt.num = SHM_PKT_POOL_SIZE/SHM_PKT_POOL_BUF_SIZE; > params.type = ODP_POOL_PACKET; > > - pool = odp_pool_create("packet_pool", ODP_SHM_NULL, ¶ms); > + pool = odp_pool_create("packet_pool", ¶ms); > > if (ODP_POOL_INVALID == pool) { > fprintf(stderr, "Packet pool creation failed.\n"); > diff --git a/test/validation/odp_packet.c b/test/validation/odp_packet.c > index a363438..08c21eb 100644 > --- a/test/validation/odp_packet.c > +++ b/test/validation/odp_packet.c > @@ -48,7 +48,7 @@ static int packet_testsuite_init(void) > struct udata_struct *udat; > uint32_t udat_size; > > - packet_pool = odp_pool_create("packet_pool", ODP_SHM_INVALID, ¶ms); > + packet_pool = odp_pool_create("packet_pool", ¶ms); > if (packet_pool == ODP_POOL_INVALID) > return -1; > > @@ -90,7 +90,7 @@ static void packet_alloc_free(void) > .type = ODP_POOL_PACKET, > }; > > - pool = odp_pool_create("packet_pool_alloc", ODP_SHM_INVALID, ¶ms); > + pool = odp_pool_create("packet_pool_alloc", ¶ms); > > /* Allocate the only buffer from the pool */ > packet = odp_packet_alloc(pool, packet_len); > diff --git a/test/validation/odp_pktio.c b/test/validation/odp_pktio.c > index d4bf7bf..1225184 100644 > --- a/test/validation/odp_pktio.c > +++ b/test/validation/odp_pktio.c > @@ -211,8 +211,7 @@ static int default_pool_create(void) > params.pkt.num = PKT_BUF_NUM; > params.type = ODP_POOL_PACKET; > > - default_pkt_pool = odp_pool_create("pkt_pool_default", > - ODP_SHM_NULL, ¶ms); > + default_pkt_pool = odp_pool_create("pkt_pool_default", ¶ms); > if (default_pkt_pool == ODP_POOL_INVALID) > return -1; > > @@ -238,7 +237,7 @@ static odp_pktio_t create_pktio(const char *iface) > if (pool != ODP_POOL_INVALID) > CU_ASSERT(odp_pool_destroy(pool) == 0); > > - pool = odp_pool_create(pool_name, ODP_SHM_NULL, ¶ms); > + pool = odp_pool_create(pool_name, ¶ms); > CU_ASSERT(pool != ODP_POOL_INVALID); > > pktio = odp_pktio_open(iface, pool); > diff --git a/test/validation/odp_pool.c b/test/validation/odp_pool.c > index 1a518a0..b670e2e 100644 > --- a/test/validation/odp_pool.c > +++ b/test/validation/odp_pool.c > @@ -19,7 +19,7 @@ static void pool_create_destroy(odp_pool_param_t *params) > snprintf(pool_name, sizeof(pool_name), > "test_pool-%d", pool_name_number++); > > - pool = odp_pool_create(pool_name, ODP_SHM_INVALID, params); > + pool = odp_pool_create(pool_name, params); > CU_ASSERT_FATAL(pool != ODP_POOL_INVALID); > CU_ASSERT(odp_pool_to_u64(pool) != > odp_pool_to_u64(ODP_POOL_INVALID)); > @@ -66,32 +66,6 @@ static void pool_create_destroy_timeout(void) > pool_create_destroy(¶ms); > } > > -static void pool_create_destroy_buffer_shm(void) > -{ > - odp_pool_t pool; > - odp_shm_t test_shm; > - odp_pool_param_t params = { > - .buf = { > - .size = 1500, > - .align = ODP_CACHE_LINE_SIZE, > - .num = 10, > - }, > - .type = ODP_POOL_BUFFER, > - }; > - > - test_shm = odp_shm_reserve("test_shm", > - params.buf.size * params.buf.num * 2, > - ODP_CACHE_LINE_SIZE, > - 0); > - CU_ASSERT_FATAL(test_shm != ODP_SHM_INVALID); > - > - pool = odp_pool_create("test_shm_pool", test_shm, ¶ms); > - CU_ASSERT_FATAL(pool != ODP_POOL_INVALID); > - > - CU_ASSERT(odp_pool_destroy(pool) == 0); > - CU_ASSERT(odp_shm_free(test_shm) == 0); > -} > - > static void pool_lookup_info_print(void) > { > odp_pool_t pool; > @@ -106,7 +80,7 @@ static void pool_lookup_info_print(void) > .type = ODP_POOL_BUFFER, > }; > > - pool = odp_pool_create(pool_name, ODP_SHM_INVALID, ¶ms); > + pool = odp_pool_create(pool_name, ¶ms); > CU_ASSERT_FATAL(pool != ODP_POOL_INVALID); > > pool = odp_pool_lookup(pool_name); > @@ -114,7 +88,6 @@ static void pool_lookup_info_print(void) > > CU_ASSERT_FATAL(odp_pool_info(pool, &info) == 0); > CU_ASSERT(strncmp(pool_name, info.name, sizeof(pool_name)) == 0); > - CU_ASSERT(info.shm == ODP_SHM_INVALID); > CU_ASSERT(params.buf.size <= info.params.buf.size); > CU_ASSERT(params.buf.align <= info.params.buf.align); > CU_ASSERT(params.buf.num <= info.params.buf.num); > @@ -131,7 +104,6 @@ CU_TestInfo pool_tests[] = { > _CU_TEST_INFO(pool_create_destroy_buffer), > _CU_TEST_INFO(pool_create_destroy_packet), > _CU_TEST_INFO(pool_create_destroy_timeout), > - _CU_TEST_INFO(pool_create_destroy_buffer_shm), > _CU_TEST_INFO(pool_lookup_info_print), > CU_TEST_INFO_NULL, > }; > diff --git a/test/validation/odp_queue.c b/test/validation/odp_queue.c > index 5123939..c61842c 100644 > --- a/test/validation/odp_queue.c > +++ b/test/validation/odp_queue.c > @@ -23,7 +23,7 @@ static int init_queue_suite(void) > params.buf.num = 1024 * 10; > params.type = ODP_POOL_BUFFER; > > - pool = odp_pool_create("msg_pool", ODP_SHM_NULL, ¶ms); > + pool = odp_pool_create("msg_pool", ¶ms); > > if (ODP_POOL_INVALID == pool) { > printf("Pool create failed.\n"); > diff --git a/test/validation/odp_scheduler.c b/test/validation/odp_scheduler.c > index a3ac505..b48ef3a 100644 > --- a/test/validation/odp_scheduler.c > +++ b/test/validation/odp_scheduler.c > @@ -119,7 +119,7 @@ static void test_schedule_queue_destroy(void) > params.buf.num = 1; > params.type = ODP_POOL_BUFFER; > > - p = odp_pool_create("sched_destroy_pool", ODP_SHM_NULL, ¶ms); > + p = odp_pool_create("sched_destroy_pool", ¶ms); > > CU_ASSERT_FATAL(p != ODP_POOL_INVALID); > > @@ -663,7 +663,7 @@ static int schd_suite_init(void) > params.buf.num = MSG_POOL_SIZE/BUF_SIZE; > params.type = ODP_POOL_BUFFER; > > - pool = odp_pool_create(MSG_POOL_NAME, ODP_SHM_NULL, ¶ms); > + pool = odp_pool_create(MSG_POOL_NAME, ¶ms); > > if (pool == ODP_POOL_INVALID) { > printf("Pool creation failed (msg).\n"); > diff --git a/test/validation/odp_timer.c b/test/validation/odp_timer.c > index 554b353..50bf6bd 100644 > --- a/test/validation/odp_timer.c > +++ b/test/validation/odp_timer.c > @@ -64,7 +64,7 @@ static void test_timeout_pool_alloc(void) > .type = ODP_POOL_TIMEOUT, > }; > > - pool = odp_pool_create("timeout_pool_alloc", ODP_SHM_NULL, ¶ms); > + pool = odp_pool_create("timeout_pool_alloc", ¶ms); > odp_pool_print(pool); > > /* Try to allocate num items from the pool */ > @@ -104,7 +104,7 @@ static void test_timeout_pool_free(void) > .type = ODP_POOL_TIMEOUT, > }; > > - pool = odp_pool_create("timeout_pool_free", ODP_SHM_NULL, ¶ms); > + pool = odp_pool_create("timeout_pool_free", ¶ms); > odp_pool_print(pool); > > /* Allocate the only timeout from the pool */ > @@ -139,7 +139,7 @@ static void test_odp_timer_cancel(void) > > params.tmo.num = 1; > params.type = ODP_POOL_TIMEOUT; > - pool = odp_pool_create("tmo_pool_for_cancel", ODP_SHM_NULL, ¶ms); > + pool = odp_pool_create("tmo_pool_for_cancel", ¶ms); > > if (pool == ODP_POOL_INVALID) > CU_FAIL_FATAL("Timeout pool create failed"); > @@ -449,7 +449,7 @@ static void test_odp_timer_all(void) > /* Create timeout pools */ > params.tmo.num = (NTIMERS + 1) * num_workers; > params.type = ODP_POOL_TIMEOUT; > - tbp = odp_pool_create("tmo_pool", ODP_SHM_NULL, ¶ms); > + tbp = odp_pool_create("tmo_pool", ¶ms); > if (tbp == ODP_POOL_INVALID) > CU_FAIL_FATAL("Timeout pool create failed"); >
On Sun, May 31, 2015 at 03:38:55PM -0500, Bill Fischofer wrote: > Implement card https://cards.linaro.org/browse/LNG-925 > > Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org> > --- > example/classifier/odp_classifier.c | 2 +- > example/generator/odp_generator.c | 4 +- > example/ipsec/odp_ipsec.c | 8 ++-- > example/packet/odp_pktio.c | 2 +- > example/timer/odp_timer_test.c | 2 +- > include/odp/api/pool.h | 23 +++------ > platform/linux-generic/odp_pool.c | 54 +++++----------------- > platform/linux-generic/odp_schedule.c | 2 +- > test/performance/odp_l2fwd.c | 2 +- > test/performance/odp_pktio_perf.c | 5 +- > test/performance/odp_scheduling.c | 2 +- > .../classification/odp_classification_tests.c | 3 +- > test/validation/odp_buffer.c | 6 +-- > test/validation/odp_crypto.c | 2 +- > test/validation/odp_packet.c | 4 +- > test/validation/odp_pktio.c | 5 +- > test/validation/odp_pool.c | 32 +------------ > test/validation/odp_queue.c | 2 +- > test/validation/odp_scheduler.c | 4 +- > test/validation/odp_timer.c | 8 ++-- > 20 files changed, 49 insertions(+), 123 deletions(-) > > diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c > index 48fc1ab..22f9413 100644 > --- a/example/classifier/odp_classifier.c > +++ b/example/classifier/odp_classifier.c > @@ -433,7 +433,7 @@ int main(int argc, char *argv[]) > params.pkt.num = SHM_PKT_POOL_SIZE/SHM_PKT_POOL_BUF_SIZE; > params.type = ODP_POOL_PACKET; > > - pool = odp_pool_create("packet_pool", ODP_SHM_NULL, ¶ms); > + pool = odp_pool_create("packet_pool", ¶ms); > > if (pool == ODP_POOL_INVALID) { > EXAMPLE_ERR("Error: packet pool create failed.\n"); > diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c > index 8ae5b29..ed8fd50 100644 > --- a/example/generator/odp_generator.c > +++ b/example/generator/odp_generator.c > @@ -654,7 +654,7 @@ int main(int argc, char *argv[]) > params.pkt.num = SHM_PKT_POOL_SIZE/SHM_PKT_POOL_BUF_SIZE; > params.type = ODP_POOL_PACKET; > > - pool = odp_pool_create("packet_pool", ODP_SHM_NULL, ¶ms); > + pool = odp_pool_create("packet_pool", ¶ms); > > if (pool == ODP_POOL_INVALID) { > EXAMPLE_ERR("Error: packet pool create failed.\n"); > @@ -681,7 +681,7 @@ int main(int argc, char *argv[]) > params.tmo.num = tparams.num_timers; /* One timeout per timer */ > params.type = ODP_POOL_TIMEOUT; > > - tmop = odp_pool_create("timeout_pool", ODP_SHM_NULL, ¶ms); > + tmop = odp_pool_create("timeout_pool", ¶ms); > > if (pool == ODP_POOL_INVALID) { > EXAMPLE_ERR("Error: packet pool create failed.\n"); > diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c > index cb8f535..58a9800 100644 > --- a/example/ipsec/odp_ipsec.c > +++ b/example/ipsec/odp_ipsec.c > @@ -347,7 +347,7 @@ void ipsec_init_pre(void) > params.pkt.num = SHM_PKT_POOL_BUF_COUNT; > params.type = ODP_POOL_PACKET; > > - out_pool = odp_pool_create("out_pool", ODP_SHM_NULL, ¶ms); > + out_pool = odp_pool_create("out_pool", ¶ms); > > if (ODP_POOL_INVALID == out_pool) { > EXAMPLE_ERR("Error: message pool create failed.\n"); > @@ -1215,8 +1215,7 @@ main(int argc, char *argv[]) > params.pkt.num = SHM_PKT_POOL_BUF_COUNT; > params.type = ODP_POOL_PACKET; > > - pkt_pool = odp_pool_create("packet_pool", ODP_SHM_NULL, > - ¶ms); > + pkt_pool = odp_pool_create("packet_pool", ¶ms); > > if (ODP_POOL_INVALID == pkt_pool) { > EXAMPLE_ERR("Error: packet pool create failed.\n"); > @@ -1229,8 +1228,7 @@ main(int argc, char *argv[]) > params.buf.num = SHM_CTX_POOL_BUF_COUNT; > params.type = ODP_POOL_BUFFER; > > - ctx_pool = odp_pool_create("ctx_pool", ODP_SHM_NULL, > - ¶ms); > + ctx_pool = odp_pool_create("ctx_pool", ¶ms); > > if (ODP_POOL_INVALID == ctx_pool) { > EXAMPLE_ERR("Error: context pool create failed.\n"); > diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c > index f08d9f4..937146e 100644 > --- a/example/packet/odp_pktio.c > +++ b/example/packet/odp_pktio.c > @@ -368,7 +368,7 @@ int main(int argc, char *argv[]) > params.pkt.num = SHM_PKT_POOL_SIZE/SHM_PKT_POOL_BUF_SIZE; > params.type = ODP_POOL_PACKET; > > - pool = odp_pool_create("packet_pool", ODP_SHM_NULL, ¶ms); > + pool = odp_pool_create("packet_pool", ¶ms); > > if (pool == ODP_POOL_INVALID) { > EXAMPLE_ERR("Error: packet pool create failed.\n"); > diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c > index 5e4306e..196cdf8 100644 > --- a/example/timer/odp_timer_test.c > +++ b/example/timer/odp_timer_test.c > @@ -418,7 +418,7 @@ int main(int argc, char *argv[]) > params.tmo.num = NUM_TMOS; > params.type = ODP_POOL_TIMEOUT; > > - gbls->pool = odp_pool_create("msg_pool", ODP_SHM_NULL, ¶ms); > + gbls->pool = odp_pool_create("msg_pool", ¶ms); > > if (gbls->pool == ODP_POOL_INVALID) { > EXAMPLE_ERR("Pool create failed.\n"); > diff --git a/include/odp/api/pool.h b/include/odp/api/pool.h > index e5061ab..a76563a 100644 > --- a/include/odp/api/pool.h > +++ b/include/odp/api/pool.h > @@ -99,28 +99,22 @@ typedef struct odp_pool_param_t { > > /** > * Create a pool > - * This routine is used to create a pool. It take three > - * arguments: the optional name of the pool to be created, an optional shared > - * memory handle, and a parameter struct that describes the pool to be > - * created. If a name is not specified the result is an anonymous pool that > - * cannot be referenced by odp_pool_lookup(). > + * > + * This routine is used to create a pool. It take two arguments: the optional > + * name of the pool to be created and a parameter struct that describes the > + * pool to be created. If a name is not specified the result is an anonymous > + * pool that cannot be referenced by odp_pool_lookup(). > * > * @param name Name of the pool, max ODP_POOL_NAME_LEN-1 chars. > * May be specified as NULL for anonymous pools. > * > - * @param shm The shared memory object in which to create the pool. > - * Use ODP_SHM_NULL to reserve default memory type > - * for the pool type. > - * > * @param params Pool parameters. > * > * @return Handle of the created pool > * @retval ODP_POOL_INVALID Pool could not be created > */ > > -odp_pool_t odp_pool_create(const char *name, > - odp_shm_t shm, > - odp_pool_param_t *params); > +odp_pool_t odp_pool_create(const char *name, odp_pool_param_t *params); > > /** > * Destroy a pool previously created by odp_pool_create() Not shown in this diff, but there's a @note against odp_pool_destroy() that refers to the shared memory handle and therefore needs an update.
OK, will post a v2 to cover both Maxim's and Stuart's comments. Thanks. On Tue, Jun 2, 2015 at 6:08 AM, Stuart Haslam <stuart.haslam@linaro.org> wrote: > On Sun, May 31, 2015 at 03:38:55PM -0500, Bill Fischofer wrote: > > Implement card https://cards.linaro.org/browse/LNG-925 > > > > Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org> > > --- > > example/classifier/odp_classifier.c | 2 +- > > example/generator/odp_generator.c | 4 +- > > example/ipsec/odp_ipsec.c | 8 ++-- > > example/packet/odp_pktio.c | 2 +- > > example/timer/odp_timer_test.c | 2 +- > > include/odp/api/pool.h | 23 +++------ > > platform/linux-generic/odp_pool.c | 54 > +++++----------------- > > platform/linux-generic/odp_schedule.c | 2 +- > > test/performance/odp_l2fwd.c | 2 +- > > test/performance/odp_pktio_perf.c | 5 +- > > test/performance/odp_scheduling.c | 2 +- > > .../classification/odp_classification_tests.c | 3 +- > > test/validation/odp_buffer.c | 6 +-- > > test/validation/odp_crypto.c | 2 +- > > test/validation/odp_packet.c | 4 +- > > test/validation/odp_pktio.c | 5 +- > > test/validation/odp_pool.c | 32 +------------ > > test/validation/odp_queue.c | 2 +- > > test/validation/odp_scheduler.c | 4 +- > > test/validation/odp_timer.c | 8 ++-- > > 20 files changed, 49 insertions(+), 123 deletions(-) > > > > diff --git a/example/classifier/odp_classifier.c > b/example/classifier/odp_classifier.c > > index 48fc1ab..22f9413 100644 > > --- a/example/classifier/odp_classifier.c > > +++ b/example/classifier/odp_classifier.c > > @@ -433,7 +433,7 @@ int main(int argc, char *argv[]) > > params.pkt.num = SHM_PKT_POOL_SIZE/SHM_PKT_POOL_BUF_SIZE; > > params.type = ODP_POOL_PACKET; > > > > - pool = odp_pool_create("packet_pool", ODP_SHM_NULL, ¶ms); > > + pool = odp_pool_create("packet_pool", ¶ms); > > > > if (pool == ODP_POOL_INVALID) { > > EXAMPLE_ERR("Error: packet pool create failed.\n"); > > diff --git a/example/generator/odp_generator.c > b/example/generator/odp_generator.c > > index 8ae5b29..ed8fd50 100644 > > --- a/example/generator/odp_generator.c > > +++ b/example/generator/odp_generator.c > > @@ -654,7 +654,7 @@ int main(int argc, char *argv[]) > > params.pkt.num = SHM_PKT_POOL_SIZE/SHM_PKT_POOL_BUF_SIZE; > > params.type = ODP_POOL_PACKET; > > > > - pool = odp_pool_create("packet_pool", ODP_SHM_NULL, ¶ms); > > + pool = odp_pool_create("packet_pool", ¶ms); > > > > if (pool == ODP_POOL_INVALID) { > > EXAMPLE_ERR("Error: packet pool create failed.\n"); > > @@ -681,7 +681,7 @@ int main(int argc, char *argv[]) > > params.tmo.num = tparams.num_timers; /* One timeout per timer > */ > > params.type = ODP_POOL_TIMEOUT; > > > > - tmop = odp_pool_create("timeout_pool", ODP_SHM_NULL, ¶ms); > > + tmop = odp_pool_create("timeout_pool", ¶ms); > > > > if (pool == ODP_POOL_INVALID) { > > EXAMPLE_ERR("Error: packet pool create failed.\n"); > > diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c > > index cb8f535..58a9800 100644 > > --- a/example/ipsec/odp_ipsec.c > > +++ b/example/ipsec/odp_ipsec.c > > @@ -347,7 +347,7 @@ void ipsec_init_pre(void) > > params.pkt.num = SHM_PKT_POOL_BUF_COUNT; > > params.type = ODP_POOL_PACKET; > > > > - out_pool = odp_pool_create("out_pool", ODP_SHM_NULL, ¶ms); > > + out_pool = odp_pool_create("out_pool", ¶ms); > > > > if (ODP_POOL_INVALID == out_pool) { > > EXAMPLE_ERR("Error: message pool create failed.\n"); > > @@ -1215,8 +1215,7 @@ main(int argc, char *argv[]) > > params.pkt.num = SHM_PKT_POOL_BUF_COUNT; > > params.type = ODP_POOL_PACKET; > > > > - pkt_pool = odp_pool_create("packet_pool", ODP_SHM_NULL, > > - ¶ms); > > + pkt_pool = odp_pool_create("packet_pool", ¶ms); > > > > if (ODP_POOL_INVALID == pkt_pool) { > > EXAMPLE_ERR("Error: packet pool create failed.\n"); > > @@ -1229,8 +1228,7 @@ main(int argc, char *argv[]) > > params.buf.num = SHM_CTX_POOL_BUF_COUNT; > > params.type = ODP_POOL_BUFFER; > > > > - ctx_pool = odp_pool_create("ctx_pool", ODP_SHM_NULL, > > - ¶ms); > > + ctx_pool = odp_pool_create("ctx_pool", ¶ms); > > > > if (ODP_POOL_INVALID == ctx_pool) { > > EXAMPLE_ERR("Error: context pool create failed.\n"); > > diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c > > index f08d9f4..937146e 100644 > > --- a/example/packet/odp_pktio.c > > +++ b/example/packet/odp_pktio.c > > @@ -368,7 +368,7 @@ int main(int argc, char *argv[]) > > params.pkt.num = SHM_PKT_POOL_SIZE/SHM_PKT_POOL_BUF_SIZE; > > params.type = ODP_POOL_PACKET; > > > > - pool = odp_pool_create("packet_pool", ODP_SHM_NULL, ¶ms); > > + pool = odp_pool_create("packet_pool", ¶ms); > > > > if (pool == ODP_POOL_INVALID) { > > EXAMPLE_ERR("Error: packet pool create failed.\n"); > > diff --git a/example/timer/odp_timer_test.c > b/example/timer/odp_timer_test.c > > index 5e4306e..196cdf8 100644 > > --- a/example/timer/odp_timer_test.c > > +++ b/example/timer/odp_timer_test.c > > @@ -418,7 +418,7 @@ int main(int argc, char *argv[]) > > params.tmo.num = NUM_TMOS; > > params.type = ODP_POOL_TIMEOUT; > > > > - gbls->pool = odp_pool_create("msg_pool", ODP_SHM_NULL, ¶ms); > > + gbls->pool = odp_pool_create("msg_pool", ¶ms); > > > > if (gbls->pool == ODP_POOL_INVALID) { > > EXAMPLE_ERR("Pool create failed.\n"); > > diff --git a/include/odp/api/pool.h b/include/odp/api/pool.h > > index e5061ab..a76563a 100644 > > --- a/include/odp/api/pool.h > > +++ b/include/odp/api/pool.h > > @@ -99,28 +99,22 @@ typedef struct odp_pool_param_t { > > > > /** > > * Create a pool > > - * This routine is used to create a pool. It take three > > - * arguments: the optional name of the pool to be created, an optional > shared > > - * memory handle, and a parameter struct that describes the pool to be > > - * created. If a name is not specified the result is an anonymous pool > that > > - * cannot be referenced by odp_pool_lookup(). > > + * > > + * This routine is used to create a pool. It take two arguments: the > optional > > + * name of the pool to be created and a parameter struct that describes > the > > + * pool to be created. If a name is not specified the result is an > anonymous > > + * pool that cannot be referenced by odp_pool_lookup(). > > * > > * @param name Name of the pool, max ODP_POOL_NAME_LEN-1 chars. > > * May be specified as NULL for anonymous pools. > > * > > - * @param shm The shared memory object in which to create the pool. > > - * Use ODP_SHM_NULL to reserve default memory type > > - * for the pool type. > > - * > > * @param params Pool parameters. > > * > > * @return Handle of the created pool > > * @retval ODP_POOL_INVALID Pool could not be created > > */ > > > > -odp_pool_t odp_pool_create(const char *name, > > - odp_shm_t shm, > > - odp_pool_param_t *params); > > +odp_pool_t odp_pool_create(const char *name, odp_pool_param_t *params); > > > > /** > > * Destroy a pool previously created by odp_pool_create() > > Not shown in this diff, but there's a @note against odp_pool_destroy() > that refers to the shared memory handle and therefore needs an update. > > -- > Stuart. >
diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c index 48fc1ab..22f9413 100644 --- a/example/classifier/odp_classifier.c +++ b/example/classifier/odp_classifier.c @@ -433,7 +433,7 @@ int main(int argc, char *argv[]) params.pkt.num = SHM_PKT_POOL_SIZE/SHM_PKT_POOL_BUF_SIZE; params.type = ODP_POOL_PACKET; - pool = odp_pool_create("packet_pool", ODP_SHM_NULL, ¶ms); + pool = odp_pool_create("packet_pool", ¶ms); if (pool == ODP_POOL_INVALID) { EXAMPLE_ERR("Error: packet pool create failed.\n"); diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index 8ae5b29..ed8fd50 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -654,7 +654,7 @@ int main(int argc, char *argv[]) params.pkt.num = SHM_PKT_POOL_SIZE/SHM_PKT_POOL_BUF_SIZE; params.type = ODP_POOL_PACKET; - pool = odp_pool_create("packet_pool", ODP_SHM_NULL, ¶ms); + pool = odp_pool_create("packet_pool", ¶ms); if (pool == ODP_POOL_INVALID) { EXAMPLE_ERR("Error: packet pool create failed.\n"); @@ -681,7 +681,7 @@ int main(int argc, char *argv[]) params.tmo.num = tparams.num_timers; /* One timeout per timer */ params.type = ODP_POOL_TIMEOUT; - tmop = odp_pool_create("timeout_pool", ODP_SHM_NULL, ¶ms); + tmop = odp_pool_create("timeout_pool", ¶ms); if (pool == ODP_POOL_INVALID) { EXAMPLE_ERR("Error: packet pool create failed.\n"); diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index cb8f535..58a9800 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -347,7 +347,7 @@ void ipsec_init_pre(void) params.pkt.num = SHM_PKT_POOL_BUF_COUNT; params.type = ODP_POOL_PACKET; - out_pool = odp_pool_create("out_pool", ODP_SHM_NULL, ¶ms); + out_pool = odp_pool_create("out_pool", ¶ms); if (ODP_POOL_INVALID == out_pool) { EXAMPLE_ERR("Error: message pool create failed.\n"); @@ -1215,8 +1215,7 @@ main(int argc, char *argv[]) params.pkt.num = SHM_PKT_POOL_BUF_COUNT; params.type = ODP_POOL_PACKET; - pkt_pool = odp_pool_create("packet_pool", ODP_SHM_NULL, - ¶ms); + pkt_pool = odp_pool_create("packet_pool", ¶ms); if (ODP_POOL_INVALID == pkt_pool) { EXAMPLE_ERR("Error: packet pool create failed.\n"); @@ -1229,8 +1228,7 @@ main(int argc, char *argv[]) params.buf.num = SHM_CTX_POOL_BUF_COUNT; params.type = ODP_POOL_BUFFER; - ctx_pool = odp_pool_create("ctx_pool", ODP_SHM_NULL, - ¶ms); + ctx_pool = odp_pool_create("ctx_pool", ¶ms); if (ODP_POOL_INVALID == ctx_pool) { EXAMPLE_ERR("Error: context pool create failed.\n"); diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c index f08d9f4..937146e 100644 --- a/example/packet/odp_pktio.c +++ b/example/packet/odp_pktio.c @@ -368,7 +368,7 @@ int main(int argc, char *argv[]) params.pkt.num = SHM_PKT_POOL_SIZE/SHM_PKT_POOL_BUF_SIZE; params.type = ODP_POOL_PACKET; - pool = odp_pool_create("packet_pool", ODP_SHM_NULL, ¶ms); + pool = odp_pool_create("packet_pool", ¶ms); if (pool == ODP_POOL_INVALID) { EXAMPLE_ERR("Error: packet pool create failed.\n"); diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c index 5e4306e..196cdf8 100644 --- a/example/timer/odp_timer_test.c +++ b/example/timer/odp_timer_test.c @@ -418,7 +418,7 @@ int main(int argc, char *argv[]) params.tmo.num = NUM_TMOS; params.type = ODP_POOL_TIMEOUT; - gbls->pool = odp_pool_create("msg_pool", ODP_SHM_NULL, ¶ms); + gbls->pool = odp_pool_create("msg_pool", ¶ms); if (gbls->pool == ODP_POOL_INVALID) { EXAMPLE_ERR("Pool create failed.\n"); diff --git a/include/odp/api/pool.h b/include/odp/api/pool.h index e5061ab..a76563a 100644 --- a/include/odp/api/pool.h +++ b/include/odp/api/pool.h @@ -99,28 +99,22 @@ typedef struct odp_pool_param_t { /** * Create a pool - * This routine is used to create a pool. It take three - * arguments: the optional name of the pool to be created, an optional shared - * memory handle, and a parameter struct that describes the pool to be - * created. If a name is not specified the result is an anonymous pool that - * cannot be referenced by odp_pool_lookup(). + * + * This routine is used to create a pool. It take two arguments: the optional + * name of the pool to be created and a parameter struct that describes the + * pool to be created. If a name is not specified the result is an anonymous + * pool that cannot be referenced by odp_pool_lookup(). * * @param name Name of the pool, max ODP_POOL_NAME_LEN-1 chars. * May be specified as NULL for anonymous pools. * - * @param shm The shared memory object in which to create the pool. - * Use ODP_SHM_NULL to reserve default memory type - * for the pool type. - * * @param params Pool parameters. * * @return Handle of the created pool * @retval ODP_POOL_INVALID Pool could not be created */ -odp_pool_t odp_pool_create(const char *name, - odp_shm_t shm, - odp_pool_param_t *params); +odp_pool_t odp_pool_create(const char *name, odp_pool_param_t *params); /** * Destroy a pool previously created by odp_pool_create() @@ -160,11 +154,6 @@ odp_pool_t odp_pool_lookup(const char *name); */ typedef struct odp_pool_info_t { const char *name; /**< pool name */ - odp_shm_t shm; /**< handle of shared memory area - supplied by application to - contain pool, or - ODP_SHM_INVALID if this pool is - managed by ODP */ odp_pool_param_t params; /**< pool parameters */ } odp_pool_info_t; diff --git a/platform/linux-generic/odp_pool.c b/platform/linux-generic/odp_pool.c index cd2c449..0a75409 100644 --- a/platform/linux-generic/odp_pool.c +++ b/platform/linux-generic/odp_pool.c @@ -144,13 +144,12 @@ 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 odp_pool_create(const char *name, odp_pool_param_t *params) { odp_pool_t pool_hdl = ODP_POOL_INVALID; pool_entry_t *pool; uint32_t i, headroom = 0, tailroom = 0; + odp_shm_t shm; if (params == NULL) return ODP_POOL_INVALID; @@ -289,38 +288,14 @@ odp_pool_t odp_pool_create(const char *name, mdata_size + udata_size); - if (shm == ODP_SHM_NULL) { - shm = odp_shm_reserve(pool->s.name, - pool->s.pool_size, - ODP_PAGE_SIZE, 0); - if (shm == ODP_SHM_INVALID) { - POOL_UNLOCK(&pool->s.lock); - return ODP_POOL_INVALID; - } - pool->s.pool_base_addr = odp_shm_addr(shm); - } else { - odp_shm_info_t info; - if (odp_shm_info(shm, &info) != 0 || - info.size < pool->s.pool_size) { - POOL_UNLOCK(&pool->s.lock); - return ODP_POOL_INVALID; - } - pool->s.pool_base_addr = odp_shm_addr(shm); - void *page_addr = - ODP_ALIGN_ROUNDUP_PTR(pool->s.pool_base_addr, - ODP_PAGE_SIZE); - if (pool->s.pool_base_addr != page_addr) { - if (info.size < pool->s.pool_size + - ((size_t)page_addr - - (size_t)pool->s.pool_base_addr)) { - POOL_UNLOCK(&pool->s.lock); - return ODP_POOL_INVALID; - } - pool->s.pool_base_addr = page_addr; - } - pool->s.flags.user_supplied_shm = 1; + shm = odp_shm_reserve(pool->s.name, + pool->s.pool_size, + ODP_PAGE_SIZE, 0); + if (shm == ODP_SHM_INVALID) { + POOL_UNLOCK(&pool->s.lock); + return ODP_POOL_INVALID; } - + pool->s.pool_base_addr = odp_shm_addr(shm); pool->s.pool_shm = shm; /* Now safe to unlock since pool entry has been allocated */ @@ -458,8 +433,6 @@ int odp_pool_info(odp_pool_t pool_hdl, odp_pool_info_t *info) return -1; info->name = pool->s.name; - info->shm = pool->s.flags.user_supplied_shm ? - pool->s.pool_shm : ODP_SHM_INVALID; info->params = pool->s.params; return 0; @@ -491,9 +464,7 @@ int odp_pool_destroy(odp_pool_t pool_hdl) return -1; } - if (!pool->s.flags.user_supplied_shm) - odp_shm_free(pool->s.pool_shm); - + odp_shm_free(pool->s.pool_shm); pool->s.pool_shm = ODP_SHM_INVALID; POOL_UNLOCK(&pool->s.lock); @@ -606,9 +577,8 @@ void odp_pool_print(odp_pool_t pool_hdl) (pool->s.params.type == ODP_POOL_PACKET ? "packet" : (pool->s.params.type == ODP_POOL_TIMEOUT ? "timeout" : "unknown"))); - ODP_DBG(" pool storage %sODP managed\n", - pool->s.flags.user_supplied_shm ? - "application provided, " : ""); + ODP_DBG(" pool storage ODP managed shm handle %" PRIu64 "\n", + odp_shm_to_u64(pool->s.pool_shm)); ODP_DBG(" pool status %s\n", pool->s.quiesced ? "quiesced" : "active"); ODP_DBG(" pool opts %s, %s, %s\n", diff --git a/platform/linux-generic/odp_schedule.c b/platform/linux-generic/odp_schedule.c index 7fe42d7..d7289d0 100644 --- a/platform/linux-generic/odp_schedule.c +++ b/platform/linux-generic/odp_schedule.c @@ -128,7 +128,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, ¶ms); + pool = odp_pool_create("odp_sched_pool", ¶ms); if (pool == ODP_POOL_INVALID) { ODP_ERR("Schedule init: Pool create failed.\n"); diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c index 5d4b833..97c932f 100644 --- a/test/performance/odp_l2fwd.c +++ b/test/performance/odp_l2fwd.c @@ -415,7 +415,7 @@ int main(int argc, char *argv[]) params.pkt.num = SHM_PKT_POOL_SIZE/SHM_PKT_POOL_BUF_SIZE; params.type = ODP_POOL_PACKET; - pool = odp_pool_create("packet pool", ODP_SHM_NULL, ¶ms); + pool = odp_pool_create("packet pool", ¶ms); if (pool == ODP_POOL_INVALID) { LOG_ERR("Error: packet pool create failed.\n"); diff --git a/test/performance/odp_pktio_perf.c b/test/performance/odp_pktio_perf.c index fbe27a0..4cc4cb4 100644 --- a/test/performance/odp_pktio_perf.c +++ b/test/performance/odp_pktio_perf.c @@ -645,7 +645,7 @@ static odp_pktio_t create_pktio(const char *iface) params.type = ODP_POOL_PACKET; snprintf(pool_name, sizeof(pool_name), "pkt_pool_%s", iface); - pool = odp_pool_create(pool_name, ODP_SHM_NULL, ¶ms); + pool = odp_pool_create(pool_name, ¶ms); if (pool == ODP_POOL_INVALID) return ODP_PKTIO_INVALID; @@ -667,8 +667,7 @@ static int test_init(void) params.pkt.num = PKT_BUF_NUM; params.type = ODP_POOL_PACKET; - transmit_pkt_pool = odp_pool_create("pkt_pool_transmit", - ODP_SHM_NULL, ¶ms); + transmit_pkt_pool = odp_pool_create("pkt_pool_transmit", ¶ms); if (transmit_pkt_pool == ODP_POOL_INVALID) LOG_ABORT("Failed to create transmit pool\n"); diff --git a/test/performance/odp_scheduling.c b/test/performance/odp_scheduling.c index 99f0f9b..609f854 100644 --- a/test/performance/odp_scheduling.c +++ b/test/performance/odp_scheduling.c @@ -916,7 +916,7 @@ int main(int argc, char *argv[]) params.buf.num = MSG_POOL_SIZE/sizeof(test_message_t); params.type = ODP_POOL_BUFFER; - pool = odp_pool_create("msg_pool", ODP_SHM_NULL, ¶ms); + pool = odp_pool_create("msg_pool", ¶ms); if (pool == ODP_POOL_INVALID) { LOG_ERR("Pool create failed.\n"); diff --git a/test/validation/classification/odp_classification_tests.c b/test/validation/classification/odp_classification_tests.c index 131ac91..da6d29f 100644 --- a/test/validation/classification/odp_classification_tests.c +++ b/test/validation/classification/odp_classification_tests.c @@ -283,8 +283,7 @@ int classification_tests_init(void) param.pkt.num = SHM_PKT_NUM_BUFS; param.type = ODP_POOL_PACKET; - pool = odp_pool_create("classification_pool", - ODP_SHM_NULL, ¶m); + pool = odp_pool_create("classification_pool", ¶m); if (ODP_POOL_INVALID == pool) { fprintf(stderr, "Packet pool creation failed.\n"); return -1; diff --git a/test/validation/odp_buffer.c b/test/validation/odp_buffer.c index f2c0c9b..141ecab 100644 --- a/test/validation/odp_buffer.c +++ b/test/validation/odp_buffer.c @@ -25,7 +25,7 @@ static int buffer_testsuite_init(void) .type = ODP_POOL_BUFFER, }; - raw_pool = odp_pool_create("raw_pool", ODP_SHM_INVALID, ¶ms); + raw_pool = odp_pool_create("raw_pool", ¶ms); if (raw_pool == ODP_POOL_INVALID) return -1; raw_buffer = odp_buffer_alloc(raw_pool); @@ -60,7 +60,7 @@ static void buffer_pool_alloc(void) .type = ODP_POOL_BUFFER, }; - pool = odp_pool_create("buffer_pool_alloc", ODP_SHM_INVALID, ¶ms); + pool = odp_pool_create("buffer_pool_alloc", ¶ms); odp_pool_print(pool); /* Try to allocate num items from the pool */ @@ -107,7 +107,7 @@ static void buffer_pool_free(void) .type = ODP_POOL_BUFFER, }; - pool = odp_pool_create("buffer_pool_free", ODP_SHM_INVALID, ¶ms); + pool = odp_pool_create("buffer_pool_free", ¶ms); /* Allocate the only buffer from the pool */ buffer = odp_buffer_alloc(pool); diff --git a/test/validation/odp_crypto.c b/test/validation/odp_crypto.c index 2a20ea1..3070fd5 100644 --- a/test/validation/odp_crypto.c +++ b/test/validation/odp_crypto.c @@ -43,7 +43,7 @@ int tests_global_init(void) params.pkt.num = SHM_PKT_POOL_SIZE/SHM_PKT_POOL_BUF_SIZE; params.type = ODP_POOL_PACKET; - pool = odp_pool_create("packet_pool", ODP_SHM_NULL, ¶ms); + pool = odp_pool_create("packet_pool", ¶ms); if (ODP_POOL_INVALID == pool) { fprintf(stderr, "Packet pool creation failed.\n"); diff --git a/test/validation/odp_packet.c b/test/validation/odp_packet.c index a363438..08c21eb 100644 --- a/test/validation/odp_packet.c +++ b/test/validation/odp_packet.c @@ -48,7 +48,7 @@ static int packet_testsuite_init(void) struct udata_struct *udat; uint32_t udat_size; - packet_pool = odp_pool_create("packet_pool", ODP_SHM_INVALID, ¶ms); + packet_pool = odp_pool_create("packet_pool", ¶ms); if (packet_pool == ODP_POOL_INVALID) return -1; @@ -90,7 +90,7 @@ static void packet_alloc_free(void) .type = ODP_POOL_PACKET, }; - pool = odp_pool_create("packet_pool_alloc", ODP_SHM_INVALID, ¶ms); + pool = odp_pool_create("packet_pool_alloc", ¶ms); /* Allocate the only buffer from the pool */ packet = odp_packet_alloc(pool, packet_len); diff --git a/test/validation/odp_pktio.c b/test/validation/odp_pktio.c index d4bf7bf..1225184 100644 --- a/test/validation/odp_pktio.c +++ b/test/validation/odp_pktio.c @@ -211,8 +211,7 @@ static int default_pool_create(void) params.pkt.num = PKT_BUF_NUM; params.type = ODP_POOL_PACKET; - default_pkt_pool = odp_pool_create("pkt_pool_default", - ODP_SHM_NULL, ¶ms); + default_pkt_pool = odp_pool_create("pkt_pool_default", ¶ms); if (default_pkt_pool == ODP_POOL_INVALID) return -1; @@ -238,7 +237,7 @@ static odp_pktio_t create_pktio(const char *iface) if (pool != ODP_POOL_INVALID) CU_ASSERT(odp_pool_destroy(pool) == 0); - pool = odp_pool_create(pool_name, ODP_SHM_NULL, ¶ms); + pool = odp_pool_create(pool_name, ¶ms); CU_ASSERT(pool != ODP_POOL_INVALID); pktio = odp_pktio_open(iface, pool); diff --git a/test/validation/odp_pool.c b/test/validation/odp_pool.c index 1a518a0..b670e2e 100644 --- a/test/validation/odp_pool.c +++ b/test/validation/odp_pool.c @@ -19,7 +19,7 @@ static void pool_create_destroy(odp_pool_param_t *params) snprintf(pool_name, sizeof(pool_name), "test_pool-%d", pool_name_number++); - pool = odp_pool_create(pool_name, ODP_SHM_INVALID, params); + pool = odp_pool_create(pool_name, params); CU_ASSERT_FATAL(pool != ODP_POOL_INVALID); CU_ASSERT(odp_pool_to_u64(pool) != odp_pool_to_u64(ODP_POOL_INVALID)); @@ -66,32 +66,6 @@ static void pool_create_destroy_timeout(void) pool_create_destroy(¶ms); } -static void pool_create_destroy_buffer_shm(void) -{ - odp_pool_t pool; - odp_shm_t test_shm; - odp_pool_param_t params = { - .buf = { - .size = 1500, - .align = ODP_CACHE_LINE_SIZE, - .num = 10, - }, - .type = ODP_POOL_BUFFER, - }; - - test_shm = odp_shm_reserve("test_shm", - params.buf.size * params.buf.num * 2, - ODP_CACHE_LINE_SIZE, - 0); - CU_ASSERT_FATAL(test_shm != ODP_SHM_INVALID); - - pool = odp_pool_create("test_shm_pool", test_shm, ¶ms); - CU_ASSERT_FATAL(pool != ODP_POOL_INVALID); - - CU_ASSERT(odp_pool_destroy(pool) == 0); - CU_ASSERT(odp_shm_free(test_shm) == 0); -} - static void pool_lookup_info_print(void) { odp_pool_t pool; @@ -106,7 +80,7 @@ static void pool_lookup_info_print(void) .type = ODP_POOL_BUFFER, }; - pool = odp_pool_create(pool_name, ODP_SHM_INVALID, ¶ms); + pool = odp_pool_create(pool_name, ¶ms); CU_ASSERT_FATAL(pool != ODP_POOL_INVALID); pool = odp_pool_lookup(pool_name); @@ -114,7 +88,6 @@ static void pool_lookup_info_print(void) CU_ASSERT_FATAL(odp_pool_info(pool, &info) == 0); CU_ASSERT(strncmp(pool_name, info.name, sizeof(pool_name)) == 0); - CU_ASSERT(info.shm == ODP_SHM_INVALID); CU_ASSERT(params.buf.size <= info.params.buf.size); CU_ASSERT(params.buf.align <= info.params.buf.align); CU_ASSERT(params.buf.num <= info.params.buf.num); @@ -131,7 +104,6 @@ CU_TestInfo pool_tests[] = { _CU_TEST_INFO(pool_create_destroy_buffer), _CU_TEST_INFO(pool_create_destroy_packet), _CU_TEST_INFO(pool_create_destroy_timeout), - _CU_TEST_INFO(pool_create_destroy_buffer_shm), _CU_TEST_INFO(pool_lookup_info_print), CU_TEST_INFO_NULL, }; diff --git a/test/validation/odp_queue.c b/test/validation/odp_queue.c index 5123939..c61842c 100644 --- a/test/validation/odp_queue.c +++ b/test/validation/odp_queue.c @@ -23,7 +23,7 @@ static int init_queue_suite(void) params.buf.num = 1024 * 10; params.type = ODP_POOL_BUFFER; - pool = odp_pool_create("msg_pool", ODP_SHM_NULL, ¶ms); + pool = odp_pool_create("msg_pool", ¶ms); if (ODP_POOL_INVALID == pool) { printf("Pool create failed.\n"); diff --git a/test/validation/odp_scheduler.c b/test/validation/odp_scheduler.c index a3ac505..b48ef3a 100644 --- a/test/validation/odp_scheduler.c +++ b/test/validation/odp_scheduler.c @@ -119,7 +119,7 @@ static void test_schedule_queue_destroy(void) params.buf.num = 1; params.type = ODP_POOL_BUFFER; - p = odp_pool_create("sched_destroy_pool", ODP_SHM_NULL, ¶ms); + p = odp_pool_create("sched_destroy_pool", ¶ms); CU_ASSERT_FATAL(p != ODP_POOL_INVALID); @@ -663,7 +663,7 @@ static int schd_suite_init(void) params.buf.num = MSG_POOL_SIZE/BUF_SIZE; params.type = ODP_POOL_BUFFER; - pool = odp_pool_create(MSG_POOL_NAME, ODP_SHM_NULL, ¶ms); + pool = odp_pool_create(MSG_POOL_NAME, ¶ms); if (pool == ODP_POOL_INVALID) { printf("Pool creation failed (msg).\n"); diff --git a/test/validation/odp_timer.c b/test/validation/odp_timer.c index 554b353..50bf6bd 100644 --- a/test/validation/odp_timer.c +++ b/test/validation/odp_timer.c @@ -64,7 +64,7 @@ static void test_timeout_pool_alloc(void) .type = ODP_POOL_TIMEOUT, }; - pool = odp_pool_create("timeout_pool_alloc", ODP_SHM_NULL, ¶ms); + pool = odp_pool_create("timeout_pool_alloc", ¶ms); odp_pool_print(pool); /* Try to allocate num items from the pool */ @@ -104,7 +104,7 @@ static void test_timeout_pool_free(void) .type = ODP_POOL_TIMEOUT, }; - pool = odp_pool_create("timeout_pool_free", ODP_SHM_NULL, ¶ms); + pool = odp_pool_create("timeout_pool_free", ¶ms); odp_pool_print(pool); /* Allocate the only timeout from the pool */ @@ -139,7 +139,7 @@ static void test_odp_timer_cancel(void) params.tmo.num = 1; params.type = ODP_POOL_TIMEOUT; - pool = odp_pool_create("tmo_pool_for_cancel", ODP_SHM_NULL, ¶ms); + pool = odp_pool_create("tmo_pool_for_cancel", ¶ms); if (pool == ODP_POOL_INVALID) CU_FAIL_FATAL("Timeout pool create failed"); @@ -449,7 +449,7 @@ static void test_odp_timer_all(void) /* Create timeout pools */ params.tmo.num = (NTIMERS + 1) * num_workers; params.type = ODP_POOL_TIMEOUT; - tbp = odp_pool_create("tmo_pool", ODP_SHM_NULL, ¶ms); + tbp = odp_pool_create("tmo_pool", ¶ms); if (tbp == ODP_POOL_INVALID) CU_FAIL_FATAL("Timeout pool create failed");
Implement card https://cards.linaro.org/browse/LNG-925 Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org> --- example/classifier/odp_classifier.c | 2 +- example/generator/odp_generator.c | 4 +- example/ipsec/odp_ipsec.c | 8 ++-- example/packet/odp_pktio.c | 2 +- example/timer/odp_timer_test.c | 2 +- include/odp/api/pool.h | 23 +++------ platform/linux-generic/odp_pool.c | 54 +++++----------------- platform/linux-generic/odp_schedule.c | 2 +- test/performance/odp_l2fwd.c | 2 +- test/performance/odp_pktio_perf.c | 5 +- test/performance/odp_scheduling.c | 2 +- .../classification/odp_classification_tests.c | 3 +- test/validation/odp_buffer.c | 6 +-- test/validation/odp_crypto.c | 2 +- test/validation/odp_packet.c | 4 +- test/validation/odp_pktio.c | 5 +- test/validation/odp_pool.c | 32 +------------ test/validation/odp_queue.c | 2 +- test/validation/odp_scheduler.c | 4 +- test/validation/odp_timer.c | 8 ++-- 20 files changed, 49 insertions(+), 123 deletions(-)