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 A89AAA0093 for ; Mon, 18 May 2020 03:33:28 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 368E31BFAB; Mon, 18 May 2020 03:33:26 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 90EEA1D404; Mon, 18 May 2020 03:33:22 +0200 (CEST) IronPort-SDR: n8c3vYdbd3ANjru2PeORJiFCWXuqQ8TAhro6mzEH7tIhS/f0JaLy3gYJcDaVZfXNBv5NUosnev KsJOHJs7XJJg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2020 18:33:21 -0700 IronPort-SDR: 8aAhZGKUFn9MeKAR4wLHPJ3fA1U+N6yC65rhg1henmSueATq+xlOu69ggZUYZaH5z7i10OsM5M YNmKk7U5TmCg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,405,1583222400"; d="scan'208";a="281822926" Received: from yexl-server.sh.intel.com (HELO localhost) ([10.67.116.183]) by orsmga002.jf.intel.com with ESMTP; 17 May 2020 18:33:20 -0700 Date: Mon, 18 May 2020 09:24:53 +0800 From: Ye Xiaolong To: Guinan Sun Cc: dev@dpdk.org, stable@dpdk.org Message-ID: <20200518012453.GA93575@intel.com> References: <20200508015913.48764-1-guinanx.sun@intel.com> <20200508044618.70535-1-guinanx.sun@intel.com> <20200508044618.70535-3-guinanx.sun@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200508044618.70535-3-guinanx.sun@intel.com> User-Agent: Mutt/1.9.4 (2018-02-28) Subject: Re: [dpdk-stable] [PATCH v2 2/2] net/e1000: fix defects of macro in VF X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, guinan On 05/08, Guinan Sun wrote: >The defects in the macros UPDATE_VF_STAT and UPDATE_VF_STAT_36BIT exist. >If latest is less than last, we will get wrong result. >The patch fixes the defect. There was similar patch before, https://patches.dpdk.org/patch/65131/, if I understand it correctly, you are trying to solve the rollover issue, right? Could you find the Ferruh's comment and check if this is a real issue? > >Fixes: d15fcf76c8b7 ("e1000: move to drivers/net/") This fix commit isn't correct. Thanks, Xiaolong >Cc: stable@dpdk.org > >Signed-off-by: Guinan Sun >--- >v2 changes: >* Aligned line-continuation character "\". >--- > drivers/net/e1000/igb_ethdev.c | 18 +++++++++++++----- > 1 file changed, 13 insertions(+), 5 deletions(-) > >diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c >index 520fba8fa..4cd4e55c0 100644 >--- a/drivers/net/e1000/igb_ethdev.c >+++ b/drivers/net/e1000/igb_ethdev.c >@@ -47,6 +47,8 @@ > #define IGB_4_BIT_MASK RTE_LEN2MASK(IGB_4_BIT_WIDTH, uint8_t) > #define IGB_8_BIT_WIDTH CHAR_BIT > #define IGB_8_BIT_MASK UINT8_MAX >+#define IGB_32_BIT_WIDTH (CHAR_BIT * 4) >+#define IGB_32_BIT_MASK RTE_LEN2MASK(IGB_32_BIT_WIDTH, uint32_t) > > /* Additional timesync values. */ > #define E1000_CYCLECOUNTER_MASK 0xffffffffffffffffULL >@@ -261,11 +263,17 @@ 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) \ >+{ \ >+ uint64_t latest = E1000_READ_REG(hw, reg); \ >+ uint64_t stat = 0; \ >+ if (latest >= last) \ >+ stat = latest - last; \ >+ else \ >+ stat = (uint64_t)((latest + \ >+ ((uint64_t)1 << IGB_32_BIT_WIDTH)) - last);\ >+ cur += stat & IGB_32_BIT_MASK; \ >+ last = latest; \ > } > > #define IGB_FC_PAUSE_TIME 0x0680 >-- >2.17.1 >