[PATCH 1/2] nvme: sanitize KATO setting
Sagi Grimberg
sagi at grimberg.me
Mon Mar 15 17:23:23 GMT 2021
On 3/11/21 2:55 AM, Christoph Hellwig wrote:
>> +/*
>> + * 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.
More information about the Linux-nvme
mailing list