Skip to contentSkip to conversation

: HFSC packet scheduler

PATCH New Patrick McHardy 1 participant 1 message Jan 29, 2004

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 : HFSC packet scheduler

This is the 2.4 version of HFSC. Besides HFSC, it adds the list_for_each_entry_continue macro from 2.6.

Best regards,
Patrick

Documentation/Configure.help +9 -0
diff -urN linux-2.4/Documentation/Configure.help linux-2.4-hfsc/Documentation/Configure.help
@@ -10647,6 +10647,15 @@
   whenever you want).  If you want to compile it as a module, say M
   here and read <file:Documentation/modules.txt>.
 
+CONFIG_NET_SCH_HFSC
+  Say Y here if you want to use the Hierarchical Fair Service Curve
+  (HFSC) packet scheduling algorithm for some of your network devices.
+
+  This code is also available as a module called sch_hfsc.o ( = code
+  which can be inserted in and removed from the running kernel
+  whenever you want).  If you want to compile it as a module, say M
+  here and read <file:Documentation/modules.txt>.
+
 CSZ packet scheduler
 CONFIG_NET_SCH_CSZ
   Say Y here if you want to use the Clark-Shenker-Zhang (CSZ) packet
include/linux/list.h +14 -0
diff -urN linux-2.4/include/linux/list.h linux-2.4-hfsc/include/linux/list.h
@@ -240,6 +240,20 @@
 	     &pos->member != (head); 					\
 	     pos = n, n = list_entry(n->member.next, typeof(*n), member))
 
+/**
+ * list_for_each_entry_continue -       iterate over list of given type
+ *                      continuing after existing point
+ * @pos:        the type * to use as a loop counter.
+ * @head:       the head for your list.
+ * @member:     the name of the list_struct within the struct.
+ */
+#define list_for_each_entry_continue(pos, head, member)			\
+	for (pos = list_entry(pos->member.next, typeof(*pos), member),	\
+		     prefetch(pos->member.next);			\
+	     &pos->member != (head);					\
+	     pos = list_entry(pos->member.next, typeof(*pos), member),	\
+		     prefetch(pos->member.next))
+
 #endif /* __KERNEL__ || _LVM_H_INCLUDE */
 
 #endif
include/linux/pkt_sched.h +31 -0
diff -urN linux-2.4/include/linux/pkt_sched.h linux-2.4-hfsc/include/linux/pkt_sched.h
@@ -290,6 +290,37 @@
 	__u32 ctokens;
 };
 
+/* HFSC section */
+
+struct tc_hfsc_qopt
+{
+	__u16	defcls;		/* default class */
+};
+
+struct tc_service_curve
+{
+	__u32	m1;		/* slope of the first segment in bps */
+	__u32	d;		/* x-projection of the first segment in us */
+	__u32	m2;		/* slope of the second segment in bps */
+};
+
+struct tc_hfsc_stats
+{
+	__u64	work;		/* total work done */
+	__u64	rtwork;		/* work done by real-time criteria */
+	__u32	period;		/* current period */
+	__u32	level;		/* class level in hierarchy */
+};
+
+enum
+{
+	TCA_HFSC_UNSPEC,
+	TCA_HFSC_RSC,
+	TCA_HFSC_FSC,
+	TCA_HFSC_USC,
+	TCA_HFSC_MAX = TCA_HFSC_USC
+};
+
 /* CBQ section */
 
 #define TC_CBQ_MAXPRIO		8
include/net/pkt_sched.h +3 -0
diff -urN linux-2.4/include/net/pkt_sched.h linux-2.4-hfsc/include/net/pkt_sched.h
@@ -198,6 +198,7 @@
 
 #define PSCHED_GET_TIME(stamp) do_gettimeofday(&(stamp))
 #define PSCHED_US2JIFFIE(usecs) (((usecs)+(1000000/HZ-1))/(1000000/HZ))
+#define PSCHED_JIFFIE2US(delay) ((delay)*(1000000/HZ))
 
 #define PSCHED_EXPORTLIST EXPORT_SYMBOL(psched_tod_diff);
 
@@ -246,6 +247,7 @@
 #endif
 
 #define PSCHED_US2JIFFIE(delay) (((delay)+(1<<PSCHED_JSCALE)-1)>>PSCHED_JSCALE)
+#define PSCHED_JIFFIE2US(delay) ((delay)<<PSCHED_JSCALE)
 
 #elif PSCHED_CLOCK_SOURCE == PSCHED_CPU
 
@@ -256,6 +258,7 @@
                             EXPORT_SYMBOL(psched_clock_scale);
 
 #define PSCHED_US2JIFFIE(delay) (((delay)+psched_clock_per_hz-1)/psched_clock_per_hz)
+#define PSCHED_JIFFIE2US(delay) ((delay)*psched_clock_per_hz)
 
 #ifdef CONFIG_X86_TSC
 
net/sched/Config.in +1 -1
diff -urN linux-2.4/net/sched/Config.in linux-2.4-hfsc/net/sched/Config.in
@@ -5,7 +5,7 @@
 tristate '  HTB packet scheduler' CONFIG_NET_SCH_HTB
 tristate '  CSZ packet scheduler' CONFIG_NET_SCH_CSZ
 #tristate '  H-PFQ packet scheduler' CONFIG_NET_SCH_HPFQ
-#tristate '  H-FSC packet scheduler' CONFIG_NET_SCH_HFCS
+tristate '  H-FSC packet scheduler' CONFIG_NET_SCH_HFSC
 if [ "$CONFIG_ATM" = "y" -o "$CONFIG_ATM" = "m" ]; then
    dep_tristate '  ATM pseudo-scheduler' CONFIG_NET_SCH_ATM $CONFIG_ATM
 fi
net/sched/sch_hfsc.c +1864 -0

1,864 lines not on this page · raw message