svn commit: r202079 - user/luigi/ipfw3-head/sys/netinet/ipfw

Luigi Rizzo luigi at FreeBSD.org
Mon Jan 11 11:09:04 UTC 2010


Author: luigi
Date: Mon Jan 11 11:09:03 2010
New Revision: 202079
URL: http://svn.freebsd.org/changeset/base/202079

Log:
  documentation update

Modified:
  user/luigi/ipfw3-head/sys/netinet/ipfw/dummynet.txt

Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/dummynet.txt
==============================================================================
--- user/luigi/ipfw3-head/sys/netinet/ipfw/dummynet.txt	Mon Jan 11 10:49:34 2010	(r202078)
+++ user/luigi/ipfw3-head/sys/netinet/ipfw/dummynet.txt	Mon Jan 11 11:09:03 2010	(r202079)
@@ -47,7 +47,7 @@ association of flowsets and schedulers i
 "sched 10" represents one or more scheduler instances,
 selected through a mask on the 5-tuple itself.
 
-	ipfw sched 20 config sched_mask yyy ...
+	ipfw sched 20 config type FIFO sched_mask yyy ...
 
 There are in fact two masks applied to each packet:
 + the "sched_mask" sends packets arriving to a scheduler_id to
@@ -57,69 +57,102 @@ There are in fact two masks applied to e
 
 As an example, we can have
 	ipfw queue 5 config sched 10 flow_mask src-ip 0x000000ff
-	ipfw sched 10 config sched_mask src-ip 0xffffff00
+	ipfw sched 10 config type WF2Q+ sched_mask src-ip 0xffffff00
 
 means that sched 10 will have one instance per /24 source subnet,
 and within that, each individual source will be a flow.
 	
 Internal structure
 -----------------
-Dummynet-related data is split into five main strucs:
-
-- struct new_pipe: contains data about the physical link such
-  as bandwith, delay, fields to simulate a delay profile and so on.
-
-- struct new_fs: describes a flowset. It contains template values for the
-  specified flowset, and a pointer (alg_fs) to an opaque struct that
-  can contain per-flowset scheduler-specific parameters, such as
-  weight, priorities, slot sizes and the like.
-  It also contains a flow_mask to allow to create more queues
-  depending of the flow id of the packet. All queues are stored into the
-  scheduler instance.
-
-- struct new_sch: it acts as a template for the scheduler used. It contains
-  enqueue and dequeue packet functions, a configure function for
-  possible global parameters, and two functions to create and destroy
-  the scheduler instance.
-  A scheduler can have more scheduler instance: a field sched_mask is
-  used to know how many instance could exist for this scheduler.
-  This struct also contains an hash table of queues pointers
-
-- struct new_sch_inst: it is the struct that represents the instance of the
-  scheduler. It has a pointer to the template, and some general parameter
-  and status variable relative to the single instance.
-  It also contains all queues associated with this instance and the delay line,
-  which is a list of packets that will be sent after a certain amount of time.
-
-- struct new_queue: it contains all data belonging to a single queue, as
-  total bytes, number of packets dropped, list of packet...
-  It can have some extra data about the scheduling algorithm.
-  XXX this is one instance of a flowset ?
-
-
-                                +----------------+
-      +--------+   ptr_sched    |                |         +----------+
-      | new_fs |--------------->|     new_sch    |-------->| new_pipe |
-      `--------'                |                |         +----------+
-          |                     +----------------+
-          |                             |       ^
-          |                             V        \___
-          |                      +------------+      |
-          |                      | hash table |      |
-          |                      |    (m1)    |      |
-          |                      +------------+      |
-          |                         |  ..... \_      |
-   -----------+     ...             v          \     |
-  | new_queue |<-----|          --------------  |    |
+Dummynet-related data is split into several data structures,
+part of them constituting the userland-kernel API, and others
+specific to the kernel.
+
+USERLAND-KERNEL API
+
+    struct new_pipe:
+	contains data about the physical link such as
+	bandwith, delay, burst size;
+
+    struct new_profile:
+	fields to simulate a delay profile
+
+    struct new_sch:
+	defines a scheduler (and a link attached to it).
+	Parameters include scheduler type, sched_mask, number of
+	buckets, and possibly other scheduler-specific parameters,
+
+    struct new_fs:
+	describes a flowset, i.e. a template for queues.
+	Main parameters are the scheduler we attach to, a flow_mask,
+	buckets, queue size, plr, weight, and other scheduler-specific
+	parameters.
+
+KERNEL REPRESENTATION
+
+    struct new_queue
+	individual queue of packets, which are created by a
+	flowset and attached to a scheduler instance.
+	A new_queue has a pointer to the new_fsk (which in turn counts
+	how many queues point to it), a pointer to the
+	new_sch_inst it attaches to, and is linked in a list
+	of queues attached to the new_sch_inst
+	CREATE: done on packet arrivals when a flow matches a flowset.
+	DELETE: done only when deleting the parent new_sch_inst
+
+    struct new_fsk
+	includes a new_fs; a pointer to the new_schk; a link field
+	for the list of new_fsk attached to the same scheduler;
+	a refcount for the number of queues pointing to it;
+	The new_fsk is in a hash table when it is attached to a
+	scheduler, or in the fsunlinked list when shutting down
+	or no scheduler is active.
+	CREATE: done on configuration commands.
+	DELETE: configuration commands mark the flowset as DN_DELETE,
+		and move it to fsunlinked. Then as queue are drained,
+		they are deleted and when the last one goes away,
+		also the flowset goes away.
+
+    struct new_sch_inst
+	a scheduler instance, created from a new_schk applying sched_mask.
+	Contains a delay line, a list of queues, and a reference to the
+	parent. Both new_sch_inst and its delay line can be in the
+	system_heap if they have events to be processed.
+	CREATE: created from a new_schk applying sched_mask
+	DELETE: configuration command delete a scheduler which in turn
+		sweeps the hash table of instances, deletes all queues
+		and then the instance.
+
+    struct new_schk
+	includes new_sch, new_pipe, a pointer to new_profile,
+	a hash table of new_sch_inst, a list of new_fsk
+	attached to it.
+	CREATE: configuration command. If there are flowsets that
+		refer to this number, they are attached and moved
+		to the hash table
+	DELETE: manual, see new_sch_inst
+
+
+                                +--------------+
+  +------------+   ptr_sched    |  fsk_list    |
+  |  NEW_FSK   |--------------->|   NEW_SCHK   |<----.
+  |  refcnt    |                |   new_pipe   |     |
+  |  sch_chain |                +--------------+     |
+  +------------+                | hash table   |     |
+          ^                     |    (m1)      |     |
+          |                     +--------------+     |
+          |                        |  .....   \      |
+   -----------+     ...            v           \     |
+  | NEW_QUEUE |<-----|          --------------  `    |
   +-----------+      |         |              | |    |
        ....          |         | new_sch_inst | |    |
    -----------+      |         |              | |    |
-  | new_queue |<-----|          --------------  |    |
+  | NEW_QUEUE |<-----|          --------------  |    |
   +-----------+      |                          v    |
       |       .--------------.       --------------  |
       |       |  hash table  |      |              | |
-      |       |     (m2) +   |<-----| new_sch_inst |_/
-      |       | new_sch_inst |      |              |
+      |       |     (m2) +   |<-----| NEW_SCH_INST |_|
+      |       | new_sch_inst |      |  ql_head     |
       |       `--------------'       --------------
       |                                 ^
       |                                 |
@@ -128,11 +161,8 @@ Dummynet-related data is split into five
 Note that the hash table m2 is not mandatory, a scheduler instance
 can use its own struct to store its queues
 
-Three global data structures (hash tables) contain all
-pipes, schedulers and flowsets.
-- pipehash[x]:      contains all pipes in the system
-	not needed to be efficient - we never do a lookup
-	in a critical section
+The following global data structures contain all
+schedulers and flowsets.
 
 - schedulerhash[x]: contains all scheduler templates in the system
 	this needs to be a hash table because we may have to do


More information about the svn-src-user mailing list