[PATCH v2] fabrics: ensure zero kato for non-persistent controllers
George, Martin
Martin.George at netapp.com
Mon Mar 1 15:48:08 GMT 2021
Ping?
> Add a helper function that sets the default kato value for the
> controllers. Along with ensuring a non-zero kato value (i.e.
> NVMF_DEF_DISC_TMO) is passed to a persistent discovery controller,
> it also ensures a zero kato is passed to a non-persistent discovery
> controller.
>
> Signed-off-by: Martin George <marting at netapp.com>
> ---
> fabrics.c | 16 ++++++++++++----
> 1 file changed, 12 insertions(+), 4 deletions(-)
>
> diff --git a/fabrics.c b/fabrics.c
> index e38657e..c780040 100644
> --- a/fabrics.c
> +++ b/fabrics.c
> @@ -918,6 +918,16 @@ static int build_options(char *argstr, int
> max_len, bool discover)
> return 0;
> }
>
> +static void set_kato(struct config *cfg)
> +{
> + /* Set kato to NVMF_DEF_DISC_TMO for persistent discovery
> controllers */
> + if (cfg->persistent && !cfg->keep_alive_tmo)
> + cfg->keep_alive_tmo = NVMF_DEF_DISC_TMO;
> + /* Set kato to zero for non-persistent discovery controllers
> */
> + else if (!cfg->persistent && (cfg->keep_alive_tmo > 0))
> + cfg->keep_alive_tmo = 0;
> +}
> +
> static void discovery_trsvcid(struct config *cfg)
> {
> if (!strcmp(cfg->transport, "tcp")) {
> @@ -1401,8 +1411,7 @@ static int discover_from_conf_file(const char
> *desc, char *argstr,
> if (err)
> goto free_and_continue;
>
> - if (cfg.persistent && !cfg.keep_alive_tmo)
> - cfg.keep_alive_tmo = NVMF_DEF_DISC_TMO;
> + set_kato(&cfg);
>
> if (traddr_is_hostname(&cfg)) {
> ret = hostname2traddr(&cfg);
> @@ -1476,8 +1485,7 @@ int fabrics_discover(const char *desc, int
> argc, char **argv, bool connect)
> if (!cfg.transport && !cfg.traddr) {
> ret = discover_from_conf_file(desc, argstr, opts,
> connect);
> } else {
> - if (cfg.persistent && !cfg.keep_alive_tmo)
> - cfg.keep_alive_tmo = NVMF_DEF_DISC_TMO;
> + set_kato(&cfg);
>
> if (traddr_is_hostname(&cfg)) {
> ret = hostname2traddr(&cfg);
> --
> 2.30.0
>
More information about the Linux-nvme
mailing list