From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 072508E8A for ; Mon, 12 Oct 2015 15:33:49 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 12 Oct 2015 06:33:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,672,1437462000"; d="scan'208";a="824944253" Received: from sie-lab-212-222.ir.intel.com (HELO silpixa00366884.ir.intel.com) ([10.237.212.222]) by fmsmga002.fm.intel.com with ESMTP; 12 Oct 2015 06:33:47 -0700 From: Harry van Haaren To: dev@dpdk.org Date: Mon, 12 Oct 2015 14:33:42 +0100 Message-Id: <1444656823-717-2-git-send-email-harry.van.haaren@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1444656823-717-1-git-send-email-harry.van.haaren@intel.com> References: <1444656823-717-1-git-send-email-harry.van.haaren@intel.com> Subject: [dpdk-dev] [PATCH 1/2] ixgbe: fix VF statistic wraparound handling macro X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Oct 2015 13:33:50 -0000 Fix a misinterpretation of VF stats in ixgbe Signed-off-by: Harry van Haaren --- 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