Previous

Content

Next 


3.9. ef-prio

 

The example's script is as follows:

#!/bin/bash

tc qdisc add dev eth1 handle 1:0 root dsmark indices 64 set_tc_index
tc filter add dev eth1 parent 1:0 protocol ip prio 1 tcindex mask 0xfc shift 2
tc qdisc add dev eth1 parent 1:0 handle 2:0 prio
tc qdisc add dev eth1 parent 2:1 tbf rate 1.5Mbit burst 1.5kB limit 1.6kB
tc filter add dev eth1 parent 2:0 protocol ip prio 1 handle 0x2e tcindex \
classid 2:1 pass_on

#BE class(2:2)
tc qdisc add dev eth1 parent 2:2 red limit 60KB min 15KB max 45KB burst 20 \
avpkt 1000 bandwidth 10Mbit probability 0.4
tc filter add dev eth1 parent 2:0 protocol ip prio 2 handle 0 tcindex mask 0 \
classid 2:2 pass_on

This is a very simple implementation of the Expedited Forwarding (EF) class using a priority queuing discipline. To begin with a dsmark queuing discipline is configured. Dsmark will be in charge of copying the DS field from entering packets to the skb->tc_index field. The dsmark's main filter reads this value and applies over it the bitwise operation DS & 0xfc >> 2. This operation returns back the class value 0x2e for packets marked as EF, this means, having the DS field set to 0xb8 when entering the discipline. This class id value is then copied back onto the skb->tc_index field by the dsmark queuing discipline.
 
A prio queuing discipline is configured having as parent the dsmark queuing discipline. The prio 2:0 queuing discipline has three classes by default: class 2:1, class 2:2 and class 2:3. The first class, class 2:1, is selected to place on it the packets belonging to the DS EF class. Because these packets, having the skb->tc_index field set to 0x2e are matched against the first classifier element (prio 1 handle 0x2e), the class id 2:1 is returned and the packets are finally placed on it.
 
In the prio class 2:1 a tbf queuing discipline is configured. This queuing discipline is necessary to control the maximum throughput for EF traffic going through class 2:1, avoiding this way to starve low priority traffic going through classes 2:2 and following. Do not forget that class 2:1 will be served with priority as long as there are packets on it. The tbf queuing discipline is set for allowing a maximum of 1.5 Mbps of EF traffic.
 
Best effort packets are matched with the second classifier element (prio 2 handle 0), being then assigned to prio class 2:2. On this class a red queuing discipline is configured. Red is the best solution for BE traffic not subjugated to any kind of additional preemptive queuing control. It avoids phase effects, allows moderate bursting, doesn't impose any bias to well behaved flows and is as fair as is possible when dropping packets is a necessity. Have a look to Red queuing discipline for more information about this.
 
What are we implementing with this scheme?  Just a simple way for EF packets to kick them out as soon as is possible from the router to avoiding them to loss their time traveling through it. This scheme is normally used for real-time traffic where any delay in the transmission time affect the behavior quality. Have a look to Voice over IP to see a practical example using this type of configuration.
 
Well, dear lectors. We are ready here. Our next scheme will be efcbq but using htb instead.
 
   

 


   


Previous

Content

Next