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/ixgbevf: update VF_STAT macros to handle rollover
Date: Wed, 29 Jan 2020 17:57:15 +0000	[thread overview]
Message-ID: <BL0PR11MB3505185A39AE706106412DEAAA050@BL0PR11MB3505.namprd11.prod.outlook.com> (raw)
In-Reply-To: <be94019c-4e68-107a-1147-504af282a488@intel.com>



> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@intel.com>
> Sent: Wednesday, January 29, 2020 6:23 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/ixgbevf: update VF_STAT macros to
> handle rollover
> 
> On 1/26/2020 5:32 PM, David Harton wrote:
> > Added rollover logic to UPDATE_VF_STAT and UPDATE_VF_STAT_36BIT macros.
> >
> > Fixes: af75078fece3 ("first public release")
> > Cc: intel.com
> >
> > Signed-off-by: David Harton <dharton@cisco.com>
> > ---
> >  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;                      \
> 
> Here since 'last' is 'u64', the 'UINT_MAX' is required, but overall this
> looks good, original code should be OK.

Agreed.  As mentioned on the igbvf thread I've gone back to the developer for justification.

Regards,
Dave

> 
> > +	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;                                    \
> 
> For this case old and new implementation looks same to me.
> 
> >  	last = latest;                                           \
> >  }
> >
> >


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

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-11  2:38 [dpdk-dev] [PATCH] " David Harton
2020-01-26  9:42 ` Ye Xiaolong
2020-01-26 17:13 ` Stephen Hemminger
2020-01-26 17:32 ` [dpdk-dev] [PATCH v2] " David Harton
2020-01-29  7:53   ` Ye Xiaolong
2020-01-29 11:22   ` Ferruh Yigit
2020-01-29 17:57     ` David Harton (dharton) [this message]

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=BL0PR11MB3505185A39AE706106412DEAAA050@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).