Skip to contentSkip to conversation

Some work to extend SFQ to be more configurable

LARTC Alexander Atanasov 1 participant 1 message Jun 4, 2002

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

Hi there!

Quoted 6 lines · Martin Devera

This is often discussed and is on "TODO" for someone ;)

Quoted 4 lines

SFQ is connection oriented. right?
Would be a good idea to make the queues per ip rather than per tcp flow? So there would be per host fairnes.

I've done some in this direction , probably needs more work, and
it's poorly tested - expect b00ms ;)

This adds a new qdisc for now - esfq which is a 100% clone of
original sfq.
- You can set all sfq parameters: hash table size, queue depths,
queue limits.
- You can choose from 3 hash types: original(classic), dst ip, src
ip.
Things to consider: perturbation with dst and src hashes is not
good IMHO, you can try with perturb 0 if it couses trouble.

Please, see the attached files.

Plaing with it gives interesting results:
higher depth -> makes flows equal slower
small depth -> makes flows equal faster
limit kills big delays when set at about 75-85% of depth.

Needs testings and mesurements - that's why i made it
separate qdisc and not a patch over sfq, i wanted to compare both.

Any feedback good or bad is welcome.

Signature · 2 lines
have fun,
alex
	You need:
		iproute2-2.2.4-now-ss001007.tar.gz
		linux-2.4.18.tar.gz
	
	This may work with next versions too. 

	Example Step by Step install
	------------------------------------------------------------------
	Install kernel:
	tar zxvf linux-2.4.18.tar.gz
	cd linux
	cat linux-2.4.18-esfq.diff | patch -p1
	make menuconfig

	Now you have it in:
	Networking options  ---> QoS and/or fair queueing ---> ESFQ queue

	Configure and install kernel
	make dep clean bzImage modules_install
	cp System.map /boot/
	cp arch/i386/boot/bzImage /boot/bzImage
	
	Edit lilo.conf and add your new kernel.

	------------------------------------------------------------------
	Install iproute:
	tar zxvf iproute2-2.2.4-now-ss001007.tar.gz
	cd iproute2
	cat iproute2-2.2.4-now-ss001007-esfq.diff | patch -p1
	make

/* Note: If you get an error in lib/ll_proto.c comment _PF(ECHO,echo) */
cp tc/tc your_favourite_iproute_path/tc
cp ip/ip your_favourite_iproute_path/ip

------------------------------------------------------------------

Usage: ... esfq [ perturb SECS ] [ quantum BYTES ] [ depth FLOWS ] [ divisor HASHBITS ] [ limit PKTS ] [ hash HASHTYPE]

Where:
HASHTYPE := { classic | src | dst }

Examples:
tc qdisc add dev eth0 root esfq limit 128 depth 128 divisor 10 \
hash classic perturb 15

Setups a classic SFQ.

tc qdisc add dev eth0 root esfq limit 64 depth 64 divisor 11 \
hash dst

Setups a dst SFQ with limit and depth of 64 packets and 11bits (2048 rows) hash table. 1:1 with sch_sfq.

You can experiment with the values as you like to find the best which sfq can do for you.

More can be found in:
linux/net/sched/sch_sfq.c
linux/net/sched/sch_esfq.c

Limits:
- limit must be less than depth
- divisor must be less than 15

tc/Makefile +1 -0
diff -urN iproute2.orig/tc/Makefile iproute2/tc/Makefile
@@ -5,6 +5,7 @@
 TCMODULES :=
 TCMODULES += q_fifo.o
 TCMODULES += q_sfq.o
+TCMODULES += q_esfq.o
 TCMODULES += q_red.o
 TCMODULES += q_prio.o
 TCMODULES += q_tbf.o
tc/q_esfq.c +169 -0

169 lines not on this page · raw message

include/linux/pkt_sched.h renamed from include/linux/pkt_sched.h.orig +10 -0
@@ -157,6 +157,13 @@
 
 /* SFQ section */
 
+enum
+{
+	TCA_SFQ_HASH_CLASSIC,
+	TCA_SFQ_HASH_DST,
+	TCA_SFQ_HASH_SRC,
+};
+
 struct tc_sfq_qopt
 {
 	unsigned	quantum;	/* Bytes per round allocated to flow */
@@ -164,6 +171,7 @@
 	__u32		limit;		/* Maximal packets in queue */
 	unsigned	divisor;	/* Hash divisor  */
 	unsigned	flows;		/* Maximal number of flows  */
+	unsigned	hash_kind;	/* Hash function to use for flow identification */
 };
 
 /*
@@ -173,6 +181,8 @@
  *
  *	The only reason for this is efficiency, it is possible
  *	to change these parameters in compile time.
+ *	
+ *	If you need to play with this values use esfq.
  */
 
 /* RED section */
net/ipv4/netfilter/ipchains_core.c renamed from net/ipv4/netfilter/ipchains_core.c.orig +1 -0
@@ -723,6 +723,7 @@
 						      src_port, dst_port,
 						      count, tcpsyn)) {
 					ret = FW_BLOCK;
+					cleanup(chain, 0, slot);
 					goto out;
 				}
 				break;
net/sched/Makefile renamed from net/sched/Makefile.orig +1 -0
@@ -17,6 +17,7 @@
 obj-$(CONFIG_NET_SCH_HPFQ)	+= sch_hpfq.o
 obj-$(CONFIG_NET_SCH_HFSC)	+= sch_hfsc.o
 obj-$(CONFIG_NET_SCH_SFQ)	+= sch_sfq.o
+obj-$(CONFIG_NET_SCH_ESFQ)	+= sch_esfq.o
 obj-$(CONFIG_NET_SCH_RED)	+= sch_red.o
 obj-$(CONFIG_NET_SCH_TBF)	+= sch_tbf.o
 obj-$(CONFIG_NET_SCH_PRIO)	+= sch_prio.o
net/sched/Config.in renamed from net/sched/Config.in.orig +1 -0
@@ -11,6 +11,7 @@
 tristate '  The simplest PRIO pseudoscheduler' CONFIG_NET_SCH_PRIO
 tristate '  RED queue' CONFIG_NET_SCH_RED
 tristate '  SFQ queue' CONFIG_NET_SCH_SFQ
+tristate '  ESFQ queue' CONFIG_NET_SCH_ESFQ
 tristate '  TEQL queue' CONFIG_NET_SCH_TEQL
 tristate '  TBF queue' CONFIG_NET_SCH_TBF
 tristate '  GRED queue' CONFIG_NET_SCH_GRED
Documentation/Configure.help renamed from Documentation/Configure.help.orig +18 -0
@@ -9433,6 +9433,24 @@
   whenever you want). If you want to compile it as a module, say M
   here and read <file:Documentation/modules.txt>.
 
+ESFQ queue
+CONFIG_NET_SCH_ESFQ
+  Say Y here if you want to use the Stochastic Fairness Queueing (SFQ)
+  packet scheduling algorithm for some of your network devices or as a
+  leaf discipline for the CBQ scheduling algorithm (see the top of
+  <file:net/sched/sch_esfq.c> for details and references about the SFQ
+  algorithm).
+
+  This is an enchanced SFQ version which allows you to control the
+  hardcoded values in the SFQ scheduler: queue depth, hash table size,
+  queues limit. Also adds control to the hash function used to identify
+  packet flows. Hash by src or dst ip and original sfq hash.
+
+  This code is also available as a module called sch_esfq.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>.
+
 TEQL queue
 CONFIG_NET_SCH_TEQL
   Say Y here if you want to use the True Link Equalizer (TLE) packet
net/sched/sch_esfq.c new file +591 -0

591 lines not on this page · raw message