diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2010-07-19 15:37:28 -0700 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2010-07-19 15:37:28 -0700 |
commit | e83b813fe1fba0735db2b080948144de3e337ce5 (patch) | |
tree | 002df64948348fe808a7832653a9f014a7fc14df /lib/Vyatta | |
parent | 06e3123122da9b351418c4a9773ae431e16323bb (diff) | |
download | vyatta-cfg-qos-e83b813fe1fba0735db2b080948144de3e337ce5.tar.gz vyatta-cfg-qos-e83b813fe1fba0735db2b080948144de3e337ce5.zip |
Add sanity checks for shaper random-detect queue type
Bug 5872
Don't allow stupidly small queue limit, and round up the minimum queue
value to be at least one packet.
Diffstat (limited to 'lib/Vyatta')
-rw-r--r-- | lib/Vyatta/Qos/ShaperClass.pm | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/Vyatta/Qos/ShaperClass.pm b/lib/Vyatta/Qos/ShaperClass.pm index 361eb57..439e404 100644 --- a/lib/Vyatta/Qos/ShaperClass.pm +++ b/lib/Vyatta/Qos/ShaperClass.pm @@ -116,6 +116,19 @@ sub rateCheck { $rate / 1000; exit 1; } + + my $qlimit = $self->{_limit}; + if (defined($qlimit) && $self->{_qdisc} eq 'random-detect') { + my $avg = 1024; + my $qmax = ( $rate * 100 ) / 8000; + if ($qlimit * $avg < $qmax) { + print STDERR "Configuration error in: $level\n"; + printf STDERR +"The queue limit (%d) is too small, must be greater than %d when using random-detect\n", + $level, $qmax / $avg; + exit 1; + } + } } sub prioQdisc { @@ -171,6 +184,8 @@ sub redQdisc { my $avg = 1024; my $qmax = (defined $rate) ? (( $rate * 100 ) / 8000) : (18 * $avg); my $qmin = $qmax / 3; + $qmin = $avg if $qmin < $avg; + my $burst = ( 2 * $qmin + $qmax ) / (3 * $avg); my $limit = $self->{_limit}; my $qlimit = (defined $limit) ? ($limit * $avg) : (4 * $qmax); |