From 390baad7dc729fd11b0f7782c80158b764a139c7 Mon Sep 17 00:00:00 2001 From: Lukas Sismis Date: Fri, 6 Dec 2024 13:42:21 +0100 Subject: [PATCH] util-affinity: move properties of *-cpu-set node one layer up in YAML --- src/util-affinity.c | 10 ++++------ suricata.yaml.in | 30 +++++++++++++++--------------- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/src/util-affinity.c b/src/util-affinity.c index 2708d6f213..6271a2726f 100644 --- a/src/util-affinity.c +++ b/src/util-affinity.c @@ -173,8 +173,7 @@ static const char *GetAffinitySetName(const char *val) static void SetupCpuSets(ThreadsAffinityType *taf, SCConfNode *affinity, const char *setname) { CPU_ZERO(&taf->cpu_set); - - SCConfNode *cpu_node = SCConfNodeLookupChild(affinity->head.tqh_first, "cpu"); + SCConfNode *cpu_node = SCConfNodeLookupChild(affinity, "cpu"); if (cpu_node != NULL) { BuildCpuset(setname, cpu_node, &taf->cpu_set); } else { @@ -233,8 +232,7 @@ static int SetupAffinityPriority( CPU_ZERO(&taf->lowprio_cpu); CPU_ZERO(&taf->medprio_cpu); CPU_ZERO(&taf->hiprio_cpu); - - SCConfNode *prio_node = SCConfNodeLookupChild(affinity->head.tqh_first, "prio"); + SCConfNode *prio_node = SCConfNodeLookupChild(affinity, "prio"); if (prio_node == NULL) { return 0; } @@ -251,7 +249,7 @@ static int SetupAffinityPriority( */ static int SetupAffinityMode(ThreadsAffinityType *taf, SCConfNode *affinity) { - SCConfNode *mode_node = SCConfNodeLookupChild(affinity->head.tqh_first, "mode"); + SCConfNode *mode_node = SCConfNodeLookupChild(affinity, "mode"); if (mode_node == NULL) { return 0; } @@ -273,7 +271,7 @@ static int SetupAffinityMode(ThreadsAffinityType *taf, SCConfNode *affinity) */ static int SetupAffinityThreads(ThreadsAffinityType *taf, SCConfNode *affinity) { - SCConfNode *threads_node = SCConfNodeLookupChild(affinity->head.tqh_first, "threads"); + SCConfNode *threads_node = SCConfNodeLookupChild(affinity, "threads"); if (threads_node == NULL) { return 0; } diff --git a/suricata.yaml.in b/suricata.yaml.in index 4bc0835468..64784f47f3 100644 --- a/suricata.yaml.in +++ b/suricata.yaml.in @@ -1880,24 +1880,24 @@ threading: # cpu-affinity: - management-cpu-set: - cpu: [ 0 ] # include only these CPUs in affinity settings + cpu: [ 0 ] # include only these CPUs in affinity settings - receive-cpu-set: - cpu: [ 0 ] # include only these CPUs in affinity settings + cpu: [ 0 ] # include only these CPUs in affinity settings - worker-cpu-set: - cpu: [ "all" ] - mode: "exclusive" - # Use explicitly 3 threads and don't compute number by using - # detect-thread-ratio variable: - # threads: 3 - prio: - low: [ 0 ] - medium: [ "1-2" ] - high: [ 3 ] - default: "medium" + cpu: [ "all" ] + mode: "exclusive" + # Use explicitly 3 threads and don't compute number by using + # detect-thread-ratio variable: + # threads: 3 + prio: + low: [ 0 ] + medium: [ "1-2" ] + high: [ 3 ] + default: "medium" #- verdict-cpu-set: - # cpu: [ 0 ] - # prio: - # default: "high" + # cpu: [ 0 ] + # prio: + # default: "high" # # By default Suricata creates one "detect" thread per available CPU/CPU core. # This setting allows controlling this behaviour. A ratio setting of 2 will