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

Traffic Control: 'bounded' and 'isolated' keyword problems.



Title: Traffic Control: 'bounded' and 'isolated' keyword problems.

Hi,

I'm still plugging away with TC, trying to get it to do what I want.  What I want to do is illustrated in the diagram below.  I have a cbq qdisc, which has its bandwidth defined as 3.3mbit.  Inside I define three cbq classes, each with a rate of 1.1mbit.  They are defined as bounded (so they should only tolerate a maximum of 1.1mbit), and isolated (so they won't loan their BW to any other classes).  Each of these classes has a subclass of type cbq, and a rate of 1mbit.  The script I use ('ep') to set up the filtering is included (I call it as 'ep start eth3 1mbit').

       +---1:0 3.3mbit------------------------------------+
       |                                                  |
       |+--1:1 1.1mbit-+ +--1:2 1.1mbit-+ +--1:3 1.1mbit-+|
       ||              | |              | |              ||
       ||+-1:10 1mbit-+| |+-1:20 1mbit-+| |+-1:30 1mbit-+||
       |||            || ||            || ||            |||
       |||            || ||            || ||            |||
       |||            || ||            || ||            |||
       |||            || ||            || ||            |||
       |||            || ||            || ||            |||
       ||+------------+| |+------------+| |+------------+||
       ||              | |              | |              ||
       || isolated     | | isolated     | | isolated     ||
       || bounded      | | bounded      | | bounded      ||
       |+--------------+ +--------------+ +--------------+|
       |                                                  |
       +--------------------------------------------------+

In this setup, with two incoming streams of traffic entering into the router at around 7mbit (combined), the streams are each limited to the total bandwidth of the pipe, in this case, around 3.3mbit.  I would have figured the bounded and isolated keywords specified would have limited the egress rate to a 2.2mbit combined maximum (two flows @ 1.1mbit each).  If I put the isolated keyword on the subclasses, then it acts as though there is no rate limiting at all - the egress rate is the same as the ingress rate - around 7mbit.  I've tried with just the 1:1, 1:2 level classes, and I can't limit the amount or location of where they are able to borrow BW from with use of just the bounded and isolated keywords.

Any thoughts as to where I went wrong?

Jon

My start/stop script:

#!/bin/sh
# ep - start/stop egress policing.
#
# Match based on MPLS header contents (1st 20bits) which is the label, in hex.
# Thus 00014000/fffff000 is label 0x14 or 20.

# Tools
TC=/sbin/tc

usage() {
   echo "Usage: $0 <start|stop> <ethX> <policing rate. ie: 1mbit>"
   exit 0
}

# Parameters
ETH=$2
POL=$3
BW=3.3Mbit
SBW=1.1Mbit

# Match label 20 (0x14) in packet (should read MPLS header).
LABEL1='0x00014000 0xfffff000 at 0'
LABEL2='0x00015000 0xfffff000 at 0'

case "$1" in
 start)
   ACTION=add
   ;;
 stop)
   ACTION=del
   ;;
 *)
   usage
   ;;
esac

# Set up the root CBQ
$TC qdisc $ACTION dev $ETH root handle 1: cbq bandwidth $BW \
   cell 8 avpkt 1000 mpu 64

if [ "$ACTION" = "add" ]; then
   echo " Set up the CBQ classes"

   echo " Leaf classes"
   $TC class $ACTION dev $ETH parent 1:0 classid 1:1 cbq \
      bandwidth $BW rate $SBW \
      allot 1514 cell 8 weight 1 prio 1 maxburst 20 avpkt 1000 bounded isolated
   $TC class $ACTION dev $ETH parent 1:1 classid 1:10 cbq \
      bandwidth $SBW rate $POL \
      allot 1514 cell 8 weight 1 prio 1 maxburst 20 avpkt 1000

   $TC class $ACTION dev $ETH parent 1:0 classid 1:2 cbq \
      bandwidth $BW rate $SBW \
      allot 1514 cell 8 weight 1 prio 1 maxburst 20 avpkt 1000 bounded isolated
   $TC class $ACTION dev $ETH parent 1:2 classid 1:20 cbq \
      bandwidth $SBW rate $POL \
      allot 1514 cell 8 weight 1 prio 1 maxburst 20 avpkt 1000

   $TC class $ACTION dev $ETH parent 1:0 classid 1:3 cbq \
      bandwidth $BW rate $SBW \
      allot 1514 cell 8 weight 1 prio 1 maxburst 20 avpkt 1000 bounded isolated
   $TC class $ACTION dev $ETH parent 1:3 classid 1:30 cbq \
      bandwidth $SBW rate $POL \
      allot 1514 cell 8 weight 1 prio 1 maxburst 20 avpkt 1000

   echo " Outbound queues"
   $TC qdisc $ACTION dev $ETH parent 1:10 sfq quantum 1514b perturb 15
   $TC qdisc $ACTION dev $ETH parent 1:20 sfq quantum 1514b perturb 15
   $TC qdisc $ACTION dev $ETH parent 1:30 sfq quantum 1514b perturb 15

   echo " Set up the filters, with label matching and policing."
   $TC filter $ACTION dev $ETH parent 1:0 protocol mpls prio 1 u32 \
      match u32 $LABEL1 flowid 1:10

   $TC filter $ACTION dev $ETH parent 1:0 protocol mpls prio 2 u32 \
      match u32 $LABEL2 flowid 1:20
fi

# Show information.
echo "==== qdiscs ========================================="
$TC -s qdisc
echo "==== classes ========================================"
$TC -s class show dev $ETH
echo "==== filters ========================================"
$TC -s filter show dev $ETH