public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
From: Pavel Begunkov <asml.silence@gmail.com>
To: io-uring@vger.kernel.org
Cc: asml.silence@gmail.com, David Wei <dw@davidwei.uk>
Subject: [PATCH liburing 1/3] examples: remove zcrx size limiting
Date: Sun, 20 Apr 2025 12:24:46 +0100	[thread overview]
Message-ID: <64f4734fbd7722e87a21959ac668b066bd984717.1745146129.git.asml.silence@gmail.com> (raw)
In-Reply-To: <cover.1745146129.git.asml.silence@gmail.com>

It's not handled too well and is not great at show casing the feature,
remove it for now, we may add it back later in a different form.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
 examples/zcrx.c | 34 ++++------------------------------
 1 file changed, 4 insertions(+), 30 deletions(-)

diff --git a/examples/zcrx.c b/examples/zcrx.c
index 32d9e4ae..afc05642 100644
--- a/examples/zcrx.c
+++ b/examples/zcrx.c
@@ -46,8 +46,6 @@ static long page_size;
 static int cfg_port = 8000;
 static const char *cfg_ifname;
 static int cfg_queue_id = -1;
-static bool cfg_oneshot;
-static int cfg_oneshot_recvs;
 static bool cfg_verify_data = false;
 static struct sockaddr_in6 cfg_addr;
 
@@ -150,16 +148,6 @@ static void add_recvzc(struct io_uring *ring, int sockfd)
 	sqe->user_data = 2;
 }
 
-static void add_recvzc_oneshot(struct io_uring *ring, int sockfd, size_t len)
-{
-	struct io_uring_sqe *sqe = io_uring_get_sqe(ring);
-
-	io_uring_prep_rw(IORING_OP_RECV_ZC, sqe, sockfd, NULL, len, 0);
-	sqe->ioprio |= IORING_RECV_MULTISHOT;
-	sqe->zcrx_ifq_idx = zcrx_id;
-	sqe->user_data = 2;
-}
-
 static void process_accept(struct io_uring *ring, struct io_uring_cqe *cqe)
 {
 	if (cqe->res < 0)
@@ -168,10 +156,7 @@ static void process_accept(struct io_uring *ring, struct io_uring_cqe *cqe)
 		t_error(1, 0, "Unexpected second connection");
 
 	connfd = cqe->res;
-	if (cfg_oneshot)
-		add_recvzc_oneshot(ring, connfd, page_size);
-	else
-		add_recvzc(ring, connfd);
+	add_recvzc(ring, connfd);
 }
 
 static void verify_data(char *data, size_t size, unsigned long seq)
@@ -200,19 +185,13 @@ static void process_recvzc(struct io_uring *ring, struct io_uring_cqe *cqe)
 	if (cqe->res < 0)
 		t_error(1, 0, "recvzc(): %d", cqe->res);
 
-	if (cqe->res == 0 && cqe->flags == 0 && cfg_oneshot_recvs == 0) {
+	if (cqe->res == 0 && cqe->flags == 0) {
 		stop = true;
 		return;
 	}
 
-	if (cfg_oneshot) {
-		if (cqe->res == 0 && cqe->flags == 0 && cfg_oneshot_recvs) {
-			add_recvzc_oneshot(ring, connfd, page_size);
-			cfg_oneshot_recvs--;
-		}
-	} else if (!(cqe->flags & IORING_CQE_F_MORE)) {
+	if (!(cqe->flags & IORING_CQE_F_MORE))
 		add_recvzc(ring, connfd);
-	}
 
 	rcqe = (struct io_uring_zcrx_cqe *)(cqe + 1);
 	mask = (1ULL << IORING_ZCRX_AREA_SHIFT) - 1;
@@ -299,7 +278,7 @@ static void parse_opts(int argc, char **argv)
 	if (argc <= 1)
 		usage(argv[0]);
 
-	while ((c = getopt(argc, argv, "vp:i:q:o:")) != -1) {
+	while ((c = getopt(argc, argv, "vp:i:q:")) != -1) {
 		switch (c) {
 		case 'p':
 			cfg_port = strtoul(optarg, NULL, 0);
@@ -307,11 +286,6 @@ static void parse_opts(int argc, char **argv)
 		case 'i':
 			cfg_ifname = optarg;
 			break;
-		case 'o': {
-			cfg_oneshot = true;
-			cfg_oneshot_recvs = strtoul(optarg, NULL, 0);
-			break;
-		}
 		case 'q':
 			cfg_queue_id = strtoul(optarg, NULL, 0);
 			break;
-- 
2.48.1


  reply	other threads:[~2025-04-20 11:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-20 11:24 [PATCH liburing 0/3] zcrx refill queue allocation modes Pavel Begunkov
2025-04-20 11:24 ` Pavel Begunkov [this message]
2025-04-21  0:22   ` [PATCH liburing 1/3] examples: remove zcrx size limiting David Wei
2025-04-21  6:40     ` Pavel Begunkov
2025-04-21 17:38       ` David Wei
2025-04-20 11:24 ` [PATCH liburing 2/3] examples/zcrx: constants for request types Pavel Begunkov
2025-04-21  0:25   ` David Wei
2025-04-20 11:24 ` [PATCH liburing 3/3] examples/zcrx: add refill queue allocation modes Pavel Begunkov
2025-04-21  0:28   ` David Wei
2025-04-21  6:38     ` Pavel Begunkov

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=64f4734fbd7722e87a21959ac668b066bd984717.1745146129.git.asml.silence@gmail.com \
    --to=asml.silence@gmail.com \
    --cc=dw@davidwei.uk \
    --cc=io-uring@vger.kernel.org \
    /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