Igor Anić 087ee497d4 io_uring: add zero-copy send operation
`send_zc` tries to avoid making intermediate copies of data. Zerocopy execution
is not guaranteed and may fall back to copying.

The flags field of the first struct io_uring_cqe may likely contain
IORING_CQE_F_MORE , which means that there will be a second completion event /
notification for the request, with the user_data field set to the same value.
The user must not modify the data buffer until the notification is posted. The
first cqe follows the usual rules and so its res field will contain the number
of bytes sent or a negative error code. The notification's res field will be set
to zero and the flags field will contain IORING_CQE_F_NOTIF. The two step model
is needed because the kernel may hold on to buffers for a long time, e.g.
waiting for a TCP ACK, and having a separate cqe for request completions allows
userspace to push more data without extra delays. Note, notifications are only
responsible for controlling the lifetime of the buffers, and as such don't mean
anything about whether the data has atually been sent out or received by the
other end. Even errored requests may generate a notification, and the user must
check for IORING_CQE_F_MORE rather than relying on the result.

Available since kernel 6.0.

References:
https://man7.org/linux/man-pages/man3/io_uring_prep_send_zc.3.html
https://man7.org/linux/man-pages/man2/io_uring_enter.2.html
2023-11-10 16:44:18 +01:00
..
2023-07-31 03:49:21 -04:00
2023-07-31 03:49:21 -04:00
2023-07-31 03:49:21 -04:00
2023-07-31 03:49:21 -04:00
2023-07-31 03:49:21 -04:00
2023-07-31 03:49:21 -04:00
2023-07-31 03:49:21 -04:00
2023-10-23 22:42:18 -04:00
2023-07-31 03:49:21 -04:00
2023-07-31 03:49:21 -04:00
2023-10-25 04:28:30 -04:00
2023-07-31 03:49:21 -04:00