]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
nvme-cli/fabrics: Add ctrl-loss-tmo param to connect cmd
authorNitzan Carmi <nitzanc@mellanox.com>
Sun, 13 Aug 2017 15:45:04 +0000 (18:45 +0300)
committerKeith Busch <keith.busch@intel.com>
Mon, 14 Aug 2017 19:18:44 +0000 (15:18 -0400)
Added 'ctrl-loss-tmo' to 'connect' command so users can specify the
controller lost timeout period.

usage examples:
nvme connect --ctrl-loss-tmo=0 --transport=rdma --traddr=10.0.1.1 --nqn=test-nvme
nvme connect -l 0 -t rdma -a 10.0.1.1 -n test_nvme

Signed-off-by: Nitzan Carmi <nitzanc@mellanox.com>
Reviewed-by: Max Gurtovoy <maxg@mellanox.com>
Signed-off-by: Keith Busch <keith.busch@intel.com>
fabrics.c

index 9ed11274abd0d6e9167930f93f403334af2ff0fb..4871e1759ed01757eedad41bd698225ceabc6994 100644 (file)
--- a/fabrics.c
+++ b/fabrics.c
@@ -58,6 +58,7 @@ static struct config {
        char *queue_size;
        char *keep_alive_tmo;
        char *reconnect_delay;
+       char *ctrl_loss_tmo;
        char *raw;
        char *device;
 } cfg = { NULL };
@@ -585,6 +586,14 @@ static int build_options(char *argstr, int max_len)
                max_len -= len;
        }
 
+       if (cfg.ctrl_loss_tmo) {
+               len = snprintf(argstr, max_len, ",ctrl_loss_tmo=%s", cfg.ctrl_loss_tmo);
+               if (len < 0)
+                       return -EINVAL;
+               argstr += len;
+               max_len -= len;
+       }
+
        return 0;
 }
 
@@ -863,6 +872,7 @@ int connect(const char *desc, int argc, char **argv)
                {"queue-size",      'Q', "LIST", CFG_STRING, &cfg.queue_size,      required_argument, "number of io queue elements to use (default 128)" },
                {"keep-alive-tmo",  'k', "LIST", CFG_STRING, &cfg.keep_alive_tmo,  required_argument, "keep alive timeout period in seconds" },
                {"reconnect-delay", 'c', "LIST", CFG_STRING, &cfg.reconnect_delay, required_argument, "reconnect timeout period in seconds" },
+               {"ctrl-loss-tmo",   'l', "LIST", CFG_STRING, &cfg.ctrl_loss_tmo,   required_argument, "controller loss timeout period in seconds" },
                {NULL},
        };