Skip to contentSkip to conversation

Need Clarification on TBF + (PRIO+SFQ)

LARTC Gerry Weaver 2 participants 2 messages Mar 15, 2004

lore
Share & tools
lore
#0 lore raw

Hi All,

I need help to understand the proper order to create qdiscs. I'm trying to do the following:

1. Use the TBF to slow a 100mb link to 3mb
2. Use PRIO to prioritize the traffic
3. Use SFQ to hand out bandwidth to each PRIO class fairly

Here's my question. What order should the qdiscs be in? For example:

ROOT->TBF->PRIO[1,2,3]->SFQ or ROOT->PRIO[1,2,3]->SFQ->TBF

Please forgive me if this is a stupid question. I'm a total newbie ;-).

Thanks in advance,
Gerry

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.576 / Virus Database: 365 - Release Date: 1/30/2004

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

#1 lore raw
Quoted 6 lines · Gerry Weaver

Hi All,

I need help to understand the proper order to create qdiscs. I'm trying to do the following:

1. Use the TBF to slow a 100mb link to 3mb

Check the "UNITS" section of the tc manual to make sure you don't get "mbit" confused with "mbps". In tc unit nomenclature, "kb" and "mb" refer to quantities rather than bandwidths.

Quoted 7 lines

2. Use PRIO to prioritize the traffic
3. Use SFQ to hand out bandwidth to each PRIO class fairly

Here's my question. What order should the qdiscs be in? For example:

ROOT->TBF->PRIO[1,2,3]->SFQ or ROOT->PRIO[1,2,3]->SFQ->TBF

Well, the first cannot work because TBF is a classless discipline, and as such cannot have child qdiscs. The second cannot work because sfq is also classless (and even if it were, I don't think that configuration would do what you want.

Try htb. I'm going to assume you mean "mbit"; you'll want to tweak other parameters, too. This (untested) example won't behave exactly like PRIO, but I think you could modify it to do so by changing each class' rate to 0mbit (remember that's the guaranteed rate) and let them take their shares of the bandwidth solely based on prio. htb allows for what are usually more elegant solutions to bandwidth prioritization, though, so what I've written below allows the three classes to share bandwidth disproportionately when they all have packets waiting.

tc qdisc add dev eth0 root handle htb
tc class add dev eth0 parent 1: classid 1:1 htb rate 3mbit tc class add dev eth0 parent 1:1 classid 1:10 htb rate 1500kbit ceil \
3mbit prio 1
tc qdisc add dev eth0 parent 1:10 handle 10: sfq perturb 10
tc class add dev eth0 parent 1:1 classid 1:20 htb rate 1000kbit ceil \
3mbit prio 2
tc qdisc add dev eth0 parent 1:20 handle 20: sfq perturb 10
tc class add dev eth0 parent 1:1 classid 1:30 htb rate 500kbit ceil \
3mbit prio 3
tc qdisc add dev eth0 parent 1:30 handle 30: sfq perturb 10

(then write some filters attached to 1: to pass packets to 1:10, 1:20, and 1:30)

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