Commit 57ddfd1b authored by Jonathan Jenkins's avatar Jonathan Jenkins

generalize modelnet lp registration routine

parent 397300a5
......@@ -21,6 +21,11 @@ struct model_net_method
{
uint64_t packet_size; /* packet size */
void (*mn_configure)(); /* For initializing the network */
/* Register lp types with ROSS. This may be left as NULL, in which case the
* type corresponding to name "modelnet_<type>" will be registered
* automatically. Most networks don't need this (currently, only dragonfly
* uses it) */
void (*mn_register)(tw_lptype *base_type);
tw_stime (*model_net_method_packet_event)(
char* category,
tw_lpid final_dest_lp,
......
......@@ -1826,10 +1826,16 @@ static tw_lpid dragonfly_find_local_device(
return(dest_id);
}
static void dragonfly_register(tw_lptype *base_type) {
lp_type_register(LP_CONFIG_NM, base_type);
lp_type_register("dragonfly_router", &dragonfly_lps[1]);
}
/* data structure for dragonfly statistics */
struct model_net_method dragonfly_method =
{
.mn_configure = dragonfly_configure,
.mn_register = dragonfly_register,
.model_net_method_packet_event = dragonfly_packet_event,
.model_net_method_packet_event_rc = dragonfly_packet_event_rc,
.model_net_method_recv_msg_event = NULL,
......
......@@ -155,6 +155,7 @@ static const struct param_table_entry* find_params(
struct model_net_method loggp_method =
{
.mn_configure = loggp_configure,
.mn_register = NULL,
.model_net_method_packet_event = loggp_packet_event,
.model_net_method_packet_event_rc = loggp_packet_event_rc,
.model_net_method_recv_msg_event = loggp_recv_msg_event,
......
......@@ -113,18 +113,13 @@ void model_net_base_register(int *do_config_nets){
// here, we initialize ALL lp types to use the base type
for (int i = 0; i < MAX_NETS; i++){
if (do_config_nets[i]){
lp_type_register(model_net_lp_config_names[i], &model_net_base_lp);
// HACK: unfortunately, we need to special-case dragonfly
// registration at the moment - there are two LPs, and
// previously the LP matched on configuration initialized
// the "router" LP. Now that the base LP is in charge of
// registration, we need to take care of it
// TODO: fix the interface to have underlying networks do
// the registration
if (i==DRAGONFLY){
lp_type_register("dragonfly_router",
&method_array[DRAGONFLY]->mn_get_lp_type()[1]);
}
// some model-net lps need custom registration hooks (dragonfly).
// Those that don't NULL out the reg. function
if (method_array[i]->mn_register == NULL)
lp_type_register(model_net_lp_config_names[i],
&model_net_base_lp);
else
method_array[i]->mn_register(&model_net_base_lp);
}
}
}
......
......@@ -74,6 +74,10 @@ static void simple_net_collective();
/* collective network calls-- rc */
static void simple_net_collective_rc();
/* Modelnet interface events */
/* sets up the simplenet parameters through modelnet interface */
static void sn_configure();
/* allocate a new event that will pass through simplenet to arriave at its
* destination:
*
......@@ -86,10 +90,6 @@ static void simple_net_collective_rc();
* - net_msg_size_bytes: size of simulated network message in bytes.
* - sender: LP calling this function.
*/
/* Modelnet interface events */
/* sets up the simplenet parameters through modelnet interface */
static void sn_configure();
/* Issues a simplenet packet event call */
static tw_stime simplenet_packet_event(
char* category,
......@@ -121,6 +121,7 @@ static tw_lpid sn_find_local_device(
struct model_net_method simplenet_method =
{
.mn_configure = sn_configure,
.mn_register = NULL,
.model_net_method_packet_event = simplenet_packet_event,
.model_net_method_packet_event_rc = simplenet_packet_event_rc,
.model_net_method_recv_msg_event = NULL,
......
......@@ -152,6 +152,7 @@ static tw_lpid sp_find_local_device(
struct model_net_method simplep2p_method =
{
.mn_configure = sp_configure,
.mn_register = NULL,
.model_net_method_packet_event = simplep2p_packet_event,
.model_net_method_packet_event_rc = simplep2p_packet_event_rc,
.model_net_method_recv_msg_event = NULL,
......
......@@ -1341,6 +1341,7 @@ static tw_lpid torus_find_local_device(
struct model_net_method torus_method =
{
.mn_configure = torus_configure,
.mn_register = NULL,
.model_net_method_packet_event = torus_packet_event,
.model_net_method_packet_event_rc = torus_packet_event_rc,
.model_net_method_recv_msg_event = NULL,
......
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