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 glue.



details:   https://anonhg.NetBSD.org/src/rev/f64fdb74580a
branches:  trunk
changeset: 500558:f64fdb74580a
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Wed Dec 13 22:07:50 2000 +0000

description:
Add ALTQ glue.

diffstat:

 sys/net/if_atmsubr.c      |  22 +++++++++++++++-------
 sys/net/if_ethersubr.c    |  27 +++++++++++++++++++--------
 sys/net/if_fddisubr.c     |  27 +++++++++++++++++++--------
 sys/net/if_hippisubr.c    |  23 ++++++++++++++++-------
 sys/net/if_ieee1394subr.c |   6 +++++-
 sys/net/if_spppsubr.c     |  40 +++++++++++++++++++++++++++++-----------
 sys/net/if_tokensubr.c    |  27 +++++++++++++++++++--------
 7 files changed, 122 insertions(+), 50 deletions(-)

diffs (truncated from 430 to 300 lines):

diff -r 29f4b1387b01 -r f64fdb74580a sys/net/if_atmsubr.c
--- a/sys/net/if_atmsubr.c      Wed Dec 13 22:06:05 2000 +0000
+++ b/sys/net/if_atmsubr.c      Wed Dec 13 22:07:50 2000 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: if_atmsubr.c,v 1.24 2000/12/12 18:22:39 thorpej Exp $       */
+/*      $NetBSD: if_atmsubr.c,v 1.25 2000/12/13 22:07:50 thorpej Exp $       */
 
 /*
  *
@@ -102,19 +102,27 @@
        struct rtentry *rt0;
 {
        u_int16_t etype = 0;                    /* if using LLC/SNAP */
-       int s, error = 0, sz;
+       int s, error = 0, sz, len;
        struct atm_pseudohdr atmdst, *ad;
        struct mbuf *m = m0;
        struct rtentry *rt;
        struct atmllc *atmllc;
        struct atmllc *llc_hdr = NULL;
        u_int32_t atm_flags;
+       ALTQ_DECL(struct altq_pktattr pktattr;)
 
        if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING))
                senderr(ENETDOWN);
        ifp->if_lastchange = time;
 
        /*
+        * If the queueing discipline needs packet classification,
+        * do it before prepending link headers.
+        */
+       IFQ_CLASSIFY(&ifp->if_snd, m,
+            (dst != NULL ? dst->sa_family : AF_UNSPEC), &pktattr);
+
+       /*
         * check route
         */
        if ((rt = rt0) != NULL) {
@@ -220,14 +228,14 @@
         * not yet active.
         */
 
+       len = m->m_pkthdr.len;
        s = splimp();
-       if (IF_QFULL(&ifp->if_snd)) {
-               IF_DROP(&ifp->if_snd);
+       IFQ_ENQUEUE(&ifp->if_snd, m, &pktattr, error);
+       if (error) {
                splx(s);
-               senderr(ENOBUFS);
+               return (error);
        }
-       ifp->if_obytes += m->m_pkthdr.len;
-       IF_ENQUEUE(&ifp->if_snd, m);
+       ifp->if_obytes += len;
        if ((ifp->if_flags & IFF_OACTIVE) == 0)
                (*ifp->if_start)(ifp);
        splx(s);
diff -r 29f4b1387b01 -r f64fdb74580a sys/net/if_ethersubr.c
--- a/sys/net/if_ethersubr.c    Wed Dec 13 22:06:05 2000 +0000
+++ b/sys/net/if_ethersubr.c    Wed Dec 13 22:07:50 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_ethersubr.c,v 1.71 2000/12/12 18:00:25 thorpej Exp $        */
+/*     $NetBSD: if_ethersubr.c,v 1.72 2000/12/13 22:07:50 thorpej Exp $        */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -174,18 +174,20 @@
        struct rtentry *rt0)
 {
        u_int16_t etype = 0;
-       int s, error = 0, hdrcmplt = 0;
+       int s, len, error = 0, hdrcmplt = 0;
        u_char esrc[6], edst[6];
        struct mbuf *m = m0;
        struct rtentry *rt;
        struct mbuf *mcopy = (struct mbuf *)0;
        struct ether_header *eh;
+       ALTQ_DECL(struct altq_pktattr pktattr;)
 #ifdef INET
        struct arphdr *ah;
 #endif /* INET */
 #ifdef NETATALK
        struct at_ifaddr *aa;
 #endif /* NETATALK */
+       short mflags;
 
        if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING))
                senderr(ENETDOWN);
@@ -222,6 +224,13 @@
                            time.tv_sec < rt->rt_rmx.rmx_expire)
                                senderr(rt == rt0 ? EHOSTDOWN : EHOSTUNREACH);
        }
+
+       /*
+        * If the queueing discipline needs packet classification,
+        * do it before prepending link headers.
+        */
+       IFQ_CLASSIFY(&ifp->if_snd, m, dst->sa_family, &pktattr);
+
        switch (dst->sa_family) {
 
 #ifdef INET
@@ -468,20 +477,22 @@
        else
                bcopy(LLADDR(ifp->if_sadl), (caddr_t)eh->ether_shost,
                    sizeof(eh->ether_shost));
+       mflags = m->m_flags;
+       len = m->m_pkthdr.len;
        s = splimp();
        /*
         * Queue message on interface, and start output if interface
         * not yet active.
         */
-       if (IF_QFULL(&ifp->if_snd)) {
-               IF_DROP(&ifp->if_snd);
+       IFQ_ENQUEUE(&ifp->if_snd, m, &pktattr, error);
+       if (error) {
+               /* mbuf is already freed */
                splx(s);
-               senderr(ENOBUFS);
+               return (error);
        }
-       ifp->if_obytes += m->m_pkthdr.len;
-       if (m->m_flags & M_MCAST)
+       ifp->if_obytes += len;
+       if (mflags & M_MCAST)
                ifp->if_omcasts++;
-       IF_ENQUEUE(&ifp->if_snd, m);
        if ((ifp->if_flags & IFF_OACTIVE) == 0)
                (*ifp->if_start)(ifp);
        splx(s);
diff -r 29f4b1387b01 -r f64fdb74580a sys/net/if_fddisubr.c
--- a/sys/net/if_fddisubr.c     Wed Dec 13 22:06:05 2000 +0000
+++ b/sys/net/if_fddisubr.c     Wed Dec 13 22:07:50 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_fddisubr.c,v 1.35 2000/12/12 18:00:26 thorpej Exp $ */
+/*     $NetBSD: if_fddisubr.c,v 1.36 2000/12/13 22:07:50 thorpej Exp $ */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -211,12 +211,14 @@
        struct rtentry *rt0;
 {
        u_int16_t etype;
-       int s, error = 0, hdrcmplt = 0;
+       int s, len, error = 0, hdrcmplt = 0;
        u_char esrc[6], edst[6];
        struct mbuf *m = m0;
        struct rtentry *rt;
        struct fddi_header *fh;
        struct mbuf *mcopy = (struct mbuf *)0;
+       ALTQ_DECL(struct altq_pktattr pktattr;)
+       short mflags;
 
        if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING))
                senderr(ENETDOWN);
@@ -245,6 +247,13 @@
                                senderr(rt == rt0 ? EHOSTDOWN : EHOSTUNREACH);
        }
 #endif
+
+       /*
+        * If the queueing discipline needs packet classification,
+        * do it before prepending link headers.
+        */
+       IFQ_CLASSIFY(&ifp->if_snd, m, dst->sa_family, &pktattr);
+
        switch (dst->sa_family) {
 
 #ifdef INET
@@ -575,20 +584,22 @@
        else
                bcopy((caddr_t)FDDIADDR(ifp), (caddr_t)fh->fddi_shost,
                    sizeof(fh->fddi_shost));
+       mflags = m->m_flags;
+       len = m->m_pkthdr.len;
        s = splimp();
        /*
         * Queue message on interface, and start output if interface
         * not yet active.
         */
-       if (IF_QFULL(&ifp->if_snd)) {
-               IF_DROP(&ifp->if_snd);
+       IFQ_ENQUEUE(&ifp->if_snd, m, &pktattr, error);
+       if (error) {
+               /* mbuf is already freed */
                splx(s);
-               senderr(ENOBUFS);
+               return (error);
        }
-       ifp->if_obytes += m->m_pkthdr.len;
-       if (m->m_flags & M_MCAST)
+       ifp->if_obytes += len;
+       if (mflags & M_MCAST)
                ifp->if_omcasts++;
-       IF_ENQUEUE(&ifp->if_snd, m);
        if ((ifp->if_flags & IFF_OACTIVE) == 0)
                (*ifp->if_start)(ifp);
        splx(s);
diff -r 29f4b1387b01 -r f64fdb74580a sys/net/if_hippisubr.c
--- a/sys/net/if_hippisubr.c    Wed Dec 13 22:06:05 2000 +0000
+++ b/sys/net/if_hippisubr.c    Wed Dec 13 22:07:50 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_hippisubr.c,v 1.7 2000/12/12 18:00:27 thorpej Exp $ */
+/*     $NetBSD: if_hippisubr.c,v 1.8 2000/12/13 22:07:51 thorpej Exp $ */
 
 /*
  * Copyright (c) 1982, 1989, 1993
@@ -97,12 +97,13 @@
 {
        u_int16_t htype;
        u_int32_t ifield = 0;
-       int s, error = 0;
+       int s, len, error = 0;
        struct mbuf *m = m0;
        struct rtentry *rt;
        struct hippi_header *hh;
        u_int32_t *cci;
        u_int32_t d2_len;
+       ALTQ_DECL(struct altq_pktattr pktattr;)
 
        if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING))
                senderr(ENETDOWN);
@@ -144,6 +145,13 @@
                            time.tv_sec < rt->rt_rmx.rmx_expire)
                                senderr(rt == rt0 ? EHOSTDOWN : EHOSTUNREACH);
        }
+
+       /*
+        * If the queueing discipline needs packet classification,
+        * do it before prepending link headers.
+        */
+       IFQ_CLASSIFY(&ifp->if_snd, m, dst->sa_family, &pktattr);
+
        switch (dst->sa_family) {
 
 #ifdef INET
@@ -210,18 +218,19 @@
                m_copyback(m, m->m_pkthdr.len, 8 - d2_len % 8, (caddr_t) buffer);
        }
 
+       len = m->m_pkthdr.len;
        s = splimp();
        /*
         * Queue message on interface, and start output if interface
         * not yet active.
         */
-       if (IF_QFULL(&ifp->if_snd)) {
-               IF_DROP(&ifp->if_snd);
+       IFQ_ENQUEUE(&ifp->if_snd, m, &pktattr, error);
+       if (error) {
+               /* mbuf is already free */
                splx(s);
-               senderr(ENOBUFS);
+               return (error);
        }
-       ifp->if_obytes += m->m_pkthdr.len;
-       IF_ENQUEUE(&ifp->if_snd, m);
+       ifp->if_obytes += len;
        if ((ifp->if_flags & IFF_OACTIVE) == 0)
                (*ifp->if_start)(ifp);
        splx(s);
diff -r 29f4b1387b01 -r f64fdb74580a sys/net/if_ieee1394subr.c
--- a/sys/net/if_ieee1394subr.c Wed Dec 13 22:06:05 2000 +0000
+++ b/sys/net/if_ieee1394subr.c Wed Dec 13 22:07:50 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_ieee1394subr.c,v 1.4 2000/12/12 18:00:27 thorpej Exp $      */
+/*     $NetBSD: if_ieee1394subr.c,v 1.5 2000/12/13 22:07:51 thorpej Exp $      */
 
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -95,6 +95,10 @@
        struct ieee1394_arphdr *ah;
 #endif /* INET */
 
+       /*
+        * XXX ALTQ
+        */
+
        if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING))
                senderr(ENETDOWN);
        ifp->if_lastchange = time;
diff -r 29f4b1387b01 -r f64fdb74580a sys/net/if_spppsubr.c
--- a/sys/net/if_spppsubr.c     Wed Dec 13 22:06:05 2000 +0000
+++ b/sys/net/if_spppsubr.c     Wed Dec 13 22:07:50 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_spppsubr.c,v 1.14 2000/10/10 11:43:51 itojun Exp $   */
+/*     $NetBSD: if_spppsubr.c,v 1.15 2000/12/13 22:07:51 thorpej Exp $  */
 
 /*
  * Synchronous PPP/Cisco link level subroutines.
@@ -673,8 +673,9 @@
 {
        struct sppp *sp = (struct sppp*) ifp;
        struct ppp_header *h;
-       struct ifqueue *ifq;
-       int s, rv = 0;
+       struct ifqueue *ifq = NULL;             /* XXX */
+       int s, len, rv = 0;



Home | Main Index | Thread Index | Old Index