Commit 478bcb93 authored by James Smart's avatar James Smart Committed by Sagi Grimberg

nvme-fabrics: Add host_traddr options field to host infrastructure

Add the host_traddr field to allow specification of the host-port
connection info for the transport. Will be used by FC transport.
Signed-off-by: default avatarJames Smart <james.smart@broadcom.com>
Acked-by: default avatarJohannes Thumshirn <jth@kernel.org>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarSagi Grimberg <sagi@grimberg.me>
parent 4a9f05c5
...@@ -116,6 +116,9 @@ int nvmf_get_address(struct nvme_ctrl *ctrl, char *buf, int size) ...@@ -116,6 +116,9 @@ int nvmf_get_address(struct nvme_ctrl *ctrl, char *buf, int size)
if (ctrl->opts->mask & NVMF_OPT_TRSVCID) if (ctrl->opts->mask & NVMF_OPT_TRSVCID)
len += snprintf(buf + len, size - len, "%strsvcid=%s", len += snprintf(buf + len, size - len, "%strsvcid=%s",
(len) ? "," : "", ctrl->opts->trsvcid); (len) ? "," : "", ctrl->opts->trsvcid);
if (ctrl->opts->mask & NVMF_OPT_HOST_TRADDR)
len += snprintf(buf + len, size - len, "%shost_traddr=%s",
(len) ? "," : "", ctrl->opts->host_traddr);
len += snprintf(buf + len, size - len, "\n"); len += snprintf(buf + len, size - len, "\n");
return len; return len;
...@@ -518,6 +521,7 @@ static const match_table_t opt_tokens = { ...@@ -518,6 +521,7 @@ static const match_table_t opt_tokens = {
{ NVMF_OPT_RECONNECT_DELAY, "reconnect_delay=%d" }, { NVMF_OPT_RECONNECT_DELAY, "reconnect_delay=%d" },
{ NVMF_OPT_KATO, "keep_alive_tmo=%d" }, { NVMF_OPT_KATO, "keep_alive_tmo=%d" },
{ NVMF_OPT_HOSTNQN, "hostnqn=%s" }, { NVMF_OPT_HOSTNQN, "hostnqn=%s" },
{ NVMF_OPT_HOST_TRADDR, "host_traddr=%s" },
{ NVMF_OPT_ERR, NULL } { NVMF_OPT_ERR, NULL }
}; };
...@@ -674,6 +678,14 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts, ...@@ -674,6 +678,14 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts,
} }
opts->reconnect_delay = token; opts->reconnect_delay = token;
break; break;
case NVMF_OPT_HOST_TRADDR:
p = match_strdup(args);
if (!p) {
ret = -ENOMEM;
goto out;
}
opts->host_traddr = p;
break;
default: default:
pr_warn("unknown parameter or missing value '%s' in ctrl creation request\n", pr_warn("unknown parameter or missing value '%s' in ctrl creation request\n",
p); p);
...@@ -740,6 +752,7 @@ void nvmf_free_options(struct nvmf_ctrl_options *opts) ...@@ -740,6 +752,7 @@ void nvmf_free_options(struct nvmf_ctrl_options *opts)
kfree(opts->traddr); kfree(opts->traddr);
kfree(opts->trsvcid); kfree(opts->trsvcid);
kfree(opts->subsysnqn); kfree(opts->subsysnqn);
kfree(opts->host_traddr);
kfree(opts); kfree(opts);
} }
EXPORT_SYMBOL_GPL(nvmf_free_options); EXPORT_SYMBOL_GPL(nvmf_free_options);
......
...@@ -52,6 +52,7 @@ enum { ...@@ -52,6 +52,7 @@ enum {
NVMF_OPT_KATO = 1 << 7, NVMF_OPT_KATO = 1 << 7,
NVMF_OPT_HOSTNQN = 1 << 8, NVMF_OPT_HOSTNQN = 1 << 8,
NVMF_OPT_RECONNECT_DELAY = 1 << 9, NVMF_OPT_RECONNECT_DELAY = 1 << 9,
NVMF_OPT_HOST_TRADDR = 1 << 10,
}; };
/** /**
...@@ -68,6 +69,8 @@ enum { ...@@ -68,6 +69,8 @@ enum {
* subsystem which is adding a controller. * subsystem which is adding a controller.
* @trsvcid: The transport-specific TRSVCID field for a port on the * @trsvcid: The transport-specific TRSVCID field for a port on the
* subsystem which is adding a controller. * subsystem which is adding a controller.
* @host_traddr: A transport-specific field identifying the NVME host port
* to use for the connection to the controller.
* @queue_size: Number of IO queue elements. * @queue_size: Number of IO queue elements.
* @nr_io_queues: Number of controller IO queues that will be established. * @nr_io_queues: Number of controller IO queues that will be established.
* @reconnect_delay: Time between two consecutive reconnect attempts. * @reconnect_delay: Time between two consecutive reconnect attempts.
...@@ -81,6 +84,7 @@ struct nvmf_ctrl_options { ...@@ -81,6 +84,7 @@ struct nvmf_ctrl_options {
char *subsysnqn; char *subsysnqn;
char *traddr; char *traddr;
char *trsvcid; char *trsvcid;
char *host_traddr;
size_t queue_size; size_t queue_size;
unsigned int nr_io_queues; unsigned int nr_io_queues;
unsigned int reconnect_delay; unsigned int reconnect_delay;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment