Commit ae0f71dd authored by Jonathan Jenkins's avatar Jonathan Jenkins

sched method refactor, added non-packetizing fcfs sched

- NOTE: shim just forces packet size to a huge number
parent 27fc0282
......@@ -13,6 +13,27 @@
#include "model-net.h"
#include "model-net-method.h"
/// types of schedulers
/// format: enum type, config string, function pointer names
/// fcfs-full eschews packetization
#define SCHEDULER_TYPES \
X(MN_SCHED_FCFS, "fcfs", &fcfs_tab) \
X(MN_SCHED_FCFS_FULL, "fcfs-full", &fcfs_tab) \
X(MN_SCHED_RR, "round-robin", &rr_tab) \
X(MAX_SCHEDS, NULL, NULL)
#define X(a,b,c) a,
enum sched_type {
SCHEDULER_TYPES
};
#undef X
extern char * sched_names[];
/// global for scheduler
/// TODO: move away from using the global for when we have multiple networks
extern enum sched_type mn_sched_type;
/// scheduler decls
typedef struct model_net_sched_s model_net_sched;
......@@ -41,15 +62,6 @@ typedef struct model_net_sched_interface {
void (*next_rc)(void * sched, model_net_sched_rc *rc, tw_lp *lp);
} model_net_sched_interface;
enum sched_type {
MN_SCHED_FCFS, // issue all packets at once (orig. model-net behavior)
MN_SCHED_RR // round-robin packet scheduling
};
/// global for scheduler
/// TODO: move away from using the global for when we have multiple networks
extern enum sched_type mn_sched_type;
/// overall scheduler struct - type puns the actual data structure
struct model_net_sched_s {
......
......@@ -20,4 +20,6 @@ src_libcodes_net_a_SOURCES = \
src/models/networks/model-net/loggp.c \
src/models/networks/model-net/simplewan.c \
src/models/networks/model-net/model-net-lp.c \
src/models/networks/model-net/model-net-sched.c
src/models/networks/model-net/model-net-sched.c \
src/models/networks/model-net/model-net-sched-impl.h \
src/models/networks/model-net/model-net-sched-impl.c
This diff is collapsed.
/*
* Copyright (C) 2014 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*
*/
#ifndef MODEL_NET_SCHED_IMPL_H
#define MODEL_NET_SCHED_IMPL_H
#include "codes/model-net-sched.h"
#include "codes/model-net-method.h"
extern model_net_sched_interface * sched_interfaces[];
#endif /* end of include guard: MODEL-NET-SCHED-IMPL_H */
/*
* Local variables:
* c-indent-level: 4
* c-basic-offset: 4
* End:
*
* vim: ft=c ts=8 sts=4 sw=4 expandtab
*/
......@@ -264,25 +264,23 @@ int model_net_set_params()
config_lpgroups_t paramconf;
configuration_get_lpgroups(&config, "PARAMS", &paramconf);
configuration_get_value(&config, "PARAMS", "modelnet", mn_name, MAX_NAME_LENGTH);
configuration_get_value_longint(&config, "PARAMS", "packet_size", &packet_size_l);
ret = configuration_get_value(&config, "PARAMS", "modelnet_scheduler", sched,
MAX_NAME_LENGTH);
configuration_get_value_longint(&config, "PARAMS", "packet_size", &packet_size_l);
packet_size = packet_size_l;
if(!packet_size)
{
packet_size = 512;
printf("\n Warning, no packet size specified, setting packet size to %llu ", packet_size);
}
if (ret > 0){
if (strcmp("round-robin", sched) == 0){
mn_sched_type = MN_SCHED_RR;
int i;
for (i = 0; i < MAX_SCHEDS; i++){
if (strcmp(sched_names[i], sched) == 0){
mn_sched_type = i;
break;
}
}
else if (strcmp("fcfs", sched) == 0){
mn_sched_type = MN_SCHED_FCFS;
}
else{
fprintf(stderr, "Unknown value for PARAMS:modelnet-scheduler : %s\n",
if (i == MAX_SCHEDS){
fprintf(stderr,
"Unknown value for PARAMS:modelnet-scheduler : %s\n",
sched);
abort();
}
......@@ -292,6 +290,17 @@ int model_net_set_params()
mn_sched_type = MN_SCHED_FCFS;
}
if (mn_sched_type == MN_SCHED_FCFS_FULL){
// override packet size to something huge (leave a bit in the unlikely
// case that an op using packet size causes overflow)
packet_size = 1ull << 62;
}
else if (!packet_size && mn_sched_type != MN_SCHED_FCFS_FULL)
{
packet_size = 512;
fprintf(stderr, "\n Warning, no packet size specified, setting packet size to %llu ", packet_size);
}
if(strcmp(model_net_method_names[SIMPLENET],mn_name)==0)
{
double net_startup_ns, net_bw_mbps;
......
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