[dpdk-dev] [PATCH 1/2] ixgbe: fix VF statistic wraparound handling macro
Harry van Haaren
harry.van.haaren at intel.com
Mon Oct 12 15:33:42 CEST 2015
Fix a misinterpretation of VF stats in ixgbe
Signed-off-by: Harry van Haaren <harry.van.haaren at intel.com>
---
drivers/net/ixgbe/ixgbe_ethdev.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index ec2918c..d226e8d 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -329,10 +329,14 @@ static int ixgbe_timesync_read_tx_timestamp(struct rte_eth_dev *dev,
/*
* Define VF Stats MACRO for Non "cleared on read" register
*/
-#define UPDATE_VF_STAT(reg, last, cur) \
+#define UPDATE_VF_STAT(reg, last, cur) \
{ \
uint32_t latest = IXGBE_READ_REG(hw, reg); \
- cur += latest - last; \
+ if(likely(latest > last)) { \
+ cur += latest - last; \
+ } else { \
+ cur += (UINT_MAX - last) + latest; \
+ } \
last = latest; \
}
--
1.9.1
More information about the dev
mailing list