From 254f894a9ae414529b88bc4d248a1b9633ef87fe Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 31 Mar 2008 11:53:20 -0700 Subject: bandwidth problems should be nonfatal If the customer has incorrectly assigned bandwidth and rate ceilings for QOS, the problem can not be detected until commit. At that point (possibly during boot), it is better to print a warning rather than failing. This addresses Bug 2919. --- scripts/VyattaQosTrafficShaper.pm | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) (limited to 'scripts') diff --git a/scripts/VyattaQosTrafficShaper.pm b/scripts/VyattaQosTrafficShaper.pm index 8ecb6db..0f4d34c 100644 --- a/scripts/VyattaQosTrafficShaper.pm +++ b/scripts/VyattaQosTrafficShaper.pm @@ -102,24 +102,21 @@ } sub rateCheck { - my ($self, $speed) = @_; - my $rate = _getPercentRate($self->{_rate}, $speed); - my $ceil = _getPercentRate($self->{_ceiling}, $speed); + my ($self, $limit, $level) = @_; - if ($rate > $speed) { - printf "policy bandwidth %dKbps < class bandwidth %dKbps\n", - $speed / 1000, $rate / 1000; - return undef; + my $rate = _getPercentRate($self->{_rate}, $limit); + if ($rate > $limit) { + printf STDERR + "Warning: $level\nbandwidth %dKbps > overall bandwidth %dKbps\n", + $rate / 1000, $limit / 1000; } - # create the class + my $ceil = _getPercentRate($self->{_ceiling}, $limit); if (defined $ceil && $ceil < $rate) { - printf "ceiling %dKbps < bandwidth %dKbps\n", + printf STDERR + "Warning: $level\nceiling %dKbps < class bandwidth %dKbps\n", $ceil / 1000, $rate / 1000; - return undef; } - - return !0; } sub prioQdisc { @@ -317,15 +314,10 @@ sub commands { my $default = shift @$classes; my $maxid = 1; - if (! $default->rateCheck($rate) ) { - die "$self->{_level} default : invalid parameter\n"; - } + $default->rateCheck($rate, "$self->{_level} default"); foreach my $class (@$classes) { - # rate constraints - if (! $class->rateCheck($rate) ) { - die "$self->{_level} class $class->{id} : invalid parameter\n"; - } + $class->rateCheck($rate, "$self->{_level} class $class->{id}"); # find largest class id if (defined $class->{id} && $class->{id} > $maxid) { -- cgit v1.2.3 From 46d9f133a49420e8e7385a87809ced30437bbdc6 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Wed, 2 Apr 2008 20:23:07 -0700 Subject: set ceiling on class ceiling parameter was not being forwarded to kernel. --- scripts/VyattaQosTrafficShaper.pm | 1 + 1 file changed, 1 insertion(+) (limited to 'scripts') diff --git a/scripts/VyattaQosTrafficShaper.pm b/scripts/VyattaQosTrafficShaper.pm index 0f4d34c..ef7bd7b 100644 --- a/scripts/VyattaQosTrafficShaper.pm +++ b/scripts/VyattaQosTrafficShaper.pm @@ -193,6 +193,7 @@ printf ${out} "class add dev %s parent %x:1 classid %x:%x htb rate %s", $dev, $parent, $parent, $self->{id}, $rate; + print ${out} " ceil $self->{_ceiling}" if ( defined $self->{_ceiling} ); print ${out} " burst $self->{_burst}" if ( defined $self->{_burst} ); print ${out} " prio $self->{_priority}" if ( defined $self->{_priority} ); print {$out} "\n"; -- cgit v1.2.3