mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
removed more obsolete configuration options
git-svn-id: https://zerberus.eonerc.rwth-aachen.de:8443/svn/s2ss/trunk@128 8ec27952-4edc-4aab-86aa-e87bb2611832
This commit is contained in:
parent
fa97d70e79
commit
d082441e88
5 changed files with 31 additions and 47 deletions
|
@ -7,13 +7,11 @@ priority = 50; # Scheduler priority for the server
|
|||
|
||||
nodes = {
|
||||
acs = {
|
||||
id = 1, # Device ID
|
||||
type = "opal", # server, workstation, opal, rtds or dsp
|
||||
local = "127.0.0.1:10201", # Local ip:port, use '*' for random port
|
||||
remote = "127.0.0.1:10200"
|
||||
remote = "8.8.8.8:10200"
|
||||
},
|
||||
sintef = {
|
||||
id = 2,
|
||||
type = "rtds",
|
||||
local = "127.0.0.1:10202",
|
||||
remote = "127.0.0.1:10203",
|
||||
|
@ -24,8 +22,8 @@ nodes = {
|
|||
jitter = 30000, # Jitter in uS
|
||||
distribution = "normal",# Distribution of delay (uniform, normal, pareto, paretonormal)
|
||||
loss = 10 # Loss in percentage
|
||||
duplicate = 10, # Duplication in percentage
|
||||
corrupt = 10, # Corruption in percentage
|
||||
duplicate = 10, # Duplication in percent
|
||||
corrupt = 10 # Corruption in percent
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -18,8 +18,6 @@ struct netem;
|
|||
|
||||
/** Global configuration */
|
||||
struct settings {
|
||||
/** Name of this node */
|
||||
const char *name;
|
||||
/** Task priority (lower is better) */
|
||||
int priority;
|
||||
/** Core affinity of this task */
|
||||
|
|
|
@ -40,13 +40,10 @@ enum node_type
|
|||
*/
|
||||
struct node
|
||||
{
|
||||
/** A system-wide unique id per node */
|
||||
int id;
|
||||
|
||||
/** The socket descriptor */
|
||||
int sd;
|
||||
|
||||
/** A short identifier of the node */
|
||||
/** A short identifier of the node, only used for configuration and logging */
|
||||
const char *name;
|
||||
|
||||
/** The type of this node */
|
||||
|
|
|
@ -64,9 +64,6 @@ int config_parse(const char *filename, config_t *cfg, struct settings *set,
|
|||
|
||||
int config_parse_global(config_setting_t *cfg, struct settings *set)
|
||||
{
|
||||
if (!config_setting_lookup_string(cfg, "name", &set->name))
|
||||
cerror(cfg, "Missing node name");
|
||||
|
||||
config_setting_lookup_int(cfg, "affinity", &set->affinity);
|
||||
config_setting_lookup_int(cfg, "priority", &set->priority);
|
||||
|
||||
|
@ -140,8 +137,6 @@ int config_parse_path(config_setting_t *cfg,
|
|||
int config_parse_node(config_setting_t *cfg,
|
||||
struct node **nodes, struct interface **interfaces)
|
||||
{
|
||||
static int id;
|
||||
|
||||
const char *type_str = NULL;
|
||||
const char *remote_str = NULL;
|
||||
const char *local_str = NULL;
|
||||
|
@ -160,18 +155,12 @@ int config_parse_node(config_setting_t *cfg,
|
|||
if (!node->name)
|
||||
cerror(cfg, "Missing node name");
|
||||
|
||||
if (!config_setting_lookup_string(cfg, "type", &type_str))
|
||||
cerror(cfg, "Missing type for node '%s'", node->name);
|
||||
|
||||
if (!config_setting_lookup_string(cfg, "remote", &remote_str))
|
||||
cerror(cfg, "Missing remote address for node '%s'", node->name);
|
||||
|
||||
if (!config_setting_lookup_string(cfg, "local", &local_str))
|
||||
cerror(cfg, "Missing local address for node '%s'", node->name);
|
||||
|
||||
node->type = node_lookup_type(type_str);
|
||||
if (node->type == NODE_INVALID)
|
||||
cerror(cfg, "Invalid type '%s' for node '%s'", type_str, node->name);
|
||||
|
||||
if (resolve_addr(local_str, &node->local, AI_PASSIVE))
|
||||
cerror(cfg, "Failed to resolve local address '%s' of node '%s'", local_str, node->name);
|
||||
|
@ -180,15 +169,17 @@ int config_parse_node(config_setting_t *cfg,
|
|||
cerror(cfg, "Failed to resolve remote address '%s' of node '%s'", remote_str, node->name);
|
||||
|
||||
/* Optional settings */
|
||||
if (config_setting_lookup_string(cfg, "type", &type_str))
|
||||
node->type = node_lookup_type(type_str);
|
||||
else
|
||||
node->type = NODE_UNKNOWN;
|
||||
|
||||
config_setting_t *cfg_netem = config_setting_get_member(cfg, "netem");
|
||||
if (cfg_netem) {
|
||||
node->netem = (struct netem *) malloc(sizeof(struct netem));
|
||||
config_parse_netem(cfg_netem, node->netem);
|
||||
}
|
||||
|
||||
if (!config_setting_lookup_int(cfg, "id", &node->id))
|
||||
node->id = id++;
|
||||
|
||||
/* Determine outgoing interface */
|
||||
int index = if_getegress(&node->remote);
|
||||
struct interface *i = if_lookup_index(index, *interfaces);
|
||||
|
@ -232,5 +223,5 @@ int config_parse_netem(config_setting_t *cfg, struct netem *em)
|
|||
|
||||
/** @todo Check netem config values */
|
||||
|
||||
return 0;
|
||||
return CONFIG_TRUE;
|
||||
}
|
||||
|
|
|
@ -31,13 +31,8 @@ static struct path *paths;
|
|||
/** Linked list of interfaces */
|
||||
static struct interface *interfaces;
|
||||
|
||||
/** Default settings */
|
||||
static struct settings settings = {
|
||||
.priority = 0,
|
||||
.affinity = 0xC0,
|
||||
.protocol = 0
|
||||
};
|
||||
|
||||
/** The global configuration */
|
||||
static struct settings settings;
|
||||
static config_t config;
|
||||
|
||||
static void start()
|
||||
|
@ -46,11 +41,13 @@ static void start()
|
|||
for (struct interface *i = interfaces; i; i = i->next) {
|
||||
if_indextoname(i->index, i->name);
|
||||
|
||||
debug(3, "Configure interface %s (index = %d, refcnt = %u)",
|
||||
debug(3, "Setup interface '%s'",
|
||||
i->name, i->index, i->refcnt);
|
||||
|
||||
if_getirqs(i);
|
||||
if_setaffinity(i, settings.affinity);
|
||||
if (settings.affinity) {
|
||||
if_getirqs(i);
|
||||
if_setaffinity(i, settings.affinity);
|
||||
}
|
||||
|
||||
/* Create priority queuing discipline */
|
||||
tc_prio(i, TC_HDL(4000, 0), i->refcnt);
|
||||
|
@ -161,19 +158,22 @@ int main(int argc, char *argv[])
|
|||
debug(3, "This is a realtime patched kernel");
|
||||
|
||||
/* Use FIFO scheduler with realtime priority */
|
||||
struct sched_param param;
|
||||
param.sched_priority = settings.priority;
|
||||
if (sched_setscheduler(0, SCHED_FIFO, ¶m))
|
||||
perror("Failed to set realtime priority");
|
||||
else
|
||||
debug(3, "Set task priority to %u", settings.priority);
|
||||
if (settings.priority) {
|
||||
struct sched_param param = { .sched_priority = settings.priority };
|
||||
if (sched_setscheduler(0, SCHED_FIFO, ¶m))
|
||||
perror("Failed to set realtime priority");
|
||||
else
|
||||
debug(3, "Set task priority to %u", settings.priority);
|
||||
}
|
||||
|
||||
/* Pin threads to CPUs by setting the affinity */
|
||||
cpu_set_t cset = to_cpu_set(settings.affinity);
|
||||
if (sched_setaffinity(0, sizeof(cset), &cset))
|
||||
perror("Failed to set CPU affinity to '%#x'", settings.affinity);
|
||||
else
|
||||
debug(3, "Set affinity to %#x", settings.affinity);
|
||||
if (settings.affinity) {
|
||||
cpu_set_t cset = to_cpu_set(settings.affinity);
|
||||
if (sched_setaffinity(0, sizeof(cset), &cset))
|
||||
perror("Failed to set CPU affinity to '%#x'", settings.affinity);
|
||||
else
|
||||
debug(3, "Set affinity to %#x", settings.affinity);
|
||||
}
|
||||
|
||||
/* Connect all nodes and start one thread per path */
|
||||
start();
|
||||
|
|
Loading…
Add table
Reference in a new issue