[dpdk-dev] [PATCH v2] power: fix unused-but-set variable error
Jim Harris
james.r.harris at intel.com
Fri Nov 5 16:53:51 CET 2021
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 at 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
More information about the dev
mailing list