diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-05-20 16:46:24 -0700 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-05-20 16:46:24 -0700 |
commit | 49d4456f54d7a73ae06276f2ebf58e5f6f3039de (patch) | |
tree | c0a8420acc1169dfeffb99925d4be354999debf7 | |
parent | 9e2906ce7755f1723d345d36db7364df1e0b6a03 (diff) | |
download | vyatta-cfg-qos-49d4456f54d7a73ae06276f2ebf58e5f6f3039de.tar.gz vyatta-cfg-qos-49d4456f54d7a73ae06276f2ebf58e5f6f3039de.zip |
Fix calculation of RED parameters
The latency value is in microseconds.
-rw-r--r-- | lib/Vyatta/Qos/ShaperClass.pm | 3 | ||||
-rw-r--r-- | lib/Vyatta/Qos/Util.pm | 8 |
2 files changed, 6 insertions, 5 deletions
diff --git a/lib/Vyatta/Qos/ShaperClass.pm b/lib/Vyatta/Qos/ShaperClass.pm index 482ec09..d89dfb9 100644 --- a/lib/Vyatta/Qos/ShaperClass.pm +++ b/lib/Vyatta/Qos/ShaperClass.pm @@ -159,7 +159,8 @@ sub fifoQdisc { sub redQdisc { my ( $self, $dev, $rate ) = @_; my $avg = 1000; - my ($qmin, $qmax, $burst) = RedParam($rate, 500, $avg); + my $latency = 100000; # 100 ms + my ($qmin, $qmax, $burst) = RedParam($rate, $latency, $avg); my $limit = $self->{_limit}; my $qlimit; diff --git a/lib/Vyatta/Qos/Util.pm b/lib/Vyatta/Qos/Util.pm index 2e0eec9..afd5c78 100644 --- a/lib/Vyatta/Qos/Util.pm +++ b/lib/Vyatta/Qos/Util.pm @@ -322,16 +322,16 @@ sub ethtoolRate { # Compute parameters for RED algorithim based on bandwidth and latency # # Bandwidth (bits/sec) * Latency (ms) -# Maximum Threshold = -------------------------------------- -# 1000 ms/sec +# Maximum Threshold = -------------------------------------- +# (bytes) 8 bits/byte * 1000000 us/sec # # Minimum Threshold = Maximum Threshold / 3 # Avpkt = Average Packet Length # Burst = ( 2 * MinThreshold + MaxThreshold) / ( 3 * Avpkt ) # Limit = 4 * MaxThreshold sub RedParam { - my ($bandwidth, $latency, $avgpkt) = @_; - my $qmax = ($bandwidth * $latency) / 1000; + my ( $bandwidth, $latency, $avgpkt ) = @_; + my $qmax = ( $bandwidth * $latency ) / 8000000; my $qmin = $qmax / 3; my $burst = ( 2 * $qmin + $qmax ) / ( 3 * $avgpkt ); |