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 <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2017-02-23 09:24:58 -07:00
parent 6c067d0e9f
commit b6d6cd8e81
3 changed files with 5 additions and 4 deletions

View File

@ -388,7 +388,8 @@ struct spdk_nvme_qpair;
*/ */
typedef void (*spdk_nvme_timeout_cb)(void *cb_arg, typedef void (*spdk_nvme_timeout_cb)(void *cb_arg,
struct spdk_nvme_ctrlr *ctrlr, 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. * \brief Register for timeout callback on a controller.

View File

@ -503,11 +503,11 @@ probe_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
static void static void
blockdev_nvme_timeout_cb(void *cb_arg, struct spdk_nvme_ctrlr *ctrlr, 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; 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); rc = spdk_nvme_ctrlr_reset(ctrlr);
if (rc) { if (rc) {

View File

@ -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. * Request has timed out. This could be i/o or admin request.
* Call the registered timeout function for user to take action. * 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);
} }
} }