mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-12-27 10:01:39 -05:00
io_uring/zcrx: introduce IORING_REGISTER_ZCRX_CTRL
It'll be annoying and take enough of boilerplate code to implement new zcrx features as separate io_uring register opcode. Introduce IORING_REGISTER_ZCRX_CTRL that will multiplex such calls to zcrx. Note, there are no real users of the opcode in this patch. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
committed by
Jens Axboe
parent
1b8b5d0316
commit
d663976dad
@@ -815,6 +815,9 @@ static int __io_uring_register(struct io_ring_ctx *ctx, unsigned opcode,
|
||||
case IORING_REGISTER_QUERY:
|
||||
ret = io_query(ctx, arg, nr_args);
|
||||
break;
|
||||
case IORING_REGISTER_ZCRX_CTRL:
|
||||
ret = io_zcrx_ctrl(ctx, arg, nr_args);
|
||||
break;
|
||||
default:
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
|
||||
@@ -941,6 +941,27 @@ static const struct memory_provider_ops io_uring_pp_zc_ops = {
|
||||
.uninstall = io_pp_uninstall,
|
||||
};
|
||||
|
||||
int io_zcrx_ctrl(struct io_ring_ctx *ctx, void __user *arg, unsigned nr_args)
|
||||
{
|
||||
struct zcrx_ctrl ctrl;
|
||||
struct io_zcrx_ifq *zcrx;
|
||||
|
||||
if (nr_args)
|
||||
return -EINVAL;
|
||||
if (copy_from_user(&ctrl, arg, sizeof(ctrl)))
|
||||
return -EFAULT;
|
||||
if (!mem_is_zero(&ctrl.__resv, sizeof(ctrl.__resv)))
|
||||
return -EFAULT;
|
||||
|
||||
zcrx = xa_load(&ctx->zcrx_ctxs, ctrl.zcrx_id);
|
||||
if (!zcrx)
|
||||
return -ENXIO;
|
||||
if (ctrl.op >= __ZCRX_CTRL_LAST)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static bool io_zcrx_queue_cqe(struct io_kiocb *req, struct net_iov *niov,
|
||||
struct io_zcrx_ifq *ifq, int off, int len)
|
||||
{
|
||||
|
||||
@@ -65,6 +65,7 @@ struct io_zcrx_ifq {
|
||||
};
|
||||
|
||||
#if defined(CONFIG_IO_URING_ZCRX)
|
||||
int io_zcrx_ctrl(struct io_ring_ctx *ctx, void __user *arg, unsigned nr_arg);
|
||||
int io_register_zcrx_ifq(struct io_ring_ctx *ctx,
|
||||
struct io_uring_zcrx_ifq_reg __user *arg);
|
||||
void io_unregister_zcrx_ifqs(struct io_ring_ctx *ctx);
|
||||
@@ -93,6 +94,11 @@ static inline struct io_mapped_region *io_zcrx_get_region(struct io_ring_ctx *ct
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
static inline int io_zcrx_ctrl(struct io_ring_ctx *ctx,
|
||||
void __user *arg, unsigned nr_arg)
|
||||
{
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
#endif
|
||||
|
||||
int io_recvzc(struct io_kiocb *req, unsigned int issue_flags);
|
||||
|
||||
Reference in New Issue
Block a user