[Top] [All Lists]

Re: Zeroing interface stats?

To: Jeff Garzik <jgarzik@xxxxxxxxxxxxxxxx>
Subject: Re: Zeroing interface stats?
From: Andrew Morton <andrewm@xxxxxxxxxx>
Date: Tue, 06 Mar 2001 02:36:38 +0000
Cc: netdev@xxxxxxxxxxx, linux-net@xxxxxxxxxxxxxxxx
References: <>
Sender: owner-netdev@xxxxxxxxxxx
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.

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));


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