summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2022-03-09 19:39:51 -0700
committerJens Axboe <axboe@kernel.dk>2022-03-10 09:27:40 -0700
commit22718e636826a6ec6f2248433e9e68e35aed914d (patch)
tree93dfe1a633e9cad389e616047fd80915a4bce2ed
parent115cca320dd4df9293440d8e410bebb064822265 (diff)
downloadliburing-22718e636826a6ec6f2248433e9e68e35aed914d.tar.gz
liburing-22718e636826a6ec6f2248433e9e68e35aed914d.tar.bz2
Add io_uring_prep_msg_ring() helper
The IORING_OP_MSG_RING command type can be used to send a notification to another ring. This can be used to either just wakeup anyone waiting on the ring, for example. Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--src/include/liburing.h8
-rw-r--r--src/include/liburing/io_uring.h3
2 files changed, 11 insertions, 0 deletions
diff --git a/src/include/liburing.h b/src/include/liburing.h
index ef5a4cd..7f75eb4 100644
--- a/src/include/liburing.h
+++ b/src/include/liburing.h
@@ -703,6 +703,14 @@ static inline void io_uring_prep_linkat(struct io_uring_sqe *sqe, int olddfd,
sqe->hardlink_flags = (__u32) flags;
}
+static inline void io_uring_prep_msg_ring(struct io_uring_sqe *sqe, int fd,
+ unsigned int len, __u64 data,
+ unsigned int flags)
+{
+ io_uring_prep_rw(IORING_OP_MSG_RING, sqe, fd, NULL, len, data);
+ sqe->rw_flags = flags;
+}
+
/*
* Returns number of unconsumed (if SQPOLL) or unsubmitted entries exist in
* the SQ ring
diff --git a/src/include/liburing/io_uring.h b/src/include/liburing/io_uring.h
index a7d193d..c7cfe7d 100644
--- a/src/include/liburing/io_uring.h
+++ b/src/include/liburing/io_uring.h
@@ -147,6 +147,7 @@ enum {
IORING_OP_MKDIRAT,
IORING_OP_SYMLINKAT,
IORING_OP_LINKAT,
+ IORING_OP_MSG_RING,
/* this goes last, obviously */
IORING_OP_LAST,
@@ -203,9 +204,11 @@ struct io_uring_cqe {
*
* IORING_CQE_F_BUFFER If set, the upper 16 bits are the buffer ID
* IORING_CQE_F_MORE If set, parent SQE will generate more CQE entries
+ * IORING_CQE_F_MSG If set, CQE was generated with IORING_OP_MSG_RING
*/
#define IORING_CQE_F_BUFFER (1U << 0)
#define IORING_CQE_F_MORE (1U << 1)
+#define IORING_CQE_F_MSG (1U << 2)
enum {
IORING_CQE_BUFFER_SHIFT = 16,