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.
Showing the changes to include/uapi (1 of 4 files). Show all
Unified · Split
| @@ -296,10 +296,28 @@ enum io_uring_op { · 295 unmodified lines | |||
| 296 | * | 296 | * |
| 297 | * IORING_RECVSEND_FIXED_BUF Use registered buffers, the index is stored in | 297 | * IORING_RECVSEND_FIXED_BUF Use registered buffers, the index is stored in |
| 298 | * the buf_index field. | 298 | * 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). | ||
| 299 | */ | 307 | */ |
| 300 | #define IORING_RECVSEND_POLL_FIRST (1U << 0) | 308 | #define IORING_RECVSEND_POLL_FIRST (1U << 0) |
| 301 | #define IORING_RECV_MULTISHOT (1U << 1) | 309 | #define IORING_RECV_MULTISHOT (1U << 1) |
| 302 | #define IORING_RECVSEND_FIXED_BUF (1U << 2) | 310 | #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) | ||
| 303 | 321 | ||
| 304 | /* | 322 | /* |
| 305 | * accept flags stored in sqe->ioprio | 323 | * accept flags stored in sqe->ioprio |