Repository navigation
feat(vmnetsock): convert Virtio headers for Ethernet peers - #293
Merged
Merged
Conversation
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.
Why
A vmnet interface with Virtio headers cannot connect directly to a peer that expects plain Ethernet frames. Removing the header alone can leave partial checksums unfinished.
Add
vmnetsock.WithVirtioHeaderConversion()to convert between these formats. This continues the work from #205 and builds on the raw Virtio header support in #290.Scope
The adapter completes partial checksums and removes the 12-byte Virtio header from packets sent to the peer. In the other direction, it adds a zeroed header to fully checksummed Ethernet frames.
Conversion supports both Stream and Datagram framing. The peer can use QEMU stream or socket networking, a VZ file-handle attachment, or krunkit Unixgram with
offloading=off.Interface.VirtioHeaderEnabled()andInterface.TSOEnabled()let the adapter reject incompatible settings before it opens sockets. Existing calls still pass bytes through unchanged unless conversion is enabled.Dupstill returns a caller-owned descriptor.Closestops the adapter without stopping the borrowed interface. Conversion uses reusable buffers in the existing packet pumps.Limits
The interface must have Virtio headers enabled and TSO disabled. The adapter does not perform TSO or GSO segmentation. A nonzero GSO type or
RSC_INFOcombined withNEEDS_CSUMstops forwarding, andClosereturns the error.Packet tests cover partial-checksum completion, but the guest runs did not exercise
NEEDS_CSUM.The peer must supply complete Ethernet frames with finished checksums. The socket protocol does not negotiate offload features. The guest configurations covered here use MTU 1500. This change does not alter MTU settings.