Make all network interrupt service routines MPSAFE part 1/3.
[dragonfly.git] / sys / dev / netif / ex / if_ex_pccard.c
index c8be613..563b022 100644 (file)
@@ -24,7 +24,7 @@
  * SUCH DAMAGE.
  *
  *     $FreeBSD: src/sys/dev/ex/if_ex_pccard.c,v 1.2.2.1 2001/03/05 05:33:20 imp Exp $
- *     $DragonFly: src/sys/dev/netif/ex/if_ex_pccard.c,v 1.9 2005/10/12 17:35:51 dillon Exp $
+ *     $DragonFly: src/sys/dev/netif/ex/if_ex_pccard.c,v 1.10 2005/11/28 17:13:42 dillon Exp $
  */
 
 #include <sys/param.h>
@@ -34,6 +34,7 @@
 
 #include <sys/module.h>
 #include <sys/bus.h>
+#include <sys/serialize.h>
 
 #include <machine/bus.h>
 #include <machine/resource.h>
@@ -162,8 +163,9 @@ ex_pccard_attach(device_t dev)
                goto bad;
        }
 
-       error = bus_setup_intr(dev, sc->irq, 0,
-                               ex_intr, (void *)sc, &sc->ih, NULL);
+       error = bus_setup_intr(dev, sc->irq, INTR_NETSAFE,
+                               ex_intr, (void *)sc, &sc->ih, 
+                               sc->arpcom.ac_if.if_serializer);
        if (error) {
                device_printf(dev, "bus_setup_intr() failed!\n");
                goto bad;
@@ -181,9 +183,11 @@ ex_pccard_detach(device_t dev)
        struct ex_softc         *sc = device_get_softc(dev);
        struct ifnet            *ifp = &sc->arpcom.ac_if;
 
+       lwkt_serialize_enter(sc->arpcom.ac_if.if_serializer);
        ex_stop(sc);
        ifp->if_flags &= ~IFF_RUNNING;
        if_detach(ifp);
        ex_release_resources(dev);
+       lwkt_serialize_exit(sc->arpcom.ac_if.if_serializer);
        return (0);
 }