Skip to content

Commit 0c1165d

Browse files
Anuj Guptaankit-sam
authored andcommitted
ioctl: nvme_uring_cmd add structure and opcodes
This adds definition of struct nvme_uring_cmd and NVME_URING_CMD_IO/NVME_URING_CMD_IO_VEC opcodes. The new structure definition and opcodes are required for using uring-nvme-passthrough feature. This feature has been picked for 5.19 kernel. Signed-off-by: Anuj Gupta <[email protected]> Signed-off-by: Ankit Kumar <[email protected]>
1 parent 34475e2 commit 0c1165d

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

src/nvme/ioctl.h

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,48 @@ struct nvme_passthru_cmd64 {
119119
__u64 result;
120120
};
121121

122+
/**
123+
* struct nvme_uring_cmd - nvme uring command structure
124+
* @opcode: Operation code, see &enum nvme_io_opcodes and &enum nvme_admin_opcodes
125+
* @flags: Not supported: intended for command flags (eg: SGL, FUSE)
126+
* @rsvd1: Reserved for future use
127+
* @nsid: Namespace Identifier, or Fabrics type
128+
* @cdw2: Command Dword 2 (no spec defined use)
129+
* @cdw3: Command Dword 3 (no spec defined use)
130+
* @metadata: User space address to metadata buffer (NULL if not used)
131+
* @addr: User space address to data buffer (NULL if not used)
132+
* @metadata_len: Metadata buffer transfer length
133+
* @data_len: Data buffer transfer length
134+
* @cdw10: Command Dword 10 (command specific)
135+
* @cdw11: Command Dword 11 (command specific)
136+
* @cdw12: Command Dword 12 (command specific)
137+
* @cdw13: Command Dword 13 (command specific)
138+
* @cdw14: Command Dword 14 (command specific)
139+
* @cdw15: Command Dword 15 (command specific)
140+
* @timeout_ms: If non-zero, overrides system default timeout in milliseconds
141+
* @rsvd2: Reserved for future use (and fills an impicit struct pad
142+
*/
143+
struct nvme_uring_cmd {
144+
__u8 opcode;
145+
__u8 flags;
146+
__u16 rsvd1;
147+
__u32 nsid;
148+
__u32 cdw2;
149+
__u32 cdw3;
150+
__u64 metadata;
151+
__u64 addr;
152+
__u32 metadata_len;
153+
__u32 data_len;
154+
__u32 cdw10;
155+
__u32 cdw11;
156+
__u32 cdw12;
157+
__u32 cdw13;
158+
__u32 cdw14;
159+
__u32 cdw15;
160+
__u32 timeout_ms;
161+
__u32 rsvd2;
162+
};
163+
122164
#define NVME_IOCTL_ID _IO('N', 0x40)
123165
#define NVME_IOCTL_RESET _IO('N', 0x44)
124166
#define NVME_IOCTL_SUBSYS_RESET _IO('N', 0x45)
@@ -128,6 +170,10 @@ struct nvme_passthru_cmd64 {
128170
#define NVME_IOCTL_ADMIN64_CMD _IOWR('N', 0x47, struct nvme_passthru_cmd64)
129171
#define NVME_IOCTL_IO64_CMD _IOWR('N', 0x48, struct nvme_passthru_cmd64)
130172

173+
/* io_uring async commands: */
174+
#define NVME_URING_CMD_IO _IOWR('N', 0x80, struct nvme_uring_cmd)
175+
#define NVME_URING_CMD_IO_VEC _IOWR('N', 0x81, struct nvme_uring_cmd)
176+
131177
#endif /* _UAPI_LINUX_NVME_IOCTL_H */
132178

133179
#endif /* _LINUX_NVME_IOCTL_H */

0 commit comments

Comments
 (0)