nvme: make response callback after moving completion queue head

For some cases, especially for Admin commands, there maybe has
recursive commands, e.g.: in AER callback we may send a new AER
request, in such case, the current code can't process such
case.  While here, move the completion queue head to next before
any response callback will fix such issue.

Change-Id: Ide56701d94615881790cf025ede2f07420b9b16e
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/412766
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Changpeng Liu 2018-05-30 01:20:25 +08:00 committed by Daniel Verkamp
parent 57d93c9ecb
commit 266f37a5a0

View File

@ -2059,6 +2059,11 @@ nvme_pcie_qpair_process_completions(struct spdk_nvme_qpair *qpair, uint32_t max_
spdk_mb();
#endif
if (spdk_unlikely(++pqpair->cq_head == pqpair->num_entries)) {
pqpair->cq_head = 0;
pqpair->phase = !pqpair->phase;
}
tr = &pqpair->tr[cpl->cid];
pqpair->sq_head = cpl->sqhd;
@ -2070,11 +2075,6 @@ nvme_pcie_qpair_process_completions(struct spdk_nvme_qpair *qpair, uint32_t max_
assert(0);
}
if (spdk_unlikely(++pqpair->cq_head == pqpair->num_entries)) {
pqpair->cq_head = 0;
pqpair->phase = !pqpair->phase;
}
if (++num_completions == max_completions) {
break;
}