Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F172601351
D59828.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D59828.diff
View Options
diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c
--- a/sys/dev/nvme/nvme_ctrlr.c
+++ b/sys/dev/nvme/nvme_ctrlr.c
@@ -786,7 +786,7 @@
* Disable timeout here, since asynchronous event requests should by
* nature never be timed out.
*/
- req->timeout = false;
+ req->timeout_ms = NVME_TIMEOUT_NONE;
req->cmd.opc = NVME_OPC_ASYNC_EVENT_REQUEST;
nvme_ctrlr_submit_admin_request(ctrlr, req);
}
diff --git a/sys/dev/nvme/nvme_private.h b/sys/dev/nvme/nvme_private.h
--- a/sys/dev/nvme/nvme_private.h
+++ b/sys/dev/nvme/nvme_private.h
@@ -85,6 +85,9 @@
#define NVME_MAX_TIMEOUT_PERIOD (120)
#define NVME_MAX_FORMAT_TIMEOUT_PERIOD (60 * 60)
+#define NVME_TIMEOUT_DEFAULT 0U
+#define NVME_TIMEOUT_NONE UINT32_MAX
+
#define NVME_DEFAULT_RETRY_COUNT (4)
/* Maximum log page size to fetch for AERs. */
@@ -114,12 +117,11 @@
struct memdesc payload;
nvme_cb_fn_t cb_fn;
void *cb_arg;
+ uint32_t timeout_ms;
int16_t retries;
uint16_t ioq;
#define NVME_IOQ_DEFAULT 0xffff
bool payload_valid;
- bool timeout;
- bool spare[2]; /* Future use */
STAILQ_ENTRY(nvme_request) stailq;
};
@@ -533,7 +535,7 @@
req->ioq = NVME_IOQ_DEFAULT;
req->cb_fn = cb_fn;
req->cb_arg = cb_arg;
- req->timeout = true;
+ req->timeout_ms = NVME_TIMEOUT_DEFAULT;
}
return (req);
}
diff --git a/sys/dev/nvme/nvme_qpair.c b/sys/dev/nvme/nvme_qpair.c
--- a/sys/dev/nvme/nvme_qpair.c
+++ b/sys/dev/nvme/nvme_qpair.c
@@ -1048,7 +1048,7 @@
{
struct nvme_request *req;
struct nvme_controller *ctrlr;
- int timeout;
+ uint32_t timeout_ms;
mtx_assert(&qpair->lock, MA_OWNED);
@@ -1056,14 +1056,19 @@
qpair->act_tr[tr->cid] = tr;
ctrlr = qpair->ctrlr;
- if (req->timeout) {
+ if (req->timeout_ms != NVME_TIMEOUT_NONE) {
if (req->cb_fn == nvme_completion_poll_cb)
- timeout = 1;
+ timeout_ms = 1000;
+ else if (req->timeout_ms != NVME_TIMEOUT_DEFAULT)
+ timeout_ms = req->timeout_ms;
+ else if (qpair->id == 0 && req->cmd.opc == NVME_OPC_FORMAT_NVM)
+ timeout_ms = ctrlr->format_timeout_period * 1000;
else if (qpair->id == 0)
- timeout = ctrlr->admin_timeout_period;
+ timeout_ms = ctrlr->admin_timeout_period * 1000;
else
- timeout = ctrlr->timeout_period;
- tr->deadline = getsbinuptime() + timeout * SBT_1S;
+ timeout_ms = ctrlr->timeout_period * 1000;
+ tr->deadline = getsbinuptime() +
+ (sbintime_t)timeout_ms * SBT_1MS;
if (!qpair->timer_armed) {
qpair->timer_armed = true;
callout_reset_sbt_on(&qpair->timer, SBT_1S / 2, SBT_1S / 2,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Sep 20, 2:49 PM (18 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
39295741
Default Alt Text
D59828.diff (2 KB)
Attached To
Mode
D59828: nvme: support per-request timeouts
Attached
Detach File
Event Timeline
Log In to Comment