DPDK patches and discussions
 help / color / mirror / Atom feed
From: "David Harton (dharton)" <dharton@cisco.com>
To: Ferruh Yigit <ferruh.yigit@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
Cc: "wenzhuo.lu@intel.com" <wenzhuo.lu@intel.com>,
	"konstantin.ananyev@intel.com" <konstantin.ananyev@intel.com>,
	"xiaolong.ye@intel.com" <xiaolong.ye@intel.com>,
	"intel.com@cisco.com" <intel.com@cisco.com>
Subject: Re: [dpdk-dev] [PATCH v2] net/e1000: update UPDATE_VF_STAT to handle rollover
Date: Wed, 29 Jan 2020 17:56:06 +0000	[thread overview]
Message-ID: <BL0PR11MB35050C119010D8B28613E314AA050@BL0PR11MB3505.namprd11.prod.outlook.com> (raw)
In-Reply-To: <558f34ae-e577-62ca-04e1-1097e6ee1abb@intel.com>


> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@intel.com>
> Sent: Wednesday, January 29, 2020 5:10 AM
> To: David Harton (dharton) <dharton@cisco.com>; dev@dpdk.org
> Cc: wenzhuo.lu@intel.com; konstantin.ananyev@intel.com;
> xiaolong.ye@intel.com; intel.com@cisco.com
> Subject: Re: [dpdk-dev] [PATCH v2] net/e1000: update UPDATE_VF_STAT to
> handle rollover
> 
> On 1/26/2020 5:25 PM, 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 <dharton@cisco.com>
> > ---
> >  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;        \
> 
> Why this is wrong? Both 'latest' and 'last' are 'u32', so diff should be
> correct 'u32' value. And it is added to 'u64' 'cur' value. What I am
> missing?
> 
> > -	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;                                        \
> 
> Why & with UINT_MAX, won't this limit the value to 32bits which has 64bit
> storage?

I'm embarrassed.  I was upstreaming this on behalf of another and honestly didn't even look. :(

You are right about the '&='.  In fact, I'm not convinced these diffs are necessary and have asked our local developer to verify why this change and the ixgbevf change are needed.  I'm wondering if they were encountering another issue related to sync that cause pkt counts to get out of sync as they were attempting to fix what looked like a rollover issue (huge packet counts after boot).

Sorry,
Dave

> 
> > +	last = latest;                                          \
> >  }
> >
> >  #define IGB_FC_PAUSE_TIME 0x0680
> >


  reply	other threads:[~2020-01-29 17:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-11  2:48 [dpdk-dev] [PATCH] " David Harton
2020-01-26  9:41 ` Ye Xiaolong
2020-01-26 17:25 ` [dpdk-dev] [PATCH v2] " David Harton
2020-01-29  7:53   ` Ye Xiaolong
2020-01-29 10:10   ` Ferruh Yigit
2020-01-29 17:56     ` David Harton (dharton) [this message]
2020-01-31  8:46     ` Ye Xiaolong

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=BL0PR11MB35050C119010D8B28613E314AA050@BL0PR11MB3505.namprd11.prod.outlook.com \
    --to=dharton@cisco.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=intel.com@cisco.com \
    --cc=konstantin.ananyev@intel.com \
    --cc=wenzhuo.lu@intel.com \
    --cc=xiaolong.ye@intel.com \
    /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).