[dpdk-stable] patch 'app/testpmd: fix packet throughput after stats reset' has been queued to stable release 17.08.1

Yuanhan Liu yliu at fridaylinux.org
Tue Nov 21 14:16:34 CET 2017


Hi,

FYI, your patch has been queued to stable release 17.08.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 11/24/17. So please
shout if anyone has objections.

Thanks.

	--yliu

---
>From d26af30a623917b0530dfc87dee42b4b4abee46b Mon Sep 17 00:00:00 2001
From: Wei Zhao <wei.zhao1 at intel.com>
Date: Thu, 21 Sep 2017 14:32:23 +0800
Subject: [PATCH] app/testpmd: fix packet throughput after stats reset

[ upstream commit 69986a823d789da3745ab6b4ca6d3e84fe76c1b1 ]

Testpmd calculates packet throughput by getting a diff of previous stats
value and current one.

If a stats clear called after previous sample taken, the diff will be
negative and throughput calculation will be wrong.

If current stats value is smaller than previous one, set throughput to
zero.

Fixes: 0e106980301d ("app/testpmd: show throughput in port stats")

Signed-off-by: Wei Zhao <wei.zhao1 at intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit at intel.com>
---
 app/test-pmd/config.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 3ae3e1c..14131d6 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -203,8 +203,10 @@ nic_stats_display(portid_t port_id)
 	if (diff_cycles > 0)
 		diff_cycles = prev_cycles[port_id] - diff_cycles;
 
-	diff_pkts_rx = stats.ipackets - prev_pkts_rx[port_id];
-	diff_pkts_tx = stats.opackets - prev_pkts_tx[port_id];
+	diff_pkts_rx = (stats.ipackets > prev_pkts_rx[port_id]) ?
+		(stats.ipackets - prev_pkts_rx[port_id]) : 0;
+	diff_pkts_tx = (stats.opackets > prev_pkts_tx[port_id]) ?
+		(stats.opackets - prev_pkts_tx[port_id]) : 0;
 	prev_pkts_rx[port_id] = stats.ipackets;
 	prev_pkts_tx[port_id] = stats.opackets;
 	mpps_rx = diff_cycles > 0 ?
-- 
2.7.4



More information about the stable mailing list