Blame man/man8/tc-stab.8

Packit Service 3880ab
.TH STAB 8 "31 October 2011" iproute2 Linux
Packit Service 3880ab
.
Packit Service 3880ab
.SH NAME
Packit Service 3880ab
tc\-stab \- Generic size table manipulations
Packit Service 3880ab
.
Packit Service 3880ab
.SH SYNOPSIS
Packit Service 3880ab
.nf
Packit Service 3880ab
tc qdisc add ... stab
Packit Service 3880ab
.RS 4
Packit Service 3880ab
[ \fBmtu\fR BYTES ] [ \fBtsize\fR SLOTS ]
Packit Service 3880ab
[ \fBmpu\fR BYTES ] [ \fBoverhead\fR BYTES ]
Packit Service 3880ab
[ \fBlinklayer\fR { adsl | atm | ethernet } ] ...
Packit Service 3880ab
.RE
Packit Service 3880ab
.fi
Packit Service 3880ab
Packit Service 3880ab
.SH OPTIONS
Packit Service 3880ab
For the description of BYTES \- please refer to the \fBUNITS\fR
Packit Service 3880ab
section of \fBtc\fR(8).
Packit Service 3880ab
Packit Service 3880ab
.IP \fBmtu\fR 4
Packit Service 3880ab
.br
Packit Service 3880ab
maximum packet size we create size table for, assumed 2048 if not specified explicitly
Packit Service 3880ab
.IP \fBtsize\fR
Packit Service 3880ab
.br
Packit Service 3880ab
required table size, assumed 512 if not specified explicitly
Packit Service 3880ab
.IP \fBmpu\fR
Packit Service 3880ab
.br
Packit Service 3880ab
minimum packet size used in computations
Packit Service 3880ab
.IP \fBoverhead\fR
Packit Service 3880ab
.br
Packit Service 3880ab
per\-packet size overhead (can be negative) used in computations
Packit Service 3880ab
.IP \fBlinklayer\fR
Packit Service 3880ab
.br
Packit Service 3880ab
required linklayer specification.
Packit Service 3880ab
.PP
Packit Service 3880ab
.
Packit Service 3880ab
.SH DESCRIPTION
Packit Service 3880ab
.
Packit Service 3880ab
Size tables allow manipulation of packet sizes, as seen by the whole scheduler
Packit Service 3880ab
framework (of course, the actual packet size remains the same). Adjusted packet
Packit Service 3880ab
size is calculated only once \- when a qdisc enqueues the packet. Initial root
Packit Service 3880ab
enqueue initializes it to the real packet's size.
Packit Service 3880ab
Packit Service 3880ab
Each qdisc can use a different size table, but the adjusted size is stored in
Packit Service 3880ab
an area shared by whole qdisc hierarchy attached to the interface. The effect is
Packit Service 3880ab
that if you have such a setup, the last qdisc with a stab in a chain "wins". For
Packit Service 3880ab
example, consider HFSC with simple pfifo attached to one of its leaf classes.
Packit Service 3880ab
If that pfifo qdisc has stab defined, it will override lengths calculated
Packit Service 3880ab
during HFSC's enqueue; and in turn, whenever HFSC tries to dequeue a packet, it
Packit Service 3880ab
will use a potentially invalid size in its calculations. Normal setups will
Packit Service 3880ab
usually include stab defined only on root qdisc, but further overriding gives
Packit Service 3880ab
extra flexibility for less usual setups.
Packit Service 3880ab
Packit Service 3880ab
The initial size table is calculated by \fBtc\fR tool using \fBmtu\fR and
Packit Service 3880ab
\fBtsize\fR parameters. The algorithm sets each slot's size to the smallest
Packit Service 3880ab
power of 2 value, so the whole \fBmtu\fR is covered by the size table. Neither
Packit Service 3880ab
\fBtsize\fR, nor \fBmtu\fR have to be power of 2 value, so the size
Packit Service 3880ab
table will usually support more than is required by \fBmtu\fR.
Packit Service 3880ab
Packit Service 3880ab
For example, with \fBmtu\fR\~=\~1500 and \fBtsize\fR\~=\~128, a table with 128
Packit Service 3880ab
slots will be created, where slot 0 will correspond to sizes 0\-16, slot 1 to
Packit Service 3880ab
17\~\-\~32, \&..., slot 127 to 2033\~\-\~2048. Sizes assigned to each slot
Packit Service 3880ab
depend on \fBlinklayer\fR parameter.
Packit Service 3880ab
Packit Service 3880ab
Stab calculation is also safe for an unusual case, when a size assigned to a
Packit Service 3880ab
slot would be larger than 2^16\-1 (you will lose the accuracy though).
Packit Service 3880ab
Packit Service 3880ab
During the kernel part of packet size adjustment, \fBoverhead\fR will be added
Packit Service 3880ab
to original size, and then slot will be calculated. If the size would cause
Packit Service 3880ab
overflow, more than 1 slot will be used to get the final size. This of course
Packit Service 3880ab
will affect accuracy, but it's only a guard against unusual situations.
Packit Service 3880ab
Packit Service 3880ab
Currently there are two methods of creating values stored in the size table \-
Packit Service 3880ab
ethernet and atm (adsl):
Packit Service 3880ab
Packit Service 3880ab
.IP ethernet 4
Packit Service 3880ab
.br
Packit Service 3880ab
This is basically 1\-1 mapping, so following our example from above
Packit Service 3880ab
(disregarding \fBmpu\fR for a moment) slot 0 would have 8, slot 1 would have 16
Packit Service 3880ab
and so on, up to slot 127 with 2048. Note, that \fBmpu\fR\~>\~0 must be
Packit Service 3880ab
specified, and slots that would get less than specified by \fBmpu\fR will get
Packit Service 3880ab
\fBmpu\fR instead. If you don't specify \fBmpu\fR, the size table will not be
Packit Service 3880ab
created at all (it wouldn't make any difference), although any \fBoverhead\fR
Packit Service 3880ab
value will be respected during calculations.
Packit Service 3880ab
.IP "atm, adsl"
Packit Service 3880ab
.br
Packit Service 3880ab
ATM linklayer consists of 53 byte cells, where each of them provides 48 bytes
Packit Service 3880ab
for payload. Also all the cells must be fully utilized, thus the last one is
Packit Service 3880ab
padded if/as necessary.
Packit Service 3880ab
Packit Service 3880ab
When the size table is calculated, adjusted size that fits properly into lowest
Packit Service 3880ab
amount of cells is assigned to a slot. For example, a 100 byte long packet
Packit Service 3880ab
requires three 48\-byte payloads, so the final size would require 3 ATM cells
Packit Service 3880ab
\- 159 bytes.
Packit Service 3880ab
Packit Service 3880ab
For ATM size tables, 16\~bytes sized slots are perfectly enough. The default
Packit Service 3880ab
values of \fBmtu\fR and \fBtsize\fR create 4\~bytes sized slots.
Packit Service 3880ab
.PP
Packit Service 3880ab
.
Packit Service 3880ab
.SH "TYPICAL OVERHEADS"
Packit Service 3880ab
The following values are typical for different adsl scenarios (based on
Packit Service 3880ab
\fB[1]\fR and \fB[2]\fR):
Packit Service 3880ab
Packit Service 3880ab
.nf
Packit Service 3880ab
LLC based:
Packit Service 3880ab
.RS 4
Packit Service 3880ab
PPPoA \- 14 (PPP \- 2, ATM \- 12)
Packit Service 3880ab
PPPoE \- 40+ (PPPoE \- 8, ATM \- 18, ethernet 14, possibly FCS \- 4+padding)
Packit Service 3880ab
Bridged \- 32 (ATM \- 18, ethernet 14, possibly FCS \- 4+padding)
Packit Service 3880ab
IPoA \- 16 (ATM \- 16)
Packit Service 3880ab
.RE
Packit Service 3880ab
Packit Service 3880ab
VC Mux based:
Packit Service 3880ab
.RS 4
Packit Service 3880ab
PPPoA \- 10 (PPP \- 2, ATM \- 8)
Packit Service 3880ab
PPPoE \- 32+ (PPPoE \- 8, ATM \- 10, ethernet 14, possibly FCS \- 4+padding)
Packit Service 3880ab
Bridged \- 24+ (ATM \- 10, ethernet 14, possibly FCS \- 4+padding)
Packit Service 3880ab
IPoA \- 8 (ATM \- 8)
Packit Service 3880ab
.RE
Packit Service 3880ab
.fi
Packit Service 3880ab
There are a few important things regarding the above overheads:
Packit Service 3880ab
.
Packit Service 3880ab
.IP \(bu 4
Packit Service 3880ab
IPoA in LLC case requires SNAP, instead of LLC\-NLPID (see rfc2684) \- this is
Packit Service 3880ab
the reason why it actually takes more space than PPPoA.
Packit Service 3880ab
.IP \(bu
Packit Service 3880ab
In rare cases, FCS might be preserved on protocols that include Ethernet frames
Packit Service 3880ab
(Bridged and PPPoE). In such situation, any Ethernet specific padding
Packit Service 3880ab
guaranteeing 64 bytes long frame size has to be included as well (see RFC2684).
Packit Service 3880ab
In the other words, it also guarantees that any packet you send will take
Packit Service 3880ab
minimum 2 atm cells. You should set \fBmpu\fR accordingly for that.
Packit Service 3880ab
.IP \(bu
Packit Service 3880ab
When the size table is consulted, and you're shaping traffic for the sake of
Packit Service 3880ab
another modem/router, an Ethernet header (without padding) will already be added
Packit Service 3880ab
to initial packet's length. You should compensate for that by subtracting 14
Packit Service 3880ab
from the above overheads in this case. If you're shaping directly on the router
Packit Service 3880ab
(for example, with speedtouch usb modem) using ppp daemon, you're using raw ip
Packit Service 3880ab
interface without underlying layer2, so nothing will be added.
Packit Service 3880ab
Packit Service 3880ab
For more thorough explanations, please see \fB[1]\fR and \fB[2]\fR.
Packit Service 3880ab
.
Packit Service 3880ab
.SH "ETHERNET CARDS CONSIDERATIONS"
Packit Service 3880ab
.
Packit Service 3880ab
It's often forgotten that modern network cards (even cheap ones on desktop
Packit Service 3880ab
motherboards) and/or their drivers often support different offloading
Packit Service 3880ab
mechanisms. In the context of traffic shaping, 'tso' and 'gso' might cause
Packit Service 3880ab
undesirable effects, due to massive TCP segments being considered during
Packit Service 3880ab
traffic shaping (including stab calculations). For slow uplink interfaces,
Packit Service 3880ab
it's good to use \fBethtool\fR to turn off offloading features.
Packit Service 3880ab
.
Packit Service 3880ab
.SH "SEE ALSO"
Packit Service 3880ab
.
Packit Service 3880ab
\fBtc\fR(8), \fBtc\-hfsc\fR(7), \fBtc\-hfsc\fR(8),
Packit Service 3880ab
.br
Packit Service 3880ab
\fB[1]\fR http://ace\-host.stuart.id.au/russell/files/tc/tc\-atm/
Packit Service 3880ab
.br
Packit Service 3880ab
\fB[2]\fR http://www.faqs.org/rfcs/rfc2684.html
Packit Service 3880ab
Packit Service 3880ab
Please direct bugreports and patches to: <netdev@vger.kernel.org>
Packit Service 3880ab
.
Packit Service 3880ab
.SH "AUTHOR"
Packit Service 3880ab
.
Packit Service 3880ab
Manpage created by Michal Soltys (soltys@ziu.info)