svn commit: r248735 - head/sys/dev/nvme
Jim Harris
jimharris at FreeBSD.org
Tue Mar 26 18:31:48 UTC 2013
Author: jimharris
Date: Tue Mar 26 18:31:46 2013
New Revision: 248735
URL: http://svnweb.freebsd.org/changeset/base/248735
Log:
Specify command timeout interval on a per-command type basis.
This is primarily driven by the need to disable timeouts for asynchronous
event requests, which by nature should not be timed out.
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:29:04 2013 (r248734)
+++ head/sys/dev/nvme/nvme_ctrlr_cmd.c Tue Mar 26 18:31:46 2013 (r248735)
@@ -257,6 +257,12 @@ nvme_ctrlr_cmd_asynchronous_event_reques
req = nvme_allocate_request(NULL, 0, cb_fn, cb_arg);
+ /*
+ * Override default timeout value here, since asynchronous event
+ * requests should by nature never be timed out.
+ */
+ req->timeout = 0;
+
cmd = &req->cmd;
cmd->opc = NVME_OPC_ASYNC_EVENT_REQUEST;
Modified: head/sys/dev/nvme/nvme_private.h
==============================================================================
--- head/sys/dev/nvme/nvme_private.h Tue Mar 26 18:29:04 2013 (r248734)
+++ head/sys/dev/nvme/nvme_private.h Tue Mar 26 18:31:46 2013 (r248735)
@@ -112,6 +112,7 @@ struct nvme_request {
struct nvme_command cmd;
void *payload;
uint32_t payload_size;
+ uint32_t timeout;
struct uio *uio;
nvme_cb_fn_t cb_fn;
void *cb_arg;
@@ -411,6 +412,7 @@ nvme_allocate_request(void *payload, uin
req->payload_size = payload_size;
req->cb_fn = cb_fn;
req->cb_arg = cb_arg;
+ req->timeout = NVME_TIMEOUT_IN_SEC;
return (req);
}
@@ -427,6 +429,7 @@ nvme_allocate_request_uio(struct uio *ui
req->uio = uio;
req->cb_fn = cb_fn;
req->cb_arg = cb_arg;
+ req->timeout = NVME_TIMEOUT_IN_SEC;
return (req);
}
Modified: head/sys/dev/nvme/nvme_qpair.c
==============================================================================
--- head/sys/dev/nvme/nvme_qpair.c Tue Mar 26 18:29:04 2013 (r248734)
+++ head/sys/dev/nvme/nvme_qpair.c Tue Mar 26 18:31:46 2013 (r248735)
@@ -438,11 +438,12 @@ nvme_qpair_submit_cmd(struct nvme_qpair
req->cmd.cid = tr->cid;
qpair->act_tr[tr->cid] = tr;
+ if (req->timeout > 0)
#if __FreeBSD_version >= 800030
- callout_reset_curcpu(&tr->timer, NVME_TIMEOUT_IN_SEC * hz,
- nvme_timeout, tr);
+ callout_reset_curcpu(&tr->timer, req->timeout * hz,
+ nvme_timeout, tr);
#else
- callout_reset(&tr->timer, NVME_TIMEOUT_IN_SEC * hz, nvme_timeout, tr);
+ callout_reset(&tr->timer, req->timeout * hz, nvme_timeout, tr);
#endif
/* Copy the command from the tracker to the submission queue. */
More information about the svn-src-all
mailing list