Commit 0c99582b authored by Jonathan Jenkins's avatar Jonathan Jenkins
Browse files

refactor, addition of source LP to base msg

parent f4d8c7a4
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#define MODEL_NET_LP_H #define MODEL_NET_LP_H
#include <ross.h> #include <ross.h>
#include "codes/lp-msg.h"
#include "model-net.h" #include "model-net.h"
#include "model-net-sched.h" #include "model-net-sched.h"
#include "net/dragonfly.h" #include "net/dragonfly.h"
...@@ -88,8 +89,7 @@ typedef struct model_net_base_msg { ...@@ -88,8 +89,7 @@ typedef struct model_net_base_msg {
} model_net_base_msg; } model_net_base_msg;
typedef struct model_net_wrap_msg { typedef struct model_net_wrap_msg {
enum model_net_base_event_type event_type; msg_header h;
int magic;
union { union {
model_net_base_msg m_base; // base lp model_net_base_msg m_base; // base lp
terminal_message m_dfly; // dragonfly terminal_message m_dfly; // dragonfly
......
...@@ -26,6 +26,7 @@ static int msg_offsets[MAX_NETS]; ...@@ -26,6 +26,7 @@ static int msg_offsets[MAX_NETS];
typedef struct model_net_base_params_s { typedef struct model_net_base_params_s {
model_net_sched_cfg_params sched_params; model_net_sched_cfg_params sched_params;
uint64_t packet_size; uint64_t packet_size;
int use_recv_queue;
} model_net_base_params; } model_net_base_params;
/* annotation-specific parameters (unannotated entry occurs at the /* annotation-specific parameters (unannotated entry occurs at the
...@@ -133,8 +134,6 @@ static void base_read_config(const char * anno, model_net_base_params *p){ ...@@ -133,8 +134,6 @@ static void base_read_config(const char * anno, model_net_base_params *p){
uint64_t packet_size; uint64_t packet_size;
int ret; int ret;
// TODO: make this annotation-specific - put in the config loop, make part
// of model-net base
ret = configuration_get_value(&config, "PARAMS", "modelnet_scheduler", ret = configuration_get_value(&config, "PARAMS", "modelnet_scheduler",
anno, sched, MAX_NAME_LENGTH); anno, sched, MAX_NAME_LENGTH);
configuration_get_value_longint(&config, "PARAMS", "packet_size", anno, configuration_get_value_longint(&config, "PARAMS", "packet_size", anno,
...@@ -323,9 +322,9 @@ void model_net_base_event( ...@@ -323,9 +322,9 @@ void model_net_base_event(
tw_bf * b, tw_bf * b,
model_net_wrap_msg * m, model_net_wrap_msg * m,
tw_lp * lp){ tw_lp * lp){
assert(m->magic == model_net_base_magic); assert(m->h.magic == model_net_base_magic);
switch (m->event_type){ switch (m->h.event_type){
case MN_BASE_NEW_MSG: case MN_BASE_NEW_MSG:
handle_new_msg(ns, b, m, lp); handle_new_msg(ns, b, m, lp);
break; break;
...@@ -348,9 +347,9 @@ void model_net_base_event_rc( ...@@ -348,9 +347,9 @@ void model_net_base_event_rc(
tw_bf * b, tw_bf * b,
model_net_wrap_msg * m, model_net_wrap_msg * m,
tw_lp * lp){ tw_lp * lp){
assert(m->magic == model_net_base_magic); assert(m->h.magic == model_net_base_magic);
switch (m->event_type){ switch (m->h.event_type){
case MN_BASE_NEW_MSG: case MN_BASE_NEW_MSG:
handle_new_msg_rc(ns, b, m, lp); handle_new_msg_rc(ns, b, m, lp);
break; break;
...@@ -419,8 +418,8 @@ void handle_new_msg( ...@@ -419,8 +418,8 @@ void handle_new_msg(
b->c0 = 1; b->c0 = 1;
tw_event *e = codes_event_new(lp->gid, codes_local_latency(lp), lp); tw_event *e = codes_event_new(lp->gid, codes_local_latency(lp), lp);
model_net_wrap_msg *m = tw_event_data(e); model_net_wrap_msg *m = tw_event_data(e);
m->event_type = MN_BASE_SCHED_NEXT; msg_set_header(model_net_base_magic, MN_BASE_SCHED_NEXT, lp->gid,
m->magic = model_net_base_magic; &m->h);
// m_base not used in sched event // m_base not used in sched event
tw_event_send(e); tw_event_send(e);
ns->in_sched_loop = 1; ns->in_sched_loop = 1;
...@@ -462,8 +461,8 @@ void handle_sched_next( ...@@ -462,8 +461,8 @@ void handle_sched_next(
tw_event *e = codes_event_new(lp->gid, tw_event *e = codes_event_new(lp->gid,
poffset+codes_local_latency(lp), lp); poffset+codes_local_latency(lp), lp);
model_net_wrap_msg *m = tw_event_data(e); model_net_wrap_msg *m = tw_event_data(e);
m->event_type = MN_BASE_SCHED_NEXT; msg_set_header(model_net_base_magic, MN_BASE_SCHED_NEXT, lp->gid,
m->magic = model_net_base_magic; &m->h);
// no need to set m_base here // no need to set m_base here
tw_event_send(e); tw_event_send(e);
} }
...@@ -495,8 +494,8 @@ tw_event * model_net_method_event_new( ...@@ -495,8 +494,8 @@ tw_event * model_net_method_event_new(
void **extra_data){ void **extra_data){
tw_event *e = tw_event_new(dest_gid, offset_ts, sender); tw_event *e = tw_event_new(dest_gid, offset_ts, sender);
model_net_wrap_msg *m_wrap = tw_event_data(e); model_net_wrap_msg *m_wrap = tw_event_data(e);
m_wrap->event_type = MN_BASE_PASS; msg_set_header(model_net_base_magic, MN_BASE_PASS, sender->gid,
m_wrap->magic = model_net_base_magic; &m_wrap->h);
*msg_data = ((char*)m_wrap)+msg_offsets[net_id]; *msg_data = ((char*)m_wrap)+msg_offsets[net_id];
// extra_data is optional // extra_data is optional
if (extra_data != NULL){ if (extra_data != NULL){
...@@ -508,8 +507,8 @@ tw_event * model_net_method_event_new( ...@@ -508,8 +507,8 @@ tw_event * model_net_method_event_new(
void model_net_method_idle_event(tw_stime offset_ts, tw_lp * lp){ void model_net_method_idle_event(tw_stime offset_ts, tw_lp * lp){
tw_event *e = tw_event_new(lp->gid, offset_ts, lp); tw_event *e = tw_event_new(lp->gid, offset_ts, lp);
model_net_wrap_msg *m_wrap = tw_event_data(e); model_net_wrap_msg *m_wrap = tw_event_data(e);
m_wrap->event_type = MN_BASE_SCHED_NEXT; msg_set_header(model_net_base_magic, MN_BASE_SCHED_NEXT, lp->gid,
m_wrap->magic = model_net_base_magic; &m_wrap->h);
tw_event_send(e); tw_event_send(e);
} }
......
...@@ -256,8 +256,7 @@ static void model_net_event_impl_base( ...@@ -256,8 +256,7 @@ static void model_net_event_impl_base(
tw_event *e = codes_event_new(mn_lp, poffset+offset, sender); tw_event *e = codes_event_new(mn_lp, poffset+offset, sender);
model_net_wrap_msg *m = tw_event_data(e); model_net_wrap_msg *m = tw_event_data(e);
m->event_type = MN_BASE_NEW_MSG; msg_set_header(model_net_base_magic, MN_BASE_NEW_MSG, sender->gid, &m->h);
m->magic = model_net_base_magic;
// set the request struct // set the request struct
model_net_request *r = &m->msg.m_base.u.req; model_net_request *r = &m->msg.m_base.u.req;
......
...@@ -10,7 +10,7 @@ LPGROUPS ...@@ -10,7 +10,7 @@ LPGROUPS
PARAMS PARAMS
{ {
packet_size="2147483648"; packet_size="2147483648";
message_size="208"; message_size="216";
modelnet_order=( "loggp" ); modelnet_order=( "loggp" );
# scheduler options # scheduler options
modelnet_scheduler="fcfs"; modelnet_scheduler="fcfs";
......
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