-
Notifications
You must be signed in to change notification settings - Fork 645
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 support for UDP_GRO #2385
Add support for UDP_GRO #2385
Conversation
Motivation: Support was added for UDP_SEGMENT in apple#2372 which allows for large UDP datagrams to be written to a socket by letting the kernel or NIC segment the data across multiple datagrams. This reduces traversals across the network stack which can lead to performance improvements. UDP_GRO is the receive-side counterpart allowing the kernel/NIC to aggregate datagrams and reduce network stack traversals. Modifications: - Add a function in CNIOLinux to check whether UDP_GRO is supported - Add the relevant socket and channel options - Add tests Result: - UDP_GRO can be enabled where supported and applications may receive large buffers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly looks great, a few tiny notes!
|
||
static func setUDPReceiveOffload(_ enabled: Bool, socket: NIOBSDSocket.Handle) throws { | ||
#if os(Linux) | ||
var isEnabled: CInt = enabled ? 1 : 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to be var
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so: option_value
in setsockopt
takes an UnsafeRawPointer
These tests are failing for me on Ubuntu 20.04 x86_64 and the CI is not running them, which may be why that was missed:
This is the error I see when they are run locally:
|
Thanks for this. We’re tracking this on our side as well, as our internal CI platform has also flagged this regression. |
Also as a breadcrumb, can you provide the output of |
|
10/10 for the hostname. |
We also see failures on 5.4. FWIW these tests do pass with a newer kernel (5.15). |
Motivation:
Support was added for UDP_SEGMENT in #2372 which allows for large UDP datagrams to be written to a socket by letting the kernel or NIC segment the data across multiple datagrams. This reduces traversals across the network stack which can lead to performance improvements. UDP_GRO is the receive-side counterpart allowing the kernel/NIC to aggregate datagrams and reduce network stack traversals.
Modifications:
Result: