Source-Changes-HG archive

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

[src/trunk]: src/sys/net Once we have a complete frame, schedule a SLIP softw...



details:   https://anonhg.NetBSD.org/src/rev/7421032bbab6
branches:  trunk
changeset: 501911:7421032bbab6
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Tue Jan 09 05:04:23 2001 +0000

description:
Once we have a complete frame, schedule a SLIP software interrupt,
and manipulate ipintrq from there.  This will allow us to clean up
the use of splimp() in this file later.

diffstat:

 sys/net/if_sl.c           |  59 ++++++++++++++++++++++++++++++++++++----------
 sys/net/if_slvar.h        |   4 ++-
 sys/net/netisr_dispatch.h |   5 +++-
 3 files changed, 53 insertions(+), 15 deletions(-)

diffs (133 lines):

diff -r 7bcd7cb45432 -r 7421032bbab6 sys/net/if_sl.c
--- a/sys/net/if_sl.c   Tue Jan 09 05:03:10 2001 +0000
+++ b/sys/net/if_sl.c   Tue Jan 09 05:04:23 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_sl.c,v 1.64 2001/01/09 04:42:48 thorpej Exp $       */
+/*     $NetBSD: if_sl.c,v 1.65 2001/01/09 05:04:23 thorpej Exp $       */
 
 /*
  * Copyright (c) 1987, 1989, 1992, 1993
@@ -322,6 +322,8 @@
                m_freem(sc->sc_mbuf);
                sc->sc_mbuf = NULL;
                sc->sc_ep = sc->sc_mp = sc->sc_pktstart = NULL;
+               IF_PURGE(&sc->sc_fastq);
+               IF_PURGE(&sc->sc_inq);
        }
 #ifdef __NetBSD__
        /* if necessary, install a new outq buffer of the appropriate size */
@@ -865,20 +867,11 @@
                }
 #endif
 
-               m_adj(m, SLIP_HDRLEN);
-               sc->sc_if.if_ipackets++;
-               sc->sc_if.if_lastchange = time;
+               IF_ENQUEUE(&sc->sc_inq, m);
                s = splimp();
-               if (IF_QFULL(&ipintrq)) {
-                       IF_DROP(&ipintrq);
-                       sc->sc_if.if_ierrors++;
-                       sc->sc_if.if_iqdrops++;
-                       m_freem(m);
-               } else {
-                       IF_ENQUEUE(&ipintrq, m);
-                       schednetisr(NETISR_IP);
-               }
+               schednetisr(NETISR_SLIP);
                splx(s);
+
                goto newpack;
        }
        if (sc->sc_mp < sc->sc_ep) {
@@ -898,6 +891,46 @@
        sc->sc_escape = 0;
 }
 
+void
+slintr(void)
+{
+       struct sl_softc *sc;
+       struct mbuf *m;
+       int i, s;
+
+       for (i = 0; i < NSL; i++) {
+               sc = &sl_softc[i];
+               for (;;) {
+                       s = spltty();
+                       IF_DEQUEUE(&sc->sc_inq, m);
+                       splx(s);
+                       if (m == NULL)
+                               break;
+#if NBPFILTER > 0
+                       if (sc->sc_if.if_bpf) {
+                               s = splnet();
+                               bpf_mtap(sc->sc_if.if_bpf, m);
+                               splx(s);
+                       }
+#endif
+                       m_adj(m, SLIP_HDRLEN);
+                       sc->sc_if.if_ipackets++;
+                       sc->sc_if.if_lastchange = time;
+                       s = splimp();
+                       if (IF_QFULL(&ipintrq)) {
+                               IF_DROP(&ipintrq);
+                               sc->sc_if.if_ierrors++;
+                               sc->sc_if.if_iqdrops++;
+                               m_freem(m);
+                       } else {
+                               IF_ENQUEUE(&ipintrq, m);
+                               schednetisr(NETISR_IP);
+                       }
+                       splx(s);
+               }
+       }
+}
+
 /*
  * Process an ioctl request.
  */
diff -r 7bcd7cb45432 -r 7421032bbab6 sys/net/if_slvar.h
--- a/sys/net/if_slvar.h        Tue Jan 09 05:03:10 2001 +0000
+++ b/sys/net/if_slvar.h        Tue Jan 09 05:04:23 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_slvar.h,v 1.21 2001/01/09 04:42:49 thorpej Exp $    */
+/*     $NetBSD: if_slvar.h,v 1.22 2001/01/09 05:04:23 thorpej Exp $    */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -48,6 +48,7 @@
        struct  ifnet sc_if;            /* network-visible interface */
        int     sc_unit;                /* XXX unit number */
        struct  ifqueue sc_fastq;       /* interactive output queue */
+       struct  ifqueue sc_inq;         /* input queue */
        struct  tty *sc_ttyp;           /* pointer to tty structure */
        u_char  *sc_mp;                 /* pointer to next available buf char */
        u_char  *sc_ep;                 /* pointer to last available buf char */
@@ -87,6 +88,7 @@
            struct mbuf *, struct sockaddr *, struct rtentry *));
 void   slstart __P((struct tty *));
 int    sltioctl __P((struct tty *, u_long, caddr_t, int));
+void   slintr __P((void));
 #endif /* _KERNEL */
 
 #endif /* _NET_IF_SLVAR_H_ */
diff -r 7bcd7cb45432 -r 7421032bbab6 sys/net/netisr_dispatch.h
--- a/sys/net/netisr_dispatch.h Tue Jan 09 05:03:10 2001 +0000
+++ b/sys/net/netisr_dispatch.h Tue Jan 09 05:04:23 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netisr_dispatch.h,v 1.2 2000/07/02 04:40:47 cgd Exp $ */
+/* $NetBSD: netisr_dispatch.h,v 1.3 2001/01/09 05:04:23 thorpej Exp $ */
 
 /*
  * netisr_dispatch: This file is included by the 
@@ -48,6 +48,9 @@
 #ifdef NATM
        DONETISR(NETISR_NATM,natmintr);
 #endif
+#if NSL > 0
+       DONETISR(NETISR_SLIP,slintr);
+#endif
 #if NPPP > 0
        DONETISR(NETISR_PPP,pppintr);
 #endif



Home | Main Index | Thread Index | Old Index