Lines Matching refs:opts
107 if (ctrl->opts->mask & NVMF_OPT_TRADDR)
108 len += scnprintf(buf, size, "traddr=%s", ctrl->opts->traddr);
109 if (ctrl->opts->mask & NVMF_OPT_TRSVCID)
111 (len) ? "," : "", ctrl->opts->trsvcid);
112 if (ctrl->opts->mask & NVMF_OPT_HOST_TRADDR)
114 (len) ? "," : "", ctrl->opts->host_traddr);
392 if (ctrl->opts->disable_sqflow)
399 uuid_copy(&data->hostid, &ctrl->opts->host->id);
401 strncpy(data->subsysnqn, ctrl->opts->subsysnqn, NVMF_NQN_SIZE);
402 strncpy(data->hostnqn, ctrl->opts->host->nqn, NVMF_NQN_SIZE);
455 if (ctrl->opts->disable_sqflow)
462 uuid_copy(&data->hostid, &ctrl->opts->host->id);
464 strncpy(data->subsysnqn, ctrl->opts->subsysnqn, NVMF_NQN_SIZE);
465 strncpy(data->hostnqn, ctrl->opts->host->nqn, NVMF_NQN_SIZE);
481 if (ctrl->opts->max_reconnects == -1 ||
482 ctrl->nr_reconnects < ctrl->opts->max_reconnects)
529 struct nvmf_ctrl_options *opts)
536 if (strcmp(ops->name, opts->transport) == 0)
626 static int nvmf_parse_options(struct nvmf_ctrl_options *opts,
637 opts->queue_size = NVMF_DEF_QUEUE_SIZE;
638 opts->nr_io_queues = num_online_cpus();
639 opts->reconnect_delay = NVMF_DEF_RECONNECT_DELAY;
640 opts->kato = NVME_DEFAULT_KATO;
641 opts->duplicate_connect = false;
642 opts->hdr_digest = false;
643 opts->data_digest = false;
644 opts->tos = -1; /* < 0 == use transport default */
657 opts->mask |= token;
665 kfree(opts->transport);
666 opts->transport = p;
674 kfree(opts->subsysnqn);
675 opts->subsysnqn = p;
676 nqnlen = strlen(opts->subsysnqn);
679 opts->subsysnqn, NVMF_NQN_SIZE);
683 opts->discovery_nqn =
684 !(strcmp(opts->subsysnqn,
693 kfree(opts->traddr);
694 opts->traddr = p;
702 kfree(opts->trsvcid);
703 opts->trsvcid = p;
716 opts->queue_size = token;
728 if (opts->discovery_nqn) {
733 opts->nr_io_queues = min_t(unsigned int,
746 } else if (token == 0 && !opts->discovery_nqn) {
750 opts->kato = token;
763 if (opts->host) {
765 opts->host->nqn);
782 nvmf_host_put(opts->host);
783 opts->host = nvmf_host_add(p);
785 if (!opts->host) {
800 opts->reconnect_delay = token;
808 kfree(opts->host_traddr);
809 opts->host_traddr = p;
827 opts->duplicate_connect = true;
830 opts->disable_sqflow = true;
833 opts->hdr_digest = true;
836 opts->data_digest = true;
848 opts->nr_write_queues = token;
860 opts->nr_poll_queues = token;
876 opts->tos = token;
886 if (opts->discovery_nqn) {
887 opts->nr_io_queues = 0;
888 opts->nr_write_queues = 0;
889 opts->nr_poll_queues = 0;
890 opts->duplicate_connect = true;
893 opts->max_reconnects = -1;
895 opts->max_reconnects = DIV_ROUND_UP(ctrl_loss_tmo,
896 opts->reconnect_delay);
898 if (!opts->host) {
900 opts->host = nvmf_default_host;
903 uuid_copy(&opts->host->id, &hostid);
910 static int nvmf_check_required_opts(struct nvmf_ctrl_options *opts,
913 if ((opts->mask & required_opts) != required_opts) {
918 !(opt_tokens[i].token & opts->mask)) {
931 struct nvmf_ctrl_options *opts)
933 if (!nvmf_ctlr_matches_baseopts(ctrl, opts) ||
934 strcmp(opts->traddr, ctrl->opts->traddr) ||
935 strcmp(opts->trsvcid, ctrl->opts->trsvcid))
947 if ((opts->mask & NVMF_OPT_HOST_TRADDR) &&
948 (ctrl->opts->mask & NVMF_OPT_HOST_TRADDR)) {
949 if (strcmp(opts->host_traddr, ctrl->opts->host_traddr))
951 } else if ((opts->mask & NVMF_OPT_HOST_TRADDR) ||
952 (ctrl->opts->mask & NVMF_OPT_HOST_TRADDR)) {
960 static int nvmf_check_allowed_opts(struct nvmf_ctrl_options *opts,
963 if (opts->mask & ~allowed_opts) {
967 if ((opt_tokens[i].token & opts->mask) &&
980 void nvmf_free_options(struct nvmf_ctrl_options *opts)
982 nvmf_host_put(opts->host);
983 kfree(opts->transport);
984 kfree(opts->traddr);
985 kfree(opts->trsvcid);
986 kfree(opts->subsysnqn);
987 kfree(opts->host_traddr);
988 kfree(opts);
1001 struct nvmf_ctrl_options *opts;
1006 opts = kzalloc(sizeof(*opts), GFP_KERNEL);
1007 if (!opts)
1010 ret = nvmf_parse_options(opts, buf);
1015 request_module("nvme-%s", opts->transport);
1022 ret = nvmf_check_required_opts(opts, NVMF_REQUIRED_OPTS);
1025 opts->mask &= ~NVMF_REQUIRED_OPTS;
1028 ops = nvmf_lookup_transport(opts);
1031 opts->transport);
1042 ret = nvmf_check_required_opts(opts, ops->required_opts);
1045 ret = nvmf_check_allowed_opts(opts, NVMF_ALLOWED_OPTS |
1050 ctrl = ops->create_ctrl(dev, opts);
1065 nvmf_free_options(opts);