Subject: Re: [PATCH] net: add ability to clear stats via ethtool - e1000/pcnet32

From: Andrew Morton <[email-masked]>
Date: Wed, 28 May 2008 22:11:18 -0700

On Wed, 28 May 2008 20:45:18 -0500 James Cammarata <[email-masked]> wrote:

> I had originally submitted this ability as a patch to procfs, and
> general consensus was that it seemed "hackish" to do it that way.  It
> was suggested that it be implemented as a feature of ethtool, so I 
> thought I'd take on the challenge and add it that way.
> 
> I've laid the groundwork here, and added the ability to two of the 
> drivers for which I have hardware to test on (e1000 and pcnet32).  I 
> also added the code required to call this functionality to the ethtool 
> code base, and have been using that to test my changes (using -z as the 
> flag to ethtool for clearing stats for now).
> 
> If this is an acceptable start, I will gladly start working on adding 
> this to as many drivers as possible (we do have some bnx2 hardware, 
> though I'm not sure if it's available for testing).
> 
> Some other sys-admins have mentioned to me that ethtool doesn't work 
> sometimes and they fall back to using mii-tool to configure interfaces,
> so I'd still like to have the procfs change implemented to accommodate 
> that hardware, but I agree, this is a better way forward.

You didn't provide a reason from adding this feature to the kernel.

Many of the kernel's accounting accumulators cannot be reset.  We
handle that in userspace tools by using subtraction.