From b6d6cd8e8181c98c9d1cf8e6a3aa8d9e74362061 Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Thu, 23 Feb 2017 09:24:58 -0700 Subject: [PATCH] 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: Daniel Verkamp --- include/spdk/nvme.h | 3 ++- lib/bdev/nvme/blockdev_nvme.c | 4 ++-- lib/nvme/nvme_pcie.c | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/spdk/nvme.h b/include/spdk/nvme.h index 9c920e469..d67c668b8 100644 --- a/include/spdk/nvme.h +++ b/include/spdk/nvme.h @@ -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. diff --git a/lib/bdev/nvme/blockdev_nvme.c b/lib/bdev/nvme/blockdev_nvme.c index 2246fe0e8..b7988bdf3 100644 --- a/lib/bdev/nvme/blockdev_nvme.c +++ b/lib/bdev/nvme/blockdev_nvme.c @@ -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) { diff --git a/lib/nvme/nvme_pcie.c b/lib/nvme/nvme_pcie.c index 7982fa1f8..1230d4d9d 100644 --- a/lib/nvme/nvme_pcie.c +++ b/lib/nvme/nvme_pcie.c @@ -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); } }