Commit b6d6cd8e authored by Daniel Verkamp's avatar Daniel Verkamp
Browse files

nvme: pass command ID to timeout callback



This can be used for issuing an abort for the timed-out command.

Change-Id: I3c5727fdddc156cd7c8f99afbc3e6da8e73bba56
Signed-off-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent 6c067d0e
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -388,7 +388,8 @@ struct spdk_nvme_qpair;
 */
typedef void (*spdk_nvme_timeout_cb)(void *cb_arg,
				     struct spdk_nvme_ctrlr *ctrlr,
				     struct spdk_nvme_qpair *qpair);
				     struct spdk_nvme_qpair *qpair,
				     uint16_t cid);

/**
 * \brief Register for timeout callback on a controller.
+2 −2
Original line number Diff line number Diff line
@@ -503,11 +503,11 @@ probe_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,

static void
blockdev_nvme_timeout_cb(void *cb_arg, struct spdk_nvme_ctrlr *ctrlr,
			 struct spdk_nvme_qpair *qpair)
			 struct spdk_nvme_qpair *qpair, uint16_t cid)
{
	int rc;

	SPDK_WARNLOG("Warning: Detected a timeout. ctrlr=%p qpair=%p\n", ctrlr, qpair);
	SPDK_WARNLOG("Warning: Detected a timeout. ctrlr=%p qpair=%p cid=%u\n", ctrlr, qpair, cid);

	rc = spdk_nvme_ctrlr_reset(ctrlr);
	if (rc) {
+1 −1
Original line number Diff line number Diff line
@@ -1841,7 +1841,7 @@ nvme_pcie_qpair_check_timeout(struct spdk_nvme_qpair *qpair)
		 * Request has timed out. This could be i/o or admin request.
		 * Call the registered timeout function for user to take action.
		 */
		ctrlr->timeout_cb_fn(ctrlr->timeout_cb_arg, ctrlr, qpair);
		ctrlr->timeout_cb_fn(ctrlr->timeout_cb_arg, ctrlr, qpair, tr->cid);
	}
}