From mboxrd@z Thu Jan 1 00:00:00 1970 From: Olivier Matz Subject: [PATCH] net/ixgbevf: fix stats update after a PF reset Date: Wed, 11 Jan 2017 18:04:14 +0100 Message-ID: <1484154254-31387-1-git-send-email-olivier.matz@6wind.com> Cc: Guo Fengtian , stable@dpdk.org To: dev@dpdk.org, helin.zhang@intel.com, konstantin.ananyev@intel.com Return-path: List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Guo Fengtian 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@dpdk.org Signed-off-by: Guo Fengtian Signed-off-by: Olivier Matz --- 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