Hello guys,
I am trying to start the suricata in ips mode with 2 threads per interface and can’t do it.
My computer has 8 cores.
suricata : latest master
dpdk: 23.03.0
configuration in suricata.yaml:
dpdk:
eal-params:
proc-type: primary
interfaces:
- interface: 0000:01:00.2 # PCIe address of the NIC port
threads: 2
promisc: true # promiscuous mode - capture all packets
multicast: true # enables also detection on multicast packets
checksum-checks: true # if Suricata should validate checksums
checksum-checks-offload: true # if possible offload checksum validation to the NIC (saves Suricata resources)
mtu: 1500 # Set MTU of the device in bytes
mempool-size: 65535 # The number of elements in the mbuf pool
mempool-cache-size: 257
rx-descriptors: 1024
tx-descriptors: 1024
copy-mode: ips
copy-iface: 0000:01:00.3 # or PCIe address of the second interface
- interface: 0000:01:00.3 # PCIe address of the NIC port
threads: 2
promisc: true # promiscuous mode - capture all packets
multicast: true # enables also detection on multicast packets
checksum-checks: true # if Suricata should validate checksums
checksum-checks-offload: true # if possible offload checksum validation to the NIC (saves Suricata resources)
mtu: 1500 # Set MTU of the device in bytes
mempool-size: 65535 # The number of elements in the mbuf pool
mempool-cache-size: 257
rx-descriptors: 1024
tx-descriptors: 1024
copy-mode: ips
copy-iface: 0000:01:00.2 # or PCIe address of the second interface
- interface: default
threads: auto
promisc: true
multicast: true
checksum-checks: true
checksum-checks-offload: true
mtu: 1500
rss-hash-functions: auto
mempool-size: 65535
mempool-cache-size: 257
rx-descriptors: 1024
tx-descriptors: 1024
copy-mode: none
copy-iface: none
The Problem: Suricata can’t start:
sudo LD_LIBRARY_PATH=/usr/local/lib/x86_64-linux-gnu/ /usr/local/bin/suricata --dpdk
…
Error: dpdk: Interfaces requested more cores than configured in the threading section [ConfigSetThreads:runmode-dpdk.c:439]
Error: dpdk: 0000:01:00.2: fail to load config of interface [DeviceValidateOutIfaceConfig:runmode-dpdk.c:1240]
Error: dpdk: 0000:01:00.3: failed to configure [ParseDpdkConfigAndConfigureDevice:runmode-dpdk.c:1520]
I added tracing to the function static int ConfigSetThreads(DPDKIfaceConfig *iconf, const char *entry_str) (from runmode-dpdk.c )
static int ConfigSetThreads(DPDKIfaceConfig *iconf, const char *entry_str)
{
//ADymov
SCLogError("ConfigSetThreads for interface "%s" ", iconf->iface);
//ADymov
…
…
…
//ADymov
total_cpus += iconf->threads;
if (total_cpus > sched_cpus) {
SCLogError(“Interfaces requested more cores than configured in the threading section: %d > %d”, total_cpus, sched_cpus);
SCReturnInt(-ERANGE);
}
else
{
SCLogError(“Interfaces requested less cores than configured in the threading section: %d <= %d”, total_cpus, sched_cpus);
}
//ADymov
SCReturnInt(0);
}
Builded the suricata and repeated test:
sudo LD_LIBRARY_PATH=/usr/local/lib/x86_64-linux-gnu/ /usr/local/bin/suricata --dpdk
…
Error: dpdk: ConfigSetThreads for interface “0000:01:00.2” [ConfigSetThreads:runmode-dpdk.c:358]
Warning: dpdk: “all” specified in worker CPU cores affinity, excluding management threads [ConfigSetThreads:runmode-dpdk.c:380]
Error: dpdk: Interfaces requested less cores than configured in the threading section: 2 <= 7 [ConfigSetThreads:runmode-dpdk.c:444]
Error: dpdk: ConfigSetThreads for interface “0000:01:00.3” [ConfigSetThreads:runmode-dpdk.c:358]
Error: dpdk: Interfaces requested less cores than configured in the threading section: 4 <= 7 [ConfigSetThreads:runmode-dpdk.c:444]
Notice: dpdk: 0000:01:00.2: unable to determine NIC’s NUMA node, degraded performance can be expected [ReceiveDPDKThreadInit:source-dpdk.c:555]
Error: dpdk: ConfigSetThreads for interface “0000:01:00.3” [ConfigSetThreads:runmode-dpdk.c:358]
Error: dpdk: Interfaces requested less cores than configured in the threading section: 6 <= 7 [ConfigSetThreads:runmode-dpdk.c:444]
Error: dpdk: ConfigSetThreads for interface “0000:01:00.2” [ConfigSetThreads:runmode-dpdk.c:358]
Error: dpdk: Interfaces requested more cores than configured in the threading section: 8 > 7 [ConfigSetThreads:runmode-dpdk.c:439]
Error: dpdk: 0000:01:00.2: fail to load config of interface [DeviceValidateOutIfaceConfig:runmode-dpdk.c:1240]
Error: dpdk: 0000:01:00.3: failed to configure [ParseDpdkConfigAndConfigureDevice:runmode-dpdk.c:1520]
I have 8 cores. 1 core for management. So 7 core i can use. I expected suricata takes 4 core for ips mode, but she requires 8 cores.
The ConfigSetThreads() function is called twice for each interface and requires twice as many cores as needed.
If i disable this check, i can set threads: parameter to 2 or 3 and the suricata works faster and all cores are used.
set threads: parameter to 1 → trex shows speed: Total-Tx :6 Gbps, Total-Rx: 1.35 Gbps
set threads: parameter to 2 → trex shows speed: Total-Tx :6 Gbps, Total-Rx: 2.70 Gbps
set threads: parameter to 3 → trex shows speed: Total-Tx :6 Gbps, Total-Rx: 3.0 Gbps
But suricata prohibits assigning a parameter threads > 1.
Is it mistake?
Is there something that I am doing wrong ?
Thank you for any hint/help