summaryrefslogtreecommitdiff
path: root/scripts/VyattaQosUtil.pm
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2008-07-15 09:01:10 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2008-07-15 09:01:10 -0700
commit3dd93c5175de9a4d32cadb7bb0c4f832fb14312d (patch)
treefad3292cb82c2f49408ecfd1a8bec6467b2095e9 /scripts/VyattaQosUtil.pm
parentb23c4faf070e8e5dc0eacee19c1dc379a0e9bcf5 (diff)
parent9a25dee29ff200647e6b0f6b6dc58b0aade39a52 (diff)
downloadvyatta-cfg-qos-3dd93c5175de9a4d32cadb7bb0c4f832fb14312d.tar.gz
vyatta-cfg-qos-3dd93c5175de9a4d32cadb7bb0c4f832fb14312d.zip
Merge branch 'hollywood' of suva.vyatta.com:/git/vyatta-cfg-qos into hollywood
Diffstat (limited to 'scripts/VyattaQosUtil.pm')
-rw-r--r--scripts/VyattaQosUtil.pm15
1 files changed, 13 insertions, 2 deletions
diff --git a/scripts/VyattaQosUtil.pm b/scripts/VyattaQosUtil.pm
index f847116..eca0ca3 100644
--- a/scripts/VyattaQosUtil.pm
+++ b/scripts/VyattaQosUtil.pm
@@ -220,17 +220,28 @@ sub getIfIndex {
# return result in bits per second
sub interfaceRate {
my ($interface) = @_;
+ my $speed;
my $config = new VyattaConfig;
$config->setLevel("interfaces ethernet");
if ($config->exists("$interface")) {
- my $speed = $config->returnValue("$interface speed");
+ $speed = $config->returnValue("$interface speed");
if (defined($speed) && $speed ne "auto") {
return $speed * 1000000;
}
}
- return ethtoolRate($interface);
+ # During boot it may take time for auto-negotiation
+ for (my $retries = 0; $retries < 5; $retries++) {
+ $speed = ethtoolRate($interface);
+ if (defined $speed) {
+ return $speed;
+ }
+ sleep 1;
+ }
+
+ warn "Could not determine speed for $interface, assuming 100mbit\n";
+ return 100 * 1000000;
}
## ethtoolRate("eth0")