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
This commit is contained in:
parent
b4217411fa
commit
6162f3ce10
@ -257,6 +257,12 @@ nvme_ctrlr_cmd_asynchronous_event_request(struct nvme_controller *ctrlr,
|
||||
|
||||
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;
|
||||
|
||||
|
@ -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, uint32_t payload_size, nvme_cb_fn_t cb_fn,
|
||||
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 *uio, nvme_cb_fn_t cb_fn, void *cb_arg)
|
||||
req->uio = uio;
|
||||
req->cb_fn = cb_fn;
|
||||
req->cb_arg = cb_arg;
|
||||
req->timeout = NVME_TIMEOUT_IN_SEC;
|
||||
|
||||
return (req);
|
||||
}
|
||||
|
@ -438,11 +438,12 @@ nvme_qpair_submit_cmd(struct nvme_qpair *qpair, struct nvme_tracker *tr)
|
||||
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. */
|
||||
|
Loading…
x
Reference in New Issue
Block a user