IFQ_ENQUEUE refactor (2/3) : eliminate pktattr argument from altq implemantation
This commit is contained in:
parent
6190bb13a7
commit
40b1061c07
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: altq_blue.c,v 1.23 2011/11/19 22:51:18 tls Exp $ */
|
||||
/* $NetBSD: altq_blue.c,v 1.24 2016/04/20 08:58:48 knakahara Exp $ */
|
||||
/* $KAME: altq_blue.c,v 1.15 2005/04/13 03:44:24 suz Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -61,7 +61,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: altq_blue.c,v 1.23 2011/11/19 22:51:18 tls Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: altq_blue.c,v 1.24 2016/04/20 08:58:48 knakahara Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_altq.h"
|
||||
|
@ -112,7 +112,7 @@ __KERNEL_RCSID(0, "$NetBSD: altq_blue.c,v 1.23 2011/11/19 22:51:18 tls Exp $");
|
|||
static blue_queue_t *blue_list = NULL;
|
||||
|
||||
/* internal function prototypes */
|
||||
static int blue_enqueue(struct ifaltq *, struct mbuf *, struct altq_pktattr *);
|
||||
static int blue_enqueue(struct ifaltq *, struct mbuf *);
|
||||
static struct mbuf *blue_dequeue(struct ifaltq *, int);
|
||||
static int drop_early(blue_t *);
|
||||
static int mark_ecn(struct mbuf *, struct altq_pktattr *, int);
|
||||
|
@ -391,12 +391,17 @@ blue_init(blue_t *rp, int flags, int pkttime, int blue_max_pmark,
|
|||
* ENOBUFS when drop occurs.
|
||||
*/
|
||||
static int
|
||||
blue_enqueue(struct ifaltq *ifq, struct mbuf *m, struct altq_pktattr *pktattr)
|
||||
blue_enqueue(struct ifaltq *ifq, struct mbuf *m)
|
||||
{
|
||||
struct altq_pktattr pktattr;
|
||||
blue_queue_t *rqp = (blue_queue_t *)ifq->altq_disc;
|
||||
int error = 0;
|
||||
|
||||
if (blue_addq(rqp->rq_blue, rqp->rq_q, m, pktattr) == 0)
|
||||
pktattr.pattr_class = m->m_pkthdr.pattr_class;
|
||||
pktattr.pattr_af = m->m_pkthdr.pattr_af;
|
||||
pktattr.pattr_hdr = m->m_pkthdr.pattr_hdr;
|
||||
|
||||
if (blue_addq(rqp->rq_blue, rqp->rq_q, m, &pktattr) == 0)
|
||||
ifq->ifq_len++;
|
||||
else
|
||||
error = ENOBUFS;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: altq_cbq.c,v 1.28 2014/10/18 08:33:24 snj Exp $ */
|
||||
/* $NetBSD: altq_cbq.c,v 1.29 2016/04/20 08:58:48 knakahara Exp $ */
|
||||
/* $KAME: altq_cbq.c,v 1.21 2005/04/13 03:44:24 suz Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -32,7 +32,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: altq_cbq.c,v 1.28 2014/10/18 08:33:24 snj Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: altq_cbq.c,v 1.29 2016/04/20 08:58:48 knakahara Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_altq.h"
|
||||
|
@ -82,8 +82,7 @@ static int cbq_class_destroy(cbq_state_t *, struct rm_class *);
|
|||
static struct rm_class *clh_to_clp(cbq_state_t *, u_int32_t);
|
||||
static int cbq_clear_interface(cbq_state_t *);
|
||||
static int cbq_request(struct ifaltq *, int, void *);
|
||||
static int cbq_enqueue(struct ifaltq *, struct mbuf *,
|
||||
struct altq_pktattr *);
|
||||
static int cbq_enqueue(struct ifaltq *, struct mbuf *);
|
||||
static struct mbuf *cbq_dequeue(struct ifaltq *, int);
|
||||
static void cbqrestart(struct ifaltq *);
|
||||
static void get_class_stats(class_stats_t *, struct rm_class *);
|
||||
|
@ -483,7 +482,7 @@ cbq_getqstats(struct pf_altq *a, void *ubuf, int *nbytes)
|
|||
|
||||
/*
|
||||
* int
|
||||
* cbq_enqueue(struct ifaltq *ifq, struct mbuf *m, struct altq_pktattr *pattr)
|
||||
* cbq_enqueue(struct ifaltq *ifq, struct mbuf *m)
|
||||
* - Queue data packets.
|
||||
*
|
||||
* cbq_enqueue is set to ifp->if_altqenqueue and called by an upper
|
||||
|
@ -497,8 +496,9 @@ cbq_getqstats(struct pf_altq *a, void *ubuf, int *nbytes)
|
|||
*/
|
||||
|
||||
static int
|
||||
cbq_enqueue(struct ifaltq *ifq, struct mbuf *m, struct altq_pktattr *pktattr)
|
||||
cbq_enqueue(struct ifaltq *ifq, struct mbuf *m)
|
||||
{
|
||||
struct altq_pktattr pktattr;
|
||||
cbq_state_t *cbqp = (cbq_state_t *)ifq->altq_disc;
|
||||
struct rm_class *cl;
|
||||
struct m_tag *t;
|
||||
|
@ -516,8 +516,8 @@ cbq_enqueue(struct ifaltq *ifq, struct mbuf *m, struct altq_pktattr *pktattr)
|
|||
if ((t = m_tag_find(m, PACKET_TAG_ALTQ_QID, NULL)) != NULL)
|
||||
cl = clh_to_clp(cbqp, ((struct altq_tag *)(t+1))->qid);
|
||||
#ifdef ALTQ3_COMPAT
|
||||
else if ((ifq->altq_flags & ALTQF_CLASSIFY) && pktattr != NULL)
|
||||
cl = pktattr->pattr_class;
|
||||
else if (ifq->altq_flags & ALTQF_CLASSIFY)
|
||||
cl = m->m_pkthdr.pattr_class;
|
||||
#endif
|
||||
if (cl == NULL) {
|
||||
cl = cbqp->ifnp.default_;
|
||||
|
@ -527,9 +527,13 @@ cbq_enqueue(struct ifaltq *ifq, struct mbuf *m, struct altq_pktattr *pktattr)
|
|||
}
|
||||
}
|
||||
#ifdef ALTQ3_COMPAT
|
||||
if (pktattr != NULL)
|
||||
cl->pktattr_ = pktattr; /* save proto hdr used by ECN */
|
||||
else
|
||||
if (m->m_pkthdr.pattr_af != AF_UNSPEC) {
|
||||
pktattr.pattr_class = m->m_pkthdr.pattr_class;
|
||||
pktattr.pattr_af = m->m_pkthdr.pattr_af;
|
||||
pktattr.pattr_hdr = m->m_pkthdr.pattr_hdr;
|
||||
|
||||
cl->pktattr_ = &pktattr; /* save proto hdr used by ECN */
|
||||
} else
|
||||
#endif
|
||||
cl->pktattr_ = NULL;
|
||||
len = m_pktlen(m);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: altq_fifoq.c,v 1.16 2007/03/04 05:59:01 christos Exp $ */
|
||||
/* $NetBSD: altq_fifoq.c,v 1.17 2016/04/20 08:58:48 knakahara Exp $ */
|
||||
/* $KAME: altq_fifoq.c,v 1.12 2003/07/10 12:07:48 kjc Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -28,7 +28,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: altq_fifoq.c,v 1.16 2007/03/04 05:59:01 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: altq_fifoq.c,v 1.17 2016/04/20 08:58:48 knakahara Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_altq.h"
|
||||
|
@ -70,8 +70,7 @@ __KERNEL_RCSID(0, "$NetBSD: altq_fifoq.c,v 1.16 2007/03/04 05:59:01 christos Exp
|
|||
static fifoq_state_t *fifoq_list = NULL;
|
||||
|
||||
/* internal function prototypes */
|
||||
static int fifoq_enqueue(struct ifaltq *, struct mbuf *,
|
||||
struct altq_pktattr *);
|
||||
static int fifoq_enqueue(struct ifaltq *, struct mbuf *);
|
||||
static struct mbuf *fifoq_dequeue(struct ifaltq *, int);
|
||||
static int fifoq_detach(fifoq_state_t *);
|
||||
static int fifoq_request(struct ifaltq *, int, void *);
|
||||
|
@ -266,8 +265,7 @@ fifoqioctl(dev_t dev, ioctlcmd_t cmd, void *addr, int flag,
|
|||
* ENOBUFS when drop occurs.
|
||||
*/
|
||||
static int
|
||||
fifoq_enqueue(struct ifaltq *ifq, struct mbuf *m,
|
||||
struct altq_pktattr *pktattr)
|
||||
fifoq_enqueue(struct ifaltq *ifq, struct mbuf *m)
|
||||
{
|
||||
fifoq_state_t *q = (fifoq_state_t *)ifq->altq_disc;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: altq_hfsc.c,v 1.25 2016/01/22 18:19:54 christos Exp $ */
|
||||
/* $NetBSD: altq_hfsc.c,v 1.26 2016/04/20 08:58:48 knakahara Exp $ */
|
||||
/* $KAME: altq_hfsc.c,v 1.26 2005/04/13 03:44:24 suz Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -43,7 +43,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: altq_hfsc.c,v 1.25 2016/01/22 18:19:54 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: altq_hfsc.c,v 1.26 2016/04/20 08:58:48 knakahara Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_altq.h"
|
||||
|
@ -90,8 +90,7 @@ static struct hfsc_class *hfsc_class_create(struct hfsc_if *,
|
|||
struct hfsc_class *, int, int, int);
|
||||
static int hfsc_class_destroy(struct hfsc_class *);
|
||||
static struct hfsc_class *hfsc_nextclass(struct hfsc_class *);
|
||||
static int hfsc_enqueue(struct ifaltq *, struct mbuf *,
|
||||
struct altq_pktattr *);
|
||||
static int hfsc_enqueue(struct ifaltq *, struct mbuf *);
|
||||
static struct mbuf *hfsc_dequeue(struct ifaltq *, int);
|
||||
|
||||
static int hfsc_addq(struct hfsc_class *, struct mbuf *);
|
||||
|
@ -666,8 +665,9 @@ hfsc_nextclass(struct hfsc_class *cl)
|
|||
* (*altq_enqueue) in struct ifaltq.
|
||||
*/
|
||||
static int
|
||||
hfsc_enqueue(struct ifaltq *ifq, struct mbuf *m, struct altq_pktattr *pktattr)
|
||||
hfsc_enqueue(struct ifaltq *ifq, struct mbuf *m)
|
||||
{
|
||||
struct altq_pktattr pktattr;
|
||||
struct hfsc_if *hif = (struct hfsc_if *)ifq->altq_disc;
|
||||
struct hfsc_class *cl;
|
||||
struct m_tag *t;
|
||||
|
@ -685,8 +685,8 @@ hfsc_enqueue(struct ifaltq *ifq, struct mbuf *m, struct altq_pktattr *pktattr)
|
|||
if ((t = m_tag_find(m, PACKET_TAG_ALTQ_QID, NULL)) != NULL)
|
||||
cl = clh_to_clp(hif, ((struct altq_tag *)(t+1))->qid);
|
||||
#ifdef ALTQ3_COMPAT
|
||||
else if ((ifq->altq_flags & ALTQF_CLASSIFY) && pktattr != NULL)
|
||||
cl = pktattr->pattr_class;
|
||||
else if ((ifq->altq_flags & ALTQF_CLASSIFY))
|
||||
cl = m->m_pkthdr.pattr_class;
|
||||
#endif
|
||||
if (cl == NULL || is_a_parent_class(cl)) {
|
||||
cl = hif->hif_defaultclass;
|
||||
|
@ -696,9 +696,13 @@ hfsc_enqueue(struct ifaltq *ifq, struct mbuf *m, struct altq_pktattr *pktattr)
|
|||
}
|
||||
}
|
||||
#ifdef ALTQ3_COMPAT
|
||||
if (pktattr != NULL)
|
||||
cl->cl_pktattr = pktattr; /* save proto hdr used by ECN */
|
||||
else
|
||||
if (m->m_pkthdr.pattr_af != AF_UNSPEC) {
|
||||
pktattr.pattr_class = m->m_pkthdr.pattr_class;
|
||||
pktattr.pattr_af = m->m_pkthdr.pattr_af;
|
||||
pktattr.pattr_hdr = m->m_pkthdr.pattr_hdr;
|
||||
|
||||
cl->cl_pktattr = &pktattr; /* save proto hdr used by ECN */
|
||||
} else
|
||||
#endif
|
||||
cl->cl_pktattr = NULL;
|
||||
len = m_pktlen(m);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: altq_jobs.c,v 1.8 2016/01/22 18:19:54 christos Exp $ */
|
||||
/* $NetBSD: altq_jobs.c,v 1.9 2016/04/20 08:58:48 knakahara Exp $ */
|
||||
/* $KAME: altq_jobs.c,v 1.11 2005/04/13 03:44:25 suz Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2001, the Rector and Board of Visitors of the
|
||||
|
@ -59,7 +59,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: altq_jobs.c,v 1.8 2016/01/22 18:19:54 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: altq_jobs.c,v 1.9 2016/04/20 08:58:48 knakahara Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_altq.h"
|
||||
|
@ -103,7 +103,7 @@ static void jobs_purge(struct jobs_if *);
|
|||
static struct jobs_class *jobs_class_create(struct jobs_if *,
|
||||
int, int64_t, int64_t, int64_t, int64_t, int64_t, int);
|
||||
static int jobs_class_destroy(struct jobs_class *);
|
||||
static int jobs_enqueue(struct ifaltq *, struct mbuf *, struct altq_pktattr *);
|
||||
static int jobs_enqueue(struct ifaltq *, struct mbuf *);
|
||||
static struct mbuf *jobs_dequeue(struct ifaltq *, int);
|
||||
|
||||
static int jobs_addq(struct jobs_class *, struct mbuf *, struct jobs_if*);
|
||||
|
@ -490,7 +490,7 @@ jobs_class_destroy(struct jobs_class *cl)
|
|||
* (*altq_enqueue) in struct ifaltq.
|
||||
*/
|
||||
static int
|
||||
jobs_enqueue(struct ifaltq *ifq, struct mbuf *m, struct altq_pktattr *pktattr)
|
||||
jobs_enqueue(struct ifaltq *ifq, struct mbuf *m)
|
||||
{
|
||||
struct jobs_if *jif = (struct jobs_if *)ifq->altq_disc;
|
||||
struct jobs_class *cl, *scan;
|
||||
|
@ -533,7 +533,7 @@ jobs_enqueue(struct ifaltq *ifq, struct mbuf *m, struct altq_pktattr *pktattr)
|
|||
}
|
||||
|
||||
/* grab class set by classifier */
|
||||
if (pktattr == NULL || (cl = pktattr->pattr_class) == NULL)
|
||||
if ((cl = m->m_pkthdr.pattr_class) == NULL)
|
||||
cl = jif->jif_default;
|
||||
|
||||
len = m_pktlen(m);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: altq_priq.c,v 1.22 2016/01/22 18:19:54 christos Exp $ */
|
||||
/* $NetBSD: altq_priq.c,v 1.23 2016/04/20 08:58:48 knakahara Exp $ */
|
||||
/* $KAME: altq_priq.c,v 1.13 2005/04/13 03:44:25 suz Exp $ */
|
||||
/*
|
||||
* Copyright (C) 2000-2003
|
||||
|
@ -31,7 +31,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: altq_priq.c,v 1.22 2016/01/22 18:19:54 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: altq_priq.c,v 1.23 2016/04/20 08:58:48 knakahara Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_altq.h"
|
||||
|
@ -76,7 +76,7 @@ static void priq_purge(struct priq_if *);
|
|||
static struct priq_class *priq_class_create(struct priq_if *, int, int, int,
|
||||
int);
|
||||
static int priq_class_destroy(struct priq_class *);
|
||||
static int priq_enqueue(struct ifaltq *, struct mbuf *, struct altq_pktattr *);
|
||||
static int priq_enqueue(struct ifaltq *, struct mbuf *);
|
||||
static struct mbuf *priq_dequeue(struct ifaltq *, int);
|
||||
|
||||
static int priq_addq(struct priq_class *, struct mbuf *);
|
||||
|
@ -438,8 +438,9 @@ priq_class_destroy(struct priq_class *cl)
|
|||
* (*altq_enqueue) in struct ifaltq.
|
||||
*/
|
||||
static int
|
||||
priq_enqueue(struct ifaltq *ifq, struct mbuf *m, struct altq_pktattr *pktattr)
|
||||
priq_enqueue(struct ifaltq *ifq, struct mbuf *m)
|
||||
{
|
||||
struct altq_pktattr pktattr;
|
||||
struct priq_if *pif = (struct priq_if *)ifq->altq_disc;
|
||||
struct priq_class *cl;
|
||||
struct m_tag *t;
|
||||
|
@ -457,8 +458,8 @@ priq_enqueue(struct ifaltq *ifq, struct mbuf *m, struct altq_pktattr *pktattr)
|
|||
if ((t = m_tag_find(m, PACKET_TAG_ALTQ_QID, NULL)) != NULL)
|
||||
cl = clh_to_clp(pif, ((struct altq_tag *)(t+1))->qid);
|
||||
#ifdef ALTQ3_COMPAT
|
||||
else if ((ifq->altq_flags & ALTQF_CLASSIFY) && pktattr != NULL)
|
||||
cl = pktattr->pattr_class;
|
||||
else if (ifq->altq_flags & ALTQF_CLASSIFY)
|
||||
cl = m->m_pkthdr.pattr_class;
|
||||
#endif
|
||||
if (cl == NULL) {
|
||||
cl = pif->pif_default;
|
||||
|
@ -468,9 +469,13 @@ priq_enqueue(struct ifaltq *ifq, struct mbuf *m, struct altq_pktattr *pktattr)
|
|||
}
|
||||
}
|
||||
#ifdef ALTQ3_COMPAT
|
||||
if (pktattr != NULL)
|
||||
cl->cl_pktattr = pktattr; /* save proto hdr used by ECN */
|
||||
else
|
||||
if (m->m_pkthdr.pattr_af != AF_UNSPEC) {
|
||||
pktattr.pattr_class = m->m_pkthdr.pattr_class;
|
||||
pktattr.pattr_af = m->m_pkthdr.pattr_af;
|
||||
pktattr.pattr_hdr = m->m_pkthdr.pattr_hdr;
|
||||
|
||||
cl->cl_pktattr = &pktattr; /* save proto hdr used by ECN */
|
||||
} else
|
||||
#endif
|
||||
cl->cl_pktattr = NULL;
|
||||
len = m_pktlen(m);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: altq_red.c,v 1.29 2011/11/19 22:51:18 tls Exp $ */
|
||||
/* $NetBSD: altq_red.c,v 1.30 2016/04/20 08:58:48 knakahara Exp $ */
|
||||
/* $KAME: altq_red.c,v 1.20 2005/04/13 03:44:25 suz Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -61,7 +61,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: altq_red.c,v 1.29 2011/11/19 22:51:18 tls Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: altq_red.c,v 1.30 2016/04/20 08:58:48 knakahara Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_altq.h"
|
||||
|
@ -203,7 +203,7 @@ static int default_inv_pmax = INV_P_MAX;
|
|||
|
||||
#ifdef ALTQ3_COMPAT
|
||||
/* internal function prototypes */
|
||||
static int red_enqueue(struct ifaltq *, struct mbuf *, struct altq_pktattr *);
|
||||
static int red_enqueue(struct ifaltq *, struct mbuf *);
|
||||
static struct mbuf *red_dequeue(struct ifaltq *, int);
|
||||
static int red_request(struct ifaltq *, int, void *);
|
||||
static void red_purgeq(red_queue_t *);
|
||||
|
@ -1011,11 +1011,16 @@ red_detach(red_queue_t *rqp)
|
|||
* ENOBUFS when drop occurs.
|
||||
*/
|
||||
static int
|
||||
red_enqueue(struct ifaltq *ifq, struct mbuf *m, struct altq_pktattr *pktattr)
|
||||
red_enqueue(struct ifaltq *ifq, struct mbuf *m)
|
||||
{
|
||||
struct altq_pktattr pktattr;
|
||||
red_queue_t *rqp = (red_queue_t *)ifq->altq_disc;
|
||||
|
||||
if (red_addq(rqp->rq_red, rqp->rq_q, m, pktattr) < 0)
|
||||
pktattr.pattr_class = m->m_pkthdr.pattr_class;
|
||||
pktattr.pattr_af = m->m_pkthdr.pattr_af;
|
||||
pktattr.pattr_hdr = m->m_pkthdr.pattr_hdr;
|
||||
|
||||
if (red_addq(rqp->rq_red, rqp->rq_q, m, &pktattr) < 0)
|
||||
return ENOBUFS;
|
||||
ifq->ifq_len++;
|
||||
return 0;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: altq_rio.c,v 1.21 2009/04/18 14:58:02 tsutsui Exp $ */
|
||||
/* $NetBSD: altq_rio.c,v 1.22 2016/04/20 08:58:48 knakahara Exp $ */
|
||||
/* $KAME: altq_rio.c,v 1.19 2005/04/13 03:44:25 suz Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -60,7 +60,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: altq_rio.c,v 1.21 2009/04/18 14:58:02 tsutsui Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: altq_rio.c,v 1.22 2016/04/20 08:58:48 knakahara Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_altq.h"
|
||||
|
@ -190,7 +190,7 @@ static struct redparams default_rio_params[RIO_NDROPPREC] = {
|
|||
/* internal function prototypes */
|
||||
static int dscp2index(u_int8_t);
|
||||
#ifdef ALTQ3_COMPAT
|
||||
static int rio_enqueue(struct ifaltq *, struct mbuf *, struct altq_pktattr *);
|
||||
static int rio_enqueue(struct ifaltq *, struct mbuf *);
|
||||
static struct mbuf *rio_dequeue(struct ifaltq *, int);
|
||||
static int rio_request(struct ifaltq *, int, void *);
|
||||
static int rio_detach(rio_queue_t *);
|
||||
|
@ -763,12 +763,17 @@ rio_request(struct ifaltq *ifq, int req, void *arg)
|
|||
* ENOBUFS when drop occurs.
|
||||
*/
|
||||
static int
|
||||
rio_enqueue(struct ifaltq *ifq, struct mbuf *m, struct altq_pktattr *pktattr)
|
||||
rio_enqueue(struct ifaltq *ifq, struct mbuf *m)
|
||||
{
|
||||
struct altq_pktattr pktattr;
|
||||
rio_queue_t *rqp = (rio_queue_t *)ifq->altq_disc;
|
||||
int error = 0;
|
||||
|
||||
if (rio_addq(rqp->rq_rio, rqp->rq_q, m, pktattr) == 0)
|
||||
pktattr.pattr_class = m->m_pkthdr.pattr_class;
|
||||
pktattr.pattr_af = m->m_pkthdr.pattr_af;
|
||||
pktattr.pattr_hdr = m->m_pkthdr.pattr_hdr;
|
||||
|
||||
if (rio_addq(rqp->rq_rio, rqp->rq_q, m, &pktattr) == 0)
|
||||
ifq->ifq_len++;
|
||||
else
|
||||
error = ENOBUFS;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: altq_subr.c,v 1.29 2014/05/17 20:44:24 rmind Exp $ */
|
||||
/* $NetBSD: altq_subr.c,v 1.30 2016/04/20 08:58:48 knakahara Exp $ */
|
||||
/* $KAME: altq_subr.c,v 1.24 2005/04/13 03:44:25 suz Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -28,7 +28,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: altq_subr.c,v 1.29 2014/05/17 20:44:24 rmind Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: altq_subr.c,v 1.30 2016/04/20 08:58:48 knakahara Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_altq.h"
|
||||
|
@ -125,7 +125,7 @@ altq_lookup(char *name, int type)
|
|||
|
||||
int
|
||||
altq_attach(struct ifaltq *ifq, int type, void *discipline,
|
||||
int (*enqueue)(struct ifaltq *, struct mbuf *, struct altq_pktattr *),
|
||||
int (*enqueue)(struct ifaltq *, struct mbuf *),
|
||||
struct mbuf *(*dequeue)(struct ifaltq *, int),
|
||||
int (*request)(struct ifaltq *, int, void *),
|
||||
void *clfier, void *(*classify)(void *, struct mbuf *, int))
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: altq_wfq.c,v 1.20 2014/03/20 20:51:54 christos Exp $ */
|
||||
/* $NetBSD: altq_wfq.c,v 1.21 2016/04/20 08:58:48 knakahara Exp $ */
|
||||
/* $KAME: altq_wfq.c,v 1.14 2005/04/13 03:44:25 suz Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -32,7 +32,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: altq_wfq.c,v 1.20 2014/03/20 20:51:54 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: altq_wfq.c,v 1.21 2016/04/20 08:58:48 knakahara Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_altq.h"
|
||||
|
@ -69,8 +69,7 @@ __KERNEL_RCSID(0, "$NetBSD: altq_wfq.c,v 1.20 2014/03/20 20:51:54 christos Exp $
|
|||
static int wfq_setenable(struct wfq_interface *, int);
|
||||
static int wfq_ifattach(struct wfq_interface *);
|
||||
static int wfq_ifdetach(struct wfq_interface *);
|
||||
static int wfq_ifenqueue(struct ifaltq *, struct mbuf *,
|
||||
struct altq_pktattr *);
|
||||
static int wfq_ifenqueue(struct ifaltq *, struct mbuf *);
|
||||
static u_long wfq_hash(struct flowinfo *, int);
|
||||
static inline u_long wfq_hashbydstaddr(struct flowinfo *, int);
|
||||
static inline u_long wfq_hashbysrcaddr(struct flowinfo *, int);
|
||||
|
@ -249,7 +248,7 @@ wfq_classify(void *clfier, struct mbuf *m, int af)
|
|||
}
|
||||
|
||||
static int
|
||||
wfq_ifenqueue(struct ifaltq *ifq, struct mbuf *mp, struct altq_pktattr *pktattr)
|
||||
wfq_ifenqueue(struct ifaltq *ifq, struct mbuf *mp)
|
||||
{
|
||||
wfq_state_t *wfqp;
|
||||
wfq *queue;
|
||||
|
@ -259,7 +258,7 @@ wfq_ifenqueue(struct ifaltq *ifq, struct mbuf *mp, struct altq_pktattr *pktattr)
|
|||
mp->m_nextpkt = NULL;
|
||||
|
||||
/* grab a queue selected by classifier */
|
||||
if (pktattr == NULL || (queue = pktattr->pattr_class) == NULL)
|
||||
if ((queue = mp->m_pkthdr.pattr_class) == NULL)
|
||||
queue = &wfqp->queue[0];
|
||||
|
||||
if (queue->tail == NULL)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_altq.h,v 1.14 2014/07/01 10:16:02 ozaki-r Exp $ */
|
||||
/* $NetBSD: if_altq.h,v 1.15 2016/04/20 08:58:48 knakahara Exp $ */
|
||||
/* $KAME: if_altq.h,v 1.12 2005/04/13 03:44:25 suz Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -53,8 +53,7 @@ struct ifaltq {
|
|||
void *altq_disc; /* for discipline-specific use */
|
||||
struct ifnet *altq_ifp; /* back pointer to interface */
|
||||
|
||||
int (*altq_enqueue)(struct ifaltq *, struct mbuf *,
|
||||
struct altq_pktattr *);
|
||||
int (*altq_enqueue)(struct ifaltq *, struct mbuf *);
|
||||
struct mbuf *(*altq_dequeue)(struct ifaltq *, int);
|
||||
int (*altq_request)(struct ifaltq *, int, void *);
|
||||
|
||||
|
@ -146,8 +145,8 @@ struct tb_regulator {
|
|||
#define ALTQ_CLEAR_CNDTNING(ifq) ((ifq)->altq_flags &= ~ALTQF_CNDTNING)
|
||||
#define ALTQ_IS_ATTACHED(ifq) ((ifq)->altq_disc != NULL)
|
||||
|
||||
#define ALTQ_ENQUEUE(ifq, m, pa, err) \
|
||||
(err) = (*(ifq)->altq_enqueue)((ifq),(m),(pa))
|
||||
#define ALTQ_ENQUEUE(ifq, m, err) \
|
||||
(err) = (*(ifq)->altq_enqueue)((ifq),(m))
|
||||
#define ALTQ_DEQUEUE(ifq, m) \
|
||||
(m) = (*(ifq)->altq_dequeue)((ifq), ALTDQ_REMOVE)
|
||||
#define ALTQ_POLL(ifq, m) \
|
||||
|
@ -158,8 +157,7 @@ struct tb_regulator {
|
|||
#define TBR_IS_ENABLED(ifq) ((ifq)->altq_tbr != NULL)
|
||||
|
||||
extern int altq_attach(struct ifaltq *, int, void *,
|
||||
int (*)(struct ifaltq *, struct mbuf *,
|
||||
struct altq_pktattr *),
|
||||
int (*)(struct ifaltq *, struct mbuf *),
|
||||
struct mbuf *(*)(struct ifaltq *, int),
|
||||
int (*)(struct ifaltq *, int, void *),
|
||||
void *,
|
||||
|
@ -170,7 +168,7 @@ extern int altq_disable(struct ifaltq *);
|
|||
extern struct mbuf *tbr_dequeue(struct ifaltq *, int);
|
||||
extern int (*altq_input)(struct mbuf *, int);
|
||||
#if 1 /* ALTQ3_CLFIER_COMPAT */
|
||||
void altq_etherclassify(struct ifaltq *, struct mbuf *, struct altq_pktattr *);
|
||||
void altq_etherclassify(struct ifaltq *, struct mbuf *);
|
||||
#endif
|
||||
#endif /* _KERNEL */
|
||||
|
||||
|
|
12
sys/net/if.h
12
sys/net/if.h
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if.h,v 1.199 2016/04/20 08:56:32 knakahara Exp $ */
|
||||
/* $NetBSD: if.h,v 1.200 2016/04/20 08:58:48 knakahara Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
|
||||
|
@ -761,13 +761,9 @@ struct if_addrprefreq {
|
|||
do { \
|
||||
struct altq_pktattr *_unused __unused = unused; \
|
||||
IFQ_LOCK((ifq)); \
|
||||
if (ALTQ_IS_ENABLED((ifq))) { \
|
||||
struct altq_pktattr pattr; \
|
||||
pattr.pattr_class = (m)->m_pkthdr.pattr_class; \
|
||||
pattr.pattr_af = (m)->m_pkthdr.pattr_af; \
|
||||
pattr.pattr_hdr = (m)->m_pkthdr.pattr_hdr; \
|
||||
ALTQ_ENQUEUE((ifq), (m), &pattr, (err)); \
|
||||
} else { \
|
||||
if (ALTQ_IS_ENABLED((ifq))) \
|
||||
ALTQ_ENQUEUE((ifq), (m), (err)); \
|
||||
else { \
|
||||
if (IF_QFULL((ifq))) { \
|
||||
m_freem((m)); \
|
||||
(err) = ENOBUFS; \
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_bridge.c,v 1.115 2016/04/19 07:10:22 ozaki-r Exp $ */
|
||||
/* $NetBSD: if_bridge.c,v 1.116 2016/04/20 08:58:48 knakahara Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 2001 Wasabi Systems, Inc.
|
||||
|
@ -80,7 +80,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.115 2016/04/19 07:10:22 ozaki-r Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.116 2016/04/20 08:58:48 knakahara Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_bridge_ipf.h"
|
||||
|
@ -1375,7 +1375,7 @@ bridge_enqueue(struct bridge_softc *sc, struct ifnet *dst_ifp, struct mbuf *m,
|
|||
*/
|
||||
if (ALTQ_IS_ENABLED(&dst_ifp->if_snd)) {
|
||||
/* XXX IFT_ETHER */
|
||||
altq_etherclassify(&dst_ifp->if_snd, m, &pktattr);
|
||||
altq_etherclassify(&dst_ifp->if_snd, m);
|
||||
}
|
||||
#endif /* ALTQ */
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_ethersubr.c,v 1.219 2016/04/20 08:56:32 knakahara Exp $ */
|
||||
/* $NetBSD: if_ethersubr.c,v 1.220 2016/04/20 08:58:48 knakahara Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
||||
|
@ -61,7 +61,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.219 2016/04/20 08:56:32 knakahara Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.220 2016/04/20 08:58:48 knakahara Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_inet.h"
|
||||
|
@ -418,7 +418,7 @@ ether_output(struct ifnet * const ifp0, struct mbuf * const m0,
|
|||
* address family/header pointer in the pktattr.
|
||||
*/
|
||||
if (ALTQ_IS_ENABLED(&ifp->if_snd))
|
||||
altq_etherclassify(&ifp->if_snd, m, NULL);
|
||||
altq_etherclassify(&ifp->if_snd, m);
|
||||
#endif
|
||||
return ifq_enqueue(ifp, m ALTQ_COMMA ALTQ_DECL(&pktattr));
|
||||
|
||||
|
@ -435,8 +435,7 @@ bad:
|
|||
* classification engine understands link headers.
|
||||
*/
|
||||
void
|
||||
altq_etherclassify(struct ifaltq *ifq, struct mbuf *m,
|
||||
struct altq_pktattr *pktattr)
|
||||
altq_etherclassify(struct ifaltq *ifq, struct mbuf *m)
|
||||
{
|
||||
struct ether_header *eh;
|
||||
uint16_t ether_type;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_vlan.c,v 1.84 2016/02/09 08:32:12 ozaki-r Exp $ */
|
||||
/* $NetBSD: if_vlan.c,v 1.85 2016/04/20 08:58:48 knakahara Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
|
||||
|
@ -78,7 +78,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.84 2016/02/09 08:32:12 ozaki-r Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.85 2016/04/20 08:58:48 knakahara Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_inet.h"
|
||||
|
@ -709,7 +709,7 @@ vlan_start(struct ifnet *ifp)
|
|||
if (ALTQ_IS_ENABLED(&p->if_snd)) {
|
||||
switch (p->if_type) {
|
||||
case IFT_ETHER:
|
||||
altq_etherclassify(&p->if_snd, m, &pktattr);
|
||||
altq_etherclassify(&p->if_snd, m);
|
||||
break;
|
||||
#ifdef DIAGNOSTIC
|
||||
default:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ieee80211_input.c,v 1.80 2016/02/09 08:32:12 ozaki-r Exp $ */
|
||||
/* $NetBSD: ieee80211_input.c,v 1.81 2016/04/20 08:58:48 knakahara Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 2001 Atsushi Onoe
|
||||
* Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
|
||||
|
@ -36,7 +36,7 @@
|
|||
__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_input.c,v 1.81 2005/08/10 16:22:29 sam Exp $");
|
||||
#endif
|
||||
#ifdef __NetBSD__
|
||||
__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.80 2016/02/09 08:32:12 ozaki-r Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.81 2016/04/20 08:58:48 knakahara Exp $");
|
||||
#endif
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
|
@ -741,8 +741,7 @@ ieee80211_deliver_data(struct ieee80211com *ic,
|
|||
int len;
|
||||
#ifdef ALTQ
|
||||
if (ALTQ_IS_ENABLED(&ifp->if_snd)) {
|
||||
altq_etherclassify(&ifp->if_snd, m1,
|
||||
&pktattr);
|
||||
altq_etherclassify(&ifp->if_snd, m1);
|
||||
}
|
||||
#endif
|
||||
len = m1->m_pkthdr.len;
|
||||
|
|
Loading…
Reference in New Issue