Convert to critical sections. Drop a splz.
authorJoerg Sonnenberger <joerg@dragonflybsd.org>
Wed, 15 Jun 2005 11:56:03 +0000 (11:56 +0000)
committerJoerg Sonnenberger <joerg@dragonflybsd.org>
Wed, 15 Jun 2005 11:56:03 +0000 (11:56 +0000)
sys/net/i4b/driver/i4b_ing.c
sys/net/i4b/driver/i4b_isppp.c
sys/net/i4b/driver/i4b_rbch.c
sys/net/i4b/driver/i4b_tel.c
sys/net/i4b/layer1/ihfc/i4b_ihfc.h
sys/net/i4b/layer1/ihfc/i4b_ihfc_drv.c
sys/net/i4b/layer1/ihfc/i4b_ihfc_l1if.c
sys/net/i4b/layer1/ihfc/i4b_ihfc_pnp.c
sys/net/i4b/layer2/i4b_mbuf.c

index 2efb048..5bfa781 100644 (file)
@@ -28,7 +28,7 @@
  *     -------------------------------------------------
  *
  * $FreeBSD: src/sys/i4b/driver/i4b_ing.c,v 1.10.2.4 2002/07/02 23:44:02 archie Exp $
- * $DragonFly: src/sys/net/i4b/driver/i4b_ing.c,v 1.7 2005/06/03 16:49:57 dillon Exp $
+ * $DragonFly: src/sys/net/i4b/driver/i4b_ing.c,v 1.8 2005/06/15 11:56:03 joerg Exp $
  *
  *     last edit-date: [Tue Jan  1 10:43:58 2002]
  *
@@ -840,12 +840,7 @@ ng_ing_disconnect(hook_p hook)
 {
        struct ing_softc *sc = hook->node->private;
        
-       if(hook->private)
-       {
-               splz();
-       }
-       else
-       {
+       if(hook->private == NULL) {
                sc->debughook = NULL;
        }
        return (0);
index 6419b8e..27fee39 100644 (file)
@@ -37,7 +37,7 @@
  *     $Id: i4b_isppp.c,v 1.44 2000/08/31 07:07:26 hm Exp $
  *
  * $FreeBSD: src/sys/i4b/driver/i4b_isppp.c,v 1.7.2.3 2003/02/06 14:50:53 gj Exp $
- * $DragonFly: src/sys/net/i4b/driver/i4b_isppp.c,v 1.13 2005/06/14 21:19:18 joerg Exp $
+ * $DragonFly: src/sys/net/i4b/driver/i4b_isppp.c,v 1.14 2005/06/15 11:56:03 joerg Exp $
  *
  *     last edit-date: [Thu Aug 31 09:02:27 2000]
  *
@@ -58,6 +58,7 @@
 #include <sys/ioccom.h>
 #include <sys/sockio.h>
 #include <sys/kernel.h>
+#include <sys/thread2.h>
 
 #include <net/if.h>
 #include <net/if_arp.h>
@@ -262,10 +263,10 @@ i4bisppp_ioctl(struct ifnet *ifp, IOCTL_CMD_T cmd, caddr_t data,
        switch(cmd) {
        case SIOCSIFFLAGS:
 #if 0 /* never used ??? */
-               x = splimp();
+               crit_enter();
                if ((ifp->if_flags & IFF_UP) == 0)
                        callout_stop(&sc->sc_timeout);
-               splx(x);
+               crit_exit();
 #endif
                break;
        }
@@ -291,9 +292,9 @@ i4bisppp_start(struct ifnet *ifp)
                return;
 
        /*
-        * s = splimp();
+        * crit_enter();
         * ifp->if_flags |= IFF_OACTIVE; // - need to clear this somewhere
-        * splx(s);
+        * crit_exit();
         */
 
        while ((m = sppp_dequeue(&sc->sc_if)) != NULL)
@@ -453,7 +454,8 @@ i4bisppp_connect(int unit, void *cdp)
 {
        struct i4bisppp_softc *sc = &i4bisppp_softc[unit];
        struct sppp *sp = &sc->sc_if_un.scu_sp;
-       int s = splimp();
+
+       crit_enter();
 
        sc->sc_cdp = (call_desc_t *)cdp;
        sc->sc_state = ST_CONNECTED;
@@ -474,7 +476,8 @@ i4bisppp_connect(int unit, void *cdp)
 
        sp->pp_up(sp);          /* tell PPP we are ready */
        sp->pp_last_sent = sp->pp_last_recv = SECOND;
-       splx(s);
+
+       crit_exit();
 }
 
 /*---------------------------------------------------------------------------*
@@ -487,13 +490,13 @@ i4bisppp_disconnect(int unit, void *cdp)
        struct i4bisppp_softc *sc = &i4bisppp_softc[unit];
        struct sppp *sp = &sc->sc_if_un.scu_sp;
 
-       int s = splimp();
+       crit_enter();
 
        /* new stuff to check that the active channel is being closed */
        if (cd != sc->sc_cdp)
        {
                NDBGL4(L4_ISPDBG, "isp%d, channel%d not active!", unit, cd->channelid);
-               splx(s);
+               crit_exit();
                return;
        }
 
@@ -515,7 +518,7 @@ i4bisppp_disconnect(int unit, void *cdp)
                sp->pp_down(sp);        /* tell PPP we have hung up */
        }
 
-       splx(s);
+       crit_exit();
 }
 
 /*---------------------------------------------------------------------------*
@@ -575,7 +578,6 @@ i4bisppp_rx_data_rdy(int unit)
 {
        struct i4bisppp_softc *sc = &i4bisppp_softc[unit];
        struct mbuf *m;
-       int s;
        
        if((m = *isdn_linktab[unit]->rx_mbuf) == NULL)
                return;
@@ -600,11 +602,9 @@ i4bisppp_rx_data_rdy(int unit)
 
        BPF_MTAP(&sc->sc_if, m);
 
-       s = splimp();
-
+       crit_enter();
        sppp_input(&sc->sc_if, m);
-
-       splx(s);
+       crit_exit();
 }
 
 /*---------------------------------------------------------------------------*
index 39cfca3..c8b8fd9 100644 (file)
@@ -28,7 +28,7 @@
  *     ---------------------------------------------------
  *
  * $FreeBSD: src/sys/i4b/driver/i4b_rbch.c,v 1.10.2.3 2001/08/12 16:22:48 hm Exp $
- * $DragonFly: src/sys/net/i4b/driver/i4b_rbch.c,v 1.16 2005/06/14 21:19:18 joerg Exp $
+ * $DragonFly: src/sys/net/i4b/driver/i4b_rbch.c,v 1.17 2005/06/15 11:56:03 joerg Exp $
  *
  *     last edit-date: [Sat Aug 11 18:06:57 2001]
  *
@@ -560,17 +560,15 @@ PDEVSTATIC int
 i4brbchpoll(dev_t dev, int events, struct thread *td)
 {
        int revents = 0;        /* Events we found */
-       int s;
        int unit = minor(dev);
        struct rbch_softc *sc = &rbch_softc[unit];
        
        /* We can't check for anything but IN or OUT */
-
-       s = splhigh();
+       crit_enter();
 
        if(!(sc->sc_devstate & ST_ISOPEN))
        {
-               splx(s);
+               crit_exit();
                return(POLLNVAL);
        }
 
@@ -605,7 +603,7 @@ i4brbchpoll(dev_t dev, int events, struct thread *td)
        if(revents == 0)
                selrecord(td, &sc->selp);
 
-       splx(s);
+       crit_exit();
        return(revents);
 }
 
index 92cd41b..3027498 100644 (file)
@@ -28,7 +28,7 @@
  *     --------------------------------------------
  *
  * $FreeBSD: src/sys/i4b/driver/i4b_tel.c,v 1.10.2.4 2001/12/16 15:12:57 hm Exp $
- * $DragonFly: src/sys/net/i4b/driver/i4b_tel.c,v 1.11 2005/06/14 21:19:18 joerg Exp $
+ * $DragonFly: src/sys/net/i4b/driver/i4b_tel.c,v 1.12 2005/06/15 11:56:03 joerg Exp $
  *
  *     last edit-date: [Sat Aug 11 18:07:05 2001]
  *
@@ -52,6 +52,7 @@
 #include <sys/mbuf.h>
 #include <sys/socket.h>
 #include <net/if.h>
+#include <sys/thread2.h>
 #include <sys/tty.h>
 
 #ifdef DEVFS
@@ -265,14 +266,13 @@ i4btelclose(dev_t dev, int flag, int fmt, struct thread *td)
        int func = FUNC(dev);
        tel_sc_t *sc;
        int error = 0;
-       int x;
        
        if(unit > NI4BTEL)
                return(ENXIO);
 
        sc = &tel_sc[unit][func];               
 
-       x = splimp();
+       crit_enter();
        sc->devstate &= ~ST_TONE;               
 
        if((func == FUNCTEL) &&
@@ -292,7 +292,7 @@ i4btelclose(dev_t dev, int flag, int fmt, struct thread *td)
        }
 
        sc->devstate &= ~ST_ISOPEN;             
-       splx(x);
+       crit_exit();
        wakeup((caddr_t) &sc->tones);
 
        return(error);
@@ -308,7 +308,6 @@ i4btelioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
        int func = FUNC(dev);
        int error = 0;
         struct mbuf *m;
-        int s;
 
        tel_sc_t *sc = &tel_sc[unit][func];
 
@@ -348,7 +347,7 @@ i4btelioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
                                break;
        
                        case I4B_TEL_EMPTYINPUTQUEUE:
-                               s = splimp();
+                               crit_enter();
                                while((sc->devstate & ST_CONNECTED)     &&
                                        (sc->devstate & ST_ISOPEN)      &&
                                        !IF_QEMPTY(sc->isdn_linktab->rx_queue))
@@ -357,7 +356,7 @@ i4btelioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
                                        if(m)
                                                i4b_Bfreembuf(m);
                                }
-                               splx(s);
+                               crit_exit();
                                break;
 
                        case I4B_TEL_VR_REQ:
@@ -376,21 +375,21 @@ i4btelioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
                                struct i4b_tel_tones *tt;
 
                                tt = (struct i4b_tel_tones *)data;
-                               s = splimp();
+                               crit_enter();
                                while ((sc->devstate & ST_TONE) && 
                                    sc->tones.duration[sc->toneidx] != 0) {
                                        if((error = tsleep((caddr_t) &sc->tones,
                                            PCATCH, "rtone", 0 )) != 0) {
-                                               splx(s);
+                                               crit_exit();
                                                return(error);
                                        }
                                } 
                                if(!(sc->devstate & ST_ISOPEN)) {
-                                       splx(s);
+                                       crit_exit();
                                        return (EIO);
                                }
                                if(!(sc->devstate & ST_CONNECTED)) {
-                                       splx(s);
+                                       crit_exit();
                                        return (EIO);
                                }
 
@@ -398,7 +397,7 @@ i4btelioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
                                sc->toneidx = 0;
                                sc->tonefreq = tt->frequency[0];
                                sc->devstate |= ST_TONE;
-                               splx(s);
+                               crit_exit();
                                tel_tone(sc);
                                break;
                        }
@@ -430,7 +429,6 @@ i4btelread(dev_t dev, struct uio *uio, int ioflag)
        int func = FUNC(dev);
 
        struct mbuf *m;
-       int s;
        int error = 0;
 
        tel_sc_t *sc = &tel_sc[unit][func];
@@ -440,7 +438,7 @@ i4btelread(dev_t dev, struct uio *uio, int ioflag)
 
        if(func == FUNCTEL)
        {
-               s = splimp();
+               crit_enter();
 
                while((sc->devstate & ST_ISOPEN)        &&
                      (sc->devstate & ST_CONNECTED)     &&
@@ -454,20 +452,20 @@ i4btelread(dev_t dev, struct uio *uio, int ioflag)
                                                PCATCH, "rtel", 0 )) != 0)
                        {
                                sc->devstate &= ~ST_RDWAITDATA;
-                               splx(s);
+                               crit_exit();
                                return(error);
                        }
                }
        
                if(!(sc->devstate & ST_ISOPEN))
                {
-                       splx(s);
+                       crit_exit();
                        return(EIO);
                }
        
                if(!(sc->devstate & ST_CONNECTED))
                {
-                       splx(s);
+                       crit_exit();
                        return(EIO);
                }
                
@@ -500,11 +498,11 @@ i4btelread(dev_t dev, struct uio *uio, int ioflag)
                if(m)
                        i4b_Bfreembuf(m);
        
-               splx(s);
+               crit_exit();
        }
        else if(func == FUNCDIAL)
        {
-               s = splimp();
+               crit_enter();
                while((sc->result == 0) && (sc->devstate & ST_ISOPEN))
                {
                        sc->devstate |= ST_RDWAITDATA;
@@ -513,14 +511,14 @@ i4btelread(dev_t dev, struct uio *uio, int ioflag)
                                                PCATCH, "rtel1", 0 )) != 0)
                        {
                                sc->devstate &= ~ST_RDWAITDATA;
-                               splx(s);
+                               crit_exit();
                                return(error);
                        }
                }
        
                if(!(sc->devstate & ST_ISOPEN))
                {
-                       splx(s);
+                       crit_exit();
                        return(EIO);
                }
        
@@ -534,7 +532,7 @@ i4btelread(dev_t dev, struct uio *uio, int ioflag)
                        error = EIO;
                }
 
-               splx(s);                        
+               crit_exit();
        }
        return(error);
 }
@@ -548,7 +546,6 @@ i4btelwrite(dev_t dev, struct uio * uio, int ioflag)
        int unit = UNIT(dev);
        int func = FUNC(dev);
        struct mbuf *m;
-       int s;
        int error = 0;
        tel_sc_t *sc = &tel_sc[unit][func];
        
@@ -559,10 +556,10 @@ i4btelwrite(dev_t dev, struct uio * uio, int ioflag)
 
        if(func == FUNCTEL)
        {
-               s = splimp();
+               crit_enter();
                
                if(!(sc->devstate & ST_CONNECTED)) {
-                       splx(s);
+                       crit_exit();
                        return(EIO);
                }
                        
@@ -576,20 +573,20 @@ i4btelwrite(dev_t dev, struct uio * uio, int ioflag)
                                        PCATCH, "wtel", 0)) != 0)
                        {
                                sc->devstate &= ~ST_WRWAITEMPTY;
-                               splx(s);
+                               crit_exit();
                                return(error);
                        }
                }
        
                if(!(sc->devstate & ST_ISOPEN))
                {
-                       splx(s);
+                       crit_exit();
                        return(EIO);
                }
        
                if(!(sc->devstate & ST_CONNECTED))
                {
-                       splx(s);
+                       crit_exit();
                        return(EIO);
                }
 
@@ -618,7 +615,7 @@ i4btelwrite(dev_t dev, struct uio * uio, int ioflag)
                        (*sc->isdn_linktab->bch_tx_start)(sc->isdn_linktab->unit, sc->isdn_linktab->channel);
                }
        
-               splx(s);
+               crit_exit();
        }
        else if(func == FUNCDIAL)
        {
@@ -706,18 +703,17 @@ PDEVSTATIC int
 i4btelpoll(dev_t dev, int events, struct thread *td)
 {
        int revents = 0;        /* Events we found */
-       int s;
        int unit = UNIT(dev);
        int func = FUNC(dev);   
 
        tel_sc_t *sc = &tel_sc[unit][func];
        
-       s = splhigh();
+       crit_enter();
 
        if(!(sc->devstate & ST_ISOPEN))
        {
                NDBGL4(L4_TELDBG, "i4btel%d, !ST_ISOPEN", unit);
-               splx(s);
+               crit_exit();
                return(0);
        }
 
@@ -775,7 +771,7 @@ i4btelpoll(dev_t dev, int events, struct thread *td)
                        selrecord(td, &sc->selp);
                }
        }
-       splx(s);
+       crit_exit();
        return(revents);
 }
 
index c909ed4..00521c4 100644 (file)
@@ -32,7 +32,7 @@
  *     $Id: i4b_ihfc.h,v 1.9 2000/09/19 13:50:36 hm Exp $
  *
  * $FreeBSD: src/sys/i4b/layer1/ihfc/i4b_ihfc.h,v 1.1.2.1 2001/08/10 14:08:37 obrien Exp $
- * $DragonFly: src/sys/net/i4b/layer1/ihfc/i4b_ihfc.h,v 1.4 2004/09/16 04:36:32 dillon Exp $
+ * $DragonFly: src/sys/net/i4b/layer1/ihfc/i4b_ihfc.h,v 1.5 2005/06/15 11:56:03 joerg Exp $
  *
  *---------------------------------------------------------------------------*/
 
@@ -82,9 +82,9 @@
  *     NOTE: If the code does not run at splhigh, we will sporadically
  *     lose bytes. On fast PC's (200 Mhz), this is very little noticable.
  *---------------------------------------------------------------------------*/
-#define HFC_VAR        int _s_                 /* declare variable     */
-#define HFC_BEG        _s_ = splhigh()         /* save spl             */
-#define HFC_END        splx(_s_)               /* restore spl          */
+#define HFC_VAR                                /* declare variable     */
+#define HFC_BEG        crit_enter()            /* save spl             */
+#define HFC_END        crit_exit()             /* restore spl          */
 
 /*---------------------------------------------------------------------------*
  *     macros related to i4b linking                           (HFC-1/S/SP)
index c3a3455..0b1afd7 100644 (file)
@@ -33,7 +33,7 @@
  *     last edit-date: [Fri Jan 12 17:06:52 2001]
  *
  * $FreeBSD: src/sys/i4b/layer1/ihfc/i4b_ihfc_drv.c,v 1.9.2.1 2001/08/10 14:08:37 obrien Exp $
- * $DragonFly: src/sys/net/i4b/layer1/ihfc/i4b_ihfc_drv.c,v 1.6 2005/06/14 21:19:18 joerg Exp $
+ * $DragonFly: src/sys/net/i4b/layer1/ihfc/i4b_ihfc_drv.c,v 1.7 2005/06/15 11:56:03 joerg Exp $
  *
  *---------------------------------------------------------------------------*/
 
@@ -44,6 +44,7 @@
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/socket.h>
+#include <sys/thread2.h>
 #include <net/if.h>
 
 #include <sys/mbuf.h>
index 1c0b5c3..4cb0c03 100644 (file)
@@ -37,7 +37,7 @@
  *      $Id: i4b_ihfc_l1if.c,v 1.10 2000/09/19 13:50:36 hm Exp $
  *
  * $FreeBSD: src/sys/i4b/layer1/ihfc/i4b_ihfc_l1if.c,v 1.7.2.1 2001/08/10 14:08:37 obrien Exp $
- * $DragonFly: src/sys/net/i4b/layer1/ihfc/i4b_ihfc_l1if.c,v 1.7 2005/01/23 13:47:24 joerg Exp $
+ * $DragonFly: src/sys/net/i4b/layer1/ihfc/i4b_ihfc_l1if.c,v 1.8 2005/06/15 11:56:03 joerg Exp $
  *
  *---------------------------------------------------------------------------*/
 
@@ -50,7 +50,7 @@
 #include <sys/systm.h>
 #include <sys/mbuf.h>
 #include <sys/socket.h>
-
+#include <sys/thread2.h>
 
 #include <net/if.h>
 
index 366afd6..4a858b5 100644 (file)
@@ -36,7 +36,7 @@
  *      $Id: i4b_ihfc_pnp.c,v 1.9 2000/09/19 13:50:36 hm Exp $
  *
  * $FreeBSD: src/sys/i4b/layer1/ihfc/i4b_ihfc_pnp.c,v 1.5.2.1 2001/08/10 14:08:37 obrien Exp $
- * $DragonFly: src/sys/net/i4b/layer1/ihfc/i4b_ihfc_pnp.c,v 1.5 2005/05/26 23:17:31 swildner Exp $
+ * $DragonFly: src/sys/net/i4b/layer1/ihfc/i4b_ihfc_pnp.c,v 1.6 2005/06/15 11:56:03 joerg Exp $
  *     
  *---------------------------------------------------------------------------*/
 
@@ -48,6 +48,7 @@
 #include <sys/systm.h>
 #include <sys/kernel.h>
 #include <sys/socket.h>
+#include <sys/thread2.h>
 #include <net/if.h>
 
 
index d74b72d..28bdaf7 100644 (file)
@@ -28,7 +28,7 @@
  *     ------------------------------------
  *
  * $FreeBSD: src/sys/i4b/layer2/i4b_mbuf.c,v 1.6.2.1 2001/08/10 14:08:41 obrien Exp $
- * $DragonFly: src/sys/net/i4b/layer2/i4b_mbuf.c,v 1.6 2005/06/14 21:19:19 joerg Exp $
+ * $DragonFly: src/sys/net/i4b/layer2/i4b_mbuf.c,v 1.7 2005/06/15 11:56:03 joerg Exp $
  *
  *      last edit-date: [Sat Jan 13 13:15:45 2001]
  *
@@ -38,6 +38,8 @@
 #include <sys/systm.h>
 #include <sys/mbuf.h>
 #include <sys/socket.h>
+#include <sys/thread2.h>
+
 #include <net/if.h>
 
 #include "../include/i4b_mbuf.h"
@@ -129,10 +131,11 @@ i4b_Dfreembuf(struct mbuf *m)
 void
 i4b_Dcleanifq(struct ifqueue *ifq)
 {
-       int x = splimp();
+       crit_enter();
 
        IF_DRAIN(ifq);
-       splx(x);
+
+       crit_exit();
 }
 
 /*---------------------------------------------------------------------------*
@@ -205,10 +208,11 @@ i4b_Bfreembuf(struct mbuf *m)
 void
 i4b_Bcleanifq(struct ifqueue *ifq)
 {
-       int x = splimp();
+       crit_enter();
        
        IF_DRAIN(ifq);
-       splx(x);
+
+       crit_exit();
 }
 
 /* EOF */