summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authormlaier <mlaier@FreeBSD.org>2004-06-13 17:29:10 +0000
committermlaier <mlaier@FreeBSD.org>2004-06-13 17:29:10 +0000
commit977d97b004a1ae5bbd9d42eae28386f8e2372068 (patch)
tree75b8601b85775d6a872ff81b3098fedeb53233af /sys
parent469e445f95c246a203c12198eff9932b25b49b12 (diff)
downloadFreeBSD-src-977d97b004a1ae5bbd9d42eae28386f8e2372068.zip
FreeBSD-src-977d97b004a1ae5bbd9d42eae28386f8e2372068.tar.gz
Link ALTQ to the build and break with ABI for struct ifnet. Please recompile
your (network) modules as well as any userland that might make sense of sizeof(struct ifnet). This does not change the queueing yet. These changes will follow in a seperate commit. Same with the driver changes, which need case by case evaluation. __FreeBSD_version bump will follow. Tested-by: (i386)LINT
Diffstat (limited to 'sys')
-rw-r--r--sys/conf/NOTES14
-rw-r--r--sys/conf/files8
-rw-r--r--sys/conf/kern.pre.mk3
-rw-r--r--sys/conf/kmod.mk4
-rw-r--r--sys/conf/options9
-rw-r--r--sys/dev/awi/awi.c2
-rw-r--r--sys/dev/pdq/pdq_freebsd.h2
-rw-r--r--sys/dev/wi/if_wi.c2
-rw-r--r--sys/i4b/driver/i4b_ipr.c2
-rw-r--r--sys/net/if.c21
-rw-r--r--sys/net/if_ppp.c6
-rw-r--r--sys/net/if_sl.c2
-rw-r--r--sys/net/if_spppsubr.c4
-rw-r--r--sys/net/if_var.h207
-rw-r--r--sys/net80211/ieee80211_input.c5
-rw-r--r--sys/netinet/ip_input.c6
-rw-r--r--sys/netinet/ip_output.c7
-rw-r--r--sys/netinet6/ip6_input.c6
18 files changed, 292 insertions, 18 deletions
diff --git a/sys/conf/NOTES b/sys/conf/NOTES
index ba02f00..ecb447d 100644
--- a/sys/conf/NOTES
+++ b/sys/conf/NOTES
@@ -399,6 +399,20 @@ options NETSMBCRYPTO #encrypted password support for SMB
# mchain library. It can be either loaded as KLD or compiled into kernel
options LIBMCHAIN
+# altq(9). Enable the base part of the hooks with the ALTQ option.
+# Individual disciplines must be built into the base system and can not be
+# loaded as modules at this point. In order to build a SMP kernel you must
+# also have the ALTQ_NOPCC option.
+options ALTQ
+options ALTQ_CBQ # Class Bases Queueing
+options ALTQ_RED # Random Early Drop
+options ALTQ_RIO # RED In/Out
+options ALTQ_HFSC # Hierarchical Packet Scheduler
+options ALTQ_CDNR # Traffic conditioner
+options ALTQ_PRIQ # Prioirity Queueing
+options ALTQ_NOPCC # Required for SMP build
+options ALTQ_DEBUG
+
# netgraph(4). Enable the base netgraph code with the NETGRAPH option.
# Individual node types can be enabled with the corresponding option
# listed below; however, this is not strictly necessary as netgraph
diff --git a/sys/conf/files b/sys/conf/files
index 72afd93..4bf1291 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -85,6 +85,14 @@ coda/coda_venus.c optional vcoda
coda/coda_vfsops.c optional vcoda
coda/coda_vnops.c optional vcoda
compat/linprocfs/linprocfs.c optional linprocfs
+contrib/altq/altq/altq_cbq.c optional altq
+contrib/altq/altq/altq_cdnr.c optional altq
+contrib/altq/altq/altq_hfsc.c optional altq
+contrib/altq/altq/altq_priq.c optional altq
+contrib/altq/altq/altq_red.c optional altq
+contrib/altq/altq/altq_rio.c optional altq
+contrib/altq/altq/altq_rmclass.c optional altq
+contrib/altq/altq/altq_subr.c optional altq
contrib/dev/acpica/dbcmds.c optional acpi acpi_debug
contrib/dev/acpica/dbdisply.c optional acpi acpi_debug
contrib/dev/acpica/dbexec.c optional acpi acpi_debug
diff --git a/sys/conf/kern.pre.mk b/sys/conf/kern.pre.mk
index 83afd1e..0dc3b01 100644
--- a/sys/conf/kern.pre.mk
+++ b/sys/conf/kern.pre.mk
@@ -51,6 +51,9 @@ INCLUDES= ${NOSTDINC} -I- ${INCLMAGIC} -I. -I$S
# include path into 100+ source files.
INCLUDES+= -I$S/contrib/dev/acpica
+# ... and the same for altq
+INCLUDES+= -I$S/contrib/altq
+
# ... and the same for ipfilter
INCLUDES+= -I$S/contrib/ipfilter
diff --git a/sys/conf/kmod.mk b/sys/conf/kmod.mk
index de4461b..90c839e 100644
--- a/sys/conf/kmod.mk
+++ b/sys/conf/kmod.mk
@@ -96,6 +96,10 @@ CFLAGS+= -include ${KERNBUILDDIR}/opt_global.h
# set because there are no standard paths for non-headers.
CFLAGS+= -I. -I@
+# Add -I path for altq headers as they are included via net/if_var.h
+# for example.
+CFLAGS+= -I@/contrib/altq
+
# Add a -I path to standard headers like <stddef.h>. Use a relative
# path to src/include if possible. If the @ symlink hasn't been built
# yet, then we can't tell if the relative path exists. Add both the
diff --git a/sys/conf/options b/sys/conf/options
index 03fc6c6..62913a1 100644
--- a/sys/conf/options
+++ b/sys/conf/options
@@ -294,6 +294,15 @@ DEV_ATARAID opt_ata.h
# Net stuff.
ACCEPT_FILTER_DATA
ACCEPT_FILTER_HTTP
+ALTQ opt_global.h
+ALTQ_CBQ opt_altq.h
+ALTQ_RED opt_altq.h
+ALTQ_RIO opt_altq.h
+ALTQ_HFSC opt_altq.h
+ALTQ_CDNR opt_altq.h
+ALTQ_PRIQ opt_altq.h
+ALTQ_NOPCC opt_altq.h
+ALTQ_DEBUG opt_altq.h
BOOTP opt_bootp.h
BOOTP_COMPAT opt_bootp.h
BOOTP_NFSROOT opt_bootp.h
diff --git a/sys/dev/awi/awi.c b/sys/dev/awi/awi.c
index db72716..11c6081 100644
--- a/sys/dev/awi/awi.c
+++ b/sys/dev/awi/awi.c
@@ -235,10 +235,12 @@ ether_sprintf(u_int8_t *enaddr)
}
#endif
+#if 0 /* ALTQ */
#define IFQ_PURGE(ifq) IF_DRAIN(ifq)
#define IF_POLL(ifq, m) ((m) = (ifq)->ifq_head)
#define IFQ_POLL(ifq, m) IF_POLL((ifq), (m))
#define IFQ_DEQUEUE(ifq, m) IF_DEQUEUE((ifq), (m))
+#endif
#endif
diff --git a/sys/dev/pdq/pdq_freebsd.h b/sys/dev/pdq/pdq_freebsd.h
index c86b14b..ba2a993 100644
--- a/sys/dev/pdq/pdq_freebsd.h
+++ b/sys/dev/pdq/pdq_freebsd.h
@@ -97,8 +97,10 @@ enum _pdq_type_t {
#define sc_ifmedia ifmedia
#define sc_if arpcom.ac_if
#define sc_bpf sc_if.if_bpf
+#if 0 /* ALTQ */
#define IFQ_DEQUEUE IF_DEQUEUE
#define IFQ_IS_EMPTY(q) ((q)->ifq_len == 0)
+#endif
typedef struct _pdq_os_ctx_t {
struct arpcom arpcom;
diff --git a/sys/dev/wi/if_wi.c b/sys/dev/wi/if_wi.c
index dc2e75e..70cff59 100644
--- a/sys/dev/wi/if_wi.c
+++ b/sys/dev/wi/if_wi.c
@@ -114,9 +114,11 @@ __FBSDID("$FreeBSD$");
#include <dev/wi/if_wireg.h>
#include <dev/wi/if_wivar.h>
+#if 0 /* ALTQ */
#define IF_POLL(ifq, m) ((m) = (ifq)->ifq_head)
#define IFQ_POLL(ifq, m) IF_POLL((ifq), (m))
#define IFQ_DEQUEUE(ifq, m) IF_DEQUEUE((ifq), (m))
+#endif
static void wi_start(struct ifnet *);
static int wi_reset(struct wi_softc *);
diff --git a/sys/i4b/driver/i4b_ipr.c b/sys/i4b/driver/i4b_ipr.c
index 6a30908..f0d9e8d 100644
--- a/sys/i4b/driver/i4b_ipr.c
+++ b/sys/i4b/driver/i4b_ipr.c
@@ -382,7 +382,7 @@ i4biproutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
if(ip->ip_tos & IPTOS_LOWDELAY)
ifq = &sc->sc_fastq;
else
- ifq = &sc->sc_if.if_snd;
+ ifq = (struct ifqueue *)&sc->sc_if.if_snd;
/* check for space in choosen send queue */
diff --git a/sys/net/if.c b/sys/net/if.c
index 3830c18..c1d874a 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -82,7 +82,7 @@ static void if_grow(void);
static void if_init(void *);
static void if_check(void *);
static int if_findindex(struct ifnet *);
-static void if_qflush(struct ifqueue *);
+static void if_qflush(struct ifaltq *);
static void if_route(struct ifnet *, int flag, int fam);
static void if_slowtimo(void *);
static void if_unroute(struct ifnet *, int flag, int fam);
@@ -441,6 +441,13 @@ if_attach(struct ifnet *ifp)
ifa->ifa_refcnt = 1;
TAILQ_INSERT_HEAD(&ifp->if_addrhead, ifa, ifa_link);
ifp->if_broadcastaddr = 0; /* reliably crash if used uninitialized */
+#ifdef ALTQ
+ ifp->if_snd.altq_type = 0;
+ ifp->if_snd.altq_disc = NULL;
+ ifp->if_snd.altq_flags &= ALTQF_CANTCHANGE;
+ ifp->if_snd.altq_tbr = NULL;
+ ifp->if_snd.altq_ifp = ifp;
+#endif
if (domains)
if_attachdomain1(ifp);
@@ -519,6 +526,12 @@ if_detach(struct ifnet *ifp)
*/
s = splnet();
if_down(ifp);
+#ifdef ALTQ
+ if (ALTQ_IS_ENABLED(&ifp->if_snd))
+ altq_disable(&ifp->if_snd);
+ if (ALTQ_IS_ATTACHED(&ifp->if_snd))
+ altq_detach(&ifp->if_snd);
+#endif
for (ifa = TAILQ_FIRST(&ifp->if_addrhead); ifa; ifa = next) {
next = TAILQ_NEXT(ifa, ifa_link);
@@ -1189,10 +1202,14 @@ if_up(struct ifnet *ifp)
* Flush an interface queue.
*/
static void
-if_qflush(struct ifqueue *ifq)
+if_qflush(struct ifaltq *ifq)
{
struct mbuf *m, *n;
+#ifdef ALTQ
+ if (ALTQ_IS_ENABLED(ifq))
+ ALTQ_PURGE(ifq);
+#endif
n = ifq->ifq_head;
while ((m = n) != 0) {
n = m->m_act;
diff --git a/sys/net/if_ppp.c b/sys/net/if_ppp.c
index d7e007e..d0db17e 100644
--- a/sys/net/if_ppp.c
+++ b/sys/net/if_ppp.c
@@ -933,7 +933,8 @@ pppoutput(ifp, m0, dst, rtp)
sc->sc_npqtail = &m0->m_nextpkt;
} else {
/* fastq and if_snd are emptied at spl[soft]net now */
- ifq = (m0->m_flags & M_HIGHPRI)? &sc->sc_fastq: &ifp->if_snd;
+ ifq = (m0->m_flags & M_HIGHPRI)? &sc->sc_fastq:
+ (struct ifqueue *)&ifp->if_snd;
IF_LOCK(ifq);
if (_IF_QFULL(ifq) && dst->sa_family != AF_UNSPEC) {
_IF_DROP(ifq);
@@ -988,7 +989,8 @@ ppp_requeue(sc)
*/
*mpp = m->m_nextpkt;
m->m_nextpkt = NULL;
- ifq = (m->m_flags & M_HIGHPRI)? &sc->sc_fastq: &sc->sc_if.if_snd;
+ ifq = (m->m_flags & M_HIGHPRI)? &sc->sc_fastq:
+ (struct ifqueue *)&sc->sc_if.if_snd;
if (! IF_HANDOFF(ifq, m, NULL)) {
sc->sc_if.if_oerrors++;
sc->sc_stats.ppp_oerrors++;
diff --git a/sys/net/if_sl.c b/sys/net/if_sl.c
index 0d39973..bc35341 100644
--- a/sys/net/if_sl.c
+++ b/sys/net/if_sl.c
@@ -571,7 +571,7 @@ sloutput(ifp, m, dst, rtp)
m_freem(m);
return (EHOSTUNREACH);
}
- ifq = &sc->sc_if.if_snd;
+ ifq = (struct ifqueue *)&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);
diff --git a/sys/net/if_spppsubr.c b/sys/net/if_spppsubr.c
index 83fb1fc..66b6412 100644
--- a/sys/net/if_spppsubr.c
+++ b/sys/net/if_spppsubr.c
@@ -781,7 +781,7 @@ sppp_output(struct ifnet *ifp, struct mbuf *m,
s = splimp();
}
- ifq = &ifp->if_snd;
+ ifq = (struct ifqueue *)&ifp->if_snd;
#ifdef INET
if (dst->sa_family == AF_INET) {
/* XXX Check mbuf length here? */
@@ -1038,7 +1038,7 @@ sppp_flush(struct ifnet *ifp)
{
struct sppp *sp = (struct sppp*) ifp;
- sppp_qflush (&sp->pp_if.if_snd);
+ sppp_qflush ((struct ifqueue *)&sp->pp_if.if_snd);
sppp_qflush (&sp->pp_fastq);
sppp_qflush (&sp->pp_cpq);
}
diff --git a/sys/net/if_var.h b/sys/net/if_var.h
index 541f214..02bcf1f 100644
--- a/sys/net/if_var.h
+++ b/sys/net/if_var.h
@@ -82,6 +82,10 @@ struct ether_header;
#define IF_DUNIT_NONE -1
+#if 1 /* ALTQ */
+#include <altq/if_altq.h>
+#endif
+
TAILQ_HEAD(ifnethead, ifnet); /* we use TAILQs so that the order of */
TAILQ_HEAD(ifaddrhead, ifaddr); /* instantiation is preserved in the list */
TAILQ_HEAD(ifprefixhead, ifprefix);
@@ -171,7 +175,11 @@ struct ifnet {
(void *);
int (*if_resolvemulti) /* validate/resolve multicast */
(struct ifnet *, struct sockaddr **, struct sockaddr *);
+#if 1 /* ALTQ */
+ struct ifaltq if_snd; /* output queue (includes altq) */
+#else
struct ifqueue if_snd; /* output queue */
+#endif
const u_int8_t *if_broadcastaddr; /* linklevel broadcast bytestring */
struct lltable *lltables; /* list of L3-L2 resolution tables */
@@ -228,6 +236,7 @@ typedef void if_init_f_t(void *);
*/
#define IF_LOCK(ifq) mtx_lock(&(ifq)->ifq_mtx)
#define IF_UNLOCK(ifq) mtx_unlock(&(ifq)->ifq_mtx)
+#define IF_LOCK_ASSERT(ifq) mtx_assert(&(ifq)->ifq_mtx, MA_OWNED)
#define _IF_QFULL(ifq) ((ifq)->ifq_len >= (ifq)->ifq_maxlen)
#define _IF_DROP(ifq) ((ifq)->ifq_drops++)
#define _IF_QLEN(ifq) ((ifq)->ifq_len)
@@ -278,18 +287,25 @@ typedef void if_init_f_t(void *);
IF_UNLOCK(ifq); \
} while (0)
-#define IF_DRAIN(ifq) do { \
+#define _IF_POLL(ifq, m) ((m) = (ifq)->ifq_head)
+#define IF_POLL(ifq, m) _IF_POLL(ifq, m)
+
+#define _IF_DRAIN(ifq) do { \
struct mbuf *m; \
- IF_LOCK(ifq); \
for (;;) { \
_IF_DEQUEUE(ifq, m); \
if (m == NULL) \
break; \
m_freem(m); \
} \
- IF_UNLOCK(ifq); \
} while (0)
+#define IF_DRAIN(ifq) do { \
+ IF_LOCK(ifq); \
+ _IF_DRAIN(ifq); \
+ IF_UNLOCK(ifq); \
+} while(0)
+
#ifdef _KERNEL
/* interface address change event */
typedef void (*ifaddr_event_handler_t)(void *, struct ifnet *);
@@ -311,8 +327,10 @@ EVENTHANDLER_DECLARE(if_clone_event, if_clone_event_handler_t);
#define IF_AFDATA_UNLOCK(ifp) mtx_unlock(&(ifp)->if_afdata_mtx)
#define IF_AFDATA_DESTROY(ifp) mtx_destroy(&(ifp)->if_afdata_mtx)
-#define IF_HANDOFF(ifq, m, ifp) if_handoff(ifq, m, ifp, 0)
-#define IF_HANDOFF_ADJ(ifq, m, ifp, adj) if_handoff(ifq, m, ifp, adj)
+#define IF_HANDOFF(ifq, m, ifp) \
+ if_handoff((struct ifqueue *)ifq, m, ifp, 0)
+#define IF_HANDOFF_ADJ(ifq, m, ifp, adj) \
+ if_handoff((struct ifqueue *)ifq, m, ifp, adj)
static __inline int
if_handoff(struct ifqueue *ifq, struct mbuf *m, struct ifnet *ifp, int adjust)
@@ -338,6 +356,185 @@ if_handoff(struct ifqueue *ifq, struct mbuf *m, struct ifnet *ifp, int adjust)
(*ifp->if_start)(ifp);
return (1);
}
+#if 1 /* ALTQ */
+#define IFQ_ENQUEUE(ifq, m, err) \
+do { \
+ IF_LOCK(ifq); \
+ if (ALTQ_IS_ENABLED(ifq)) \
+ ALTQ_ENQUEUE(ifq, m, NULL, err); \
+ else { \
+ if (_IF_QFULL(ifq)) { \
+ m_freem(m); \
+ (err) = ENOBUFS; \
+ } else { \
+ _IF_ENQUEUE(ifq, m); \
+ (err) = 0; \
+ } \
+ } \
+ if (err) \
+ (ifq)->ifq_drops++; \
+ IF_UNLOCK(ifq); \
+} while (0)
+
+#define IFQ_DEQUEUE_NOLOCK(ifq, m) \
+do { \
+ if (TBR_IS_ENABLED(ifq)) \
+ (m) = tbr_dequeue(ifq, ALTDQ_REMOVE); \
+ else if (ALTQ_IS_ENABLED(ifq)) \
+ ALTQ_DEQUEUE(ifq, m); \
+ else \
+ _IF_DEQUEUE(ifq, m); \
+} while (0)
+
+#define IFQ_DEQUEUE(ifq, m) \
+do { \
+ IF_LOCK(ifq); \
+ IFQ_DEQUEUE_NOLOCK(ifq, m); \
+ IF_UNLOCK(ifq); \
+} while (0)
+
+#define IFQ_POLL_NOLOCK(ifq, m) \
+do { \
+ if (TBR_IS_ENABLED(ifq)) \
+ (m) = tbr_dequeue(ifq, ALTDQ_POLL); \
+ else if (ALTQ_IS_ENABLED(ifq)) \
+ ALTQ_POLL(ifq, m); \
+ else \
+ _IF_POLL(ifq, m); \
+} while (0)
+
+#define IFQ_POLL(ifq, m) \
+do { \
+ IF_LOCK(ifq); \
+ IFQ_POLL_NOLOCK(ifq, m); \
+ IF_UNLOCK(ifq); \
+} while (0)
+
+#define IFQ_PURGE_NOLOCK(ifq) \
+do { \
+ if (ALTQ_IS_ENABLED(ifq)) { \
+ ALTQ_PURGE(ifq); \
+ } else \
+ _IF_DRAIN(ifq); \
+} while (0)
+
+#define IFQ_PURGE(ifq) \
+do { \
+ IF_LOCK(ifq); \
+ IFQ_PURGE_NOLOCK(ifq); \
+ IF_UNLOCK(ifq); \
+} while (0)
+
+#define IFQ_SET_READY(ifq) \
+ do { ((ifq)->altq_flags |= ALTQF_READY); } while (0)
+
+#else /* !ALTQ */
+#define IFQ_ENQUEUE(ifq, m, err) \
+do { \
+ IF_LOCK(ifq); \
+ if (_IF_QFULL(ifq)) { \
+ m_freem(m); \
+ (err) = ENOBUFS; \
+ } else { \
+ _IF_ENQUEUE(ifq, m); \
+ (err) = 0; \
+ } \
+ if (err) \
+ (ifq)->ifq_drops++; \
+ IF_UNLOCK(ifq); \
+} while (0)
+
+#define IFQ_DEQUEUE_NOLOCK(ifq, m) _IF_DEQUEUE(ifq, m)
+#define IFQ_DEQUEUE(ifq, m) IF_DEQUEUE(ifq, m)
+#define IFQ_POLL_NOLOCK(ifq, m) _IF_POLL(ifq, m)
+#define IFQ_POLL(ifq, m) IF_POLL(ifq, m)
+#define IFQ_PURGE_NOLOCK(ifq) _IF_DRAIN(ifq)
+#define IFQ_PURGE(ifq) IF_DRAIN(ifq)
+
+#define IFQ_SET_READY(ifq) /* nothing */
+
+#endif /* !ALTQ */
+
+#define IFQ_LOCK(ifq) IF_LOCK(ifq)
+#define IFQ_UNLOCK(ifq) IF_UNLOCK(ifq)
+#define IFQ_LOCK_ASSERT(ifq) IF_LOCK_ASSERT(ifq)
+#define IFQ_IS_EMPTY(ifq) ((ifq)->ifq_len == 0)
+#define IFQ_INC_LEN(ifq) ((ifq)->ifq_len++)
+#define IFQ_DEC_LEN(ifq) (--(ifq)->ifq_len)
+#define IFQ_INC_DROPS(ifq) ((ifq)->ifq_drops++)
+#define IFQ_SET_MAXLEN(ifq, len) ((ifq)->ifq_maxlen = (len))
+
+#define IFQ_HANDOFF_ADJ(ifp, m, adj, err) \
+do { \
+ int len; \
+ short mflags; \
+ \
+ len = (m)->m_pkthdr.len; \
+ mflags = (m)->m_flags; \
+ IFQ_ENQUEUE(&(ifp)->if_snd, m, err); \
+ if ((err) == 0) { \
+ (ifp)->if_obytes += len + (adj); \
+ if (mflags & M_MCAST) \
+ (ifp)->if_omcasts++; \
+ if (((ifp)->if_flags & IFF_OACTIVE) == 0) \
+ (*(ifp)->if_start)(ifp); \
+ } \
+} while (0)
+
+#define IFQ_HANDOFF(ifp, m, err) \
+ IFQ_HANDOFF_ADJ(ifq, m, 0, err)
+
+#define IFQ_DRV_DEQUEUE(ifq, m) \
+do { \
+ (m) = (ifq)->ifq_drv_head; \
+ if (m) { \
+ if (((ifq)->ifq_drv_head = (m)->m_nextpkt) == NULL) \
+ (ifq)->ifq_drv_tail = NULL; \
+ (m)->m_nextpkt = NULL; \
+ (ifq)->ifq_drv_len--; \
+ } else { \
+ IFQ_LOCK(ifq); \
+ IFQ_DEQUEUE_NOLOCK(ifq, m); \
+ while ((ifq)->ifq_drv_len < (ifq)->ifq_drv_maxlen) { \
+ struct mbuf *m0; \
+ IFQ_DEQUEUE_NOLOCK(ifq, m0); \
+ if (m0 == NULL) \
+ break; \
+ m0->m_nextpkt = NULL; \
+ if ((ifq)->ifq_drv_tail == NULL) \
+ (ifq)->ifq_drv_head = m0; \
+ else \
+ (ifq)->ifq_drv_tail->m_nextpkt = m0; \
+ (ifq)->ifq_drv_tail = m0; \
+ (ifq)->ifq_drv_len++; \
+ } \
+ IFQ_UNLOCK(ifq); \
+ } \
+} while (0)
+
+#define IFQ_DRV_PREPEND(ifq, m) \
+do { \
+ (m)->m_nextpkt = (ifq)->ifq_drv_head; \
+ if ((ifq)->ifq_tail == NULL) \
+ (ifq)->ifq_tail = (m); \
+ (ifq)->ifq_drv_head = (m); \
+ (ifq)->ifq_drv_len++; \
+} while (0)
+
+#define IFQ_DRV_IS_EMPTY(ifq) \
+ (((ifq)->ifq_drv_len == 0) && ((ifq)->ifq_len == 0))
+
+#define IFQ_DRV_PURGE(ifq) \
+do { \
+ struct mbuf *m = (ifq)->ifq_drv_head; \
+ while(m != NULL) { \
+ m = m->m_nextpkt; \
+ m_freem(m); \
+ } \
+ (ifq)->ifq_drv_head = (ifq)->ifq_drv_tail = NULL; \
+ (ifq)->ifq_drv_len = 0; \
+ IFQ_PURGE(ifq); \
+} while (0)
/*
* 72 was chosen below because it is the size of a TCP/IP
diff --git a/sys/net80211/ieee80211_input.c b/sys/net80211/ieee80211_input.c
index 153a650..74aa1c4 100644
--- a/sys/net80211/ieee80211_input.c
+++ b/sys/net80211/ieee80211_input.c
@@ -288,11 +288,6 @@ ieee80211_input(struct ifnet *ifp, struct mbuf *m, struct ieee80211_node *ni,
}
}
if (m1 != NULL) {
-#ifdef ALTQ
- if (ALTQ_IS_ENABLED(&ifp->if_snd))
- altq_etherclassify(&ifp->if_snd, m1,
- &pktattr);
-#endif
len = m1->m_pkthdr.len;
IF_ENQUEUE(&ifp->if_snd, m1);
if (m != NULL)
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c
index 586d1b1..25501aa 100644
--- a/sys/netinet/ip_input.c
+++ b/sys/netinet/ip_input.c
@@ -390,6 +390,12 @@ ip_input(struct mbuf *m)
goto bad;
}
+#ifdef ALTQ
+ if (altq_input != NULL && (*altq_input)(m, AF_INET) == 0)
+ /* packet is dropped by traffic conditioner */
+ return;
+#endif
+
/*
* Convert fields to host representation.
*/
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c
index 98da087..520de05 100644
--- a/sys/netinet/ip_output.c
+++ b/sys/netinet/ip_output.c
@@ -404,6 +404,12 @@ ip_output(struct mbuf *m, struct mbuf *opt, struct route *ro,
}
}
#endif /* notdef */
+#ifdef ALTQ
+ /*
+ * disable packet drop hack.
+ * packetdrop should be done by queueing.
+ */
+#else /* !ALTQ */
/*
* Verify that we have any chance at all of being able to queue
* the packet or packet fragments
@@ -414,6 +420,7 @@ ip_output(struct mbuf *m, struct mbuf *opt, struct route *ro,
ipstat.ips_odropped++;
goto bad;
}
+#endif /* !ALTQ */
/*
* Look for broadcast address and
diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c
index 4eb6042..a22eb12 100644
--- a/sys/netinet6/ip6_input.c
+++ b/sys/netinet6/ip6_input.c
@@ -366,6 +366,12 @@ ip6_input(m)
goto bad;
}
+#ifdef ALTQ
+ if (altq_input != NULL && (*altq_input)(m, AF_INET6) == 0) {
+ /* packet is dropped by traffic conditioner */
+ return;
+ }
+#endif
/*
* The following check is not documented in specs. A malicious
* party may be able to use IPv4 mapped addr to confuse tcp/udp stack
OpenPOWER on IntegriCloud