File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ LIBNVME_1_0 {
4242 nvme_ctrls_filter;
4343 nvme_default_host;
4444 nvme_dev_self_test;
45+ nvme_dim_send;
4546 nvme_directive_recv;
4647 nvme_directive_recv_identify_parameters;
4748 nvme_directive_recv_stream_allocate;
Original file line number Diff line number Diff line change @@ -306,6 +306,8 @@ enum nvme_cmd_dword_fields {
306306 NVME_ZNS_MGMT_RECV_ZRASF_MASK = 0xff ,
307307 NVME_ZNS_MGMT_RECV_ZRAS_FEAT_SHIFT = 16 ,
308308 NVME_ZNS_MGMT_RECV_ZRAS_FEAT_MASK = 0x1 ,
309+ NVME_DIM_TAS_SHIFT = 0 ,
310+ NVME_DIM_TAS_MASK = 0xF ,
309311};
310312
311313enum features {
@@ -1842,3 +1844,23 @@ int nvme_zns_append(struct nvme_zns_append_args *args)
18421844 }
18431845 return nvme_submit_io_passthru64 (args -> fd , & cmd , args -> result );
18441846}
1847+
1848+ int nvme_dim_send (struct nvme_dim_args * args )
1849+ {
1850+ __u32 cdw10 = NVME_SET (args -> tas , DIM_TAS );
1851+
1852+ struct nvme_passthru_cmd cmd = {
1853+ .opcode = nvme_admin_discovery_info_mgmt ,
1854+ .cdw10 = cdw10 ,
1855+ .addr = (__u64 )(uintptr_t )args -> data ,
1856+ .data_len = args -> data_len ,
1857+ .timeout_ms = args -> timeout ,
1858+ };
1859+
1860+ if (args -> args_size < sizeof (* args )) {
1861+ errno = EINVAL ;
1862+ return -1 ;
1863+ }
1864+
1865+ return nvme_submit_admin_passthru (args -> fd , & cmd , args -> result );
1866+ }
Original file line number Diff line number Diff line change @@ -4346,4 +4346,33 @@ struct nvme_zns_append_args {
43464346 */
43474347int nvme_zns_append (struct nvme_zns_append_args * args );
43484348
4349+ /**
4350+ * struct nvme_dim_args - Arguments for the Discovery Information Management (DIM) command
4351+ * @result: Set on completion to the command's CQE DWORD 0 controller response.
4352+ * @data: Pointer to the DIM data
4353+ * @args_size: Length of the structure
4354+ * @fd: File descriptor of nvme device
4355+ * @timeout: Timeout in ms
4356+ * @data_len: Length of @data
4357+ * @tas: Task field of the Command Dword 10 (cdw10)
4358+ */
4359+ struct nvme_dim_args {
4360+ __u32 * result ;
4361+ void * data ;
4362+ int args_size ;
4363+ int fd ;
4364+ __u32 timeout ;
4365+ __u32 data_len ;
4366+ __u8 tas ;
4367+ } __attribute__((packed , aligned (__alignof__(__u32 * ))));
4368+
4369+ /**
4370+ * nvme_dim_send - Send a Discovery Information Management (DIM) command
4371+ * @args: &struct nvme_dim_args argument structure
4372+ *
4373+ * Return: The nvme command status if a response was received (see
4374+ * &enum nvme_status_field) or -1 with errno set otherwise.
4375+ */
4376+ int nvme_dim_send (struct nvme_dim_args * args );
4377+
43494378#endif /* _LIBNVME_IOCTL_H */
You can’t perform that action at this time.
0 commit comments