netdev
[Top] [All Lists]

Re: Zeroing interface stats?

To: Andrew Morton <andrewm@xxxxxxxxxx>
Subject: Re: Zeroing interface stats?
From: jamal <hadi@xxxxxxxxxx>
Date: Mon, 5 Mar 2001 22:02:38 -0500 (EST)
Cc: Jeff Garzik <jgarzik@xxxxxxxxxxxxxxxx>, <netdev@xxxxxxxxxxx>, <linux-net@xxxxxxxxxxxxxxxx>
In-reply-to: <3AA44D36.540CC5BE@uow.edu.au>
Sender: owner-netdev@xxxxxxxxxxx


On Tue, 6 Mar 2001, Andrew Morton wrote:

> Jeff Garzik wrote:
> >
> > Just spotted this code in acenic.c.  Should it be carried over to other
> > net drivers?
> >
> > static int ace_open(struct net_device *dev)
> > {
> > [...]
> >         /*
> >          * Zero the stats when restarting the interface...
> >          */
> >         memset(&ap->stats, 0, sizeof(ap->stats));
> >
>
> It's a philosophical thing...  Do we want the stats
> to tell us what's happened since the interface was
> created, of so we want them to tell us what's
> happened since the interface was opened?
>
> I think I prefer the former: tell me what has
> happened since day one.
>

Infact i think what the acenic is doing is illegal. These stats are used
by SNMP.
IIRC, if you have to zero the stats you also must reset the ifindex.
Someone double check the SNMP RFCs.
I think this removes any ambiguity since the ifindex was received at
boot time.
OTOH, while i am almost agreeing with you with the proposal below
i think it is dangerous because people will write proggies to use it.
It is useful for debugging etc



> If we require the ability to zero out the stats
> then this can be done at a higher level
>
>       case SIOCZAPSTATS:
>               if (dev->get_stats) {
>                       struct net_device_stats *stats = dev->get_stats(dev);
>                       if (stats)
>                               memset(stats, 0, sizeof(*stats));
>               }
>
> No?
>

cheers,
jamal


<Prev in Thread] Current Thread [Next in Thread>