From: Kanchan Joshi <[email protected]>
To: [email protected]
Cc: [email protected], Kanchan Joshi <[email protected]>
Subject: [PATCH liburing 1/2] test/io_uring_passthrough: fix iopoll test
Date: Tue, 6 Dec 2022 17:48:30 +0530 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
iopoll test is broken as it does not initialize the command/sqe properly
before submission.
Add the necessary initialization to set this right.
Signed-off-by: Kanchan Joshi <[email protected]>
---
test/io_uring_passthrough.c | 24 +++++++++++++++++++++---
1 file changed, 21 insertions(+), 3 deletions(-)
diff --git a/test/io_uring_passthrough.c b/test/io_uring_passthrough.c
index 9c71586..b58feae 100644
--- a/test/io_uring_passthrough.c
+++ b/test/io_uring_passthrough.c
@@ -350,6 +350,8 @@ static int test_io_uring_submit_enters(const char *file)
int fd, i, ret, ring_flags, open_flags;
unsigned head;
struct io_uring_cqe *cqe;
+ struct nvme_uring_cmd *cmd;
+ struct io_uring_sqe *sqe;
ring_flags = IORING_SETUP_IOPOLL;
ring_flags |= IORING_SETUP_SQE128;
@@ -369,12 +371,28 @@ static int test_io_uring_submit_enters(const char *file)
}
for (i = 0; i < BUFFERS; i++) {
- struct io_uring_sqe *sqe;
off_t offset = BS * (rand() % BUFFERS);
+ __u64 slba;
+ __u32 nlb;
sqe = io_uring_get_sqe(&ring);
- io_uring_prep_writev(sqe, fd, &vecs[i], 1, offset);
- sqe->user_data = 1;
+ io_uring_prep_readv(sqe, fd, &vecs[i], 1, offset);
+ sqe->user_data = i;
+ sqe->opcode = IORING_OP_URING_CMD;
+ sqe->cmd_op = NVME_URING_CMD_IO;
+ cmd = (struct nvme_uring_cmd *)sqe->cmd;
+ memset(cmd, 0, sizeof(struct nvme_uring_cmd));
+
+ slba = offset >> lba_shift;
+ nlb = (BS >> lba_shift) - 1;
+
+ cmd->opcode = nvme_cmd_read;
+ cmd->cdw10 = slba & 0xffffffff;
+ cmd->cdw11 = slba >> 32;
+ cmd->cdw12 = nlb;
+ cmd->addr = (__u64)(uintptr_t)&vecs[i];
+ cmd->data_len = 1;
+ cmd->nsid = nsid;
}
/* submit manually to avoid adding IORING_ENTER_GETEVENTS */
--
2.25.1
next prev parent reply other threads:[~2022-12-06 12:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20221206123005epcas5p474a1374f850c47f2c9af5ef8c8cc6509@epcas5p4.samsung.com>
2022-12-06 12:18 ` [PATCH liburing 0/2] passthrough test fix and cleanup Kanchan Joshi
[not found] ` <CGME20221206123009epcas5p4d65eca3320f9845e190fc425a06799a6@epcas5p4.samsung.com>
2022-12-06 12:18 ` Kanchan Joshi [this message]
[not found] ` <CGME20221206123012epcas5p33de3600bbc6effa8e2a08f748cb0eee4@epcas5p3.samsung.com>
2022-12-06 12:18 ` [PATCH liburing 2/2] test/io_uring_passthrough: cleanup invalid submission test Kanchan Joshi
2022-12-06 17:19 ` [PATCH liburing 0/2] passthrough test fix and cleanup 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 \
[email protected] \
[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