-
Notifications
You must be signed in to change notification settings - Fork 28
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
Implement Linux MSG_ZEROCOPY support for nts #107
Merged
Merged
Conversation
This file contains 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
35644ac
to
0b1f831
Compare
… zero-copy completion intervals (#5) * Standardize and document configurability of zero-copy threshold across socket and interface configuration and propagate default configuration * Standardize the function naming for the mechanics of processing timestamp and zero-copy notifications * Revisions to zero-copy implementation * Support enabling and disabling timestamping and zero-copy during the operation of a socket * Move responsibility of retrying zero-copy due to ENOBUFS to ntsu::SocketUtil * Delegate ntcr::DatagramSocket::send without a callback to the callback overload * Revise ntcq::ZeroCopyQueue interface and restructure send paths for ntcr::DatagramSocket and ntcr::StreamSocket * Zero copy set intersection * Zero copy set intersection * ntcq::ZeroCopyQueue test sanity checks * ntcq::ZeroCopyQueue test sanity checks * ntcq::ZeroCopyQueue test sanity checks * ntcq::ZeroCopyQueue test sanity checks * Revisions to zero-copy implementation * 32-bit wraparound conversion * Test 32-bit wraparound * Introduce ntsa::ZeroCopyType * Update test drivers to respect ntsa::ZeroCopyType * Only set SO_ZEROCOPY on IPv4 and IPv6 sockets, automatically disable zero-copy when we learn a copy is only deferred and not avoided * When testing default value of zero-copy socket option respect that ntsu::SocketUtil::create automatically sets it for IPv4 and IPv6 sockets * When explicitly sending to an endpoint for a connected datagram socket, verify the two endpoints match but don't explicitely set the target endpoint when calling ::sendmsg * Fix improper assert in ntcr::StreamSocket when writing to a non-empty write queue * Ensure the send deadline timer is closed whenever a write queue entry is popped from the write queue, especially at shutdown * When flushing reactors after the last waiter is deregistered, on loop while functors are still enqueued; pending timers are never guaranteed to fire and may cause infinite loops * Check zero copy queue if the associated send callback is ready after framing a zero copied send group * Fix defensive check when explicitly sending to an endpoint different that the endpoint to a datagram socket is connected * Do not set SO_ZEROCOPY by default in nts, but do set it by default in ntc * Only retry sendmsg without MSG_ZEROCOPY if it failed with ENOBUFS and MSG_ZEROCOPY was specified in the first place * Default ntci::{Stream,Datagram}Socket::setZeroCopyThreshold returns e_NOT_IMPLEMENTED * Review comments * Assert wait list is not empty in ntcq::ZeroCopyQueue::frame()
…_system.t (only on Linux)
mattrm456
approved these changes
Jan 25, 2024
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.
OK to merge.
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.
This PR extends support of Linux send data copy avoidance mechanism to NTS.
Also, this PR includes (thanks to @mattrm456 ) refactoring of datagram/stream socket send path implementation (ntcr & ntcp) (relative PR: smtrfnv#5)
Brief description:
ntsa::InterfaceConfig
or inntca::StreamSocketOptions
andntca::DatagramSocketOptions
MSG_ZEROCOPY
flag fails due toENOBUFS
error.ulimit -l
is something big.