ut/nvme_ctrlr: asynchronous register get/set mocks

Added mocks in preparation for making the NVMe controller initialization
use asynchronous versions of the register operations.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: Ifbcc3c73933fb965db710389fec8cd2d52886d4d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8610
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Monica Kenguva <monica.kenguva@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Konrad Sztyber 2021-06-22 16:42:32 +02:00 committed by Tomasz Zawadzki
parent eff86c7042
commit 94cec6a78a

View File

@ -149,6 +149,64 @@ nvme_transport_ctrlr_get_reg_8(struct spdk_nvme_ctrlr *ctrlr, uint32_t offset, u
return 0;
}
int
nvme_transport_ctrlr_set_reg_4_async(struct spdk_nvme_ctrlr *ctrlr, uint32_t offset,
uint32_t value, spdk_nvme_reg_cb cb_fn, void *cb_arg)
{
struct spdk_nvme_cpl cpl = {};
cpl.status.sct = SPDK_NVME_SCT_GENERIC;
cpl.status.sc = SPDK_NVME_SC_SUCCESS;
nvme_transport_ctrlr_set_reg_4(ctrlr, offset, value);
cb_fn(cb_arg, value, &cpl);
return 0;
}
int
nvme_transport_ctrlr_set_reg_8_async(struct spdk_nvme_ctrlr *ctrlr, uint32_t offset,
uint64_t value, spdk_nvme_reg_cb cb_fn, void *cb_arg)
{
struct spdk_nvme_cpl cpl = {};
cpl.status.sct = SPDK_NVME_SCT_GENERIC;
cpl.status.sc = SPDK_NVME_SC_SUCCESS;
nvme_transport_ctrlr_set_reg_8(ctrlr, offset, value);
cb_fn(cb_arg, value, &cpl);
return 0;
}
int
nvme_transport_ctrlr_get_reg_4_async(struct spdk_nvme_ctrlr *ctrlr, uint32_t offset,
spdk_nvme_reg_cb cb_fn, void *cb_arg)
{
struct spdk_nvme_cpl cpl = {};
uint32_t value;
cpl.status.sct = SPDK_NVME_SCT_GENERIC;
cpl.status.sc = SPDK_NVME_SC_SUCCESS;
nvme_transport_ctrlr_get_reg_4(ctrlr, offset, &value);
cb_fn(cb_arg, value, &cpl);
return 0;
}
int
nvme_transport_ctrlr_get_reg_8_async(struct spdk_nvme_ctrlr *ctrlr, uint32_t offset,
spdk_nvme_reg_cb cb_fn, void *cb_arg)
{
struct spdk_nvme_cpl cpl = {};
uint64_t value;
cpl.status.sct = SPDK_NVME_SCT_GENERIC;
cpl.status.sc = SPDK_NVME_SC_SUCCESS;
nvme_transport_ctrlr_get_reg_8(ctrlr, offset, &value);
cb_fn(cb_arg, value, &cpl);
return 0;
}
uint32_t
nvme_transport_ctrlr_get_max_xfer_size(struct spdk_nvme_ctrlr *ctrlr)
{