Files
fanyang 09cd15725e perf(udp): add GSO batch send via quinn-udp for UDP tunnel
Replace per-packet socket.send_to() with batch drain + GSO sendmsg
in forward_from_ring_to_udp. Uses quinn-udp's UdpSocketState to
leverage UDP_SEGMENT (GSO) when the kernel supports it.

Architecture:
  1. Await first packet from RingStream
  2. Non-blocking drain up to 8 more packets (noop_waker poll_next)
  3. If all same size + GSO supported: concatenate + single sendmsg
     with UDP_SEGMENT → kernel splits into N UDP datagrams
  4. Otherwise: fallback to per-packet send

Feature gated behind 'udp-gso' (enabled in default features).
Falls back to per-packet send on older kernels (no GSO support).

Benchmark (localhost, no hotpath):
  Before GSO: 1,066K pps
  After GSO:  1,070K pps (noise — localhost has no NIC driver overhead)

GSO will have larger impact on real WAN interfaces where syscall
overhead dominates. Implementation is correct and ready for that.

All 208 peers tests pass. 6 netns tests fail (require root, unchanged).
2026-06-29 03:24:55 +08:00
..