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 64BEDA052F; Sun, 26 Jan 2020 10:43:21 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 466E01B94F; Sun, 26 Jan 2020 10:43:21 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id D4A4A8F96 for ; Sun, 26 Jan 2020 10:43:19 +0100 (CET) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Jan 2020 01:43:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,365,1574150400"; d="scan'208";a="228709428" Received: from yexl-server.sh.intel.com (HELO localhost) ([10.67.117.17]) by orsmga003.jf.intel.com with ESMTP; 26 Jan 2020 01:43:16 -0800 Date: Sun, 26 Jan 2020 17:42:42 +0800 From: Ye Xiaolong To: David Harton Cc: dev@dpdk.org, wenzhuo.lu@intel.com, konstantin.ananyev@intel.com Message-ID: <20200126094242.GB54838@intel.com> References: <20191211023836.16272-1-dharton@cisco.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191211023836.16272-1-dharton@cisco.com> User-Agent: Mutt/1.9.4 (2018-02-28) Subject: Re: [dpdk-dev] [PATCH] 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 12/10, David Harton wrote: >Added rollover logic to UPDATE_VF_STAT and UPDATE_VF_STAT_36BIT macros. > >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 >o Could you provide Fixes: tag and cc stable? Acked-by: Xiaolong Ye