test/bdevio: add nvme admin passthrough test
This test sends identify controller command to the NVMe device. Change-Id: Icc262a1a1fa52bafe5cb019151c3d196bd268673 Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/454609 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
e45f3b102b
commit
0668025839
@ -939,6 +939,49 @@ blockdev_test_nvme_passthru_vendor_specific(void)
|
||||
CU_ASSERT(pt_req.sc == SPDK_NVME_SC_INVALID_OPCODE);
|
||||
}
|
||||
|
||||
static void
|
||||
__blockdev_nvme_admin_passthru(void *arg1, void *arg2)
|
||||
{
|
||||
struct bdevio_passthrough_request *pt_req = arg1;
|
||||
struct io_target *target = pt_req->target;
|
||||
int rc;
|
||||
|
||||
rc = spdk_bdev_nvme_admin_passthru(target->bdev_desc, target->ch,
|
||||
&pt_req->cmd, pt_req->buf, pt_req->len,
|
||||
nvme_pt_test_complete, pt_req);
|
||||
if (rc) {
|
||||
wake_ut_thread();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
blockdev_test_nvme_admin_passthru(void)
|
||||
{
|
||||
struct io_target *target;
|
||||
struct bdevio_passthrough_request pt_req;
|
||||
|
||||
target = g_current_io_target;
|
||||
|
||||
if (!spdk_bdev_io_type_supported(target->bdev, SPDK_BDEV_IO_TYPE_NVME_ADMIN)) {
|
||||
return;
|
||||
}
|
||||
|
||||
memset(&pt_req, 0, sizeof(pt_req));
|
||||
pt_req.target = target;
|
||||
pt_req.cmd.opc = SPDK_NVME_OPC_IDENTIFY;
|
||||
pt_req.cmd.nsid = 0;
|
||||
*(uint64_t *)&pt_req.cmd.cdw10 = SPDK_NVME_IDENTIFY_CTRLR;
|
||||
|
||||
pt_req.len = sizeof(struct spdk_nvme_ctrlr_data);
|
||||
pt_req.buf = spdk_dma_malloc(pt_req.len, 0, NULL);
|
||||
|
||||
pt_req.sct = SPDK_NVME_SCT_GENERIC;
|
||||
pt_req.sc = SPDK_NVME_SC_SUCCESS;
|
||||
execute_spdk_function(__blockdev_nvme_admin_passthru, &pt_req, NULL);
|
||||
CU_ASSERT(pt_req.sct == SPDK_NVME_SCT_GENERIC);
|
||||
CU_ASSERT(pt_req.sc == SPDK_NVME_SC_SUCCESS);
|
||||
}
|
||||
|
||||
static void
|
||||
__stop_init_thread(void *arg1, void *arg2)
|
||||
{
|
||||
@ -1032,6 +1075,8 @@ __setup_ut_on_single_target(struct io_target *target)
|
||||
blockdev_test_nvme_passthru_rw) == NULL
|
||||
|| CU_add_test(suite, "blockdev nvme passthru vendor specific",
|
||||
blockdev_test_nvme_passthru_vendor_specific) == NULL
|
||||
|| CU_add_test(suite, "blockdev nvme admin passthru",
|
||||
blockdev_test_nvme_admin_passthru) == NULL
|
||||
) {
|
||||
CU_cleanup_registry();
|
||||
rc = CU_get_error();
|
||||
|
Loading…
Reference in New Issue
Block a user