History

io_uring/net: introduce IORING_SEND_ZC_REPORT_USAGE flag

It might be useful for applications to detect if a zero copy transfer with SEND[MSG]_ZC was actually possible or not. The application can fallback to plain SEND[MSG] in order to avoid the overhead of two cqes per request. Or it can generate a log message that could indicate to an administrator that no zero copy was possible and could explain degraded performance.

Stefan Metzmacher committed 4 years ago

Commit e307e661 parent eb708144 files · +38 −1Browse files

Showing the changes to include/uapi (1 of 4 files). Show all

Unified · Split

include/uapi/linux/io_uring.h+18−0
@@ -296,10 +296,28 @@ enum io_uring_op { · 295 unmodified lines
296296 *
297297 * IORING_RECVSEND_FIXED_BUF Use registered buffers, the index is stored in
298298 * the buf_index field.
299+ *
300+ * IORING_SEND_ZC_REPORT_USAGE
301+ * If set, SEND[MSG]_ZC should report
302+ * the zerocopy usage in cqe.res
303+ * for the IORING_CQE_F_NOTIF cqe.
304+ * 0 is reported if zerocopy was actually possible.
305+ * IORING_NOTIF_USAGE_ZC_COPIED if data was copied
306+ * (at least partially).
299307 */
300308 #define IORING_RECVSEND_POLL_FIRST (1U << 0)
301309 #define IORING_RECV_MULTISHOT (1U << 1)
302310 #define IORING_RECVSEND_FIXED_BUF (1U << 2)
311+#define IORING_SEND_ZC_REPORT_USAGE (1U << 3)
312+
313+/*
314+ * cqe.res for IORING_CQE_F_NOTIF if
315+ * IORING_SEND_ZC_REPORT_USAGE was requested
316+ *
317+ * It should be treated as a flag, all other
318+ * bits of cqe.res should be treated as reserved!
319+ */
320+#define IORING_NOTIF_USAGE_ZC_COPIED (1U << 31)
303321
304322 /*
305323 * accept flags stored in sqe->ioprio