nvme: zero shadow doorbell registers when freeing qpair

The shadow registers need to be zero when the qpair is
created.  This happens automatically when a given qid
is used for the first time, since the page is allocated
with zmalloc. But if a qid is reused, we need to make
sure its shadow registers are cleared *before* we create
the qpair again with the same qid.

So clear the registers in nvme_pcie_ctrlr_delete_io_qpair,
just after the cq is deleted.

Fixes issue #1795.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I08c30d1ea248559a01b802cd132dd57199b491b5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6752
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Jim Harris 2021-03-05 22:55:40 +00:00 committed by Tomasz Zawadzki
parent 34429830bd
commit 38736d993d

View File

@ -936,6 +936,7 @@ nvme_pcie_ctrlr_create_io_qpair(struct spdk_nvme_ctrlr *ctrlr, uint16_t qid,
int int
nvme_pcie_ctrlr_delete_io_qpair(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_qpair *qpair) nvme_pcie_ctrlr_delete_io_qpair(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_qpair *qpair)
{ {
struct nvme_pcie_qpair *pqpair = nvme_pcie_qpair(qpair);
struct nvme_completion_poll_status *status; struct nvme_completion_poll_status *status;
int rc; int rc;
@ -986,6 +987,12 @@ nvme_pcie_ctrlr_delete_io_qpair(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_
} }
free(status); free(status);
if (pqpair->flags.has_shadow_doorbell) {
*pqpair->shadow_doorbell.sq_tdbl = 0;
*pqpair->shadow_doorbell.cq_hdbl = 0;
*pqpair->shadow_doorbell.sq_eventidx = 0;
*pqpair->shadow_doorbell.cq_eventidx = 0;
}
free: free:
if (qpair->no_deletion_notification_needed == 0) { if (qpair->no_deletion_notification_needed == 0) {
/* Abort the rest of the I/O */ /* Abort the rest of the I/O */