Skip to content

quinn-udp: retry GSO batch after disabling offload#2724

Open
kixelated wants to merge 1 commit into
quinn-rs:mainfrom
kixelated:codex/gso-disable-retry
Open

quinn-udp: retry GSO batch after disabling offload#2724
kixelated wants to merge 1 commit into
quinn-rs:mainfrom
kixelated:codex/gso-disable-retry

Conversation

@kixelated

Copy link
Copy Markdown

Fixes #2399

The first batch that causes a GSO failure is often the initial packet, which takes forever to retry sending at the QUIC layer because of the default RTT. This should improves connection time dramatically on some Linux devices (apparently Android).

@kixelated kixelated changed the title retry GSO batch after disabling offload quinn-udp: retry GSO batch after disabling offload Jul 9, 2026
@kixelated
kixelated force-pushed the codex/gso-disable-retry branch from 608e04a to 565fcd6 Compare July 9, 2026 21:12
Comment thread quinn-proto/src/connection/packet_crypto.rs Outdated
Comment thread quinn-udp/src/unix.rs Outdated
Comment thread quinn-udp/src/unix.rs Outdated
Comment thread quinn-udp/tests/tests.rs
@mxinden

mxinden commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

Very much in favor. Thanks for working on it.

We (Firefox) ran into the same issue. We currently re-send within Firefox. Instead re-sending in quinn-udp would be much cleanre.

https://bugzilla.mozilla.org/show_bug.cgi?id=2049334

@kixelated
kixelated force-pushed the codex/gso-disable-retry branch 2 times, most recently from 296845f to adc90b9 Compare July 12, 2026 14:46

@thomaseizinger thomaseizinger left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK, a few nits

Comment thread quinn-udp/src/unix.rs Outdated
state.max_gso_segments.store(1, Ordering::Relaxed);

// Immediately retry this batch as individual datagrams rather than waiting
// for the QUIC layer to time out and retransmit. These sends run with GSO

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Refer to "upper" layer here.

Comment thread quinn-udp/src/unix.rs
Comment thread quinn-udp/src/unix.rs
Comment thread quinn-udp/src/unix.rs Outdated
#[allow(unused_variables)] // only used on Linux
state: &UdpSocketState,
io: SockRef<'_>,
io: &SockRef<'_>,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can avoid this by re-borrowing the ref instead:

let io = SockRef::from(&*io);

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I opted for & because it's feels less magic, but IDK.

@kixelated
kixelated force-pushed the codex/gso-disable-retry branch from adc90b9 to 3535538 Compare July 15, 2026 17:16
Comment thread quinn-udp/src/unix.rs Outdated
let segment_size = transmit
.segment_size
.unwrap_or(transmit.contents.len())
.max(1);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is that for?

If contents.len is 0, we can just return Ok(()), right? And if segment_size is 0, we should probably fail?

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@kixelated
kixelated force-pushed the codex/gso-disable-retry branch from 3535538 to c6ad76d Compare July 17, 2026 03:50
@kixelated
kixelated requested a review from thomaseizinger July 17, 2026 03:53

@Ralith Ralith left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@thomaseizinger

Copy link
Copy Markdown
Collaborator

Note that this also gets fixed in #2748 which may be preferable to merge because it also fixes another issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

udp: retry failed GSO sendmsg on EIO without GSO

4 participants