Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dgram crate #1764

Draft
wants to merge 21 commits into
base: master
Choose a base branch
from
Draft

Add dgram crate #1764

wants to merge 21 commits into from

Conversation

evanrittenhouse
Copy link
Contributor

@evanrittenhouse evanrittenhouse commented Apr 24, 2024

Overview

This PR adds a new crate for abstracting away direct interactions with cmsgs. It currently only contains implementations for Linux, but we can add multi-platform support when required.

Testing

Unit tests exist for basic functionality. As far as checking the success of GSO/GRO operations, I fired up a local server with a known GSO/GRO implementation. I then straced 100 requests to the server on master, filtering on sendmsg/recvmsg. Checking the number of syscalls, we see:

❯ rg -c "sendmsg" -g "master-syscalls-100-req.csv"
master-syscalls-100-req.csv:788

❮ rg -c "recvmsg" -g "master-syscalls-100-req.csv"
master-syscalls-100-req.csv:1860

I then substituted that GSO/GRO implementation with the one in this crate, and performed an identical test. The output is:

❯ rg -c "sendmsg" -g "dgram-syscalls-100-req.csv"
dgram-syscalls-100-req.csv:769

❮ rg -c "recvmsg" -g "dgram-syscalls-100-req.csv"
dgram-syscalls-100-req.csv:1826

@evanrittenhouse evanrittenhouse requested a review from a team as a code owner April 24, 2024 01:53
@evanrittenhouse evanrittenhouse force-pushed the evanrittenhouse/dgram branch 5 times, most recently from 4b9b904 to e1ae9c5 Compare April 24, 2024 04:58
@evanrittenhouse evanrittenhouse marked this pull request as draft April 24, 2024 19:53
@evanrittenhouse evanrittenhouse force-pushed the evanrittenhouse/dgram branch 2 times, most recently from 5921dc7 to 5636abb Compare April 25, 2024 16:11
@evanrittenhouse evanrittenhouse force-pushed the evanrittenhouse/dgram branch 2 times, most recently from d39138b to 8412ac7 Compare April 25, 2024 16:43
@evanrittenhouse evanrittenhouse force-pushed the evanrittenhouse/dgram branch 3 times, most recently from b973dc7 to 9fa335c Compare April 26, 2024 05:15
1) Remove Mio layer and replace it with a sync FD layer
2) Move RecvData, RecvMetrics, and StoreCmsgSettings to `lib`, since
   syscalls is private
3) Rework the signature of `recv_msg` to take a `StoreCmsgSettings` to
   allow applications to handle custom cmsgs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant