Commit 21293ecc authored by Jonathan Jenkins's avatar Jonathan Jenkins

clean up parameter usage in base modelnet/sched

parent 77cf5291
...@@ -88,17 +88,17 @@ typedef struct model_net_sched_interface { ...@@ -88,17 +88,17 @@ typedef struct model_net_sched_interface {
// prio (currently the only user): int priority // prio (currently the only user): int priority
// - NULL arguments should be treated as "use default value" // - NULL arguments should be treated as "use default value"
void (*add)( void (*add)(
model_net_request * req, const model_net_request * req,
const mn_sched_params * sched_params, const mn_sched_params * sched_params,
int remote_event_size, int remote_event_size,
void * remote_event, void * remote_event,
int local_event_size, int local_event_size,
void * local_event, void * local_event,
void * sched, void * sched,
model_net_sched_rc * rc, model_net_sched_rc * rc,
tw_lp * lp); tw_lp * lp);
// reverse the previous request addition // reverse the previous request addition
void (*add_rc)(void *sched, model_net_sched_rc *rc, tw_lp *lp); void (*add_rc)(void *sched, const model_net_sched_rc *rc, tw_lp *lp);
// schedule the next packet for processing by the model // schedule the next packet for processing by the model
int (*next)( int (*next)(
tw_stime * poffset, tw_stime * poffset,
...@@ -109,10 +109,10 @@ typedef struct model_net_sched_interface { ...@@ -109,10 +109,10 @@ typedef struct model_net_sched_interface {
tw_lp * lp); tw_lp * lp);
// reverse schedule the previous packet // reverse schedule the previous packet
void (*next_rc)( void (*next_rc)(
void * sched, void * sched,
void * rc_event_save, const void * rc_event_save,
model_net_sched_rc * rc, const model_net_sched_rc * rc,
tw_lp * lp); tw_lp * lp);
} model_net_sched_interface; } model_net_sched_interface;
/// overall scheduler struct - type puns the actual data structure /// overall scheduler struct - type puns the actual data structure
...@@ -166,8 +166,8 @@ int model_net_sched_next( ...@@ -166,8 +166,8 @@ int model_net_sched_next(
void model_net_sched_next_rc( void model_net_sched_next_rc(
model_net_sched *sched, model_net_sched *sched,
void *rc_event_save, const void *rc_event_save,
model_net_sched_rc *sched_rc, const model_net_sched_rc *sched_rc,
tw_lp *lp); tw_lp *lp);
/// enter a new request into the scheduler, storing any info needed for rc in /// enter a new request into the scheduler, storing any info needed for rc in
...@@ -175,7 +175,7 @@ void model_net_sched_next_rc( ...@@ -175,7 +175,7 @@ void model_net_sched_next_rc(
/// sched_msg_params is scheduler-specific parameters (currently only used by /// sched_msg_params is scheduler-specific parameters (currently only used by
/// prio scheduler) /// prio scheduler)
void model_net_sched_add( void model_net_sched_add(
model_net_request *req, const model_net_request *req,
const mn_sched_params * sched_params, const mn_sched_params * sched_params,
int remote_event_size, int remote_event_size,
void * remote_event, void * remote_event,
...@@ -187,7 +187,7 @@ void model_net_sched_add( ...@@ -187,7 +187,7 @@ void model_net_sched_add(
void model_net_sched_add_rc( void model_net_sched_add_rc(
model_net_sched *sched, model_net_sched *sched,
model_net_sched_rc *sched_rc, const model_net_sched_rc *sched_rc,
tw_lp *lp); tw_lp *lp);
// set default parameters for messages that don't specify any // set default parameters for messages that don't specify any
......
...@@ -89,6 +89,7 @@ typedef struct model_net_request { ...@@ -89,6 +89,7 @@ typedef struct model_net_request {
tw_lpid dest_mn_lp; // destination modelnet lp tw_lpid dest_mn_lp; // destination modelnet lp
tw_lpid src_lp; tw_lpid src_lp;
uint64_t msg_size; uint64_t msg_size;
uint64_t pull_size;
uint64_t packet_size; uint64_t packet_size;
int net_id; int net_id;
int is_pull; int is_pull;
......
...@@ -532,20 +532,23 @@ void model_net_method_send_msg_recv_event( ...@@ -532,20 +532,23 @@ void model_net_method_send_msg_recv_event(
else else
model_net_sched_set_default_params(&m->msg.m_base.sched_params); model_net_sched_set_default_params(&m->msg.m_base.sched_params);
m->msg.m_base.req.final_dest_lp = final_dest_lp; model_net_request *r = &m->msg.m_base.req;
m->msg.m_base.req.src_lp = src_lp; r->final_dest_lp = final_dest_lp;
r->src_lp = src_lp;
// for "recv" events, set the "dest" to this LP in the case of a pull event // for "recv" events, set the "dest" to this LP in the case of a pull event
m->msg.m_base.req.dest_mn_lp = sender->gid; r->dest_mn_lp = sender->gid;
m->msg.m_base.req.msg_size = is_pull ? pull_size : msg_size; r->pull_size = pull_size;
m->msg.m_base.req.packet_size = m->msg.m_base.req.msg_size; r->msg_size = msg_size;
m->msg.m_base.req.net_id = net_id; // TODO: document why we're setting packet_size this way
m->msg.m_base.req.is_pull = is_pull; r->packet_size = msg_size;
m->msg.m_base.req.remote_event_size = remote_event_size; r->net_id = net_id;
m->msg.m_base.req.self_event_size = 0; r->is_pull = is_pull;
r->remote_event_size = remote_event_size;
r->self_event_size = 0;
m->msg.m_base.is_from_remote = 1; m->msg.m_base.is_from_remote = 1;
strncpy(m->msg.m_base.req.category, category, CATEGORY_NAME_MAX-1); strncpy(r->category, category, CATEGORY_NAME_MAX-1);
m->msg.m_base.req.category[CATEGORY_NAME_MAX-1] = '\0'; r->category[CATEGORY_NAME_MAX-1] = '\0';
if (remote_event_size > 0){ if (remote_event_size > 0){
void * m_dat = model_net_method_get_edata(net_id, msg); void * m_dat = model_net_method_get_edata(net_id, msg);
......
...@@ -49,14 +49,14 @@ int model_net_sched_next( ...@@ -49,14 +49,14 @@ int model_net_sched_next(
void model_net_sched_next_rc( void model_net_sched_next_rc(
model_net_sched *sched, model_net_sched *sched,
void *rc_event_save, const void *rc_event_save,
model_net_sched_rc *sched_rc, const model_net_sched_rc *sched_rc,
tw_lp *lp) { tw_lp *lp) {
sched->impl->next_rc(sched->dat, rc_event_save, sched_rc, lp); sched->impl->next_rc(sched->dat, rc_event_save, sched_rc, lp);
} }
void model_net_sched_add( void model_net_sched_add(
model_net_request *req, const model_net_request *req,
const mn_sched_params * sched_params, const mn_sched_params * sched_params,
int remote_event_size, int remote_event_size,
void * remote_event, void * remote_event,
...@@ -71,7 +71,7 @@ void model_net_sched_add( ...@@ -71,7 +71,7 @@ void model_net_sched_add(
void model_net_sched_add_rc( void model_net_sched_add_rc(
model_net_sched *sched, model_net_sched *sched,
model_net_sched_rc *sched_rc, const model_net_sched_rc *sched_rc,
tw_lp *lp){ tw_lp *lp){
sched->impl->add_rc(sched->dat, sched_rc, lp); sched->impl->add_rc(sched->dat, sched_rc, lp);
} }
......
...@@ -304,14 +304,21 @@ static model_net_event_return model_net_event_impl_base( ...@@ -304,14 +304,21 @@ static model_net_event_return model_net_event_impl_base(
// set the request struct // set the request struct
model_net_request *r = &m->msg.m_base.req; model_net_request *r = &m->msg.m_base.req;
r->net_id = net_id;
r->final_dest_lp = final_dest_lp; r->final_dest_lp = final_dest_lp;
r->dest_mn_lp = dest_mn_lp; r->dest_mn_lp = dest_mn_lp;
r->src_lp = sender->gid; r->src_lp = sender->gid;
r->msg_size = message_size; r->is_pull = is_pull;
if (r->is_pull) {
r->msg_size = PULL_MSG_SIZE;
r->pull_size = message_size;
}
else {
r->msg_size = message_size;
r->pull_size = 0;
}
r->net_id = net_id;
r->remote_event_size = remote_event_size; r->remote_event_size = remote_event_size;
r->self_event_size = self_event_size; r->self_event_size = self_event_size;
r->is_pull = is_pull;
strncpy(r->category, category, CATEGORY_NAME_MAX-1); strncpy(r->category, category, CATEGORY_NAME_MAX-1);
r->category[CATEGORY_NAME_MAX-1]='\0'; r->category[CATEGORY_NAME_MAX-1]='\0';
......
...@@ -107,6 +107,7 @@ static tw_stime simplenet_packet_event( ...@@ -107,6 +107,7 @@ static tw_stime simplenet_packet_event(
tw_lpid src_lp, tw_lpid src_lp,
tw_lp *sender, tw_lp *sender,
int is_last_pckt); int is_last_pckt);
static void simplenet_packet_event_rc(tw_lp *sender); static void simplenet_packet_event_rc(tw_lp *sender);
static void simplenet_packet_event_rc(tw_lp *sender); static void simplenet_packet_event_rc(tw_lp *sender);
......
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