Dear list members, I think there must be something wrong with my code or the tcng package has a small bug... First, the rules are simple: everything from 10.0.0.80 gets full priority whereas anything else gets a 80/20 rate depending if the packets are comming from 10.0.0.1 or not: # TCSIM input: file demo.tcc #define FLOW(n) TCP_PCK($ip_src=10.0.0.##n) \ 0 x 960 /* 1000-header = 960 bytes */ dev eth0 100kbps { egress { prio { class ( 1 ) \ if ip_src == 10.0.0.80 { sfq; }; class ( 2 ) if 1 { htb (quantum 2ms) { class (rate 100kbps, ceil 100kbps) { class (rate 80kbps, ceil 100kbps) \ if ip_src == 10.0.0.1 {sfq;} class (rate 20kbps, ceil 100kbps) \ if 1 {sfq;} } } } } } } every 0.05s until 1s send FLOW(80); every 0.05s until 6s send FLOW(1); every 0.05s until 7s send FLOW(2); time 3s; every 0.05s until 4s send FLOW(80); time 10s; end; If we graph the above with the command: tcsim demo.tcc | tcsim_filter src | tcsim_plot -a 20 we see that both 10.0.0.1 and 10.0.0.2 get 50% despite the fact of the above "if" in the htb class. If we observe the output from tcc on the above source we can see that we get the "tc filter" command for the parent htb class and not on the htb qdisc! This results in the filters for the htb qdisc never to be consulted! Have a look: command: tcc demo-src.tcc .... tc qdisc add dev eth0 handle 1:0 root dsmark indices 4 default_index 0 tc qdisc add dev eth0 handle 2:0 parent 1:0 prio tc qdisc add dev eth0 handle 3:0 parent 2:1 sfq perturb 1 tc qdisc add dev eth0 handle 4:0 parent 2:2 htb tc class add dev eth0 parent 4:0 classid 4:1 htb rate 12500bps ceil 12500bps quantum 25000 tc class add dev eth0 parent 4:1 classid 4:2 htb rate 11250bps ceil 12500bps quantum 22500 tc qdisc add dev eth0 handle 5:0 parent 4:2 sfq tc class add dev eth0 parent 4:1 classid 4:3 htb rate 1250bps ceil 12500bps quantum 2500 tc qdisc add dev eth0 handle 6:0 parent 4:3 sfq tc filter add dev eth0 parent 4:1 protocol all prio 1 u32 match u32 0xa000001 0xffffffff at 12 classid 4:2 .... ^^^ oups! should be 4.0!! Is there something I am missing from the code in order to attach the filters to the htb qdisc and not the borrowing class? George. __________________________________________________ Do you Yahoo!? The New Yahoo! Search - Faster. Easier. Bingo http://search.yahoo.com _______________________________________________ LARTC mailing list / LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
Jacob Teplitsky
2003-Apr-19 15:46 UTC
RE: [tcng] Is there a bug in tcc or my code is wrong?
Hi George, You can try this style: See if it works better. dev eth0 { egress { class (<$high_prio>) if ip_src == 10.0.0.80; class (<$htb_1>) if ip_src == 10.0.0.1; class (<$htb_2>) if 1; prio { $high_prio = class { sfq; }; class { htb (quantum 2ms) { class (rate 100kbps, ceil 100kbps) { $htb_1 = class (rate 80kbps, ceil 100kbps) {sfq;}; $htb_2 = class (rate 20kbps, ceil 100kbps) {sfq;}; } } } } } } - Jacob> Message: 4 > Date: Thu, 17 Apr 2003 05:55:50 -0700 (PDT) > From: George Spiliotis <gspiliot@yahoo.com> > To: lartc@mailman.ds9a.nl > Subject: [LARTC] [tcng] Is there a bug in tcc or my code is wrong? > > Dear list members, > > I think there must be something wrong with my code or the > tcng package has a small bug... > > First, the rules are simple: everything from 10.0.0.80 gets > full priority whereas anything else gets a 80/20 rate > depending if the packets are comming from 10.0.0.1 or not: > > # TCSIM input: file demo.tcc > #define FLOW(n) TCP_PCK($ip_src=10.0.0.##n) \ > 0 x 960 /* 1000-header = 960 bytes > */ > > dev eth0 100kbps { > egress { > prio { > class ( 1 ) \ > if ip_src == 10.0.0.80 { sfq; }; > class ( 2 ) if 1 { > htb (quantum 2ms) { > class (rate 100kbps, ceil 100kbps) { > class (rate 80kbps, ceil 100kbps) \ > if ip_src == 10.0.0.1 {sfq;} > class (rate 20kbps, ceil 100kbps) \ > if 1 {sfq;} > } > } > } > } > } > } > > every 0.05s until 1s send FLOW(80); > every 0.05s until 6s send FLOW(1); > every 0.05s until 7s send FLOW(2); > time 3s; > every 0.05s until 4s send FLOW(80); > time 10s; > end; > > If we graph the above with the command: > tcsim demo.tcc | tcsim_filter src | tcsim_plot -a 20 > we see that both 10.0.0.1 and 10.0.0.2 get 50% despite the > fact of the above "if" in the htb class. If we observe the > output from tcc on the above source we can see that we get > the "tc filter" command for the parent htb class and not on > the htb qdisc! This results in the filters for the htb > qdisc never to be consulted! Have a look: > > command: tcc demo-src.tcc > .... > tc qdisc add dev eth0 handle 1:0 root dsmark indices 4 > default_index 0 > tc qdisc add dev eth0 handle 2:0 parent 1:0 prio > tc qdisc add dev eth0 handle 3:0 parent 2:1 sfq perturb 1 > tc qdisc add dev eth0 handle 4:0 parent 2:2 htb > tc class add dev eth0 parent 4:0 classid 4:1 htb rate > 12500bps ceil 12500bps quantum 25000 > tc class add dev eth0 parent 4:1 classid 4:2 htb rate > 11250bps ceil 12500bps quantum 22500 > tc qdisc add dev eth0 handle 5:0 parent 4:2 sfq > tc class add dev eth0 parent 4:1 classid 4:3 htb rate > 1250bps ceil 12500bps quantum 2500 > tc qdisc add dev eth0 handle 6:0 parent 4:3 sfq > tc filter add dev eth0 parent 4:1 protocol all prio 1 u32 > match u32 0xa000001 0xffffffff at 12 classid 4:2 > .... ^^^ oups! should be 4.0!! > > Is there something I am missing from the code in order to > attach the filters to the htb qdisc and not the borrowing > class? > > George._______________________________________________ LARTC mailing list / LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/