From 28523d9a1935f752464ddb68bf304f28b7406616 Mon Sep 17 00:00:00 2001 From: Pablo de Lara Date: Fri, 12 Feb 2016 09:17:22 +0000 Subject: [PATCH] examples/l2fwd-crypto: fix total stats Reset total statistics (sum of all port statistics) before adding up the new accumulated statistics per port. Fixes: 387259bd6c67 ("examples/l2fwd-crypto: add sample application") Signed-off-by: Pablo de Lara Acked-by: Declan Doherty --- examples/l2fwd-crypto/main.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c index d70fc9ae40..113d8f5b3c 100644 --- a/examples/l2fwd-crypto/main.c +++ b/examples/l2fwd-crypto/main.c @@ -205,17 +205,22 @@ struct l2fwd_crypto_statistics crypto_statistics[RTE_MAX_ETHPORTS]; /* default period is 10 seconds */ static int64_t timer_period = 10 * TIMER_MILLISECOND * 1000; -uint64_t total_packets_dropped = 0, total_packets_tx = 0, total_packets_rx = 0, - total_packets_enqueued = 0, total_packets_dequeued = 0, - total_packets_errors = 0; - /* Print out statistics on packets dropped */ static void print_stats(void) { + uint64_t total_packets_dropped, total_packets_tx, total_packets_rx; + uint64_t total_packets_enqueued, total_packets_dequeued, + total_packets_errors; unsigned portid; uint64_t cdevid; + total_packets_dropped = 0; + total_packets_tx = 0; + total_packets_rx = 0; + total_packets_enqueued = 0; + total_packets_dequeued = 0; + total_packets_errors = 0; const char clr[] = { 27, '[', '2', 'J', '\0' }; const char topLeft[] = { 27, '[', '1', ';', '1', 'H', '\0' }; -- 2.20.1