diff options
author | jimharris <jimharris@FreeBSD.org> | 2013-03-26 18:23:35 +0000 |
---|---|---|
committer | jimharris <jimharris@FreeBSD.org> | 2013-03-26 18:23:35 +0000 |
commit | 34e3d4c73e2de964686848587d24876fa9299321 (patch) | |
tree | 43a4a97ce3faa5f715c203c7c8c2f92b8874631e | |
parent | 1ba7ad0dee259570e2b2e97e68b3408f481a82b1 (diff) | |
download | FreeBSD-src-34e3d4c73e2de964686848587d24876fa9299321.zip FreeBSD-src-34e3d4c73e2de964686848587d24876fa9299321.tar.gz |
Add support for ABORT commands, including issuing these commands when
an I/O times out.
Also ensure that we retry commands that are aborted due to a timeout.
Sponsored by: Intel
-rw-r--r-- | sys/dev/nvme/nvme_ctrlr_cmd.c | 16 | ||||
-rw-r--r-- | sys/dev/nvme/nvme_private.h | 2 | ||||
-rw-r--r-- | sys/dev/nvme/nvme_qpair.c | 11 |
3 files changed, 24 insertions, 5 deletions
diff --git a/sys/dev/nvme/nvme_ctrlr_cmd.c b/sys/dev/nvme/nvme_ctrlr_cmd.c index 225d12be..f41e1eb 100644 --- a/sys/dev/nvme/nvme_ctrlr_cmd.c +++ b/sys/dev/nvme/nvme_ctrlr_cmd.c @@ -281,3 +281,19 @@ nvme_ctrlr_cmd_get_health_information_page(struct nvme_controller *ctrlr, nvme_ctrlr_submit_admin_request(ctrlr, req); } + +void +nvme_ctrlr_cmd_abort(struct nvme_controller *ctrlr, uint16_t cid, + uint16_t sqid, nvme_cb_fn_t cb_fn, void *cb_arg) +{ + struct nvme_request *req; + struct nvme_command *cmd; + + req = nvme_allocate_request(NULL, 0, cb_fn, cb_arg); + + cmd = &req->cmd; + cmd->opc = NVME_OPC_ABORT; + cmd->cdw10 = (cid << 16) | sqid; + + nvme_ctrlr_submit_admin_request(ctrlr, req); +} diff --git a/sys/dev/nvme/nvme_private.h b/sys/dev/nvme/nvme_private.h index a74b876..69024ba 100644 --- a/sys/dev/nvme/nvme_private.h +++ b/sys/dev/nvme/nvme_private.h @@ -348,6 +348,8 @@ void nvme_ctrlr_cmd_set_asynchronous_event_config(struct nvme_controller *ctrlr, void nvme_ctrlr_cmd_asynchronous_event_request(struct nvme_controller *ctrlr, nvme_cb_fn_t cb_fn, void *cb_arg); +void nvme_ctrlr_cmd_abort(struct nvme_controller *ctrlr, uint16_t cid, + uint16_t sqid, nvme_cb_fn_t cb_fn, void *cb_arg); void nvme_payload_map(void *arg, bus_dma_segment_t *seg, int nseg, int error); diff --git a/sys/dev/nvme/nvme_qpair.c b/sys/dev/nvme/nvme_qpair.c index 7fafb7c..6954830 100644 --- a/sys/dev/nvme/nvme_qpair.c +++ b/sys/dev/nvme/nvme_qpair.c @@ -49,6 +49,8 @@ nvme_completion_check_retry(const struct nvme_completion *cpl) switch (cpl->sf_sct) { case NVME_SCT_GENERIC: switch (cpl->sf_sc) { + case NVME_SC_ABORTED_BY_REQUEST: + return (1); case NVME_SC_NAMESPACE_NOT_READY: if (cpl->sf_dnr) return (0); @@ -60,7 +62,6 @@ nvme_completion_check_retry(const struct nvme_completion *cpl) case NVME_SC_DATA_TRANSFER_ERROR: case NVME_SC_ABORTED_POWER_LOSS: case NVME_SC_INTERNAL_DEVICE_ERROR: - case NVME_SC_ABORTED_BY_REQUEST: case NVME_SC_ABORTED_SQ_DELETION: case NVME_SC_ABORTED_FAILED_FUSED: case NVME_SC_ABORTED_MISSING_FUSED: @@ -378,10 +379,10 @@ nvme_io_qpair_destroy(struct nvme_qpair *qpair) static void nvme_timeout(void *arg) { - /* - * TODO: Add explicit abort operation here, once nvme(4) supports - * abort commands. - */ + struct nvme_tracker *tr = arg; + + nvme_ctrlr_cmd_abort(tr->qpair->ctrlr, tr->cid, tr->qpair->id, + NULL, NULL); } void |