Skip to main content

best_packet_size

Function best_packet_size 

Source
pub fn best_packet_size(mtu: u32) -> u32
Expand description

Compute an optimal GVSP packet size from the link MTU.

GevSCPSPacketSize is the transmitted IP packet size, so it tracks the link MTU rather than subtracting Ethernet, IPv4, or UDP headers — corroborated by aravis, which derives its payload block size as packet_size - (IP + UDP + GVSP headers) and so excludes L2 from the negotiated value (ARV_GVSP_PACKET_PROTOCOL_OVERHEAD).

The MTU is clamped to 65535, the largest an IPv4 datagram can be, because an unclamped value is not merely suboptimal, it is unsendable: on Linux loopback (MTU 65536) the sender would build a 65536 - 36 byte payload and a 65508-byte UDP datagram, one byte past the 65507-byte maximum, and send_to fails for every packet.