virtio-net: Add LRO support for TCPv4 and TCPv6 segments#3413
Open
damanm24 wants to merge 38 commits intomicrosoft:mainfrom
Open
virtio-net: Add LRO support for TCPv4 and TCPv6 segments#3413damanm24 wants to merge 38 commits intomicrosoft:mainfrom
damanm24 wants to merge 38 commits intomicrosoft:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces receive-side LRO/GSO plumbing for virtio-net by propagating coalesced-packet metadata from network backends (TAP and Consomme) through net_backend::RxMetadata into the virtio-net header (GUEST_TSO4/6).
Changes:
- Advertise
VIRTIO_NET_F_GUEST_TSO4/6and plumb negotiated guest TSO features into virtio-net RX buffer handling. - Extend
net_backend::RxMetadatawith L3/L2/L3/L4 header length + GSO size fields and populate them in TAP and Consomme RX paths. - Update Consomme TCP send path to optionally emit larger-than-MSS frames with TSO metadata.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| vm/devices/virtio/virtio_net/src/lib.rs | Advertises guest TSO4/6 and passes negotiated features into RX work-pool setup. |
| vm/devices/virtio/virtio_net/src/buffers.rs | Builds virtio-net RX headers with GSO fields derived from backend-provided metadata. |
| vm/devices/net/net_tap/src/lib.rs | Enables TAP RX offloads and parses vnet headers into new RX GSO metadata fields. |
| vm/devices/net/net_consomme/src/lib.rs | Populates new RX GSO metadata (L3 + header lens + MSS) for packets received from Consomme. |
| vm/devices/net/net_consomme/consomme/src/tcp.rs | Adds ability to emit larger TCP frames flagged as TSO/LRO to downstream client. |
| vm/devices/net/net_backend/src/lib.rs | Extends RxMetadata with GSO/LRO-related fields and defaults. |
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.
This PR adds LRO support for our virtio-net device and makes the corresponding changes to the TAP and Consomme backends to take advantage of the new feature.
Burette tests showed ~75% improvement in TCP rx throughput with the TAP backend.
Consomme showed a ~37% reduction in CPU usage while maintaining similar rx throughput. Through further experimentation, the throughput improvements here are bounded by
Tcp::ConnectionParams::tx_buffer_size(i.e. increasing this parameter (to 512 kb) showed same level of improvement as the TAP backend)