Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
ca80103
schema: document generic DPDK capture statistics
Nov 11, 2026
593ac29
qa/live: remove the dpdk configuration test suite
Nov 11, 2026
c9ee4b8
qa/live: fail the dpdk test when no packets are captured
Sep 22, 2026
980ba51
qa/live: let the dpdk IDS test size its own mempool
Sep 22, 2026
1563f7e
dpdk: require DPDK 21.11
Sep 17, 2026
6430c5e
dpdk: timestamp packets once per RX burst
Sep 17, 2026
ea46e5b
dpdk: fix cleanup after packet processing failure
Sep 17, 2026
6a5ee32
dpdk: account for in-flight packets in mempool sizing
Sep 17, 2026
ff92ea2
dpdk: fix shutdown barrier race
Nov 11, 2026
d4d4802
dpdk: update counters on idle polls
Nov 11, 2026
4597f40
dpdk: adjust condition to uint type
Jun 19, 2025
cb04628
affinity: fix loop bound when walking the CPU set
Jun 19, 2025
8b2dc69
affinity: return bool from UtilAffinityCpusOverlap
Jun 19, 2025
187cedb
affinity: rename public APIs
Jun 19, 2025
ca2f93e
affinity: expose test reset function
Jun 19, 2025
b572fd8
dpdk: transform static variable to function-guarded global variable
Apr 7, 2024
6db68d1
util-device: reset the device list after cleanup
Apr 7, 2024
b2bc23d
unittests: let a test register a cleanup function
Oct 24, 2025
325a8ec
util/cpu: simulate the CPUs of the system in unit tests
Oct 24, 2025
d68df9a
affinity: restore the startup defaults in the test reset
Oct 24, 2025
38af491
suricata.yaml: comment out affinity examples with fixed CPU numbers
Oct 24, 2025
43e4df9
affinity: run unit tests on simulated CPUs
Oct 24, 2025
5ad3fe4
affinity: return errors from config loading
Oct 24, 2025
cf600d3
affinity: check every CPU number of a CPU set
Oct 24, 2025
90dfef7
affinity: accept all CPUs of the system in CPU sets
Oct 24, 2025
b194861
affinity: reduce test CPU definitions to 4 cores
Oct 27, 2025
e42334e
dpdk: add unit tests for mempool cache and thread assignment
Jan 13, 2025
a098b74
github-ci: expand unit test coverage with DPDK tests to Fedora
Apr 15, 2026
e600cbd
dpdk: add unit tests for mempool size calculation
Nov 11, 2026
2b0d3c8
util/ring-buffer: add a bounded FIFO for fixed-size elements
Sep 21, 2026
1566c7e
dpdk: add per-worker RX backlog
Sep 22, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions .github/workflows/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -954,6 +954,7 @@ jobs:
ccache \
clang \
diffutils \
dpdk-devel \
file-devel \
gcc \
gcc-c++ \
Expand All @@ -978,6 +979,7 @@ jobs:
libtool \
lz4-devel \
make \
numactl-devel \
parallel \
pcre2-devel \
pkgconfig \
Expand All @@ -998,7 +1000,7 @@ jobs:
- run: CC="clang" CFLAGS="$DEFAULT_CFLAGS -Wshadow" ./configure --disable-shared
- run: make check
- run: make distclean
- run: CC="clang" CFLAGS="$DEFAULT_CFLAGS -Wshadow -fsanitize=address -fno-omit-frame-pointer" ./configure --enable-warnings --enable-debug --enable-qa-simulation --enable-unittests --disable-shared --enable-rust-strict --enable-hiredis --enable-nfqueue
- run: CC="clang" CFLAGS="$DEFAULT_CFLAGS -Wshadow -fsanitize=address -fno-omit-frame-pointer" ./configure --enable-warnings --enable-debug --enable-qa-simulation --enable-unittests --disable-shared --enable-rust-strict --enable-hiredis --enable-nfqueue --enable-dpdk
env:
LDFLAGS: "-fsanitize=address"
ac_cv_func_realloc_0_nonnull: "yes"
Expand Down Expand Up @@ -1895,10 +1897,6 @@ jobs:
./qa/live/dpdk.sh "qa/live/dpdk/suricata-null-ips.yaml"
env:
LLVM_PROFILE_FILE: "/tmp/dpdk-ips.profraw"
# DPDK configuration checks
- run: ./qa/live/dpdk/dpdk-testsuite.sh
env:
LLVM_PROFILE_FILE: "/tmp/dpdk-testsuite-%p.profraw"
# AF_PACKET tests
- run: |
./qa/live/afp-ids.sh "2" "autofp"
Expand Down Expand Up @@ -2326,8 +2324,6 @@ jobs:
# IPS config
- run: |
./qa/live/dpdk.sh "qa/live/dpdk/suricata-null-ips.yaml"
# DPDK configuration checks
- run: ./qa/live/dpdk/dpdk-testsuite.sh
# AF_PACKET tests
- run: |
./qa/live/afp-ids.sh "2" "autofp"
Expand Down Expand Up @@ -3052,8 +3048,6 @@ jobs:
# IPS config
- run: |
./qa/live/dpdk.sh "qa/live/dpdk/suricata-null-ips.yaml"
# DPDK configuration checks
- run: ./qa/live/dpdk/dpdk-testsuite.sh
- name: Run suricata-verify live tests
id: sv_live
run: ASAN_OPTIONS=detect_leaks=0 python3 ./suricata-verify/live/run.py dpdk
Expand Down
10 changes: 3 additions & 7 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1434,10 +1434,10 @@
fi

AC_DEFINE([HAVE_DPDK],[1],(DPDK support enabled))
PKG_CHECK_EXISTS(libdpdk >= 19.11, , [with_pkgconfig_libdpdk=no])
PKG_CHECK_EXISTS(libdpdk >= 21.11, , [with_pkgconfig_libdpdk=no])
if test "$with_pkgconfig_libdpdk" = "no"; then
echo
echo " ERROR! libdpdk >= 19.11 not found by pkg-config, go get it"
echo " ERROR! libdpdk >= 21.11 not found by pkg-config, go get it"
echo " from https://www.dpdk.org/ or your distribution:"
echo
echo " Ubuntu: apt-get install dpdk-dev"
Expand All @@ -1452,11 +1452,7 @@
if test ! -z "$(ldconfig -p | grep librte_net_bond)"; then
AC_DEFINE([HAVE_DPDK_BOND],[1],(DPDK Bond PMD support enabled))
enable_dpdk_bond_pmd="yes"
LIBS="${LIBS} -lrte_net_bond" # 20.11+
elif test ! -z "$(ldconfig -p | grep librte_pmd_bond)"; then
AC_DEFINE([HAVE_DPDK_BOND],[1],(DPDK Bond PMD support enabled))
enable_dpdk_bond_pmd="yes"
LIBS="${LIBS} -lrte_pmd_bond"
LIBS="${LIBS} -lrte_net_bond"
else
echo
echo " WARNING: DPDK Bond PMD was not found on your system, "
Expand Down
62 changes: 60 additions & 2 deletions doc/userguide/capture-hardware/dpdk.rst
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,9 @@ by the NIC. Number of TX descriptors depends on the configured ``copy-mode``.
IDS (none) mode uses no TX descriptors and does not create any TX queues by
default. IPS and TAP mode uses the same number of TX descriptors as RX
descriptors.
The number of mempool and its cache is then derived from the count of
descriptors.
The size of each queue's mempool and its cache is then derived from the count
of descriptors, the configured RX backlog, and an allowance for in-flight
packets.

Rx (and Tx) descriptors are set to the highest possible value to allow more
buffer room when traffic spikes occur. However, it requires more memory.
Expand All @@ -215,6 +216,63 @@ Individual properties can still be set manually if needed.
.. note:: Mellanox ConnectX-4 NICs may not support auto-configuration of
``RX /TX descriptors``. Instead it can be set to a fixed value (e.g. 16384).

.. _dpdk-rx-backlog:

Per-worker RX backlog
---------------------

The optional ``rx-backlog-size`` interface setting allows a worker to drain
its NIC RX queue into a software first-in-first-out queue before processing
the packets. This helps absorb traffic bursts while the worker catches up
with packet processing.

.. code-block:: yaml

dpdk:
interfaces:
- interface: 0000:05:00.1
rx-backlog-size: 65536

The value is the number of packets (mbufs) **per RX queue / worker**. Zero
disables the backlog and is the default when the setting is absent from both
the interface and the default interface configuration. A nonzero value
must be a power of two of at least 32.

.. note:: TAP and IPS can experience extra forwarding latency in exchange for
fewer packet drops during bursts.

Packets waiting in the backlog receive a timestamp when the worker starts
processing their batch. Their timestamps therefore include time spent in the
backlog, which can affect correlation with other capture sources during bursts.

Packets still queued in the backlog when Suricata stops are processed before
the worker exits, so a shutdown can take up to the time needed to process
``rx-backlog-size`` packets per worker longer.

Choosing the backlog size
~~~~~~~~~~~~~~~~~~~~~~~~~

1. Start with a large ``rx-backlog-size`` that fits the sensor's memory budget.
2. Monitor the backlog counters during representative traffic, including the
busiest periods and expected bursts. Use ``capture.dpdk.backlog.max`` to
find the highest number of packets queued by any worker since startup.
A quiet period alone is not sufficient to size the backlog.
3. If the maximum stays well below ``rx-backlog-size``, you can reduce the size
to save memory. Choose a power of two above the observed peak and leave room
for larger bursts. For example, a peak of 40000 packets could justify
reducing a backlog of 131072 to 65536. Restart Suricata to apply the change
and potentially repeat the measurement.
4. If the maximum approaches the configured size or ``capacity_hits``
increases, check whether the backlog empties between bursts by observing
the ``capture.dpdk.backlog.current`` counter. If it does, a larger backlog
may help absorb those bursts. Otherwise, a high aggregate ``current`` value
across successive samples indicates that the workers may not be keeping up
with their traffic.

See ``stats.capture.dpdk.backlog`` in the
:doc:`EVE Index <../appendix/eve-index>` for each counter's interpretation
and recommended action.

.. _dpdk-link-state-change-timeout:

Link State Change timeout
Expand Down
36 changes: 23 additions & 13 deletions doc/userguide/configuration/suricata-yaml.rst
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,12 @@ receive-, worker- and verdict-set. These are fixed names and can not be
changed. For each set there are several options: cpu, mode, and prio. In the
option 'cpu' you can set the numbers of the CPU's/cores which will run the
threads from that set. You can set this option to 'all', use a range (0-3) or a
comma separated list (0,1). The option 'mode' can be set to 'balanced' or
comma separated list (0,1). CPU numbers start at 0 and must exist on the
system. With ``set-cpu-affinity`` enabled, Suricata does not start on a CPU
number the system does not have, an unknown CPU set name or a malformed CPU
range, mode, priority or thread count, also in the
``interface-specific-cpu-set`` of an interface that is not used.
The option 'mode' can be set to 'balanced' or
'exclusive'. When set to 'balanced', the individual threads can be processed by
all cores set in the option 'cpu'. If the option 'mode' is set to 'exclusive',
there will be fixed cores for each thread. As mentioned before, threads can
Expand Down Expand Up @@ -954,17 +959,17 @@ per available CPU/CPU core.
# detect-thread-ratio variable:
# threads: 3
prio:
low: [ 0 ]
medium: [ "1-2" ]
high: [ 3 ]
# low: [ 0 ]
# medium: [ "1-2" ]
# high: [ 3 ]
default: "medium"
interface-specific-cpu-set:
- interface: "enp4s0f0" # 0000:3b:00.0 # net_bonding0 # ens1f0
cpu: [ 1,3,5,7,9 ]
mode: "exclusive"
prio:
high: [ "all" ]
default: "medium"
# interface-specific-cpu-set:
# - interface: "enp4s0f0" # 0000:3b:00.0 # net_bonding0 # ens1f0
# cpu: [ 1,3,5,7,9 ]
# mode: "exclusive"
# prio:
# high: [ "all" ]
# default: "medium"
verdict-cpu-set:
cpu: [ 0 ]
prio:
Expand Down Expand Up @@ -2512,6 +2517,12 @@ auto-calculated by setting ``mempool-size: auto``. If ``mempool-size`` is set
manually (to e.g. ``mempool-size: 65536``), the value is divided by the number of
worker cores of the interface (on 4 worker threads, each worker is assigned
with a mempool containing 16383 packet objects).
Both auto sizing and manual minimum validation include each worker's RX and
TX descriptors, ``rx-backlog-size`` mbufs, and a 32-mbuf in-flight margin.
The optional :ref:`dpdk-rx-backlog` can help to overcome short-term traffic
bursts. The backlog is configured per worker/RX queue. Its size must be an
integer that is a power of two, with a minimum of 32; zero (the default)
disables it. A good value to start with could be, e.g., ``131072``.
Memory (in bytes) for interface's memory pools is calculated as:
``mempool-size`` * ``mtu``.
The sum of memory pool requirements divided by the size of one hugepage results
Expand Down Expand Up @@ -2549,8 +2560,7 @@ Other NICs using the same driver as mentioned above should work as well.
The DPDK capture interface has not been tested neither with the virtual
interfaces nor in the virtual environments like VMs, Docker or similar.

The minimal supported DPDK is version 19.11 which should be available in most
repositories of major distributions.
The minimal supported DPDK version is 21.11.
Alternatively, it is also possible to use ``meson`` and ``ninja`` to build and
install DPDK from source files.
It is required to have correctly configured tool ``pkg-config`` as it is used to
Expand Down
21 changes: 21 additions & 0 deletions doc/userguide/upgrade.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@ Major Changes
explicit rule that catches the SNI-less case if you want to keep the
drop (the reference SNI example in :doc:`firewall/firewall-example`
keeps the drop by having no certificate-state accept).
- DPDK capture support now requires DPDK 21.11 or later;
``./configure --enable-dpdk`` fails on older releases.
- ``mempool-size: auto`` for DPDK interfaces now reserves one RX burst (32
packets) per queue in addition to the RX and TX descriptors, and a manually
set ``mempool-size`` is validated against the same requirement.
- DPDK interfaces accept the optional ``rx-backlog-size`` setting, a per-worker
packet backlog that absorbs traffic bursts; see :ref:`dpdk-rx-backlog`.

Logging Changes
~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -120,6 +127,14 @@ Logging Changes
``stats.app_layer.*.ftp-data`` becomes ``stats.app_layer.*.ftp_data``,
and same for bittorrent_dht

- DPDK: all packets of one RX burst carry the same timestamp, taken when the
burst was received, instead of a timestamp taken when the processing of each
packet started. This should have none-to-minimal impact on timestamp accuracy
for most use cases. Packets held in the optional RX backlog
(``rx-backlog-size``) are timestamped when the worker starts processing
their batch, so their timestamps include the time spent in the backlog; see
:ref:`dpdk-rx-backlog`.
Comment on lines +130 to +136

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Medium (new) — This DPDK timestamp upgrade note runs to seven lines, and upgrade notes should be about three. Its second half repeats the backlog-timestamp explanation that the linked dpdk-rx-backlog section already gives. The backlog is also new and off by default, so it is not something users meet on upgrade. Keep the per-burst timestamp sentence and cut the backlog part down to a :ref: pointer. This was raised on Suricata PR #16749 and is still present.



- MQTT user properties are now logged as a new object called ``user_properties``
as an array of key-value pairs like ``[{"key":"mykey", "value":"myvalue"}]``
Expand Down Expand Up @@ -211,6 +226,12 @@ Other Changes
by default, set with ``max-preliminary-responses``. Past the limit, the
``ftp.too_many_preliminary_responses`` event is raised. See
:ref:`suricata-yaml-configure-ftp`.
- With ``threading.set-cpu-affinity`` enabled, Suricata now fails to start on a
``threading.cpu-affinity`` CPU number the system does not have, an unknown
CPU set name or a malformed CPU range, mode, priority or thread count, also
in the ``interface-specific-cpu-set`` of an interface that is not used.
- A CPU number the system does not have in the AF_PACKET ``xdp-cpu-redirect``
list disables the XDP CPU redirect, with a warning.

Changes for Library Users and Plugin Developers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
58 changes: 58 additions & 0 deletions etc/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -6968,6 +6968,52 @@
}
}
},
"dpdk": {
"type": "object",
"description": "Statistics for the DPDK capture module",
"additionalProperties": false,
"properties": {
"backlog": {
"type": "object",
"description": "RX backlog statistics, available when ``rx-backlog-size`` YAML setting is nonzero. In totals, ``max`` is the highest value from any single worker; other backlog counters are summed across workers. The ``enqueued``, ``capacity_hits``, and ``drain_budget_hits`` counters are cumulative since startup.",
"additionalProperties": false,
"properties": {
"capacity_hits": {
"type": "integer",
"description": "Number of episodes when a backlog could not receive another batch. Increases indicate that available space limited receiving: consider a larger backlog for short bursts, or address processing capacity if the backlog stays high. A continuously near-full backlog can count as one episode, so also monitor ``current``."
},
"current": {
"type": "integer",
"description": "Number of packets waiting for processing at the last sample. A worker returning to zero between bursts indicates that it is catching up. A value that stays near its configured capacity signals a sustained overload."
},
"drain_budget_hits": {
"type": "integer",
"description": "Number of times a worker received the full drain allowance into the backlog. Increases indicate bursty traffic as the NIC received many packets in between the drain periods."
},
"enqueued": {
"type": "integer",
"description": "Total packets placed in the backlog. An increase shows that the backlog is being used."
},
"max": {
"type": "integer",
"description": "Highest occupancy reached by any single worker since startup. Compare it directly with that worker's ``rx-backlog-size`` YAML option to assess spare capacity."
}
}
},
"ierrors": {
"type": "integer",
"description": "Number of erroneous received packets reported by DPDK"
},
"imissed": {
"type": "integer",
"description": "Number of packets dropped by the NIC because receive buffers were unavailable"
},
"no_mbufs": {
"type": "integer",
"description": "Number of RX packet-buffer allocation failures reported by DPDK"
}
}
},
"errors": {
"type": "integer",
"description": "Number of Suricata errors reported while reading capture module"
Expand All @@ -6983,6 +7029,18 @@
"kernel_packets": {
"type": "integer",
"description": "Number of packets received from the kernel"
},
"packets": {
"type": "integer",
"description": "Number of received packets plus receive errors reported by the DPDK capture module"
},
"rx_errors": {
"type": "integer",
"description": "Total DPDK missed packets, erroneous received packets, and RX packet-buffer allocation failures"
},
"tx_errors": {
"type": "integer",
"description": "Number of packet transmission errors reported by DPDK"
}
}
},
Expand Down
4 changes: 2 additions & 2 deletions qa/live/dpdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ sleep 15

# check stats and alerts
STATSCHECK=$(jq -c 'select(.event_type == "stats")' ./eve.json | tail -n1 | jq '.stats.capture.packets > 0')
if [ $STATSCHECK = false ]; then
if [ "$STATSCHECK" != true ]; then
echo "ERROR no packets captured"
RES=1
fi
Expand All @@ -59,7 +59,7 @@ sleep 15

# check stats and alerts
STATSCHECK=$(jq -c 'select(.event_type == "stats")' ./eve.json | tail -n1 | jq '.stats.capture.packets > 0')
if [ $STATSCHECK = false ]; then
if [ "$STATSCHECK" != true ]; then
echo "ERROR no packets captured"
RES=1
fi
Expand Down
Loading
Loading