io_uring: add mshot helper for posting CQE32

Add a helper for posting 32 byte CQEs in a multishot mode and add a cmd
helper on top. As it specifically works with requests, the helper ignore
the passed in cqe->user_data and sets it to the one stored in the
request.

The command helper is only valid with multishot requests.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/c29d7720c16e1f981cfaa903df187138baa3946b.1750065793.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Pavel Begunkov
2025-06-16 10:46:28 +01:00
committed by Jens Axboe
parent b955754959
commit ac479eac22
4 changed files with 56 additions and 0 deletions

View File

@@ -328,3 +328,14 @@ int io_cmd_poll_multishot(struct io_uring_cmd *cmd,
ret = io_arm_apoll(req, issue_flags, mask);
return ret == IO_APOLL_OK ? -EIOCBQUEUED : -ECANCELED;
}
bool io_uring_cmd_post_mshot_cqe32(struct io_uring_cmd *cmd,
unsigned int issue_flags,
struct io_uring_cqe cqe[2])
{
struct io_kiocb *req = cmd_to_io_kiocb(cmd);
if (WARN_ON_ONCE(!(issue_flags & IO_URING_F_MULTISHOT)))
return false;
return io_req_post_cqe32(req, cqe);
}