RE: [LARTC] DSCP remarking + GRED at one go?

Linux Advanced Routing and Traffic Control

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

 



Hi Titus,

I just tried this, and it seems you can. See script below. I did it quite
quickly, so there may be an error somewhere - every 30 seconds or so it
prints out an error on the commandline (something like - dsmark_dequeue:
unsupported protocol 2054), but it remarks packets correctly, and then
enqueues them in the right place, so it is functional.

The basic idea is use the root dsmark qdisc to remark packets as usual. As a
child to this set up another dsmark qdisc which matches packets using
tcindex as usual, and within this qdisc set up your classful qdisc, and
GRED...

Regards,
James

=====================================================

#!/bin/bash

#Test to see if you can mark and use GRED with dsmark simultaneously.
#Takes outgoing HTTP traffic, marks it af11 and queues it in GRED

DEV='eth0'

tc qdisc del dev $DEV root

#DSMARK - for marking
tc qdisc add dev $DEV root handle 1:0 dsmark indices 64

#Marking classes
tc class change dev $DEV parent 1:0 classid 1:1 dsmark mask 0x3 value 0x28
tc class change dev $DEV parent 1:0 classid 1:2 dsmark mask 0x3 value 0x0

#Filters - second one matches everything the first one missed
tc filter add dev $DEV parent 1:0 protocol ip prio 1 u32 match ip dport 80
0xffff flowid 1:1
tc filter add dev $DEV parent 1:0 protocol ip prio 10 u32 match ip tos 0x0
0x0 classid 1:2

#DSMARK - matching on DSCP
tc qdisc add dev $DEV parent 1: handle 2: dsmark indices 64 default_index
0x1 set_tc_index

#Filter to get DSCP from TOS
tc filter add dev $DEV parent 2: protocol ip prio 1 tcindex mask 0xfc shift
2 pass_on

#Sets tcindex of packets marked af11 to 1
tc filter add dev $DEV parent 2: protocol ip prio 1 handle 0x0a tcindex
classid 2:1

#HTB
tc qdisc add dev $DEV parent 2: handle 3: htb default 20

#This class allows sharing of bandwidth (note the b/ws are random figures)
tc class add dev $DEV parent 3: classid 3:1 htb rate 300kbit burst 20kbit

#Leaf classes
tc class add dev $DEV parent 3:1 classid 3:10 htb rate 100kbit burst 20kbit
tc class add dev $DEV parent 3:1 classid 3:20 htb rate 200kbit burst 20kbit

#Leaf qdisc - GRED 
tc qdisc add dev $DEV parent 3:10 gred setup DPs 3 default 2 grio
tc qdisc change dev $DEV parent 3:10 gred limit 60KB min 15KB max 45KB burst
20 avpkt 1000 bandwidth 300kbit DP 1 probability 0.02 prio 2
tc qdisc change dev $DEV parent 3:10 gred limit 60KB min 15KB max 45KB burst
20 avpkt 1000 bandwidth 300kbit DP 2 probability 0.04 prio 3
tc qdisc change dev $DEV parent 3:10 gred limit 60KB min 15KB max 45KB burst
20 avpkt 1000 bandwidth 300kbit DP 0 probability 0.06 prio 4

#Leaf filter - best effort defaults to class 3:20
tc filter add dev $DEV parent 3:0 protocol ip prio 1 handle 1 tcindex
classid 3:10

=====================================================


> -----Original Message-----
> From: Hoon Titus [mailto:hoontitu@xxxxxxxxxxxxxxx]
> Sent: 31 March 2003 11:41
> To: lartc@xxxxxxxxxxxxxxx
> Subject: [LARTC] DSCP remarking + GRED at one go?
> 
> 
> Daer all,
> 
> Is it possible to do DSCP remarking + GRED at one go using tc?
> 
> The examples that I found on the Net is either doing DSCP 
> remark or GRED
> but not both.
> 
> I have read the IETF draft 
> draft-almesberger-wajhak-diffserv-linux-00.txt
> @
> http://snafu.freedom.org/linux2.2/docs/draft-almesberger-wajha
> k-diffserv-linux-00.txt
> and it mentioned in Figure 7 that it is possible to change 
> the DS field.
> 
> Can anyone enlighten me? :-)
> 
> Thanks and Regards,
> Titus
> 
> 
> 
> _______________________________________________
> LARTC mailing list / LARTC@xxxxxxxxxxxxxxx
> http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
> 

The Information contained in this E-Mail and any subsequent correspondence
is private and is intended solely for the intended recipient(s).
For those other than the recipient any disclosure, copying, distribution,
or any action taken or omitted to be taken in reliance on such information
is prohibited and may be unlawful.

Emails and other electronic communication with QinetiQ may be monitored.
Calls to our Customer Contact Centre may be recorded for quality control,
regulatory and monitoring purposes.


[Index of Archives]     [LARTC Home Page]     [Netfilter]     [Netfilter Development]     [Network Development]     [Bugtraq]     [GCC Help]     [Yosemite News]     [Linux Kernel]     [Fedora Users]
  Powered by Linux