2 * nvme structure declarations and helper functions for the
9 #include <linux/nvme_ioctl.h>
13 * If the uapi headers installed on the system lacks nvme uring command
14 * support, use the local version to prevent compilation issues.
16 #ifndef CONFIG_NVME_URING_CMD
17 struct nvme_uring_cmd {
38 #define NVME_URING_CMD_IO _IOWR('N', 0x80, struct nvme_uring_cmd)
39 #define NVME_URING_CMD_IO_VEC _IOWR('N', 0x81, struct nvme_uring_cmd)
40 #endif /* CONFIG_NVME_URING_CMD */
42 #define NVME_DEFAULT_IOCTL_TIMEOUT 0
43 #define NVME_IDENTIFY_DATA_SIZE 4096
44 #define NVME_IDENTIFY_CSI_SHIFT 24
46 #define NVME_ZNS_ZRA_REPORT_ZONES 0
47 #define NVME_ZNS_ZRAS_FEAT_ERZ (1 << 16)
48 #define NVME_ZNS_ZSA_RESET 0x4
49 #define NVME_ZONE_TYPE_SEQWRITE_REQ 0x2
51 enum nvme_identify_cns {
52 NVME_IDENTIFY_CNS_NS = 0x00,
53 NVME_IDENTIFY_CNS_CSI_NS = 0x05,
54 NVME_IDENTIFY_CNS_CSI_CTRL = 0x06,
63 enum nvme_admin_opcode {
64 nvme_admin_identify = 0x06,
68 nvme_cmd_write = 0x01,
70 nvme_zns_cmd_mgmt_send = 0x79,
71 nvme_zns_cmd_mgmt_recv = 0x7a,
75 NVME_ZNS_ZS_EMPTY = 0x1,
76 NVME_ZNS_ZS_IMPL_OPEN = 0x2,
77 NVME_ZNS_ZS_EXPL_OPEN = 0x3,
78 NVME_ZNS_ZS_CLOSED = 0x4,
79 NVME_ZNS_ZS_READ_ONLY = 0xd,
80 NVME_ZNS_ZS_FULL = 0xe,
81 NVME_ZNS_ZS_OFFLINE = 0xf,
133 struct nvme_lbaf lbaf[16];
138 static inline int ilog2(uint32_t i)
149 struct nvme_zns_lbafe {
155 struct nvme_zns_id_ns {
173 struct nvme_zns_lbafe lbafe[64];
177 struct nvme_zns_desc {
189 struct nvme_zone_report {
192 struct nvme_zns_desc entries[];
195 int fio_nvme_get_info(struct fio_file *f, __u32 *nsid, __u32 *lba_sz,
198 int fio_nvme_uring_cmd_prep(struct nvme_uring_cmd *cmd, struct io_u *io_u,
201 int fio_nvme_get_zoned_model(struct thread_data *td, struct fio_file *f,
202 enum zbd_zoned_model *model);
204 int fio_nvme_report_zones(struct thread_data *td, struct fio_file *f,
205 uint64_t offset, struct zbd_zone *zbdz,
206 unsigned int nr_zones);
208 int fio_nvme_reset_wp(struct thread_data *td, struct fio_file *f,
209 uint64_t offset, uint64_t length);
211 int fio_nvme_get_max_open_zones(struct thread_data *td, struct fio_file *f,
212 unsigned int *max_open_zones);