From c4645a893837f11318aa44dfe8b0fea3c7d3914e Mon Sep 17 00:00:00 2001 From: enricobuehler Date: Wed, 15 Jul 2026 20:48:05 +0200 Subject: [PATCH] fix(host/linux): TCP_NODELAY on accepted usbip loopback sockets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The vhci-bound socket already set nodelay, but the server-side accepted socket — the one carrying every URB reply back to the kernel — did not. The wired single-interface device never tripped it, but the Puck's six concurrent endpoint streams turn the request/response URB pattern into classic write-write-read Nagle/delayed-ACK stalls: measured ~22 reports/s on Steam's active Puck hidraw (each ~45 ms apart, sequence jumping by 12) against a clean 266 Hz feed from the client. Trackpad felt accordingly. Co-Authored-By: Claude Fable 5 --- crates/punktfunk-host/src/inject/linux/steam_usbip.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/punktfunk-host/src/inject/linux/steam_usbip.rs b/crates/punktfunk-host/src/inject/linux/steam_usbip.rs index 74852707..f8631575 100644 --- a/crates/punktfunk-host/src/inject/linux/steam_usbip.rs +++ b/crates/punktfunk-host/src/inject/linux/steam_usbip.rs @@ -283,6 +283,11 @@ async fn run_server( _ = stop.notified() => break, r = listener.accept() => match r { Ok((mut sock, _)) => { + // URB replies are small and interleave with the kernel's next SUBMITs; without + // TCP_NODELAY the multi-interface request/response pattern collapses into + // ~40 ms Nagle/delayed-ACK stalls (observed as ~22 reports/s on the Puck's + // active hidraw against a 266 Hz source). + sock.set_nodelay(true).ok(); let server = server.clone(); tokio::spawn(async move { let _ = usbip_sim::handler(&mut sock, server).await;