From 6348298f5acd634158eb749a4775965b2d705d48 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 17 Aug 2010 16:56:43 -0700 Subject: Fix shaper class queue calculations for random-detect Need to handle queue-limit better (confusion between bytes and packets) Bug 5872 (cherry picked from commit 94ea365fc966a16807a2086db05ea2877e9b00fa) --- lib/Vyatta/Qos/ShaperClass.pm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'lib/Vyatta/Qos') diff --git a/lib/Vyatta/Qos/ShaperClass.pm b/lib/Vyatta/Qos/ShaperClass.pm index b84b057..cc42f44 100644 --- a/lib/Vyatta/Qos/ShaperClass.pm +++ b/lib/Vyatta/Qos/ShaperClass.pm @@ -123,7 +123,7 @@ sub sfqValidate { if ( defined $limit && $limit > 127 ) { print STDERR "Configuration error in: $level\n"; - die "queue limit must be between 1 and 127 for random-detect\n"; + die "queue limit must be between 1 and 127 for queue-type fair-queue\n"; } } @@ -173,8 +173,9 @@ sub redQdisc { sub redValidate { my ( $self, $level, $rate ) = @_; - my $limit = $self->{_limit}; - my $qmax = int((redQsize($rate) + AVGPKT - 1) / AVGPKT); + my $limit = $self->{_limit}; # packets + my $thresh = redQsize($rate); # bytes + my $qmax = POSIX::ceil($thresh / AVGPKT); # packets if ( defined($limit) && $limit < $qmax ) { print STDERR "Configuration error in: $level\n"; @@ -184,7 +185,7 @@ sub redValidate { exit 1; } - if ( $qmax < 3 * AVGPKT ) { + if ( $qmax < 3 ) { my $minbw = ( 3 * AVGPKT * 8 ) / LATENCY; print STDERR "Configuration error in: $level\n"; -- cgit v1.2.3