Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys IFQ_ENQUEUE refactor (2/3) : eliminate pktattr argument ...
details: https://anonhg.NetBSD.org/src/rev/51147838fba8
branches: trunk
changeset: 344790:51147838fba8
user: knakahara <knakahara%NetBSD.org@localhost>
date: Wed Apr 20 08:58:48 2016 +0000
description:
IFQ_ENQUEUE refactor (2/3) : eliminate pktattr argument from altq implemantation
diffstat:
sys/altq/altq_blue.c | 15 ++++++++++-----
sys/altq/altq_cbq.c | 26 +++++++++++++++-----------
sys/altq/altq_fifoq.c | 10 ++++------
sys/altq/altq_hfsc.c | 24 ++++++++++++++----------
sys/altq/altq_jobs.c | 10 +++++-----
sys/altq/altq_priq.c | 23 ++++++++++++++---------
sys/altq/altq_red.c | 15 ++++++++++-----
sys/altq/altq_rio.c | 15 ++++++++++-----
sys/altq/altq_subr.c | 6 +++---
sys/altq/altq_wfq.c | 11 +++++------
sys/altq/if_altq.h | 14 ++++++--------
sys/net/if.h | 12 ++++--------
sys/net/if_bridge.c | 6 +++---
sys/net/if_ethersubr.c | 9 ++++-----
sys/net/if_vlan.c | 6 +++---
sys/net80211/ieee80211_input.c | 7 +++----
16 files changed, 113 insertions(+), 96 deletions(-)
diffs (truncated from 699 to 300 lines):
diff -r 96f719e95d22 -r 51147838fba8 sys/altq/altq_blue.c
--- a/sys/altq/altq_blue.c Wed Apr 20 08:56:32 2016 +0000
+++ b/sys/altq/altq_blue.c Wed Apr 20 08:58:48 2016 +0000
@@ -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 @@
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 @@
* 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;
diff -r 96f719e95d22 -r 51147838fba8 sys/altq/altq_cbq.c
--- a/sys/altq/altq_cbq.c Wed Apr 20 08:56:32 2016 +0000
+++ b/sys/altq/altq_cbq.c Wed Apr 20 08:58:48 2016 +0000
@@ -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 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 @@
/*
* 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 @@
*/
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 @@
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 @@
}
}
#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);
diff -r 96f719e95d22 -r 51147838fba8 sys/altq/altq_fifoq.c
--- a/sys/altq/altq_fifoq.c Wed Apr 20 08:56:32 2016 +0000
+++ b/sys/altq/altq_fifoq.c Wed Apr 20 08:58:48 2016 +0000
@@ -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 @@
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 @@
* 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;
diff -r 96f719e95d22 -r 51147838fba8 sys/altq/altq_hfsc.c
--- a/sys/altq/altq_hfsc.c Wed Apr 20 08:56:32 2016 +0000
+++ b/sys/altq/altq_hfsc.c Wed Apr 20 08:58:48 2016 +0000
@@ -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 @@
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 @@
* (*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 @@
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 @@
}
}
#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);
diff -r 96f719e95d22 -r 51147838fba8 sys/altq/altq_jobs.c
--- a/sys/altq/altq_jobs.c Wed Apr 20 08:56:32 2016 +0000
+++ b/sys/altq/altq_jobs.c Wed Apr 20 08:58:48 2016 +0000
@@ -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 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 @@
* (*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 @@
}
/* 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);
diff -r 96f719e95d22 -r 51147838fba8 sys/altq/altq_priq.c
--- a/sys/altq/altq_priq.c Wed Apr 20 08:56:32 2016 +0000
+++ b/sys/altq/altq_priq.c Wed Apr 20 08:58:48 2016 +0000
@@ -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 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 *);
Home |
Main Index |
Thread Index |
Old Index