|
Packit Service |
3880ab |
.TH PRIO 8 "16 December 2001" "iproute2" "Linux"
|
|
Packit Service |
3880ab |
.SH NAME
|
|
Packit Service |
3880ab |
PRIO \- Priority qdisc
|
|
Packit Service |
3880ab |
.SH SYNOPSIS
|
|
Packit Service |
3880ab |
.B tc qdisc ... dev
|
|
Packit Service |
3880ab |
dev
|
|
Packit Service |
3880ab |
.B ( parent
|
|
Packit Service |
3880ab |
classid
|
|
Packit Service |
3880ab |
.B | root) [ handle
|
|
Packit Service |
3880ab |
major:
|
|
Packit Service |
3880ab |
.B ] prio [ bands
|
|
Packit Service |
3880ab |
bands
|
|
Packit Service |
3880ab |
.B ] [ priomap
|
|
Packit Service |
3880ab |
band band band...
|
|
Packit Service |
3880ab |
.B ] [ estimator
|
|
Packit Service |
3880ab |
interval timeconstant
|
|
Packit Service |
3880ab |
.B ]
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
.SH DESCRIPTION
|
|
Packit Service |
3880ab |
The PRIO qdisc is a simple classful queueing discipline that contains
|
|
Packit Service |
3880ab |
an arbitrary number of classes of differing priority. The classes are
|
|
Packit Service |
3880ab |
dequeued in numerical descending order of priority. PRIO is a scheduler
|
|
Packit Service |
3880ab |
and never delays packets - it is a work-conserving qdisc, though the qdiscs
|
|
Packit Service |
3880ab |
contained in the classes may not be.
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
Very useful for lowering latency when there is no need for slowing down
|
|
Packit Service |
3880ab |
traffic.
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
.SH ALGORITHM
|
|
Packit Service |
3880ab |
On creation with 'tc qdisc add', a fixed number of bands is created. Each
|
|
Packit Service |
3880ab |
band is a class, although is not possible to add classes with 'tc qdisc
|
|
Packit Service |
3880ab |
add', the number of bands to be created must instead be specified on the
|
|
Packit Service |
3880ab |
command line attaching PRIO to its root.
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
When dequeueing, band 0 is tried first and only if it did not deliver a
|
|
Packit Service |
3880ab |
packet does PRIO try band 1, and so onwards. Maximum reliability packets
|
|
Packit Service |
3880ab |
should therefore go to band 0, minimum delay to band 1 and the rest to band
|
|
Packit Service |
3880ab |
2.
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
As the PRIO qdisc itself will have minor number 0, band 0 is actually
|
|
Packit Service |
3880ab |
major:1, band 1 is major:2, etc. For major, substitute the major number
|
|
Packit Service |
3880ab |
assigned to the qdisc on 'tc qdisc add' with the
|
|
Packit Service |
3880ab |
.B handle
|
|
Packit Service |
3880ab |
parameter.
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
.SH CLASSIFICATION
|
|
Packit Service |
3880ab |
Three methods are available to PRIO to determine in which band a packet will
|
|
Packit Service |
3880ab |
be enqueued.
|
|
Packit Service |
3880ab |
.TP
|
|
Packit Service |
3880ab |
From userspace
|
|
Packit Service |
3880ab |
A process with sufficient privileges can encode the destination class
|
|
Packit Service |
3880ab |
directly with SO_PRIORITY, see
|
|
Packit Service |
3880ab |
.BR socket(7).
|
|
Packit Service |
3880ab |
.TP
|
|
Packit Service |
3880ab |
with a tc filter
|
|
Packit Service |
3880ab |
A tc filter attached to the root qdisc can point traffic directly to a class
|
|
Packit Service |
3880ab |
.TP
|
|
Packit Service |
3880ab |
with the priomap
|
|
Packit Service |
3880ab |
Based on the packet priority, which in turn is derived from the Type of
|
|
Packit Service |
3880ab |
Service assigned to the packet.
|
|
Packit Service |
3880ab |
.P
|
|
Packit Service |
3880ab |
Only the priomap is specific to this qdisc.
|
|
Packit Service |
3880ab |
.SH QDISC PARAMETERS
|
|
Packit Service |
3880ab |
.TP
|
|
Packit Service |
3880ab |
bands
|
|
Packit Service |
3880ab |
Number of bands. If changed from the default of 3,
|
|
Packit Service |
3880ab |
.B priomap
|
|
Packit Service |
3880ab |
must be updated as well.
|
|
Packit Service |
3880ab |
.TP
|
|
Packit Service |
3880ab |
priomap
|
|
Packit Service |
3880ab |
The priomap maps the priority of
|
|
Packit Service |
3880ab |
a packet to a class. The priority can either be set directly from userspace,
|
|
Packit Service |
3880ab |
or be derived from the Type of Service of the packet.
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
Determines how packet priorities, as assigned by the kernel, map to
|
|
Packit Service |
3880ab |
bands. Mapping occurs based on the TOS octet of the packet, which looks like
|
|
Packit Service |
3880ab |
this:
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
.nf
|
|
Packit Service |
3880ab |
0 1 2 3 4 5 6 7
|
|
Packit Service |
3880ab |
+---+---+---+---+---+---+---+---+
|
|
Packit Service |
3880ab |
| | | |
|
|
Packit Service |
3880ab |
|PRECEDENCE | TOS |MBZ|
|
|
Packit Service |
3880ab |
| | | |
|
|
Packit Service |
3880ab |
+---+---+---+---+---+---+---+---+
|
|
Packit Service |
3880ab |
.fi
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
The four TOS bits (the 'TOS field') are defined as:
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
.nf
|
|
Packit Service |
3880ab |
Binary Decimal Meaning
|
|
Packit Service |
3880ab |
-----------------------------------------
|
|
Packit Service |
3880ab |
1000 8 Minimize delay (md)
|
|
Packit Service |
3880ab |
0100 4 Maximize throughput (mt)
|
|
Packit Service |
3880ab |
0010 2 Maximize reliability (mr)
|
|
Packit Service |
3880ab |
0001 1 Minimize monetary cost (mmc)
|
|
Packit Service |
3880ab |
0000 0 Normal Service
|
|
Packit Service |
3880ab |
.fi
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
As there is 1 bit to the right of these four bits, the actual value of the
|
|
Packit Service |
3880ab |
TOS field is double the value of the TOS bits. Tcpdump -v -v shows you the
|
|
Packit Service |
3880ab |
value of the entire TOS field, not just the four bits. It is the value you
|
|
Packit Service |
3880ab |
see in the first column of this table:
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
.nf
|
|
Packit Service |
3880ab |
TOS Bits Means Linux Priority Band
|
|
Packit Service |
3880ab |
------------------------------------------------------------
|
|
Packit Service |
3880ab |
0x0 0 Normal Service 0 Best Effort 1
|
|
Packit Service |
3880ab |
0x2 1 Minimize Monetary Cost 0 Best Effort 1
|
|
Packit Service |
3880ab |
0x4 2 Maximize Reliability 0 Best Effort 1
|
|
Packit Service |
3880ab |
0x6 3 mmc+mr 0 Best Effort 1
|
|
Packit Service |
3880ab |
0x8 4 Maximize Throughput 2 Bulk 2
|
|
Packit Service |
3880ab |
0xa 5 mmc+mt 2 Bulk 2
|
|
Packit Service |
3880ab |
0xc 6 mr+mt 2 Bulk 2
|
|
Packit Service |
3880ab |
0xe 7 mmc+mr+mt 2 Bulk 2
|
|
Packit Service |
3880ab |
0x10 8 Minimize Delay 6 Interactive 0
|
|
Packit Service |
3880ab |
0x12 9 mmc+md 6 Interactive 0
|
|
Packit Service |
3880ab |
0x14 10 mr+md 6 Interactive 0
|
|
Packit Service |
3880ab |
0x16 11 mmc+mr+md 6 Interactive 0
|
|
Packit Service |
3880ab |
0x18 12 mt+md 4 Int. Bulk 1
|
|
Packit Service |
3880ab |
0x1a 13 mmc+mt+md 4 Int. Bulk 1
|
|
Packit Service |
3880ab |
0x1c 14 mr+mt+md 4 Int. Bulk 1
|
|
Packit Service |
3880ab |
0x1e 15 mmc+mr+mt+md 4 Int. Bulk 1
|
|
Packit Service |
3880ab |
.fi
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
The second column contains the value of the relevant
|
|
Packit Service |
3880ab |
four TOS bits, followed by their translated meaning. For example, 15 stands
|
|
Packit Service |
3880ab |
for a packet wanting Minimal Monetary Cost, Maximum Reliability, Maximum
|
|
Packit Service |
3880ab |
Throughput AND Minimum Delay.
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
The fourth column lists the way the Linux kernel interprets the TOS bits, by
|
|
Packit Service |
3880ab |
showing to which Priority they are mapped.
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
The last column shows the result of the default priomap. On the command line,
|
|
Packit Service |
3880ab |
the default priomap looks like this:
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
This means that priority 4, for example, gets mapped to band number 1.
|
|
Packit Service |
3880ab |
The priomap also allows you to list higher priorities (> 7) which do not
|
|
Packit Service |
3880ab |
correspond to TOS mappings, but which are set by other means.
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
This table from RFC 1349 (read it for more details) explains how
|
|
Packit Service |
3880ab |
applications might very well set their TOS bits:
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
.nf
|
|
Packit Service |
3880ab |
TELNET 1000 (minimize delay)
|
|
Packit Service |
3880ab |
FTP
|
|
Packit Service |
3880ab |
Control 1000 (minimize delay)
|
|
Packit Service |
3880ab |
Data 0100 (maximize throughput)
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
TFTP 1000 (minimize delay)
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
SMTP
|
|
Packit Service |
3880ab |
Command phase 1000 (minimize delay)
|
|
Packit Service |
3880ab |
DATA phase 0100 (maximize throughput)
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
Domain Name Service
|
|
Packit Service |
3880ab |
UDP Query 1000 (minimize delay)
|
|
Packit Service |
3880ab |
TCP Query 0000
|
|
Packit Service |
3880ab |
Zone Transfer 0100 (maximize throughput)
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
NNTP 0001 (minimize monetary cost)
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
ICMP
|
|
Packit Service |
3880ab |
Errors 0000
|
|
Packit Service |
3880ab |
Requests 0000 (mostly)
|
|
Packit Service |
3880ab |
Responses <same as request> (mostly)
|
|
Packit Service |
3880ab |
.fi
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
.SH CLASSES
|
|
Packit Service |
3880ab |
PRIO classes cannot be configured further - they are automatically created
|
|
Packit Service |
3880ab |
when the PRIO qdisc is attached. Each class however can contain yet a
|
|
Packit Service |
3880ab |
further qdisc.
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
.SH BUGS
|
|
Packit Service |
3880ab |
Large amounts of traffic in the lower bands can cause starvation of higher
|
|
Packit Service |
3880ab |
bands. Can be prevented by attaching a shaper (for example,
|
|
Packit Service |
3880ab |
.BR tc-tbf(8)
|
|
Packit Service |
3880ab |
to these bands to make sure they cannot dominate the link.
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
.SH AUTHORS
|
|
Packit Service |
3880ab |
Alexey N. Kuznetsov, <kuznet@ms2.inr.ac.ru>, J Hadi Salim
|
|
Packit Service |
3880ab |
<hadi@cyberus.ca>. This manpage maintained by bert hubert <ahu@ds9a.nl>
|