Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/nvme/nvme_qpair.c
Show First 20 Lines • Show All 618 Lines • ▼ Show 20 Lines | bus_dmamap_sync(qpair->dma_tag, qpair->queuemem_map, | ||||
BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); | BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); | ||||
cpl = qpair->cpl[qpair->cq_head]; | cpl = qpair->cpl[qpair->cq_head]; | ||||
nvme_completion_swapbytes(&cpl); | nvme_completion_swapbytes(&cpl); | ||||
KASSERT( | KASSERT( | ||||
NVME_STATUS_GET_P(status) == NVME_STATUS_GET_P(cpl.status), | NVME_STATUS_GET_P(status) == NVME_STATUS_GET_P(cpl.status), | ||||
("Phase unexpectedly inconsistent")); | ("Phase unexpectedly inconsistent")); | ||||
if (cpl.cid < qpair->num_trackers) | |||||
tr = qpair->act_tr[cpl.cid]; | tr = qpair->act_tr[cpl.cid]; | ||||
else | |||||
tr = NULL; | |||||
if (tr != NULL) { | if (tr != NULL) { | ||||
nvme_qpair_complete_tracker(tr, &cpl, ERROR_PRINT_ALL); | nvme_qpair_complete_tracker(tr, &cpl, ERROR_PRINT_ALL); | ||||
qpair->sq_head = cpl.sqhd; | qpair->sq_head = cpl.sqhd; | ||||
done++; | done++; | ||||
} else if (!in_panic) { | } else if (!in_panic) { | ||||
/* | /* | ||||
* A missing tracker is normally an error. However, a | * A missing tracker is normally an error. However, a | ||||
* panic can stop the CPU this routine is running on | * panic can stop the CPU this routine is running on | ||||
* after completing an I/O but before updating | * after completing an I/O but before updating | ||||
* qpair->cq_head at 1 below. Later, we re-enter this | * qpair->cq_head at 1 below. Later, we re-enter this | ||||
* routine to poll I/O associated with the kernel | * routine to poll I/O associated with the kernel | ||||
* dump. We find that the tr has been set to null before | * dump. We find that the tr has been set to null before | ||||
* calling the completion routine. If it hasn't | * calling the completion routine. If it hasn't | ||||
* completed (or it triggers a panic), then '1' below | * completed (or it triggers a panic), then '1' below | ||||
* won't have updated cq_head. Rather than panic again, | * won't have updated cq_head. Rather than panic again, | ||||
* ignore this condition because it's not unexpected. | * ignore this condition because it's not unexpected. | ||||
*/ | */ | ||||
nvme_printf(qpair->ctrlr, | nvme_printf(qpair->ctrlr, | ||||
"cpl does not map to outstanding cmd\n"); | "cpl (cid = %u) does not map to outstanding cmd\n", | ||||
cpl.cid); | |||||
/* nvme_dump_completion expects device endianess */ | /* nvme_dump_completion expects device endianess */ | ||||
nvme_dump_completion(&qpair->cpl[qpair->cq_head]); | nvme_dump_completion(&qpair->cpl[qpair->cq_head]); | ||||
KASSERT(0, ("received completion for unknown cmd")); | KASSERT(0, ("received completion for unknown cmd")); | ||||
} | } | ||||
/* | /* | ||||
* There's a number of races with the following (see above) when | * There's a number of races with the following (see above) when | ||||
* the system panics. We compensate for each one of them by | * the system panics. We compensate for each one of them by | ||||
▲ Show 20 Lines • Show All 728 Lines • Show Last 20 Lines |