[v2,2/4] test/lpm: return error on failure in rcu qsbr perf

Message ID 20201102235203.6342-3-dharmik.thakkar@arm.com (mailing list archive)
State Superseded, archived
Delegated to: David Marchand
Headers
Series test/lpm: fix rcu qsbr perf test |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Dharmik Thakkar Nov. 2, 2020, 11:52 p.m. UTC
  Return error if Add/Delete fail in multiwriter perf test

Fixes: eff30b59cc2e ("test/lpm: add RCU performance tests")
Cc: honnappa.nagarahalli@arm.com
Cc: stable@dpdk.org

Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 app/test/test_lpm_perf.c | 4 ++++
 1 file changed, 4 insertions(+)
  

Comments

Honnappa Nagarahalli Nov. 3, 2020, 1:28 a.m. UTC | #1
<snip>

> 
> Return error if Add/Delete fail in multiwriter perf test
> 
> Fixes: eff30b59cc2e ("test/lpm: add RCU performance tests")
> Cc: honnappa.nagarahalli@arm.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> ---
>  app/test/test_lpm_perf.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/app/test/test_lpm_perf.c b/app/test/test_lpm_perf.c index
> 45164b23214b..55084816ab91 100644
> --- a/app/test/test_lpm_perf.c
> +++ b/app/test/test_lpm_perf.c
> @@ -453,6 +453,8 @@ test_lpm_rcu_qsbr_writer(void *arg)
>  					next_hop_add) != 0) {
>  				printf("Failed to add iteration %d, route#
> %d\n",
>  					i, j);
> +				pthread_mutex_unlock(&lpm_mutex);
> +				return -1;
Would be good to use the "goto error" method used in this file in other functions.

>  			}
>  			pthread_mutex_unlock(&lpm_mutex);
>  		}
> @@ -464,6 +466,8 @@ test_lpm_rcu_qsbr_writer(void *arg)
>  				large_ldepth_route_table[j].depth) != 0) {
>  				printf("Failed to delete iteration %d, route#
> %d\n",
>  					i, j);
> +				pthread_mutex_unlock(&lpm_mutex);
> +				return -1;
>  			}
>  			pthread_mutex_unlock(&lpm_mutex);
>  		}
> --
> 2.17.1
  
Dharmik Thakkar Nov. 3, 2020, 4:42 a.m. UTC | #2
> On Nov 2, 2020, at 7:28 PM, Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com> wrote:
> 
> <snip>
> 
>> 
>> Return error if Add/Delete fail in multiwriter perf test
>> 
>> Fixes: eff30b59cc2e ("test/lpm: add RCU performance tests")
>> Cc: honnappa.nagarahalli@arm.com
>> Cc: stable@dpdk.org
>> 
>> Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
>> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
>> ---
>> app/test/test_lpm_perf.c | 4 ++++
>> 1 file changed, 4 insertions(+)
>> 
>> diff --git a/app/test/test_lpm_perf.c b/app/test/test_lpm_perf.c index
>> 45164b23214b..55084816ab91 100644
>> --- a/app/test/test_lpm_perf.c
>> +++ b/app/test/test_lpm_perf.c
>> @@ -453,6 +453,8 @@ test_lpm_rcu_qsbr_writer(void *arg)
>> 					next_hop_add) != 0) {
>> 				printf("Failed to add iteration %d, route#
>> %d\n",
>> 					i, j);
>> +				pthread_mutex_unlock(&lpm_mutex);
>> +				return -1;
> Would be good to use the "goto error" method used in this file in other functions.

Yes, will update in the next version.

> 
>> 			}
>> 			pthread_mutex_unlock(&lpm_mutex);
>> 		}
>> @@ -464,6 +466,8 @@ test_lpm_rcu_qsbr_writer(void *arg)
>> 				large_ldepth_route_table[j].depth) != 0) {
>> 				printf("Failed to delete iteration %d, route#
>> %d\n",
>> 					i, j);
>> +				pthread_mutex_unlock(&lpm_mutex);
>> +				return -1;
>> 			}
>> 			pthread_mutex_unlock(&lpm_mutex);
>> 		}
>> --
>> 2.17.1
  

Patch

diff --git a/app/test/test_lpm_perf.c b/app/test/test_lpm_perf.c
index 45164b23214b..55084816ab91 100644
--- a/app/test/test_lpm_perf.c
+++ b/app/test/test_lpm_perf.c
@@ -453,6 +453,8 @@  test_lpm_rcu_qsbr_writer(void *arg)
 					next_hop_add) != 0) {
 				printf("Failed to add iteration %d, route# %d\n",
 					i, j);
+				pthread_mutex_unlock(&lpm_mutex);
+				return -1;
 			}
 			pthread_mutex_unlock(&lpm_mutex);
 		}
@@ -464,6 +466,8 @@  test_lpm_rcu_qsbr_writer(void *arg)
 				large_ldepth_route_table[j].depth) != 0) {
 				printf("Failed to delete iteration %d, route# %d\n",
 					i, j);
+				pthread_mutex_unlock(&lpm_mutex);
+				return -1;
 			}
 			pthread_mutex_unlock(&lpm_mutex);
 		}