feat(1gbps): raise bitrate/probe clamps + socket buffers, count send-buffer drops
ci / rust (push) Has been cancelled

First step of 1 Gbps+ readiness (the whole point of the GF(2^16) Leopard FEC):
make 1 Gbps configurable and its dominant failure mode observable, before the
real transport work (sendmmsg + paced encode|send split) lands.

Investigation (6-way) verdict: we're ~halfway, and it's mostly clamps plus one
real piece of work. The integer/type path, FEC (a 1 Gbps frame is only a few
hundred shards in one GF(2^16) block, far under the 65535 ceiling), AES-GCM
(AES-NI, ~10-25x headroom), and the M1 reassembler bounds (fully derived from
the negotiated FecConfig) are ALL already 1 Gbps-ready and untouched.

This commit (the configurable + observable foundation):
- m3.rs: MAX_BITRATE_KBPS 500_000 -> 2_000_000 (2 Gbps headroom over the 1 Gbps+
  target); MAX_PROBE_KBPS 1_000_000 -> 3_000_000 (probe can demonstrate headroom
  ABOVE the session cap so a client can confidently pick a 1 Gbps+ bitrate).
- transport/udp.rs: TARGET_SOCKBUF 8 MB -> 32 MB (a multi-MB IDR keyframe burst
  no longer fills the buffer); scripts/99-punktfunk-net.conf bumped to match.
- Observability: Transport::send now returns Ok(true|false) (false = WouldBlock
  send-buffer drop, previously a silent Ok(())). Session counts these as a new
  `packets_send_dropped` stat (distinct from recv-side packets_dropped) — in
  Stats, the C ABI PunktfunkStats (header regenerated), a PUNKTFUNK_PERF periodic
  wire-Mbps + drop dump in virtual_stream, and the speed-test probe completion
  log. This is the dominant 1 Gbps+ loss mode and was invisible.

Loopback-verified: a probe now runs at 1.2 Gbps target (no longer truncated to
1 Gbps) with the drop counter live. NOT yet a sustained-1-Gbps proof — the
single-send()-per-packet native path is the next, real piece of work (port the
proven GameStream sendmmsg + paced send thread into the core Transport).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-11 20:45:49 +00:00
parent 902cc162f7
commit b8a33e21a2
9 changed files with 98 additions and 32 deletions
+9 -8
View File
@@ -1,11 +1,12 @@
# Larger UDP socket buffers for clean 4K/5K streaming.
# Larger UDP socket buffers for clean 4K/5K — and 1 Gbps+ — streaming.
#
# A single high-resolution frame is a burst (a 5120×1440 keyframe is ~130 packets sent at once),
# which overflows the Linux default (~208 KB) — dropping packets and, under infinite-GOP, freezing
# the client decode on one frame. punktfunk requests 8 MB SO_SNDBUF/SO_RCVBUF, but the kernel
# clamps to these caps; raise them on the HOST for send-side headroom (the host logs a warning
# when the grant is small). macOS clients need no tuning (their default cap is already multi-MB).
# A single high-resolution frame is a burst (a 5120×1440 keyframe is ~130 packets sent at once; a
# 1 Gbps IDR is several thousand), which overflows the Linux default (~208 KB) — dropping packets
# and, under infinite-GOP, freezing the client decode on one frame. punktfunk requests 32 MB
# SO_SNDBUF/SO_RCVBUF, but the kernel clamps to these caps; raise them on the HOST for send-side
# headroom (the host logs a warning when the grant is small, and counts send-buffer drops as
# `packets_send_dropped`). macOS clients need no tuning (their default cap is already multi-MB).
#
# Install: sudo cp scripts/99-punktfunk-net.conf /etc/sysctl.d/ && sudo sysctl --system
net.core.wmem_max = 8388608
net.core.rmem_max = 8388608
net.core.wmem_max = 33554432
net.core.rmem_max = 33554432