svn commit: r202687 - in user/luigi/ipfw3-head: sbin/ipfw
sys/netinet/ipfw
Luigi Rizzo
luigi at FreeBSD.org
Wed Jan 20 09:48:46 UTC 2010
Author: luigi
Date: Wed Jan 20 09:48:46 2010
New Revision: 202687
URL: http://svn.freebsd.org/changeset/base/202687
Log:
default to wf2q+ in the kernel and not in userland.
Modified:
user/luigi/ipfw3-head/sbin/ipfw/dummynet.c
user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c
Modified: user/luigi/ipfw3-head/sbin/ipfw/dummynet.c
==============================================================================
--- user/luigi/ipfw3-head/sbin/ipfw/dummynet.c Wed Jan 20 09:29:07 2010 (r202686)
+++ user/luigi/ipfw3-head/sbin/ipfw/dummynet.c Wed Jan 20 09:48:46 2010 (r202687)
@@ -308,6 +308,11 @@ flush_buf(char *buf)
/*
* generic list routine. We expect objects in a specific order, i.e.
+ * PIPES AND SCHEDULERS:
+ * pipe; scheduler; internal flowset if any; instances
+ * XXX do we need the queue ?
+ * FLOWSETS:
+ * flowset; queues;
* pipe i (int queue); scheduler i; si(i) { flowsets() : queues }
* filt is an array of sorted ranges whithin where we list
*/
@@ -322,12 +327,17 @@ list_pipes(struct dn_id *oid, struct dn_
errx(1, "invalid oid len %d\n", oid->len);
switch (oid->type) {
+ default:
+ flush_buf(buf);
+ printf("unrecognized object %d size %d\n", oid->type, oid->len);
+ break;
case DN_PIPE: {
struct new_pipe *p = (struct new_pipe *)oid;
double b = p->bandwidth;
char bwbuf[30];
char burst[5 + 7];
+ /* This starts a new object so flush buffer */
flush_buf(buf);
/* data rate */
if (b == 0)
@@ -787,7 +797,8 @@ ipfw_config_pipe(int ac, char **av)
/* the WFQ scheduler */
sch = o_next(&buf, sizeof(*sch), DN_SCH);
sch->sched_nr = i;
- sch->oid.subtype = DN_SCHED_WF2QP;
+ /* type should be wfq, but we set the default in the kernel. */
+ sch->oid.subtype = 0;
mask = &sch->sched_mask;
/* XXX the FIFO scheduler is created from the WFQ one */
Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c
==============================================================================
--- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c Wed Jan 20 09:29:07 2010 (r202686)
+++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c Wed Jan 20 09:48:46 2010 (r202687)
@@ -1005,20 +1005,24 @@ config_sched(struct new_sch *_nsch, stru
again: /* run twice, for wfq and fifo */
a.fp = find_sched_type(a.sch->oid.subtype, a.sch->type);
if (a.fp != NULL) {
- a.sch->oid.subtype = a.fp->type;
s = dn_ht_find(dn_cfg.schedhash, i, DNHT_INSERT, &a);
+ } else if (a.sch->oid.subtype != 0 || a.sch->type[0]) {
+ DN_BH_WUNLOCK();
+ printf("invalid scheduler type %d %s\n",
+ a.sch->oid.subtype, a.sch->type);
+ return EINVAL;
} else {
- /* accept missing type if sched already exists */
+ /* type not supplied. If it exist already, use
+ * the existing one. Otherwise default to WF2Q+
+ */
s = dn_ht_find(dn_cfg.schedhash, i, 0, &a);
if (s == NULL) {
- DN_BH_WUNLOCK();
- printf("invalid scheduler type %s %d\n",
- a.sch->type, a.sch->oid.subtype);
- return EINVAL;
+ a.sch->oid.subtype = DN_SCHED_WF2QP;
+ goto again;
}
a.fp = s->fp;
- a.sch->oid.subtype = a.fp->type;
}
+ a.sch->oid.subtype = a.fp->type;
printf("%s start i %d ty %s -> %s\n",
__FUNCTION__, i, a.sch->type,
s ? (s->fp?"old":"new"):"none");
More information about the svn-src-user
mailing list