diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-06-09 11:08:38 -0700 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-06-10 10:34:28 -0700 |
commit | 8104da09f5da338c6ce0813c367262de4e417598 (patch) | |
tree | e845bd3a269da26fb98a1ea7592965cea89572ce | |
parent | 26890ac98e3ed6c0830e61fa91f306fea0cc227a (diff) | |
download | vyatta-cfg-qos-8104da09f5da338c6ce0813c367262de4e417598.tar.gz vyatta-cfg-qos-8104da09f5da338c6ce0813c367262de4e417598.zip |
Allow setting queue limit and average packet size
Two more (optional) parameters for random detect precedence groups.
Bug 4518,4519
3 files changed, 24 insertions, 11 deletions
diff --git a/lib/Vyatta/Qos/RandomDetect.pm b/lib/Vyatta/Qos/RandomDetect.pm index 1918711..663abc2 100644 --- a/lib/Vyatta/Qos/RandomDetect.pm +++ b/lib/Vyatta/Qos/RandomDetect.pm @@ -31,14 +31,14 @@ use Vyatta::Qos::Util qw/getRate getAutoRate getTime/; # default values for different precedence levels my @default_fields = ( - { 'min-threshold' => 9, 'max-threshold' => 18, 'mark-probability' => 1/2 }, - { 'min-threshold' => 10, 'max-threshold' => 18, 'mark-probability' => 5/9 }, - { 'min-threshold' => 11, 'max-threshold' => 18, 'mark-probability' => .1 }, - { 'min-threshold' => 12, 'max-threshold' => 18, 'mark-probability' => 2/3 }, - { 'min-threshold' => 13, 'max-threshold' => 18, 'mark-probability' => .1 }, - { 'min-threshold' => 14, 'max-threshold' => 18, 'mark-probability' => 7/9 }, - { 'min-threshold' => 15, 'max-threshold' => 18, 'mark-probability' => 5/6 }, - { 'min-threshold' => 16, 'max-threshold' => 18, 'mark-probability' => 8/9 }, + { 'min-threshold' => 9, 'mark-probability' => 1/2 }, + { 'min-threshold' => 10, 'mark-probability' => 5/9 }, + { 'min-threshold' => 11, 'mark-probability' => .1 }, + { 'min-threshold' => 12, 'mark-probability' => 2/3 }, + { 'min-threshold' => 13, 'mark-probability' => .1 }, + { 'min-threshold' => 14, 'mark-probability' => 7/9 }, + { 'min-threshold' => 15, 'mark-probability' => 5/6 }, + { 'min-threshold' => 16, 'mark-probability' => 8/9 }, ); # Create a new instance based on config information @@ -69,8 +69,8 @@ sub getPrecedence { my $defaults = $default_fields[$i]; my %param; - $config->setLevel("$level precedence $i"); - foreach my $field (keys %$defaults) { + foreach my $field (qw(max-threshold average-packet queue-limit), + keys %$defaults) { my $val = $config->returnValue($field); if ( !defined $val ) { @@ -116,10 +116,17 @@ sub commands { my $param = $precedence->[$i]; my $qmin = $param->{'min-threshold'}; my $qmax = $param->{'max-threshold'}; + my $qlimit = $param->{'queue-limit'}; + my $avgpkt = $param->{'average-packet'}; my $prob = $param->{'mark-probability'}; + $qmax = 18 unless $qmax; + $avgpkt = 1024 unless $avgpkt; + $qlimit = 4 * $qmax unless $qlimit; + printf "qdisc change dev %s handle %x:0 gred", $dev, $root+1, $i; - printf " limit %dK min %dK max %dK avpkt 1K", 4 * $qmax, $qmin, $qmax; + printf " limit %d min %d max %d avpkt %d", + $qlimit * $avgpkt, $qmin * $avgpkt, $qmax * $avgpkt, $avgpkt; printf " burst %d bandwidth %d probability %f DP %d prio %d\n", ( 2 * $qmin + $qmax ) / 3, $rate, $prob, $i, 8-$i; } diff --git a/templates/qos-policy/random-detect/node.tag/precedence/node.tag/average-packet/node.def b/templates/qos-policy/random-detect/node.tag/precedence/node.tag/average-packet/node.def new file mode 100644 index 0000000..9b4490d --- /dev/null +++ b/templates/qos-policy/random-detect/node.tag/precedence/node.tag/average-packet/node.def @@ -0,0 +1,4 @@ +type: u32 +help: Average packet size (bytes) +default: "1024" +syntax:expression: $VAR(@) >= 16 && $VAR(@) <= 10240 ; "Average packet size must be between 16 and 10240" diff --git a/templates/qos-policy/random-detect/node.tag/precedence/node.tag/queue-limit/node.def b/templates/qos-policy/random-detect/node.tag/precedence/node.tag/queue-limit/node.def new file mode 100644 index 0000000..49c47b4 --- /dev/null +++ b/templates/qos-policy/random-detect/node.tag/precedence/node.tag/queue-limit/node.def @@ -0,0 +1,2 @@ +type: u32 +help: Set maximum queue size (packets) |