DragonFly BSD
DragonFly bugs List (threaded) for 2006-02
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: kernel panic when running dhclient on tulip


From: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxx>
Date: Mon, 6 Feb 2006 11:53:41 -0800 (PST)

    I think this one is a bit different.  It's in netif/de/if_de.c.

    The problem is simply that the IFP's serializer is not being installed
    by bus_setup_intr().  Instead it looks like its installing a private
    serializer.

    I probably did this before the IFP serialization work.  

    Try the attached patch.  I'm not 100% sure the initialization is
    ordered properly, but its worth a shot.

					-Matt
					Matthew Dillon 
					<dillon@xxxxxxxxxxxxx>


Index: if_de.c
===================================================================
RCS file: /cvs/src/sys/dev/netif/de/if_de.c,v
retrieving revision 1.41
diff -u -r1.41 if_de.c
--- if_de.c	28 Nov 2005 17:13:42 -0000	1.41
+++ if_de.c	6 Feb 2006 19:49:47 -0000
@@ -129,11 +129,11 @@
 {
     tulip_softc_t *sc = arg;
 
-    lwkt_serialize_enter(&sc->tulip_serializer);
+    lwkt_serialize_enter(sc->tulip_if.if_serializer);
     sc->tulip_flags &= ~TULIP_TIMEOUTPENDING;
     sc->tulip_probe_timeout -= 1000 / TULIP_HZ;
     (sc->tulip_boardsw->bd_media_poll)(sc, TULIP_MEDIAPOLL_TIMER);
-    lwkt_serialize_exit(&sc->tulip_serializer);
+    lwkt_serialize_exit(sc->tulip_if.if_serializer);
 }
 
 static void
@@ -3945,6 +3945,13 @@
 }
 
 static void
+tulip_detach(tulip_softc_t *sc)
+{
+    ifmedia_removeall(&sc->tulip_ifmedia);
+    ether_ifdetach(&sc->tulip_if);
+}
+
+static void
 tulip_initcsrs(tulip_softc_t *sc, tulip_csrptr_t csr_base, size_t csr_size)
 {
     sc->tulip_csrs.csr_busmode		= csr_base +  0 * csr_size;
@@ -4031,12 +4038,12 @@
 {
     tulip_softc_t *sc = device_get_softc(dev);
 
-    lwkt_serialize_enter(&sc->tulip_serializer);
+    lwkt_serialize_enter(sc->tulip_if.if_serializer);
     TULIP_CSR_WRITE(sc, csr_busmode, TULIP_BUSMODE_SWRESET);
     DELAY(10);	/* Wait 10 microseconds (actually 50 PCI cycles but at 
 		   33MHz that comes to two microseconds but wait a
 		   bit longer anyways) */
-    lwkt_serialize_exit(&sc->tulip_serializer);
+    lwkt_serialize_exit(sc->tulip_if.if_serializer);
     return 0;
 }
 
@@ -4090,7 +4097,6 @@
     }
 
     sc = device_get_softc(dev);
-    lwkt_serialize_init(&sc->tulip_serializer);
     sc->tulip_dev = dev;
     sc->tulip_pci_busno = pci_get_bus(dev);
     sc->tulip_pci_devno = pci_get_slot(dev);
@@ -4156,7 +4162,6 @@
 		   33MHz that comes to two microseconds but wait a
 		   bit longer anyways) */
 
-    lwkt_serialize_enter(&sc->tulip_serializer);
     if ((retval = tulip_read_macaddr(sc)) < 0) {
 	device_printf(dev, "can't read ENET ROM (why=%d) (", retval);
 	for (idx = 0; idx < 32; idx++)
@@ -4172,6 +4177,7 @@
 	if (sc->tulip_features & TULIP_HAVE_SHAREDINTR)
 	    intr_rtn = tulip_intr_shared;
 
+	tulip_attach(sc);
 	if ((sc->tulip_features & TULIP_HAVE_SLAVEDINTR) == 0) {
 	    void *ih;
 
@@ -4180,16 +4186,14 @@
 				         RF_SHAREABLE | RF_ACTIVE);
 	    if (res == 0 || bus_setup_intr(dev, res, INTR_NETSAFE,
 					   intr_rtn, sc, &ih,
-					   &sc->tulip_serializer)) {
-		lwkt_serialize_exit(&sc->tulip_serializer);
+					   sc->tulip_if.if_serializer)) {
 		device_printf(dev, "couldn't map interrupt\n");
+		tulip_detach(sc);
 		free((caddr_t) sc->tulip_rxdescs, M_DEVBUF);
 		free((caddr_t) sc->tulip_txdescs, M_DEVBUF);
 		return ENXIO;
 	    }
 	}
-	tulip_attach(sc);
-	lwkt_serialize_exit(&sc->tulip_serializer);
     }
     return 0;
 }



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]