Another way is to clear hw_stats->last_vfgprc/last_vfgorc/last_vfgptc/last_vfmprc at the same time PF is set down.
> -----Original Message----- > From: Dai, Wei > Sent: Thursday, February 9, 2017 10:38 PM > To: 'Olivier Matz' <olivier.m...@6wind.com>; dev@dpdk.org; Zhang, Helin > <helin.zh...@intel.com>; Ananyev, Konstantin > <konstantin.anan...@intel.com> > Cc: Guo Fengtian <fengtian....@6wind.com>; sta...@dpdk.org > Subject: RE: [dpdk-dev] [PATCH] net/ixgbevf: fix stats update after a PF reset > > The stats register can rewind to zero when the port is running for a long > period. > So I am afraid that this check is not always correct. > Why not introduce a variable to directly indicate whether the resulted stats > should be updated or not. > > > -----Original Message----- > > From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Olivier Matz > > Sent: Monday, February 6, 2017 9:59 PM > > To: dev@dpdk.org; Zhang, Helin <helin.zh...@intel.com>; Ananyev, > > Konstantin <konstantin.anan...@intel.com> > > Cc: Guo Fengtian <fengtian....@6wind.com>; sta...@dpdk.org > > Subject: Re: [dpdk-dev] [PATCH] net/ixgbevf: fix stats update after a > > PF reset > > > > Hi, > > > > On Wed, 11 Jan 2017 18:04:14 +0100, Olivier Matz > > <olivier.m...@6wind.com> > > wrote: > > > From: Guo Fengtian <fengtian....@6wind.com> > > > > > > When PF is set down, in VF, the value of stats register is zero. > > > So only increase stats when it's non zero. > > > > > > Fixes: af75078fece3 ("first public release") > > > > > > CC: sta...@dpdk.org > > > Signed-off-by: Guo Fengtian <fengtian....@6wind.com> > > > Signed-off-by: Olivier Matz <olivier.m...@6wind.com> > > > > Ping > > > > > > Thanks, > > Olivier