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/420b39eca15b
branches:  trunk
changeset: 500796:420b39eca15b
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Mon Dec 18 20:41:44 2000 +0000

description:
ALTQ'ify.

diffstat:

 sys/net/if_sl.c |  39 +++++++++++++++++++++++++--------------
 1 files changed, 25 insertions(+), 14 deletions(-)

diffs (89 lines):

diff -r f88d1ef98352 -r 420b39eca15b sys/net/if_sl.c
--- a/sys/net/if_sl.c   Mon Dec 18 20:40:25 2000 +0000
+++ b/sys/net/if_sl.c   Mon Dec 18 20:41:44 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_sl.c,v 1.62 2000/12/18 19:50:45 thorpej Exp $       */
+/*     $NetBSD: if_sl.c,v 1.63 2000/12/18 20:41:44 thorpej Exp $       */
 
 /*
  * Copyright (c) 1987, 1989, 1992, 1993
@@ -213,8 +213,8 @@
                sc->sc_if.if_ioctl = slioctl;
                sc->sc_if.if_output = sloutput;
                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);
                if_attach(&sc->sc_if);
 #if NBPFILTER > 0
                bpfattach(&sc->sc_if, DLT_SLIP, SLIP_HDRLEN);
@@ -383,8 +383,10 @@
 {
        struct sl_softc *sc = ifp->if_softc;
        struct ip *ip;
-       struct ifqueue *ifq;
-       int s;
+       int s, error;
+       ALTQ_DECL(struct altq_pktattr pktattr;)
+
+       IFQ_CLASSIFY(&ifp->if_snd, m, dst->sa_family, &pktattr);
 
        /*
         * `Cannot happen' (see slioctl).  Someday we will extend
@@ -408,14 +410,11 @@
                printf("%s: no carrier and not local\n", sc->sc_if.if_xname);
                return (EHOSTUNREACH);
        }
-       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)
-               ifq = &sc->sc_fastq;
        s = splimp();
        if (sc->sc_oqlen && sc->sc_ttyp->t_outq.c_cc == sc->sc_oqlen) {
                struct timeval tv;
@@ -427,14 +426,26 @@
                        slstart(sc->sc_ttyp);
                }
        }
-       if (IF_QFULL(ifq)) {
-               IF_DROP(ifq);
-               m_freem(m);
+       if ((ip->ip_tos & IPTOS_LOWDELAY) != 0
+#ifdef ALTQ
+           && ALTQ_IS_ENABLED(&ifp->if_snd) == 0
+#endif
+           ) {
+               if (IF_QFULL(&sc->sc_fastq)) {
+                       IF_DROP(&sc->sc_fastq);
+                       m_freem(m);
+                       error = ENOBUFS;
+               } else {
+                       IF_ENQUEUE(&sc->sc_fastq, 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)
                slstart(sc->sc_ttyp);
@@ -516,7 +527,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) {
 #if NBPFILTER > 0



Home | Main Index | Thread Index | Old Index