mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-05 00:20:32 +00:00
nvme: Add connect option 'discovery'
Add a connect option 'discovery' to specify that the connection should be made to a discovery controller, not a normal I/O controller. With discovery controllers supporting unique subsystem NQNs we cannot easily distinguish by the subsystem NQN if this should be a discovery connection, but we need this information to blank out options not supported by discovery controllers. Signed-off-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
parent
954ae16681
commit
20e8b689c9
3 changed files with 13 additions and 1 deletions
|
@ -2737,6 +2737,13 @@ static int nvme_init_subsystem(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)
|
||||||
else
|
else
|
||||||
subsys->subtype = NVME_NQN_NVME;
|
subsys->subtype = NVME_NQN_NVME;
|
||||||
|
|
||||||
|
if (nvme_discovery_ctrl(ctrl) && subsys->subtype != NVME_NQN_DISC) {
|
||||||
|
dev_err(ctrl->device,
|
||||||
|
"Subsystem %s is not a discovery controller",
|
||||||
|
subsys->subnqn);
|
||||||
|
kfree(subsys);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
subsys->awupf = le16_to_cpu(id->awupf);
|
subsys->awupf = le16_to_cpu(id->awupf);
|
||||||
#ifdef CONFIG_NVME_MULTIPATH
|
#ifdef CONFIG_NVME_MULTIPATH
|
||||||
subsys->iopolicy = NVME_IOPOLICY_NUMA;
|
subsys->iopolicy = NVME_IOPOLICY_NUMA;
|
||||||
|
|
|
@ -548,6 +548,7 @@ static const match_table_t opt_tokens = {
|
||||||
{ NVMF_OPT_NR_POLL_QUEUES, "nr_poll_queues=%d" },
|
{ NVMF_OPT_NR_POLL_QUEUES, "nr_poll_queues=%d" },
|
||||||
{ NVMF_OPT_TOS, "tos=%d" },
|
{ NVMF_OPT_TOS, "tos=%d" },
|
||||||
{ NVMF_OPT_FAIL_FAST_TMO, "fast_io_fail_tmo=%d" },
|
{ NVMF_OPT_FAIL_FAST_TMO, "fast_io_fail_tmo=%d" },
|
||||||
|
{ NVMF_OPT_DISCOVERY, "discovery" },
|
||||||
{ NVMF_OPT_ERR, NULL }
|
{ NVMF_OPT_ERR, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -823,6 +824,9 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts,
|
||||||
}
|
}
|
||||||
opts->tos = token;
|
opts->tos = token;
|
||||||
break;
|
break;
|
||||||
|
case NVMF_OPT_DISCOVERY:
|
||||||
|
opts->discovery_nqn = true;
|
||||||
|
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);
|
||||||
|
@ -949,7 +953,7 @@ EXPORT_SYMBOL_GPL(nvmf_free_options);
|
||||||
#define NVMF_ALLOWED_OPTS (NVMF_OPT_QUEUE_SIZE | NVMF_OPT_NR_IO_QUEUES | \
|
#define NVMF_ALLOWED_OPTS (NVMF_OPT_QUEUE_SIZE | NVMF_OPT_NR_IO_QUEUES | \
|
||||||
NVMF_OPT_KATO | NVMF_OPT_HOSTNQN | \
|
NVMF_OPT_KATO | NVMF_OPT_HOSTNQN | \
|
||||||
NVMF_OPT_HOST_ID | NVMF_OPT_DUP_CONNECT |\
|
NVMF_OPT_HOST_ID | NVMF_OPT_DUP_CONNECT |\
|
||||||
NVMF_OPT_DISABLE_SQFLOW |\
|
NVMF_OPT_DISABLE_SQFLOW | NVMF_OPT_DISCOVERY |\
|
||||||
NVMF_OPT_FAIL_FAST_TMO)
|
NVMF_OPT_FAIL_FAST_TMO)
|
||||||
|
|
||||||
static struct nvme_ctrl *
|
static struct nvme_ctrl *
|
||||||
|
|
|
@ -67,6 +67,7 @@ enum {
|
||||||
NVMF_OPT_TOS = 1 << 19,
|
NVMF_OPT_TOS = 1 << 19,
|
||||||
NVMF_OPT_FAIL_FAST_TMO = 1 << 20,
|
NVMF_OPT_FAIL_FAST_TMO = 1 << 20,
|
||||||
NVMF_OPT_HOST_IFACE = 1 << 21,
|
NVMF_OPT_HOST_IFACE = 1 << 21,
|
||||||
|
NVMF_OPT_DISCOVERY = 1 << 22,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue