summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-06-10 10:33:46 -0700
committerStephen Hemminger <shemminger@lenny.localdomain>2009-10-01 13:51:19 -0700
commitc46cba727ad8853991052602315c6a1f3b992e3e (patch)
treefb6b39949a451c0c11de902b7a1f3890d3116ead
parente0f015e97b01a0e1f3349e74e5b8c9f2b862022d (diff)
downloadvyatta-cfg-qos-c46cba727ad8853991052602315c6a1f3b992e3e.tar.gz
vyatta-cfg-qos-c46cba727ad8853991052602315c6a1f3b992e3e.zip
Allow random-detect for Qos policy types without rate
Part of Bug 4516 (cherry picked from commit 8f5e0920e7edd83b8d58d016d7ec6964bf222577)
-rw-r--r--lib/Vyatta/Qos/ShaperClass.pm14
1 files changed, 4 insertions, 10 deletions
diff --git a/lib/Vyatta/Qos/ShaperClass.pm b/lib/Vyatta/Qos/ShaperClass.pm
index 3a25233..ef18f30 100644
--- a/lib/Vyatta/Qos/ShaperClass.pm
+++ b/lib/Vyatta/Qos/ShaperClass.pm
@@ -168,18 +168,12 @@ sub fifoQdisc {
#
sub redQdisc {
my ( $self, $dev, $rate ) = @_;
- my $qmax = ( $rate * 100 ) / 8000;
- my $qmin = $qmax / 3;
my $avg = 1024;
- my $burst = ( 2 * $qmin + $qmax ) / (3*$avg);
-
+ my $qmax = (defined $rate) ? (( $rate * 100 ) / 8000) : (18 * $avg);
+ my $qmin = $qmax / 3;
+ my $burst = ( 2 * $qmin + $qmax ) / (3 * $avg);
my $limit = $self->{_limit};
- my $qlimit;
- if ($limit) {
- $qlimit = $limit * $avg;
- } else {
- $qlimit = 4 * $qmax;
- }
+ my $qlimit = (defined $limit) ? ($limit * $avg) : (4 * $qmax);
printf "red limit %d min %d max %d avpkt %d", $qlimit, $qmin, $qmax, $avg;
printf " burst %d probability 0.1 bandwidth %s ecn\n", $burst, $rate;