Commit 0552a7db authored by Robert Ricci's avatar Robert Ricci
Browse files

First phase of adding a special '*' bandwidth to the top file

This value can be specified in place of an integer bandwidth. When
this is done, assign will map the virtual link to *any* physical
link of the right type, regardless of bandwidth. However, it will
adjust the bandwidth used for trunk calculations, etc, based on the
bandwidth of the interfaces selected, so that this doesn't cause us
to overuse interswitch links.

For the time being, it is not legal to use this option with trivial
links or emulated (multiplexed) links, since it's not at all clear
what this would mean.

This commit contains only the data structure and parser changes; the
actual implementation will come soon.
parent 0916e296
......@@ -36,9 +36,21 @@ inline double loss_distance(double a,double b) {
class tb_delay_info {
public:
// TODO: Make a real constructor!
tb_delay_info() : bandwidth(0), delay(0), loss(0.0),
adjust_to_native_bandwidth(false) { ; } ;
// Note the adjust_to_native_bandwidth flag below
int bandwidth;
int delay;
double loss;
// If true, we just use the native bandwidth of the interface that gets
// picked; the bandwidth member gets updated on every assignment. This only
// makes sense on virtual links.
bool adjust_to_native_bandwidth;
// TODO: We don't actually use any of these; we should get 'em out of here.
int bw_under,bw_over;
int delay_under,delay_over;
double loss_under,loss_over;
......@@ -62,12 +74,14 @@ public:
friend ostream &operator<<(ostream &o, const tb_delay_info& delay)
{
o << "tb_delay_info: bw=" << delay.bandwidth << "+" <<
delay.bw_over << "-" << delay.bw_under << "/" << delay.bw_weight;
o << " delay=" << delay.delay << "+" << delay.delay_over <<
"-" << delay.delay_under << "/" << delay.delay_weight;
o << " loss=" << delay.loss << "+" << delay.loss_over << "-" <<
delay.loss_under << "/" << delay.loss_weight;
// Only print out the stuff that matters, not all of the pieces we don't
// use
o << "tb_delay_info: bw=" << delay.bandwidth;
if (delay.adjust_to_native_bandwidth) {
o << "(adjusted)";
}
o << " delay=" << delay.delay;
o << " loss=" << delay.loss;
o << endl;
return o;
}
......
......@@ -98,8 +98,8 @@ top file: <line>*
<desire> ::= <desire_type><desire_name>:<float>
<desire_type> ::= | "?+" | "&*" | "*!"
<link_line1> ::= link <link_name> <interface> <interface> <int> <float> <float>
<link_flag>*
<link_line1> ::= link <link_name> <interface> <interface> <int|'*'> <float>
<float> <link_flag>*
<link_line2> ::= link <link_name> <interface> <interface> <int> <float> <float>
<link_type> <link_flag*>
<link_flag> ::= nodelay | emulated | trivial_ok | fixsrciface:<string> |
......@@ -124,7 +124,9 @@ Interpretation:
<desire> - see <feature> in the ptop file
<desire_type> - see <feature_type> in the ptop file
<link_line1> and <link_line2> - see notes below for the difference between the
two line types. See <link_line> in the ptop file.
two line types. See <link_line> in the ptop file. The integer gives the
bandwidth for the link, but if the special value '*' is given, assign
simply uses the native bandwidth of the interfaces selected.
<link_type> - when present, a valid mapping must put this virtual link on a
physical link of the same type. For multi-hop link mappings (ie. those
that traverse multiple switches), *all* links used must be of this type. I
......
......@@ -242,8 +242,18 @@ int parse_top(tb_vgraph &vg, istream& input)
l->type = link_type;
put(vedge_pmap,e,l);
if ((sscanf(bw.c_str(),"%d",&(l->delay_info.bandwidth)) != 1) ||
(sscanf(bwunder.c_str(),"%d",&(l->delay_info.bw_under)) != 1) ||
// Special flag: treat a bandwidth of '*' specially
if (!strcmp(bw.c_str(),"*")) {
l->delay_info.bandwidth = 0;
l->delay_info.adjust_to_native_bandwidth = true;
} else {
if (sscanf(bw.c_str(),"%d",&(l->delay_info.bandwidth)) != 1) {
top_error("Bad line line, bad bandwidth characteristics.");
}
}
// Scan in the rest of the delay_info structure
if ((sscanf(bwunder.c_str(),"%d",&(l->delay_info.bw_under)) != 1) ||
(sscanf(bwover.c_str(),"%d",&(l->delay_info.bw_over)) != 1) ||
(sscanf(bwweight.c_str(),"%lg",&(l->delay_info.bw_weight)) != 1) ||
(sscanf(delay.c_str(),"%d",&(l->delay_info.delay)) != 1) ||
......@@ -288,6 +298,13 @@ int parse_top(tb_vgraph &vg, istream& input)
parsed_line[i] << ".");
}
}
// Some sanity checks: this combination is illegal for now
if (l->delay_info.adjust_to_native_bandwidth && (l->allow_trivial ||
l->emulated)) {
top_error("Auto-assigning bandwidth on trivial or emulated links"
" not allowed!");
}
#ifdef PER_VNODE_TT
tb_vnode *vnode1 = get(vvertex_pmap,node1);
......
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