[dpdk-dev] [PATCH 2/2] igb: fix VF statistic wraparound handling macro

Harry van Haaren harry.van.haaren at intel.com
Mon Oct 12 15:33:43 CEST 2015


Fix a misinterpreatation of VF statistic macro in e1000/igb.

Signed-off-by: Harry van Haaren <harry.van.haaren at intel.com>
---
 drivers/net/e1000/igb_ethdev.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index 848ef6e..e3f7402 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -246,7 +246,11 @@ static void eth_igb_configure_msix_intr(struct rte_eth_dev *dev);
 #define UPDATE_VF_STAT(reg, last, cur)            \
 {                                                 \
 	u32 latest = E1000_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