diff mbox

[v2,2/2] Shared memory flag default value

Message ID 1409916551-24327-2-git-send-email-petri.savolainen@linaro.org
State New
Headers show

Commit Message

Petri Savolainen Sept. 5, 2014, 11:29 a.m. UTC
Flags default value is zero (share memory within ODP, include HW
accelerators).

Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>
---
 example/generator/odp_generator.c        |  5 +++--
 example/l2fwd/odp_l2fwd.c                |  5 +++--
 example/odp_example/odp_example.c        |  2 +-
 example/packet/odp_pktio.c               |  5 +++--
 example/timer/odp_timer_test.c           |  2 +-
 platform/linux-generic/odp_buffer_pool.c |  2 +-
 platform/linux-generic/odp_crypto.c      |  3 ++-
 platform/linux-generic/odp_packet_io.c   |  2 +-
 platform/linux-generic/odp_queue.c       |  2 +-
 platform/linux-generic/odp_ring.c        |  2 +-
 platform/linux-generic/odp_schedule.c    | 10 +++++++---
 test/api_test/odp_shm_test.c             |  2 +-
 test/api_test/odp_timer_ping.c           |  2 +-
 13 files changed, 26 insertions(+), 18 deletions(-)
diff mbox

Patch

diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c
index 65c2034..10c7b31 100644
--- a/example/generator/odp_generator.c
+++ b/example/generator/odp_generator.c
@@ -537,7 +537,8 @@  int main(int argc, char *argv[])
 	odp_atomic_init_u64(&counters.icmp);
 
 	/* Reserve memory for args from shared mem */
-	args = odp_shm_reserve("shm_args", sizeof(args_t), ODP_CACHE_LINE_SIZE);
+	args = odp_shm_reserve("shm_args", sizeof(args_t),
+			       ODP_CACHE_LINE_SIZE, 0);
 	if (args == NULL) {
 		ODP_ERR("Error: shared mem alloc failed.\n");
 		exit(EXIT_FAILURE);
@@ -582,7 +583,7 @@  int main(int argc, char *argv[])
 
 	/* Create packet pool */
 	pool_base = odp_shm_reserve("shm_packet_pool",
-				    SHM_PKT_POOL_SIZE, ODP_CACHE_LINE_SIZE);
+				    SHM_PKT_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);
 	if (pool_base == NULL) {
 		ODP_ERR("Error: packet pool mem alloc failed.\n");
 		exit(EXIT_FAILURE);
diff --git a/example/l2fwd/odp_l2fwd.c b/example/l2fwd/odp_l2fwd.c
index 6a38c1b..e19aa94 100644
--- a/example/l2fwd/odp_l2fwd.c
+++ b/example/l2fwd/odp_l2fwd.c
@@ -329,7 +329,8 @@  int main(int argc, char *argv[])
 	}
 
 	/* Reserve memory for args from shared mem */
-	gbl_args = odp_shm_reserve("shm_args", sizeof(args_t), ODP_CACHE_LINE_SIZE);
+	gbl_args = odp_shm_reserve("shm_args", sizeof(args_t),
+				   ODP_CACHE_LINE_SIZE, 0);
 	if (gbl_args == NULL) {
 		ODP_ERR("Error: shared mem alloc failed.\n");
 		exit(EXIT_FAILURE);
@@ -380,7 +381,7 @@  int main(int argc, char *argv[])
 
 	/* Create packet pool */
 	pool_base = odp_shm_reserve("shm_packet_pool",
-				    SHM_PKT_POOL_SIZE, ODP_CACHE_LINE_SIZE);
+				    SHM_PKT_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);
 	if (pool_base == NULL) {
 		ODP_ERR("Error: packet pool mem alloc failed.\n");
 		exit(EXIT_FAILURE);
diff --git a/example/odp_example/odp_example.c b/example/odp_example/odp_example.c
index 40d237b..e99df85 100644
--- a/example/odp_example/odp_example.c
+++ b/example/odp_example/odp_example.c
@@ -1004,7 +1004,7 @@  int main(int argc, char *argv[])
 	 * Create message pool
 	 */
 	pool_base = odp_shm_reserve("msg_pool",
-				    MSG_POOL_SIZE, ODP_CACHE_LINE_SIZE);
+				    MSG_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);
 
 	pool = odp_buffer_pool_create("msg_pool", pool_base, MSG_POOL_SIZE,
 				      sizeof(test_message_t),
diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
index 88ce575..7f2d43f 100644
--- a/example/packet/odp_pktio.c
+++ b/example/packet/odp_pktio.c
@@ -317,7 +317,8 @@  int main(int argc, char *argv[])
 	}
 
 	/* Reserve memory for args from shared mem */
-	args = odp_shm_reserve("shm_args", sizeof(args_t), ODP_CACHE_LINE_SIZE);
+	args = odp_shm_reserve("shm_args", sizeof(args_t),
+			       ODP_CACHE_LINE_SIZE, 0);
 	if (args == NULL) {
 		ODP_ERR("Error: shared mem alloc failed.\n");
 		exit(EXIT_FAILURE);
@@ -358,7 +359,7 @@  int main(int argc, char *argv[])
 
 	/* Create packet pool */
 	pool_base = odp_shm_reserve("shm_packet_pool",
-				    SHM_PKT_POOL_SIZE, ODP_CACHE_LINE_SIZE);
+				    SHM_PKT_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);
 	if (pool_base == NULL) {
 		ODP_ERR("Error: packet pool mem alloc failed.\n");
 		exit(EXIT_FAILURE);
diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c
index 1061190..fd46f16 100644
--- a/example/timer/odp_timer_test.c
+++ b/example/timer/odp_timer_test.c
@@ -311,7 +311,7 @@  int main(int argc, char *argv[])
 	 * Create message pool
 	 */
 	pool_base = odp_shm_reserve("msg_pool",
-				    MSG_POOL_SIZE, ODP_CACHE_LINE_SIZE);
+				    MSG_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);
 
 	pool = odp_buffer_pool_create("msg_pool", pool_base, MSG_POOL_SIZE,
 				      0,
diff --git a/platform/linux-generic/odp_buffer_pool.c b/platform/linux-generic/odp_buffer_pool.c
index e538f04..f54a0c4 100644
--- a/platform/linux-generic/odp_buffer_pool.c
+++ b/platform/linux-generic/odp_buffer_pool.c
@@ -117,7 +117,7 @@  int odp_buffer_pool_init_global(void)
 
 	pool_tbl = odp_shm_reserve("odp_buffer_pools",
 				   sizeof(pool_table_t),
-				   sizeof(pool_entry_t));
+				   sizeof(pool_entry_t), 0);
 
 	if (pool_tbl == NULL)
 		return -1;
diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c
index fae546c..2942a84 100644
--- a/platform/linux-generic/odp_crypto.c
+++ b/platform/linux-generic/odp_crypto.c
@@ -409,7 +409,8 @@  odp_crypto_init_global(void)
 	mem_size += (MAX_SESSIONS * sizeof(odp_crypto_generic_session_t));
 
 	/* Allocate our globally shared memory */
-	global = odp_shm_reserve("crypto_pool", mem_size, ODP_CACHE_LINE_SIZE);
+	global = odp_shm_reserve("crypto_pool", mem_size,
+				 ODP_CACHE_LINE_SIZE, 0);
 
 	/* Clear it out */
 	memset(global, 0, mem_size);
diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c
index 33ade10..944c1d4 100644
--- a/platform/linux-generic/odp_packet_io.c
+++ b/platform/linux-generic/odp_packet_io.c
@@ -55,7 +55,7 @@  int odp_pktio_init_global(void)
 
 	pktio_tbl = odp_shm_reserve("odp_pktio_entries",
 				    sizeof(pktio_table_t),
-				    sizeof(pktio_entry_t));
+				    sizeof(pktio_entry_t), 0);
 	if (pktio_tbl == NULL)
 		return -1;
 
diff --git a/platform/linux-generic/odp_queue.c b/platform/linux-generic/odp_queue.c
index c637bdf..9852598 100644
--- a/platform/linux-generic/odp_queue.c
+++ b/platform/linux-generic/odp_queue.c
@@ -99,7 +99,7 @@  int odp_queue_init_global(void)
 
 	queue_tbl = odp_shm_reserve("odp_queues",
 				    sizeof(queue_table_t),
-				    sizeof(queue_entry_t));
+				    sizeof(queue_entry_t), 0);
 
 	if (queue_tbl == NULL)
 		return -1;
diff --git a/platform/linux-generic/odp_ring.c b/platform/linux-generic/odp_ring.c
index 720d8db..3e72952 100644
--- a/platform/linux-generic/odp_ring.c
+++ b/platform/linux-generic/odp_ring.c
@@ -171,7 +171,7 @@  odph_ring_create(const char *name, unsigned count, unsigned flags)
 
 	odp_rwlock_write_lock(&qlock);
 	/* reserve a memory zone for this ring.*/
-	r = odp_shm_reserve(ring_name, ring_size, ODP_CACHE_LINE_SIZE);
+	r = odp_shm_reserve(ring_name, ring_size, ODP_CACHE_LINE_SIZE, 0);
 
 	if (r != NULL) {
 		/* init the ring structure */
diff --git a/platform/linux-generic/odp_schedule.c b/platform/linux-generic/odp_schedule.c
index 9e399f1..16ae4af 100644
--- a/platform/linux-generic/odp_schedule.c
+++ b/platform/linux-generic/odp_schedule.c
@@ -89,16 +89,20 @@  int odp_schedule_init_global(void)
 
 	sched = odp_shm_reserve("odp_scheduler",
 				sizeof(sched_t),
-				ODP_CACHE_LINE_SIZE);
+				ODP_CACHE_LINE_SIZE, 0);
 
 	if (sched == NULL) {
 		ODP_ERR("Schedule init: Shm reserve failed.\n");
 		return -1;
 	}
 
-
 	pool_base = odp_shm_reserve("odp_sched_pool",
-				    SCHED_POOL_SIZE, ODP_CACHE_LINE_SIZE);
+				    SCHED_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);
+
+	if (pool_base == NULL) {
+		ODP_ERR("Schedule init: Shm reserve failed.\n");
+		return -1;
+	}
 
 	pool = odp_buffer_pool_create("odp_sched_pool", pool_base,
 				      SCHED_POOL_SIZE, sizeof(queue_desc_t),
diff --git a/test/api_test/odp_shm_test.c b/test/api_test/odp_shm_test.c
index 318d662..376b06f 100644
--- a/test/api_test/odp_shm_test.c
+++ b/test/api_test/odp_shm_test.c
@@ -47,7 +47,7 @@  int main(int argc ODP_UNUSED, char *argv[] ODP_UNUSED)
 	odp_print_system_info();
 
 	test_shared_data = odp_shm_reserve("test_shared_data",
-					   sizeof(test_shared_data_t), 128);
+					   sizeof(test_shared_data_t), 128, 0);
 	memset(test_shared_data, 0, sizeof(test_shared_data_t));
 	printf("test shared data at %p\n\n", test_shared_data);
 
diff --git a/test/api_test/odp_timer_ping.c b/test/api_test/odp_timer_ping.c
index 6ba30d3..a31567a 100644
--- a/test/api_test/odp_timer_ping.c
+++ b/test/api_test/odp_timer_ping.c
@@ -328,7 +328,7 @@  int main(int argc ODP_UNUSED, char *argv[] ODP_UNUSED)
 	 * Create message pool
 	 */
 	pool_base = odp_shm_reserve("msg_pool",
-				    MSG_POOL_SIZE, ODP_CACHE_LINE_SIZE);
+				    MSG_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0);
 
 	pool = odp_buffer_pool_create("msg_pool", pool_base, MSG_POOL_SIZE,
 				      BUF_SIZE,