Page MenuHomeFreeBSD

D61853.1795409982.diff
No OneTemporary

Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None

D61853.1795409982.diff

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,16 @@
}
}
+static sbintime_t
+nvmft_kato_sbt(uint32_t kato)
+{
+ /*
+ * Round up to 1 second matching granularity advertised in
+ * cdata.
+ */
+ return (mstosbt(roundup(kato, 1000)));
+}
+
static void
nvmft_set_kato(struct nvmft_controller *ctrlr, uint32_t kato)
{
@@ -130,11 +140,7 @@
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));
+ ctrlr->ka_sbt = nvmft_kato_sbt(kato);
callout_reset_sbt(&ctrlr->ka_timer, ctrlr->ka_sbt, 0,
nvmft_keep_alive_timer, ctrlr, C_HARDCLOCK);
}
@@ -397,6 +403,9 @@
mtx_lock(&ctrlr->lock);
ctrlr->num_io_queues = 0;
+ if (ctrlr->ka_sbt != 0)
+ ctrlr->ka_sbt = nvmft_kato_sbt(NVMF_KATO_DEFAULT);
+
/* Mark shutdown complete. */
if (NVMEV(NVME_CSTS_REG_SHST, ctrlr->csts) == NVME_SHST_OCCURRING) {
ctrlr->csts &= ~NVMEM(NVME_CSTS_REG_SHST);
diff --git a/tests/sys/cam/ctl/nvmft/nvmft.c b/tests/sys/cam/ctl/nvmft/nvmft.c
--- a/tests/sys/cam/ctl/nvmft/nvmft.c
+++ b/tests/sys/cam/ctl/nvmft/nvmft.c
@@ -1592,6 +1592,7 @@
uint8_t hostid[16];
useconds_t delay;
uint32_t kato, kato_after;
+ uint16_t status;
int error;
init_hostid(hostid, hostnqn);
@@ -1613,14 +1614,20 @@
kato = get_simple_feature(admin, NVME_FEAT_KEEP_ALIVE_TIMER);
ATF_REQUIRE(kato >= 100);
- /* Shutdown and wait for the shutdown to complete. */
+ /* Shut down and wait for the shutdown to complete. */
shutdown_controller(admin);
wait_for_shutdown(admin);
/* Re-enable the controller. */
enable_controller(admin);
- /* Verify the KATO is the same. */
+ /* Verify the KATO has been reset to the default. */
+ kato_after = get_simple_feature(admin, NVME_FEAT_KEEP_ALIVE_TIMER);
+ ATF_REQUIRE(kato_after >= NVMF_KATO_DEFAULT);
+
+ /* Reset back to the original timeout. */
+ status = set_simple_feature(admin, NVME_FEAT_KEEP_ALIVE_TIMER, kato);
+ ATF_REQUIRE(status == 0);
kato_after = get_simple_feature(admin, NVME_FEAT_KEEP_ALIVE_TIMER);
ATF_REQUIRE(kato == kato_after);

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 23, 4:59 AM (14 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41923262
Default Alt Text
D61853.1795409982.diff (2 KB)

Event Timeline