summaryrefslogtreecommitdiff
path: root/lib/Vyatta
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-05-22 15:19:01 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2009-05-22 15:19:01 -0700
commita7ec99d913b0169b987a4ebdf2d26a36670b20bb (patch)
tree2d3163146d662a3b778a8cb67962c032a465a420 /lib/Vyatta
parentd226558aab489fd5d5abf7ead370d713beb80656 (diff)
downloadvyatta-cfg-qos-a7ec99d913b0169b987a4ebdf2d26a36670b20bb.tar.gz
vyatta-cfg-qos-a7ec99d913b0169b987a4ebdf2d26a36670b20bb.zip
Use better RED parameters
Use recommendations from Sally Floyd.
Diffstat (limited to 'lib/Vyatta')
-rw-r--r--lib/Vyatta/Qos/ShaperClass.pm14
-rw-r--r--lib/Vyatta/Qos/Util.pm5
-rw-r--r--lib/Vyatta/Qos/WeightedRandom.pm13
3 files changed, 17 insertions, 15 deletions
diff --git a/lib/Vyatta/Qos/ShaperClass.pm b/lib/Vyatta/Qos/ShaperClass.pm
index d89dfb9..c3fae16 100644
--- a/lib/Vyatta/Qos/ShaperClass.pm
+++ b/lib/Vyatta/Qos/ShaperClass.pm
@@ -151,16 +151,13 @@ sub fifoQdisc {
# Red is has way to many configuration options
# make some assumptions to make this sane (based on LARTC)
-# average size := 1000 bytes
-# limit := queue-limit * average
-# max := limit / 8
-# min := max / 3
-# burst := (2 * min + max) / (3 * average)
+# average size = 1000 bytes
+# latency = 100ms
sub redQdisc {
my ( $self, $dev, $rate ) = @_;
my $avg = 1000;
- my $latency = 100000; # 100 ms
- my ($qmin, $qmax, $burst) = RedParam($rate, $latency, $avg);
+ my $latency = 100000;
+ my ($qmin, $qmax, $burst, $maxp) = RedParam($rate, $latency, $avg);
my $limit = $self->{_limit};
my $qlimit;
@@ -171,7 +168,8 @@ sub redQdisc {
}
printf "red limit %d min %d max %d avpkt %d", $qlimit, $qmin, $qmax, $avg;
- printf " burst %d probability 0.02 bandwidth %d ecn\n", $burst, $rate / 1000;
+ printf " burst %d probability %f bandwidth %d ecn\n",
+ $prob, $burst, $maxp, $rate / 1000;
}
my %qdiscOptions = (
diff --git a/lib/Vyatta/Qos/Util.pm b/lib/Vyatta/Qos/Util.pm
index afd5c78..ee1b722 100644
--- a/lib/Vyatta/Qos/Util.pm
+++ b/lib/Vyatta/Qos/Util.pm
@@ -329,13 +329,16 @@ sub ethtoolRate {
# Avpkt = Average Packet Length
# Burst = ( 2 * MinThreshold + MaxThreshold) / ( 3 * Avpkt )
# Limit = 4 * MaxThreshold
+#
+# These are based on Sally Floyd's recommendations:
+# http://www.icir.org/floyd/REDparameters.txt
sub RedParam {
my ( $bandwidth, $latency, $avgpkt ) = @_;
my $qmax = ( $bandwidth * $latency ) / 8000000;
my $qmin = $qmax / 3;
my $burst = ( 2 * $qmin + $qmax ) / ( 3 * $avgpkt );
- return ($qmin, $qmax, $burst);
+ return ($qmin, $qmax, $burst, 0.1);
}
1;
diff --git a/lib/Vyatta/Qos/WeightedRandom.pm b/lib/Vyatta/Qos/WeightedRandom.pm
index 99f9b9e..0b1dc37 100644
--- a/lib/Vyatta/Qos/WeightedRandom.pm
+++ b/lib/Vyatta/Qos/WeightedRandom.pm
@@ -102,7 +102,7 @@ sub commands {
# fill in id of default
$default->{id} = ++$maxid;
- unshift @$classes, $default;
+ push @$classes, $default;
print "qdisc add dev $dev handle 1: root gred";
printf " setup DPs %d default %d\n", $maxid+1, $maxid;
@@ -112,15 +112,16 @@ sub commands {
my $avg = $class->{_avgpkt};
my $latency = getTime( $class->{_latency} );
- my ( $qmin, $qmax, $burst ) = RedParam( $classbw, $latency, $avg );
+ my ( $qmin, $qmax, $burst, $maxp )
+ = RedParam( $classbw, $latency, $avg );
print "qdisc change dev $dev root gred";
- printf " limit %d min %d max %d avpkt %d",
- 4 * $qmax, $qmin, $qmax, $avg;
+ printf " prio %d", $class->{_priority} if $class->{_priority};
+ printf " limit %d min %d max %d avpkt %d probability %f",
+ 4 * $qmax, $qmin, $qmax, $avg, $maxp;
printf " burst %d bandwidth %d DP %d",
$burst, $rate, $class->{id};
- printf " prio %d", $class->{_priority} if $class->{_priority};
- print " probability 0.02\n";
+ print " probability 0.1\n";
foreach my $match ( $class->matchRules() ) {
$match->filter( $dev, 1, $class->{_priority} );