netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2.6.9-rc1] handle error msg "driver changed  get_stats after register"
@ 2004-09-11  0:55 Song Wang
  2004-09-11  1:01 ` David S. Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Song Wang @ 2004-09-11  0:55 UTC (permalink / raw)
  To: netdev

This patch is against 2.6.9-rc1.

In net/core/dev.c: dev_open

  if (get_stats_changed(dev) && net_ratelimit()) {
                printk(KERN_ERR "%s: driver changed
get_stats after register\n",
                       dev->name);
        }

static inline int get_stats_changed(struct net_device
*dev)
{
        int changed = dev->last_stats !=
dev->get_stats;
        dev->last_stats = dev->get_stats;
        return changed;
}

get_stats_changed checks if dev->last_stats has been
changed after the registration when opening the net
device. However, the initialization of dev->last_stats
is done in net/core/net-sysfs.c, which is only 
compiled when CONFIG_SYSFS is enabled.

So if we don't enable CONFIG_SYSFS (for example,
embedded system may not need it for saving space.),
all the network device drivers will have an error
message "driver changed get_stats after register"
printed on the console when you try to ifconfig it,
because dev->last_stats is never initialized.

The following patch adds the initialization of
dev->last_stats in register_netdevice function.

-Song

diff -Naur linux-2.6.9-rc1/net/core/dev.c
linux-2.6.9-rc1.mod/net/core/dev.c
--- linux-2.6.9-rc1/net/core/dev.c      2004-08-31
18:51:06.000000000 -0700
+++ linux-2.6.9-rc1.mod/net/core/dev.c  2004-08-31
19:11:35.407452369 -0700
@@ -2872,6 +2872,8 @@

        dev->iflink = -1;

+       dev->last_stats = dev->get_stats;
+
        /* Init, if this function is available */
        if (dev->init) {
                ret = dev->init(dev);






		
__________________________________
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 2.6.9-rc1] handle error msg "driver changed  get_stats after register"
  2004-09-11  0:55 [PATCH 2.6.9-rc1] handle error msg "driver changed get_stats after register" Song Wang
@ 2004-09-11  1:01 ` David S. Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David S. Miller @ 2004-09-11  1:01 UTC (permalink / raw)
  To: Song Wang; +Cc: netdev, shemminger

On Fri, 10 Sep 2004 17:55:07 -0700 (PDT)
Song Wang <wsonguci@yahoo.com> wrote:

> This patch is against 2.6.9-rc1.
> 
> In net/core/dev.c: dev_open
> 
>   if (get_stats_changed(dev) && net_ratelimit()) {
>                 printk(KERN_ERR "%s: driver changed
> get_stats after register\n",
>                        dev->name);
>         }

I think we should just get rid of this debugging hack,
we fixed all the drivers I think.

Stephen, what do you think?

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-09-11  1:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-11  0:55 [PATCH 2.6.9-rc1] handle error msg "driver changed get_stats after register" Song Wang
2004-09-11  1:01 ` David S. Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).