diff --git a/server/include/cfg.h b/server/include/cfg.h index d0839bd35..0cbb5e85d 100644 --- a/server/include/cfg.h +++ b/server/include/cfg.h @@ -55,11 +55,12 @@ int config_parse_global(config_setting_t *cfg, struct settings *set); * @param cfg A libconfig object pointing to the path * @param paths Add new paths to this linked list * @param nodes A linked list of all existing nodes + * @param set The global configuration structure * @retval 0 Success. Everything went well. * @retval <0 Error. Something went wrong. */ int config_parse_path(config_setting_t *cfg, - struct list *paths, struct list *nodes); + struct list *paths, struct list *nodes, struct settings *set); /** Parse an array or single node and checks if they exist in the "nodes" section. * @@ -85,9 +86,10 @@ int config_parse_hooklist(config_setting_t *cfg, struct list *hooks); * * @param cfg A libconfig object pointing to the node. * @param nodes Add new nodes to this linked list. + * @param set The global configuration structure * @retval 0 Success. Everything went well. * @retval <0 Error. Something went wrong. */ -int config_parse_node(config_setting_t *cfg, struct list *nodes); +int config_parse_node(config_setting_t *cfg, struct list *nodes, struct settings *set); #endif /* _CFG_H_ */ diff --git a/server/include/node.h b/server/include/node.h index 7d3b5e584..fda53823f 100644 --- a/server/include/node.h +++ b/server/include/node.h @@ -136,6 +136,8 @@ struct node int refcnt; /** Number of messages to send / recv at once (scatter / gather) */ int combine; + /** CPU Affinity of this node */ + int affinity; /** A short identifier of the node, only used for configuration and logging */ const char *name; diff --git a/server/src/cfg.c b/server/src/cfg.c index c274ef34c..b56bb2177 100644 --- a/server/src/cfg.c +++ b/server/src/cfg.c @@ -61,7 +61,7 @@ int config_parse(const char *filename, config_t *cfg, struct settings *set, for (int i = 0; i < config_setting_length(cfg_nodes); i++) { config_setting_t *cfg_node = config_setting_get_elem(cfg_nodes, i); - config_parse_node(cfg_node, nodes); + config_parse_node(cfg_node, nodes, set); } } @@ -73,7 +73,7 @@ int config_parse(const char *filename, config_t *cfg, struct settings *set, for (int i = 0; i < config_setting_length(cfg_paths); i++) { config_setting_t *cfg_path = config_setting_get_elem(cfg_paths, i); - config_parse_path(cfg_path, paths, nodes); + config_parse_path(cfg_path, paths, nodes, set); } } @@ -93,7 +93,7 @@ int config_parse_global(config_setting_t *cfg, struct settings *set) } int config_parse_path(config_setting_t *cfg, - struct list *paths, struct list *nodes) + struct list *paths, struct list *nodes, struct settings *set) { const char *in; int enabled; @@ -244,7 +244,7 @@ int config_parse_hooklist(config_setting_t *cfg, struct list *hooks) { return 0; } -int config_parse_node(config_setting_t *cfg, struct list *nodes) +int config_parse_node(config_setting_t *cfg, struct list *nodes, struct settings *set) { const char *type; int ret; @@ -263,6 +263,9 @@ int config_parse_node(config_setting_t *cfg, struct list *nodes) if (!config_setting_lookup_int(cfg, "combine", &n->combine)) n->combine = 1; + if (!config_setting_lookup_int(cfg, "affinity", &n->combine)) + n->affinity = set->affinity; + n->vt = node_lookup_vtable(type); if (!n->vt) cerror(cfg, "Invalid type for node '%s'", n->name);