]> www.infradead.org Git - users/hch/nvme-cli.git/commitdiff
nvme-cli: fabrics: Fix passing "host_traddr" for all transports
authorMax Gurtovoy <maxg@mellanox.com>
Thu, 8 Mar 2018 17:38:16 +0000 (19:38 +0200)
committerKeith Busch <keith.busch@intel.com>
Thu, 8 Mar 2018 17:48:46 +0000 (10:48 -0700)
Currently only FC transport passes "host_traddr" to the kernel during
nvme connect-all command. Fix it for all transports.

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

index 4bdaaf22eeac761b6005b1053691a2a5ac60ad48..774d5dc90075666d9fda2ef0a88e389bc01268c3 100644 (file)
--- a/fabrics.c
+++ b/fabrics.c
@@ -614,6 +614,14 @@ static int connect_ctrl(struct nvmf_disc_rsp_page_entry *e)
                p += len;
        }
 
+       if (cfg.host_traddr) {
+               len = sprintf(p, ",host_traddr=%s", cfg.host_traddr);
+               if (len < 0)
+                       return -EINVAL;
+               p+= len;
+       }
+
+
        switch (e->trtype) {
        case NVMF_TRTYPE_LOOP: /* loop */
                len = sprintf(p, ",transport=loop");
@@ -659,11 +667,6 @@ static int connect_ctrl(struct nvmf_disc_rsp_page_entry *e)
                                return -EINVAL;
                        p += len;
 
-                       len = sprintf(p, ",host_traddr=%s", cfg.host_traddr);
-                       if (len < 0)
-                               return -EINVAL;
-                       p+= len;
-
                        len = sprintf(p, ",traddr=%.*s",
                                      space_strip_len(NVMF_TRADDR_SIZE, e->traddr),
                                      e->traddr);