[1600] in linux-net channel archive

home help back first fref pref prev next nref lref last post

FINALLY found netdevice autoirq bug

daemon@ATHENA.MIT.EDU (Avery Pennarun)
Sat Jan 13 17:32:18 1996

Date: 	Wed, 10 Jan 1996 19:00:00 -0500 (EST)
From: Avery Pennarun <apenwarr@foxnet.net>
To: linux-arcnet@tichy.ch.uj.edu.pl
cc: torvalds@cs.helsinki.fi, linux-net@vger.rutgers.edu


Hi all,

This patch will probably apply to nearly any 1.2 or 1.3 kernel, even if you
have to do it manually.  By enabling IRQ's when calling dev->probe, it
solves various problems with net device probes, not least of which is a
frozen "jiffers" counter that causes all functions using it to lock up. 
Obviously, with IRQ's disabled, IRQ autoprobing is unlikely to work as well.

Interestingly, netdevices compiled into the kernel are already called with
IRQ's enabled, leading to these interesting inconsistencies.

linux-arcnet mailing list readers: ARCnet 2.30 ALPHA will autoprobe as a
	module if this patch is in your kernel.  If it is not, the driver
	will lock up instead.  Be careful.
	
linux-net mailing list readers: Vger.rutgers.edu is on a rampage again.  If
	you reply to this message, please cc: me.
	
Hopefully this patch goes about things in the "right" way.  If not, I'm sure
I will be corrected very quickly :)

Have fun!

Avery
("Solving the mysteries of the universe... again!")


--- linux/drivers/net/net_init.c	Wed Jan 10 17:07:48 1996
+++ linux/drivers/net/net_init.c+ave	Wed Jan 10 17:10:22 1996
@@ -258,11 +258,13 @@
 				}
 		}
 
+		sti();	/* device probes assume interrupts enabled */
 		if (dev->init(dev) != 0) {
 		    if (i < MAX_ETH_CARDS) ethdev_index[i] = NULL;
 			restore_flags(flags);
 			return -EIO;
 		}
+		cli();
 
 		/* Add device to end of chain */
 		if (dev_base) {
@@ -345,6 +347,9 @@
 			break;
 		}
 	}
+
+	restore_flags(flags);
+
 	/* You can i.e use a interfaces in a route though it is not up.
 	   We call close_dev (which is changed: it will down a device even if
 	   dev->flags==0 (but it will not call dev->stop if IFF_UP
@@ -353,8 +358,6 @@
 	   dev_mc_discard(dev), ....
 	*/
 	dev_close(dev);
-
-	restore_flags(flags);
 }


home help back first fref pref prev next nref lref last post