@@ -327,6 +327,14 @@ enum nvme_cmd_dword_fields {
327327 NVME_ZNS_MGMT_RECV_ZRAS_FEAT_MASK = 0x1 ,
328328 NVME_DIM_TAS_SHIFT = 0 ,
329329 NVME_DIM_TAS_MASK = 0xF ,
330+ NVME_DSM_CDW10_NR_SHIFT = 0 ,
331+ NVME_DSM_CDW10_NR_MASK = 0xff ,
332+ NVME_DSM_CDW11_IDR_SHIFT = 0 ,
333+ NVME_DSM_CDW11_IDR_MASK = 0x1 ,
334+ NVME_DSM_CDW11_IDW_SHIFT = 1 ,
335+ NVME_DSM_CDW11_IDW_MASK = 0x1 ,
336+ NVME_DSM_CDW11_AD_SHIFT = 2 ,
337+ NVME_DSM_CDW11_AD_MASK = 0x1 ,
330338};
331339
332340/**
@@ -3800,7 +3808,10 @@ static inline int nvme_verify(nvme_link_t l, struct nvme_io_args *args)
38003808/**
38013809 * nvme_dsm() - Send an nvme data set management command
38023810 * @l: Link handle
3803- * @args: &struct nvme_dsm_args argument structure
3811+ * @dsm: The data set management attributes
3812+ * @nr_ranges: Number of block ranges in the data set management attributes
3813+ * @attrs: DSM attributes, see &enum nvme_dsm_attributes
3814+ * @nsid: Namespace identifier
38043815 *
38053816 * The Dataset Management command is used by the host to indicate attributes
38063817 * for ranges of logical blocks. This includes attributes like frequency that
@@ -3811,7 +3822,23 @@ static inline int nvme_verify(nvme_link_t l, struct nvme_io_args *args)
38113822 * Return: 0 on success, the nvme command status if a response was
38123823 * received (see &enum nvme_status_field) or a negative error otherwise.
38133824 */
3814- int nvme_dsm (nvme_link_t l , struct nvme_dsm_args * args );
3825+ static inline int nvme_dsm (nvme_link_t l , struct nvme_dsm_range * dsm , __u16 nr_ranges , __u32 attrs ,
3826+ __u32 nsid , __u32 * result )
3827+ {
3828+ __u32 cdw10 = NVME_SET (nr_ranges - 1 , DSM_CDW10_NR );
3829+ __u32 cdw11 = attrs ;
3830+
3831+ struct nvme_passthru_cmd cmd = {
3832+ .opcode = nvme_cmd_dsm ,
3833+ .nsid = nsid ,
3834+ .addr = (__u64 )(uintptr_t )dsm ,
3835+ .data_len = nr_ranges * sizeof (* dsm ),
3836+ .cdw10 = cdw10 ,
3837+ .cdw11 = cdw11 ,
3838+ };
3839+
3840+ return nvme_submit_io_passthru (l , & cmd , result );
3841+ }
38153842
38163843/**
38173844 * nvme_copy() - Copy command
0 commit comments