diff --git a/src/net/udp.rs b/src/net/udp.rs index 5673c822..f7016133 100644 --- a/src/net/udp.rs +++ b/src/net/udp.rs @@ -227,6 +227,22 @@ impl UdpSocket { } /// Sends a message on the socket using a msghdr. + /// + /// Returns a tuple of: + /// + /// * Result containing bytes written on success + /// * The original `io_slices` Vec + /// * The original `msg_contol` Option + /// + /// See the linux [kernel docs](https://www.kernel.org/doc/html/latest/networking/msg_zerocopy.html) + /// for a discussion on when this might be appropriate. In particular: + /// + /// > Copy avoidance is not a free lunch. As implemented, with page pinning, + /// > it replaces per byte copy cost with page accounting and completion + /// > notification overhead. As a result, zero copy is generally only effective + /// > at writes over around 10 KB. + /// + /// Note: Using fixed buffers [#54](https://github.com/tokio-rs/tokio-uring/pull/54), avoids the page-pinning overhead pub async fn sendmsg_zc( &self, io_slices: Vec,