[dpdk-dev] [dpdk-stable] [PATCH] test/hash: reset iter and found in perf test

Ferruh Yigit ferruh.yigit at intel.com
Fri Jan 11 18:10:09 CET 2019


On 11/29/2018 6:38 PM, Dharmik Thakkar wrote:
> Reset 'iter' and 'tbl_rw_test_param.found' on each iteration
> to give correct result for lost and duplicated keys.
> 
> Fixes: 0eb3726ebcf14 ("test/hash: add test for read/write concurrency")
> Cc: stable at dpdk.org
> 
> Signed-off-by: Dharmik Thakkar <dharmik.thakkar at arm.com>
> ---
>  test/test/test_hash_readwrite.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/test/test/test_hash_readwrite.c b/test/test/test_hash_readwrite.c
> index 6b695ce6e444..be93a2ebd270 100644
> --- a/test/test/test_hash_readwrite.c
> +++ b/test/test/test_hash_readwrite.c
> @@ -361,7 +361,6 @@ test_hash_readwrite_perf(struct perf *perf_results, int use_htm,
>  
>  	const void *next_key;
>  	void *next_data;
> -	uint32_t iter = 0;
>  	int use_jhash = 0;
>  
>  	uint32_t duplicated_keys = 0;
> @@ -536,6 +535,8 @@ test_hash_readwrite_perf(struct perf *perf_results, int use_htm,
>  
>  		rte_eal_mp_wait_lcore();
>  
> +		uint32_t iter = 0;

Logically looks good. Only we don't tend to declare the variables in the middle
of the scope, you may prefer to keep deceleration at its place but set 'iter' to
zero here.

> +		memset(tbl_rw_test_param.found, 0, TOTAL_ENTRY);
>  		while (rte_hash_iterate(tbl_rw_test_param.h,
>  				&next_key, &next_data, &iter) >= 0) {
>  			/* Search for the key in the list of keys added .*/
> @@ -619,7 +620,7 @@ test_hash_readwrite_main(void)
>  	if (rte_lcore_count() <= 2) {
>  		printf("More than two lcores are required "
>  			"to do read write test\n");
> -		return 0;
> +		return -1;

This is something not mentioned in the commit log, changes the default return
value of test when not enough resources provided, cc'ed Yipeng for comment.

If decided to keep this change, please update commit log to mention from it.


More information about the dev mailing list