]> git.proxmox.com Git - mirror_iproute2.git/blame - man/man8/tc-sfq.8
update kernel headers based on net-next 3.21
[mirror_iproute2.git] / man / man8 / tc-sfq.8
CommitLineData
50c6f3ee 1.TH TC 8 "24 January 2012" "iproute2" "Linux"
985794ad
SH
2.SH NAME
3sfq \- Stochastic Fairness Queueing
4.SH SYNOPSIS
610b22a3 5.B tc qdisc ...
50c6f3ee 6.B [ divisor
610b22a3 7hashtablesize
50c6f3ee 8.B ] [ limit
610b22a3 9packets
50c6f3ee 10.B ] [ perturb
985794ad 11seconds
50c6f3ee 12.B ] [ quantum
985794ad 13bytes
50c6f3ee
ED
14.B ] [ flows
15number
16.B ] [ depth
17number
18.B ] [ headdrop
19.B ] [ redflowlimit
20bytes
21.B ] [ min
22bytes
23.B ] [ max
24bytes
25.B ] [ avpkt
26bytes
27.B ] [ burst
28packets
29.B ] [ probability
30P
31.B ] [ ecn
32.B ] [ harddrop ]
985794ad
SH
33.SH DESCRIPTION
34
35Stochastic Fairness Queueing is a classless queueing discipline available for
36traffic control with the
37.BR tc (8)
38command.
39
40SFQ does not shape traffic but only schedules the transmission of packets, based on 'flows'.
41The goal is to ensure fairness so that each flow is able to send data in turn, thus preventing
42any single flow from drowning out the rest.
43
44This may in fact have some effect in mitigating a Denial of Service attempt.
45
46SFQ is work-conserving and therefore always delivers a packet if it has one available.
47.SH ALGORITHM
610b22a3
FW
48On enqueueing, each packet is assigned to a hash bucket, based on the packets hash value.
49This hash value is either obtained from an external flow classifier (use
50.B
51tc filter
52to set them), or a default internal classifier if no external classifier has been configured.
53
54When the internal classifier is used, sfq uses
985794ad
SH
55.TP
56(i)
57Source address
58.TP
59(ii)
60Destination address
61.TP
62(iii)
50c6f3ee 63Source and Destination port
985794ad
SH
64.P
65If these are available. SFQ knows about ipv4 and ipv6 and also UDP, TCP and ESP.
66Packets with other protocols are hashed based on the 32bits representation of their
50c6f3ee 67destination and source. A flow corresponds mostly to a TCP/IP connection.
985794ad
SH
68
69Each of these buckets should represent a unique flow. Because multiple flows may
610b22a3 70get hashed to the same bucket, sfqs internal hashing algorithm may be perturbed at configurable
985794ad 71intervals so that the unfairness lasts only for a short while. Perturbation may
50c6f3ee
ED
72however cause some inadvertent packet reordering to occur. After linux-3.3, there is
73no packet reordering problem, but possible packet drops if rehashing hits one limit
74(number of flows or packets per flow)
985794ad
SH
75
76When dequeuing, each hashbucket with data is queried in a round robin fashion.
77
50c6f3ee 78Before linux-3.3, the compile time maximum length of the SFQ is 128 packets, which can be spread over
985794ad
SH
79at most 128 buckets of 1024 available. In case of overflow, tail-drop is performed
80on the fullest bucket, thus maintaining fairness.
81
50c6f3ee
ED
82After linux-3.3, maximum length of SFQ is 65535 packets, and divisor limit is 65536.
83In case of overflow, tail-drop is performed on the fullest bucket, unless headdrop was requested.
84
985794ad 85.SH PARAMETERS
610b22a3
FW
86.TP
87divisor
88Can be used to set a different hash table size, available from kernel 2.6.39 onwards.
89The specified divisor must be a power of two and cannot be larger than 65536.
90Default value: 1024.
985794ad 91.TP
60de6507 92limit
50c6f3ee
ED
93Upper limit of the SFQ. Can be used to reduce the default length of 127 packets.
94After linux-3.3, it can be raised.
95.TP
96depth
97Limit of packets per flow (after linux-3.3). Default to 127 and can be lowered.
60de6507 98.TP
985794ad
SH
99perturb
100Interval in seconds for queue algorithm perturbation. Defaults to 0, which means that
101no perturbation occurs. Do not set too low for each perturbation may cause some packet
50c6f3ee 102reordering or losses. Advised value: 60
610b22a3 103This value has no effect when external flow classification is used.
50c6f3ee 104Its better to increase divisor value to lower risk of hash collisions.
985794ad
SH
105.TP
106quantum
107Amount of bytes a flow is allowed to dequeue during a round of the round robin process.
108Defaults to the MTU of the interface which is also the advised value and the minimum value.
50c6f3ee
ED
109.TP
110flows
111After linux-3.3, it is possible to change the default limit of flows.
112Default value is 127
113.TP
114headdrop
115Default SFQ behavior is to perform tail-drop of packets from a flow.
116You can ask a headdrop instead, as this is known to provide a better feedback for TCP flows.
117.TP
118redflowlimit
119Configure the optional RED module on top of each SFQ flow.
120Random Early Detection principle is to perform packet marks or drops in a probabilistic way.
121(man tc-red for details about RED)
122.nf
123redflowlimit configures the hard limit on the real (not average) queue size per SFQ flow in bytes.
124.fi
125.TP
126min
127Average queue size at which marking becomes a possibility. Defaults to
128.B max
129/3
130.TP
131max
132At this average queue size, the marking probability is maximal. Defaults to
133.B redflowlimit
134/4
135.TP
136probability
137Maximum probability for marking, specified as a floating point number from 0.0 to 1.0. Default value is 0.02
138.TP
139avpkt
140Specified in bytes. Used with burst to determine the time constant for average queue size calculations. Default value is 1000
141.TP
142burst
143Used for determining how fast the average queue size is influenced by the real queue size.
144.nf
145Default value is :
146.B (2 * min + max) / (3 * avpkt)
147.fi
148.TP
149ecn
150RED can either 'mark' or 'drop'. Explicit Congestion
151Notification allows RED to notify remote hosts that their rate exceeds the
152amount of bandwidth available. Non-ECN capable hosts can only be notified by
153dropping a packet. If this parameter is specified, packets which indicate
154that their hosts honor ECN will only be marked and not dropped, unless the
155queue size hits
156.B depth
157packets.
158.TP
159harddrop
160If average flow queue size is above
161.B max
162bytes, this parameter forces a drop instead of ecn marking.
985794ad
SH
163.SH EXAMPLE & USAGE
164
165To attach to device ppp0:
166.P
50c6f3ee 167# tc qdisc add dev ppp0 root sfq
985794ad
SH
168.P
169Please note that SFQ, like all non-shaping (work-conserving) qdiscs, is only useful
170if it owns the queue.
171This is the case when the link speed equals the actually available bandwidth. This holds
172for regular phone modems, ISDN connections and direct non-switched ethernet links.
173.P
174Most often, cable modems and DSL devices do not fall into this category. The same holds
175for when connected to a switch and trying to send data to a congested segment also
176connected to the switch.
177.P
178In this case, the effective queue does not reside within Linux and is therefore not
179available for scheduling.
180.P
181Embed SFQ in a classful qdisc to make sure it owns the queue.
182
610b22a3
FW
183It is possible to use external classifiers with sfq, for example to hash traffic based only
184on source/destination ip addresses:
185.P
186# tc filter add ... flow hash keys src,dst perturb 30 divisor 1024
50c6f3ee 187.P
610b22a3
FW
188Note that the given divisor should match the one used by sfq. If you have
189changed the sfq default of 1024, use the same value for the flow hash filter, too.
190
50c6f3ee
ED
191.P
192Example of sfq with optional RED mode :
193.P
194# tc qdisc add dev eth0 parent 1:1 handle 10: sfq limit 3000 flows 512 divisor 16384
195 redflowlimit 100000 min 8000 max 60000 probability 0.20 ecn headdrop
610b22a3 196
985794ad
SH
197.SH SOURCE
198.TP
199o
200Paul E. McKenney "Stochastic Fairness Queuing",
201IEEE INFOCOMM'90 Proceedings, San Francisco, 1990.
202
203.TP
204o
205Paul E. McKenney "Stochastic Fairness Queuing",
206"Interworking: Research and Experience", v.2, 1991, p.113-131.
207
208.TP
209o
210See also:
211M. Shreedhar and George Varghese "Efficient Fair
212Queuing using Deficit Round Robin", Proc. SIGCOMM 95.
213
214.SH SEE ALSO
50c6f3ee
ED
215.BR tc (8),
216.BR tc-red (8)
985794ad 217
50c6f3ee
ED
218.SH AUTHORS
219Alexey N. Kuznetsov, <kuznet@ms2.inr.ac.ru>,
220Eric Dumazet <eric.dumazet@gmail.com>.
221.P
222This manpage maintained by bert hubert <ahu@ds9a.nl>
985794ad
SH
223
224