public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Sathya.Perla@Emulex.Com
Cc: netdev@vger.kernel.org
Subject: RE: [PATCH net-next 3/5] be2net: fix erx->rx_drops_no_frags wrap around
Date: Tue, 23 Aug 2011 09:29:37 +0200	[thread overview]
Message-ID: <1314084577.4791.30.camel@edumazet-laptop> (raw)
In-Reply-To: <3367B80B08154D42A3B2BC708B5D41F642D8EDB9C6@EXMAIL.ad.emulex.com>

Le mardi 23 août 2011 à 00:06 -0700, Sathya.Perla@Emulex.Com a écrit :
> >-----Original Message-----
> >From: Eric Dumazet [mailto:eric.dumazet@gmail.com]
> >Sent: Tuesday, August 23, 2011 12:11 PM
> >
> >Le mardi 23 août 2011 à 11:11 +0530, Sathya Perla a écrit :
> >> The rx_drops_no_frags HW counter for RSS rings is 16bits in HW and can
> >> wraparound often. Maintain a 32-bit accumulator in the driver to prevent
> >> frequent wraparound.
> >>
> >> Also, incorporated Eric's feedback to use ACCESS_ONCE() for the
> >accumulator
> >> write.
> <...>
> >>
> >> +static void accumulate_16bit_val(u32 *acc, u16 val)
> >> +{
> >> +#define lo(x)			(x & 0xFFFF)
> >> +#define hi(x)			(x & 0xFFFF0000)
> >> +	bool wrapped = val < lo(*acc);
> >> +	u32 newacc = hi(*acc) + val;
> >> +
> >> +	if (wrapped)
> >> +		newacc += 65536;
> >> +	ACCESS_ONCE(*acc) = newacc;
> >> +}
> >> +
> >
> >I still feel something is wrong here :
> >
> >>  void be_parse_stats(struct be_adapter *adapter)
> >>  {
> >>  	struct be_erx_stats_v1 *erx = be_erx_stats_from_cmd(adapter);
> >> @@ -394,9 +406,13 @@ void be_parse_stats(struct be_adapter *adapter)
> >>  	}
> >>
> >>  	/* as erx_v1 is longer than v0, ok to use v1 defn for v0 access */
> >> -	for_all_rx_queues(adapter, rxo, i)
> >> -		rx_stats(rxo)->rx_drops_no_frags =
> >> -			erx->rx_drops_no_fragments[rxo->q.id];
> >
> >previous code was not doing a sum_of_all_queues.
> Yes, the new code still *does not* do a sum of all queues. The code just 
> parses per-queue stats. For each queue, the 16 bit
> HW stats value is taken and stored in a 32-bit *per-queue* variable.
> The comment that "driver accumulates a 32-bit val" may be misleading. The
> code here is not doing a sum of the per-queue stat.

Ah ok, I now see the code intent, and everything seems fine now, thanks
for explaining.



  reply	other threads:[~2011-08-23  7:29 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-23  5:41 [PATCH net-next 0/5] be2net fixes v2 Sathya Perla
2011-08-23  5:41 ` [PATCH net-next 1/5] be2net: Fix race in posting rx buffers Sathya Perla
2011-08-23  5:41 ` [PATCH net-next 2/5] be2net: get rid of memory mapped pci-cfg space address Sathya Perla
2011-08-23  5:41 ` [PATCH net-next 3/5] be2net: fix erx->rx_drops_no_frags wrap around Sathya Perla
2011-08-23  6:41   ` Eric Dumazet
2011-08-23  7:06     ` Sathya.Perla
2011-08-23  7:29       ` Eric Dumazet [this message]
2011-08-23  5:41 ` [PATCH net-next 4/5] be2net: increase FW update completion timeout Sathya Perla
2011-08-23  5:41 ` [PATCH net-next 5/5] be2net: remove unused variable Sathya Perla
2011-08-25  0:08 ` [PATCH net-next 0/5] be2net fixes v2 David Miller
  -- strict thread matches above, loose matches on Subject: below --
2011-08-22 11:13 [PATCH net-next 0/5] be2net: fixes Sathya Perla
2011-08-22 11:13 ` [PATCH net-next 3/5] be2net: fix erx->rx_drops_no_frags wrap around Sathya Perla
2011-08-22 11:43   ` Eric Dumazet
2011-08-22 11:47     ` Eric Dumazet
2011-08-22 12:15       ` Sathya.Perla
2011-08-22 12:44         ` Eric Dumazet
2011-08-22 17:22           ` Sathya.Perla

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=1314084577.4791.30.camel@edumazet-laptop \
    --to=eric.dumazet@gmail.com \
    --cc=Sathya.Perla@Emulex.Com \
    --cc=netdev@vger.kernel.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