//Returns a vector of connections that are legal dragonfly plus routes that specifically would not allow for a minimal connection to the specific router specified in get_possible_stops_to_specific_router()
//Be very wary of using this method, results may not make sense if possible_minimal_stops is not a vector of minimal next stops to fdest_rotuer_id
//Nonminimal specifically refers to any move that does not move directly toward the destination router
// tw_error(TW_LOC, "ROUTING TO SPINE NOT SUPPORTED\n"); //TODO when picking intm_rtr_id at the origin leaf, we need to pick a spine router that has a direct connection to our group!
vector<Connection>possible_next_conns;
vector<Connection>possible_nonminimal_stops;
if(my_router_id==specific_router_id){
returnpossible_next_conns;//we're there so theres no need to go further. return empty - routing should check if we've arrived before calling this method
if(my_group_id==origin_group_id){//then we're just sending upward out of the group
if(s->dfp_router_type==LEAF){//then any connections to spines that are not in possible_minimal_stops should be included
elseif(s->dfp_router_type==LEAF){//if we're a leaf in an intermediate group then the routing alg should have flipped the dfp_upward channel already but lets return empty just in case
assert(possible_nonminimal_stops.size()==0);
returnpossible_nonminimal_stops;
}
elseif(s->dfp_router_type==SPINE){//then possible_minimal_stops will be the list of connections
tw_error(TW_LOC,"Something went wrong when trying to send to a spine with connection to spec group\n");
// if (specific_router_type == SPINE) { //then its not good enough to just send to a spine with a connection to the group, it has to go to a spine that has a direct conn to the spec router id
// for(int i = 0; i < possible_next_conns_to_group.size(); i++)
if(msg->path_type==MINIMAL){//we need to evaluate whether to stay on the minimal path or deviate
if(scoring_preference==LOWER){
if(min_score<=adaptive_threshold){
// printf("CHOOSE MIN: Min Score=%d\tNonmin Score=%d (Adaptive Threshold =%d)\n",min_score, intm_score,adaptive_threshold);
route_to_fdest=true;
}
elseif(min_score<=intm_score){
// printf("CHOOSE MIN: Min Score=%d\tNonmin Score=%d\n",min_score, intm_score);
route_to_fdest=true;
}
else{//Changing to a nonminimal path!
// printf("CHOOSE NONMIN: Min Score=%d\tNonmin Score=%d\n",min_score, intm_score);
msg->path_type=NON_MINIMAL;
}
if(scoring_preference==LOWER){
if(min_score<=adaptive_threshold){
route_to_fdest=true;
}
else{//HIGHER is better
if(adaptive_threshold>0)
tw_error(TW_LOC,"Adaptive threshold not compatible with HIGHER score preference yet\n");//TODO fix this
if(min_score>=intm_score){
route_to_fdest=true;
}
else{//changing to a nonminimal path!
msg->path_type=NON_MINIMAL;
}
elseif(min_score<=intm_score){
route_to_fdest=true;
}
else{//Changing to a nonminimal path!
msg->path_type=NON_MINIMAL;
}
}
else{//HIGHER is better
if(adaptive_threshold>0)
tw_error(TW_LOC,"Adaptive threshold not compatible with HIGHER score preference yet\n");//TODO fix this
if(min_score>=intm_score){
route_to_fdest=true;
}
else{//changing to a nonminimal path!
msg->path_type=NON_MINIMAL;
}
}
//we don't need to do anything if the path type is already non-minimal. "Don't revisit decision to route non-minimally after it's been made to be non-minimal"
if(s->params->source_group_rerouting==0&&isRoutingAdaptive(routing)){//if we cannot reroute within our source group, we have to pick a new intermediate router
dfp_reselect_intermediate_router(s,bf,msg,lp,origin_group_id,fdest_group_id);//alters msg->intm_rtr_id to be more appropriate
}
}
// if (s->router_id == msg->origin_router_id) { //then we havent picked an intermediate router yet
// if (s->params->source_group_rerouting == 0 && isRoutingAdaptive(routing)) { //if we cannot reroute within our source group, we have to pick a new intermediate router
// dfp_reselect_intermediate_router(s, bf, msg, lp, origin_group_id, fdest_group_id); //alters msg->intm_rtr_id to be more appropriate
// }
// }
ConnectionnextStopConn;//the connection that we will forward the packet to