jamal wrote:
>
> 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
Please, PLEASE, don't change the device index!! There needs to be some
immutable thing (other than net_device*) to reliably point to a particular
device. Changing that will completely screw up VLAN code as it's written
now (because I didn't want pointers that could go stale..so I do hashed lookups
based on device id...)
And I do believe it would screw up SNMP for the same reason it screws
up my code: Counter-wrap must be taken into account...
Ben
> > case SIOCZAPSTATS:
> > if (dev->get_stats) {
> > struct net_device_stats *stats = dev->get_stats(dev);
> > if (stats)
> > memset(stats, 0, sizeof(*stats));
> > }
That sounds like a much better idea to me... (but make sure that the ip
and ifconfig tools don't automagically 'help' you out by zero-ing them!!)
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
|