Commit dcb76e71 authored by Leigh B. Stoller's avatar Leigh B. Stoller

Change bandwidth handling to Kbs instead of Mbs. Still some minor

problems with assign though, which uses Mbs. Do that in next step.
parent ccb6de90
......@@ -105,8 +105,8 @@ sub printdb {
# interfacespeed is indexed by type and contains the bandwidth.
# delaynodes is indexed by link name and contains [delay,bw,loss]
# portbw is indexed by virtual nodeport and contains the bandwidth
# of that port. Note that the bandwidth of a port is one of 100
# or 10. For LANs with other bandwidths the port speed will be
# of that port. Note that the bandwidth of a port is one of 100000 (100Mbs)
# or 10000 (10 Mbs). For LANs with other bandwidths the port speed will be
# 100 and a delay node will be inserted.
#
# Delay node names:
......@@ -175,7 +175,7 @@ while (($vname,$member,$delay,$bandwidth,$lossrate) = $result->fetchrow_array) {
push(@{$lans{$vname}},$member);
$delayinfo{"$vname:$member"} = [$delay,$bandwidth,$lossrate];
($node,$port) = split(":",$member);
if ($bandwidth == 10) {
if ($bandwidth == 10000) {
$portbw{$member} = 10;
} else {
$portbw{$member} = 100;
......@@ -207,7 +207,7 @@ foreach $lan (keys(%lans)) {
join(" ",@$sharks) . ")\n";
$sharkshelfid++;
$sharkshelves{$shelfid} = $sharks;
$delayinfo{"$lan:$shelfid:uplink"} = [0,100,0.0];
$delayinfo{"$lan:$shelfid:uplink"} = [0,100000,0.0];
push(@$realmembers,"$shelfid:uplink");
$nodes{$shelfid} = "shark-shelf";
}
......@@ -262,9 +262,9 @@ foreach $lan (keys(%lans)) {
$bw = &min($bw0,$bw1);
$bandwidth = &getbandwidth(&min($bw0,$bw1));
if (($delay > $delaythresh) ||
(($bw != 100) && ($bw != 10)) ||
(($bw != 100000) && ($bw != 10000)) ||
(($delaywithswitch == 0) &&
(($bw != 100) && (($sharks == 0) || ($nonsharks > 1)))) ||
(($bw != 100000) && (($sharks == 0) || ($nonsharks > 1)))) ||
($loss != 0)) {
$delayname = "tbsdelay$delayid";
$delaynodes{"linksdelaysrc/$lan"} = [$delay,$bw,$loss];
......@@ -290,9 +290,9 @@ foreach $lan (keys(%lans)) {
# XXX The expression below should be modified for better bandwidth support.
# Probably needs to happen post assign somehow.
if (($delay > $delaythresh) ||
(($bw != 100) && ($bw != 10)) ||
(($bw != 100000) && ($bw != 10000)) ||
(($delaywithswitch == 0) &&
(($bw != 100) && (($sharks == 0) || ($nonsharks > 1)))) ||
(($bw != 100000) && (($sharks == 0) || ($nonsharks > 1)))) ||
($loss != 0)) {
$delayname = "tbdelay$delayid";
$delaynodes{"linkdelaysrc/$lan/$member"} = [$delay,$bw,$loss];
......@@ -886,8 +886,11 @@ sub min {
# getbandwidth(bw)
# Returns the lowest ok bandwidth that is greater than or equal to
# the one passed.
#
# XXX The targetbandwidth is in Kbs, but interface types in Mbs.
#
sub getbandwidth {
my $targetbandwidth= $_[0];
my $targetbandwidth= $_[0] / 1000;
my $bandwidth;
my $best = 10000000000;
foreach $bandwidth (keys(%okbandwidths)) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment