Skip to content

Commit 28523d9

Browse files
pablodelaraThomas Monjalon
authored andcommitted
examples/l2fwd-crypto: fix total stats
Reset total statistics (sum of all port statistics) before adding up the new accumulated statistics per port. Fixes: 387259b ("examples/l2fwd-crypto: add sample application") Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com> Acked-by: Declan Doherty <declan.doherty@intel.com>
1 parent c316ed4 commit 28523d9

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

examples/l2fwd-crypto/main.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,17 +205,22 @@ struct l2fwd_crypto_statistics crypto_statistics[RTE_MAX_ETHPORTS];
205205
/* default period is 10 seconds */
206206
static int64_t timer_period = 10 * TIMER_MILLISECOND * 1000;
207207

208-
uint64_t total_packets_dropped = 0, total_packets_tx = 0, total_packets_rx = 0,
209-
total_packets_enqueued = 0, total_packets_dequeued = 0,
210-
total_packets_errors = 0;
211-
212208
/* Print out statistics on packets dropped */
213209
static void
214210
print_stats(void)
215211
{
212+
uint64_t total_packets_dropped, total_packets_tx, total_packets_rx;
213+
uint64_t total_packets_enqueued, total_packets_dequeued,
214+
total_packets_errors;
216215
unsigned portid;
217216
uint64_t cdevid;
218217

218+
total_packets_dropped = 0;
219+
total_packets_tx = 0;
220+
total_packets_rx = 0;
221+
total_packets_enqueued = 0;
222+
total_packets_dequeued = 0;
223+
total_packets_errors = 0;
219224

220225
const char clr[] = { 27, '[', '2', 'J', '\0' };
221226
const char topLeft[] = { 27, '[', '1', ';', '1', 'H', '\0' };

0 commit comments

Comments
 (0)