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:
parent
bd60c4424b
commit
614d267e4b
1 changed files with 34 additions and 0 deletions
34
src/server.c
34
src/server.c
|
@ -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()
|
||||
|
|
Loading…
Add table
Reference in a new issue