[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20100525.161539.104072714.davem@davemloft.net>
Date: Tue, 25 May 2010 16:15:39 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: junchangwang@...il.com
Cc: romieu@...zoreil.com, netdev@...r.kernel.org
Subject: Re: [PATCH] r8169: Add counters tx_bytes and rx_bytes for ethtool
From: Junchang Wang <junchangwang@...il.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@...il.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.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists