Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177570531
D61561.1794767808.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
D61561.1794767808.diff
View Options
diff --git a/sys/dev/nvmf/controller/nvmft_controller.c b/sys/dev/nvmf/controller/nvmft_controller.c
--- a/sys/dev/nvmf/controller/nvmft_controller.c
+++ b/sys/dev/nvmf/controller/nvmft_controller.c
@@ -119,6 +119,27 @@
}
}
+static void
+nvmft_set_kato(struct nvmft_controller *ctrlr, uint32_t kato)
+{
+ /*
+ * The TCP transport spec requires a non-zero KeepAlive timer,
+ * but allow a zero KATO value to match Linux.
+ */
+ if (kato == 0) {
+ callout_stop(&ctrlr->ka_timer);
+ ctrlr->ka_sbt = 0;
+ } else {
+ /*
+ * Round up to 1 second matching granularity
+ * advertised in cdata.
+ */
+ ctrlr->ka_sbt = mstosbt(roundup(kato, 1000));
+ callout_reset_sbt(&ctrlr->ka_timer, ctrlr->ka_sbt, 0,
+ nvmft_keep_alive_timer, ctrlr, C_HARDCLOCK);
+ }
+}
+
int
nvmft_handoff_admin_queue(struct nvmft_port *np, enum nvmf_trtype trtype,
const nvlist_t *params, const struct nvmf_fabric_connect_cmd *cmd,
@@ -126,7 +147,6 @@
{
struct nvmft_controller *ctrlr;
struct nvmft_qpair *qp;
- uint32_t kato;
int cntlid;
if (cmd->qid != htole16(0))
@@ -179,21 +199,7 @@
ctrlr->admin = qp;
ctrlr->trtype = trtype;
nvmft_update_cdata(ctrlr);
-
- /*
- * The spec requires a non-zero KeepAlive timer, but allow a
- * zero KATO value to match Linux.
- */
- kato = le32toh(cmd->kato);
- if (kato != 0) {
- /*
- * Round up to 1 second matching granularity
- * advertised in cdata.
- */
- ctrlr->ka_sbt = mstosbt(roundup(kato, 1000));
- callout_reset_sbt(&ctrlr->ka_timer, ctrlr->ka_sbt, 0,
- nvmft_keep_alive_timer, ctrlr, C_HARDCLOCK);
- }
+ nvmft_set_kato(ctrlr, le32toh(cmd->kato));
ctrlr->pending_connects++;
mtx_unlock(&ctrlr->lock);
@@ -884,6 +890,16 @@
nvmf_free_capsule(nc);
return;
}
+ case NVME_FEAT_KEEP_ALIVE_TIMER:
+ if (cmd->nsid != htole32(0))
+ goto not_ns_specifc;
+
+ mtx_lock(&ctrlr->lock);
+ nvmft_set_kato(ctrlr, le32toh(cmd->cdw11));
+ mtx_unlock(&ctrlr->lock);
+ nvmft_send_success(ctrlr->admin, nc);
+ nvmf_free_capsule(nc);
+ return;
default:
nvmft_printf(ctrlr,
"Unsupported feature ID %u for SET_FEATURES\n", fid);
@@ -949,6 +965,15 @@
nvmft_send_response(ctrlr->admin, &cqe);
nvmf_free_capsule(nc);
return;
+ case NVME_FEAT_KEEP_ALIVE_TIMER:
+ if (cmd->nsid != htole32(0))
+ goto not_ns_specifc;
+
+ nvmft_init_cqe(&cqe, nc, 0);
+ cqe.cdw0 = htole32(sbttoms(ctrlr->ka_sbt));
+ nvmft_send_response(ctrlr->admin, &cqe);
+ nvmf_free_capsule(nc);
+ return;
default:
nvmft_printf(ctrlr,
"Unsupported feature ID %u for GET_FEATURES\n", fid);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 15, 6:36 PM (23 h, 40 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41746174
Default Alt Text
D61561.1794767808.diff (2 KB)
Attached To
Mode
D61561: nvmft: Allow the keep alive timer to be managed as a feature
Attached
Detach File
Event Timeline