io_uring: sendzc with fixed buffers
[linux-2.6-microblaze.git] / include / uapi / linux / io_uring.h
index 53e7dae..f1a9ff9 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <linux/fs.h>
 #include <linux/types.h>
+#include <linux/time_types.h>
 
 /*
  * IO submission data structure (Submission Queue Entry)
@@ -22,7 +23,10 @@ struct io_uring_sqe {
        union {
                __u64   off;    /* offset into file */
                __u64   addr2;
-               __u32   cmd_op;
+               struct {
+                       __u32   cmd_op;
+                       __u32   __pad1;
+               };
        };
        union {
                __u64   addr;   /* pointer to buffer or iovecs */
@@ -47,6 +51,7 @@ struct io_uring_sqe {
                __u32           unlink_flags;
                __u32           hardlink_flags;
                __u32           xattr_flags;
+               __u32           msg_ring_flags;
        };
        __u64   user_data;      /* data to be passed back at completion time */
        /* pack this to avoid bogus arm OABI complaints */
@@ -61,6 +66,10 @@ struct io_uring_sqe {
        union {
                __s32   splice_fd_in;
                __u32   file_index;
+               struct {
+                       __u16   notification_idx;
+                       __u16   addr_len;
+               };
        };
        union {
                struct {
@@ -137,9 +146,12 @@ enum {
  * IORING_SQ_TASKRUN in the sq ring flags. Not valid with COOP_TASKRUN.
  */
 #define IORING_SETUP_TASKRUN_FLAG      (1U << 9)
-
 #define IORING_SETUP_SQE128            (1U << 10) /* SQEs are 128 byte */
 #define IORING_SETUP_CQE32             (1U << 11) /* CQEs are 32 byte */
+/*
+ * Only one task is allowed to submit requests
+ */
+#define IORING_SETUP_SINGLE_ISSUER     (1U << 12)
 
 enum io_uring_op {
        IORING_OP_NOP,
@@ -189,6 +201,7 @@ enum io_uring_op {
        IORING_OP_GETXATTR,
        IORING_OP_SOCKET,
        IORING_OP_URING_CMD,
+       IORING_OP_SENDZC_NOTIF,
 
        /* this goes last, obviously */
        IORING_OP_LAST,
@@ -226,10 +239,13 @@ enum io_uring_op {
  *
  * IORING_POLL_UPDATE          Update existing poll request, matching
  *                             sqe->addr as the old user_data field.
+ *
+ * IORING_POLL_LEVEL           Level triggered poll.
  */
 #define IORING_POLL_ADD_MULTI  (1U << 0)
 #define IORING_POLL_UPDATE_EVENTS      (1U << 1)
 #define IORING_POLL_UPDATE_USER_DATA   (1U << 2)
+#define IORING_POLL_ADD_LEVEL          (1U << 3)
 
 /*
  * ASYNC_CANCEL flags.
@@ -238,26 +254,53 @@ enum io_uring_op {
  * IORING_ASYNC_CANCEL_FD      Key off 'fd' for cancelation rather than the
  *                             request 'user_data'
  * IORING_ASYNC_CANCEL_ANY     Match any request
+ * IORING_ASYNC_CANCEL_FD_FIXED        'fd' passed in is a fixed descriptor
  */
 #define IORING_ASYNC_CANCEL_ALL        (1U << 0)
 #define IORING_ASYNC_CANCEL_FD (1U << 1)
 #define IORING_ASYNC_CANCEL_ANY        (1U << 2)
+#define IORING_ASYNC_CANCEL_FD_FIXED   (1U << 3)
 
 /*
- * send/sendmsg and recv/recvmsg flags (sqe->addr2)
+ * send/sendmsg and recv/recvmsg flags (sqe->ioprio)
  *
  * IORING_RECVSEND_POLL_FIRST  If set, instead of first attempting to send
  *                             or receive and arm poll if that yields an
  *                             -EAGAIN result, arm poll upfront and skip
  *                             the initial transfer attempt.
+ *
+ * IORING_RECV_MULTISHOT       Multishot recv. Sets IORING_CQE_F_MORE if
+ *                             the handler will continue to report
+ *                             CQEs on behalf of the same SQE.
+ *
+ * IORING_RECVSEND_FIXED_BUF   Use registered buffers, the index is stored in
+ *                             the buf_index field.
  */
 #define IORING_RECVSEND_POLL_FIRST     (1U << 0)
+#define IORING_RECV_MULTISHOT          (1U << 1)
+#define IORING_RECVSEND_FIXED_BUF      (1U << 2)
 
 /*
  * accept flags stored in sqe->ioprio
  */
 #define IORING_ACCEPT_MULTISHOT        (1U << 0)
 
+/*
+ * IORING_OP_MSG_RING command types, stored in sqe->addr
+ */
+enum {
+       IORING_MSG_DATA,        /* pass sqe->len as 'res' and off as user_data */
+       IORING_MSG_SEND_FD,     /* send a registered fd to another ring */
+};
+
+/*
+ * IORING_OP_MSG_RING flags (sqe->msg_ring_flags)
+ *
+ * IORING_MSG_RING_CQE_SKIP    Don't post a CQE to the target ring. Not
+ *                             applicable for IORING_MSG_DATA, obviously.
+ */
+#define IORING_MSG_RING_CQE_SKIP       (1U << 0)
+
 /*
  * IO completion data structure (Completion Queue Entry)
  */
@@ -417,6 +460,16 @@ enum {
        IORING_REGISTER_PBUF_RING               = 22,
        IORING_UNREGISTER_PBUF_RING             = 23,
 
+       /* sync cancelation API */
+       IORING_REGISTER_SYNC_CANCEL             = 24,
+
+       /* register a range of fixed file slots for automatic slot allocation */
+       IORING_REGISTER_FILE_ALLOC_RANGE        = 25,
+
+       /* zerocopy notification API */
+       IORING_REGISTER_NOTIFIERS               = 26,
+       IORING_UNREGISTER_NOTIFIERS             = 27,
+
        /* this goes last */
        IORING_REGISTER_LAST
 };
@@ -463,6 +516,19 @@ struct io_uring_rsrc_update2 {
        __u32 resv2;
 };
 
+struct io_uring_notification_slot {
+       __u64 tag;
+       __u64 resv[3];
+};
+
+struct io_uring_notification_register {
+       __u32 nr_slots;
+       __u32 resv;
+       __u64 resv2;
+       __u64 data;
+       __u64 resv3;
+};
+
 /* Skip updating fd indexes set to this value in the fd table */
 #define IORING_REGISTER_FILES_SKIP     (-2)
 
@@ -480,7 +546,7 @@ struct io_uring_probe {
        __u8 ops_len;   /* length of ops[] array below */
        __u16 resv;
        __u32 resv2[3];
-       struct io_uring_probe_op ops[0];
+       struct io_uring_probe_op ops[];
 };
 
 struct io_uring_restriction {
@@ -552,4 +618,32 @@ struct io_uring_getevents_arg {
        __u64   ts;
 };
 
+/*
+ * Argument for IORING_REGISTER_SYNC_CANCEL
+ */
+struct io_uring_sync_cancel_reg {
+       __u64                           addr;
+       __s32                           fd;
+       __u32                           flags;
+       struct __kernel_timespec        timeout;
+       __u64                           pad[4];
+};
+
+/*
+ * Argument for IORING_REGISTER_FILE_ALLOC_RANGE
+ * The range is specified as [off, off + len)
+ */
+struct io_uring_file_index_range {
+       __u32   off;
+       __u32   len;
+       __u64   resv;
+};
+
+struct io_uring_recvmsg_out {
+       __u32 namelen;
+       __u32 controllen;
+       __u32 payloadlen;
+       __u32 flags;
+};
+
 #endif