All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steffen Moser <lists@steffen-moser.de>
To: lartc@vger.kernel.org
Subject: Re: [LARTC] Please check the follow script for diffserv
Date: Thu, 07 Aug 2003 12:42:00 +0000	[thread overview]
Message-ID: <marc-lartc-106026007205492@msgid-missing> (raw)
In-Reply-To: <marc-lartc-106024505223878@msgid-missing>

Hi,

* On Thu, Aug 07, 2003 at 04:29 PM (+0800), anzp wrote:

> My linux host has two 100M eth device, but I want to limit it's 
> bandwidth to 1M for experiments. Then allocate 150k to EF flow, 
> 500k to best effort flow.
>
> The script is fllowing:
> -------------------------------------
>  #/bin/sh
> 
> DEV="dev eth0"
> echo $DEV
> TC="/usr/src/redhat/SOURCES/iproute2-2.4.7src/iproute2/tc/tc"
> $TC qdisc add $DEV handle 1:0 root dsmark indices 64 set_tc_index
> $TC filter add $DEV parent 1:0 protocol ip prio 1 tcindex mask 0xfc shift 2
> $TC qdisc add $DEV parent 1:0 handle 2:0 cbq bandwidth 1Mbit cell 8 avpkt 1000 mpu 64

Here, you should specify the physical bandwidth of your underlaying
device (eth0), i.e. 100Mbit. You can't slow down the device at this
position.

> $TC class add $DEV parent 2:0 classid 2:1 cbq bandwidth 1Mbit rate 150Kbit avpkt 500 prio 1 bounded isolated allot 1514 weight 1 max
> burst 10 
> $TC qdisc add $DEV parent 2:1 pfifo limit 5
> $TC filter add $DEV parent 2:0 protocol ip prio 1 handle 0x2e tcindex classid 2:1 pass_on
> #BE class(2:2) 
> $TC class add $DEV parent 2:0 classid 2:2 cbq bandwidth 1Mbit rate 500Kbit avpkt 1000 prio 7 allot 1514 weight 1 maxburst 21 borrow 
> split 2:0 defmap 0xffff 
> $TC qdisc add $DEV parent 2:2 red limit 10KB min 1KB max 8KB burst 4 avpkt 1000 bandwidth 1Mbit probability 0.4
> $TC filter add $DEV parent 2:0 protocol ip prio 2 handle 0 tcindex mask 0 classid 2:2 pass_on
> --------------------------------------------------------------
> 
> But I can download file from it with 40M speed. Why the limit is invalid?

Altough you set a maximum rate of 500Kbit for the BE class, this class
borrowed additional bandwidth, of course, not from your EF class (which
is isolated), but from the parent qdisc, which offers 100Mbit (because 
the underlaying device offers that much).

But, if changing the keyword "borrow" to "bounded" within your BE class,
the BE class would only be using 500Kbit, even if the EF class is empty. 

So, I've added one more class to your script - so my resulting script is:

  ---8<------8<------8<------8<------8<------8<------8<------8<---

  # Deleting old root qdisc 
  #
  $TC qdisc del $DEV root

  # Setting up DSMARK qdisc to copy DSCP to "skb->tc_index"
  #
  $TC qdisc add $DEV handle 1:0 root dsmark indices 64 set_tc_index

  # Setting up filter to mask out ECN bits and to extract DSCP
  #
  $TC filter add $DEV parent 1:0 protocol ip prio 1 tcindex mask 0xfc shift 2

  # Setting up inner CBQ disc
  #
  $TC qdisc add $DEV parent 1:0 handle 2:0 cbq bandwidth 100Mbit cell 8 avpkt 1000 mpu 64

    # Setting up a new class to restrict over all bandwidth to 1Mbit
    #
    $TC class add $DEV parent 2:0 classid 2:1 cbq bandwidth 100Mbit rate 1Mbit avpkt 1000 \ 
    prio 1 bounded isolated allot 1514 weight 1 maxburst 21

       # EF class (2:2)
       #
       $TC class add $DEV parent 2:1 classid 2:2 cbq bandwidth 1Mbit rate 150Kbit avpkt 500 \ 
       prio 1 bounded isolated allot 1514 weight 1 maxburst 10

          # Packets within EF class are stored in a simple classless PFIFO qdisc
          #
          $TC qdisc add $DEV parent 2:2 pfifo limit 5

    # Adding filter
    #
    $TC filter add $DEV parent 2:0 protocol ip prio 1 handle 0x2e tcindex classid 2:2 pass_on

       # BE class (2:3)
       #
       $TC class add $DEV parent 2:1 classid 2:3 cbq bandwidth 1Mbit rate 500Kbit avpkt 1000 \
       prio 7 allot 1514 weight 1 maxburst 21 borrow split 2:1 defmap 0xffff

          # Packets within BE class are stored in a classless RED qdisc
          #
          $TC qdisc add $DEV parent 2:3 red limit 10KB min 1KB max 8KB burst 4 avpkt 1000 \ 
          bandwidth 1Mbit probability 0.4

    # Adding filter
    #
    $TC filter add $DEV parent 2:0 protocol ip prio 2 handle 0 tcindex mask 0 classid 2:3 pass_on

---8<------8<------8<------8<------8<------8<------8<------8<---


I don't know if this way is the smartest one. But, I think it may be
able to help you with your Diffserv configuration. I hope that one 
of the tc gurus will correct me if I am totally wrong. 

Best regards,
Steffen
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

  reply	other threads:[~2003-08-07 12:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-07  8:29 [LARTC] Please check the follow script for diffserv anzp
2003-08-07 12:42 ` Steffen Moser [this message]
2003-08-07 16:45 ` Stef Coene
2003-08-14  9:13 ` Raghuveer
2003-08-14 13:41 ` Martin A. Brown
2003-08-15 10:02 ` Steffen Moser
2003-08-18 11:16 ` Raghuveer
2003-08-18 23:41 ` Damion de Soto
2003-08-19  9:42 ` Steffen Moser
2003-08-19 10:23 ` Raghuveer
2003-08-20  0:24 ` Damion de Soto
2003-08-20  6:36 ` Raghuveer
2003-08-20 19:30 ` Martin A. Brown
2003-08-21  5:11 ` Raghuveer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=marc-lartc-106026007205492@msgid-missing \
    --to=lists@steffen-moser.de \
    --cc=lartc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.