svn commit: r203294 - in user/luigi/ipfw3-head: sbin/ipfw sys/netinet/ipfw

Luigi Rizzo luigi at FreeBSD.org
Sun Jan 31 16:04:23 UTC 2010


Author: luigi
Date: Sun Jan 31 16:04:23 2010
New Revision: 203294
URL: http://svn.freebsd.org/changeset/base/203294

Log:
  make some diagnostic messages conditional on net.inet.ip.dummynet.debug
  Fix (hopefully) the printing of children of a flowset.

Modified:
  user/luigi/ipfw3-head/sbin/ipfw/dummynet.c
  user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_wf2q.c
  user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_io.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	Sun Jan 31 15:38:26 2010	(r203293)
+++ user/luigi/ipfw3-head/sbin/ipfw/dummynet.c	Sun Jan 31 16:04:23 2010	(r203294)
@@ -305,14 +305,14 @@ list_pipes(struct dn_id *oid, struct dn_
 		int i, l;
 		struct {
 			struct dn_id id;
-			uintptr_t p[0];
+			uint32_t p[0];
 		} *d = (void *)oid;
 		l = (oid->len - sizeof(*oid))/sizeof(d->p[0]);
 		if (l == 0)
 		    break;
 		printf("   Children flowsets: ");
 		for (i = 0; i < l; i++)
-			printf("%d ", d->p[i]);
+			printf("%u ", d->p[i]);
 		printf("\n");
 		break;
 	    }

Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_wf2q.c
==============================================================================
--- user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_wf2q.c	Sun Jan 31 15:38:26 2010	(r203293)
+++ user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_wf2q.c	Sun Jan 31 16:04:23 2010	(r203294)
@@ -168,7 +168,7 @@ wf2qp_enqueue(struct new_sch_inst *_si, 
     if (DN_KEY_LT(si->V, alg_fq->S)) {
         /* S>V means flow Not eligible. */
         if (si->sch_heap.elements == 0)
-            printf("dummynet: ++ ouch! not eligible but empty scheduler!\n");
+            D("++ ouch! not eligible but empty scheduler!");
         heap_insert(&si->ne_heap, alg_fq->S, q);
     } else {
         heap_insert(&si->sch_heap, alg_fq->F, q);
@@ -283,7 +283,6 @@ wf2qp_free_sched(struct new_sch_inst *_s
 static int
 wf2qp_new_fsk(struct new_fsk *fs)
 {
-	// printf("%s called\n", __FUNCTION__);
 	ipdn_bound_var(&fs->fs.par[0], 1,
 		1, 100, "WF2Q+ weight");
 	return 0;
@@ -316,7 +315,6 @@ wf2qp_free_queue(struct new_queue *q)
 	struct wf2qp_queue *alg_fq = (struct wf2qp_queue *)q;
 	struct wf2qp_si *si = (struct wf2qp_si *)(q->_si + 1);
     
-	printf("%s called\n", __FUNCTION__);
 	if (alg_fq->S >= alg_fq->F + 1)
 		return 0;	/* nothing to do, not in any heap */
 	si->wsum -= q->fs->fs.par[0];

Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_io.c
==============================================================================
--- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_io.c	Sun Jan 31 15:38:26 2010	(r203293)
+++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dn_io.c	Sun Jan 31 16:04:23 2010	(r203294)
@@ -117,6 +117,8 @@ SYSCTL_LONG(_net_inet_ip_dummynet, OID_A
     "Upper limit in bytes for pipe queue.");
 SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, io_fast,
     CTLFLAG_RW, &dn_cfg.io_fast, 0, "Enable fast dummynet io.");
+SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, debug,
+    CTLFLAG_RW, &dn_cfg.debug, 0, "Dummynet debug level");
 
 /* RED parameters */
 SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, red_lookup_depth,

Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c
==============================================================================
--- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c	Sun Jan 31 15:38:26 2010	(r203293)
+++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_dummynet.c	Sun Jan 31 16:04:23 2010	(r203294)
@@ -106,15 +106,18 @@ find_sched_type(int type, char *name)
 int
 ipdn_bound_var(int *v, int dflt, int lo, int hi, const char *msg)
 {
-	if (*v < lo) {
+	int oldv = *v;
+	const char *op = NULL;
+	if (oldv < lo) {
 		*v = dflt;
-		if (msg)
-			printf("default %s to %d\n", msg, *v);
-	} else if (*v > hi) {
+		op = "Bump";
+	} else if (oldv > hi) {
 		*v = hi;
-		if (msg)
-			printf("clamp %s to %d\n", msg, *v);
-	}
+		op = "Clamp";
+	} else
+		return *v;
+	if (op && msg)
+		printf("%s %s to %d (was %d)\n", op, msg, *v, oldv);
 	return *v;
 }
 
@@ -834,27 +837,30 @@ copy_si(struct copy_args *a, struct new_
 	return 0;
 }
 
+/*
+ * compute a list of children of a scheduler and copy up
+ */
 static int
 copy_fsk_list(struct copy_args *a, struct new_schk *s, int flags)
 {
 	struct new_fsk *fs;
 	struct dn_id *o;
-	uint16_t *p;
+	uint32_t *p;
 
 	int n = 0, space = sizeof(*o);
 	SLIST_FOREACH(fs, &s->fsk_list, sch_chain) {
 		if (fs->fs.fs_nr < DN_MAX_ID)
 			n++;
 	}
-	space += n * sizeof(uintptr_t);
-	D("sched %d has %d flowsets", s->sch.sched_nr, n);
+	space += n * sizeof(uint32_t);
+	DX(3, "sched %d has %d flowsets", s->sch.sched_nr, n);
 	if (a->end - *(a->start) < space)
 		return DNHT_SCAN_END;
 	o = (struct dn_id *)(*(a->start));
 	o->len = space;
 	*a->start += o->len;
 	o->type = DN_TEXT;
-	p = (uint16_t *)(o+1);
+	p = (uint32_t *)(o+1);
 	SLIST_FOREACH(fs, &s->fsk_list, sch_chain)
 		if (fs->fs.fs_nr < DN_MAX_ID)
 			*p++ = fs->fs.fs_nr;
@@ -1083,7 +1089,7 @@ config_fs(struct new_fs *nfs, struct dn_
 	     * queues if we need to reattach. Then update the
 	     * configuration, and possibly attach to the new sched.
 	     */
-	    D("fs %d changed sched %d@%p to %d@%p",
+	    DX(2, "fs %d changed sched %d@%p to %d@%p",
 		fs->fs.fs_nr,
 		fs->fs.sched_nr, fs->sched, nfs->sched_nr, s);
 	    if (fs->sched) {
@@ -1170,13 +1176,13 @@ again: /* run twice, for wfq and fifo */
 		s->link = p;
 	p.link_nr = 0;
 	if (s->fp == NULL) {
-		D("sched %d new type %s", i, a.fp->name);
+		DX(2, "sched %d new type %s", i, a.fp->name);
 	} else if (s->fp != a.fp ||
 			bcmp(a.sch, &s->sch, sizeof(*a.sch)) ) {
 		/* already existing. */
-		D("sched %d type changed from %s to %s",
+		DX(2, "sched %d type changed from %s to %s",
 			i, s->fp->name, a.fp->name);
-		ND("   type/sub %d/%d -> %d/%d",
+		DX(4, "   type/sub %d/%d -> %d/%d",
 			s->sch.oid.type, s->sch.oid.subtype, 
 			a.sch->oid.type, a.sch->oid.subtype);
 		if (s->link.link_nr == 0)
@@ -1190,7 +1196,7 @@ again: /* run twice, for wfq and fifo */
 		schk_delete_cb(s, (void *)DN_DELETE);
 		goto again;
 	} else {
-		ND("sched %d unchanged type %s", i, a.fp->name);
+		DX(4, "sched %d unchanged type %s", i, a.fp->name);
 	}
 	/* complete initialization */
 	s->sch = *a.sch;
@@ -1303,7 +1309,7 @@ dummynet_flush(void)
 	dn_ht_scan(dn_cfg.schedhash, schk_delete_cb,
 		(void *)(uintptr_t)DN_DELETE_FS);
 	/* delete all remaining (unlinked) flowsets */
-	D("still %d unlinked fs", dn_cfg.fsk_count);
+	DX(4, "still %d unlinked fs", dn_cfg.fsk_count);
 	dn_ht_free(dn_cfg.fshash, DNHT_REMOVE);
 	fsk_detach_list(&dn_cfg.fsu, DN_DELETE_FS);
 	/* Reinitialize system heap... */


More information about the svn-src-user mailing list