File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1474,17 +1474,20 @@ int nvme_sanitize_nvm(struct nvme_sanitize_nvm_args *args)
14741474 return nvme_submit_admin_passthru (args -> fd , & cmd , args -> result );
14751475}
14761476
1477- int nvme_dev_self_test (int fd , __u32 nsid , enum nvme_dst_stc stc )
1477+ int nvme_dev_self_test (struct nvme_dev_self_test_args * args )
14781478{
1479- __u32 cdw10 = NVME_SET (stc , DEVICE_SELF_TEST_CDW10_STC );
1479+ __u32 cdw10 = NVME_SET (args -> stc , DEVICE_SELF_TEST_CDW10_STC );
14801480
14811481 struct nvme_passthru_cmd cmd = {
1482- .opcode = nvme_admin_dev_self_test ,
1483- .nsid = nsid ,
1484- .cdw10 = cdw10 ,
1482+ .opcode = nvme_admin_dev_self_test ,
1483+ .nsid = args -> nsid ,
1484+ .cdw10 = cdw10 ,
1485+ .timeout_ms = args -> timeout ,
14851486 };
14861487
1487- return nvme_submit_admin_passthru (fd , & cmd , NULL );
1488+ if (args -> args_size < sizeof (* args ))
1489+ return - EINVAL ;
1490+ return nvme_submit_admin_passthru (args -> fd , & cmd , args -> result );
14881491}
14891492
14901493int nvme_virtual_mgmt (int fd , enum nvme_virt_mgmt_act act ,
Original file line number Diff line number Diff line change @@ -3481,10 +3481,25 @@ struct nvme_sanitize_nvm_args {
34813481int nvme_sanitize_nvm (struct nvme_sanitize_nvm_args * args );
34823482
34833483/**
3484- * nvme_dev_self_test() - Start or abort a self test
3484+ * nvme_dev_self_test_args - Arguments for the NVMe Device Self Test command
34853485 * @fd: File descriptor of nvme device
34863486 * @nsid: Namespace ID to test
34873487 * @stc: Self test code, see &enum nvme_dst_stc
3488+ * @timeout: Timeout in ms
3489+ * @result: The command completion result from CQE dword0
3490+ */
3491+ struct nvme_dev_self_test_args {
3492+ int args_size ;
3493+ int fd ;
3494+ __u32 nsid ;
3495+ enum nvme_dst_stc stc ;
3496+ __u32 timeout ;
3497+ __u32 * result ;
3498+ };
3499+
3500+ /**
3501+ * nvme_dev_self_test() - Start or abort a self test
3502+ * @args: &struct nvme_dev_self_test argument structure
34883503 *
34893504 * The Device Self-test command starts a device self-test operation or abort a
34903505 * device self-test operation. A device self-test operation is a diagnostic
@@ -3500,7 +3515,7 @@ int nvme_sanitize_nvm(struct nvme_sanitize_nvm_args *args);
35003515 * Return: The nvme command status if a response was received (see
35013516 * &enum nvme_status_field) or -1 with errno set otherwise.
35023517 */
3503- int nvme_dev_self_test (int fd , __u32 nsid , enum nvme_dst_stc stc );
3518+ int nvme_dev_self_test (struct nvme_dev_self_test_args * args );
35043519
35053520/**
35063521 * nvme_virtual_mgmt() - Virtualization resource management
You can’t perform that action at this time.
0 commit comments