On 4/28/2020 12:50 PM, Wei Hu (Xavier) wrote: > From: "Wei Hu (Xavier)" <xavier.hu...@huawei.com> > > Currently, when running start/clear stats&xstats/stop command many times > based on testpmd application, there are incorrect forward Rx/Tx-packets > stats as below: > ---------------------- Forward statistics for port 0 -------------- > RX-packets: 18446744073709544808 RX-dropped: 0 <snip> > TX-packets: 18446744073709536616 TX-dropped: 0 <snip> > -------------------------------------------------------------------- > > The root cause as below: > 1. The struct rte_port of testpmd.h has a member variable > "struct rte_eth_stats stats" to store the last port statistics. > 2. When runnig start command, it execute cmd_start_parsed -> > start_packet_forwarding -> fwd_stats_reset, which call rte_eth_stats_get > API function to save current port statistics. > 3. When running stop command, it execute fwd_stats_display, which call > rte_eth_stats_get to get current port statistics, and then minus last > port statistics. > 4. If we run clear stats or xstats after start command, then run stop, > it may display above incorrect stats because the current Rx/Tx-packets > is lower than the last saved RX/TX-packets(uint64_t overflow). > > This patch fixes it by clearing last port statistics when executing > "clear stats/xstats" command. > > Fixes: af75078fece3 ("first public release") > Cc: sta...@dpdk.org > > Signed-off-by: Chengwen Feng <fengcheng...@huawei.com> > Signed-off-by: Wei Hu (Xavier) <xavier.hu...@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yi...@intel.com> Applied to dpdk-next-net/master, thanks.