Date: Tue, 26 Mar 2013 18:23:35 +0000 (UTC) From: Jim Harris <jimharris@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248732 - head/sys/dev/nvme Message-ID: <201303261823.r2QINZ0B060695@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jimharris Date: Tue Mar 26 18:23:35 2013 New Revision: 248732 URL: http://svnweb.freebsd.org/changeset/base/248732 Log: 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 Modified: head/sys/dev/nvme/nvme_ctrlr_cmd.c head/sys/dev/nvme/nvme_private.h head/sys/dev/nvme/nvme_qpair.c Modified: head/sys/dev/nvme/nvme_ctrlr_cmd.c ============================================================================== --- head/sys/dev/nvme/nvme_ctrlr_cmd.c Tue Mar 26 18:20:11 2013 (r248731) +++ head/sys/dev/nvme/nvme_ctrlr_cmd.c Tue Mar 26 18:23:35 2013 (r248732) @@ -281,3 +281,19 @@ nvme_ctrlr_cmd_get_health_information_pa 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); +} Modified: head/sys/dev/nvme/nvme_private.h ============================================================================== --- head/sys/dev/nvme/nvme_private.h Tue Mar 26 18:20:11 2013 (r248731) +++ head/sys/dev/nvme/nvme_private.h Tue Mar 26 18:23:35 2013 (r248732) @@ -348,6 +348,8 @@ void nvme_ctrlr_cmd_set_asynchronous_eve 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); Modified: head/sys/dev/nvme/nvme_qpair.c ============================================================================== --- head/sys/dev/nvme/nvme_qpair.c Tue Mar 26 18:20:11 2013 (r248731) +++ head/sys/dev/nvme/nvme_qpair.c Tue Mar 26 18:23:35 2013 (r248732) @@ -49,6 +49,8 @@ nvme_completion_check_retry(const struct 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 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 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201303261823.r2QINZ0B060695>