[RFC] virtio-vsock: Introduce Reader/Writer support#392
Draft
luigix25 wants to merge 4 commits intorust-vmm:mainfrom
Draft
[RFC] virtio-vsock: Introduce Reader/Writer support#392luigix25 wants to merge 4 commits intorust-vmm:mainfrom
luigix25 wants to merge 4 commits intorust-vmm:mainfrom
Conversation
Replace the unified VsockPacket type with two separate types: - VsockPacketTx, backed by a Reader for device-readable TX chains - VsockPacketRx, backed by Writer for device-writable RX chains This removes the VolatileSlice-based implementation, replacing them with the higher-level Reader/Writer abstractions from virtio-queue. Setters and getters are moved directly onto PacketHeader, and the unsafe VsockPacket::new() constructor is removed. vsock packets can be split across multiple descriptors, up until now the code assumed that header + payload was in a single descriptor or the header was on the first descriptor and the data on the second one. This is not compliant to the standard, as multiple descriptors can be used. This is actually the case for Linux with a payload bigger than 32k. Reader and Writer abstraction handle this. Some tests had to be dropped, because with the Reader/Writer is not possible to get the addresses of the slices. Signed-off-by: Luigi Leonardi <leonardi@redhat.com>
Take the DescriptorChain by value instead of by mutable reference. This removes the need for Clone trait on the DescriptorChain's memory handle, since Reader/Writer can be constructed directly from the owned chain. Signed-off-by: Luigi Leonardi <leonardi@redhat.com>
Signed-off-by: Luigi Leonardi <leonardi@redhat.com>
Signed-off-by: Luigi Leonardi <leonardi@redhat.com>
Author
|
TODO:
|
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.
Summary of the PR
Linux can use more than 2 descriptor in a chain for a vsock packet and this crate does not handle it.
To fix it I'm using Reader/Writer helpers from the virtio-queue crate. This needs major (and breaking) changes.
I'm splitting the VsockPacket in Rx and Tx, because in the first one I need writers while in the second Readers.
I had to delete some tests because they no longer apply.
Fixes: #216
Requirements
Before submitting your PR, please make sure you addressed the following
requirements:
git commit -s), and the commit message has max 60 characters for thesummary and max 75 characters for each description line.
test.
Release" section of CHANGELOG.md (if no such section exists, please create one).
unsafecode is properly documented.