@@ -438,6 +438,8 @@ enum {
#define IORING_OFF_PBUF_RING 0x80000000ULL
#define IORING_OFF_PBUF_SHIFT 16
#define IORING_OFF_MMAP_MASK 0xf8000000ULL
+#define IORING_OFF_RQ_RING 0x20000000ULL
+#define IORING_OFF_RQ_SHIFT 16
/*
* Filled with the offset for mmap(2)
@@ -3434,6 +3434,11 @@ static void *io_uring_validate_mmap_request(struct file *file,
return ERR_PTR(-EINVAL);
break;
}
+ case IORING_OFF_RQ_RING:
+ if (!ctx->ifq)
+ return ERR_PTR(-EINVAL);
+ ptr = ctx->ifq->rq_ring;
+ break;
default:
return ERR_PTR(-EINVAL);
}
@@ -58,6 +58,7 @@ int io_register_zc_rx_ifq(struct io_ring_ctx *ctx,
{
struct io_uring_zc_rx_ifq_reg reg;
struct io_zc_rx_ifq *ifq;
+ size_t ring_sz, rqes_sz;
int ret;
if (!(ctx->flags & IORING_SETUP_DEFER_TASKRUN &&
@@ -80,8 +81,20 @@ int io_register_zc_rx_ifq(struct io_ring_ctx *ctx,
ifq->rq_entries = reg.rq_entries;
ifq->if_rxq_id = reg.if_rxq_id;
- ctx->ifq = ifq;
+ ring_sz = sizeof(struct io_uring);
+ rqes_sz = sizeof(struct io_uring_rbuf_rqe) * ifq->rq_entries;
+ reg.mmap_sz = ring_sz + rqes_sz;
+ reg.rq_off.rqes = ring_sz;
+ reg.rq_off.head = offsetof(struct io_uring, head);
+ reg.rq_off.tail = offsetof(struct io_uring, tail);
+
+ if (copy_to_user(arg, ®, sizeof(reg))) {
+ ret = -EFAULT;
+ goto err;
+ }
+
+ ctx->ifq = ifq;
return 0;
err:
io_zc_rx_ifq_free(ifq);