Source-Changes-HG archive

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

[src/trunk]: src/sys/net ALTQ'ify.



details:   https://anonhg.NetBSD.org/src/rev/0cd1b2875e92
branches:  trunk
changeset: 500798:0cd1b2875e92
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Mon Dec 18 20:47:10 2000 +0000

description:
ALTQ'ify.

diffstat:

 sys/net/if_strip.c |  43 ++++++++++++++++++++++++++++---------------
 1 files changed, 28 insertions(+), 15 deletions(-)

diffs (104 lines):

diff -r 7aaede0d5711 -r 0cd1b2875e92 sys/net/if_strip.c
--- a/sys/net/if_strip.c        Mon Dec 18 20:43:58 2000 +0000
+++ b/sys/net/if_strip.c        Mon Dec 18 20:47:10 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_strip.c,v 1.25 2000/12/18 19:50:45 thorpej Exp $    */
+/*     $NetBSD: if_strip.c,v 1.26 2000/12/18 20:47:10 thorpej Exp $    */
 /*     from: NetBSD: if_sl.c,v 1.38 1996/02/13 22:00:23 christos Exp $ */
 
 /*
@@ -361,8 +361,8 @@
                sc->sc_if.if_ioctl = stripioctl;
                sc->sc_if.if_output = stripoutput;
                sc->sc_if.if_dlt = DLT_SLIP;
-               sc->sc_if.if_snd.ifq_maxlen = 50;
                sc->sc_fastq.ifq_maxlen = 32;
+               IFQ_SET_READY(&sc->sc_if.if_snd);
 
                sc->sc_if.if_watchdog = strip_watchdog;
                if_attach(&sc->sc_if);
@@ -726,12 +726,12 @@
 {
        struct strip_softc *sc = ifp->if_softc;
        struct ip *ip;
-       struct ifqueue *ifq;
        struct st_header *shp;
        const u_char *dldst;            /* link-level next-hop */
-       int s;
+       struct ifqueue *ifq;
+       int s, error;
        u_char dl_addrbuf[STARMODE_ADDR_LEN+1];
-
+       ALTQ_DECL(altq_pktattr pktattr;)
 
        /*
         * Verify tty line is up and alive.
@@ -792,14 +792,19 @@
                return (EAFNOSUPPORT);
        }
        
-       ifq = &sc->sc_if.if_snd;
        ip = mtod(m, struct ip *);
        if (sc->sc_if.if_flags & SC_NOICMP && ip->ip_p == IPPROTO_ICMP) {
                m_freem(m);
                return (ENETRESET);             /* XXX ? */
        }
-       if (ip->ip_tos & IPTOS_LOWDELAY)
+       if ((ip->ip_tos & IPTOS_LOWDELAY) != 0
+#ifdef ALTQ
+           && ALTQ_IS_ENABLED(&ifp->if_snd) == 0
+#endif
+           )
                ifq = &sc->sc_fastq;
+       else
+               ifq = NULL;
 
        /*
         * Add local net header.  If no space in first mbuf,
@@ -856,14 +861,22 @@
                        stripstart(sc->sc_ttyp);
                }
        }
-       if (IF_QFULL(ifq)) {
-               IF_DROP(ifq);
-               m_freem(m);
+       if (ifq != NULL) {
+               if (IF_QFULL(ifq)) {
+                       IF_DROP(ifq);
+                       m_freem(m);
+                       error = ENOBUFS;
+               } else {
+                       IF_ENQUEUE(ifq, m);
+                       error = 0;
+               }
+       } else
+               IFQ_ENQUEUE(&ifp->if_snd, m, &pktattr, error);
+       if (error) {
                splx(s);
-               sc->sc_if.if_oerrors++;
-               return (ENOBUFS);
+               ifp->if_oerrors++;
+               return (error);
        }
-       IF_ENQUEUE(ifq, m);
        sc->sc_if.if_lastchange = time;
        if ((sc->sc_oqlen = sc->sc_ttyp->t_outq.c_cc) == 0) {
                stripstart(sc->sc_ttyp);
@@ -873,7 +886,7 @@
         * slip doesn't call its start routine unconditionally (again)
         * here, but doing so apepars to reduce latency.
         */
-        stripstart(sc->sc_ttyp);
+       stripstart(sc->sc_ttyp);
 
        splx(s);
        return (0);
@@ -953,7 +966,7 @@
                if (m)
                        sc->sc_if.if_omcasts++;         /* XXX */
                else
-                       IF_DEQUEUE(&sc->sc_if.if_snd, m);
+                       IFQ_DEQUEUE(&sc->sc_if.if_snd, m);
                splx(s);
                if (m == NULL) {
                        return;



Home | Main Index | Thread Index | Old Index