CVPN-2515/CVPN-2512: Send/receive multiple packets to TUN at once#406
Open
kp-thomas-yau wants to merge 12 commits intomainfrom
Open
CVPN-2515/CVPN-2512: Send/receive multiple packets to TUN at once#406kp-thomas-yau wants to merge 12 commits intomainfrom
kp-thomas-yau wants to merge 12 commits intomainfrom
Conversation
424e1ea to
dfa9243
Compare
|
Code coverage summary for a3aa60a: ✅ Region coverage 68% passes |
0eb651a to
175d1d3
Compare
01ef021 to
8f1cfb6
Compare
It will also enable batch receive if TUN offloading is ON as well.
Implement the trait and also add GROTable to TunDirect object so that we can reuse this across different calls. The implementation now is not exactly perfect as well, as we're now doing an extra layer of copying to create an offset in BytesMut to pre-allocate space for VIRTIO_NET_HDR_LEN
Add this variable in to let us determine whether we need to batch the packets here or not
Add a queue for the packets that are going to the TUN device if `inside_batch_enabled` is on. Also add a new method to flush all the queued packets to be sent all at once via send_multiple function.
Move this value to this constant for better clarity
This struct will be used later on so that the caller of TUN's receive method can pass in a mutable reference of a buffer for recv_multiple to use directly. This fixes the issue of requiring a mutex lock needed for every buffer and easier to tell who is the owner of the buffer space.
Add a new `recv_multiple_buf` to `InsideIORecv` trait, which allows user to receive multiple packets from the TUN device directly (via TUN offloading).
This wrapper makes thing easier by abstracting the logic of between receiving multiple and single buffer from the socket, so that the main inside_io_task loop won't be too messy and hard test. Added some unit tests thanks to mockall.
8f1cfb6 to
4a0ee45
Compare
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.
Description
If offload config is on, enable TUN offload so that we can send/receive multiple packets at the same time. Both receive and sending side must use its
send/receive_multiplefunction variants, as regular send/receive function from tun-rs is now sending raw packets.Motivation and Context
Now that there's an option to batch receive packets, we can receive/send packets into TUN all at once.
How Has This Been Tested?
Passed e2e CI tests
Test reference, waiting for iPerf3 test
When tested with our regular testing server, speed mostly are quite similar, but upload speed got a nice speed bump of 1898 -> 2262 Mbps (with speedtest CLI)
Types of changes
Checklist:
main