summaryrefslogtreecommitdiff
path: root/lib/Vyatta/Qos/ShaperClass.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Vyatta/Qos/ShaperClass.pm')
-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;