Commit b0a536b9 authored by Leigh Stoller's avatar Leigh Stoller

Small changes to allow bridge nodes to bridge/delay multiplexed vlan

encapsulated links and lans. Still a work in progress. See issue #72.
parent 8bb7f5ed
......@@ -814,6 +814,8 @@ CREATE TABLE `delays` (
`q1_gentle` tinyint(4) default '0',
`iface0` varchar(8) NOT NULL default '',
`iface1` varchar(8) NOT NULL default '',
`viface_unit0` int(10) default NULL,
`viface_unit1` int(10) default NULL,
`exptidx` int(11) NOT NULL default '0',
`eid` varchar(32) default NULL,
`pid` varchar(48) default NULL,
......@@ -826,7 +828,7 @@ CREATE TABLE `delays` (
`card1` tinyint(3) unsigned default NULL,
`noshaping` tinyint(1) default '0',
`isbridge` tinyint(1) default '0',
PRIMARY KEY (`node_id`,`iface0`,`iface1`),
PRIMARY KEY (`node_id`,`iface0`,`iface1`,`vlan0`,`vlan1`,`vnode0`,`vnode1`),
KEY `pid` (`pid`,`eid`),
KEY `exptidx` (`exptidx`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
......
use strict;
use libdb;
sub DoUpdate($$$)
{
my ($dbhandle, $dbname, $version) = @_;
if (!DBSlotExists("delays", "viface_unit0")) {
DBQueryFatal("alter table delays add ".
" `viface_unit0` int(10) default NULL after iface1");
DBQueryFatal("alter table delays add ".
" `viface_unit1` int(10) default NULL after viface_unit0");
DBQueryFatal("alter table delays drop primary key");
DBQueryFatal("alter table delays add primary key ".
" PRIMARY KEY (`node_id`,`iface0`,`iface1`,".
" `vlan0`,`vlan1`,`vnode0`,`vnode1`)");
}
return 0;
}
# Local Variables:
# mode:perl
# End:
......@@ -1956,6 +1956,7 @@ sub LoadVirtLans($)
$vlanmember->_shaped(0);
$virtlan->_delayed(0);
$vlanmember->_bridged(0);
$vlanmember->_virtiface(undef);
#
# Look for a sharedvlan setting, which is the name of the
......@@ -1989,7 +1990,7 @@ sub LoadVirtLans($)
# resets this to 100Mbs.
#
my $portbw = $self->getbandwidth($vlanmember, $virtlan, $bandwidth);
$self->portbw()->{"$vlanmember"} = $portbw;
$self->portbw()->{"$vlanmember"} = 0;
$self->printdb(" $vlanname $vlanmember portbw:$portbw - ".
"$delay $bandwidth $lossrate ".
......@@ -2481,7 +2482,7 @@ sub GenVirtNodes($)
}
}
elsif ($vnode->_isbridge()) {
$type = ($type eq "pc" ? "delay" : "delay-" . $type);
$type = ($type eq "pc" ? "bridge" : "bridge-" . $type);
}
if ($vnode->_explicit_type_request()) {
$desires->{"$type" . "-explicit"} = ['', 1.0];
......@@ -3286,7 +3287,7 @@ sub GenVirtLans($)
$bw, $vlan->_wiretype(), $others);
}
}
elsif (@members == 2 && !$vlan->_bridged()) {
elsif (@members == 2) {
#
# We treat LANs with two members specially - they are just links
#
......@@ -3366,6 +3367,8 @@ sub GenVirtLans($)
$mustdelay ||
# Global force, or per-link force.
$self->option('forcelinkdelays') || $uselinkdelay) &&
# No shaping on bridged lans.
!$vlan->_bridged() &&
# No shaping of geni nodes.
$vlan->_geninodes() == 0) {
# Need a delay node and its really a shaped link.
......@@ -3459,6 +3462,8 @@ sub GenVirtLans($)
if (($shaped ||
(($traced || $rtraced) &&
!($trace_endnode && $rtrace_endnode))) &&
# Ignore for bridged links.
!$vlan->_bridged() &&
# XXX simulated nodes hack. We don't want to put delay nodes
# between simulated nodes. If there is a link between a
# simulated and a real node, we might need to put in delay
......@@ -3584,10 +3589,10 @@ sub GenVirtLans($)
# could not tell earlier if the link was going to get a real
# delay node or just a delaywithswitch.
#
$self->portbw()->{$member0} =
$self->getbandwidth($member0,$vlan,$bandwidth);
$self->portbw()->{$member1} =
$self->getbandwidth($member1,$vlan,$rbandwidth);
#$self->portbw()->{$member0} =
# $self->getbandwidth($member0,$vlan,$bandwidth);
#$self->portbw()->{$member1} =
# $self->getbandwidth($member1,$vlan,$rbandwidth);
}
else {
my $plink = "linksimple/$vname/$member0,$member1";
......@@ -3916,7 +3921,7 @@ sub GenVirtLans($)
# going to get a real delay node or just a
# delaywithswitch.
#
$self->portbw()->{$member} = $bandwidth;
#$self->portbw()->{$member} = $bandwidth;
}
else {
my $plink = "linklan/$vname/$member";
......@@ -8043,6 +8048,16 @@ sub AddBridge($$$$)
$rbandwidth = 0
if ($member1->nobwshaping());
# We now allow bridges to work with vinterfaces (vlan encap).
my $viface_unit0 = "null";
my $viface_unit1 = "null";
if (defined($member0->_virtiface())) {
$viface_unit0 = $member0->_virtiface()->unit();
}
if (defined($member1->_virtiface())) {
$viface_unit1 = $member1->_virtiface()->unit();
}
#
# We are inserting the bridge, but it might not be for shaping.
# Maybe for tracing. We use the estimated bandwidth field to
......@@ -8057,7 +8072,7 @@ sub AddBridge($$$$)
DBQueryWarn("insert into delays " .
" (pid,eid,exptidx,node_id,vname,noshaping,iface0,iface1" .
",vlan0,vlan1,isbridge".
",vlan0,vlan1,isbridge,viface_unit0,viface_unit1".
",vnode0,pipe0,delay0,bandwidth0,backfill0,lossrate0" .
",vnode1,pipe1,delay1,bandwidth1,backfill1,lossrate1" .
",q0_limit,q0_maxthresh,q0_minthresh,q0_weight,q0_linterm" .
......@@ -8068,6 +8083,7 @@ sub AddBridge($$$$)
",q1_droptail,q1_red,q1_gentle)" .
" values ('$pid','$eid','$idx','$pnodename','$vname' ".
",$noshaping,'$iface0','$iface1','$lan0','$lan1',1".
",$viface_unit0,$viface_unit1".
",'$vnodename0',$pipe0,$delay,$bandwidth,$backfill,$lossrate".
",'$vnodename1',$pipe1,$rdelay,$rbandwidth,$rbackfill".
",$rlossrate".
......@@ -8150,6 +8166,9 @@ sub AddBridge($$$$)
$self->interfacespeedmbps(physinterfacetype($pnode, $iface1),
"ethernet");
$self->portbw()->{$member0} = $speed0;
$self->portbw()->{$member1} = $speed1;
$self->printdb(" Setting port speeds on $pnodename: ".
"$iface0:$speed0 $iface1:$speed1\n");
......
......@@ -1276,6 +1276,8 @@ foreach $node (@nodenames) {
push @types, "delay:$delay_capacity";
push @types, "delay-${type}:$delay_capacity";
push @types, "bridge:100";
push @types, "bridge-${type}:100";
}
#
......
......@@ -3478,21 +3478,27 @@ COMMAND_PROTOTYPE(dodelay)
res = mydb_query("select i.MAC,j.MAC, "
"pipe0,delay0,bandwidth0,lossrate0,q0_red, "
"pipe1,delay1,bandwidth1,lossrate1,q1_red, "
"vname, "
"d.vname, "
"q0_limit,q0_maxthresh,q0_minthresh,q0_weight,q0_linterm, "
"q0_qinbytes,q0_bytes,q0_meanpsize,q0_wait,q0_setbit, "
"q0_droptail,q0_gentle, "
"q1_limit,q1_maxthresh,q1_minthresh,q1_weight,q1_linterm, "
"q1_qinbytes,q1_bytes,q1_meanpsize,q1_wait,q1_setbit, "
"q1_droptail,q1_gentle,vnode0,vnode1,noshaping, "
"backfill0,backfill1,isbridge,vlan0,vlan1"
"backfill0,backfill1,isbridge,vlan0,vlan1,v1.mac,v2.mac "
" from delays as d "
"left join interfaces as i on "
" i.node_id=d.node_id and i.iface=iface0 "
"left join interfaces as j on "
" j.node_id=d.node_id and j.iface=iface1 "
"left join vinterfaces as v1 on "
" v1.node_id=d.node_id and v1.exptidx=d.exptidx and "
" v1.unit=d.viface_unit0 "
"left join vinterfaces as v2 on "
" v2.node_id=d.node_id and v2.exptidx=d.exptidx and "
" v2.unit=d.viface_unit1 "
" where d.node_id='%s'",
45, reqp->nodeid);
47, reqp->nodeid);
if (!res) {
error("DELAY: %s: DB Error getting delays!\n", reqp->nodeid);
return 1;
......@@ -3545,7 +3551,8 @@ COMMAND_PROTOTYPE(dodelay)
"VNODE0=%s VNODE1=%s "
"NOSHAPING=%s "
"BACKFILL0=%s BACKFILL1=%s\n",
row[0], row[1],
(row[45] ? row[45] : row[0]),
(row[46] ? row[46] : row[1]),
row[2], row[3], row[4], row[5],
row[7], row[8], row[9], row[10],
row[12],
......
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