Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net Add ALTQ support.
details: https://anonhg.NetBSD.org/src/rev/f6c1ac4fa129
branches: trunk
changeset: 500785:f6c1ac4fa129
user: thorpej <thorpej%NetBSD.org@localhost>
date: Mon Dec 18 18:57:21 2000 +0000
description:
Add ALTQ support.
diffstat:
sys/net/if_ppp.c | 61 ++++++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 46 insertions(+), 15 deletions(-)
diffs (133 lines):
diff -r 1ffa0e1d4433 -r f6c1ac4fa129 sys/net/if_ppp.c
--- a/sys/net/if_ppp.c Mon Dec 18 18:57:11 2000 +0000
+++ b/sys/net/if_ppp.c Mon Dec 18 18:57:21 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ppp.c,v 1.63 2000/12/12 18:00:27 thorpej Exp $ */
+/* $NetBSD: if_ppp.c,v 1.64 2000/12/18 18:57:21 thorpej Exp $ */
/* Id: if_ppp.c,v 1.6 1997/03/04 03:33:00 paulus Exp */
/*
@@ -207,10 +207,11 @@
sc->sc_if.if_hdrlen = PPP_HDRLEN;
sc->sc_if.if_ioctl = pppsioctl;
sc->sc_if.if_output = pppoutput;
- sc->sc_if.if_snd.ifq_maxlen = IFQ_MAXLEN;
+ IFQ_SET_MAXLEN(&sc->sc_if.if_snd, IFQ_MAXLEN);
sc->sc_inq.ifq_maxlen = IFQ_MAXLEN;
sc->sc_fastq.ifq_maxlen = IFQ_MAXLEN;
sc->sc_rawq.ifq_maxlen = IFQ_MAXLEN;
+ IFQ_SET_READY(&sc->sc_if.if_snd);
if_attach(&sc->sc_if);
#if NBPFILTER > 0
bpfattach(&sc->sc_if, DLT_NULL, 0);
@@ -722,6 +723,7 @@
enum NPmode mode;
int len;
struct mbuf *m;
+ ALTQ_DECL(struct altq_pktattr pktattr;)
if (sc->sc_devp == NULL || (ifp->if_flags & IFF_RUNNING) == 0
|| ((ifp->if_flags & IFF_UP) == 0 && dst->sa_family != AF_UNSPEC)) {
@@ -729,6 +731,8 @@
goto bad;
}
+ IFQ_CLASSIFY(&ifp->if_snd, m0, dst->sa_family, &pktattr);
+
/*
* Compute PPP header.
*/
@@ -868,16 +872,29 @@
m0->m_nextpkt = NULL;
sc->sc_npqtail = &m0->m_nextpkt;
} else {
- ifq = (m0->m_flags & M_HIGHPRI)? &sc->sc_fastq: &ifp->if_snd;
- if (IF_QFULL(ifq) && dst->sa_family != AF_UNSPEC) {
- IF_DROP(ifq);
+ if ((m0->m_flags & M_HIGHPRI)
+#ifdef ALTQ
+ && ALTQ_IS_ENABLED(&sc->sc_if.if_snd) == 0
+#endif
+ ) {
+ ifq = &sc->sc_fastq;
+ if (IF_QFULL(ifq) && dst->sa_family != AF_UNSPEC) {
+ IF_DROP(ifq);
+ splx(s);
+ error = ENOBUFS;
+ goto bad;
+ } else {
+ IF_ENQUEUE(ifq, m0);
+ error = 0;
+ }
+ } else
+ IFQ_ENQUEUE(&sc->sc_if.if_snd, m0, &pktattr, error);
+ if (error) {
splx(s);
sc->sc_if.if_oerrors++;
sc->sc_stats.ppp_oerrors++;
- error = ENOBUFS;
- goto bad;
+ return (error);
}
- IF_ENQUEUE(ifq, m0);
ppp_restart(sc);
}
ifp->if_lastchange = time;
@@ -904,6 +921,7 @@
struct mbuf *m, **mpp;
struct ifqueue *ifq;
enum NPmode mode;
+ int error;
for (mpp = &sc->sc_npqueue; (m = *mpp) != NULL; ) {
switch (PPP_PROTOCOL(mtod(m, u_char *))) {
@@ -924,13 +942,26 @@
*/
*mpp = m->m_nextpkt;
m->m_nextpkt = NULL;
- ifq = (m->m_flags & M_HIGHPRI)? &sc->sc_fastq: &sc->sc_if.if_snd;
- if (IF_QFULL(ifq)) {
- IF_DROP(ifq);
+ if ((m->m_flags & M_HIGHPRI)
+#ifdef ALTQ
+ && ALTQ_IS_ENABLED(&sc->sc_if.if_snd) == 0
+#endif
+ ) {
+ ifq = &sc->sc_fastq;
+ if (IF_QFULL(ifq)) {
+ IF_DROP(ifq);
+ m_freem(m);
+ error = ENOBUFS;
+ } else {
+ IF_ENQUEUE(ifq, m);
+ error = 0;
+ }
+ } else
+ IFQ_ENQUEUE(&sc->sc_if.if_snd, m, NULL, error);
+ if (error) {
sc->sc_if.if_oerrors++;
sc->sc_stats.ppp_oerrors++;
- } else
- IF_ENQUEUE(ifq, m);
+ }
break;
case NPMODE_DROP:
@@ -984,7 +1015,7 @@
s = splimp();
IF_DEQUEUE(&sc->sc_fastq, m);
if (m == NULL)
- IF_DEQUEUE(&sc->sc_if.if_snd, m);
+ IFQ_DEQUEUE(&sc->sc_if.if_snd, m);
splx(s);
if (m == NULL)
@@ -1111,7 +1142,7 @@
s = splsoftnet();
for (i = 0; i < NPPP; ++i, ++sc) {
if (!(sc->sc_flags & SC_TBUSY)
- && (sc->sc_if.if_snd.ifq_head || sc->sc_fastq.ifq_head
+ && (IFQ_IS_EMPTY(&sc->sc_if.if_snd) == 0 || sc->sc_fastq.ifq_head
|| sc->sc_outm)) {
s2 = splimp();
sc->sc_flags |= SC_TBUSY;
Home |
Main Index |
Thread Index |
Old Index