diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2010-12-07 17:20:43 -0800 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2010-12-08 12:31:19 -0800 |
commit | 110ffa598bd6ab3f4b91ddfa47f5f7528c35dee3 (patch) | |
tree | dd48a0c7073401c5073c52a0423b04b1dbe86258 /lib/Vyatta/Qos/ShaperClass.pm | |
parent | ded8a3bf9547df82b2f6b17ad39f269738c0e7c4 (diff) | |
download | vyatta-cfg-qos-110ffa598bd6ab3f4b91ddfa47f5f7528c35dee3.tar.gz vyatta-cfg-qos-110ffa598bd6ab3f4b91ddfa47f5f7528c35dee3.zip |
Compute optimium rate to quantum value
Bug 6092
The code now calculates r2q value based on max rate and min rate which
gives better accuracy and stops kernel message.
Diffstat (limited to 'lib/Vyatta/Qos/ShaperClass.pm')
-rw-r--r-- | lib/Vyatta/Qos/ShaperClass.pm | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/Vyatta/Qos/ShaperClass.pm b/lib/Vyatta/Qos/ShaperClass.pm index cc42f44..4afd90c 100644 --- a/lib/Vyatta/Qos/ShaperClass.pm +++ b/lib/Vyatta/Qos/ShaperClass.pm @@ -26,6 +26,8 @@ use Vyatta::Qos::Util qw/getDsfield getRate/; use constant { AVGPKT => 1024, # Average packet size for RED calculations LATENCY => 250, # Worstcase latency for RED (ms) + + MINQUANTUM => 1000, # Lowest allowable HTB quantum }; sub new { @@ -247,18 +249,27 @@ sub get_rate { } sub gen_class { - my ( $self, $dev, $qdisc, $parent, $speed ) = @_; + my ( $self, $dev, $qdisc, $parent, $speed, $r2q ) = @_; my $rate = _getPercentRate( $self->{_rate}, $speed ); my $ceil = _getPercentRate( $self->{_ceiling}, $speed ); + my $quantum = $self->{_quantum}; + + # Hack to avoid kernel HTB message if quantum is small. + # Only occurs if link speed is high and offered bandwidth is small. + if ( defined($r2q) && !defined($quantum) && ($rate / 8) / $r2q < MINQUANTUM ) { + $quantum = MINQUANTUM; + } printf "class add dev %s parent %x:1 classid %x:%x %s", $dev, $parent, $parent, $self->{id}, $qdisc; print " rate $rate" if ($rate); print " ceil $ceil" if ($ceil); + print " quantum $quantum" if ($quantum); print " burst $self->{_burst}" if ( $self->{_burst} ); print " prio $self->{_priority}" if ( $self->{_priority} ); - print " quantum $self->{_quantum}" if ( $self->{_quantum} ); + + print "\n"; } |