# Traffic shaping using pfifo_fast

## dE_logics

On trying to understand the behavior, I'm stumped with man tc-prio. It contradicts itself all the time. So I'ld like to clarify.

First of all, this datagram in the man page -- 

```

              0   1   2   3   4   5   6   7

              +---+---+---+---+---+---+---+---+

              |           |               |   |

              |PRECEDENCE |      TOS      |MBZ|

              |           |               |   |

              +---+---+---+---+---+---+---+---+

```

Has not been seen in ANY RFC. First the author says -- 

"Mapping occurs based on the TOS octet of the packet, which looks like this:"

i.e. he admits that the whole datagram above (an octet)is the TOS field, then marks the middle most 4 bits as the TOS   :Confused: 

Then he says -- 

 *Quote:*   

> 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.

 ]

What is MBZ? Is it always 1?  Why is it even checked by the qdisc? Since the author claims that only his TOS filed (4 bits) is checked as in this table -- 

```
              TOS     Bits  Means                    Linux Priority    Band

              ------------------------------------------------------------

              0x0     0     Normal Service           0 Best Effort     1

              0x2     1     Minimize Monetary Cost   1 Filler          2

              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
```

What is this TOS and 'bits'? How is it's value computed?

And finally, when I try and change the RFC TOS field using iptables -j TOS (i.e. the 8 bit field), will it alter the whole 8 bit TOS field or this 4 bit TOS field?

Now for ktorrent. In this client, you can set the value of the DS field. Is this the same 6 bit DS field (successor of the 8 bit RFC TOS field), or something else?

----------

## PaulBredbury

 *dE_logics wrote:*   

> What is this TOS and 'bits'?

 

More info here.

I'd say ignore TOS - I've never heard of it being worthwhile, while investigating traffic shaping. I expect that ISPs ignore those flags.

 *Quote:*   

> DS field

 

Never heard of it.

----------

## dE_logics

I did some investigation and found this related to RFC 1349; although outdated by DS (differentiated services), this still applies to the qdisc pfifo_fast, which I'm trying to configure in this case (i.e. I'm not expecting the ISP to do anything).

Also the TOS field appears to be internal numbers which the TOS jump target of iptables appears to accept.

That link is based on class based queues which will take too much time to configure, with maybe similar results.

----------

