From: "Paulo Augusto" Date: Sun, 23 Oct 2005 20:09:08 +0000 Subject: Re: [LARTC] Lost packets and strange "behaviour" of my TC rules Message-Id: MIME-Version: 1 Content-Type: multipart/mixed; boundary="===============1453468169==" List-Id: References: In-Reply-To: To: lartc@vger.kernel.org --===============1453468169== Content-Type: text/html; charset="iso-8859-1"; format="flowed" Content-Transfer-Encoding: quoted-printable
Hi Andy.
 
Thanks !! Thanks a lot for your help !!!!
Finally I'm seeing something working in the right way... ;)
 
I=92ve tried another sender/receiver program (I find the =93netperf= =94 a little difficult to operate), so I=92ve tried with
=93iperf=94.
Now I=92m getting all the flows with the correct limitation for its c= orresponding class.
But also now, I=92m getting ONLY the RATE limitation, not the CEIL on= e !!! :(
I=92ve done a smaller test configuration, with the same 2 PCs, connec= ted the same way and added the following rules:
=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
#interfa= ce=3D"eth0"
#interface=3D"lo"
interface=3D"ppp0"
#Delete any previous stored configuration
tc qdisc del dev $interf= ace root
#Creating the root Qdisc (Queueing Disk)
tc qdisc add dev $interfa= ce root handle 1: htb default 20
#Definition of classes
tc class add dev $interface parent 1: class= id 1:1 htb rate 28kbit ceil 28kbit
tc class add dev $interface parent 1:= 2 classid 1:20 htb rate 10kbit ceil 28kbit prio 0
tc class add dev $inte= rface parent 1:3 classid 1:30 htb rate 15kbit ceil 28kbit prio 1
tc qdisc add dev $interface parent 1:20 handle 30: sfq
tc qdisc ad= d dev $interface parent 1:30 handle 40: sfq
#Definition of the filters
tc filter add dev $interface protocol i= p parent 1:0 u32 match ip dport 20001 0xffff flowid 1:20
tc filter add d= ev $interface protocol ip parent 1:0 u32 match ip dport 20002 0xffff flowid= 1:30
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
 
 
This is my actual version of HTB:
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
 [root@EdenRH9 htb]# tc qdisc add ht= b help
What is "help"?
Usage: ... qdisc add ... htb [default N] [r2q = N]
 default  minor id of class to which unclassified packets a= re sent {0}
 r2q      DRR quantums are com= puted as rate in Bps/r2q {10}
 debug    string of 16= numbers each 0-3 {0}
... class add ... htb rate R1 burst B1 [prio P] [slot S] [pslot PS]            &= nbsp;         [ceil R2] [cburst B2]= [mtu MTU] [quantum Q]
 rate     rate allocated= to this class (class can still borrow)
 burst    ma= x bytes burst which can be accumulated during idle period {computed}
&nb= sp;ceil     definite upper class rate (no borrows) {rat= e}
 cburst   burst but for ceil {computed}
 mtu&n= bsp;     max packet size we create rate map for {1600}<= BR> prio     priority of leaf; lower are served fi= rst {0}
 quantum  how much bytes to serve from leaf at once {u= se r2q}
TC HTB version 3.3
[root@EdenRH9 htb]#
=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 
 
When I did a test run with the traffic generator Iperf, utilizing the= following command I got the following results:
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
[root@EdenRH9 htb]# iperf -c 192.168.7.10= 0 -p 20001 -n 1 -l 50000
-----------------------------------------------= -------------
Client connecting to 192.168.7.100, TCP port 20001
TCP = window size: 16.0 KByte (default)
--------------------------------------= ----------------------
[  3] local 192.168.7.200 port 35550 connect= ed with 192.168.7.100 port 20001
[ ID] Interval    &= nbsp;  Transfer     Bandwidth
[  3]  = 0.0-37.4 sec  48.8 KBytes  10.7 Kbits/sec
[root@EdenRH9 htb]#<= BR>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D
 
 
You can already see that the rate didn=92t went up to the 28kbit, and= there was no other traffic on that interface or other class.
So I=92ve = printed the output of the TC command regarding its QDISC, CLASS and FILTER,= before the test run and after the test run and got the following answers:<= BR>
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
 [root@EdenRH9 htb]# tc -s -d class = show dev ppp0
class htb 1:1 root prio 0 quantum 1000 rate 28Kbit ceil 28= Kbit burst 1634b/8 mpu 0b cburst 1634b/8 mpu 0b level 0
 Sent 0 byt= es 0 pkts (dropped 0, overlimits 0)
 lended: 0 borrowed: 0 giants: = 0
 tokens: 373714 ctokens: 373714
class htb 1:20 root leaf 30: prio 0 quantum 1000 rate 10Kbit ceil 28K= bit burst 1611b/8 mpu 0b cburst 1634b/8 mpu 0b level 0
 Sent 0 byte= s 0 pkts (dropped 0, overlimits 0)
 lended: 0 borrowed: 0 giants: 0=
 tokens: 1031680 ctokens: 373714
class htb 1:30 root leaf 40: prio 1 quantum 1000 rate 15Kbit ceil 28K= bit burst 1618b/8 mpu 0b cburst 1634b/8 mpu 0b level 0
 Sent 0 byte= s 0 pkts (dropped 0, overlimits 0)
 lended: 0 borrowed: 0 giants: 0=
 tokens: 690773 ctokens: 373714
[root@EdenRH9 htb]# tc -s -d filter show dev ppp0
filter parent 1:= protocol ip pref 49151 u32
filter parent 1: protocol ip pref 49151 u32 = fh 801: ht divisor 1
filter parent 1: protocol ip pref 49151 u32 fh 801:= :800 order 2048 key ht 801 bkt 0 flowid 1:30
  match 00004e22/0000f= fff at 20
filter parent 1: protocol ip pref 49151 u32 fh 800: ht divisor= 1
filter parent 1: protocol ip pref 49151 u32 fh 800::800 order 2048 ke= y ht 800 bkt 0 flowid 1:20
  match 00004e21/0000ffff at 20
filte= r parent 1: protocol ip pref 49152 u32
filter parent 1: protocol ip pref= 49152 u32 fh 801: ht divisor 1
filter parent 1: protocol ip pref 49152 = u32 fh 801::800 order 2048 key ht 801 bkt 0 flowid 1:30
  match 000= 04e22/0000ffff at 20
filter parent 1: protocol ip pref 49152 u32 fh 800:= ht=20 divisor 1
filter parent 1: protocol ip pref 49152 u32 fh 800::800 order = 2048 key ht 800 bkt 0 flowid 1:20
  match 00004e21/0000ffff at 20[root@EdenRH9 htb]# tc -s -d qdisc show dev ppp0
qdisc sfq 40: quantum= 1500b limit 128p flows 128/1024
 Sent 0 bytes 0 pkts (dropped 0, o= verlimits 0)
 qdisc sfq 30: quantum 1500b limit 128p flows 128/1024
 = Sent 0 bytes 0 pkts (dropped 0, overlimits 0)
 qdisc htb 1: r2q 10 default 20 direct_packets_stat 0 ver 3.7 Sent 0 bytes 0 pkts (dropped 0, overlimits 0)
 [root@EdenRH9 htb]#
 [root@EdenRH9 htb]#
 [root= @EdenRH9 htb]#
 [root@EdenRH9 htb]#
 [root@EdenRH9 htb]# [root@EdenRH9 htb]#
 [root@EdenRH9 htb]#
 [root@Eden= RH9 htb]#
 [root@EdenRH9 htb]#
[root@EdenRH9 htb]# tc -s -d qdis= c show dev ppp0
qdisc sfq 40: quantum 1500b limit 128p flows 128/1024 Sent 0 bytes 0 pkts (dropped 0, overlimits 0)
 qdisc sfq 30: quantum 1500b limit 128p flows 128/1024
 = Sent 52060 bytes 39 pkts (dropped 0, overlimits 0)
 qdisc htb 1: r2q 10 default 20 direct_packets_stat 0 ver 3.7 Sent 52060 bytes 39 pkts (dropped 0, overlimits 65)
[root@EdenRH9 htb]# tc -s -d filter show dev ppp0
filter parent 1:= protocol ip pref 49151 u32
filter parent 1: protocol ip pref 49151 u32 = fh 801: ht divisor 1
filter parent 1: protocol ip pref 49151 u32 fh 801:= :800 order 2048 key ht 801 bkt 0 flowid 1:30
  match 00004e22/0000f= fff at 20
filter parent 1: protocol ip pref 49151 u32 fh 800: ht divisor= 1
filter parent 1: protocol ip pref 49151 u32 fh 800::800 order 2048 ke= y ht 800 bkt 0 flowid 1:20
  match 00004e21/0000ffff at 20
filte= r parent 1: protocol ip pref 49152 u32
filter parent 1: protocol ip pref= 49152 u32 fh 801: ht divisor 1
filter parent 1: protocol ip pref 49152 = u32 fh 801::800 order 2048 key ht 801 bkt 0 flowid 1:30
  match 000= 04e22/0000ffff at 20
filter parent 1: protocol ip pref 49152 u32 fh 800:= ht=20 divisor 1
filter parent 1: protocol ip pref 49152 u32 fh 800::800 order = 2048 key ht 800 bkt 0 flowid 1:20
  match 00004e21/0000ffff at 20[root@EdenRH9 htb]# tc -s -d class show dev ppp0
class htb 1:1 root pr= io 0 quantum 1000 rate 28Kbit ceil 28Kbit burst 1634b/8 mpu 0b cburst 1634b= /8 mpu 0b level 0
 Sent 0 bytes 0 pkts (dropped 0, overlimits 0) lended: 0 borrowed: 0 giants: 0
 tokens: 373714 ctokens: 373= 714
class htb 1:20 root leaf 30: prio 0 quantum 1000 rate 10Kbit ceil 28K= bit burst 1611b/8 mpu 0b cburst 1634b/8 mpu 0b level 0
 Sent 52060 = bytes 39 pkts (dropped 0, overlimits 0)
 rate 131bps
 lende= d: 39 borrowed: 0 giants: 0
 tokens: -25088 ctokens: 362744
<= /DIV>
class htb 1:30 root leaf 40: prio 1 quantum 1000 rate 15Kbit ceil 28K= bit burst 1618b/8 mpu 0b cburst 1634b/8 mpu 0b level 0
 Sent 0 byte= s 0 pkts (dropped 0, overlimits 0)
 lended: 0 borrowed: 0 giants: 0=
 tokens: 690773 ctokens: 373714
[root@EdenRH9 htb]#
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
 
Also made a printout from the TCPTRACE output, captured on the other = PC with ETHEREAL with the following content:
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
1 arg remaining, starting with '/opt/teste_regras20001.ethereal'
Ost= ermann's tcptrace -- version 6.6.7 -- Thu Nov  4, 2004
76 packets seen, 76 TCP packets traced
elapsed wallclock time: 0:0= 0:00.006178, 12301 pkts/sec analyzed
trace file elapsed time: 0:00:39.28= 9997
TCP connection info:
1 TCP connection traced:
TCP connection = 1:
 host a:        192.168.7.200= :35550
 host b:        192.168.7= .100:20001
 complete conn: yes
 first packet:  Sun Oct= 23 20:26:51.304505 2005
 last packet:   Sun Oct 23 20:27= :30.594503 2005
 elapsed time:  0:00:39.289997
 total = packets: 76
 filename:      /opt/teste_reg= ras20001.ethereal
   a->b:     &nb= sp;   b->a:
     total=20 packets:            = 39           total packet= s:            37&nbs= p;    
     ack pkts sent: = ;           38  = ;         ack pkts sent:  = ;          37   = ;  
     pure acks sent:   = ;         2    =        pure acks sent:    = ;       35     
=      sack pkts=20 sent:            0&n= bsp;          sack pkts sent:&= nbsp;           0 &n= bsp;   
     dsack pkts sent: &= nbsp;         0   &n= bsp;       dsack pkts sent:   =         0      =
     max sack blks/ack:    &nbs= p;    0         = ;  max sack blks/ack:         = 0     
     unique bytes s= ent:    =20 50024           unique by= tes sent:         0  &nbs= p;  
     actual data pkts:  &n= bsp;      36      &n= bsp;    actual data pkts:      = ;    0     
   &= nbsp; actual data bytes:     50024   &nb= sp;       actual data bytes:   = ;      0     
 &= nbsp;   rexmt data pkts:       = ;    0         =   rexmt data=20 pkts:           0 &n= bsp;   
     rexmt data bytes: =          0    &= nbsp;      rexmt data bytes:   &nbs= p;      0     
 =     zwnd probe pkts:      &nbs= p;    0         = ;  zwnd probe pkts:        &nb= sp;  0     
     zwnd= probe bytes:          0 =           zwnd probe bytes:&nb= sp;        =20 0     
     outoforder pkt= s:           0  = ;         outoforder pkts: &nb= sp;         0   &nbs= p; 
     pushed data pkts:   &n= bsp;     10       &n= bsp;   pushed data pkts:       = ;   0     
     = SYN/FIN pkts sent:       1/1   = ;        SYN/FIN pkts sent:  &= nbsp;    1/1     
  &= nbsp;  req 1323=20 ws/ts:          Y/Y  = ;         req 1323 ws/ts: &nbs= p;        Y/Y    &nb= sp;
     adv wind scale:    &nb= sp;       0     &nbs= p;     adv wind scale:     &nb= sp;      0     
 = ;    req sack:       &nbs= p;          Y   = ;        req sack:   &nbs= p;            &= nbsp; Y     
     sacks=20 sent:           &nbs= p;    0         = ;  sacks sent:         &n= bsp;      0     
&nbs= p;    urgent data pkts:      &= nbsp;   0 pkts      urgent data pkts:&nb= sp;         0 pkts
  =    urgent data bytes:       &n= bsp; 0 bytes     urgent data bytes:   &n= bsp;     0 bytes
     mss reques= ted:          1460 bytes =     mss=20 requested:          1460 bytes=
     max segm size:     &n= bsp;    1448 bytes     max segm size:&nb= sp;            0 byt= es
     min segm size:     =        24 bytes     min s= egm size:           =   0 bytes
     avg segm size:   =        1389 bytes     avg= segm size:          &nbs= p;  0 bytes
     max win adv:   =          5840=20 bytes     max win adv:     &nb= sp;     63712 bytes
     min win= adv:            584= 0 bytes     min win adv:     &= nbsp;      5792 bytes
     = zero win adv:          &n= bsp;   0 times     zero win adv:  &= nbsp;           0 times     avg win adv:      =       5840 bytes     avg win a= dv:           46818 bytes=
     initial=20 window:           24 byte= s     initial window:     &nbs= p;      0 bytes
     initia= l window:           = 1 pkts      initial window:   &nbs= p;        0 pkts
   &= nbsp; ttl stream length:     50024 bytes  &nb= sp;  ttl stream length:        = ; 0 bytes
     missed data:    &= nbsp;          0 bytes &n= bsp;   missed data:       &nbs= p;       0 bytes
     = truncated data:          =   0 bytes     truncated data:   &nb= sp;        0 bytes
   =   truncated packets:         0= pkts      truncated packets:   &nb= sp;     0 pkts
     data xmit t= ime:       37.430 secs    = ;  data xmit time:        0.000 sec= s
     idletime max:     &= nbsp;   2370.0 ms        idlet= ime max:         2374.2 ms &nb= sp;
    =20 throughput:          &nbs= p;  1273 Bps       throughput: &nbs= p;            &= nbsp; 0 Bps 
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
 
Why are the rules for RATE being the only ones that are taken into ac= count for bandwidth limitation and HTB does not care about the CEIL in clas= s (1:20) and borrows tokens from the other class (1:30) that=92s not being = utilized?
 
Can I still have a problem with software versions (Linux, HTB or TC) = ?
 
Can there be a problem of correct shaping in HTB for smaller bitrates= ?

Thanks in advance.
 
 
Best regards.
 
Paulo AUgusto


From:  Andy Furniss <andy.furniss@dsl.pipex.com&= gt;
Reply-To:  andy.furniss@dsl.pipex.com
To:&nb= sp; Paulo Augusto <augustopaulo@hotmail.com>
CC: =  lartc@mailman.ds9a.nl
Subject:  Re: [LARTC] Lo= st packets and strange "behaviour" of my TC rules
Date:  <= I>Mon, 17 Oct 2005 22:29:12 +0100
>Paulo Augusto wrote:
>>
>>
>>I'm using the TG (www.postel.org/tg <http:= //www.postel.org/tg>) as
>>a TCP traffic generator, to establi= sh three 90kbits/s TCP flows
>>from PC1(any port) to PC2(port 200= 00, 20001 and 20002), with
>>different durations and pause times,= which as can be shown in the
>>next files:
>
>Usuall= y tcp won't be like this, netperf may be better to test with,
>as=20 it's more normal for bulk tcp to try to go as fast as it can.
>
&g= t;>
>>I've also plotted a graph with gnuplot, showing me that (= somehow)
>>my rules were "correct", I've got an average value of = 30kbits/s, a
>>10kbits/s and a 60kbits/s.
>>
>>= Is it normal that some packets get dropped by the rules or not
>>= (taking into account my test configuration) ?
>
>The packets ar= e not dropped in this case as the default queue length
>for sfq is 1= 28, which can hold a rwin worth of data. The missing
>packets just d= idn't get sent because htb slowed the packets down to
>the rates spe= cified and the sender will only send more once the ones
>already sen= t are acked.
>
>Andy.
>
--===============1453468169== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ LARTC mailing list LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc --===============1453468169==--