From: David Miller <davem@davemloft.net>
To: junchangwang@gmail.com
Cc: romieu@fr.zoreil.com, netdev@vger.kernel.org
Subject: Re: [PATCH] r8169: Add counters tx_bytes and rx_bytes for ethtool
Date: Tue, 25 May 2010 16:15:39 -0700 (PDT) [thread overview]
Message-ID: <20100525.161539.104072714.davem@davemloft.net> (raw)
In-Reply-To: <AANLkTimRwNqPYh1MgXPhh3hHep7Koc3OJCCroEj_scqg@mail.gmail.com>
From: Junchang Wang <junchangwang@gmail.com>
Date: Tue, 25 May 2010 22:19:46 +0800
> Traffic stats counters (rx_bytes and tx_bytes) in net_device are
> "unsigned long". On 32-bit systems, they wrap around every few
> minutes, giving out wrong answers to the amount of traffic. To get the
> right message, another available approach is "ethtool -S". However,
> r8169 didn't support those two counters so far.
>
> Add traffic counters tx_bytes and rx_bytes with 64-bit width for
> ethtool. On 32-bit systems, gcc treats each one as two 32-bit
> variables, making the increment not "atomic". But there is no sync
> issue since the updates to the counters are serialized by driver logic
> in any case. Results provided by ethtool maybe slightly biased if the
> read and update operations are interleaved. But the results are much
> better than the original ones that always fall into the range from 0
> to 4GiB.
>
> Signed-off-by: Junchang Wang <junchangwang@gmail.com>
I absolutely do not want to see drivers start doing this, so right
off the bat I am not going to apply this patch.
If the problem is that people want 64-bit counters available for core
statistics on 32-bit systems, we do not fix that problem by hacking
every single driver to provide them side-band via ethtool.
First of all, we now have "struct rtnl_link_stats64" in
linux/if_link.h, it's there to start combating this problem
generically, for every device, rather than the way you are trying
handle it only for one specific driver at a time.
So that's the area where you should start looking to solve these kinds
of problem.
next prev parent reply other threads:[~2010-05-25 23:15 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-25 14:19 [PATCH] r8169: Add counters tx_bytes and rx_bytes for ethtool Junchang Wang
2010-05-25 19:56 ` Francois Romieu
2010-05-26 1:01 ` Junchang Wang
2010-05-25 23:15 ` David Miller [this message]
2010-05-26 0:51 ` Junchang Wang
2010-06-02 21:34 ` 64-bit net_device_stats Ben Hutchings
2010-06-02 21:59 ` Stephen Hemminger
2010-06-02 23:38 ` Arnd Bergmann
2010-06-03 14:51 ` Ben Hutchings
2010-06-03 17:39 ` [PATCH 1/2] net: Enable 64-bit net device statistics on 32-bit architectures Ben Hutchings
2010-06-03 18:47 ` Stephen Hemminger
2010-06-03 19:11 ` Ben Hutchings
2010-06-04 17:28 ` Stephen Hemminger
2010-06-04 18:15 ` Ben Hutchings
2010-06-04 20:39 ` Stephen Hemminger
2010-06-04 20:47 ` Ben Hutchings
2010-06-03 17:40 ` [PATCH 2/2] sfc: Implement 64-bit net device statistics on all architectures Ben Hutchings
2010-06-04 1:59 ` 64-bit net_device_stats Junchang Wang
2010-06-04 3:59 ` Eric Dumazet
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=20100525.161539.104072714.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=junchangwang@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=romieu@fr.zoreil.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).