1PRIO(8) Linux PRIO(8)
2
3
4
6 PRIO - Priority qdisc
7
9 tc qdisc ... dev dev ( parent classid | root) [ handle major: ] prio [
10 bands bands ] [ priomap band,band,band... ] [ estimator interval time‐
11 constant ]
12
13
15 The PRIO qdisc is a simple classful queueing discipline that contains
16 an arbitrary number of classes of differing priority. The classes are
17 dequeued in numerical descending order of priority. PRIO is a scheduler
18 and never delays packets - it is a work-conserving qdisc, though the
19 qdiscs contained in the classes may not be.
20
21 Very useful for lowering latency when there is no need for slowing down
22 traffic.
23
24
26 On creation with 'tc qdisc add', a fixed number of bands is created.
27 Each band is a class, although is not possible to add classes with 'tc
28 qdisc add', the number of bands to be created must instead be specified
29 on the command line attaching PRIO to its root.
30
31 When dequeueing, band 0 is tried first and only if it did not deliver a
32 packet does PRIO try band 1, and so onwards. Maximum reliability pack‐
33 ets should therefore go to band 0, minimum delay to band 1 and the rest
34 to band 2.
35
36 As the PRIO qdisc itself will have minor number 0, band 0 is actually
37 major:1, band 1 is major:2, etc. For major, substitute the major number
38 assigned to the qdisc on 'tc qdisc add' with the handle parameter.
39
40
42 Three methods are available to PRIO to determine in which band a packet
43 will be enqueued.
44
45 From userspace
46 A process with sufficient privileges can encode the destination
47 class directly with SO_PRIORITY, see socket(7).
48
49 with a tc filter
50 A tc filter attached to the root qdisc can point traffic
51 directly to a class
52
53 with the priomap
54 Based on the packet priority, which in turn is derived from the
55 Type of Service assigned to the packet.
56
57 Only the priomap is specific to this qdisc.
58
60 bands Number of bands. If changed from the default of 3, priomap must
61 be updated as well.
62
63 priomap
64 The priomap maps the priority of a packet to a class. The prior‐
65 ity can either be set directly from userspace, or be derived
66 from the Type of Service of the packet.
67
68 Determines how packet priorities, as assigned by the kernel, map
69 to bands. Mapping occurs based on the TOS octet of the packet,
70 which looks like this:
71
72 0 1 2 3 4 5 6 7
73 +---+---+---+---+---+---+---+---+
74 | | | |
75 |PRECEDENCE | TOS |MBZ|
76 | | | |
77 +---+---+---+---+---+---+---+---+
78
79 The four TOS bits (the 'TOS field') are defined as:
80
81 Binary Decimal Meaning
82 -----------------------------------------
83 1000 8 Minimize delay (md)
84 0100 4 Maximize throughput (mt)
85 0010 2 Maximize reliability (mr)
86 0001 1 Minimize monetary cost (mmc)
87 0000 0 Normal Service
88
89 As there is 1 bit to the right of these four bits, the actual
90 value of the TOS field is double the value of the TOS bits. Tcp‐
91 dump -v -v shows you the value of the entire TOS field, not just
92 the four bits. It is the value you see in the first column of
93 this table:
94
95 TOS Bits Means Linux Priority Band
96 ------------------------------------------------------------
97 0x0 0 Normal Service 0 Best Effort 1
98 0x2 1 Minimize Monetary Cost 1 Filler 2
99 0x4 2 Maximize Reliability 0 Best Effort 1
100 0x6 3 mmc+mr 0 Best Effort 1
101 0x8 4 Maximize Throughput 2 Bulk 2
102 0xa 5 mmc+mt 2 Bulk 2
103 0xc 6 mr+mt 2 Bulk 2
104 0xe 7 mmc+mr+mt 2 Bulk 2
105 0x10 8 Minimize Delay 6 Interactive 0
106 0x12 9 mmc+md 6 Interactive 0
107 0x14 10 mr+md 6 Interactive 0
108 0x16 11 mmc+mr+md 6 Interactive 0
109 0x18 12 mt+md 4 Int. Bulk 1
110 0x1a 13 mmc+mt+md 4 Int. Bulk 1
111 0x1c 14 mr+mt+md 4 Int. Bulk 1
112 0x1e 15 mmc+mr+mt+md 4 Int. Bulk 1
113
114 The second column contains the value of the relevant four TOS
115 bits, followed by their translated meaning. For example, 15
116 stands for a packet wanting Minimal Monetary Cost, Maximum Reli‐
117 ability, Maximum Throughput AND Minimum Delay.
118
119 The fourth column lists the way the Linux kernel interprets the
120 TOS bits, by showing to which Priority they are mapped.
121
122 The last column shows the result of the default priomap. On the
123 command line, the default priomap looks like this:
124
125 1, 2, 2, 2, 1, 2, 0, 0 , 1, 1, 1, 1, 1, 1, 1, 1
126
127 This means that priority 4, for example, gets mapped to band
128 number 1. The priomap also allows you to list higher priorities
129 (> 7) which do not correspond to TOS mappings, but which are set
130 by other means.
131
132 This table from RFC 1349 (read it for more details) explains how
133 applications might very well set their TOS bits:
134
135 TELNET 1000 (minimize delay)
136 FTP
137 Control 1000 (minimize delay)
138 Data 0100 (maximize throughput)
139
140 TFTP 1000 (minimize delay)
141
142 SMTP
143 Command phase 1000 (minimize delay)
144 DATA phase 0100 (maximize throughput)
145
146 Domain Name Service
147 UDP Query 1000 (minimize delay)
148 TCP Query 0000
149 Zone Transfer 0100 (maximize throughput)
150
151 NNTP 0001 (minimize monetary cost)
152
153 ICMP
154 Errors 0000
155 Requests 0000 (mostly)
156 Responses <same as request> (mostly)
157
158
159
161 PRIO classes cannot be configured further - they are automatically cre‐
162 ated when the PRIO qdisc is attached. Each class however can contain
163 yet a further qdisc.
164
165
167 Large amounts of traffic in the lower bands can cause starvation of
168 higher bands. Can be prevented by attaching a shaper (for example, tc-
169 tbf(8) to these bands to make sure they cannot dominate the link.
170
171
173 Alexey N. Kuznetsov, <kuznet@ms2.inr.ac.ru>, J Hadi Salim
174 <hadi@cyberus.ca>. This manpage maintained by bert hubert <ahu@ds9a.nl>
175
176
177
178
179
180iproute2 16 December 2001 PRIO(8)