fix(host/linux): TCP_NODELAY on accepted usbip loopback sockets

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 <noreply@anthropic.com>
This commit is contained in:
2026-07-15 20:48:05 +02:00
co-authored by Claude Fable 5
parent 252960291e
commit c4645a8938
@@ -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;