public inbox for [email protected]
 help / color / mirror / Atom feed
From: Pavel Begunkov <[email protected]>
To: [email protected]
Cc: Jens Axboe <[email protected]>, [email protected]
Subject: [PATCH liburing for-next 1/5] tests: improve zc cflags handling
Date: Thu, 20 Oct 2022 02:49:51 +0100	[thread overview]
Message-ID: <8ce91fa37051e2b36d5fbb1735a19e2573b2838d.1666230529.git.asml.silence@gmail.com> (raw)
In-Reply-To: <[email protected]>

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 <[email protected]>
---
 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 4db102b..005220d 100644
--- a/test/send-zerocopy.c
+++ b/test/send-zerocopy.c
@@ -288,9 +288,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);
@@ -335,7 +335,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;
 
@@ -352,13 +352,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) {
@@ -367,12 +373,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.38.0


  reply	other threads:[~2022-10-20  1:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-20  1:49 [PATCH liburing for-next 0/5] expand send / zc tests Pavel Begunkov
2022-10-20  1:49 ` Pavel Begunkov [this message]
2022-10-20  1:49 ` [PATCH liburing for-next 2/5] tests: pass params in a struct Pavel Begunkov
2022-10-20  1:49 ` [PATCH liburing for-next 3/5] tests: add non-zc tests in send-zerocopy.c Pavel Begunkov
2022-10-20  1:49 ` [PATCH liburing for-next 4/5] tests: add tests for retries with long iovec Pavel Begunkov
2022-10-20  1:49 ` [PATCH liburing for-next 5/5] tests: test poll_first Pavel Begunkov
2022-10-20  2:26 ` [PATCH liburing for-next 0/5] expand send / zc tests Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8ce91fa37051e2b36d5fbb1735a19e2573b2838d.1666230529.git.asml.silence@gmail.com \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox