[PATCH liburing 1/4] tests: improve zc cflags handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add a couple of tweaks, count nr_cqes on in the loop, so it's easier to
adapt for other test cases.

Signed-off-by: Pavel Begunkov <asml.silence@xxxxxxxxx>
---
 test/send-zerocopy.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/test/send-zerocopy.c b/test/send-zerocopy.c
index 31d66e3..e58b11c 100644
--- a/test/send-zerocopy.c
+++ b/test/send-zerocopy.c
@@ -283,9 +283,9 @@ static int do_test_inet_send(struct io_uring *ring, int sock_client, int sock_se
 		if (mix_register)
 			real_fixed_buf = rand() & 1;
 
-		if (cork && i != nr_reqs - 1)
+		if (i != nr_reqs - 1)
 			msg_flags |= MSG_MORE;
-		if (i == nr_reqs - 1)
+		else
 			cur_size = chunk_size_last;
 
 		sqe = io_uring_get_sqe(ring);
@@ -330,7 +330,7 @@ static int do_test_inet_send(struct io_uring *ring, int sock_client, int sock_se
 		return 1;
 	}
 
-	nr_cqes = 2 * nr_reqs + 1;
+	nr_cqes = nr_reqs + 1;
 	for (i = 0; i < nr_cqes; i++) {
 		int expected = chunk_size;
 
@@ -347,13 +347,19 @@ static int do_test_inet_send(struct io_uring *ring, int sock_client, int sock_se
 			io_uring_cqe_seen(ring, cqe);
 			continue;
 		}
-
+		if ((cqe->flags & IORING_CQE_F_MORE) && (cqe->flags & IORING_CQE_F_NOTIF)) {
+			fprintf(stderr, "unexpected cflags %i res %i\n",
+					cqe->flags, cqe->res);
+			return 1;
+		}
 		if (cqe->user_data >= nr_reqs) {
 			fprintf(stderr, "invalid user_data %lu\n",
 					(unsigned long)cqe->user_data);
 			return 1;
 		}
 		if (!(cqe->flags & IORING_CQE_F_NOTIF)) {
+			if (cqe->flags & IORING_CQE_F_MORE)
+				nr_cqes++;
 			if (cqe->user_data == nr_reqs - 1)
 				expected = chunk_size_last;
 			if (cqe->res != expected) {
@@ -362,12 +368,6 @@ static int do_test_inet_send(struct io_uring *ring, int sock_client, int sock_se
 				return 1;
 			}
 		}
-		if ((cqe->flags & IORING_CQE_F_MORE) ==
-		    (cqe->flags & IORING_CQE_F_NOTIF)) {
-			fprintf(stderr, "unexpected cflags %i res %i\n",
-					cqe->flags, cqe->res);
-			return 1;
-		}
 		io_uring_cqe_seen(ring, cqe);
 	}
 
-- 
2.37.2




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux