summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Roesch <shr@fb.com>2022-04-25 11:26:36 -0700
committerJens Axboe <axboe@kernel.dk>2022-05-16 09:31:02 -0600
commit0ba877d0e76f378c01a34c221bf1dc67d158744c (patch)
tree84264c832ce76a337623d6792997a9348f026b27
parent7eb8df1b627cce6ccb1ce1b422a713a06943eb6e (diff)
downloadliburing-0ba877d0e76f378c01a34c221bf1dc67d158744c.tar.gz
liburing-0ba877d0e76f378c01a34c221bf1dc67d158744c.tar.bz2
liburing: return correct ring size for large CQE's
Return the correct ring_size when large CQE's are used. Signed-off-by: Stefan Roesch <shr@fb.com> Link: https://lore.kernel.org/r/20220425182639.2446370-4-shr@fb.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--src/setup.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/setup.c b/src/setup.c
index dd6a712..d2adc7f 100644
--- a/src/setup.c
+++ b/src/setup.c
@@ -257,8 +257,11 @@ static size_t rings_size(struct io_uring_params *p, unsigned entries,
{
size_t pages, sq_size, cq_size;
- cq_size = KRING_SIZE;
- cq_size += cq_entries * sizeof(struct io_uring_cqe);
+ cq_size = sizeof(struct io_uring_cqe);
+ if (p->flags & IORING_SETUP_CQE32)
+ cq_size += sizeof(struct io_uring_cqe);
+ cq_size *= cq_entries;
+ cq_size += KRING_SIZE;
cq_size = (cq_size + 63) & ~63UL;
pages = (size_t) 1 << npages(cq_size, page_size);