Re: [PATCH 1/2] nvme: sanitize KATO setting
From: Sagi Grimberg <sagi@grimberg.me>
Date: 2021-03-15 17:24:07
On 3/11/21 2:55 AM, Christoph Hellwig wrote:
quoted
+/* + * Recommended frequency for KATO commands + * + * NVMe 1.4 section 7.12.1 states: + * The host should send Keep Alive commands at half of the + * Keep Alive Timeout accounting for transport roundtrip times [..]. + */ +#define NVME_KATO_DELAY(k) (((k) > 1)?(k) >> 1:(k))This should have been an inline if added at all, and use proper formatting, as well as avoiding the shift obsfucation. I think the best is to just move this into the only caller, where we also know that ctrl->kato can't be 0 due to the check in nvme_start_keep_alive: /* * Recommended frequency for KATO commands per NVMe 1.4 section 7.12.1: * * The host should send Keep Alive commands at half of the * Keep Alive Timeout accounting for transport roundtrip times [..]. */ static inline void nvme_queue_keep_alive_work(struct nvme_ctrl *ctrl) { queue_delayed_work(nvme_wq, &ctrl->ka_work, ctrl->kato * HZ / 2); } Also please keep this helper inside of core.c.
Agreed. _______________________________________________ Linux-nvme mailing list Linux-nvme@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-nvme