Feat/mrg rxbuf offload - #6
Merged
Merged
Conversation
Member
|
Hi @kdamaski Thank you very much for your PR! Overall, the approach is correct and the performance rationale is well-founded. Before merging, please remove both |
Member
|
Also @kdamaski , please refactor the two commit messages to align with the previous commit message guidelines. |
kdamaski
force-pushed
the
feat/mrg-rxbuf-offload
branch
from
June 22, 2026 13:36
2a98d7d to
179a42c
Compare
…io-net 1) Downloads stalled completely (RX correctness). With large-frame offload on, the frontend silently dropped big frames. Cause: the device didn't offer mergeable RX buffers (MRG_RXBUF), which forced Linux into a fragile receive mode where it couldn't validate the checksum of a big frame → drop. Fix: Advertise MRG_RXBUF (+ the guest offload features) so big frames are delivered properly. 2) The downloads were lossy and slow (RX performance). Cause: the RX code allocated memory (Vecs) for every single packet, which slowed the DM down. Fix: rewrite the RX path to do its work in one pass with a fixed stack scratch buffer — zero allocation per packet. Result: 151→363 Mbit/s, retransmits 1239→197. 3) rebuilds its ring iterator and clones the memory handle on every packet, and signals the guest per-packet instead of in batches)
Improve the virtio-net (non-vhost) data plane that serves the frontend NIC. RX (download): - Advertise VIRTIO_NET_F_MRG_RXBUF and the guest offload features (GUEST_TSO4/6, GUEST_UFO, GUEST_CSUM) so a Linux frontend can receive large/GSO frames. Without mergeable buffers these were dropped and downloads stalled. Tap offload flags are derived from the features the driver actually negotiated, so a guest that declines offload still works via the single-buffer fallback. - Rewrite write_frame_to_guest to span one frame across several guest buffers and set num_buffers, in a single pass using fixed stack scratch instead of per-packet heap allocations. Draining the tap faster cut download retransmits and ~doubled throughput (iperf3: ~150 -> ~360 Mbit/s, retransmits ~1200 -> ~200). TX (upload): - Stop cloning the guest memory map per packet, drain the queue with a single iterator per batch instead of one per packet, and signal the driver once per drain instead of per packet. Cuts per-packet CPU and syscall overhead on the transmit path.
kdamaski
force-pushed
the
feat/mrg-rxbuf-offload
branch
from
June 22, 2026 13:54
179a42c to
c14296a
Compare
Contributor
Author
|
Done - Removed AI tool attribution mention in both commits and reworded the two commit messages to align with the previous commit message guidelines. Ready for re-review, thanks! |
joaopeixoto13
approved these changes
Jun 23, 2026
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.
Improve the virtio-net (non-vhost) data plane that serves the frontend NIC.
RX (download):
(GUEST_TSO4/6, GUEST_UFO, GUEST_CSUM) so a Linux frontend can receive
large/GSO frames. Without mergeable buffers these were dropped and
downloads stalled. Tap offload flags are derived from the features the
driver actually negotiated, so a guest that declines offload still works
via the single-buffer fallback.
buffers and set num_buffers, in a single pass using fixed stack scratch
instead of per-packet heap allocations. Draining the tap faster cut
download retransmits and ~doubled throughput
(iperf3: ~150 -> ~360 Mbit/s, retransmits ~1200 -> ~200).
TX (upload):
single iterator per batch instead of one per packet, and signal the
driver once per drain instead of per packet. Cuts per-packet CPU and
syscall overhead on the transmit path.