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

feat: Add UDP GRO option #536

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

XAMPPRocky
Copy link
Member

Allows setting UDP_GRO on the socket.

https://www.man7.org/linux/man-pages/man7/udp.7.html

Enables UDP receive offload. If enabled, the socket may
receive multiple datagrams worth of data as a single large
buffer, together with a cmsg(3) that holds the segment
size. This option is the inverse of segmentation offload.
It reduces receive cost by handling multiple datagrams
worth of data as a single large packet in the kernel
receive path, even when that exceeds MTU. This option
should not be used in code intended to be portable.

Copy link
Collaborator

@Thomasdezeeuw Thomasdezeeuw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this Linux only, can you put in the sys/unix.rs file:

impl SockAddr {

Could also you make sure it's order by option name.

Can you add the appropriate attributes, e.g. see

socket2/src/sys/unix.rs

Lines 791 to 795 in 3a93893

#[cfg(all(feature = "all", any(target_os = "android", target_os = "linux")))]
#[cfg_attr(
docsrs,
doc(cfg(all(feature = "all", any(target_os = "android", target_os = "linux"))))
)]

Finally can you add a test? A simple set and get test is sufficient, see

test!(reuse_port, set_reuse_port(true));

@XAMPPRocky
Copy link
Member Author

@Thomasdezeeuw Thank you, I've implemented your feedback, the only thing I wasn't 100% sure on was "Could also you make sure it's order by option name." let me know if I need to make more changes

@Thomasdezeeuw Thomasdezeeuw enabled auto-merge (squash) November 21, 2024 12:24
@Thomasdezeeuw
Copy link
Collaborator

Thanks @XAMPPRocky

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.

2 participants