From owner-svn-src-user@FreeBSD.ORG  Thu Jan 21 10:09:19 2010
Return-Path: <owner-svn-src-user@FreeBSD.ORG>
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A9C73106566C;
	Thu, 21 Jan 2010 10:09:19 +0000 (UTC)
	(envelope-from luigi@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 997CD8FC14;
	Thu, 21 Jan 2010 10:09:19 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o0LA9JCZ092137;
	Thu, 21 Jan 2010 10:09:19 GMT (envelope-from luigi@svn.freebsd.org)
Received: (from luigi@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o0LA9JTs092134;
	Thu, 21 Jan 2010 10:09:19 GMT (envelope-from luigi@svn.freebsd.org)
Message-Id: <201001211009.o0LA9JTs092134@svn.freebsd.org>
From: Luigi Rizzo <luigi@FreeBSD.org>
Date: Thu, 21 Jan 2010 10:09:19 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r202738 - user/luigi/ipfw3-head/sys/netinet/ipfw
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental &quot; user&quot;
	src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 21 Jan 2010 10:09:19 -0000

Author: luigi
Date: Thu Jan 21 10:09:19 2010
New Revision: 202738
URL: http://svn.freebsd.org/changeset/base/202738

Log:
  some documentation fixes

Modified:
  user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_fifo.c
  user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_wf2q.c

Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_fifo.c
==============================================================================
--- user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_fifo.c	Thu Jan 21 10:08:58 2010	(r202737)
+++ user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_fifo.c	Thu Jan 21 10:09:19 2010	(r202738)
@@ -47,13 +47,16 @@
  * This file implements a FIFO scheduler for a single queue.
  * The queue is allocated as part of the scheduler instance,
  * and there is a single flowset is in the template which stores
- * queue-related information.
- * No parameters are used except queue sizes and management policy.
+ * queue size and policy.
  * Enqueue and dequeue use the default library functions.
  */
 static int 
 fifo_enqueue(struct new_sch_inst *si, struct new_queue *q, struct mbuf *m)
 {
+	/* XXX if called with q != NULL and m=NULL, this is a
+	 * re-enqueue from an existing scheduler, which we should
+	 * handle.
+	 */
 	return dn_enqueue((struct new_queue *)(si+1), m, 0);
 }
 

Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_wf2q.c
==============================================================================
--- user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_wf2q.c	Thu Jan 21 10:08:58 2010	(r202737)
+++ user/luigi/ipfw3-head/sys/netinet/ipfw/dn_sched_wf2q.c	Thu Jan 21 10:09:19 2010	(r202738)
@@ -48,10 +48,6 @@
 #define MY_M    16 /* shift for fixed point arithmetic */
 #endif
 
-#ifndef isdigit
-#define isdigit(x)  ((x) >= '0' && (x) <= '9' )
-#endif
-
 /*
  * Private information for the scheduler instance:
  * sch_heap (key is Finish time) returns the next queue to serve
@@ -234,7 +230,7 @@ wf2qp_new_sched(struct new_sch_inst *_si
 	struct wf2qp_si *si = (struct wf2qp_si *)(_si + 1);
 	int ofs = sizeof(*_si) + offsetof(struct wf2qp_queue, heap_pos);
 
-	/* only idle-heap supports extract from middle */
+	/* all heaps support extract from middle */
 	if (heap_init(&si->idle_heap, 16, ofs) ||
 	    heap_init(&si->sch_heap, 16, ofs) ||
 	    heap_init(&si->ne_heap, 16, ofs)) {
@@ -283,6 +279,12 @@ wf2qp_new_queue(struct new_queue *_q)
 	return 0;
 }
 
+/*
+ * Called when the infrastructure removes a queue (e.g. flowset
+ * is reconfigured). Nothing to do if we did not 'own' the queue,
+ * otherwise remove it from the right heap and adjust the sum
+ * of weights.
+ */
 static int
 wf2qp_free_queue(struct new_queue *q)
 {
@@ -290,13 +292,11 @@ wf2qp_free_queue(struct new_queue *q)
 	struct wf2qp_si *si = (struct wf2qp_si *)(q->_si + 1);
     
 	printf("%s called\n", __FUNCTION__);
-	/* If the queue was valid, decrement the sum value */
-	if (alg_fq->S == alg_fq->F + 1)
+	if (alg_fq->S >= alg_fq->F + 1)
 		return 0;	/* nothing to do, not in any heap */
-	/* decrement the sum of weights */
 	si->sum -= q->fs->fs.weight;
 
-	/* extract from the heap. Note that we may need to adjust V
+	/* extract from the heap. XXX TODO we may need to adjust V
 	 * to make sure the invariants hold.
 	 */
 	if (q->mq.head == NULL) {
@@ -319,6 +319,7 @@ static struct dn_sched wf2qp_desc = {
 	.name = "WF2Q+",
 	.flags = DN_MULTIQUEUE,
 
+	/* we need extra space in the si and the queue */
 	.si_datalen = sizeof(struct wf2qp_si),
 	.q_datalen = sizeof(struct wf2qp_queue),