netdev
[Top] [All Lists]

Re: Zeroing interface stats?

To: Jeff Garzik <jgarzik@xxxxxxxxxxxxxxxx>
Subject: Re: Zeroing interface stats?
From: Ben Greear <greearb@xxxxxxxxxxxxxxx>
Date: Mon, 05 Mar 2001 19:43:14 -0700
Cc: netdev@xxxxxxxxxxx, linux-net@xxxxxxxxxxxxxxxx
Organization: Candela Technologies
References: <3AA43B44.DE3089A2@mandrakesoft.com>
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));
> 
> --
> Jeff Garzik       | "You see, in this world there's two kinds of
> Building 1024     |  people, my friend: Those with loaded guns
> MandrakeSoft      |  and those who dig. You dig."  --Blondie

Well, sounds like a pretty good idea, but I know it will break
at least one piece of code I've written because I assume the
(measly) 32-bit counters have wrapped if the current value is less
than the last value read...)

Now, if someone wanted to go make sure all counters were 64-bit, then
that would be cool :)

Of course, I can probably figure a way to re-write my code...but
I can't think of a concise way offhand...

Ben

-- 
Ben Greear (greearb@xxxxxxxxxxxxxxx)  http://www.candelatech.com
Author of ScryMUD:  scry.wanfear.com 4444        (Released under GPL)
http://scry.wanfear.com               http://scry.wanfear.com/~greear

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