From 021ce718f5ae4bfd5f4e42290993578adb7c7bd5 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Sat, 3 Sep 2022 11:02:10 -0600 Subject: [PATCH] t/io_uring: enable support for registered buffers for passthrough Signed-off-by: Jens Axboe --- os/linux/io_uring.h | 8 ++++++++ t/io_uring.c | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/os/linux/io_uring.h b/os/linux/io_uring.h index 6604e736..c7a24ad8 100644 --- a/os/linux/io_uring.h +++ b/os/linux/io_uring.h @@ -46,6 +46,7 @@ struct io_uring_sqe { __u32 rename_flags; __u32 unlink_flags; __u32 hardlink_flags; + __u32 uring_cmd_flags; }; __u64 user_data; /* data to be passed back at completion time */ /* pack this to avoid bogus arm OABI complaints */ @@ -197,6 +198,13 @@ enum { IORING_OP_LAST, }; +/* + * sqe->uring_cmd_flags + * IORING_URING_CMD_FIXED use registered buffer; pass thig flag + * along with setting sqe->buf_index. + */ +#define IORING_URING_CMD_FIXED (1U << 0) + /* * sqe->fsync_flags */ diff --git a/t/io_uring.c b/t/io_uring.c index 3bce9e7e..b9353ac8 100644 --- a/t/io_uring.c +++ b/t/io_uring.c @@ -650,6 +650,10 @@ static void init_io_pt(struct submitter *s, unsigned index) cmd->cdw12 = nlb; cmd->addr = (unsigned long) s->iovecs[index].iov_base; cmd->data_len = bs; + if (fixedbufs) { + sqe->uring_cmd_flags = IORING_URING_CMD_FIXED; + sqe->buf_index = index; + } cmd->nsid = f->nsid; cmd->opcode = 2; } -- 2.25.1