[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: AF and EF together..
- To: Urs Thuermann <email@example.com>
- Subject: Re: AF and EF together..
- From: Roberto Mameli <firstname.lastname@example.org>
- Date: Thu, 13 Jan 2000 16:28:58 +0100
- CC: diffserv <email@example.com>
- Organization: CoRiTeL
- References: <37612F5D.firstname.lastname@example.org> <email@example.com>
- Sender: owner-linux-diffserv
Urs Thuermann wrote:
> Hi Roberto,
first of all I post this reply to the mailing list, since I think it could be of interest for
> Some while ago you posted a script for AF+EF+BE to the linux-diffserv
> mailing list. I don't quite understand how you use the tcindex
> filters. What is the meaning of lines like
> $TC filter add dev eth1 parent 1:0 protocol ip prio 1 handle 0x2e tcindex classid 1:151
> $TC filter add dev eth1 parent 2:0 protocol ip prio 1 handle 5 tcindex classid 2:5
> handle 0x2e looks like you wnat to match the EF DSCP. Isn't the
> handle of a filter only an unique id for it? Or does it specify what
> to match with this filter?
> Also what does the classid 1:151 do? You have nowhere added a class
> with that id.
> I'd really like to understand your script better. Could you please
> enlighten me?
About the script... as you can see there are two tc_index classifiers: the first is a child of
the dsmark qdisc (1:0), while the second is a child of the internal cbq qdisc (2:0). Note that
the first one is added by the line:
$TC filter add dev eth1 parent 1:0 protocol ip prio 1 tcindex mask 0xfc shift 2 pass_on
at the beginning of the script, and thus it uses the value stored in skb->tc_index by the
external dsmark (i.e. the TOS byte of the IP header) to compute a key as follows:
key = (skb->tc_index & mask) >> shift
If this key is matched by the handle, then the corresponding classid is used by the second
tc_index classifier to find the target cbq class. For example, think of an EF packet... the TOS
byte, that is the skb->tc_index, contains 0xb8 (1011 1000 ). The first tc_index computes the
key = (0xb8 & 0xfc) >> 2 = (10111000 & 11111100) >> 2 = 00101110 = 0x2e (i.e. the EF DSCP)
As a consequence the corresponding classid is :151. Note however that 151 is hexadecimal (0001
0101 0001), even if this is not immediately clear from the script. The second tc_index is
characterized by a mask 0xf0 and a shift 4, and applying these values to the classid we obtain:
(0x151 & 0xf0) >> 4 = (101010001 & 011110000) >> 4 = 0101 = 5
This value of the handle is matched by the line:
$TC filter add dev eth1 parent 2:0 protocol ip prio 1 handle 5 tcindex classid 2:5
and, as a consequence, the packet is directed to class 2:5.
> Also, how would I do if I first want to set the DSCP dependent on IP
> addresses/ports etc. and then apply your AF+EF+BE qdisc?
I guess you need a script that non only forwards packets according to predefined PHBs, but also
remarks them based, for example, on their source/destination IP ports. I have such a script...
if you can wait a few days, you'll find all those scripts, along with papers describing in
details how they work, at our home page. We are working on it, and I'll give you the URL ASAP.
CoRiTeL - Consorzio di Ricerca sulle Telecomunicazioni
EMAIL : firstname.lastname@example.org URL : http://www.coritel.it
TEL : +39-06-20410038 ADDRESS : Via di Tor Vergata, 135
FAX : +39-06-20410037 00133 Roma - ITALY