summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Roesch <shr@fb.com>2022-04-25 11:26:38 -0700
committerJens Axboe <axboe@kernel.dk>2022-05-16 09:31:11 -0600
commita2b20bcad03706101c3fffe77f0ced1ebcc1b9ff (patch)
tree96a88edcdd3508a945866f3aa0dece2159212fd3
parent406176e9a0e7c023a6572d734d4e2d40e3e2c4d6 (diff)
downloadliburing-a2b20bcad03706101c3fffe77f0ced1ebcc1b9ff.tar.gz
liburing-a2b20bcad03706101c3fffe77f0ced1ebcc1b9ff.tar.bz2
liburing: add large CQE tests to nop test
This adds two test cases for large CQE's: - Single NOP test, which checks that the new extra1 and extra2 fields are set. - Multiple NOP submission test which also checks for the new fields. Signed-off-by: Stefan Roesch <shr@fb.com> Link: https://lore.kernel.org/r/20220425182639.2446370-6-shr@fb.com [axboe: fixup cqe naming] Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--test/nop.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/nop.c b/test/nop.c
index d477a1b..8656373 100644
--- a/test/nop.c
+++ b/test/nop.c
@@ -19,6 +19,7 @@ static int test_single_nop(struct io_uring *ring)
struct io_uring_cqe *cqe;
struct io_uring_sqe *sqe;
int ret;
+ bool cqe32 = (ring->flags & IORING_SETUP_CQE32);
sqe = io_uring_get_sqe(ring);
if (!sqe) {
@@ -27,6 +28,10 @@ static int test_single_nop(struct io_uring *ring)
}
io_uring_prep_nop(sqe);
+ if (cqe32) {
+ sqe->addr = 1234;
+ sqe->addr2 = 5678;
+ }
sqe->user_data = ++seq;
ret = io_uring_submit(ring);
@@ -44,6 +49,17 @@ static int test_single_nop(struct io_uring *ring)
fprintf(stderr, "Unexpected 0 user_data\n");
goto err;
}
+ if (cqe32) {
+ if (cqe->big_cqe[0] != 1234) {
+ fprintf(stderr, "Unexpected extra1\n");
+ goto err;
+
+ }
+ if (cqe->big_cqe[1] != 5678) {
+ fprintf(stderr, "Unexpected extra2\n");
+ goto err;
+ }
+ }
io_uring_cqe_seen(ring, cqe);
return 0;
err:
@@ -55,6 +71,7 @@ static int test_barrier_nop(struct io_uring *ring)
struct io_uring_cqe *cqe;
struct io_uring_sqe *sqe;
int ret, i;
+ bool cqe32 = (ring->flags & IORING_SETUP_CQE32);
for (i = 0; i < 8; i++) {
sqe = io_uring_get_sqe(ring);
@@ -66,6 +83,10 @@ static int test_barrier_nop(struct io_uring *ring)
io_uring_prep_nop(sqe);
if (i == 4)
sqe->flags = IOSQE_IO_DRAIN;
+ if (cqe32) {
+ sqe->addr = 1234;
+ sqe->addr2 = 5678;
+ }
sqe->user_data = ++seq;
}
@@ -88,6 +109,16 @@ static int test_barrier_nop(struct io_uring *ring)
fprintf(stderr, "Unexpected 0 user_data\n");
goto err;
}
+ if (cqe32) {
+ if (cqe->big_cqe[0] != 1234) {
+ fprintf(stderr, "Unexpected extra1\n");
+ goto err;
+ }
+ if (cqe->big_cqe[1] != 5678) {
+ fprintf(stderr, "Unexpected extra2\n");
+ goto err;
+ }
+ }
io_uring_cqe_seen(ring, cqe);
}