nvmf: add auxiliary asserts to confirm API usage is correct

Signed-off-by: Jacek Kalwas <jacek.kalwas@intel.com>
Change-Id: Id85420fe38bf804e66cc0da892dd9e7a266eeb00
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11092
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Jacek Kalwas 2022-01-14 06:42:15 -05:00 committed by Jim Harris
parent 93364164e5
commit fcc426bda8
2 changed files with 15 additions and 0 deletions

View File

@ -2897,6 +2897,8 @@ nvmf_qpair_abort_aer(struct spdk_nvmf_qpair *qpair, uint16_t cid)
return false;
}
assert(spdk_get_thread() == ctrlr->thread);
for (i = 0; i < ctrlr->nr_aer_reqs; i++) {
if (ctrlr->aer_req[i]->cmd->nvme_cmd.cid == cid) {
SPDK_DEBUGLOG(nvmf, "Aborting AER request\n");
@ -3296,6 +3298,8 @@ nvmf_ctrlr_process_admin_cmd(struct spdk_nvmf_request *req)
return SPDK_NVMF_REQUEST_EXEC_STATUS_COMPLETE;
}
assert(spdk_get_thread() == ctrlr->thread);
if (cmd->fuse != 0) {
/* Fused admin commands are not supported. */
response->status.sct = SPDK_NVME_SCT_GENERIC;
@ -3440,6 +3444,8 @@ nvmf_ctrlr_async_event_notification(struct spdk_nvmf_ctrlr *ctrlr,
struct spdk_nvmf_request *req;
struct spdk_nvme_cpl *rsp;
assert(spdk_get_thread() == ctrlr->thread);
/* If there is no outstanding AER request, queue the event. Then
* if an AER is later submitted, this event can be sent as a
* response.
@ -3573,6 +3579,8 @@ nvmf_qpair_free_aer(struct spdk_nvmf_qpair *qpair)
return;
}
assert(spdk_get_thread() == ctrlr->thread);
for (i = 0; i < ctrlr->nr_aer_reqs; i++) {
spdk_nvmf_request_free(ctrlr->aer_req[i]);
ctrlr->aer_req[i] = NULL;
@ -3587,6 +3595,8 @@ nvmf_ctrlr_abort_aer(struct spdk_nvmf_ctrlr *ctrlr)
struct spdk_nvmf_request *req;
int i;
assert(spdk_get_thread() == ctrlr->thread);
if (!ctrlr->nr_aer_reqs) {
return;
}

View File

@ -874,6 +874,7 @@ test_get_ns_id_desc_list(void)
memset(&ctrlr, 0, sizeof(ctrlr));
ctrlr.subsys = &subsystem;
ctrlr.vcprop.cc.bits.en = 1;
ctrlr.thread = spdk_get_thread();
memset(&req, 0, sizeof(req));
req.qpair = &qpair;
@ -1639,6 +1640,7 @@ test_custom_admin_cmd(void)
memset(&ctrlr, 0, sizeof(ctrlr));
ctrlr.subsys = &subsystem;
ctrlr.vcprop.cc.bits.en = 1;
ctrlr.thread = spdk_get_thread();
memset(&req, 0, sizeof(req));
req.qpair = &qpair;
@ -1796,6 +1798,7 @@ test_multi_async_event_reqs(void)
ctrlr.subsys = &subsystem;
ctrlr.vcprop.cc.bits.en = 1;
ctrlr.thread = spdk_get_thread();
for (i = 0; i < 5; i++) {
cmd[i].nvme_cmd.opc = SPDK_NVME_OPC_ASYNC_EVENT_REQUEST;
@ -2050,6 +2053,7 @@ test_multi_async_events(void)
ctrlr.subsys = &subsystem;
ctrlr.vcprop.cc.bits.en = 1;
ctrlr.thread = spdk_get_thread();
ctrlr.feat.async_event_configuration.bits.ns_attr_notice = 1;
ctrlr.feat.async_event_configuration.bits.ana_change_notice = 1;
ctrlr.feat.async_event_configuration.bits.discovery_log_change_notice = 1;
@ -2124,6 +2128,7 @@ test_rae(void)
ctrlr.subsys = &subsystem;
ctrlr.vcprop.cc.bits.en = 1;
ctrlr.thread = spdk_get_thread();
ctrlr.feat.async_event_configuration.bits.ns_attr_notice = 1;
init_pending_async_events(&ctrlr);