summaryrefslogtreecommitdiff
path: root/lib/Vyatta/Qos/ShaperClass.pm
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2010-07-19 16:13:28 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2010-07-19 16:13:28 -0700
commit410e94afe308549e097137f4ef3241ebcf1d4ed5 (patch)
tree4d335aa493de8c8c44174f50bbb793d72cd1585d /lib/Vyatta/Qos/ShaperClass.pm
parente83b813fe1fba0735db2b080948144de3e337ce5 (diff)
downloadvyatta-cfg-qos-410e94afe308549e097137f4ef3241ebcf1d4ed5.tar.gz
vyatta-cfg-qos-410e94afe308549e097137f4ef3241ebcf1d4ed5.zip
Add check for random-detect on slow speed class
The calculation of random-detect queue parameters is based on recommended values from RFC. If allowed bandwidth is too small, the queue will be too small to be useable. In that case just fail.
Diffstat (limited to 'lib/Vyatta/Qos/ShaperClass.pm')
-rw-r--r--lib/Vyatta/Qos/ShaperClass.pm17
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/Vyatta/Qos/ShaperClass.pm b/lib/Vyatta/Qos/ShaperClass.pm
index 439e404..6b474e6 100644
--- a/lib/Vyatta/Qos/ShaperClass.pm
+++ b/lib/Vyatta/Qos/ShaperClass.pm
@@ -117,17 +117,28 @@ sub rateCheck {
exit 1;
}
- my $qlimit = $self->{_limit};
- if (defined($qlimit) && $self->{_qdisc} eq 'random-detect') {
+ if ($self->{_qdisc} eq 'random-detect') {
my $avg = 1024;
my $qmax = ( $rate * 100 ) / 8000;
- if ($qlimit * $avg < $qmax) {
+ my $qlimit = $self->{_limit};
+ if (defined($qlimit) && $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;
}
+
+ # The assumptions about average packet size and allowable latency
+ # result in limit on available bandwidth
+ #
+ # 2 * Avg pkt = (BW * Latency) / 8 bit/byte
+ # 16K bits = BW * .1 sec
+ if ($qmax < $avg) {
+ print STDERR "Configuration error in: $level\n";
+ die
+"Random-detect queue type requires effective bandwidth of 160 Kbit/sec or greater\n";
+ }
}
}