version 2, including all changes.
.
Rev |
Author |
# |
Line |
1 |
perry |
1 |
TC |
|
|
2 |
!!!TC |
|
|
3 |
NAME |
|
|
4 |
SYNOPSIS |
|
|
5 |
DESCRIPTION |
|
|
6 |
ALGORITHM |
|
|
7 |
PARAMETERS |
|
|
8 |
EXAMPLE |
|
|
9 |
SOURCE |
|
|
10 |
SEE ALSO |
|
|
11 |
AUTHOR |
|
|
12 |
---- |
|
|
13 |
!!NAME |
|
|
14 |
|
|
|
15 |
|
|
|
16 |
sfq - Stochastic Fairness Queueing |
|
|
17 |
!!SYNOPSIS |
|
|
18 |
|
|
|
19 |
|
|
|
20 |
__tc qdisc ... perturb__ seconds __quantum__ |
|
|
21 |
bytes |
|
|
22 |
!!DESCRIPTION |
|
|
23 |
|
|
|
24 |
|
|
|
25 |
Stochastic Fairness Queueing is a classless queueing |
|
|
26 |
discipline available for traffic control with the |
|
|
27 |
tc(8) command. |
|
|
28 |
|
|
|
29 |
|
|
|
30 |
SFQ does not shape traffic but only schedules the |
|
|
31 |
transmission of packets, based on 'flows'. The goal is to |
|
|
32 |
ensure fairness so that each flow is able to send data in |
|
|
33 |
turn, thus preventing any single flow from drowning out the |
|
|
34 |
rest. |
|
|
35 |
|
|
|
36 |
|
|
|
37 |
This may in fact have some effect in mitigating a Denial of |
|
|
38 |
Service attempt. |
|
|
39 |
|
|
|
40 |
|
|
|
41 |
SFQ is work-conserving and therefore always delivers a |
|
|
42 |
packet if it has one available. |
|
|
43 |
!!ALGORITHM |
|
|
44 |
|
|
|
45 |
|
|
|
46 |
On enqueueing, each packet is assigned to a hash bucket, |
|
|
47 |
based on |
|
|
48 |
|
|
|
49 |
|
|
|
50 |
(i) |
|
|
51 |
|
|
|
52 |
|
|
|
53 |
Source address |
|
|
54 |
|
|
|
55 |
|
|
|
56 |
(ii) |
|
|
57 |
|
|
|
58 |
|
|
|
59 |
Destination address |
|
|
60 |
|
|
|
61 |
|
|
|
62 |
(iii) |
|
|
63 |
|
|
|
64 |
|
|
|
65 |
Source port |
|
|
66 |
|
|
|
67 |
|
|
|
68 |
If these are available. SFQ knows about ipv4 and ipv6 and |
|
|
69 |
also UDP, TCP and ESP. Packets with other protocols are |
|
|
70 |
hashed based on the 32bits representation of their |
|
|
71 |
destination and the socket they belong to. A flow |
|
|
72 |
corresponds mostly to a TCP/IP connection. |
|
|
73 |
|
|
|
74 |
|
|
|
75 |
Each of these buckets should represent a unique flow. |
|
|
76 |
Because multiple flows may get hashed to the same bucket, |
|
|
77 |
the hashing algorithm is perturbed at configurable intervals |
|
|
78 |
so that the unfairness lasts only for a short while. |
|
|
79 |
Perturbation may however cause some inadvertent packet |
|
|
80 |
reordering to occur. |
|
|
81 |
|
|
|
82 |
|
|
|
83 |
When dequeuing, each hashbucket with data is queried in a |
|
|
84 |
round robin fashion. |
|
|
85 |
|
|
|
86 |
|
|
|
87 |
The compile time maximum length of the SFQ is 128 packets, |
|
|
88 |
which can be spread over at most 128 buckets of 1024 |
|
|
89 |
available. In case of overflow, tail-drop is performed on |
|
|
90 |
the fullest bucket, thus maintaining fairness. |
|
|
91 |
!!PARAMETERS |
|
|
92 |
|
|
|
93 |
|
|
|
94 |
perturb |
|
|
95 |
|
|
|
96 |
|
|
|
97 |
Interval in seconds for queue algorithm perturbation. |
|
|
98 |
Defaults to 0, which means that no perturbation occurs. Do |
|
|
99 |
not set too low for each perturbation may cause some packet |
|
|
100 |
reordering. Advised value: 10 |
|
|
101 |
|
|
|
102 |
|
|
|
103 |
quantum |
|
|
104 |
|
|
|
105 |
|
|
|
106 |
Amount of bytes a flow is allowed to dequeue during a round |
|
|
107 |
of the round robin process. Defaults to the MTU of the |
|
|
108 |
interface which is also the advised value and the minimum |
|
|
109 |
value. |
|
|
110 |
!!EXAMPLE !! |
|
|
111 |
|
|
|
112 |
|
|
|
113 |
To attach to device ppp0: |
|
|
114 |
|
|
|
115 |
|
|
|
116 |
# tc qdisc add dev ppp0 root sfq perturb 10 |
|
|
117 |
|
|
|
118 |
|
|
|
119 |
Please note that SFQ, like all non-shaping (work-conserving) |
|
|
120 |
qdiscs, is only useful if it owns the queue. This is the |
|
|
121 |
case when the link speed equals the actually available |
|
|
122 |
bandwidth. This holds for regular phone modems, ISDN |
|
|
123 |
connections and direct non-switched ethernet |
|
|
124 |
links. |
|
|
125 |
|
|
|
126 |
|
|
|
127 |
Most often, cable modems and DSL devices do not fall into |
|
|
128 |
this category. The same holds for when connected to a switch |
|
|
129 |
and trying to send data to a congested segment also |
|
|
130 |
connected to the switch. |
|
|
131 |
|
|
|
132 |
|
|
|
133 |
In this case, the effective queue does not reside within |
|
|
134 |
Linux and is therefore not available for |
|
|
135 |
scheduling. |
|
|
136 |
|
|
|
137 |
|
|
|
138 |
Embed SFQ in a classful qdisc to make sure it owns the |
|
|
139 |
queue. |
|
|
140 |
!!SOURCE |
|
|
141 |
|
|
|
142 |
|
|
|
143 |
o |
|
|
144 |
|
|
|
145 |
|
2 |
perry |
146 |
Paul E. !McKenney |
1 |
perry |
147 |
|
|
|
148 |
|
|
|
149 |
o |
|
|
150 |
|
|
|
151 |
|
2 |
perry |
152 |
Paul E. !McKenney |
1 |
perry |
153 |
|
|
|
154 |
|
|
|
155 |
o |
|
|
156 |
|
|
|
157 |
|
|
|
158 |
See also: M. Shreedhar and George Varghese |
|
|
159 |
!!SEE ALSO |
|
|
160 |
|
|
|
161 |
|
|
|
162 |
tc(8) |
|
|
163 |
!!AUTHOR |
|
|
164 |
|
|
|
165 |
|
|
|
166 |
Alexey N. Kuznetsov, |
|
|
167 |
---- |