<div>
<dt>IMHO, the priomap explanation in the <a name="114b0df346af1e8f_AEN664">9.2.1.1. </a>of the LARTC HOWTO is not clear enough. I only understood it's real behavior until I read this document from Russell Stuart:</dt>
<dt><a href="http://ace-host.stuart.id.au/russell/files/tc/doc/tc/priority.txt">http://ace-host.stuart.id.au/russell/files/tc/doc/tc/priority.txt</a></dt>
<dt>So, based in this information, I've prepared an alternative priomap explanation for this section of the HOWTO, if you like it as it is I could try to do the modifications to the .db file. If not, just take what you want from it or forget it... It is possibly full plenty of techical mistakes and also linux-centered, as long as I have no idea how this goes on other operating systems. I'm not a professional, so please don't be hard with the criticism...
</dt></div>
<div>
<dt> </dt>
<dt>priomap</dt></div>
<div> </div>
<div>Determines how packet priorities, as assigned by the kernel, map to bands. <br><br>The kernel assigns a generic priority to every packet which enters or is generated in the machine, this priority is an 8-bit integer, and higher value means higher priority. The priomap defines how all the 16 possible values of the linux priority are mapped to the bands.
<br><br>For example, on the command line, the default priomap looks like this; <font face="courier new,monospace"><font face="courier new,monospace">1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1</font>. </font>This means the following mapping:
<br><br><span style="FONT-FAMILY: courier new,monospace">Linux priority Default Band (priomap)</span><br style="FONT-FAMILY: courier new,monospace"><span style="FONT-FAMILY: courier new,monospace">-------------- ----------------------
</span><br style="FONT-FAMILY: courier new,monospace"><span style="FONT-FAMILY: courier new,monospace">0 (</span><font style="FONT-FAMILY: courier new,monospace" face="courier new,monospace">Best Effort) 1</font> <br style="FONT-FAMILY: courier new,monospace">
<span style="FONT-FAMILY: courier new,monospace">1 (</span><font style="FONT-FAMILY: courier new,monospace" face="courier new,monospace">Filler) 2</font><br style="FONT-FAMILY: courier new,monospace"><span style="FONT-FAMILY: courier new,monospace">
2 2</span><br style="FONT-FAMILY: courier new,monospace"><span style="FONT-FAMILY: courier new,monospace">3 (</span><font style="FONT-FAMILY: courier new,monospace" face="courier new,monospace">Bulk) 2
</font><br style="FONT-FAMILY: courier new,monospace"><span style="FONT-FAMILY: courier new,monospace">4 (</span><font style="FONT-FAMILY: courier new,monospace" face="courier new,monospace">Interactive Bulk) 1</font><br style="FONT-FAMILY: courier new,monospace">
<span style="FONT-FAMILY: courier new,monospace">5 2</span><br style="FONT-FAMILY: courier new,monospace"><span style="FONT-FAMILY: courier new,monospace">6 (</span><font style="FONT-FAMILY: courier new,monospace" face="courier new,monospace">
Interactive) 0</font><br style="FONT-FAMILY: courier new,monospace"><span style="FONT-FAMILY: courier new,monospace">7 0</span><br style="FONT-FAMILY: courier new,monospace"><span style="FONT-FAMILY: courier new,monospace">
8 1</span><br style="FONT-FAMILY: courier new,monospace"><span style="FONT-FAMILY: courier new,monospace">9 1</span><br style="FONT-FAMILY: courier new,monospace"><span style="FONT-FAMILY: courier new,monospace">
10 1</span><br style="FONT-FAMILY: courier new,monospace"><span style="FONT-FAMILY: courier new,monospace">11 1</span><br style="FONT-FAMILY: courier new,monospace"><span style="FONT-FAMILY: courier new,monospace">
12 1</span><br style="FONT-FAMILY: courier new,monospace"><span style="FONT-FAMILY: courier new,monospace">13 1</span><br style="FONT-FAMILY: courier new,monospace"><span style="FONT-FAMILY: courier new,monospace">
14 1</span><br style="FONT-FAMILY: courier new,monospace"><span style="FONT-FAMILY: courier new,monospace">15 1</span><br style="FONT-FAMILY: courier new,monospace"><br>Some of the linux priority values have a symbolic name, but on the table above only five of them are shown. For IPv4 packets we will only care about the bands assigned to those five named values. This is beacause for packets using this protocol, the priority is assigned based on the ToS octet of the packet, which looks like this:
<br><br><font face="courier new,monospace"> 0 1 2 3 4 5 6 7<br>+-----+-----+-----+-----+-----+-----+-----+-----+<br>| | | |<br>| PRECEDENCE | ToS | MBZ |
<br>| | | |<br>+-----+-----+-----+-----+-----+-----+-----+-----+<br><br></font>The four ToS bits (the 'ToS field') are defined as: <br><br><font face="courier new,monospace">
Binary Decimal Meaning<br>-----------------------------------------<br>1000 8 Minimize delay (md)<br>0100 4 Maximize throughput (mt) <br>0010 2 Maximize reliability (mr) <br>0001 1 Minimize monetary cost (mmc)
<br>0000 0 Normal Service<br></font><br>As the MBZ must be zero, 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 the following table, which shows how the ToS values are mapped to the five linux priority values mentioned above:
<br><font face="courier new,monospace"><br>ToS Bits Means Linux Priority<br>------------------------------------------------------<br>0x0 0 Normal Service 0 (Best Effort) <br>0x2 1 Minimize Monetary Cost 1 (Filler)
<br>0x4 2 Maximize Reliability 0 (Best Effort)<br>0x6 3 mmc+mr 0 (Best Effort) <br>0x8 4 Maximize Throughput 2 (Bulk<font face="Courier New">)</font> <br>0xa 5 mmc+mt 2
<font face="Courier New">(</font>Bulk<font face="Courier New">)</font></font></div>
<div><font face="courier new,monospace">0xc 6 mr+mt 2 <font face="Courier New">(</font>Bulk)<br>0xe 7 mmc+mr+mt 2 <font face="Courier New">(</font>Bulk)<br>0x10 8 Minimize Delay 6
<font face="Courier New">(</font>Interactive)<br>0x12 9 mmc+md 6 <font face="Courier New">(</font>Interactive)<br>0x14 10 mr+md 6 <font face="Courier New">(</font>Interactive)
<br>0x16 11 mmc+mr+md 6 <font face="Courier New">(</font>Interactive) <br>0x18 12 mt+md 4 <font face="Courier New">(</font>Int. Bulk)<br>0x1a 13 mmc+mt+md 4
<font face="Courier New">(</font>Int. Bulk)<br>0x1c 14 mr+mt+md 4 <font face="Courier New">(</font>Int. Bulk)<br>0x1e 15 mmc+mr+mt+md 4 <font face="Courier New">(</font>Int. Bulk)<br>
</font><br>This mapping is hard-coded and can not be adjusted, only the default priomap can be changed, to clarify, the whole process for an IPv4 packet would be:<br><br><font face="courier new,monospace">ToS value ------mapping------> Linux Priority ------priomap ------> Band
</font></div>
<p><font face="">A few extra comments:</font></p>
<ul>
<li>The ToS-to-Linux_Priority mapping is made at the very beggining of the routing process, even before the packet enters in the iptables chains. This means that changing the ToS field of the packet with iptable's <span style="FONT-FAMILY: courier new,monospace">
<font face="courier new,monospace">"-j TOS --set-tos"</font></span> flags, will not change neither its linux priority nor the band it will be assigned to. </li>
<li>Also notice that this mapping is not one-to-one, for expample, by only adjusting the priomap, it is impossible to assign a packet with ToS value 0x00 (Normal Service), to a different band than a packet with ToS 0x02 (Maximize reliability), as both values are mapped to linux priority 0
<font face="">(Best Effort).</font></li>
<li><font face="">At the moment of writing this, the ToS octet of the IPv4 protocol has been superseded by the Diffserv Code Point. But the default linux priority mapping, and most common applications (ssh, ftp servers, etc...) are still using the ToS scheme, however, this may change in the future.
</font></li></ul>