[1/7] app/test: fix unused but set variables

Message ID 20211112140111.922171-2-conor.walsh@intel.com (mailing list archive)
State Superseded, archived
Delegated to: David Marchand
Headers
Series fix unused but set variables |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Conor Walsh Nov. 12, 2021, 2:01 p.m. UTC
  This patch fixes unused but set variables within the following test apps:
 - test distributor perf
 - test thash perf

Bugzilla ID: 881

Fixes: c0de0eb82e40 ("distributor: switch over to new API")
Fixes: 239fffe0402e ("test/thash: add performance tests for Toeplitz hash")

Signed-off-by: Conor Walsh <conor.walsh@intel.com>
Reported-by: Liang Longfeng <longfengx.liang@intel.com>
---
 app/test/test_distributor_perf.c | 3 ---
 app/test/test_thash_perf.c       | 2 ++
 2 files changed, 2 insertions(+), 3 deletions(-)
  

Comments

Vladimir Medvedkin Nov. 12, 2021, 2:29 p.m. UTC | #1
On 12/11/2021 15:01, Conor Walsh wrote:
> This patch fixes unused but set variables within the following test apps:
>   - test distributor perf
>   - test thash perf
> 
> Bugzilla ID: 881
> 
> Fixes: c0de0eb82e40 ("distributor: switch over to new API")
> Fixes: 239fffe0402e ("test/thash: add performance tests for Toeplitz hash")
> 
> Signed-off-by: Conor Walsh <conor.walsh@intel.com>
> Reported-by: Liang Longfeng <longfengx.liang@intel.com>
> ---
>   app/test/test_distributor_perf.c | 3 ---
>   app/test/test_thash_perf.c       | 2 ++
>   2 files changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/app/test/test_distributor_perf.c b/app/test/test_distributor_perf.c
> index fdbeae6d2f..92e330f194 100644
> --- a/app/test/test_distributor_perf.c
> +++ b/app/test/test_distributor_perf.c
> @@ -108,7 +108,6 @@ static int
>   handle_work(void *arg)
>   {
>   	struct rte_distributor *d = arg;
> -	unsigned int count = 0;
>   	unsigned int num = 0;
>   	int i;
>   	unsigned int id = __atomic_fetch_add(&worker_idx, 1, __ATOMIC_RELAXED);
> @@ -120,11 +119,9 @@ handle_work(void *arg)
>   	num = rte_distributor_get_pkt(d, id, buf, buf, num);
>   	while (!quit) {
>   		worker_stats[id].handled_packets += num;
> -		count += num;
>   		num = rte_distributor_get_pkt(d, id, buf, buf, num);
>   	}
>   	worker_stats[id].handled_packets += num;
> -	count += num;
>   	rte_distributor_return_pkt(d, id, buf, num);
>   	return 0;
>   }
> diff --git a/app/test/test_thash_perf.c b/app/test/test_thash_perf.c
> index 7aa9360120..c95785d8bb 100644
> --- a/app/test/test_thash_perf.c
> +++ b/app/test/test_thash_perf.c
> @@ -61,6 +61,8 @@ run_rss_calc(uint32_t *tuples[BATCH_SZ], enum test_rss_type type, int len,
>   	}
>   	end_tsc = rte_rdtsc_precise();
>   
> +	RTE_SET_USED(hash);
> +
>   	return end_tsc - start_tsc;
>   }
>   
> 

Acked-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
  

Patch

diff --git a/app/test/test_distributor_perf.c b/app/test/test_distributor_perf.c
index fdbeae6d2f..92e330f194 100644
--- a/app/test/test_distributor_perf.c
+++ b/app/test/test_distributor_perf.c
@@ -108,7 +108,6 @@  static int
 handle_work(void *arg)
 {
 	struct rte_distributor *d = arg;
-	unsigned int count = 0;
 	unsigned int num = 0;
 	int i;
 	unsigned int id = __atomic_fetch_add(&worker_idx, 1, __ATOMIC_RELAXED);
@@ -120,11 +119,9 @@  handle_work(void *arg)
 	num = rte_distributor_get_pkt(d, id, buf, buf, num);
 	while (!quit) {
 		worker_stats[id].handled_packets += num;
-		count += num;
 		num = rte_distributor_get_pkt(d, id, buf, buf, num);
 	}
 	worker_stats[id].handled_packets += num;
-	count += num;
 	rte_distributor_return_pkt(d, id, buf, num);
 	return 0;
 }
diff --git a/app/test/test_thash_perf.c b/app/test/test_thash_perf.c
index 7aa9360120..c95785d8bb 100644
--- a/app/test/test_thash_perf.c
+++ b/app/test/test_thash_perf.c
@@ -61,6 +61,8 @@  run_rss_calc(uint32_t *tuples[BATCH_SZ], enum test_rss_type type, int len,
 	}
 	end_tsc = rte_rdtsc_precise();
 
+	RTE_SET_USED(hash);
+
 	return end_tsc - start_tsc;
 }