From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id DEC80A052F; Wed, 29 Jan 2020 08:54:31 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 048631BFA6; Wed, 29 Jan 2020 08:54:31 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id ADAD01BFA5 for ; Wed, 29 Jan 2020 08:54:29 +0100 (CET) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Jan 2020 23:54:28 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,376,1574150400"; d="scan'208";a="222372494" Received: from yexl-server.sh.intel.com (HELO localhost) ([10.67.117.17]) by orsmga008.jf.intel.com with ESMTP; 28 Jan 2020 23:54:26 -0800 Date: Wed, 29 Jan 2020 15:53:43 +0800 From: Ye Xiaolong To: David Harton Cc: dev@dpdk.org, wenzhuo.lu@intel.com, konstantin.ananyev@intel.com, intel.com@cisco.com Message-ID: <20200129075343.GD54838@intel.com> References: <20191211024802.17978-1-dharton@cisco.com> <20200126172548.23327-1-dharton@cisco.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200126172548.23327-1-dharton@cisco.com> User-Agent: Mutt/1.9.4 (2018-02-28) Subject: Re: [dpdk-dev] [PATCH v2] net/e1000: update UPDATE_VF_STAT to handle rollover X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 01/26, David Harton wrote: >Modified UPDATE_VF_STAT to properly handle rollover conditions. > >Fixes: d82170d27918 ("igb: add VF support") >Cc: intel.com > >Signed-off-by: David Harton >--- > drivers/net/e1000/igb_ethdev.c | 14 +++++++++----- > 1 file changed, 9 insertions(+), 5 deletions(-) > >diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c >index a3e30dbe5..825663267 100644 >--- a/drivers/net/e1000/igb_ethdev.c >+++ b/drivers/net/e1000/igb_ethdev.c >@@ -261,11 +261,15 @@ static int igb_filter_restore(struct rte_eth_dev *dev); > /* > * Define VF Stats MACRO for Non "cleared on read" register > */ >-#define UPDATE_VF_STAT(reg, last, cur) \ >-{ \ >- u32 latest = E1000_READ_REG(hw, reg); \ >- cur += (latest - last) & UINT_MAX; \ >- last = latest; \ >+#define UPDATE_VF_STAT(reg, last, cur) \ >+{ \ >+ u32 latest = E1000_READ_REG(hw, reg); \ >+ if (latest >= last) \ >+ cur += (latest - last); \ >+ else \ >+ cur += ((latest + ((uint64_t)1 << 32)) - last); \ >+ cur &= UINT_MAX; \ >+ last = latest; \ > } > > #define IGB_FC_PAUSE_TIME 0x0680 >-- >2.19.1 > Acked-by: Xiaolong Ye Applied to dpdk-next-net-intel, Thanks.