Skip to content

Commit e13e02a

Browse files
Eric Dumazetdavem330
authored andcommitted
net_sched: SFB flow scheduler
This is the Stochastic Fair Blue scheduler, based on work from : W. Feng, D. Kandlur, D. Saha, K. Shin. Blue: A New Class of Active Queue Management Algorithms. U. Michigan CSE-TR-387-99, April 1999. http://www.thefengs.com/wuchang/blue/CSE-TR-387-99.pdf This implementation is based on work done by Juliusz Chroboczek General SFB algorithm can be found in figure 14, page 15: B[l][n] : L x N array of bins (L levels, N bins per level) enqueue() Calculate hash function values h{0}, h{1}, .. h{L-1} Update bins at each level for i = 0 to L - 1 if (B[i][h{i}].qlen > bin_size) B[i][h{i}].p_mark += p_increment; else if (B[i][h{i}].qlen == 0) B[i][h{i}].p_mark -= p_decrement; p_min = min(B[0][h{0}].p_mark ... B[L-1][h{L-1}].p_mark); if (p_min == 1.0) ratelimit(); else mark/drop with probabilty p_min; I did the adaptation of Juliusz code to meet current kernel standards, and various changes to address previous comments : http://thread.gmane.org/gmane.linux.network/90225 http://thread.gmane.org/gmane.linux.network/90375 Default flow classifier is the rxhash introduced by RPS in 2.6.35, but we can use an external flow classifier if wanted. tc qdisc add dev $DEV parent 1:11 handle 11: \ est 0.5sec 2sec sfb limit 128 tc filter add dev $DEV protocol ip parent 11: handle 3 \ flow hash keys dst divisor 1024 Notes: 1) SFB default child qdisc is pfifo_fast. It can be changed by another qdisc but a child qdisc MUST not drop a packet previously queued. This is because SFB needs to handle a dequeued packet in order to maintain its virtual queue states. pfifo_head_drop or CHOKe should not be used. 2) ECN is enabled by default, unlike RED/CHOKe/GRED With help from Patrick McHardy & Andi Kleen Signed-off-by: Eric Dumazet <[email protected]> CC: Juliusz Chroboczek <[email protected]> CC: Stephen Hemminger <[email protected]> CC: Patrick McHardy <[email protected]> CC: Andi Kleen <[email protected]> CC: John W. Linville <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent dee9f4b commit e13e02a

File tree

4 files changed

+760
-0
lines changed

4 files changed

+760
-0
lines changed

include/linux/pkt_sched.h

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,4 +522,43 @@ struct tc_mqprio_qopt {
522522
__u16 offset[TC_QOPT_MAX_QUEUE];
523523
};
524524

525+
/* SFB */
526+
527+
enum {
528+
TCA_SFB_UNSPEC,
529+
TCA_SFB_PARMS,
530+
__TCA_SFB_MAX,
531+
};
532+
533+
#define TCA_SFB_MAX (__TCA_SFB_MAX - 1)
534+
535+
/*
536+
* Note: increment, decrement are Q0.16 fixed-point values.
537+
*/
538+
struct tc_sfb_qopt {
539+
__u32 rehash_interval; /* delay between hash move, in ms */
540+
__u32 warmup_time; /* double buffering warmup time in ms (warmup_time < rehash_interval) */
541+
__u32 max; /* max len of qlen_min */
542+
__u32 bin_size; /* maximum queue length per bin */
543+
__u32 increment; /* probability increment, (d1 in Blue) */
544+
__u32 decrement; /* probability decrement, (d2 in Blue) */
545+
__u32 limit; /* max SFB queue length */
546+
__u32 penalty_rate; /* inelastic flows are rate limited to 'rate' pps */
547+
__u32 penalty_burst;
548+
};
549+
550+
struct tc_sfb_xstats {
551+
__u32 earlydrop;
552+
__u32 penaltydrop;
553+
__u32 bucketdrop;
554+
__u32 queuedrop;
555+
__u32 childdrop; /* drops in child qdisc */
556+
__u32 marked;
557+
__u32 maxqlen;
558+
__u32 maxprob;
559+
__u32 avgprob;
560+
};
561+
562+
#define SFB_MAX_PROB 0xFFFF
563+
525564
#endif

net/sched/Kconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,17 @@ config NET_SCH_RED
126126
To compile this code as a module, choose M here: the
127127
module will be called sch_red.
128128

129+
config NET_SCH_SFB
130+
tristate "Stochastic Fair Blue (SFB)"
131+
---help---
132+
Say Y here if you want to use the Stochastic Fair Blue (SFB)
133+
packet scheduling algorithm.
134+
135+
See the top of <file:net/sched/sch_sfb.c> for more details.
136+
137+
To compile this code as a module, choose M here: the
138+
module will be called sch_sfb.
139+
129140
config NET_SCH_SFQ
130141
tristate "Stochastic Fairness Queueing (SFQ)"
131142
---help---

net/sched/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ obj-$(CONFIG_NET_SCH_RED) += sch_red.o
2424
obj-$(CONFIG_NET_SCH_GRED) += sch_gred.o
2525
obj-$(CONFIG_NET_SCH_INGRESS) += sch_ingress.o
2626
obj-$(CONFIG_NET_SCH_DSMARK) += sch_dsmark.o
27+
obj-$(CONFIG_NET_SCH_SFB) += sch_sfb.o
2728
obj-$(CONFIG_NET_SCH_SFQ) += sch_sfq.o
2829
obj-$(CONFIG_NET_SCH_TBF) += sch_tbf.o
2930
obj-$(CONFIG_NET_SCH_TEQL) += sch_teql.o

0 commit comments

Comments
 (0)