Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Jan 2010 10:09:19 +0000 (UTC)
From:      Luigi Rizzo <luigi@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r202738 - user/luigi/ipfw3-head/sys/netinet/ipfw
Message-ID:  <201001211009.o0LA9JTs092134@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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),
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201001211009.o0LA9JTs092134>