summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-05-20 16:48:33 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2009-05-20 16:48:33 -0700
commitd226558aab489fd5d5abf7ead370d713beb80656 (patch)
tree09e747e098495283ed8a9272cad8b1c77b69529c /lib
parentd32ddd306f71e5878219ef472ad7cccca9630010 (diff)
downloadvyatta-cfg-qos-d226558aab489fd5d5abf7ead370d713beb80656.tar.gz
vyatta-cfg-qos-d226558aab489fd5d5abf7ead370d713beb80656.zip
Fix creation of GRED qdisc
Need to calculate parameters correctly and format up command better.
Diffstat (limited to 'lib')
-rw-r--r--lib/Vyatta/Qos/WeightedRandom.pm20
1 files changed, 12 insertions, 8 deletions
diff --git a/lib/Vyatta/Qos/WeightedRandom.pm b/lib/Vyatta/Qos/WeightedRandom.pm
index f97cc8e..99f9b9e 100644
--- a/lib/Vyatta/Qos/WeightedRandom.pm
+++ b/lib/Vyatta/Qos/WeightedRandom.pm
@@ -21,7 +21,7 @@ use warnings;
require Vyatta::Config;
require Vyatta::Qos::ShaperClass;
-use Vyatta::Qos::Util qw/getRate getAutoRate/;
+use Vyatta::Qos::Util qw/getRate getAutoRate getTime RedParam/;
my $wred = 'weighted-random';
@@ -40,6 +40,7 @@ sub new {
my $class = ref($that) || $that;
bless $self, $class;
$self->{_rate} = $rate;
+ $self->{_level} = $level;
$self->{_classes} = \@classes;
return $self;
@@ -103,20 +104,23 @@ sub commands {
$default->{id} = ++$maxid;
unshift @$classes, $default;
- print "qdisc add dev $dev root handle 1: gred";
- print " setup DPs $maxid default $maxid";
+ print "qdisc add dev $dev handle 1: root gred";
+ printf " setup DPs %d default %d\n", $maxid+1, $maxid;
foreach my $class (@$classes) {
my $classbw = $class->get_rate($rate);
my $avg = $class->{_avgpkt};
- my $latency = $class->{_latency};
+ my $latency = getTime( $class->{_latency} );
my ( $qmin, $qmax, $burst ) = RedParam( $classbw, $latency, $avg );
- print "qdisc chang dev $dev root gred";
- printf " limit %d min %d max %d avpkt %d", 4 * $qmax, $qmin, $qmax, $avg;
- printf " burst %d probability 0.02 bandwidth %d ecn\n",
- $burst, $classbw / 1000;
+ print "qdisc change dev $dev root gred";
+ printf " limit %d min %d max %d avpkt %d",
+ 4 * $qmax, $qmin, $qmax, $avg;
+ printf " burst %d bandwidth %d DP %d",
+ $burst, $rate, $class->{id};
+ printf " prio %d", $class->{_priority} if $class->{_priority};
+ print " probability 0.02\n";
foreach my $match ( $class->matchRules() ) {
$match->filter( $dev, 1, $class->{_priority} );