mirror of https://github.com/torvalds/linux.git
io_uring/zcrx: add support for IORING_SETUP_CQE_MIXED
zcrx currently requires the ring to be set up with fixed 32b CQEs, allow it to use IORING_SETUP_CQE_MIXED as well. Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
1e81bf1414
commit
c986f7586b
|
|
@ -75,7 +75,7 @@ Create an io_uring instance with the following required setup flags::
|
||||||
|
|
||||||
IORING_SETUP_SINGLE_ISSUER
|
IORING_SETUP_SINGLE_ISSUER
|
||||||
IORING_SETUP_DEFER_TASKRUN
|
IORING_SETUP_DEFER_TASKRUN
|
||||||
IORING_SETUP_CQE32
|
IORING_SETUP_CQE32 or IORING_SETUP_CQE_MIXED
|
||||||
|
|
||||||
Create memory area
|
Create memory area
|
||||||
------------------
|
------------------
|
||||||
|
|
|
||||||
|
|
@ -554,8 +554,9 @@ int io_register_zcrx_ifq(struct io_ring_ctx *ctx,
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
|
|
||||||
/* mandatory io_uring features for zc rx */
|
/* mandatory io_uring features for zc rx */
|
||||||
if (!(ctx->flags & IORING_SETUP_DEFER_TASKRUN &&
|
if (!(ctx->flags & IORING_SETUP_DEFER_TASKRUN))
|
||||||
ctx->flags & IORING_SETUP_CQE32))
|
return -EINVAL;
|
||||||
|
if (!(ctx->flags & (IORING_SETUP_CQE32|IORING_SETUP_CQE_MIXED)))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if (copy_from_user(®, arg, sizeof(reg)))
|
if (copy_from_user(®, arg, sizeof(reg)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
@ -920,17 +921,20 @@ static const struct memory_provider_ops io_uring_pp_zc_ops = {
|
||||||
static bool io_zcrx_queue_cqe(struct io_kiocb *req, struct net_iov *niov,
|
static bool io_zcrx_queue_cqe(struct io_kiocb *req, struct net_iov *niov,
|
||||||
struct io_zcrx_ifq *ifq, int off, int len)
|
struct io_zcrx_ifq *ifq, int off, int len)
|
||||||
{
|
{
|
||||||
|
struct io_ring_ctx *ctx = req->ctx;
|
||||||
struct io_uring_zcrx_cqe *rcqe;
|
struct io_uring_zcrx_cqe *rcqe;
|
||||||
struct io_zcrx_area *area;
|
struct io_zcrx_area *area;
|
||||||
struct io_uring_cqe *cqe;
|
struct io_uring_cqe *cqe;
|
||||||
u64 offset;
|
u64 offset;
|
||||||
|
|
||||||
if (!io_defer_get_uncommited_cqe(req->ctx, &cqe))
|
if (!io_defer_get_uncommited_cqe(ctx, &cqe))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
cqe->user_data = req->cqe.user_data;
|
cqe->user_data = req->cqe.user_data;
|
||||||
cqe->res = len;
|
cqe->res = len;
|
||||||
cqe->flags = IORING_CQE_F_MORE;
|
cqe->flags = IORING_CQE_F_MORE;
|
||||||
|
if (ctx->flags & IORING_SETUP_CQE_MIXED)
|
||||||
|
cqe->flags |= IORING_CQE_F_32;
|
||||||
|
|
||||||
area = io_zcrx_iov_to_area(niov);
|
area = io_zcrx_iov_to_area(niov);
|
||||||
offset = off + (net_iov_idx(niov) << PAGE_SHIFT);
|
offset = off + (net_iov_idx(niov) << PAGE_SHIFT);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue