Hi, when I run suricata in dpdk runmode and replay a pcap file to this dpdk port, suricata gets a high pkts drop rate.
But when I switch to af-packets mode, it seems everything right.
myOS: Ubuntu20
memory: 128GB
Dpdk version: 21.11.1,
NIC: Intel 10-Gigabit X540-AT2
suricata.yaml:
dpdk:
eal-params:
proc-type: primary
# DPDK capture support
# RX queues (and TX queues in IPS mode) are assigned to cores in 1:1 ratio
interfaces:
- interface: 0000:5e:00.0 # PCIe address of the NIC port
# Threading: possible values are either "auto" or number of threads
# - auto takes all cores
# in IPS mode it is required to specify the number of cores and the numbers on both interfaces must match
threads: auto
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
# To approximately calculate required amount of space (in bytes) for interface's mempool: mempool-size * mtu
# Make sure you have enough allocated hugepages.
# The optimum size for the packet memory pool (in terms of memory usage) is power of two minus one: n = (2^q - 1)
mempool-size: 65535 # The number of elements in the mbuf pool
# Mempool cache size must be lower or equal to:
# - RTE_MEMPOOL_CACHE_MAX_SIZE (by default 512) and
# - "mempool-size / 1.5"
# It is advised to choose cache_size to have "mempool-size modulo cache_size == 0".
# If this is not the case, some elements will always stay in the pool and will never be used.
# The cache can be disabled if the cache_size argument is set to 0, can be useful to avoid losing objects in cache
# If the value is empty or set to "auto", Suricata will attempt to set cache size of the mempool to a value
# that matches the previously mentioned recommendations
mempool-cache-size: 257
rx-descriptors: 1024
tx-descriptors: 1024
#
# IPS mode for Suricata works in 3 modes - none, tap, ips
# - none: IDS mode only - disables IPS functionality (does not further forward packets)
# - tap: forwards all packets and generates alerts (omits DROP action) This is not DPDK TAP
# - ips: the same as tap mode but it also drops packets that are flagged by rules to be dropped
copy-mode: none
copy-iface: none # or PCIe address of the second interface
- interface: default
threads: auto
promisc: true
multicast: true
checksum-checks: true
checksum-checks-offload: true
mtu: 1500
mempool-size: 65535
mempool-cache-size: 257
rx-descriptors: 1024
tx-descriptors: 1024
copy-mode: none
copy-iface: none
Huge page info:
grep Huge /proc/meminfo
AnonHugePages: 0 kB
ShmemHugePages: 0 kB
FileHugePages: 0 kB
HugePages_Total: 16384
HugePages_Free: 16383
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
Hugetlb: 33554432 kB
dpdk runmode result:
[1467] 7/9/2022 -- 06:53:51 - (suricata.c:1146) <Notice> (LogVersion) -- This is Suricata version 7.0.0-dev running in SYSTEM mode
[1467] 7/9/2022 -- 06:53:51 - (util-classification-config.c:138) <Warning> (SCClassConfInitContextAndLocalResources) -- [ERRCODE: SC_ERR_FOPEN(44)] - could not open: "/usr/local/etc/suricata/classification.config": No such file or directory
[1467] 7/9/2022 -- 06:53:51 - (util-classification-config.c:538) <Error> (SCClassConfLoadClassficationConfigFile) -- [ERRCODE: SC_ERR_OPENING_FILE(40)] - please check the "classification-file" option in your suricata.yaml file
[1467] 7/9/2022 -- 06:53:51 - (util-reference-config.c:129) <Error> (SCRConfInitContextAndLocalResources) -- [ERRCODE: SC_ERR_FOPEN(44)] - Error opening file: "/usr/local/etc/suricata/reference.config": No such file or directory
[1467] 7/9/2022 -- 06:53:51 - (util-reference-config.c:505) <Error> (SCRConfLoadReferenceConfigFile) -- [ERRCODE: SC_ERR_OPENING_FILE(40)] - please check the "reference-config-file" option in your suricata.yaml file
[1467] 7/9/2022 -- 06:53:51 - (detect-engine-loader.c:239) <Warning> (ProcessSigFiles) -- [ERRCODE: SC_ERR_NO_RULES(42)] - No rule files match the pattern /usr/local/var/lib/suricata/rules/suricata.rules
[1467] 7/9/2022 -- 06:53:51 - (detect-engine-loader.c:354) <Warning> (SigLoadSignatures) -- [ERRCODE: SC_ERR_NO_RULES_LOADED(43)] - 1 rule files specified, but no rules were loaded!
[1467] 7/9/2022 -- 06:53:51 - (util-threshold-config.c:257) <Warning> (SCThresholdConfInitContext) -- [ERRCODE: SC_ERR_FOPEN(44)] - Error opening file: "/usr/local/etc/suricata//threshold.config": No such file or directory
EAL: No available 1048576 kB hugepages reported
EAL: DPDK is running on a NUMA system, but is compiled without NUMA support.
EAL: This will have adverse consequences for performance and usability.
EAL: Please use --legacy-mem option, or recompile with NUMA support.
TELEMETRY: No legacy callbacks, legacy socket not created
[1467] 7/9/2022 -- 06:53:52 - (unix-manager.c:144) <Error> (UnixNew) -- [ERRCODE: SC_ERR_INITIALIZATION(45)] - Cannot create socket directory /usr/local/var/run/suricata/: No such file or directory
[1467] 7/9/2022 -- 06:53:52 - (unix-manager.c:1050) <Warning> (UnixManagerInit) -- [ERRCODE: SC_ERR_INITIALIZATION(45)] - Unable to create unix command socket
[1467] 7/9/2022 -- 06:53:52 - (tm-threads.c:1927) <Notice> (TmThreadWaitOnThreadInit) -- Threads created -> W: 12 FM: 1 FR: 1 Engine started.
^C[1467] 7/9/2022 -- 06:54:11 - (suricata.c:2774) <Notice> (SuricataMainLoop) -- Signal Received. Stopping engine.
[1467] 7/9/2022 -- 06:54:13 - (util-device.c:355) <Notice> (LiveDeviceListClean) -- Stats for '0000:5e:00.0': pkts: 314059, drop: 158818 (50.57%), invalid chksum: 0
stats.log:
Date: 9/7/2022 -- 01:25:26 (uptime: 0d, 00h 00m 16s)
------------------------------------------------------------------------------------
Counter | TM Name | Value
------------------------------------------------------------------------------------
capture.packets | Total | 314051
capture.rx_errors | Total | 211896
capture.dpdk.imissed | Total | 138397
capture.dpdk.ierrors | Total | 73499
decoder.pkts | Total | 102155
decoder.bytes | Total | 108240640
decoder.invalid | Total | 1
decoder.ipv4 | Total | 102129
decoder.ipv6 | Total | 23
decoder.ethernet | Total | 102155
decoder.tcp | Total | 102083
decoder.udp | Total | 50
decoder.icmpv6 | Total | 12
decoder.avg_pkt_size | Total | 1059
decoder.max_pkt_size | Total | 1514
flow.total | Total | 106
flow.tcp | Total | 89
flow.udp | Total | 13
flow.icmpv6 | Total | 4
flow.wrk.spare_sync_avg | Total | 100
flow.wrk.spare_sync | Total | 12
decoder.event.ipv4.iplen_smaller_than_hlen | Total | 1
decoder.event.ipv4.opt_pad_required | Total | 6
decoder.event.ipv6.zero_len_padn | Total | 8
flow.wrk.flows_evicted_needs_work | Total | 52
flow.wrk.flows_evicted_pkt_inject | Total | 62
flow.wrk.flows_injected | Total | 52
tcp.sessions | Total | 74
tcp.syn | Total | 90
tcp.synack | Total | 68
tcp.rst | Total | 60
tcp.stream_depth_reached | Total | 2
tcp.reassembly_gap | Total | 10
app_layer.flow.http | Total | 49
app_layer.tx.http | Total | 98
app_layer.flow.tls | Total | 11
app_layer.error.tls.gap | Total | 1
app_layer.flow.dhcp | Total | 1
app_layer.tx.dhcp | Total | 3
app_layer.flow.failed_udp | Total | 12
flow.end.state.new | Total | 34
flow.end.state.established | Total | 6
flow.end.state.closed | Total | 66
flow.end.tcp_state.syn_sent | Total | 6
flow.end.tcp_state.established | Total | 2
flow.end.tcp_state.last_ack | Total | 2
flow.end.tcp_state.closed | Total | 64
flow.end.tcp_liberal | Total | 5
flow.mgr.full_hash_pass | Total | 1
flow.mgr.rows_per_sec | Total | 6553
flow.spare | Total | 10100
flow.mgr.rows_maxlen | Total | 2
flow.mgr.flows_checked | Total | 98
flow.mgr.flows_notimeout | Total | 98
memcap_pressure | Total | 10
memcap_pressure_max | Total | 10
flow.recycler.recycled | Total | 54
flow.recycler.queue_avg | Total | 3
flow.recycler.queue_max | Total | 54
tcp.memuse | Total | 7274496
tcp.reassembly_memuse | Total | 1376256
http.memuse | Total | 34070
flow.memuse | Total | 7810304
------------------------------------------------------------------------------------
af-packets runmode:
[1983] 7/9/2022 -- 07:33:57 - (util-device.c:355) <Notice> (LiveDeviceListClean) -- Stats for 'ens3f0': pkts: 240490, drop: 0 (0.00%), invalid chksum: 73488
Also, when I try it in another server with lower profile (NIC: 82576 Gigabit Network Connection, 8G, 4 core, dpdk:21.11), there is also a low drop rate.
logs:
[4578] 7/9/2022 -- 10:21:10 - (suricata.c:1147) <Notice> (LogVersion) -- This is Suricata version 7.0.0-dev running in SYSTEM mode
[4578] 7/9/2022 -- 10:21:10 - (util-classification-config.c:139) <Warning> (SCClassConfInitContextAndLocalResources) -- [ERRCODE: SC_ERR_FOPEN(44)] - could not open: "/usr/local/etc/suricata/classification.config": No such file or directory
[4578] 7/9/2022 -- 10:21:10 - (util-classification-config.c:539) <Error> (SCClassConfLoadClassficationConfigFile) -- [ERRCODE: SC_ERR_OPENING_FILE(40)] - please check the "classification-file" option in your suricata.yaml file
[4578] 7/9/2022 -- 10:21:10 - (util-reference-config.c:130) <Error> (SCRConfInitContextAndLocalResources) -- [ERRCODE: SC_ERR_FOPEN(44)] - Error opening file: "/usr/local/etc/suricata/reference.config": No such file or directory
[4578] 7/9/2022 -- 10:21:10 - (util-reference-config.c:506) <Error> (SCRConfLoadReferenceConfigFile) -- [ERRCODE: SC_ERR_OPENING_FILE(40)] - please check the "reference-config-file" option in your suricata.yaml file
[4578] 7/9/2022 -- 10:21:10 - (detect-engine-loader.c:239) <Warning> (ProcessSigFiles) -- [ERRCODE: SC_ERR_NO_RULES(42)] - No rule files match the pattern /usr/local/var/lib/suricata/rules/suricata.rules
[4578] 7/9/2022 -- 10:21:10 - (util-threshold-config.c:257) <Warning> (SCThresholdConfInitContext) -- [ERRCODE: SC_ERR_FOPEN(44)] - Error opening file: "/usr/local/etc/suricata//threshold.config": No such file or directory
EAL: No available 1048576 kB hugepages reported
TELEMETRY: No legacy callbacks, legacy socket not created
[4578] 7/9/2022 -- 10:21:11 - (runmode-dpdk.c:921) <Warning> (DeviceInitPortConf) -- [ERRCODE: SC_WARN_DPDK_CONF(344)] - Interface 0000:02:00.0 modified RSS hash function based on hardware support, requested:0xa38c configured:0x8104
[4588] 7/9/2022 -- 10:21:11 - (log-pcap.c:1047) <Notice> (PcapLogInitRingBuffer) -- Ring buffer initialized with 2 files.
[4595] 7/9/2022 -- 10:21:11 - (log-pcap.c:1047) <Notice> (PcapLogInitRingBuffer) -- Ring buffer initialized with 2 files.
[4598] 7/9/2022 -- 10:21:11 - (log-pcap.c:1047) <Notice> (PcapLogInitRingBuffer) -- Ring buffer initialized with 2 files.
[4600] 7/9/2022 -- 10:21:12 - (log-pcap.c:1047) <Notice> (PcapLogInitRingBuffer) -- Ring buffer initialized with 3 files.
[4578] 7/9/2022 -- 10:21:12 - (unix-manager.c:146) <Error> (UnixNew) -- [ERRCODE: SC_ERR_INITIALIZATION(45)] - Cannot create socket directory /usr/local/var/run/suricata/: No such file or directory
[4578] 7/9/2022 -- 10:21:12 - (unix-manager.c:1051) <Warning> (UnixManagerInit) -- [ERRCODE: SC_ERR_INITIALIZATION(45)] - Unable to create unix command socket
[4578] 7/9/2022 -- 10:21:12 - (tm-threads.c:1927) <Notice> (TmThreadWaitOnThreadInit) -- Threads created -> W: 4 FM: 1 FR: 1 Engine started.
^C[4578] 7/9/2022 -- 10:21:40 - (suricata.c:2774) <Notice> (SuricataMainLoop) -- Signal Received. Stopping engine.
[4578] 7/9/2022 -- 10:21:41 - (util-device.c:359) <Notice> (LiveDeviceListClean) -- Stats for '0000:02:00.0': pkts: 240569, drop: 351 (0.15%), invalid chksum: 0
There must be something wrong. Please help me figure it out. Thanks.