Source-Changes-HG archive

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

[src/trunk]: src/sys/net Sync with if_sl.c,v 1.65:



details:   https://anonhg.NetBSD.org/src/rev/7d02f287a683
branches:  trunk
changeset: 502115:7d02f287a683
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Thu Jan 11 22:31:49 2001 +0000

description:
Sync with if_sl.c,v 1.65:

Once we have a complete frame, schedule a STRIP 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_strip.c    |  63 ++++++++++++++++++++++++++++++++++++++------------
 sys/net/if_stripvar.h |   3 +-
 2 files changed, 49 insertions(+), 17 deletions(-)

diffs (123 lines):

diff -r f0e349da4201 -r 7d02f287a683 sys/net/if_strip.c
--- a/sys/net/if_strip.c        Thu Jan 11 22:30:22 2001 +0000
+++ b/sys/net/if_strip.c        Thu Jan 11 22:31:49 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_strip.c,v 1.28 2001/01/11 22:23:11 thorpej Exp $    */
+/*     $NetBSD: if_strip.c,v 1.29 2001/01/11 22:31:49 thorpej Exp $    */
 /*     from: NetBSD: if_sl.c,v 1.38 1996/02/13 22:00:23 christos Exp $ */
 
 /*
@@ -270,6 +270,7 @@
 struct mbuf * strip_send __P((struct strip_softc *sc, struct mbuf *m0));
 
 void   strip_timeout __P((void *x));
+void   stripintr(void);
 
 
 
@@ -517,10 +518,11 @@
                if_down(&sc->sc_if);
                sc->sc_ttyp = NULL;
                tp->t_sc = NULL;
-
                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);
 
                /* XXX */
                free((caddr_t)(sc->sc_rxbuf - SLBUFSIZE + SLMAX), M_DEVBUF);
@@ -1271,25 +1273,14 @@
 
                hp[SLX_DIR] = SLIPDIR_IN;
                memcpy(&hp[SLX_CHDR], chdr, CHDR_LEN);
-
-               bpf_mtap(sc->sc_if.if_bpf, m);
        }
 #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_STRIP);
        splx(s);
+
        goto newpack;
 
 error:
@@ -1300,6 +1291,46 @@
            BUFOFFSET;
 }
 
+void
+stripintr(void)
+{
+       struct strip_softc *sc;
+       struct mbuf *m;
+       int i, s;
+
+       for (i = 0; i < NSTRIP; i++) {
+               sc = &strip_softc[i];
+               for (;;) {
+                       s = spltty();
+                       IF_DEQUEUE(&sc->sc_inq, m);
+                       splx(s);
+                       if (m == NULL)
+                               break;
+#if NPBFILTER > 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 f0e349da4201 -r 7d02f287a683 sys/net/if_stripvar.h
--- a/sys/net/if_stripvar.h     Thu Jan 11 22:30:22 2001 +0000
+++ b/sys/net/if_stripvar.h     Thu Jan 11 22:31:49 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_stripvar.h,v 1.9 2001/01/11 22:23:12 thorpej Exp $  */
+/*     $NetBSD: if_stripvar.h,v 1.10 2001/01/11 22:31:50 thorpej Exp $ */
 
 #ifndef _NET_IF_STRIPVAR_H_
 #define _NET_IF_STRIPVAR_H_
@@ -10,6 +10,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 */
        struct  callout sc_timo_ch;     /* timeout callout */
        u_char  *sc_mp;                 /* pointer to next available buf char */



Home | Main Index | Thread Index | Old Index