Hi.
After several suggestions from Henning I started working putting parts
of hfsc_if into ifaltq, where normally ALTQ bits would be (altq_flags
will have to stay outside of the union, because that's how you know if
altq has been enabled on that ifnet). But making that union will mean
"altq_disc" as "transition.altq.altq_disc" will clash with pf_altq's
member. This diff renames pf_altq::altq_disc to altq_disc_state.
(Ah, the good old C namespace problems! ;-))
It builds on amd64 and shouldn't make any difference.
ok?
--
Martin Pelikan
Index: altq/altq_cbq.c
===================================================================
RCS file: /cvs/src/sys/altq/altq_cbq.c,v
retrieving revision 1.26
diff -u -p -r1.26 altq_cbq.c
--- altq/altq_cbq.c 3 Jul 2011 23:59:43 -0000 1.26
+++ altq/altq_cbq.c 18 Oct 2013 16:49:09 -0000
@@ -189,10 +189,10 @@ cbq_pfattach(struct pf_altq *a)
struct ifnet *ifp;
int s, error;
- if ((ifp = ifunit(a->ifname)) == NULL || a->altq_disc == NULL)
+ if ((ifp = ifunit(a->ifname)) == NULL || a->altq_disc_state == NULL)
return (EINVAL);
s = splnet();
- error = altq_attach(&ifp->if_snd, ALTQT_CBQ, a->altq_disc,
+ error = altq_attach(&ifp->if_snd, ALTQT_CBQ, a->altq_disc_state,
cbq_enqueue, cbq_dequeue, cbq_request, NULL, NULL);
splx(s);
return (error);
@@ -216,7 +216,7 @@ cbq_add_altq(struct pf_altq *a)
cbqp->ifnp.ifq_ = &ifp->if_snd; /* keep the ifq */
/* keep the state in pf_altq */
- a->altq_disc = cbqp;
+ a->altq_disc_state = cbqp;
return (0);
}
@@ -226,9 +226,9 @@ cbq_remove_altq(struct pf_altq *a)
{
cbq_state_t *cbqp;
- if ((cbqp = a->altq_disc) == NULL)
+ if ((cbqp = a->altq_disc_state) == NULL)
return (EINVAL);
- a->altq_disc = NULL;
+ a->altq_disc_state = NULL;
cbq_clear_interface(cbqp);
@@ -252,7 +252,7 @@ cbq_add_queue(struct pf_altq *a)
struct cbq_opts *opts;
int i;
- if ((cbqp = a->altq_disc) == NULL)
+ if ((cbqp = a->altq_disc_state) == NULL)
return (EINVAL);
if (a->qid == 0)
return (EINVAL);
@@ -360,7 +360,7 @@ cbq_remove_queue(struct pf_altq *a)
cbq_state_t *cbqp;
int i;
- if ((cbqp = a->altq_disc) == NULL)
+ if ((cbqp = a->altq_disc_state) == NULL)
return (EINVAL);
if ((cl = clh_to_clp(cbqp, a->qid)) == NULL)
Index: altq/altq_hfsc.c
===================================================================
RCS file: /cvs/src/sys/altq/altq_hfsc.c,v
retrieving revision 1.29
diff -u -p -r1.29 altq_hfsc.c
--- altq/altq_hfsc.c 18 Sep 2011 20:34:29 -0000 1.29
+++ altq/altq_hfsc.c 18 Oct 2013 16:49:09 -0000
@@ -134,10 +134,10 @@ hfsc_pfattach(struct pf_altq *a)
struct ifnet *ifp;
int s, error;
- if ((ifp = ifunit(a->ifname)) == NULL || a->altq_disc == NULL)
+ if ((ifp = ifunit(a->ifname)) == NULL || a->altq_disc_state == NULL)
return (EINVAL);
s = splnet();
- error = altq_attach(&ifp->if_snd, ALTQT_HFSC, a->altq_disc,
+ error = altq_attach(&ifp->if_snd, ALTQT_HFSC, a->altq_disc_state,
altq_hfsc_enqueue, altq_hfsc_dequeue, altq_hfsc_request, NULL,
NULL);
splx(s);
@@ -162,7 +162,7 @@ hfsc_add_altq(struct pf_altq *a)
hif->hif_ifq = &ifp->if_snd;
/* keep the state in pf_altq */
- a->altq_disc = hif;
+ a->altq_disc_state = hif;
return (0);
}
@@ -172,9 +172,9 @@ hfsc_remove_altq(struct pf_altq *a)
{
struct altq_hfsc_if *hif;
- if ((hif = a->altq_disc) == NULL)
+ if ((hif = a->altq_disc_state) == NULL)
return (EINVAL);
- a->altq_disc = NULL;
+ a->altq_disc_state = NULL;
(void)hfsc_clear_interface(hif);
(void)altq_hfsc_class_destroy(hif->hif_rootclass);
@@ -194,7 +194,7 @@ hfsc_add_queue(struct pf_altq *a)
struct hfsc_opts *opts;
struct service_curve rtsc, lssc, ulsc;
- if ((hif = a->altq_disc) == NULL)
+ if ((hif = a->altq_disc_state) == NULL)
return (EINVAL);
opts = &a->pq_u.hfsc_opts;
@@ -235,7 +235,7 @@ hfsc_remove_queue(struct pf_altq *a)
struct altq_hfsc_if *hif;
struct altq_hfsc_class *cl;
- if ((hif = a->altq_disc) == NULL)
+ if ((hif = a->altq_disc_state) == NULL)
return (EINVAL);
if ((cl = clh_to_clp(hif, a->qid)) == NULL)
Index: altq/altq_priq.c
===================================================================
RCS file: /cvs/src/sys/altq/altq_priq.c,v
retrieving revision 1.24
diff -u -p -r1.24 altq_priq.c
--- altq/altq_priq.c 3 Jul 2011 23:59:43 -0000 1.24
+++ altq/altq_priq.c 18 Oct 2013 16:49:09 -0000
@@ -73,10 +73,10 @@ priq_pfattach(struct pf_altq *a)
struct ifnet *ifp;
int s, error;
- if ((ifp = ifunit(a->ifname)) == NULL || a->altq_disc == NULL)
+ if ((ifp = ifunit(a->ifname)) == NULL || a->altq_disc_state == NULL)
return (EINVAL);
s = splnet();
- error = altq_attach(&ifp->if_snd, ALTQT_PRIQ, a->altq_disc,
+ error = altq_attach(&ifp->if_snd, ALTQT_PRIQ, a->altq_disc_state,
priq_enqueue, priq_dequeue, priq_request, NULL, NULL);
splx(s);
return (error);
@@ -99,7 +99,7 @@ priq_add_altq(struct pf_altq *a)
pif->pif_ifq = &ifp->if_snd;
/* keep the state in pf_altq */
- a->altq_disc = pif;
+ a->altq_disc_state = pif;
return (0);
}
@@ -109,9 +109,9 @@ priq_remove_altq(struct pf_altq *a)
{
struct priq_if *pif;
- if ((pif = a->altq_disc) == NULL)
+ if ((pif = a->altq_disc_state) == NULL)
return (EINVAL);
- a->altq_disc = NULL;
+ a->altq_disc_state = NULL;
(void)priq_clear_interface(pif);
@@ -125,7 +125,7 @@ priq_add_queue(struct pf_altq *a)
struct priq_if *pif;
struct priq_class *cl;
- if ((pif = a->altq_disc) == NULL)
+ if ((pif = a->altq_disc_state) == NULL)
return (EINVAL);
/* check parameters */
@@ -152,7 +152,7 @@ priq_remove_queue(struct pf_altq *a)
struct priq_if *pif;
struct priq_class *cl;
- if ((pif = a->altq_disc) == NULL)
+ if ((pif = a->altq_disc_state) == NULL)
return (EINVAL);
if ((cl = clh_to_clp(pif, a->qid)) == NULL)
Index: altq/altq_subr.c
===================================================================
RCS file: /cvs/src/sys/altq/altq_subr.c,v
retrieving revision 1.29
diff -u -p -r1.29 altq_subr.c
--- altq/altq_subr.c 5 Nov 2012 19:39:34 -0000 1.29
+++ altq/altq_subr.c 18 Oct 2013 16:49:09 -0000
@@ -394,7 +394,8 @@ altq_pfdetach(struct pf_altq *a)
return (EINVAL);
/* if this discipline is no longer referenced, just return */
- if (a->altq_disc == NULL || a->altq_disc != ifp->if_snd.altq_disc)
+ if (a->altq_disc_state == NULL ||
+ a->altq_disc_state != ifp->if_snd.altq_disc)
return (0);
s = splnet();
Index: net/pf_ioctl.c
===================================================================
RCS file: /cvs/src/sys/net/pf_ioctl.c,v
retrieving revision 1.262
diff -u -p -r1.262 pf_ioctl.c
--- net/pf_ioctl.c 17 Oct 2013 16:27:42 -0000 1.262
+++ net/pf_ioctl.c 18 Oct 2013 16:49:10 -0000
@@ -667,7 +667,7 @@ pf_disable_altq(struct pf_altq *altq)
* when the discipline is no longer referenced, it was overridden
* by a new one. if so, just return.
*/
- if (altq->altq_disc != ifp->if_snd.altq_disc)
+ if (altq->altq_disc_state != ifp->if_snd.altq_disc)
return (0);
error = altq_disable(&ifp->if_snd);
@@ -1898,7 +1898,7 @@ pfioctl(dev_t dev, u_long cmd, caddr_t a
break;
}
bcopy(&pa->altq, altq, sizeof(struct pf_altq));
- altq->altq_disc = NULL;
+ altq->altq_disc_state = NULL;
/*
* if this is for a queue, find the discipline and
@@ -1913,7 +1913,8 @@ pfioctl(dev_t dev, u_long cmd, caddr_t a
TAILQ_FOREACH(a, pf_altqs_inactive, entries) {
if (strncmp(a->ifname, altq->ifname,
IFNAMSIZ) == 0 && a->qname[0] == 0) {
- altq->altq_disc = a->altq_disc;
+ altq->altq_disc_state =
+ a->altq_disc_state;
break;
}
}
Index: net/pfvar.h
===================================================================
RCS file: /cvs/src/sys/net/pfvar.h,v
retrieving revision 1.391
diff -u -p -r1.391 pfvar.h
--- net/pfvar.h 12 Oct 2013 12:13:11 -0000 1.391
+++ net/pfvar.h 18 Oct 2013 16:49:10 -0000
@@ -1480,7 +1480,7 @@ struct hfsc_opts {
struct pf_altq {
char ifname[IFNAMSIZ];
- void *altq_disc; /* discipline-specific state */
+ void *altq_disc_state; /* discipline-specific state
*/
TAILQ_ENTRY(pf_altq) entries;
/* scheduler spec */