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