From: Ye Xiaolong <xiaolong.ye@intel.com>
To: Guinan Sun <guinanx.sun@intel.com>
Cc: dev@dpdk.org, stable@dpdk.org
Subject: Re: [dpdk-dev] [dpdk-stable] [PATCH v2 2/2] net/e1000: fix defects of macro in VF
Date: Mon, 18 May 2020 09:24:53 +0800 [thread overview]
Message-ID: <20200518012453.GA93575@intel.com> (raw)
In-Reply-To: <20200508044618.70535-3-guinanx.sun@intel.com>
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 <guinanx.sun@intel.com>
>---
>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
>
next prev parent reply other threads:[~2020-05-18 1:33 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-08 1:59 [dpdk-dev] [PATCH 0/2] " Guinan Sun
2020-05-08 1:59 ` [dpdk-dev] [PATCH 1/2] net/ixgbe: " Guinan Sun
2020-05-08 1:59 ` [dpdk-dev] [PATCH 2/2] net/e1000: " Guinan Sun
2020-05-08 2:18 ` [dpdk-dev] [PATCH 0/2] " Zhao1, Wei
2020-05-08 5:07 ` Sun, GuinanX
2020-05-08 5:41 ` Zhao1, Wei
2020-05-08 4:46 ` [dpdk-dev] [PATCH v2 " Guinan Sun
2020-05-08 4:46 ` [dpdk-dev] [PATCH v2 1/2] net/ixgbe: " Guinan Sun
2020-05-08 4:46 ` [dpdk-dev] [PATCH v2 2/2] net/e1000: " Guinan Sun
2020-05-18 1:24 ` Ye Xiaolong [this message]
2020-05-18 6:48 ` [dpdk-dev] [dpdk-stable] " Zhao1, Wei
2020-05-18 23:39 ` Ye Xiaolong
2020-05-19 1:01 ` Zhao1, Wei
2020-05-18 7:21 ` [dpdk-dev] " Zhao1, Wei
2020-05-08 5:05 ` [dpdk-dev] [PATCH v2 0/2] " Zhao1, Wei
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200518012453.GA93575@intel.com \
--to=xiaolong.ye@intel.com \
--cc=dev@dpdk.org \
--cc=guinanx.sun@intel.com \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).