summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@vyos.io>2026-09-25 15:55:23 +0100
committerGitHub <noreply@github.com>2026-09-25 15:55:23 +0100
commit430dda1e170576239d3580c1b7a6381525a05cbc (patch)
treee9c35672c54cea4b832a63f4dc815f387ff1463f /python
parent480f28781023d81f4be08524cecff172d1d55c3f (diff)
parentaa1eb26e371e14dad0df002bb8ba784e7c7f6f82 (diff)
downloadvyos-1x-430dda1e170576239d3580c1b7a6381525a05cbc.tar.gz
vyos-1x-430dda1e170576239d3580c1b7a6381525a05cbc.zip
Merge pull request #5376 from natali-rs1985/T9146
vpp: T9146: Enable DPDK no-multi-seg when a full frame fits the buffer
Diffstat (limited to 'python')
-rw-r--r--python/vyos/vpp/config_resource_checks/memory.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/python/vyos/vpp/config_resource_checks/memory.py b/python/vyos/vpp/config_resource_checks/memory.py
index 855527ff1..44ede3d7d 100644
--- a/python/vyos/vpp/config_resource_checks/memory.py
+++ b/python/vyos/vpp/config_resource_checks/memory.py
@@ -106,6 +106,22 @@ def buffer_size(settings: dict) -> int:
return buffers_memory
+def no_multi_seg_fits(max_mtu, data_size) -> bool:
+ """Whether 'no-multi-seg' can be enabled for the given MTU and buffer size.
+
+ With multi-segment buffers disabled a received frame must fit a single
+ buffer, so the largest interface MTU plus its L2 framing overhead must fit
+ within the buffer 'data-size' (T9146).
+ """
+ # Bytes a full L2 frame carries on top of the L3 MTU: Ethernet header (14),
+ # up to two QinQ VLAN tags (8) and the FCS (4). Matches VPP's DPDK frame
+ # overhead (RTE_ETHER_HDR_LEN + 2 * RTE_VLAN_HLEN + RTE_ETHER_CRC_LEN)
+ # https://github.com/FDio/vpp/blob/stable/2506/src/plugins/dpdk/device/init.c
+ # constants: https://github.com/DPDK/dpdk/blob/main/lib/net/rte_ether.h
+ l2_frame_overhead = 14 + 8 + 4
+ return int(data_size) >= int(max_mtu) + l2_frame_overhead
+
+
def main_heap_page_size(settings: dict) -> int:
heap_page_size = settings['resource_allocation']['memory']['main_heap_page_size']
return human_memory_to_bytes(heap_page_size)