Skip to content

netvsp: tune VF and link delays per guest OS version#3509

Draft
erfrimod wants to merge 1 commit into
microsoft:mainfrom
erfrimod:erfrimod/netvsp-speed-up
Draft

netvsp: tune VF and link delays per guest OS version#3509
erfrimod wants to merge 1 commit into
microsoft:mainfrom
erfrimod:erfrimod/netvsp-speed-up

Conversation

@erfrimod
Copy link
Copy Markdown
Contributor

@erfrimod erfrimod commented May 18, 2026

The 1s VF_DEVICE_DELAY and 5s LINK_DELAY_DURATION exist to work around
Linux hv_netvsc limitations. They are unconditionally applied today,
penalizing Windows, FreeBSD, and modern Linux guests that don't need them.

This PR introduces vf_device_delay() and link_delay_duration() helpers
that consult the guest OS ID and return Duration::ZERO
for guests that do not require the respective delays. The VF delay is gated
on Linux < 6.7 (fixed by upstream commit d30fb712); the link delay still
applies to all Linux versions.

  • Added logic to set the delay duration based on OS ID.
  • Added to inspect output.
  • Added tests to verify logic and inspect output.

NOTE: The link delay duration is used to coalesce link state (up/down) notifications over a time frame. Even if it is technically correct to report each update, there could be beneficial side effects to smoothing them out for the Guest. I won't be able to know how each Guest / Application will behave if they start seeing a storm of link flapping that would previously be reported as one notification every 5 seconds.

Testing: TBD

Copilot AI review requested due to automatic review settings May 18, 2026 20:06
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR makes netvsp guest-aware when applying VF offer and link-change delays, avoiding Linux-specific workarounds for guests that do not need them while preserving conservative behavior when the guest OS is unknown.

Changes:

  • Adds helper logic to derive VF and link delay durations from the Hyper-V guest OS ID.
  • Stores the computed delays in channel/coordinator state and exposes them via inspect.
  • Adds unit/async tests for guest OS delay selection and inspect output.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
vm/devices/net/netvsp/src/lib.rs Adds guest OS-aware delay helpers, wires computed delays into netvsp coordinator/channel behavior, and exposes delay values through inspect.
vm/devices/net/netvsp/src/test.rs Adds guest OS ID construction helpers plus tests for delay policy and inspect reporting.

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