Lines Matching refs:opts
133 if (ctrl->opts->mask & NVMF_OPT_TRADDR) in nvmf_get_address()
134 len += scnprintf(buf, size, "traddr=%s", ctrl->opts->traddr); in nvmf_get_address()
135 if (ctrl->opts->mask & NVMF_OPT_TRSVCID) in nvmf_get_address()
137 (len) ? "," : "", ctrl->opts->trsvcid); in nvmf_get_address()
138 if (ctrl->opts->mask & NVMF_OPT_HOST_TRADDR) in nvmf_get_address()
140 (len) ? "," : "", ctrl->opts->host_traddr); in nvmf_get_address()
141 if (ctrl->opts->mask & NVMF_OPT_HOST_IFACE) in nvmf_get_address()
143 (len) ? "," : "", ctrl->opts->host_iface); in nvmf_get_address()
387 uuid_copy(&data->hostid, &ctrl->opts->host->id); in nvmf_connect_data_prep()
389 strncpy(data->subsysnqn, ctrl->opts->subsysnqn, NVMF_NQN_SIZE); in nvmf_connect_data_prep()
390 strncpy(data->hostnqn, ctrl->opts->host->nqn, NVMF_NQN_SIZE); in nvmf_connect_data_prep()
413 if (ctrl->opts->disable_sqflow) in nvmf_connect_cmd_prep()
563 if (ctrl->opts->max_reconnects == -1 || in nvmf_should_reconnect()
564 ctrl->nr_reconnects < ctrl->opts->max_reconnects) in nvmf_should_reconnect()
611 struct nvmf_ctrl_options *opts) in nvmf_lookup_transport() argument
618 if (strcmp(ops->name, opts->transport) == 0) in nvmf_lookup_transport()
653 static int nvmf_parse_options(struct nvmf_ctrl_options *opts, in nvmf_parse_options() argument
665 opts->queue_size = NVMF_DEF_QUEUE_SIZE; in nvmf_parse_options()
666 opts->nr_io_queues = num_online_cpus(); in nvmf_parse_options()
667 opts->reconnect_delay = NVMF_DEF_RECONNECT_DELAY; in nvmf_parse_options()
668 opts->kato = 0; in nvmf_parse_options()
669 opts->duplicate_connect = false; in nvmf_parse_options()
670 opts->fast_io_fail_tmo = NVMF_DEF_FAIL_FAST_TMO; in nvmf_parse_options()
671 opts->hdr_digest = false; in nvmf_parse_options()
672 opts->data_digest = false; in nvmf_parse_options()
673 opts->tos = -1; /* < 0 == use transport default */ in nvmf_parse_options()
688 opts->mask |= token; in nvmf_parse_options()
696 kfree(opts->transport); in nvmf_parse_options()
697 opts->transport = p; in nvmf_parse_options()
705 kfree(opts->subsysnqn); in nvmf_parse_options()
706 opts->subsysnqn = p; in nvmf_parse_options()
707 nqnlen = strlen(opts->subsysnqn); in nvmf_parse_options()
710 opts->subsysnqn, NVMF_NQN_SIZE); in nvmf_parse_options()
714 opts->discovery_nqn = in nvmf_parse_options()
715 !(strcmp(opts->subsysnqn, in nvmf_parse_options()
724 kfree(opts->traddr); in nvmf_parse_options()
725 opts->traddr = p; in nvmf_parse_options()
733 kfree(opts->trsvcid); in nvmf_parse_options()
734 opts->trsvcid = p; in nvmf_parse_options()
747 opts->queue_size = token; in nvmf_parse_options()
759 if (opts->discovery_nqn) { in nvmf_parse_options()
764 opts->nr_io_queues = min_t(unsigned int, in nvmf_parse_options()
777 } else if (token == 0 && !opts->discovery_nqn) { in nvmf_parse_options()
781 opts->kato = token; in nvmf_parse_options()
805 opts->fast_io_fail_tmo = token; in nvmf_parse_options()
808 if (opts->host) { in nvmf_parse_options()
810 opts->host->nqn); in nvmf_parse_options()
840 opts->reconnect_delay = token; in nvmf_parse_options()
848 kfree(opts->host_traddr); in nvmf_parse_options()
849 opts->host_traddr = p; in nvmf_parse_options()
857 kfree(opts->host_iface); in nvmf_parse_options()
858 opts->host_iface = p; in nvmf_parse_options()
876 opts->duplicate_connect = true; in nvmf_parse_options()
879 opts->disable_sqflow = true; in nvmf_parse_options()
882 opts->hdr_digest = true; in nvmf_parse_options()
885 opts->data_digest = true; in nvmf_parse_options()
897 opts->nr_write_queues = token; in nvmf_parse_options()
909 opts->nr_poll_queues = token; in nvmf_parse_options()
925 opts->tos = token; in nvmf_parse_options()
928 opts->discovery_nqn = true; in nvmf_parse_options()
941 kfree(opts->dhchap_secret); in nvmf_parse_options()
942 opts->dhchap_secret = p; in nvmf_parse_options()
955 kfree(opts->dhchap_ctrl_secret); in nvmf_parse_options()
956 opts->dhchap_ctrl_secret = p; in nvmf_parse_options()
966 if (opts->discovery_nqn) { in nvmf_parse_options()
967 opts->nr_io_queues = 0; in nvmf_parse_options()
968 opts->nr_write_queues = 0; in nvmf_parse_options()
969 opts->nr_poll_queues = 0; in nvmf_parse_options()
970 opts->duplicate_connect = true; in nvmf_parse_options()
972 if (!opts->kato) in nvmf_parse_options()
973 opts->kato = NVME_DEFAULT_KATO; in nvmf_parse_options()
976 opts->max_reconnects = -1; in nvmf_parse_options()
978 opts->max_reconnects = DIV_ROUND_UP(ctrl_loss_tmo, in nvmf_parse_options()
979 opts->reconnect_delay); in nvmf_parse_options()
980 if (ctrl_loss_tmo < opts->fast_io_fail_tmo) in nvmf_parse_options()
982 opts->fast_io_fail_tmo, ctrl_loss_tmo); in nvmf_parse_options()
985 opts->host = nvmf_host_add(hostnqn, &hostid); in nvmf_parse_options()
986 if (IS_ERR(opts->host)) { in nvmf_parse_options()
987 ret = PTR_ERR(opts->host); in nvmf_parse_options()
988 opts->host = NULL; in nvmf_parse_options()
997 void nvmf_set_io_queues(struct nvmf_ctrl_options *opts, u32 nr_io_queues, in nvmf_set_io_queues() argument
1000 if (opts->nr_write_queues && opts->nr_io_queues < nr_io_queues) { in nvmf_set_io_queues()
1006 io_queues[HCTX_TYPE_READ] = opts->nr_io_queues; in nvmf_set_io_queues()
1009 min(opts->nr_write_queues, nr_io_queues); in nvmf_set_io_queues()
1018 min(opts->nr_io_queues, nr_io_queues); in nvmf_set_io_queues()
1022 if (opts->nr_poll_queues && nr_io_queues) { in nvmf_set_io_queues()
1025 min(opts->nr_poll_queues, nr_io_queues); in nvmf_set_io_queues()
1033 struct nvmf_ctrl_options *opts = ctrl->opts; in nvmf_map_queues() local
1035 if (opts->nr_write_queues && io_queues[HCTX_TYPE_READ]) { in nvmf_map_queues()
1056 if (opts->nr_poll_queues && io_queues[HCTX_TYPE_POLL]) { in nvmf_map_queues()
1073 static int nvmf_check_required_opts(struct nvmf_ctrl_options *opts, in nvmf_check_required_opts() argument
1076 if ((opts->mask & required_opts) != required_opts) { in nvmf_check_required_opts()
1081 !(opt_tokens[i].token & opts->mask)) { in nvmf_check_required_opts()
1094 struct nvmf_ctrl_options *opts) in nvmf_ip_options_match() argument
1096 if (!nvmf_ctlr_matches_baseopts(ctrl, opts) || in nvmf_ip_options_match()
1097 strcmp(opts->traddr, ctrl->opts->traddr) || in nvmf_ip_options_match()
1098 strcmp(opts->trsvcid, ctrl->opts->trsvcid)) in nvmf_ip_options_match()
1114 if ((opts->mask & NVMF_OPT_HOST_TRADDR) && in nvmf_ip_options_match()
1115 (ctrl->opts->mask & NVMF_OPT_HOST_TRADDR)) { in nvmf_ip_options_match()
1116 if (strcmp(opts->host_traddr, ctrl->opts->host_traddr)) in nvmf_ip_options_match()
1118 } else if ((opts->mask & NVMF_OPT_HOST_TRADDR) || in nvmf_ip_options_match()
1119 (ctrl->opts->mask & NVMF_OPT_HOST_TRADDR)) { in nvmf_ip_options_match()
1123 if ((opts->mask & NVMF_OPT_HOST_IFACE) && in nvmf_ip_options_match()
1124 (ctrl->opts->mask & NVMF_OPT_HOST_IFACE)) { in nvmf_ip_options_match()
1125 if (strcmp(opts->host_iface, ctrl->opts->host_iface)) in nvmf_ip_options_match()
1127 } else if ((opts->mask & NVMF_OPT_HOST_IFACE) || in nvmf_ip_options_match()
1128 (ctrl->opts->mask & NVMF_OPT_HOST_IFACE)) { in nvmf_ip_options_match()
1136 static int nvmf_check_allowed_opts(struct nvmf_ctrl_options *opts, in nvmf_check_allowed_opts() argument
1139 if (opts->mask & ~allowed_opts) { in nvmf_check_allowed_opts()
1143 if ((opt_tokens[i].token & opts->mask) && in nvmf_check_allowed_opts()
1156 void nvmf_free_options(struct nvmf_ctrl_options *opts) in nvmf_free_options() argument
1158 nvmf_host_put(opts->host); in nvmf_free_options()
1159 kfree(opts->transport); in nvmf_free_options()
1160 kfree(opts->traddr); in nvmf_free_options()
1161 kfree(opts->trsvcid); in nvmf_free_options()
1162 kfree(opts->subsysnqn); in nvmf_free_options()
1163 kfree(opts->host_traddr); in nvmf_free_options()
1164 kfree(opts->host_iface); in nvmf_free_options()
1165 kfree(opts->dhchap_secret); in nvmf_free_options()
1166 kfree(opts->dhchap_ctrl_secret); in nvmf_free_options()
1167 kfree(opts); in nvmf_free_options()
1182 struct nvmf_ctrl_options *opts; in nvmf_create_ctrl() local
1187 opts = kzalloc(sizeof(*opts), GFP_KERNEL); in nvmf_create_ctrl()
1188 if (!opts) in nvmf_create_ctrl()
1191 ret = nvmf_parse_options(opts, buf); in nvmf_create_ctrl()
1196 request_module("nvme-%s", opts->transport); in nvmf_create_ctrl()
1203 ret = nvmf_check_required_opts(opts, NVMF_REQUIRED_OPTS); in nvmf_create_ctrl()
1206 opts->mask &= ~NVMF_REQUIRED_OPTS; in nvmf_create_ctrl()
1209 ops = nvmf_lookup_transport(opts); in nvmf_create_ctrl()
1212 opts->transport); in nvmf_create_ctrl()
1223 ret = nvmf_check_required_opts(opts, ops->required_opts); in nvmf_create_ctrl()
1226 ret = nvmf_check_allowed_opts(opts, NVMF_ALLOWED_OPTS | in nvmf_create_ctrl()
1231 ctrl = ops->create_ctrl(dev, opts); in nvmf_create_ctrl()
1246 nvmf_free_options(opts); in nvmf_create_ctrl()