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()
655 static int nvmf_parse_options(struct nvmf_ctrl_options *opts, in nvmf_parse_options() argument
667 opts->queue_size = NVMF_DEF_QUEUE_SIZE; in nvmf_parse_options()
668 opts->nr_io_queues = num_online_cpus(); in nvmf_parse_options()
669 opts->reconnect_delay = NVMF_DEF_RECONNECT_DELAY; in nvmf_parse_options()
670 opts->kato = 0; in nvmf_parse_options()
671 opts->duplicate_connect = false; in nvmf_parse_options()
672 opts->fast_io_fail_tmo = NVMF_DEF_FAIL_FAST_TMO; in nvmf_parse_options()
673 opts->hdr_digest = false; in nvmf_parse_options()
674 opts->data_digest = false; in nvmf_parse_options()
675 opts->tos = -1; /* < 0 == use transport default */ in nvmf_parse_options()
690 opts->mask |= token; in nvmf_parse_options()
698 kfree(opts->transport); in nvmf_parse_options()
699 opts->transport = p; in nvmf_parse_options()
707 kfree(opts->subsysnqn); in nvmf_parse_options()
708 opts->subsysnqn = p; in nvmf_parse_options()
709 nqnlen = strlen(opts->subsysnqn); in nvmf_parse_options()
712 opts->subsysnqn, NVMF_NQN_SIZE); in nvmf_parse_options()
716 opts->discovery_nqn = in nvmf_parse_options()
717 !(strcmp(opts->subsysnqn, in nvmf_parse_options()
726 kfree(opts->traddr); in nvmf_parse_options()
727 opts->traddr = p; in nvmf_parse_options()
735 kfree(opts->trsvcid); in nvmf_parse_options()
736 opts->trsvcid = p; in nvmf_parse_options()
749 opts->queue_size = token; in nvmf_parse_options()
761 if (opts->discovery_nqn) { in nvmf_parse_options()
766 opts->nr_io_queues = min_t(unsigned int, in nvmf_parse_options()
779 } else if (token == 0 && !opts->discovery_nqn) { in nvmf_parse_options()
783 opts->kato = token; in nvmf_parse_options()
807 opts->fast_io_fail_tmo = token; in nvmf_parse_options()
810 if (opts->host) { in nvmf_parse_options()
812 opts->host->nqn); in nvmf_parse_options()
842 opts->reconnect_delay = token; in nvmf_parse_options()
850 kfree(opts->host_traddr); in nvmf_parse_options()
851 opts->host_traddr = p; in nvmf_parse_options()
859 kfree(opts->host_iface); in nvmf_parse_options()
860 opts->host_iface = p; in nvmf_parse_options()
878 opts->duplicate_connect = true; in nvmf_parse_options()
881 opts->disable_sqflow = true; in nvmf_parse_options()
884 opts->hdr_digest = true; in nvmf_parse_options()
887 opts->data_digest = true; in nvmf_parse_options()
899 opts->nr_write_queues = token; in nvmf_parse_options()
911 opts->nr_poll_queues = token; in nvmf_parse_options()
927 opts->tos = token; in nvmf_parse_options()
930 opts->discovery_nqn = true; in nvmf_parse_options()
943 kfree(opts->dhchap_secret); in nvmf_parse_options()
944 opts->dhchap_secret = p; in nvmf_parse_options()
957 kfree(opts->dhchap_ctrl_secret); in nvmf_parse_options()
958 opts->dhchap_ctrl_secret = p; in nvmf_parse_options()
968 if (opts->discovery_nqn) { in nvmf_parse_options()
969 opts->nr_io_queues = 0; in nvmf_parse_options()
970 opts->nr_write_queues = 0; in nvmf_parse_options()
971 opts->nr_poll_queues = 0; in nvmf_parse_options()
972 opts->duplicate_connect = true; in nvmf_parse_options()
974 if (!opts->kato) in nvmf_parse_options()
975 opts->kato = NVME_DEFAULT_KATO; in nvmf_parse_options()
978 opts->max_reconnects = -1; in nvmf_parse_options()
980 opts->max_reconnects = DIV_ROUND_UP(ctrl_loss_tmo, in nvmf_parse_options()
981 opts->reconnect_delay); in nvmf_parse_options()
982 if (ctrl_loss_tmo < opts->fast_io_fail_tmo) in nvmf_parse_options()
984 opts->fast_io_fail_tmo, ctrl_loss_tmo); in nvmf_parse_options()
987 opts->host = nvmf_host_add(hostnqn, &hostid); in nvmf_parse_options()
988 if (IS_ERR(opts->host)) { in nvmf_parse_options()
989 ret = PTR_ERR(opts->host); in nvmf_parse_options()
990 opts->host = NULL; in nvmf_parse_options()
999 void nvmf_set_io_queues(struct nvmf_ctrl_options *opts, u32 nr_io_queues, in nvmf_set_io_queues() argument
1002 if (opts->nr_write_queues && opts->nr_io_queues < nr_io_queues) { in nvmf_set_io_queues()
1008 io_queues[HCTX_TYPE_READ] = opts->nr_io_queues; in nvmf_set_io_queues()
1011 min(opts->nr_write_queues, nr_io_queues); in nvmf_set_io_queues()
1020 min(opts->nr_io_queues, nr_io_queues); in nvmf_set_io_queues()
1024 if (opts->nr_poll_queues && nr_io_queues) { in nvmf_set_io_queues()
1027 min(opts->nr_poll_queues, nr_io_queues); in nvmf_set_io_queues()
1035 struct nvmf_ctrl_options *opts = ctrl->opts; in nvmf_map_queues() local
1037 if (opts->nr_write_queues && io_queues[HCTX_TYPE_READ]) { in nvmf_map_queues()
1058 if (opts->nr_poll_queues && io_queues[HCTX_TYPE_POLL]) { in nvmf_map_queues()
1075 static int nvmf_check_required_opts(struct nvmf_ctrl_options *opts, in nvmf_check_required_opts() argument
1078 if ((opts->mask & required_opts) != required_opts) { in nvmf_check_required_opts()
1083 !(opt_tokens[i].token & opts->mask)) { in nvmf_check_required_opts()
1096 struct nvmf_ctrl_options *opts) in nvmf_ip_options_match() argument
1098 if (!nvmf_ctlr_matches_baseopts(ctrl, opts) || in nvmf_ip_options_match()
1099 strcmp(opts->traddr, ctrl->opts->traddr) || in nvmf_ip_options_match()
1100 strcmp(opts->trsvcid, ctrl->opts->trsvcid)) in nvmf_ip_options_match()
1116 if ((opts->mask & NVMF_OPT_HOST_TRADDR) && in nvmf_ip_options_match()
1117 (ctrl->opts->mask & NVMF_OPT_HOST_TRADDR)) { in nvmf_ip_options_match()
1118 if (strcmp(opts->host_traddr, ctrl->opts->host_traddr)) in nvmf_ip_options_match()
1120 } else if ((opts->mask & NVMF_OPT_HOST_TRADDR) || in nvmf_ip_options_match()
1121 (ctrl->opts->mask & NVMF_OPT_HOST_TRADDR)) { in nvmf_ip_options_match()
1125 if ((opts->mask & NVMF_OPT_HOST_IFACE) && in nvmf_ip_options_match()
1126 (ctrl->opts->mask & NVMF_OPT_HOST_IFACE)) { in nvmf_ip_options_match()
1127 if (strcmp(opts->host_iface, ctrl->opts->host_iface)) in nvmf_ip_options_match()
1129 } else if ((opts->mask & NVMF_OPT_HOST_IFACE) || in nvmf_ip_options_match()
1130 (ctrl->opts->mask & NVMF_OPT_HOST_IFACE)) { in nvmf_ip_options_match()
1138 static int nvmf_check_allowed_opts(struct nvmf_ctrl_options *opts, in nvmf_check_allowed_opts() argument
1141 if (opts->mask & ~allowed_opts) { in nvmf_check_allowed_opts()
1145 if ((opt_tokens[i].token & opts->mask) && in nvmf_check_allowed_opts()
1158 void nvmf_free_options(struct nvmf_ctrl_options *opts) in nvmf_free_options() argument
1160 nvmf_host_put(opts->host); in nvmf_free_options()
1161 kfree(opts->transport); in nvmf_free_options()
1162 kfree(opts->traddr); in nvmf_free_options()
1163 kfree(opts->trsvcid); in nvmf_free_options()
1164 kfree(opts->subsysnqn); in nvmf_free_options()
1165 kfree(opts->host_traddr); in nvmf_free_options()
1166 kfree(opts->host_iface); in nvmf_free_options()
1167 kfree(opts->dhchap_secret); in nvmf_free_options()
1168 kfree(opts->dhchap_ctrl_secret); in nvmf_free_options()
1169 kfree(opts); in nvmf_free_options()
1184 struct nvmf_ctrl_options *opts; in nvmf_create_ctrl() local
1189 opts = kzalloc(sizeof(*opts), GFP_KERNEL); in nvmf_create_ctrl()
1190 if (!opts) in nvmf_create_ctrl()
1193 ret = nvmf_parse_options(opts, buf); in nvmf_create_ctrl()
1198 request_module("nvme-%s", opts->transport); in nvmf_create_ctrl()
1205 ret = nvmf_check_required_opts(opts, NVMF_REQUIRED_OPTS); in nvmf_create_ctrl()
1208 opts->mask &= ~NVMF_REQUIRED_OPTS; in nvmf_create_ctrl()
1211 ops = nvmf_lookup_transport(opts); in nvmf_create_ctrl()
1214 opts->transport); in nvmf_create_ctrl()
1225 ret = nvmf_check_required_opts(opts, ops->required_opts); in nvmf_create_ctrl()
1228 ret = nvmf_check_allowed_opts(opts, NVMF_ALLOWED_OPTS | in nvmf_create_ctrl()
1233 ctrl = ops->create_ctrl(dev, opts); in nvmf_create_ctrl()
1248 nvmf_free_options(opts); in nvmf_create_ctrl()