diff options
| author | Nataliia Solomko <natalirs1985@gmail.com> | 2026-08-04 17:40:11 +0300 |
|---|---|---|
| committer | Nataliia Solomko <natalirs1985@gmail.com> | 2026-08-31 13:45:52 +0300 |
| commit | aa1eb26e371e14dad0df002bb8ba784e7c7f6f82 (patch) | |
| tree | cc19b600492eec95c3676fe813af9e9aa888b5d7 /python | |
| parent | 2c269ef450f88690d03970fcafb1dbaa8b3b7f54 (diff) | |
| download | vyos-1x-aa1eb26e371e14dad0df002bb8ba784e7c7f6f82.tar.gz vyos-1x-aa1eb26e371e14dad0df002bb8ba784e7c7f6f82.zip | |
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.
Diffstat (limited to 'python')
| -rw-r--r-- | python/vyos/vpp/config_resource_checks/memory.py | 16 |
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) |
