Skip to contentSkip to conversation

GRED queues in Diffserv

LARTC Amit Kucheria 2 participants 2 messages Jun 10, 2002 – Jun 11, 2002

lore
Share & tools
lore
#0 lore raw

Hi all,

I am setting up a Diffserv router. Part of the script that I use it as follows:

---------------------------------------------------
sudo /usr/bin/tc qdisc add dev r1p4 handle 1:0 root dsmark indices 64 set_tc_index

sudo /usr/bin/tc filter add dev r1p4 parent 1:0 protocol ip prio 1 tcindex mask 0xfc shift 2 pass_on

sudo /usr/bin/tc qdisc add dev r1p4 parent 1:0 handle 2:0 cbq bandwidth 10Mbit allot 1514 cell 8 avpkt 1456 mpu 64

sudo /usr/bin/tc filter add dev r1p4 parent 2:0 protocol ip prio 1 tcindex mask 0xf0 shift 4 pass_on

sudo /usr/bin/tc class add dev r1p4 parent 2:0 classid 2:1 cbq bandwidth 10Mbit rate 6Mbit avpkt 1456 prio 5 bounded allot 1514 weight 600Kbit maxburst 21

sudo /usr/bin/tc filter add dev r1p4 parent 2:0 protocol ip prio 1 handle 1 tcindex classid 2:1

sudo /usr/bin/tc qdisc add dev r1p4 parent 2:1 gred setup DPs 3 default 2 grio
---------------------------------------------------

This last line where I setup the gred qdisc shows a message in the logs as "NO GRED Queues setup! ". Can anybody comment on what this could mean? I am using 2.2.18 with a Diffserv patch.

TIA,
Amit

PS.The remainin lines of the script include creating 3 gred qdiscs, setting their limits and creating another CBQ class (2:2) for un(ds)marked traffic.

Signature · 13 lines
I'm an angel!!! Honest!
The horns are just there to hold the halo up straight.
^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^
                  Amit Kucheria
          EECS Grad. Research Assistant
         University of Kansas @ Lawrence
   (R): +1-785-830-8521 ||| (C): +1-785-760-2871
____________________________________________________


_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
#1 lore raw

Hi Amit,

Quoted 8 lines · Amit Kucheria

sudo /usr/bin/tc qdisc add dev r1p4 parent 2:1 gred setup DPs 3 default 2 grio
---------------------------------------------------

This last line where I setup the gred qdisc shows a message in the logs as "NO GRED Queues setup! ". Can anybody comment on what this could mean? I am using 2.2.18 with a Diffserv patch.

Quoted 6 lines

TIA,
Amit

PS.The remainin lines of the script include creating 3 gred qdiscs, setting their limits and creating another CBQ class (2:2) for un(ds)marked traffic.

Same thing here. I looked into sch_gred.c and it looks like gred complains about the lack of DP entries in the table as soon as you issue the gred setup command. I didn't succeed in defining the virtual queues before I issue the gred setup command, so I decided to live with the log message.

Perhaps there is a better way to do it, but honestly I doubt it - and, hey, Almesberger uses the same approach in his tcng example script, so at least it can't be complete nonsense. :)

Kurt

P.S.: attached is my way of doing it - produces the log message, but works...

#!/bin/sh
#
# author: Kurt Wagner, [email protected]

# last changed: 25.04.02 
#
# Script to setup GRED
#
# Gred uses the 4 least sig. bits of skb->tc_index to map packets to
# virtual queues (DP, which stands for drop precedence). This script 
# setups 4 virtual queues, packets with tc_index = 0x01 are mapped 
# to DP1, 0x02 to DP2 and so on. 
# 
# The ECN bits (least sig. 2 bits of DS field) are masked out and
# most apps are only able to set a value for the whole DS field (if
# at all), so be carefull which DS field values you choose. 
# 
# e.g.: 
# 
# | DS field | tc_index | DP |
# +----------+----------+----+
# |   0x04   |   0x01   |  1 |
# |   0x08   |   0x02   |  2 |
# |   0x0C   |   0x03   |  3 |
# |   0x10   |   0x04   |  4 |
#

DEV="eth1"

function usage
{
echo "Usage:" basename $0 "COMMAND"
echo "where COMMAND := { start | stop | status }" exit 1
}

if [ $# = 0 ]; then usage ; fi

case "$1" in
start)

  # add the dsmarker as root and copys DS field to skb->tc_index
  tc qdisc add dev $DEV handle 1:0 root dsmark indices 4 set_tc_index
  # mask out ECN bits and shift right by 2 to extract DSCP
  tc filter add dev $DEV parent 1:0 protocol ip prio 1 \ 
   tcindex mask 0xfc shift 2
  # general gred setup, 4 queues, nr 4 is the default queue, 'grio' says 
  # we use the RIO like multi-RED behavior to calculate the average queue
  # lengths
  tc qdisc add dev $DEV parent 1:0 handle 2:0 \ 
   gred setup DPs 4 default 4 grio
  # setup  virtuall queues, priority 1 is the highest
  tc qdisc change dev $DEV handle 2:0 gred limit 200KB min 15KB max 45KB \
   burst 20 avpkt 1000 bandwidth 10Mbit probability 0.02 DP 1 prio 1

  tc qdisc change dev $DEV handle 2:0 gred limit 200KB min 15KB max 45KB \
   burst 20 avpkt 1000 bandwidth 10Mbit probability 0.02 DP 2 prio 2

  tc qdisc change dev $DEV handle 2:0 gred limit 200KB min 15KB max 45KB \
   burst 20 avpkt 1000 bandwidth 10Mbit probability 0.02 DP 3 prio 3

  tc qdisc change dev $DEV handle 2:0 gred limit 200KB min 15KB max 45KB \
   burst 20 avpkt 1000 bandwidth 10Mbit probability 0.2 DP 4 prio 4

echo -e "basename $0 enabled \n"
;;
stop)
tc qdisc del dev $DEV root

echo -e "basename $0 disabled \n"
;;
status)
tc -s -s -s qdisc ls dev $DEV
;;
*)
usage
;;
esac

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/