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 AAB5BA052F; Wed, 29 Jan 2020 08:54:39 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5538A1BFAD; Wed, 29 Jan 2020 08:54:37 +0100 (CET) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 24ACC1BFAC for ; Wed, 29 Jan 2020 08:54:34 +0100 (CET) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Jan 2020 23:54:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,376,1574150400"; d="scan'208";a="217875746" Received: from yexl-server.sh.intel.com (HELO localhost) ([10.67.117.17]) by orsmga007.jf.intel.com with ESMTP; 28 Jan 2020 23:54:07 -0800 Date: Wed, 29 Jan 2020 15:53:25 +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: <20200129075325.GC54838@intel.com> References: <20191211023836.16272-1-dharton@cisco.com> <20200126173201.19433-1-dharton@cisco.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200126173201.19433-1-dharton@cisco.com> User-Agent: Mutt/1.9.4 (2018-02-28) Subject: Re: [dpdk-dev] [PATCH v2] net/ixgbevf: update VF_STAT macros 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: >Added rollover logic to UPDATE_VF_STAT and UPDATE_VF_STAT_36BIT macros. > >Fixes: af75078fece3 ("first public release") >Cc: intel.com Cc: stable@dpdk.org > >Signed-off-by: David Harton >--- > drivers/net/ixgbe/ixgbe_ethdev.c | 12 ++++++++++-- > 1 file changed, 10 insertions(+), 2 deletions(-) > >diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c >index 49285ce53..bc73ad195 100644 >--- a/drivers/net/ixgbe/ixgbe_ethdev.c >+++ b/drivers/net/ixgbe/ixgbe_ethdev.c >@@ -385,7 +385,11 @@ static void ixgbe_l2_tunnel_conf(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 >= last) \ >+ cur += (latest - last); \ >+ else \ >+ cur += ((latest + ((uint64_t)1 << 32)) - last); \ >+ cur &= UINT_MAX; \ > last = latest; \ > } > >@@ -394,7 +398,11 @@ static void ixgbe_l2_tunnel_conf(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 >= last) \ >+ cur += (latest - last); \ >+ else \ >+ cur += ((latest + ((u64)1 << 36)) - last); \ >+ cur &= 0xFFFFFFFFFLL; \ > last = latest; \ > } > >-- >2.19.1 > Acked-by: Xiaolong Ye Applied to dpdk-next-net-intel, Thanks.