Bug 657

Summary: The HTB utility is not working properly using 2.5.73 kernel
Product: Networking Reporter: Yaron (yaronb)
Component: OtherAssignee: Arnaldo Carvalho de Melo (acme)
Status: CLOSED PATCH_ALREADY_AVAILABLE    
Severity: high CC: acme, yaronb
Priority: P2    
Hardware: i386   
OS: Linux   
Kernel Version: 2.5.73 Subsystem:
Regression: --- Bisected commit-id:

Description Yaron 2003-05-01 12:57:34 UTC
Distribution:
Hardware Environment: Intl Pentium-4
Software Environment: Linux kernel 2.5.68
Problem Description: I tested the HTB utility with 2.5.68 kernel, and it looks 
like it doesn't work properly. It works well with 2.3 and 2.4.20 kernels. 

Steps to reproduce:

 Build and install 2.5.68 kernel.
 Create an HTB qdisc, a class with max rate and ceil of 30000Kbit/s.
 Create a filter attached to that class.
 I pushed up to 70000Kbit/s through the filtered interface using the filterd IP
 address, but the Rate limit didn't have any effect. So the output was 
70000Kbit/s. It looks like the HTB functionality is broken.

   Let me know if you need more info.
     
         Yaron
Comment 1 Jos 2003-05-06 15:17:13 UTC
AMD XP 1700+, Linux kernel 2.5.68, iproute 20010824-9 (updated Debian Sid),
shaping eth0 outgoing traffic with a script like the following:
  tc qdisc add dev eth0 root handle 1: htb default 10
  tc class add dev eth0 parent 1: classid 1:1 htb rate 1000Kbit
  tc class add dev eth0 parent 1:1 classid 1:10 htb rate 1000Kbit

To generate traffic, "nc -l -p 8000 > /dev/null" on the server end
"cat /tmp/linux-2.5.68.tar.bz2 | nc server 8000" on the client.

Tranfer rate measured via "gkrellm" shows a mean value of 135 KB/s (1080 Kbps),
and via "iptraf":
Average rates:
  Total:        1014.31 kbits/s, 110.03 packets/s
  Incoming:     14.51 kbits/s, 27.48 packets/s
  Outgoing:     999.81 kbits/s, 82.56 packets/s

At the end of the test, the default class (created just before tbe test) shows:
class htb 1:10 parent 1:1 prio 0 rate 1000Kbit ceil 1000Kbit burst 2815b
cburst 2815b 
 Sent 32067540 bytes 21214 pkts (dropped 0, overlimits 0) 
 rate 137654bps 90pps backlog 18p 
 lended: 21196 borrowed: 0 giants: 0
 tokens: -33 ctokens: -33

In short, it works for me.
Comment 2 Yaron 2003-05-07 09:40:42 UTC
I did a comprehensive testing with 2.3 and 2.4.20
kernels. I used an Ixia as a traffic generator for pumping data to the Linux
box. In the Linux box I have two interfaces, one is used for data input and
one is used for data output.

         -------            --------
         |     |1 ---> eth0 |Linux |
         |Ixia |2 <--- eth1 |      |
         -------            --------
 I set the policing setting to eth1. The Linux box forwarded every packet it
receives on interface eth0.

 In my tests I tried different rate limits and different packet sizes. I
found a linear relation between the burst and the traffic, which give the
most accurate results.

 I am trying to verify the same results using 2.5.68 kernel.

 The reason it works for you is because you were using a rate limit of
1000kbit and a packet size of 512. I verified your test, and it looks like
it works fine. When I tried different packet sizes, and different rates the
HTB scheduling doesn't work well.

   The following is a sample of test results:
  Test 1:
  Pumping: 74Mbit/s
  Rate limit: 1000Kbit

  Results:

  Packet size    Received traffic (eth1)
      64             27Mbit/s
      128            42Mbit/s
      512            1.3Mbit/s
      1500           1.1Mbit/s

  Test 2:
  Pumping: 74Mbit/s
  Rate limit: 2000Kbit

  Results:

  Packet size    Received traffic (eth1)
      64             27Mbit/s
      512            4Mbit/s
      1500           2.4Mbit/s

  Test 3:
  Pumping: 74Mbit/s
  Rate limit: 6000Kbit

  Results:

  Packet size    Received traffic (eth1)
      64             27Mbit/s
      512            74Mbit/s
      1500           6Mbit/s

  Test 4:
  Pumping: 74Mbit/s
  Rate limit: 8000Kbit

  Results:

  Packet size    Received traffic (eth1)
      64             27Mbit/s
      512            74Mbit/s
      1500           12Mbit/s

  As you can see from the results, the rate shaping functionality doesn't
works in most
  Cases. As I maintained before, these tests works very well in 2.4.20.

   I hope it helps.
   Please let me know if you need more information.
  
              Yaron
                 
Comment 3 Alexander Nyberg 2004-12-09 11:45:38 UTC
In mail exchange Yaron verifies that problem is solved, closing.