From: Pavel Begunkov <[email protected]>
To: [email protected]
Cc: Jens Axboe <[email protected]>, [email protected]
Subject: [PATCH liburing for-next 3/5] tests: add non-zc tests in send-zerocopy.c
Date: Thu, 20 Oct 2022 02:49:53 +0100 [thread overview]
Message-ID: <5d3f1be7afe67c2fcff8bcf63c686928477476b6.1666230529.git.asml.silence@gmail.com> (raw)
In-Reply-To: <[email protected]>
We don't have good tests for normal non-zerocopy paths. Add them to
test_inet_send(), which covers lots of different cases. We can move
it into send_recv.c or so later.
Signed-off-by: Pavel Begunkov <[email protected]>
---
test/send-zerocopy.c | 31 +++++++++++++++++++++++++++----
1 file changed, 27 insertions(+), 4 deletions(-)
diff --git a/test/send-zerocopy.c b/test/send-zerocopy.c
index a69279a..646a895 100644
--- a/test/send-zerocopy.c
+++ b/test/send-zerocopy.c
@@ -261,6 +261,7 @@ struct send_conf {
bool force_async;
bool use_sendmsg;
bool tcp;
+ bool zc;
int buf_index;
struct sockaddr_storage *addr;
};
@@ -305,8 +306,14 @@ static int do_test_inet_send(struct io_uring *ring, int sock_client, int sock_se
sqe = io_uring_get_sqe(ring);
if (!conf->use_sendmsg) {
- io_uring_prep_send_zc(sqe, sock_client, buf + i * chunk_size,
- cur_size, msg_flags, zc_flags);
+ if (conf->zc) {
+ io_uring_prep_send_zc(sqe, sock_client, buf + i * chunk_size,
+ cur_size, msg_flags, zc_flags);
+ } else {
+ io_uring_prep_send(sqe, sock_client, buf + i * chunk_size,
+ cur_size, msg_flags);
+ }
+
if (real_fixed_buf) {
sqe->ioprio |= IORING_RECVSEND_FIXED_BUF;
sqe->buf_index = conf->buf_index;
@@ -315,7 +322,10 @@ static int do_test_inet_send(struct io_uring *ring, int sock_client, int sock_se
io_uring_prep_send_set_addr(sqe, (const struct sockaddr *)conf->addr,
addr_len);
} else {
- io_uring_prep_sendmsg_zc(sqe, sock_client, &msghdr[i], msg_flags);
+ if (conf->zc)
+ io_uring_prep_sendmsg_zc(sqe, sock_client, &msghdr[i], msg_flags);
+ else
+ io_uring_prep_sendmsg(sqe, sock_client, &msghdr[i], msg_flags);
memset(&msghdr[i], 0, sizeof(msghdr[i]));
iov[i].iov_len = cur_size;
@@ -418,7 +428,7 @@ static int test_inet_send(struct io_uring *ring)
return 1;
}
- for (i = 0; i < 256; i++) {
+ for (i = 0; i < 512; i++) {
conf.buf_index = i & 3;
conf.fixed_buf = i & 4;
conf.addr = (i & 8) ? &addr : NULL;
@@ -426,8 +436,19 @@ static int test_inet_send(struct io_uring *ring)
conf.mix_register = i & 32;
conf.force_async = i & 64;
conf.use_sendmsg = i & 128;
+ conf.zc = i & 256;
conf.tcp = tcp;
+ if (!conf.zc) {
+ if (conf.mix_register || conf.fixed_buf)
+ continue;
+ /*
+ * Non zerocopy send w/ addr was added together with sendmsg_zc,
+ * skip if we the kernel doesn't support it.
+ */
+ if (conf.addr && !has_sendmsg)
+ continue;
+ }
if (conf.buf_index == BUF_T_LARGE && !tcp)
continue;
if (!buffers_iov[conf.buf_index].iov_base)
@@ -440,6 +461,8 @@ static int test_inet_send(struct io_uring *ring)
continue;
if (conf.use_sendmsg && (conf.mix_register || conf.fixed_buf || !has_sendmsg))
continue;
+ if (msg_zc_set && !conf.zc)
+ continue;
ret = do_test_inet_send(ring, sock_client, sock_server, &conf);
if (ret) {
--
2.38.0
next prev parent 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 ` [PATCH liburing for-next 1/5] tests: improve zc cflags handling Pavel Begunkov
2022-10-20 1:49 ` [PATCH liburing for-next 2/5] tests: pass params in a struct Pavel Begunkov
2022-10-20 1:49 ` Pavel Begunkov [this message]
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=5d3f1be7afe67c2fcff8bcf63c686928477476b6.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