diff mbox

[ODP/PATCH,1/2] linux-generic: Fix incorrect thread_tbl index in apps

Message ID 1407130639-3417-1-git-send-email-santosh.shukla@linaro.org
State Accepted
Commit 3a00de5701c80e0feedb3664ec572cb7ac86fb9e
Headers show

Commit Message

Santosh Shukla Aug. 4, 2014, 5:37 a.m. UTC
few of odp example and test application passing
incorrect thread_tbl index entry (thread_tbl base addr)
to odp_linux_pthread_create(thread_tbl^^, 1, ..) api.

This patch a common fix for those odp application.

Signed-off-by: Santosh Shukla <santosh.shukla@linaro.org>
---
Note -
tested only odp_timer_ping application, works
fine avoid segfault for pthread_join, Its a trivial
fix should work for all other application.

appl module original author pl. raise your concerns
incase if you suspect on this patch. Thanks.


 example/generator/odp_generator.c        |    6 +++---
 example/l2fwd/odp_l2fwd.c                |    2 +-
 example/packet/odp_pktio.c               |    2 +-
 example/packet_netmap/odp_pktio_netmap.c |    4 ++--
 test/api_test/odp_timer_ping.c           |    2 +-
 5 files changed, 8 insertions(+), 8 deletions(-)

Comments

Maxim Uvarov Aug. 6, 2014, 7:52 p.m. UTC | #1
applied thanks!

Maxim.

On 08/04/2014 09:37 AM, Santosh Shukla wrote:
> few of odp example and test application passing
> incorrect thread_tbl index entry (thread_tbl base addr)
> to odp_linux_pthread_create(thread_tbl^^, 1, ..) api.
>
> This patch a common fix for those odp application.
>
> Signed-off-by: Santosh Shukla <santosh.shukla@linaro.org>
> ---
> Note -
> tested only odp_timer_ping application, works
> fine avoid segfault for pthread_join, Its a trivial
> fix should work for all other application.
>
> appl module original author pl. raise your concerns
> incase if you suspect on this patch. Thanks.
>
>
>   example/generator/odp_generator.c        |    6 +++---
>   example/l2fwd/odp_l2fwd.c                |    2 +-
>   example/packet/odp_pktio.c               |    2 +-
>   example/packet_netmap/odp_pktio_netmap.c |    4 ++--
>   test/api_test/odp_timer_ping.c           |    2 +-
>   5 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c
> index e4a72fa..b10372e 100644
> --- a/example/generator/odp_generator.c
> +++ b/example/generator/odp_generator.c
> @@ -611,13 +611,13 @@ int main(int argc, char *argv[])
>   		args->thread[1].pktio_dev = args->appl.if_names[0];
>   		args->thread[1].pool = pool;
>   		args->thread[1].mode = args->appl.mode;
> -		odp_linux_pthread_create(thread_tbl, 1, 0,
> +		odp_linux_pthread_create(&thread_tbl[1], 1, 0,
>   					 gen_recv_thread, &args->thread[1]);
>   
>   		args->thread[0].pktio_dev = args->appl.if_names[0];
>   		args->thread[0].pool = pool;
>   		args->thread[0].mode = args->appl.mode;
> -		odp_linux_pthread_create(thread_tbl, 1, 0,
> +		odp_linux_pthread_create(&thread_tbl[0], 1, 0,
>   					 gen_send_thread, &args->thread[0]);
>   
>   		/* only wait send thread to join */
> @@ -649,7 +649,7 @@ int main(int argc, char *argv[])
>   			 * because each thread might get different arguments.
>   			 * Calls odp_thread_create(cpu) for each thread
>   			 */
> -			odp_linux_pthread_create(thread_tbl, 1,
> +			odp_linux_pthread_create(&thread_tbl[i], 1,
>   						 core, thr_run_func,
>   						 &args->thread[i]);
>   		}
> diff --git a/example/l2fwd/odp_l2fwd.c b/example/l2fwd/odp_l2fwd.c
> index e331ff2..f89ea7a 100644
> --- a/example/l2fwd/odp_l2fwd.c
> +++ b/example/l2fwd/odp_l2fwd.c
> @@ -411,7 +411,7 @@ int main(int argc, char *argv[])
>   			thr_run_func = pktio_ifburst_thread;
>   		else /* APPL_MODE_PKT_QUEUE */
>   			thr_run_func = pktio_queue_thread;
> -		odp_linux_pthread_create(thread_tbl, 1, core, thr_run_func,
> +		odp_linux_pthread_create(&thread_tbl[i], 1, core, thr_run_func,
>   					 &gbl_args->thread[i]);
>   	}
>   
> diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
> index edf8cfd..247a28a 100644
> --- a/example/packet/odp_pktio.c
> +++ b/example/packet/odp_pktio.c
> @@ -375,7 +375,7 @@ int main(int argc, char *argv[])
>   		 * because each thread might get different arguments.
>   		 * Calls odp_thread_create(cpu) for each thread
>   		 */
> -		odp_linux_pthread_create(thread_tbl, 1, core, thr_run_func,
> +		odp_linux_pthread_create(&thread_tbl[i], 1, core, thr_run_func,
>   					 &args->thread[i]);
>   	}
>   
> diff --git a/example/packet_netmap/odp_pktio_netmap.c b/example/packet_netmap/odp_pktio_netmap.c
> index 7d33b19..b49aa61 100644
> --- a/example/packet_netmap/odp_pktio_netmap.c
> +++ b/example/packet_netmap/odp_pktio_netmap.c
> @@ -334,8 +334,8 @@ int main(int argc, char *argv[])
>   		 * Create threads one-by-one instead of all-at-once,
>   		 * because each thread might get different arguments
>   		 */
> -		odp_linux_pthread_create(thread_tbl, 1, i, pktio_queue_thread,
> -					 NULL);
> +		odp_linux_pthread_create(&thread_tbl[i], 1, i,
> +					 pktio_queue_thread, NULL);
>   	}
>   
>   	/* Master thread waits for other threads to exit */
> diff --git a/test/api_test/odp_timer_ping.c b/test/api_test/odp_timer_ping.c
> index cd67e0d..88650d6 100644
> --- a/test/api_test/odp_timer_ping.c
> +++ b/test/api_test/odp_timer_ping.c
> @@ -367,7 +367,7 @@ int main(int argc ODP_UNUSED, char *argv[] ODP_UNUSED)
>   			run_thread = send_ping;
>   
>   		/* Create and launch worker threads */
> -		odp_linux_pthread_create(thread_tbl, 1, i,
> +		odp_linux_pthread_create(&thread_tbl[i], 1, i,
>   					 run_thread, (pthrd_arg *)&pingarg);
>   	}
>
diff mbox

Patch

diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c
index e4a72fa..b10372e 100644
--- a/example/generator/odp_generator.c
+++ b/example/generator/odp_generator.c
@@ -611,13 +611,13 @@  int main(int argc, char *argv[])
 		args->thread[1].pktio_dev = args->appl.if_names[0];
 		args->thread[1].pool = pool;
 		args->thread[1].mode = args->appl.mode;
-		odp_linux_pthread_create(thread_tbl, 1, 0,
+		odp_linux_pthread_create(&thread_tbl[1], 1, 0,
 					 gen_recv_thread, &args->thread[1]);
 
 		args->thread[0].pktio_dev = args->appl.if_names[0];
 		args->thread[0].pool = pool;
 		args->thread[0].mode = args->appl.mode;
-		odp_linux_pthread_create(thread_tbl, 1, 0,
+		odp_linux_pthread_create(&thread_tbl[0], 1, 0,
 					 gen_send_thread, &args->thread[0]);
 
 		/* only wait send thread to join */
@@ -649,7 +649,7 @@  int main(int argc, char *argv[])
 			 * because each thread might get different arguments.
 			 * Calls odp_thread_create(cpu) for each thread
 			 */
-			odp_linux_pthread_create(thread_tbl, 1,
+			odp_linux_pthread_create(&thread_tbl[i], 1,
 						 core, thr_run_func,
 						 &args->thread[i]);
 		}
diff --git a/example/l2fwd/odp_l2fwd.c b/example/l2fwd/odp_l2fwd.c
index e331ff2..f89ea7a 100644
--- a/example/l2fwd/odp_l2fwd.c
+++ b/example/l2fwd/odp_l2fwd.c
@@ -411,7 +411,7 @@  int main(int argc, char *argv[])
 			thr_run_func = pktio_ifburst_thread;
 		else /* APPL_MODE_PKT_QUEUE */
 			thr_run_func = pktio_queue_thread;
-		odp_linux_pthread_create(thread_tbl, 1, core, thr_run_func,
+		odp_linux_pthread_create(&thread_tbl[i], 1, core, thr_run_func,
 					 &gbl_args->thread[i]);
 	}
 
diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
index edf8cfd..247a28a 100644
--- a/example/packet/odp_pktio.c
+++ b/example/packet/odp_pktio.c
@@ -375,7 +375,7 @@  int main(int argc, char *argv[])
 		 * because each thread might get different arguments.
 		 * Calls odp_thread_create(cpu) for each thread
 		 */
-		odp_linux_pthread_create(thread_tbl, 1, core, thr_run_func,
+		odp_linux_pthread_create(&thread_tbl[i], 1, core, thr_run_func,
 					 &args->thread[i]);
 	}
 
diff --git a/example/packet_netmap/odp_pktio_netmap.c b/example/packet_netmap/odp_pktio_netmap.c
index 7d33b19..b49aa61 100644
--- a/example/packet_netmap/odp_pktio_netmap.c
+++ b/example/packet_netmap/odp_pktio_netmap.c
@@ -334,8 +334,8 @@  int main(int argc, char *argv[])
 		 * Create threads one-by-one instead of all-at-once,
 		 * because each thread might get different arguments
 		 */
-		odp_linux_pthread_create(thread_tbl, 1, i, pktio_queue_thread,
-					 NULL);
+		odp_linux_pthread_create(&thread_tbl[i], 1, i,
+					 pktio_queue_thread, NULL);
 	}
 
 	/* Master thread waits for other threads to exit */
diff --git a/test/api_test/odp_timer_ping.c b/test/api_test/odp_timer_ping.c
index cd67e0d..88650d6 100644
--- a/test/api_test/odp_timer_ping.c
+++ b/test/api_test/odp_timer_ping.c
@@ -367,7 +367,7 @@  int main(int argc ODP_UNUSED, char *argv[] ODP_UNUSED)
 			run_thread = send_ping;
 
 		/* Create and launch worker threads */
-		odp_linux_pthread_create(thread_tbl, 1, i,
+		odp_linux_pthread_create(&thread_tbl[i], 1, i,
 					 run_thread, (pthrd_arg *)&pingarg);
 	}