From aa1eb26e371e14dad0df002bb8ba784e7c7f6f82 Mon Sep 17 00:00:00 2001 From: Nataliia Solomko Date: Tue, 4 Aug 2026 17:40:11 +0300 Subject: vpp: T9146: Enable DPDK no-multi-seg when a full frame fits the buffer Disabling DPDK multi-segment buffers (no-multi-seg) lets VPP receive each frame into a single buffer, increasing forwarding throughput. The frame must then fit the buffer 'data-size', so 'no-multi-seg' is computed: it is enabled only while the largest MTU across all VPP-bound interfaces, plus its L2 framing overhead (26 bytes), fits 'data-size'. Otherwise VPP keeps multi-seg and Jumbo frames still work without a larger buffer. Changing the MTU of a VPP-bound interface can flip the flag, so interfaces_ethernet reconfigures VPP when it changes, via an initial dependency (set_dependents_initial) to avoid a cycle with the existing vpp -> ethernet dependency. --- python/vyos/vpp/config_resource_checks/memory.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'python') 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) -- cgit v1.2.3