diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-05-19 10:10:59 -0700 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-05-19 10:10:59 -0700 |
commit | e955a55bcdf42ee9079e9d9575b53ae8c050c122 (patch) | |
tree | cea95d99cc561600d1bbf9882d64a081d39da274 /lib/Vyatta | |
parent | df1d6348323708b34958cd622e02cbba122c748a (diff) | |
download | vyatta-cfg-qos-e955a55bcdf42ee9079e9d9575b53ae8c050c122.tar.gz vyatta-cfg-qos-e955a55bcdf42ee9079e9d9575b53ae8c050c122.zip |
Move getAutoRate into Util
The getAutoRate function is needed by WRED as well
Diffstat (limited to 'lib/Vyatta')
-rw-r--r-- | lib/Vyatta/Qos/TrafficShaper.pm | 21 | ||||
-rw-r--r-- | lib/Vyatta/Qos/Util.pm | 21 |
2 files changed, 21 insertions, 21 deletions
diff --git a/lib/Vyatta/Qos/TrafficShaper.pm b/lib/Vyatta/Qos/TrafficShaper.pm index 114bba7..665a47d 100644 --- a/lib/Vyatta/Qos/TrafficShaper.pm +++ b/lib/Vyatta/Qos/TrafficShaper.pm @@ -45,25 +45,6 @@ sub new { return $self; } -# Rate can be something like "auto" or "10.2mbit" -sub _getAutoRate { - my ( $rate, $dev ) = @_; - - if ( $rate eq "auto" ) { - $rate = interfaceRate($dev); - if ( !defined $rate ) { - print STDERR - "Interface $dev speed cannot be determined (assuming 10mbit)\n"; - $rate = 10000000; - } - } - else { - $rate = getRate($rate); - } - - return $rate; -} - sub _getClasses { my $level = shift; my @classes; @@ -103,7 +84,7 @@ sub _checkClasses { sub commands { my ( $self, $dev ) = @_; - my $rate = _getAutoRate( $self->{_rate}, $dev ); + my $rate = getAutoRate( $self->{_rate}, $dev ); my $classes = $self->{_classes}; my %dsmark = (); my $default = shift @$classes; diff --git a/lib/Vyatta/Qos/Util.pm b/lib/Vyatta/Qos/Util.pm index c78e762..3aefbd8 100644 --- a/lib/Vyatta/Qos/Util.pm +++ b/lib/Vyatta/Qos/Util.pm @@ -20,7 +20,7 @@ use strict; use warnings; our @EXPORT = - qw(getRate getPercent getBurstSize getProtocol getDsfield getTime); + qw(getRate getPercent getBurstSize getProtocol getDsfield getTime getAutoRate); our @EXPORT_OK = qw(interfaceRate getIfIndex); use base qw(Exporter); @@ -65,6 +65,25 @@ my %rates = ( 'tbps' => 8000000000000., ); +# Rate can be something like "auto" or "10.2mbit" +sub getAutoRate { + my ( $rate, $dev ) = @_; + + if ( $rate eq "auto" ) { + $rate = interfaceRate($dev); + if ( !defined $rate ) { + print STDERR + "Interface $dev speed cannot be determined (assuming 10mbit)\n"; + $rate = 10000000; + } + } + else { + $rate = getRate($rate); + } + + return $rate; +} + sub getRate { my $rate = shift; my ( $num, $suffix ) = get_num($rate); |