public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
From: Breno Leitao <leitao@debian.org>
To: io-uring@vger.kernel.org, linux-nvme@lists.infradead.org,
	asml.silence@gmail.com, axboe@kernel.dk
Cc: leit@fb.com, linux-kernel@vger.kernel.org,
	linux-block@vger.kernel.org, sagi@grimberg.me, hch@lst.de,
	kbusch@kernel.org, ming.lei@redhat.com
Subject: [PATCH v2 1/3] io_uring: Create a helper to return the SQE size
Date: Fri, 21 Apr 2023 04:44:38 -0700	[thread overview]
Message-ID: <20230421114440.3343473-2-leitao@debian.org> (raw)
In-Reply-To: <20230421114440.3343473-1-leitao@debian.org>

Create a simple helper that returns the size of the SQE. The SQE could
have two size, depending of the flags.

If IO_URING_SETUP_SQE128 flag is set, then return a double SQE,
otherwise returns the sizeof of io_uring_sqe (64 bytes).

Signed-off-by: Breno Leitao <leitao@debian.org>
---
 io_uring/io_uring.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/io_uring/io_uring.h b/io_uring/io_uring.h
index 25515d69d205..25597a771929 100644
--- a/io_uring/io_uring.h
+++ b/io_uring/io_uring.h
@@ -394,4 +394,7 @@ static inline void io_req_queue_tw_complete(struct io_kiocb *req, s32 res)
 	io_req_task_work_add(req);
 }
 
+#define uring_sqe_size(ctx) \
+	((1 + !!(ctx->flags & IORING_SETUP_SQE128)) * sizeof(struct io_uring_sqe))
+
 #endif
-- 
2.34.1


  reply	other threads:[~2023-04-21 11:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20230421114703epcas5p37cd0ddb29674d8f3d5fe2f1fa494d1f0@epcas5p3.samsung.com>
2023-04-21 11:44 ` [PATCH v2 0/3] io_uring: Pass the whole sqe to commands Breno Leitao
2023-04-21 11:44   ` Breno Leitao [this message]
2023-04-24  7:19     ` [PATCH v2 1/3] io_uring: Create a helper to return the SQE size Christoph Hellwig
2023-04-21 11:44   ` [PATCH v2 2/3] io_uring: Pass whole sqe to commands Breno Leitao
2023-04-24  7:23     ` Christoph Hellwig
2023-04-21 11:44   ` [PATCH v2 3/3] io_uring: Remove unnecessary BUILD_BUG_ON Breno Leitao
2023-04-24  7:23     ` Christoph Hellwig
2023-04-28 17:27     ` Jens Axboe
2023-04-21 12:16   ` [PATCH v2 0/3] io_uring: Pass the whole sqe to commands Kanchan Joshi
2023-04-28 17:28   ` Jens Axboe
2023-04-30 14:39     ` Breno Leitao

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=20230421114440.3343473-2-leitao@debian.org \
    --to=leitao@debian.org \
    --cc=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=io-uring@vger.kernel.org \
    --cc=kbusch@kernel.org \
    --cc=leit@fb.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=ming.lei@redhat.com \
    --cc=sagi@grimberg.me \
    /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