Lines Matching defs:opts

134 	if (ctrl->opts->mask & NVMF_OPT_TRADDR)
135 len += scnprintf(buf, size, "traddr=%s", ctrl->opts->traddr);
136 if (ctrl->opts->mask & NVMF_OPT_TRSVCID)
138 (len) ? "," : "", ctrl->opts->trsvcid);
139 if (ctrl->opts->mask & NVMF_OPT_HOST_TRADDR)
141 (len) ? "," : "", ctrl->opts->host_traddr);
142 if (ctrl->opts->mask & NVMF_OPT_HOST_IFACE)
144 (len) ? "," : "", ctrl->opts->host_iface);
388 uuid_copy(&data->hostid, &ctrl->opts->host->id);
390 strscpy(data->subsysnqn, ctrl->opts->subsysnqn, NVMF_NQN_SIZE);
391 strscpy(data->hostnqn, ctrl->opts->host->nqn, NVMF_NQN_SIZE);
414 if (ctrl->opts->disable_sqflow)
569 if (ctrl->opts->max_reconnects == -1 ||
570 ctrl->nr_reconnects < ctrl->opts->max_reconnects)
617 struct nvmf_ctrl_options *opts)
624 if (strcmp(ops->name, opts->transport) == 0)
685 static int nvmf_parse_options(struct nvmf_ctrl_options *opts,
698 opts->queue_size = NVMF_DEF_QUEUE_SIZE;
699 opts->nr_io_queues = num_online_cpus();
700 opts->reconnect_delay = NVMF_DEF_RECONNECT_DELAY;
701 opts->kato = 0;
702 opts->duplicate_connect = false;
703 opts->fast_io_fail_tmo = NVMF_DEF_FAIL_FAST_TMO;
704 opts->hdr_digest = false;
705 opts->data_digest = false;
706 opts->tos = -1; /* < 0 == use transport default */
707 opts->tls = false;
708 opts->tls_key = NULL;
709 opts->keyring = NULL;
724 opts->mask |= token;
732 kfree(opts->transport);
733 opts->transport = p;
741 kfree(opts->subsysnqn);
742 opts->subsysnqn = p;
743 nqnlen = strlen(opts->subsysnqn);
746 opts->subsysnqn, NVMF_NQN_SIZE);
750 opts->discovery_nqn =
751 !(strcmp(opts->subsysnqn,
760 kfree(opts->traddr);
761 opts->traddr = p;
769 kfree(opts->trsvcid);
770 opts->trsvcid = p;
783 opts->queue_size = token;
795 if (opts->discovery_nqn) {
800 opts->nr_io_queues = min_t(unsigned int,
813 } else if (token == 0 && !opts->discovery_nqn) {
817 opts->kato = token;
841 opts->fast_io_fail_tmo = token;
844 if (opts->host) {
846 opts->host->nqn);
876 opts->reconnect_delay = token;
884 kfree(opts->host_traddr);
885 opts->host_traddr = p;
893 kfree(opts->host_iface);
894 opts->host_iface = p;
912 opts->duplicate_connect = true;
915 opts->disable_sqflow = true;
918 opts->hdr_digest = true;
921 opts->data_digest = true;
933 opts->nr_write_queues = token;
945 opts->nr_poll_queues = token;
961 opts->tos = token;
973 key_put(opts->keyring);
974 opts->keyring = key;
986 key_put(opts->tls_key);
987 opts->tls_key = key;
990 opts->discovery_nqn = true;
1003 kfree(opts->dhchap_secret);
1004 opts->dhchap_secret = p;
1017 kfree(opts->dhchap_ctrl_secret);
1018 opts->dhchap_ctrl_secret = p;
1026 opts->tls = true;
1036 if (opts->discovery_nqn) {
1037 opts->nr_io_queues = 0;
1038 opts->nr_write_queues = 0;
1039 opts->nr_poll_queues = 0;
1040 opts->duplicate_connect = true;
1042 if (!opts->kato)
1043 opts->kato = NVME_DEFAULT_KATO;
1046 opts->max_reconnects = -1;
1048 opts->max_reconnects = DIV_ROUND_UP(ctrl_loss_tmo,
1049 opts->reconnect_delay);
1050 if (ctrl_loss_tmo < opts->fast_io_fail_tmo)
1052 opts->fast_io_fail_tmo, ctrl_loss_tmo);
1055 opts->host = nvmf_host_add(hostnqn, &hostid);
1056 if (IS_ERR(opts->host)) {
1057 ret = PTR_ERR(opts->host);
1058 opts->host = NULL;
1067 void nvmf_set_io_queues(struct nvmf_ctrl_options *opts, u32 nr_io_queues,
1070 if (opts->nr_write_queues && opts->nr_io_queues < nr_io_queues) {
1076 io_queues[HCTX_TYPE_READ] = opts->nr_io_queues;
1079 min(opts->nr_write_queues, nr_io_queues);
1088 min(opts->nr_io_queues, nr_io_queues);
1092 if (opts->nr_poll_queues && nr_io_queues) {
1095 min(opts->nr_poll_queues, nr_io_queues);
1103 struct nvmf_ctrl_options *opts = ctrl->opts;
1105 if (opts->nr_write_queues && io_queues[HCTX_TYPE_READ]) {
1126 if (opts->nr_poll_queues && io_queues[HCTX_TYPE_POLL]) {
1143 static int nvmf_check_required_opts(struct nvmf_ctrl_options *opts,
1146 if ((opts->mask & required_opts) != required_opts) {
1151 !(opt_tokens[i].token & opts->mask)) {
1164 struct nvmf_ctrl_options *opts)
1166 if (!nvmf_ctlr_matches_baseopts(ctrl, opts) ||
1167 strcmp(opts->traddr, ctrl->opts->traddr) ||
1168 strcmp(opts->trsvcid, ctrl->opts->trsvcid))
1184 if ((opts->mask & NVMF_OPT_HOST_TRADDR) &&
1185 (ctrl->opts->mask & NVMF_OPT_HOST_TRADDR)) {
1186 if (strcmp(opts->host_traddr, ctrl->opts->host_traddr))
1188 } else if ((opts->mask & NVMF_OPT_HOST_TRADDR) ||
1189 (ctrl->opts->mask & NVMF_OPT_HOST_TRADDR)) {
1193 if ((opts->mask & NVMF_OPT_HOST_IFACE) &&
1194 (ctrl->opts->mask & NVMF_OPT_HOST_IFACE)) {
1195 if (strcmp(opts->host_iface, ctrl->opts->host_iface))
1197 } else if ((opts->mask & NVMF_OPT_HOST_IFACE) ||
1198 (ctrl->opts->mask & NVMF_OPT_HOST_IFACE)) {
1206 static int nvmf_check_allowed_opts(struct nvmf_ctrl_options *opts,
1209 if (opts->mask & ~allowed_opts) {
1213 if ((opt_tokens[i].token & opts->mask) &&
1226 void nvmf_free_options(struct nvmf_ctrl_options *opts)
1228 nvmf_host_put(opts->host);
1229 key_put(opts->keyring);
1230 key_put(opts->tls_key);
1231 kfree(opts->transport);
1232 kfree(opts->traddr);
1233 kfree(opts->trsvcid);
1234 kfree(opts->subsysnqn);
1235 kfree(opts->host_traddr);
1236 kfree(opts->host_iface);
1237 kfree(opts->dhchap_secret);
1238 kfree(opts->dhchap_ctrl_secret);
1239 kfree(opts);
1254 struct nvmf_ctrl_options *opts;
1259 opts = kzalloc(sizeof(*opts), GFP_KERNEL);
1260 if (!opts)
1263 ret = nvmf_parse_options(opts, buf);
1268 request_module("nvme-%s", opts->transport);
1275 ret = nvmf_check_required_opts(opts, NVMF_REQUIRED_OPTS);
1278 opts->mask &= ~NVMF_REQUIRED_OPTS;
1281 ops = nvmf_lookup_transport(opts);
1284 opts->transport);
1295 ret = nvmf_check_required_opts(opts, ops->required_opts);
1298 ret = nvmf_check_allowed_opts(opts, NVMF_ALLOWED_OPTS |
1303 ctrl = ops->create_ctrl(dev, opts);
1318 nvmf_free_options(opts);