Skip to content

Commit

Permalink
udp: disable GSO on EINVAL
Browse files Browse the repository at this point in the history
Linux 5.15 was observed to emit an EINVAL when attempting to transmit
UDP with GSO over IPv6 on a virtio net interface. 6.1 was also
observed to emit EINVAL, though only after EIO. In both cases, EINVAL
was suppressed by disabling GSO.

(cherry picked from commit a0dd5ff)
  • Loading branch information
Ralith committed Aug 20, 2023
1 parent 7f6bc93 commit ca287d5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions quinn-udp/src/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,15 +218,15 @@ fn send(
}
io::ErrorKind::WouldBlock => return Err(e),
_ => {
// Some network adapters do not support GSO. Unfortunately, Linux offers no easy way
// for us to detect this short of an I/O error when we try to actually send
// datagrams using it.
// Some network adapters and drivers do not support GSO. Unfortunately, Linux
// offers no easy way for us to detect this short of an EIO or sometimes EINVAL
// when we try to actually send datagrams using it.
#[cfg(target_os = "linux")]
if e.raw_os_error() == Some(libc::EIO) {
if let Some(libc::EIO) | Some(libc::EINVAL) = e.raw_os_error() {
// Prevent new transmits from being scheduled using GSO. Existing GSO transmits
// may already be in the pipeline, so we need to tolerate additional failures.
if state.max_gso_segments() > 1 {
tracing::error!("got EIO, halting segmentation offload");
tracing::error!("got transmit error, halting segmentation offload");
state
.max_gso_segments
.store(1, std::sync::atomic::Ordering::Relaxed);
Expand Down

0 comments on commit ca287d5

Please sign in to comment.