static int nvme_io(int fd, __u8 opcode, __u32 nsid, __u64 slba, __u16 nlb,
__u16 control, __u32 flags, __u32 reftag, __u16 apptag, __u16 appmask,
- __u32 data_len, void *data, __u32 metadata_len, void *metadata)
+ __u64 storage_tag, __u32 data_len, void *data, __u32 metadata_len,
+ void *metadata)
{
+ __u32 cdw2 = storage_tag & 0xffffffff;
+ __u32 cdw3 = (storage_tag >> 32) & 0xffff;
__u32 cdw10 = slba & 0xffffffff;
__u32 cdw11 = slba >> 32;
__u32 cdw12 = nlb | (control << 16);
struct nvme_passthru_cmd cmd = {
.opcode = opcode,
.nsid = nsid,
+ .cdw2 = cdw2,
+ .cdw3 = cdw3,
.cdw10 = cdw10,
.cdw11 = cdw11,
.cdw12 = cdw12,
__u32 data_len, void *data, __u32 metadata_len, void *metadata)
{
return nvme_io(fd, nvme_cmd_read, nsid, slba, nlb, control, dsm,
- reftag, apptag, appmask, data_len, data, metadata_len,
+ reftag, apptag, appmask, 0, data_len, data, metadata_len,
metadata);
}
__u32 flags = dsm | dspec << 16;
return nvme_io(fd, nvme_cmd_write, nsid, slba, nlb, control, flags,
- reftag, apptag, appmask, data_len, data, metadata_len,
+ reftag, apptag, appmask, 0, data_len, data, metadata_len,
metadata);
}
void *data, __u32 metadata_len, void *metadata)
{
return nvme_io(fd, nvme_cmd_compare, nsid, slba, nlb, control, 0,
- reftag, apptag, appmask, data_len, data, metadata_len,
+ reftag, apptag, appmask, 0, data_len, data, metadata_len,
metadata);
}
int nvme_write_zeros(int fd, __u32 nsid, __u64 slba, __u16 nlb, __u16 control,
- __u32 reftag, __u16 apptag, __u16 appmask)
+ __u32 reftag, __u16 apptag, __u16 appmask,
+ __u64 storage_tag)
{
return nvme_io(fd, nvme_cmd_write_zeroes, nsid, slba, nlb, control, 0,
- reftag, apptag, appmask, 0, NULL, 0, NULL);
+ reftag, apptag, appmask, storage_tag, 0, NULL, 0, NULL);
}
int nvme_verify(int fd, __u32 nsid, __u64 slba, __u16 nlb, __u16 control,
- __u32 reftag, __u16 apptag, __u16 appmask)
+ __u32 reftag, __u16 apptag, __u16 appmask, __u64 storage_tag)
{
return nvme_io(fd, nvme_cmd_verify, nsid, slba, nlb, control, 0,
- reftag, apptag, appmask, 0, NULL, 0, NULL);
+ reftag, apptag, appmask, 0, 0, NULL, 0, NULL);
}
int nvme_write_uncorrectable(int fd, __u32 nsid, __u64 slba, __u16 nlb)
{
return nvme_io(fd, nvme_cmd_write_uncor, nsid, slba, nlb, 0, 0, 0, 0,
- 0, 0, NULL, 0, NULL);
+ 0, 0, 0, NULL, 0, NULL);
}
int nvme_dsm(int fd, __u32 nsid, __u32 attrs, __u16 nr_ranges,
* @appmask: This field specifies the Application Tag expected value. Used
* only if the namespace is formatted to use end-to-end protection
* information.
+ * @storage_tag: This filed specifies Variable Sized Expected Logical Block
+ * Storage Tag (ELBST) and Expected Logical Block Reference
+ * Tag (ELBRT)
*
* The Write Zeroes command sets a range of logical blocks to zero. After
* successful completion of this command, the value returned by subsequent
* &enum nvme_status_field) or -1 with errno set otherwise.
*/
int nvme_write_zeros(int fd, __u32 nsid, __u64 slba, __u16 nlb, __u16 control,
- __u32 reftag, __u16 apptag, __u16 appmask);
+ __u32 reftag, __u16 apptag, __u16 appmask,
+ __u64 storage_tag);
/**
* nvme_write_uncorrectable() - Submit an nvme write uncorrectable command
* @appmask: This field specifies the Application Tag expected value. Used
* only if the namespace is formatted to use end-to-end protection
* information.
+ * @storage_tag: This filed specifies Variable Sized Expected Logical Block
+ * Storage Tag (ELBST) and Expected Logical Block Reference
+ * Tag (ELBRT)
*
* The Verify command verifies integrity of stored information by reading data
* and metadata, if applicable, for the LBAs indicated without transferring any
* &enum nvme_status_field) or -1 with errno set otherwise.
*/
int nvme_verify(int fd, __u32 nsid, __u64 slba, __u16 nlb, __u16 control,
- __u32 reftag, __u16 apptag, __u16 appmask);
+ __u32 reftag, __u16 apptag, __u16 appmask, __u64 storage_tag);
/**
* nvme_dsm() - Send an nvme data set management command