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

luca.boccassi at gmail.com luca.boccassi at gmail.com
Mon Oct 30 16:34:33 CET 2017


Hi,

FYI, your patch has been queued to LTS release 16.11.4

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/01/17. So please
shout if anyone has objections.

Thanks.

Kind regards,
Luca Boccassi

---
>From 1d6c8ed407f1e78cbbe7f9df54d3452db4221c40 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 36c47ab51..56a7ec679 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -224,8 +224,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.11.0



More information about the stable mailing list