[19.11,01/12] net/ixgbevf: fix stats update after a PF reset
Checks
Commit Message
From: Guo Fengtian <fengtian.guo@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: stable at dpdk.org
Signed-off-by: Guo Fengtian <fengtian.guo@6wind.com>
---
drivers/net/ixgbe/ixgbe_ethdev.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
@@ -385,7 +385,8 @@ static void ixgbe_l2_tunnel_conf(struct rte_eth_dev *dev);
#define UPDATE_VF_STAT(reg, last, cur) \
{ \
uint32_t latest = IXGBE_READ_REG(hw, reg); \
- cur += (latest - last) & UINT_MAX; \
+ if (latest) \
+ cur += (latest - last) & UINT_MAX; \
last = latest; \
}
@@ -394,7 +395,8 @@ static void ixgbe_l2_tunnel_conf(struct rte_eth_dev *dev);
u64 new_lsb = IXGBE_READ_REG(hw, lsb); \
u64 new_msb = IXGBE_READ_REG(hw, msb); \
u64 latest = ((new_msb << 32) | new_lsb); \
- cur += (0x1000000000LL + latest - last) & 0xFFFFFFFFFLL; \
+ if (latest) \
+ cur += (0x1000000000LL + latest - last) & 0xFFFFFFFFFLL;\
last = latest; \
}