Ireneusz Szcześniak wrote:
I have a problem understanding nested classes in tc (traffic control). To introduce the problem, I briefly describe how I think the tc works. There are qdiscs, classes and filters. A qdisc can have classes, and filters configured for this qdisc classify packets. When a packet is enqueue to a qdisc, filters decide which class the packet belongs to, i.e. filters classify packets. Each class has a qdisc, by default the pfifo class, and so classifying implies enqueing a packet in the queue of class the packet was classified to.
The detail will vary with different qdiscs - for htb only the leaf classes get pfifo by default.
Therefore I would claim that a class cannot have another class as a child, because the child should be a qdisc. However, Example 1 shows that I'm wrong. Example 1 --------- tc qdisc add dev eth0 root handle 1:0 htb tc class add dev eth0 parent 1:0 classid 1:1 htb rate 10mbit tc class add dev eth0 parent 1:1 classid 1:2 htb rate 1mbit In this example class 1:1 is a parent of both classes 1:2 and 1:3. QUESTION 1: Does class 1:1 have a queue?
As above - no because it's not a leaf class.
Example 2 implements the same functionality as Example 1, I think. Example 2 --------- tc qdisc add dev eth0 root handle 1:0 htb tc class add dev eth0 parent 1:0 classid 1:1 htb rate 10mbit tc qdisc add dev eth0 parent 1:1 handle 2:0 htb tc class add dev eth0 parent 2:0 classid 2:1 htb rate 1mbit QUESTION 2: Is there a difference between Example 1 and Example 2?
Yes, see section 6 http://luxik.cdi.cz/~devik/qos/htb/manual/userg.htm
QUESTION 3: What is "-d" for in "tc -s -d qdisc"
More detail? Well that's what it does.
QUESTION 4: How can I view the statistics for default queues of classes, those pfifo queues? "tc -s qdisc" doesn't show them.
I don't think you can. It's best to specify anyway, then you get to choose the length. By default it's picked from qlen on the if - so probably too long on eth and too short on ppp.
QUESTION 5: Why in filters there is used "flowid" instead of "parent"?
You can use flowid or classid this is the value you are setting for packets that match the filter. Parent is something different it is where the filter is attached to, usually the classid/flowid of root but you can nest filters.
-- To unsubscribe from this list: send the line "unsubscribe lartc" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html