From 7c24721f723e19b7a673f16a449a41ef3a44045b Mon Sep 17 00:00:00 2001 From: Lukas Sismis Date: Sat, 7 Mar 2026 22:40:03 +0100 Subject: [PATCH] dpdk: adjust burst size to mempool size When mempool size was configured really low (<32), Suricata exhausted the mempool with the rx_burst call, which led to undefined behavior. The current fix ensures the burst size is at most the size of the mempool, if the mempool is smaller than BURST_SIZE macro. (cherry picked from commit 1d06103e08b8edb9df20c0bb0cf6ff30a9f424be) --- src/source-dpdk.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/source-dpdk.c b/src/source-dpdk.c index f0068f3edc..2072af8f48 100644 --- a/src/source-dpdk.c +++ b/src/source-dpdk.c @@ -573,6 +573,9 @@ static TmEcode ReceiveDPDKLoop(ThreadVars *tv, void *data, void *slot) SCEnter(); DPDKThreadVars *ptv = (DPDKThreadVars *)data; ptv->slot = ((TmSlot *)slot)->slot_next; + uint32_t mp_sz = ptv->livedev->dpdk_vars->pkt_mp[ptv->queue_id]->size; + uint16_t burst_size = (uint16_t)MIN(BURST_SIZE, mp_sz); + TmEcode ret = ReceiveDPDKLoopInit(tv, ptv); if (ret != TM_ECODE_OK) { SCReturnInt(ret); @@ -584,7 +587,7 @@ static TmEcode ReceiveDPDKLoop(ThreadVars *tv, void *data, void *slot) } uint16_t nb_rx = - rte_eth_rx_burst(ptv->port_id, ptv->queue_id, ptv->received_mbufs, BURST_SIZE); + rte_eth_rx_burst(ptv->port_id, ptv->queue_id, ptv->received_mbufs, burst_size); if (RXPacketCountHeuristic(tv, ptv, nb_rx)) { continue; }