Repository navigation
Conversation
Define the DPDK packet and error counters emitted by the capture module so that EVE statistics validate against the schema. Ticket: 6012
The paragraph claimed that, apart from the checksum validation offload, no other offloads can be enabled. Suricata also enables VLAN stripping with vlan-strip-offload, MBUF_FAST_FREE and, with DPDK older than 21.11, the jumbo frame offload needed to apply an MTU above 1518. List the offloads Suricata enables.
Suricata sized its mbufs for the MTU, the Ethernet header, the CRC and one VLAN tag. NIC drivers account for two VLAN tags (QinQ): i40e and ice add them to their maximum frame size, while ixgbe keeps its maximum frame at the MTU plus 18 bytes and adds the two tags only when it decides whether a frame fits into one mbuf. Size the mbufs for two VLAN tags to be in line with these drivers. Ticket: 6012
A packet larger than one mbuf arrives as a chain of segmented mbufs, e.g. when Suricata runs as a secondary DPDK process and the primary application uses small mbufs, or when a PMD does not enforce the MTU. Suricata only warned about such packets and decoded them as if the first segment held the whole packet, reading past its data. Process a chain as one contiguous packet: 1. Merge it into its first mbuf with rte_pktmbuf_linearize(). 2. If that is not possible (not enough tailroom, or the first segment is not a direct mbuf with a single reference), copy all segments into the packet's own buffer. Each worker thread logs a warning for the first chain it receives, which advises to increase the mbuf size (secondary process) or the MTU (primary process) to avoid the extra work. In the copy modes (IPS/TAP), the mbuf chain is what gets forwarded. Forwarding chains requires the multi-segment TX offload, which replaces MBUF_FAST_FREE and selects a slower TX path on some NICs. As mbufs sized from the MTU rarely lead to chains on physical NICs, forwarding them is opt-in through the new tx-segmented-mbufs interface setting (default false), which both copy interfaces must share. When a copy interface does not advertise multi-segment TX, a warning is logged at startup and chains are transmitted anyway, as many virtual PMDs transmit them correctly without advertising the offload. Chains that cannot be inspected in full or forwarded are dropped when received: - malformed chains, whose segments do not add up to the packet length, - chains that cannot be merged and exceed the maximum packet size, - chains that cannot be merged and whose copy fails, as the buffer for a packet above the default packet size cannot be allocated, - in the copy modes, chains that cannot be merged while tx-segmented-mbufs is disabled, that have more segments than the copy interface can transmit, or that have an empty segment. DPDK treats a chain with an empty segment as valid, rte_pktmbuf_adj() and rte_pktmbuf_trim() produce such chains, and merging or copying them works. Some drivers cannot transmit them though: ice, for example, rejects them in rte_eth_tx_prepare(), which Suricata does not call. So only the chains that would be transmitted as received are dropped. The copy interface is asked for its segment limit when the worker threads start to receive packets. All interfaces are configured by then, while e.g. a bond port does not know the limits of its members before its first configuration. The drops are counted in capture.dpdk.segmented_drops, the oversized chains in capture.dpdk.segmented_too_large. In IPS mode, they are also counted in ips.blocked with the new capture_error drop reason, so that the drop reasons explain the blocked packets. In each worker thread, the first drop for each reason logs a warning. When inline stream normalization modifies a packet that was copied from a chain, the data is written back to the chain before it is transmitted. The packet is written back only if no segment of the chain is shared (an indirect mbuf, or an mbuf or external buffer with more than one reference, as handed over by a primary application that clones or keeps references to its mbufs). Otherwise, the modified packet is freed instead of transmitted, counted in capture.dpdk.shared_mbuf_drops, and a warning is logged once per worker thread. The verdict accounting precedes the release, so such a packet has no drop event and is still counted as forwarded: in ips.replaced in IPS mode and in ips.accepted in firewall mode. Ticket: 6012 Co-authored-by: Mahmoud Maatuq <mahmoudmatook.mm@gmail.com>
A packet received in a contiguous mbuf points directly to the mbuf data, so inline stream normalization rewrites the mbuf in place. When the mbuf is shared (an indirect mbuf, or an mbuf or external buffer with more than one reference, as handed over by a primary application that clones or keeps references to its mbufs), this also changes the data for its other holders. This behavior predates the segmented mbuf support. When inline stream normalization is enabled, copy the data of a shared contiguous mbuf into the packet's buffer, so that the modifications land in the copy. On release, such a packet is handled like a copied chain: an unmodified packet is forwarded as received, a modified one is written back only if no segment is shared anymore, and is otherwise freed and counted in capture.dpdk.shared_mbuf_drops. Mbufs that are not shared still point to the mbuf data. Without inline stream normalization nothing rewrites packet data, so shared contiguous mbufs are not copied either, e.g. in an IDS secondary process that receives clones of all packets. The copy can only fail when the buffer for a packet above the default packet size cannot be allocated. Such a packet is dropped before inspection, counted in capture.dpdk.shared_mbuf_drops and, in IPS mode, in ips.blocked with the capture_error drop reason. Ticket: 6012
Suricata sizes its mbufs from the configured MTU. A device that does not support setting the MTU, e.g. net_pcap, is not limited by it and can deliver frames larger than one mbuf. From DPDK 26.07, net_pcap delivers such frames, as segmented mbufs, only with the RX scatter offload enabled, and drops them otherwise. Enable RX scatter on the devices for which rte_eth_dev_set_mtu() returns -ENOTSUP and that offer the offload, and log it. Offloads are part of the port configuration, while the MTU can only be set on a configured port: on an unconfigured one the call fails with -EINVAL or, before DPDK 21.11, reaches a driver that is not ready for it. So the port, which is not started yet, is configured again with the offload. Devices that accept the MTU keep RX scatter disabled. Frames within the MTU fit into one mbuf there, and the offload alone selects slower RX paths on several NICs, e.g. it disables the vector RX and TX paths of bnxt. A bond port accepts the MTU when all of its members do. There is no configuration option for the offload. Ticket: 6012
lukashino
requested review from
a team,
jufajardini and
victorjulien
as code owners
November 26, 2026 22:40
suricata-review-bot
left a comment
There was a problem hiding this comment.
AI-generated review.
Verdict: approve
No high- or medium-severity findings.
Automated at commit 819c4f70da28 using Claude Code with claude-opus-5-5/xhigh. Run: e76c8e7216c2f6d7.
|
WARNING:
Pipeline = 36152 |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #16750 +/- ##
==========================================
- Coverage 83.98% 83.95% -0.03%
==========================================
Files 1008 1008
Lines 286748 286967 +219
==========================================
+ Hits 240832 240937 +105
- Misses 45916 46030 +114
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
victorjulien
approved these changes
Nov 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up of #16476
Suricata may receive segmented (chained) mbufs (big packets, larger than MTU, chunked into multiple mbufs).
Previously, these packets would trigger a warning and potentially be processed
incorrectly since only the first segment was accessible.
Now Suricata handles segmented mbufs by:
Link to ticket: https://redmine.openinfosecfoundation.org/issues/6012
Describe changes:
v12:
v10:
"supported with NFQ, IPFW and DPDK" line.
and in dpdk.rst. The commit message explains why.
v9:
SV_BRANCH=OISF/suricata-verify#3585