pktgen: fix stats clear

Message ID 20191121080714.42442-1-tranbaolong@niometrics.com (mailing list archive)
State Not Applicable, archived
Headers
Series pktgen: fix stats clear |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail apply issues

Commit Message

Tran Bao Long Nov. 21, 2019, 8:07 a.m. UTC
  Reset the total RX/TX pkts/bytes statistics as well when 
user issues a clear command.

Signed-off-by: Tran Bao Long <tranbaolong@niometrics.com>
---
 app/pktgen-cmds.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
  

Patch

diff --git a/app/pktgen-cmds.c b/app/pktgen-cmds.c
index 0e9af7c..1e8e456 100644
--- a/app/pktgen-cmds.c
+++ b/app/pktgen-cmds.c
@@ -2432,6 +2432,8 @@  pktgen_clear_stats(port_info_t *info)
 	memset(&info->sizes, 0, sizeof(port_sizes_t));
 	memset(&info->prev_stats, 0, sizeof(eth_stats_t));
 	memset(&info->rate_stats, 0, sizeof(eth_stats_t));
+	memset(&info->curr_stats, 0, sizeof(eth_stats_t));
+	rte_eth_stats_reset(info->pid);
 
 	rte_eth_stats_get(info->pid, &info->prev_stats);
 	pktgen.max_total_ipackets   = 0;