app/testpmd: fix packet throughput after stats reset
authorWei Zhao <wei.zhao1@intel.com>
Thu, 21 Sep 2017 06:32:23 +0000 (14:32 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 6 Oct 2017 00:49:49 +0000 (02:49 +0200)
commit69986a823d789da3745ab6b4ca6d3e84fe76c1b1
tree9ad6d784398988386b52417b1223def15550c440
parent8210e9e0d805ee0f80d19149ac0b5799b52c0e13
app/testpmd: fix packet throughput after stats reset

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")
Cc: stable@dpdk.org
Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
app/test-pmd/config.c