Set TCP_NODELAY on the ps2link request socket#25
Open
doctorspider42 wants to merge 1 commit into
Open
Conversation
ps2link fileio is a synchronous sequence of small request/response exchanges over the TCP request channel. With Nagle enabled on the client side, each response collides with the PS2 delayed ACKs and stalls ~200 ms, capping file serving at roughly 4 KB/s on a real console: a 424 KB texture took 106 seconds to serve, and a homebrew game booting entirely over host: took 10 minutes. With TCP_NODELAY on the SOCK_STREAM connect path the same texture serves in about a second and the same boot takes ~30 seconds (measured on a PAL console over 100 Mbit ethernet, Windows host); streaming 22 kHz music over host: becomes usable.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
ps2link fileio is a synchronous sequence of small request/response exchanges over the TCP request channel (port 0x4711). With Nagle enabled on the client side, each response collides with the PS2 stack delayed ACKs and stalls roughly one delayed-ACK period (~200 ms) per exchange.
Measured effect (PAL console, 100 Mbit ethernet, Windows host, ps2link v1.9.1): file serving capped at about 4 KB/s - a 424 KB texture took 106 seconds, and a homebrew game loading all of its assets over
host:took 10 minutes to boot.Fix
Set
TCP_NODELAYon theSOCK_STREAMconnect path innetwork_connect()(UDP sockets unaffected). Small responses then leave immediately instead of waiting for the ACK of the previous segment.With the patch, the same texture serves in about a second and the same game boots in ~30 seconds; streaming 22 kHz PCM music over
host:becomes usable. Verified on real hardware against ps2link v1.9.1; behaviour on Linux/macOS builds is the same code path (netinet/tcp.hinclude added for those platforms).🤖 Generated with Claude Code