[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

question on classifying flows, usage of tc, etc.

Thanks to Giacomo for helping me throught the filter problem.
Now I want to do the following test. I want to differentiate
flows based on the TOS field. I have a 100Mbit network
testing environment, so I allocate bandwidth to 4 kinds of flows:
MinDelay, MaxThroughput, Reliable, and MinCost. 
I want to assign 5M, 3M, 2M, and 90M to them respectively,
so I do the following tc assignments:

# tc qdisc add dev eth0 root handle 1: cbq bandwidth 100Mbit \
 allot 1514 cell 8 avpkt 1000 mpu 64
# tc class add dev eth0 parent 1:0 classid 1:1 cbq bandwidth 100Mbit \
 rate 100Mbit allot 1514 cell 8 weight 1Mbit prio 8 maxburst 20 avpkt 1000

# tc class add dev eth0 parent 1:1 classid 1:2 cbq bandwidth 100Mbit \
 rate 5Mbit allot 1514 cell 8 weight 50Kbit prio 3 maxburst 20 \
 avpkt 1000 bounded isolated
... (allocate class 1:3-5 correspondingly)

now filters

# tc filter add dev eth0 parent 1:1 protocol ip prio 3 handle 1: u32
# tc filter add dev eth0 parent 1:1 prio 3 u32 match ip tos 0x10 0xff \
  classid 1:2
# ... (define filters for 1:3-5 correspondingly).

Is this correct?
I've done some test on it, it seems that packets from class 2 (1:3)
get dropped while packets from class 3 (1:4) are not dropped.
This is not expected because I'm assuming 3Mbit of bandwidth
is assigned to class 2 and 2Mbit is assigned to class 3.

Thanks in advance.