diff options
Diffstat (limited to 'lib/Vyatta/Qos/ShaperClass.pm')
-rw-r--r-- | lib/Vyatta/Qos/ShaperClass.pm | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/lib/Vyatta/Qos/ShaperClass.pm b/lib/Vyatta/Qos/ShaperClass.pm index 4d95f42..5e1db8d 100644 --- a/lib/Vyatta/Qos/ShaperClass.pm +++ b/lib/Vyatta/Qos/ShaperClass.pm @@ -158,24 +158,19 @@ sub fifoQdisc { # burst := (2 * min + max) / (3 * average) sub redQdisc { my ( $self, $dev, $rate ) = @_; + my $avg = 1000; + my ($qmin, $qmax, $burst) = RedParam($rate, 500, $avg); + my $limit = $self->{_limit}; - my $avg = 1000; my $qlimit; - - if ( defined $limit ) { - $qlimit = $limit * $avg; # red limit in bytes - } - else { - - # rate is in bits/sec so queue-limit = 8 * 500ms * rate - $qlimit = $rate / 2; + if ($limit) { + $qlimit = $limit * $avg; + } else { + $qlimit = 4 * $qmax; } - my $qmax = $qlimit / 8; - my $qmin = $qmax / 3; printf "red limit %d min %d max %d avpkt %d", $qlimit, $qmin, $qmax, $avg; - printf " burst %d probability 0.02 bandwidth %d ecn\n", - ( 2 * $qmin + $qmax ) / ( 3 * $avg ), $rate / 1000; + printf " burst %d probability 0.02 bandwidth %d ecn\n", $burst, $rate / 1000; } my %qdiscOptions = ( @@ -185,6 +180,12 @@ my %qdiscOptions = ( 'drop-tail' => \&fifoQdisc, ); +sub get_rate { + my ($self, $speed) = @_; + + return _getPercentRate( $self->{_rate}, $speed ); +} + sub gen_class { my ( $self, $dev, $qdisc, $parent, $speed ) = @_; my $rate = _getPercentRate( $self->{_rate}, $speed ); |