diff mbox

[ODP/PATCH,2/2] test_api:timer: allow send thd to spwan first

Message ID 1407130639-3417-2-git-send-email-santosh.shukla@linaro.org
State Accepted
Commit 189d60606246e99dd746c53f4dfaf1289cab20c7
Headers show

Commit Message

Santosh Shukla Aug. 4, 2014, 5:37 a.m. UTC
currently rx_thread spawn first and at times leads to
tmo search failure for first ping request thats because
send thread not yet pushed tmo entry into ticklist. Making
send_tx thread spawn first avoid rx_ping tmo failure for
initial ping request.

also includes one misc fix, this returning from rx ping
thread even if current tmo search failed, allow other
ping request to process.

Signed-off-by: Santosh Shukla <santosh.shukla@linaro.org>
---
 test/api_test/odp_timer_ping.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 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:
> currently rx_thread spawn first and at times leads to
> tmo search failure for first ping request thats because
> send thread not yet pushed tmo entry into ticklist. Making
> send_tx thread spawn first avoid rx_ping tmo failure for
> initial ping request.
>
> also includes one misc fix, this returning from rx ping
> thread even if current tmo search failed, allow other
> ping request to process.
>
> Signed-off-by: Santosh Shukla <santosh.shukla@linaro.org>
> ---
>   test/api_test/odp_timer_ping.c |   12 ++++++++----
>   1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/test/api_test/odp_timer_ping.c b/test/api_test/odp_timer_ping.c
> index 88650d6..c1cc255 100644
> --- a/test/api_test/odp_timer_ping.c
> +++ b/test/api_test/odp_timer_ping.c
> @@ -94,7 +94,8 @@ static int listen_to_pingack(void)
>   	sd = socket(PF_INET, SOCK_RAW, proto->p_proto);
>   	if (sd < 0) {
>   		ODP_ERR("Listener socket open failed\n");
> -		return -1;
> +		err = -1;
> +		goto err;
>   	}
>   
>   	for (i = 0; i < PING_CNT; i++) {
> @@ -125,8 +126,11 @@ static int listen_to_pingack(void)
>   				if (odp_timer_cancel_tmo(test_timer_ping,
>   							 test_ping_tmo) != 0) {
>   					ODP_ERR("cancel_tmo failed ..exiting listner thread\n");
> +					/* avoid exiting from here even if tmo
> +					 * failed for current ping,
> +					 * allow subsequent ping_rx request */
>   					err = -1;
> -					goto err;
> +
>   				}
>   				/* cruel bad hack used for sender, listner ipc..
>   				 * euwww.. FIXME ..
> @@ -362,9 +366,9 @@ int main(int argc ODP_UNUSED, char *argv[] ODP_UNUSED)
>   		void *(*run_thread) (void *);
>   
>   		if (i == 0)
> -			run_thread = rx_ping;
> -		else
>   			run_thread = send_ping;
> +		else
> +			run_thread = rx_ping;
>   
>   		/* Create and launch worker threads */
>   		odp_linux_pthread_create(&thread_tbl[i], 1, i,
diff mbox

Patch

diff --git a/test/api_test/odp_timer_ping.c b/test/api_test/odp_timer_ping.c
index 88650d6..c1cc255 100644
--- a/test/api_test/odp_timer_ping.c
+++ b/test/api_test/odp_timer_ping.c
@@ -94,7 +94,8 @@  static int listen_to_pingack(void)
 	sd = socket(PF_INET, SOCK_RAW, proto->p_proto);
 	if (sd < 0) {
 		ODP_ERR("Listener socket open failed\n");
-		return -1;
+		err = -1;
+		goto err;
 	}
 
 	for (i = 0; i < PING_CNT; i++) {
@@ -125,8 +126,11 @@  static int listen_to_pingack(void)
 				if (odp_timer_cancel_tmo(test_timer_ping,
 							 test_ping_tmo) != 0) {
 					ODP_ERR("cancel_tmo failed ..exiting listner thread\n");
+					/* avoid exiting from here even if tmo
+					 * failed for current ping,
+					 * allow subsequent ping_rx request */
 					err = -1;
-					goto err;
+
 				}
 				/* cruel bad hack used for sender, listner ipc..
 				 * euwww.. FIXME ..
@@ -362,9 +366,9 @@  int main(int argc ODP_UNUSED, char *argv[] ODP_UNUSED)
 		void *(*run_thread) (void *);
 
 		if (i == 0)
-			run_thread = rx_ping;
-		else
 			run_thread = send_ping;
+		else
+			run_thread = rx_ping;
 
 		/* Create and launch worker threads */
 		odp_linux_pthread_create(&thread_tbl[i], 1, i,