291 lines
9.0 KiB
HTML
291 lines
9.0 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of TC</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>TC</H1>
|
|
Section: Linux (8)<BR>Updated: 24 January 2012<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
sfq - Stochastic Fairness Queueing
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<B>tc qdisc ...</B>
|
|
|
|
<B>[ divisor</B>
|
|
|
|
hashtablesize
|
|
<B>] [ limit</B>
|
|
|
|
packets
|
|
<B>] [ perturb</B>
|
|
|
|
seconds
|
|
<B>] [ quantum</B>
|
|
|
|
bytes
|
|
<B>] [ flows</B>
|
|
|
|
number
|
|
<B>] [ depth</B>
|
|
|
|
number
|
|
<B>] [ headdrop</B>
|
|
|
|
<B>] [ redflowlimit</B>
|
|
|
|
bytes
|
|
<B>] [ min</B>
|
|
|
|
bytes
|
|
<B>] [ max</B>
|
|
|
|
bytes
|
|
<B>] [ avpkt</B>
|
|
|
|
bytes
|
|
<B>] [ burst</B>
|
|
|
|
packets
|
|
<B>] [ probability</B>
|
|
|
|
P
|
|
<B>] [ ecn</B>
|
|
|
|
<B>] [ harddrop ]</B>
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
<P>
|
|
Stochastic Fairness Queueing is a classless queueing discipline available for
|
|
traffic control with the
|
|
<B><A HREF="/cgi-bin/man/man2html?8+tc">tc</A></B>(8)
|
|
|
|
command.
|
|
<P>
|
|
SFQ does not shape traffic but only schedules the transmission of packets, based on 'flows'.
|
|
The goal is to ensure fairness so that each flow is able to send data in turn, thus preventing
|
|
any single flow from drowning out the rest.
|
|
<P>
|
|
This may in fact have some effect in mitigating a Denial of Service attempt.
|
|
<P>
|
|
SFQ is work-conserving and therefore always delivers a packet if it has one available.
|
|
<A NAME="lbAE"> </A>
|
|
<H2>ALGORITHM</H2>
|
|
|
|
On enqueueing, each packet is assigned to a hash bucket, based on the packets hash value.
|
|
This hash value is either obtained from an external flow classifier (use
|
|
<B>tc filter</B>
|
|
|
|
to set them), or a default internal classifier if no external classifier has been configured.
|
|
<P>
|
|
When the internal classifier is used, sfq uses
|
|
<DL COMPACT>
|
|
<DT id="1">(i)<DD>
|
|
Source address
|
|
<DT id="2">(ii)<DD>
|
|
Destination address
|
|
<DT id="3">(iii)<DD>
|
|
Source and Destination port
|
|
</DL>
|
|
<P>
|
|
|
|
If these are available. SFQ knows about ipv4 and ipv6 and also UDP, TCP and ESP.
|
|
Packets with other protocols are hashed based on the 32bits representation of their
|
|
destination and source. A flow corresponds mostly to a TCP/IP connection.
|
|
<P>
|
|
Each of these buckets should represent a unique flow. Because multiple flows may
|
|
get hashed to the same bucket, sfqs internal hashing algorithm may be perturbed at configurable
|
|
intervals so that the unfairness lasts only for a short while. Perturbation may
|
|
however cause some inadvertent packet reordering to occur. After linux-3.3, there is
|
|
no packet reordering problem, but possible packet drops if rehashing hits one limit
|
|
(number of flows or packets per flow)
|
|
<P>
|
|
When dequeuing, each hashbucket with data is queried in a round robin fashion.
|
|
<P>
|
|
Before linux-3.3, the compile time maximum length of the SFQ is 128 packets, which can be spread over
|
|
at most 128 buckets of 1024 available. In case of overflow, tail-drop is performed
|
|
on the fullest bucket, thus maintaining fairness.
|
|
<P>
|
|
After linux-3.3, maximum length of SFQ is 65535 packets, and divisor limit is 65536.
|
|
In case of overflow, tail-drop is performed on the fullest bucket, unless headdrop was requested.
|
|
<P>
|
|
<A NAME="lbAF"> </A>
|
|
<H2>PARAMETERS</H2>
|
|
|
|
<DL COMPACT>
|
|
<DT id="4">divisor<DD>
|
|
Can be used to set a different hash table size, available from kernel 2.6.39 onwards.
|
|
The specified divisor must be a power of two and cannot be larger than 65536.
|
|
Default value: 1024.
|
|
<DT id="5">limit<DD>
|
|
Upper limit of the SFQ. Can be used to reduce the default length of 127 packets.
|
|
After linux-3.3, it can be raised.
|
|
<DT id="6">depth<DD>
|
|
Limit of packets per flow (after linux-3.3). Default to 127 and can be lowered.
|
|
<DT id="7">perturb<DD>
|
|
Interval in seconds for queue algorithm perturbation. Defaults to 0, which means that
|
|
no perturbation occurs. Do not set too low for each perturbation may cause some packet
|
|
reordering or losses. Advised value: 60
|
|
This value has no effect when external flow classification is used.
|
|
Its better to increase divisor value to lower risk of hash collisions.
|
|
<DT id="8">quantum<DD>
|
|
Amount of bytes a flow is allowed to dequeue during a round of the round robin process.
|
|
Defaults to the MTU of the interface which is also the advised value and the minimum value.
|
|
<DT id="9">flows<DD>
|
|
After linux-3.3, it is possible to change the default limit of flows.
|
|
Default value is 127
|
|
<DT id="10">headdrop<DD>
|
|
Default SFQ behavior is to perform tail-drop of packets from a flow.
|
|
You can ask a headdrop instead, as this is known to provide a better feedback for TCP flows.
|
|
<DT id="11">redflowlimit<DD>
|
|
Configure the optional RED module on top of each SFQ flow.
|
|
Random Early Detection principle is to perform packet marks or drops in a probabilistic way.
|
|
(man tc-red for details about RED)
|
|
<PRE>
|
|
redflowlimit configures the hard limit on the real (not average) queue size per SFQ flow in bytes.
|
|
</PRE>
|
|
|
|
<DT id="12">min<DD>
|
|
Average queue size at which marking becomes a possibility. Defaults to
|
|
<B>max</B>
|
|
|
|
/3
|
|
<DT id="13">max<DD>
|
|
At this average queue size, the marking probability is maximal. Defaults to
|
|
<B>redflowlimit</B>
|
|
|
|
/4
|
|
<DT id="14">probability<DD>
|
|
Maximum probability for marking, specified as a floating point number from 0.0 to 1.0. Default value is 0.02
|
|
<DT id="15">avpkt<DD>
|
|
Specified in bytes. Used with burst to determine the time constant for average queue size calculations. Default value is 1000
|
|
<DT id="16">burst<DD>
|
|
Used for determining how fast the average queue size is influenced by the real queue size.
|
|
<PRE>
|
|
Default value is :
|
|
<B>(2 * min + max) / (3 * avpkt)</B>
|
|
</PRE>
|
|
|
|
<DT id="17">ecn<DD>
|
|
RED can either 'mark' or 'drop'. Explicit Congestion
|
|
Notification allows RED to notify remote hosts that their rate exceeds the
|
|
amount of bandwidth available. Non-ECN capable hosts can only be notified by
|
|
dropping a packet. If this parameter is specified, packets which indicate
|
|
that their hosts honor ECN will only be marked and not dropped, unless the
|
|
queue size hits
|
|
<B>depth</B>
|
|
|
|
packets.
|
|
<DT id="18">harddrop<DD>
|
|
If average flow queue size is above
|
|
<B>max</B>
|
|
|
|
bytes, this parameter forces a drop instead of ecn marking.
|
|
</DL>
|
|
<A NAME="lbAG"> </A>
|
|
<H2>EXAMPLE & USAGE</H2>
|
|
|
|
<P>
|
|
To attach to device ppp0:
|
|
<P>
|
|
|
|
# tc qdisc add dev ppp0 root sfq
|
|
<P>
|
|
|
|
Please note that SFQ, like all non-shaping (work-conserving) qdiscs, is only useful
|
|
if it owns the queue.
|
|
This is the case when the link speed equals the actually available bandwidth. This holds
|
|
for regular phone modems, ISDN connections and direct non-switched ethernet links.
|
|
<P>
|
|
|
|
Most often, cable modems and DSL devices do not fall into this category. The same holds
|
|
for when connected to a switch and trying to send data to a congested segment also
|
|
connected to the switch.
|
|
<P>
|
|
|
|
In this case, the effective queue does not reside within Linux and is therefore not
|
|
available for scheduling.
|
|
<P>
|
|
|
|
Embed SFQ in a classful qdisc to make sure it owns the queue.
|
|
<P>
|
|
It is possible to use external classifiers with sfq, for example to hash traffic based only
|
|
on source/destination ip addresses:
|
|
<P>
|
|
|
|
# tc filter add ... flow hash keys src,dst perturb 30 divisor 1024
|
|
<P>
|
|
|
|
Note that the given divisor should match the one used by sfq. If you have
|
|
changed the sfq default of 1024, use the same value for the flow hash filter, too.
|
|
<P>
|
|
<P>
|
|
|
|
Example of sfq with optional RED mode :
|
|
<P>
|
|
|
|
# tc qdisc add dev eth0 parent 1:1 handle 10: sfq limit 3000 flows 512 divisor 16384
|
|
<BR> redflowlimit 100000 min 8000 max 60000 probability 0.20 ecn headdrop
|
|
<P>
|
|
<A NAME="lbAH"> </A>
|
|
<H2>SOURCE</H2>
|
|
|
|
<DL COMPACT>
|
|
<DT id="19">o<DD>
|
|
Paul E. McKenney "Stochastic Fairness Queuing",
|
|
IEEE INFOCOMM'90 Proceedings, San Francisco, 1990.
|
|
<P>
|
|
<DT id="20">o<DD>
|
|
Paul E. McKenney "Stochastic Fairness Queuing",
|
|
"Interworking: Research and Experience", v.2, 1991, p.113-131.
|
|
<P>
|
|
<DT id="21">o<DD>
|
|
See also:
|
|
M. Shreedhar and George Varghese "Efficient Fair
|
|
Queuing using Deficit Round Robin", Proc. SIGCOMM 95.
|
|
<P>
|
|
</DL>
|
|
<A NAME="lbAI"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?8+tc">tc</A></B>(8),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?8+tc-red">tc-red</A></B>(8)
|
|
|
|
<P>
|
|
<A NAME="lbAJ"> </A>
|
|
<H2>AUTHORS</H2>
|
|
|
|
Alexey N. Kuznetsov, <<A HREF="mailto:kuznet@ms2.inr.ac.ru">kuznet@ms2.inr.ac.ru</A>>,
|
|
Eric Dumazet <<A HREF="mailto:eric.dumazet@gmail.com">eric.dumazet@gmail.com</A>>.
|
|
<P>
|
|
|
|
This manpage maintained by bert hubert <<A HREF="mailto:ahu@ds9a.nl">ahu@ds9a.nl</A>>
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="22"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="23"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="24"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="25"><A HREF="#lbAE">ALGORITHM</A><DD>
|
|
<DT id="26"><A HREF="#lbAF">PARAMETERS</A><DD>
|
|
<DT id="27"><A HREF="#lbAG">EXAMPLE & USAGE</A><DD>
|
|
<DT id="28"><A HREF="#lbAH">SOURCE</A><DD>
|
|
<DT id="29"><A HREF="#lbAI">SEE ALSO</A><DD>
|
|
<DT id="30"><A HREF="#lbAJ">AUTHORS</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:06:17 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|