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>
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 2d8641a..455a0c9 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -389,7 +389,8 @@ static int ixgbe_dev_udp_tunnel_port_del(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 != 0)                                        \
+               cur += (latest - last) & UINT_MAX;              \
        last = latest;                                          \
 }
 
@@ -398,7 +399,8 @@ static int ixgbe_dev_udp_tunnel_port_del(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 != 0)                                         \
+               cur += (0x1000000000LL + latest - last) & 0xFFFFFFFFFLL; \
        last = latest;                                           \
 }
 
-- 
2.8.1

Reply via email to