linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Hannes Reinecke <hare@suse.de>
Cc: Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>,
	Keith Busch <keith.busch@wdc.com>,
	linux-nvme@lists.infradead.org
Subject: Re: [PATCH 1/2] nvme: sanitize KATO setting
Date: Thu, 11 Mar 2021 11:55:32 +0100	[thread overview]
Message-ID: <20210311105532.GA16515@lst.de> (raw)
In-Reply-To: <20210311103727.47381-2-hare@suse.de>

> +/*
> + * 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.

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

  reply	other threads:[~2021-03-11 10:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-11 10:37 [PATCHv3 0/2] nvme: sanitize KATO setting Hannes Reinecke
2021-03-11 10:37 ` [PATCH 1/2] " Hannes Reinecke
2021-03-11 10:55   ` Christoph Hellwig [this message]
2021-03-15 17:23     ` Sagi Grimberg
2021-03-11 10:37 ` [PATCH 2/2] nvme: add 'kato' sysfs attribute Hannes Reinecke
2021-03-15 17:22   ` Sagi Grimberg
2021-04-16 11:46 [PATCHv4 0/2] nvme: sanitize KATO setting Hannes Reinecke
2021-04-16 11:46 ` [PATCH 1/2] " Hannes Reinecke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210311105532.GA16515@lst.de \
    --to=hch@lst.de \
    --cc=hare@suse.de \
    --cc=keith.busch@wdc.com \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).