1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

use interface list to apply netem settings and irq smp affinty

git-svn-id: https://zerberus.eonerc.rwth-aachen.de:8443/svn/s2ss/trunk@80 8ec27952-4edc-4aab-86aa-e87bb2611832
This commit is contained in:
Steffen Vogel 2014-06-25 01:53:49 +00:00
parent bd60c4424b
commit 614d267e4b

View file

@ -43,6 +43,24 @@ static config_t config;
static void start()
{
/* Configure interfaces */
for (struct interface *i = interfaces; i; i = i->next) {
if_indextoname(i->index, i->name);
if (i->index == 1) /* Skipping loopback interface */
continue;
debug(3, "Configure interface %s (index = %d, refcnt = %u)",
i->name, i->index, i->refcnt);
if_getirqs(i);
if_setaffinity(i, settings.affinity);
/* Create priority queuing discipline */
tc_reset(i);
tc_prio(i, TC_HDL(4000, 0), i->refcnt + 2);
}
/* Connect and bind nodes to their sockets, set socket options */
for (struct node *n = nodes; n; n = n->next) {
node_connect(n);
@ -72,6 +90,8 @@ static void start()
static void stop()
{
int affinity;
/* Join all threads and print statistics */
for (struct path *p = paths; p; p = p->next) {
path_stop(p);
@ -88,6 +108,20 @@ static void stop()
for (struct node *n = nodes; n; n = n->next) {
node_disconnect(n);
}
if (getuid() != 0)
return; /* The following tasks require root privs */
/* Determine default affinity */
FILE * f = fopen("/proc/irq/default_smp_affinity", "r");
fscanf(f, "%x", &affinity);
fclose(f);
/* Reset interface queues and affinity */
for (struct interface *i = interfaces; i; i = i->next) {
if_setaffinity(i, affinity);
tc_reset(i);
}
}
static void quit()