DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jim Harris <james.r.harris@intel.com>
To: dev@dpdk.org, david.hunt@intel.com, david.marchand@redhat.com
Cc: Jim Harris <james.r.harris@intel.com>
Subject: [dpdk-dev] [PATCH v2] power: fix unused-but-set variable error
Date: Fri,  5 Nov 2021 15:53:51 +0000	[thread overview]
Message-ID: <20211105155351.350403-1-james.r.harris@intel.com> (raw)

clang-13 rightfully complains that the tot_ppi
variable in update_stats is set but not used, since
the final accumulated tot_ppi results isn't used
anywhere.

Original idea was to just remove the tot_ppi variable,
but feedback from David Marchand on mailing list was
that the related ppi_av array in struct priority_worker
wasn't useful and should be removed. This allows us
to also remove num_dequeue_pkts_prev and pc from
struct priority_worker since they are only used in
conjunction with the ppi_av array.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
---
 lib/power/rte_power_empty_poll.c | 12 +-----------
 lib/power/rte_power_empty_poll.h |  5 -----
 2 files changed, 1 insertion(+), 16 deletions(-)

diff --git a/lib/power/rte_power_empty_poll.c b/lib/power/rte_power_empty_poll.c
index 975aa92997..c4b5de9601 100644
--- a/lib/power/rte_power_empty_poll.c
+++ b/lib/power/rte_power_empty_poll.c
@@ -72,8 +72,6 @@ enter_normal_state(struct priority_worker *poll_stats)
 	/* Clear the averages arrays and strs */
 	memset(poll_stats->edpi_av, 0, sizeof(poll_stats->edpi_av));
 	poll_stats->ec = 0;
-	memset(poll_stats->ppi_av, 0, sizeof(poll_stats->ppi_av));
-	poll_stats->pc = 0;
 
 	poll_stats->cur_freq = MED;
 	poll_stats->iter_counter = 0;
@@ -91,8 +89,6 @@ enter_busy_state(struct priority_worker *poll_stats)
 {
 	memset(poll_stats->edpi_av, 0, sizeof(poll_stats->edpi_av));
 	poll_stats->ec = 0;
-	memset(poll_stats->ppi_av, 0, sizeof(poll_stats->ppi_av));
-	poll_stats->pc = 0;
 
 	poll_stats->cur_freq = HGH;
 	poll_stats->iter_counter = 0;
@@ -207,7 +203,7 @@ update_training_stats(struct priority_worker *poll_stats,
 static __rte_always_inline uint32_t
 update_stats(struct priority_worker *poll_stats)
 {
-	uint64_t tot_edpi = 0, tot_ppi = 0;
+	uint64_t tot_edpi = 0;
 	uint32_t j, percent;
 
 	struct priority_worker *s = poll_stats;
@@ -216,10 +212,6 @@ update_stats(struct priority_worker *poll_stats)
 
 	s->empty_dequeues_prev = s->empty_dequeues;
 
-	uint64_t ppi = s->num_dequeue_pkts - s->num_dequeue_pkts_prev;
-
-	s->num_dequeue_pkts_prev = s->num_dequeue_pkts;
-
 	if (s->thresh[s->cur_freq].base_edpi < cur_edpi) {
 
 		/* edpi mean empty poll counter difference per interval */
@@ -233,11 +225,9 @@ update_stats(struct priority_worker *poll_stats)
 	}
 
 	s->edpi_av[s->ec++ % BINS_AV] = cur_edpi;
-	s->ppi_av[s->pc++ % BINS_AV] = ppi;
 
 	for (j = 0; j < BINS_AV; j++) {
 		tot_edpi += s->edpi_av[j];
-		tot_ppi += s->ppi_av[j];
 	}
 
 	tot_edpi = tot_edpi / BINS_AV;
diff --git a/lib/power/rte_power_empty_poll.h b/lib/power/rte_power_empty_poll.h
index 6ba0a37074..43fb276077 100644
--- a/lib/power/rte_power_empty_poll.h
+++ b/lib/power/rte_power_empty_poll.h
@@ -71,7 +71,6 @@ struct priority_worker {
 	enum queue_state queue_state;
 
 	uint64_t empty_dequeues_prev;
-	uint64_t num_dequeue_pkts_prev;
 
 	/* Used for training only */
 	struct freq_threshold thresh[NUM_FREQ];
@@ -82,10 +81,6 @@ struct priority_worker {
 	uint64_t edpi_av[BINS_AV];
 	/* empty poll counter */
 	uint32_t ec;
-	/* ppi mean valid poll counter per interval */
-	uint64_t ppi_av[BINS_AV];
-	/* valid poll counter */
-	uint32_t pc;
 
 	uint32_t lcore_id;
 	uint32_t iter_counter;
-- 
2.32.0


             reply	other threads:[~2021-11-05 15:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-05 15:53 Jim Harris [this message]
2021-11-08 20:40 ` David Marchand
2021-11-12 14:46   ` David Marchand
2021-11-10 10:55 ` [dpdk-dev] " Jiang, YuX
2021-11-10 11:07   ` David Marchand
2021-11-10 11:34     ` Jiang, YuX

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211105155351.350403-1-james.r.harris@intel.com \
    --to=james.r.harris@intel.com \
    --cc=david.hunt@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).