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

Re: [Linux Diffserv] problem of sch_dsmark



Hi,

* On Sat, Aug 09, 2003 at 12:21 AM (+0800), ince@fudan.edu.cn wrote:

> My script is listed below:
> ####################################################
> #!/bin/bash
> tc qdisc add dev eth1 handle 1:0 root dsmark indices 64
> tc class change dev eth1 classid 1:1 dsmark mask 0x3 value 0xb8
> tc class change dev eth1 classid 1:2 dsmark mask 0x3 value 0x68
> tc class change dev eth1 classid 1:3 dsmark mask 0x3 value 0x48
> tc filter add dev eth1 parent 1:0 protocol ip prio 4 handle 1: u32 divisor 1
> tc filter add dev eth1 parent 1:0 protocol ip prio 5 handle 2: u32 divisor 1
> tc filter add dev eth1 parent 1:0 prio 4 u32 match ip dst 10.15.35.167/32 match ip dport 0x15 0xffff police rate 1Mbit burst 2K continue flowid 1:1
> tc filter add dev eth1 parent 1:0 prio 5 u32 match ip dst 10.15.35.167/32 match ip dport 0x15 0xffff flowid 1:2
> tc filter add dev eth1 parent 1:0 prio 4 u32 match ip dst 10.15.35.167/32 match ip dport 0x17 0xffff flowid 1:3
> 
> echo EF data ...
> tc qdisc add dev eth1 parent 1:1 pfifo limit 5
> echo AF1 data ...
> tc qdisc add dev eth1 parent 1:2 red limit 60KB min
> 15KB max 45KB burst 20 avpkt 1000 bandwidth 10Mbit
> probability 0.4
> echo AF2 data ...
> tc qdisc add dev eth1 parent 1:3 red limit 60KB min
> 5KB max 30KB burst 20 avpkt 1000 bandwidth 10Mbit
> probability 0.4
> ####################################################
> 
> When I ran the script,I got such messge:
> "EF data ...
> AF1 data ...
> RTNETLINK answers: File exists
> AF2 data ...
> RTNETLINK answers: File exists "

It seems that you cannot add more than one inner qdisc within the DSMARK
qdisc. So it seems you can't add inner qdiscs (like PFIFO or RED) to the
classes of DSMARK.

But, I think, you can try to add a class based queue (e.g. PRIO, CBQ or
HTB) as a child to your DSMARK qdisc, e.g.:

  $TC qdisc add dev eth0 handle 1:0 root dsmark indices 64
    $TC class change dev eth0 classid 1:1 dsmark mask 0x3 value 0xb8
    $TC class change dev eth0 classid 1:2 dsmark mask 0x3 value 0x68
    $TC class change dev eth0 classid 1:3 dsmark mask 0x3 value 0x48

  $TC filter add dev eth0 parent 1:0 protocol ip prio 4 handle 1: u32 divisor 1
  $TC filter add dev eth0 parent 1:0 protocol ip prio 5 handle 2: u32 divisor 1
  $TC filter add dev eth0 parent 1:0 prio 4 u32 \ 
      match ip dst 10.15.35.167/32 \ 
      match ip dport 0x15 0xffff \ 
      police rate 1Mbit burst 2K continue flowid 1:1 
  $TC filter add dev eth0 parent 1:0 prio 5 u32 \ 
      match ip dst 10.15.35.167/32 \
      match ip dport 0x15 0xffff flowid 1:2
  $TC filter add dev eth0 parent 1:0 prio 4 u32 \ 
      match ip dst 10.15.35.167/32 \
      match ip dport 0x17 0xffff flowid 1:3

  $TC qdisc add dev eth0 parent 1:0 handle 2:0 cbq bandwidth 100Mbit \
      allot 1514 cell 8 avpkt 1000 mpu 64

     echo EF data ...
     $TC class add dev eth0 parent 2:0 classid 2:1 cbq bandwidth 100Mbit rate 1500Kbit \
         avpkt 1000 prio 1 bounded isolated allot 1514 weight 1 maxburst 10 defmap 1

     $TC qdisc add dev eth0 parent 2:1 pfifo limit 5

     echo AF1 data ...
     $TC class add dev eth0 parent 2:0 classid 2:2 cbq bandwidth 100Mbit rate 5Mbit \ 
         avpkt 1000 prio 7 allot 1514 weight 1 maxburst 21 borrow
     $TC qdisc add dev eth0 parent 2:2 red limit 60KB min 15KB max 45KB burst 20 \ 
         avpkt 1000 bandwidth 10Mbit probability 0.4

     echo AF2 data ...
     $TC class add dev eth0 parent 2:0 classid 2:3 cbq bandwidth 100Mbit rate 5Mbit \ 
         avpkt 1000 prio 8 allot 1514 weight 1 maxburst 21 borrow
     $TC qdisc add dev eth0 parent 2:3 red limit 60KB min 5KB max 30KB burst 20 \
         avpkt 1000 bandwidth 10Mbit probability 0.4

   $TC filter add dev eth0 parent 2:0 protocol ip prio 4 handle 1: u32 divisor 1
   $TC filter add dev eth0 parent 2:0 protocol ip prio 5 handle 2: u32 divisor 1
   $TC filter add dev eth0 parent 2:0 prio 4 u32 \
       match ip dst 10.15.35.167/32 \
       match ip dport 0x15 0xffff 
       police rate 1Mbit burst 2K continue flowid 2:1
   $TC filter add dev eth0 parent 2:0 prio 5 u32 
       match ip dst 10.15.35.167/32 \
       match ip dport 0x15 0xffff flowid 2:2
   $TC filter add dev eth0 parent 2:0 prio 4 u32 \
       match ip dst 10.15.35.167/32 \
       match ip dport 0x17 0xffff flowid 2:3


I suppose that it is also possible to use the class based qdisc PRIO
instead of CBQ (PRIO should also make use of the filters if there 
exist some).

I don't really know if you need to classify your packets a second time,
that means, I don't know, if it's possible to use the TCINDEX classifier
to decide whether to put the packets to 2:1, 2:2 or 2:3, e.g. having:

   $TC filter add dev eth0 parent 2:0 protocol ip handle 1 tcindex classid 2:1 pass_on
   $TC filter add dev eth0 parent 2:0 protocol ip handle 2 tcindex classid 2:2 pass_on
   $TC filter add dev eth0 parent 2:0 protocol ip handle 3 tcindex classid 2:3 pass_on 

instead of the second filtering:

   $TC filter add dev eth0 parent 2:0 protocol ip prio 4 handle 1: u32 divisor 1
   $TC filter add dev eth0 parent 2:0 protocol ip prio 5 handle 2: u32 divisor 1
   $TC filter add dev eth0 parent 2:0 prio 4 u32 \
       match ip dst 10.15.35.167/32 \
       match ip dport 0x15 0xffff
       police rate 1Mbit burst 2K continue flowid 2:1
   $TC filter add dev eth0 parent 2:0 prio 5 u32
       match ip dst 10.15.35.167/32 \
       match ip dport 0x15 0xffff flowid 2:2
   $TC filter add dev eth0 parent 2:0 prio 4 u32 \
       match ip dst 10.15.35.167/32 \
       match ip dport 0x17 0xffff flowid 2:3


> And when I typed the command "tc qdisc ls dev eth1"
> to see the qdisc information,only the "dsmark" qdisc
> and "pfifo" qdisc are configured,missing the "red"
> qdisc:
> "qdisc pfifo 800b: limit 5p
> qdisc dsmark 1: indices 0x0040 "
> 
> What's wrong with my script and how can I correct my
> script to meet my ends. 

Yes, as stated above, it seems that you can't add qdiscs to each class
of DSMARK. You can also have a look at figure 12 of:

  ftp://icaftp.epfl.ch/pub/linux/diffserv/misc/dsid-01.ps.gz

So I think, you have to add another class based queue (e.g. PRIO, CBQ,
HTB) instaed of the default FIFO within DSMARK.

> Waiting for your reply...Thank you.

I hope that I could help you!

See also:

  http://sourceforge.net/mailarchive/forum.php?thread_id=1913231&forum_id=2058

Bye,
Steffen


-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
Diffserv-general mailing list
Diffserv-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/diffserv-general