Skip to content

fix(quinn-udp): add Apple fast path API stubs for windows and fallback#2566

Closed
mxinden wants to merge 1 commit intoquinn-rs:mainfrom
mxinden:other-platforms
Closed

fix(quinn-udp): add Apple fast path API stubs for windows and fallback#2566
mxinden wants to merge 1 commit intoquinn-rs:mainfrom
mxinden:other-platforms

Conversation

@mxinden
Copy link
Collaborator

@mxinden mxinden commented Mar 10, 2026

Mirror the Apple fast datapath APIs to windows.rs and fallback.rs.

See discussion in #2463 (comment).

Mirror the Apple fast datapath APIs to windows.rs and fallback.rs.

See discussion in quinn-rs#2463 (comment).
Copy link
Contributor

@thomaseizinger thomaseizinger left a comment

Choose a reason for hiding this comment

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

LGTM

Given that they are "experimental" as you said, maybe they should be gated on the feature being enabled?

@mxinden
Copy link
Collaborator Author

mxinden commented Mar 10, 2026

Turns out, this is a bit more complex than I thought:

In unix.rs they are currently gated on apple_fast:

quinn/quinn-udp/src/unix.rs

Lines 345 to 364 in c67e9d8

/// Enables Apple's fast UDP datapath using private `sendmsg_x`/`recvmsg_x` APIs.
/// Once enabled, this also updates [`max_gso_segments`] to allow batched sends.
///
/// # Safety
///
/// These APIs may crash on unsupported OS versions, so callers must verify
/// availability before enabling.
///
/// [`max_gso_segments`]: Self::max_gso_segments
#[cfg(apple_fast)]
pub unsafe fn set_apple_fast_path(&self) {
self.apple_fast_path.store(true, Ordering::Relaxed);
self.max_gso_segments.store(BATCH_SIZE, Ordering::Relaxed);
}
/// Returns whether Apple's fast UDP datapath is enabled for this socket.
#[cfg(apple_fast)]
pub fn is_apple_fast_path_enabled(&self) -> bool {
self.apple_fast_path.load(Ordering::Relaxed)
}

apple_fast is only true on Apple platforms:

apple_fast: { all(apple, feature = "fast-apple-datapath") },

Thus e.g. on Linux, the APIs are currently not available.

@thomaseizinger how should we proceed?

  1. Make them available on all platforms, including Linux?
  2. Make them available on MacOS only (i.e. status quo).

@thomaseizinger
Copy link
Contributor

Make them available on MacOS only (i.e. status quo).

I guess this is the better option then!

@mxinden
Copy link
Collaborator Author

mxinden commented Mar 10, 2026

👍 will keep as is then, i.e. closing here.

@mxinden mxinden closed this Mar 10, 2026
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.

2 participants