Repository navigation
net/tstun: implement tun.MultiQueueDevice - #21665
Merged
Merged
Conversation
Wrapper presents one read queue per queue of the underlying device, and forwards the flow it is given on the write side. pollVector still multiplexes injected packets onto the device's own read, which is queue 0. Wrapper.Read is now queues[0].Read and behaves exactly as it did. Locally-terminated traffic stays on flow 0. This is a no-op change: the Wrapper presents a single queue and wireguard-go runs the single reader goroutine it ran before. Updates tailscale/corp#37878 Change-Id: I844e95cf430075e237ad7e83bdbaa8e43e067ccb Signed-off-by: Alex Valiushko <[email protected]>
raggi
approved these changes
Oct 6, 2026
raggi
added a commit
that referenced
this pull request
Oct 6, 2026
gVisor can synchronously generate replies on a TUN reader or loopback consumer. Make link endpoint queue writes nonblocking so saturation cannot stop the goroutine needed to drain the queue. TCP can retransmit; UDP and other non-retrying traffic may lose packets under load. Count all PacketBuffers rejected by queue saturation, including the unaccepted batch tail. Expose the same per-netstack counter through user-facing and debug metrics, and sum it across netstacks for the client-metrics pipeline. Cancel pending tstun injections during netstack shutdown, close link queues before aborting endpoints, and stop the WireGuard injection pump on a closed Wrapper. Release rejected and canceled references, drain unread injections on Wrapper close, and release capture buffers. Keep PR #21665 multiqueue semantics: injections are multiplexed only onto queue 0. Cover independent native-reader progress, concurrent reply saturation and drop accounting, cancellation, shutdown, ownership, loopback progress, and TCP recovery. Fixes #21631 Updates #21638 Related: #21632, #21639 Signed-off-by: James Tucker <[email protected]>
cmol
approved these changes
Oct 7, 2026
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.
Wrapper presents one read queue per queue of the underlying device, and forwards the flow it is given on the write side.
pollVector still multiplexes injected packets onto the device's own read, which is queue 0. Wrapper.Read is now queues[0].Read and behaves exactly as it did. Locally-terminated traffic stays on flow 0.
This is a no-op change: the Wrapper presents a single queue and wireguard-go runs the single reader goroutine it ran before.
Updates tailscale/corp#37878
Change-Id: I844e95cf430075e237ad7e83bdbaa8e43e067ccb