]> git.proxmox.com Git - mirror_iproute2.git/blame - man/man8/tc-cbq.8
update kernel headers based on net-next 3.21
[mirror_iproute2.git] / man / man8 / tc-cbq.8
CommitLineData
985794ad
SH
1.TH CBQ 8 "16 December 2001" "iproute2" "Linux"
2.SH NAME
3CBQ \- Class Based Queueing
4.SH SYNOPSIS
5.B tc qdisc ... dev
6dev
7.B ( parent
8classid
9.B | root) [ handle
10major:
11.B ] cbq [ allot
12bytes
13.B ] avpkt
14bytes
15.B bandwidth
16rate
17.B [ cell
18bytes
19.B ] [ ewma
20log
21.B ] [ mpu
22bytes
23.B ]
24
25.B tc class ... dev
26dev
27.B parent
28major:[minor]
29.B [ classid
30major:minor
31.B ] cbq allot
32bytes
33.B [ bandwidth
34rate
35.B ] [ rate
36rate
37.B ] prio
38priority
39.B [ weight
40weight
41.B ] [ minburst
42packets
43.B ] [ maxburst
44packets
45.B ] [ ewma
46log
47.B ] [ cell
48bytes
49.B ] avpkt
50bytes
51.B [ mpu
52bytes
53.B ] [ bounded isolated ] [ split
54handle
55.B & defmap
56defmap
57.B ] [ estimator
58interval timeconstant
59.B ]
60
61.SH DESCRIPTION
62Class Based Queueing is a classful qdisc that implements a rich
63linksharing hierarchy of classes. It contains shaping elements as
64well as prioritizing capabilities. Shaping is performed using link
65idle time calculations based on the timing of dequeue events and
66underlying link bandwidth.
67
68.SH SHAPING ALGORITHM
69When shaping a 10mbit/s connection to 1mbit/s, the link will
70be idle 90% of the time. If it isn't, it needs to be throttled so that it
71IS idle 90% of the time.
72
73During operations, the effective idletime is measured using an
74exponential weighted moving average (EWMA), which considers recent
75packets to be exponentially more important than past ones. The Unix
76loadaverage is calculated in the same way.
77
78The calculated idle time is subtracted from the EWMA measured one,
79the resulting number is called 'avgidle'. A perfectly loaded link has
80an avgidle of zero: packets arrive exactly at the calculated
81interval.
82
83An overloaded link has a negative avgidle and if it gets too negative,
84CBQ throttles and is then 'overlimit'.
85
86Conversely, an idle link might amass a huge avgidle, which would then
87allow infinite bandwidths after a few hours of silence. To prevent
88this, avgidle is capped at
89.B maxidle.
90
91If overlimit, in theory, the CBQ could throttle itself for exactly the
92amount of time that was calculated to pass between packets, and then
93pass one packet, and throttle again. Due to timer resolution constraints,
94this may not be feasible, see the
95.B minburst
96parameter below.
97
98.SH CLASSIFICATION
99Within the one CBQ instance many classes may exist. Each of these classes
100contains another qdisc, by default
101.BR tc-pfifo (8).
102
103When enqueueing a packet, CBQ starts at the root and uses various methods to
104determine which class should receive the data.
105
106In the absence of uncommon configuration options, the process is rather easy.
107At each node we look for an instruction, and then go to the class the
108instruction refers us to. If the class found is a barren leaf-node (without
109children), we enqueue the packet there. If it is not yet a leaf node, we do
110the whole thing over again starting from that node.
111
112The following actions are performed, in order at each node we visit, until one
113sends us to another node, or terminates the process.
114.TP
115(i)
116Consult filters attached to the class. If sent to a leafnode, we are done.
117Otherwise, restart.
118.TP
119(ii)
120Consult the defmap for the priority assigned to this packet, which depends
121on the TOS bits. Check if the referral is leafless, otherwise restart.
122.TP
123(iii)
124Ask the defmap for instructions for the 'best effort' priority. Check the
125answer for leafness, otherwise restart.
126.TP
127(iv)
128If none of the above returned with an instruction, enqueue at this node.
129.P
130This algorithm makes sure that a packet always ends up somewhere, even while
131you are busy building your configuration.
132
133For more details, see
134.BR tc-cbq-details(8).
135
136.SH LINK SHARING ALGORITHM
137When dequeuing for sending to the network device, CBQ decides which of its
138classes will be allowed to send. It does so with a Weighted Round Robin process
139in which each class with packets gets a chance to send in turn. The WRR process
140starts by asking the highest priority classes (lowest numerically -
141highest semantically) for packets, and will continue to do so until they
142have no more data to offer, in which case the process repeats for lower
143priorities.
144
145Classes by default borrow bandwidth from their siblings. A class can be
146prevented from doing so by declaring it 'bounded'. A class can also indicate
147its unwillingness to lend out bandwidth by being 'isolated'.
148
149.SH QDISC
150The root of a CBQ qdisc class tree has the following parameters:
151
152.TP
153parent major:minor | root
154This mandatory parameter determines the place of the CBQ instance, either at the
155.B root
156of an interface or within an existing class.
157.TP
158handle major:
159Like all other qdiscs, the CBQ can be assigned a handle. Should consist only
160of a major number, followed by a colon. Optional, but very useful if classes
161will be generated within this qdisc.
162.TP
163allot bytes
164This allotment is the 'chunkiness' of link sharing and is used for determining packet
165transmission time tables. The qdisc allot differs slightly from the class allot discussed
166below. Optional. Defaults to a reasonable value, related to avpkt.
167.TP
168avpkt bytes
169The average size of a packet is needed for calculating maxidle, and is also used
170for making sure 'allot' has a safe value. Mandatory.
171.TP
172bandwidth rate
173To determine the idle time, CBQ must know the bandwidth of your underlying
174physical interface, or parent qdisc. This is a vital parameter, more about it
175later. Mandatory.
176.TP
177cell
178The cell size determines he granularity of packet transmission time calculations. Has a sensible default.
179.TP
180mpu
181A zero sized packet may still take time to transmit. This value is the lower
182cap for packet transmission time calculations - packets smaller than this value
183are still deemed to have this size. Defaults to zero.
184.TP
185ewma log
186When CBQ needs to measure the average idle time, it does so using an
6274b0b7 187Exponentially Weighted Moving Average which smooths out measurements into
985794ad
SH
188a moving average. The EWMA LOG determines how much smoothing occurs. Lower
189values imply greater sensitivity. Must be between 0 and 31. Defaults
190to 5.
191.P
192A CBQ qdisc does not shape out of its own accord. It only needs to know certain
193parameters about the underlying link. Actual shaping is done in classes.
194
195.SH CLASSES
196Classes have a host of parameters to configure their operation.
197
198.TP
199parent major:minor
200Place of this class within the hierarchy. If attached directly to a qdisc
201and not to another class, minor can be omitted. Mandatory.
202.TP
203classid major:minor
204Like qdiscs, classes can be named. The major number must be equal to the
205major number of the qdisc to which it belongs. Optional, but needed if this
206class is going to have children.
207.TP
208weight weight
209When dequeuing to the interface, classes are tried for traffic in a
210round-robin fashion. Classes with a higher configured qdisc will generally
211have more traffic to offer during each round, so it makes sense to allow
212it to dequeue more traffic. All weights under a class are normalized, so
213only the ratios matter. Defaults to the configured rate, unless the priority
214of this class is maximal, in which case it is set to 1.
215.TP
216allot bytes
217Allot specifies how many bytes a qdisc can dequeue
218during each round of the process. This parameter is weighted using the
219renormalized class weight described above. Silently capped at a minimum of
2203/2 avpkt. Mandatory.
221
222.TP
223prio priority
224In the round-robin process, classes with the lowest priority field are tried
225for packets first. Mandatory.
226
227.TP
228avpkt
229See the QDISC section.
230
231.TP
232rate rate
233Maximum rate this class and all its children combined can send at. Mandatory.
234
235.TP
236bandwidth rate
237This is different from the bandwidth specified when creating a CBQ disc! Only
238used to determine maxidle and offtime, which are only calculated when
239specifying maxburst or minburst. Mandatory if specifying maxburst or minburst.
240
241.TP
242maxburst
243This number of packets is used to calculate maxidle so that when
244avgidle is at maxidle, this number of average packets can be burst
245before avgidle drops to 0. Set it higher to be more tolerant of
246bursts. You can't set maxidle directly, only via this parameter.
247
248.TP
249minburst
250As mentioned before, CBQ needs to throttle in case of
251overlimit. The ideal solution is to do so for exactly the calculated
252idle time, and pass 1 packet. However, Unix kernels generally have a
253hard time scheduling events shorter than 10ms, so it is better to
254throttle for a longer period, and then pass minburst packets in one
255go, and then sleep minburst times longer.
256
257The time to wait is called the offtime. Higher values of minburst lead
258to more accurate shaping in the long term, but to bigger bursts at
259millisecond timescales. Optional.
260
261.TP
262minidle
263If avgidle is below 0, we are overlimits and need to wait until
264avgidle will be big enough to send one packet. To prevent a sudden
265burst from shutting down the link for a prolonged period of time,
266avgidle is reset to minidle if it gets too low.
267
268Minidle is specified in negative microseconds, so 10 means that
269avgidle is capped at -10us. Optional.
270
271.TP
272bounded
273Signifies that this class will not borrow bandwidth from its siblings.
274.TP
275isolated
276Means that this class will not borrow bandwidth to its siblings
277
278.TP
279split major:minor & defmap bitmap[/bitmap]
280If consulting filters attached to a class did not give a verdict,
281CBQ can also classify based on the packet's priority. There are 16
282priorities available, numbered from 0 to 15.
283
284The defmap specifies which priorities this class wants to receive,
285specified as a bitmap. The Least Significant Bit corresponds to priority
286zero. The
287.B split
288parameter tells CBQ at which class the decision must be made, which should
289be a (grand)parent of the class you are adding.
290
291As an example, 'tc class add ... classid 10:1 cbq .. split 10:0 defmap c0'
292configures class 10:0 to send packets with priorities 6 and 7 to 10:1.
293
294The complimentary configuration would then
295be: 'tc class add ... classid 10:2 cbq ... split 10:0 defmap 3f'
296Which would send all packets 0, 1, 2, 3, 4 and 5 to 10:1.
297.TP
298estimator interval timeconstant
299CBQ can measure how much bandwidth each class is using, which tc filters
300can use to classify packets with. In order to determine the bandwidth
301it uses a very simple estimator that measures once every
302.B interval
303microseconds how much traffic has passed. This again is a EWMA, for which
304the time constant can be specified, also in microseconds. The
305.B time constant
306corresponds to the sluggishness of the measurement or, conversely, to the
307sensitivity of the average to short bursts. Higher values mean less
308sensitivity.
309
310.SH BUGS
311The actual bandwidth of the underlying link may not be known, for example
312in the case of PPoE or PPTP connections which in fact may send over a
313pipe, instead of over a physical device. CBQ is quite resilient to major
314errors in the configured bandwidth, probably a the cost of coarser shaping.
315
316Default kernels rely on coarse timing information for making decisions. These
317may make shaping precise in the long term, but inaccurate on second long scales.
318
319See
320.BR tc-cbq-details(8)
321for hints on how to improve this.
322
323.SH SOURCES
324.TP
325o
326Sally Floyd and Van Jacobson, "Link-sharing and Resource
327Management Models for Packet Networks",
328IEEE/ACM Transactions on Networking, Vol.3, No.4, 1995
329
330.TP
331o
332Sally Floyd, "Notes on CBQ and Guaranteed Service", 1995
333
334.TP
335o
336Sally Floyd, "Notes on Class-Based Queueing: Setting
337Parameters", 1996
338
339.TP
340o
341Sally Floyd and Michael Speer, "Experimental Results
342for Class-Based Queueing", 1998, not published.
343
344
345
346.SH SEE ALSO
347.BR tc (8)
348
349.SH AUTHOR
350Alexey N. Kuznetsov, <kuznet@ms2.inr.ac.ru>. This manpage maintained by
351bert hubert <ahu@ds9a.nl>
352
353