]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
nvme-cli/fabrics: Add keep-alive-tmo param to connect cmd
authorSteve Wise <swise@opengridcomputing.com>
Tue, 20 Sep 2016 15:01:54 +0000 (08:01 -0700)
committerKeith Busch <keith.busch@intel.com>
Thu, 22 Sep 2016 16:37:13 +0000 (12:37 -0400)
Added 'keep-alive-tmo' to 'connect' command so users can specify the
keep alive timeout period.

usage examples:

nvme connect --keep-alive-tmo=30 --transport=rdma --traddr=10.0.1.14 --nqn=test-nvme
nvme connect -k 30 -t rdma -a 10.0.1.14 -n test-nvme

Signed-off-by: Steve Wise <swise@opengridcomputing.com>
Reviewed-by: Jay Freyensee <james_p_freyensee at linux.intel.com>
fabrics.c

index 294fc52205e6911e2451f23cd3088397ef696e13..45257539fb4be880ae068457fcfe2869db64109e 100644 (file)
--- a/fabrics.c
+++ b/fabrics.c
@@ -51,6 +51,7 @@ struct config {
        char *trsvcid;
        char *hostnqn;
        char *nr_io_queues;
+       char *keep_alive_tmo;
        char *raw;
        char *device;
 } cfg = { 0 };
@@ -498,6 +499,14 @@ static int build_options(char *argstr, int max_len)
                max_len -= len;
        }
 
+       if (cfg.keep_alive_tmo) {
+               len = snprintf(argstr, max_len, ",keep_alive_tmo=%s", cfg.keep_alive_tmo);
+               if (len < 0)
+                       return -EINVAL;
+               argstr += len;
+               max_len -= len;
+       }
+
        return 0;
 }
 
@@ -739,6 +748,8 @@ int connect(const char *desc, int argc, char **argv)
                {"nr-io-queues", 'i', "LIST", CFG_STRING, &cfg.nr_io_queues,
                 required_argument,
                 "number of io queues to use (default is core count)" },
+               {"keep-alive-tmo", 'k', "LIST", CFG_STRING, &cfg.keep_alive_tmo, required_argument,
+                       "keep alive timeout period in seconds" },
                {0},
        };