Lines Matching refs:ctrl

130 int nvmf_get_address(struct nvme_ctrl *ctrl, char *buf, int size)  in nvmf_get_address()  argument
134 if (ctrl->opts->mask & NVMF_OPT_TRADDR) in nvmf_get_address()
135 len += scnprintf(buf, size, "traddr=%s", ctrl->opts->traddr); in nvmf_get_address()
136 if (ctrl->opts->mask & NVMF_OPT_TRSVCID) in nvmf_get_address()
138 (len) ? "," : "", ctrl->opts->trsvcid); in nvmf_get_address()
139 if (ctrl->opts->mask & NVMF_OPT_HOST_TRADDR) in nvmf_get_address()
141 (len) ? "," : "", ctrl->opts->host_traddr); in nvmf_get_address()
142 if (ctrl->opts->mask & NVMF_OPT_HOST_IFACE) in nvmf_get_address()
144 (len) ? "," : "", ctrl->opts->host_iface); in nvmf_get_address()
172 int nvmf_reg_read32(struct nvme_ctrl *ctrl, u32 off, u32 *val) in nvmf_reg_read32() argument
182 ret = __nvme_submit_sync_cmd(ctrl->fabrics_q, &cmd, &res, NULL, 0, in nvmf_reg_read32()
188 dev_err(ctrl->device, in nvmf_reg_read32()
217 int nvmf_reg_read64(struct nvme_ctrl *ctrl, u32 off, u64 *val) in nvmf_reg_read64() argument
228 ret = __nvme_submit_sync_cmd(ctrl->fabrics_q, &cmd, &res, NULL, 0, in nvmf_reg_read64()
234 dev_err(ctrl->device, in nvmf_reg_read64()
262 int nvmf_reg_write32(struct nvme_ctrl *ctrl, u32 off, u32 val) in nvmf_reg_write32() argument
273 ret = __nvme_submit_sync_cmd(ctrl->fabrics_q, &cmd, NULL, NULL, 0, in nvmf_reg_write32()
276 dev_err(ctrl->device, in nvmf_reg_write32()
283 int nvmf_subsystem_reset(struct nvme_ctrl *ctrl) in nvmf_subsystem_reset() argument
287 if (!nvme_wait_reset(ctrl)) in nvmf_subsystem_reset()
290 ret = ctrl->ops->reg_write32(ctrl, NVME_REG_NSSR, NVME_SUBSYS_RESET); in nvmf_subsystem_reset()
294 return nvme_try_sched_reset(ctrl); in nvmf_subsystem_reset()
309 static void nvmf_log_connect_error(struct nvme_ctrl *ctrl, in nvmf_log_connect_error() argument
316 dev_err(ctrl->device, in nvmf_log_connect_error()
328 dev_err(ctrl->device, in nvmf_log_connect_error()
333 dev_err(ctrl->device, in nvmf_log_connect_error()
338 dev_err(ctrl->device, in nvmf_log_connect_error()
343 dev_err(ctrl->device, in nvmf_log_connect_error()
353 dev_err(ctrl->device, in nvmf_log_connect_error()
358 dev_err(ctrl->device, in nvmf_log_connect_error()
365 dev_err(ctrl->device, in nvmf_log_connect_error()
370 dev_err(ctrl->device, in nvmf_log_connect_error()
374 dev_err(ctrl->device, in nvmf_log_connect_error()
379 dev_err(ctrl->device, in nvmf_log_connect_error()
383 dev_err(ctrl->device, in nvmf_log_connect_error()
387 dev_err(ctrl->device, in nvmf_log_connect_error()
394 static struct nvmf_connect_data *nvmf_connect_data_prep(struct nvme_ctrl *ctrl, in nvmf_connect_data_prep() argument
403 uuid_copy(&data->hostid, &ctrl->opts->host->id); in nvmf_connect_data_prep()
405 strscpy(data->subsysnqn, ctrl->opts->subsysnqn, NVMF_NQN_SIZE); in nvmf_connect_data_prep()
406 strscpy(data->hostnqn, ctrl->opts->host->nqn, NVMF_NQN_SIZE); in nvmf_connect_data_prep()
411 static void nvmf_connect_cmd_prep(struct nvme_ctrl *ctrl, u16 qid, in nvmf_connect_cmd_prep() argument
419 cmd->connect.sqsize = cpu_to_le16(ctrl->sqsize); in nvmf_connect_cmd_prep()
426 cmd->connect.kato = cpu_to_le32(ctrl->kato * 1000); in nvmf_connect_cmd_prep()
429 if (ctrl->opts->disable_sqflow) in nvmf_connect_cmd_prep()
447 int nvmf_connect_admin_queue(struct nvme_ctrl *ctrl) in nvmf_connect_admin_queue() argument
455 nvmf_connect_cmd_prep(ctrl, 0, &cmd); in nvmf_connect_admin_queue()
457 data = nvmf_connect_data_prep(ctrl, 0xffff); in nvmf_connect_admin_queue()
461 ret = __nvme_submit_sync_cmd(ctrl->fabrics_q, &cmd, &res, in nvmf_connect_admin_queue()
467 nvmf_log_connect_error(ctrl, ret, le32_to_cpu(res.u32), in nvmf_connect_admin_queue()
473 ctrl->cntlid = result & 0xFFFF; in nvmf_connect_admin_queue()
477 !ctrl->opts->concat) { in nvmf_connect_admin_queue()
478 dev_warn(ctrl->device, in nvmf_connect_admin_queue()
484 ret = nvme_auth_negotiate(ctrl, 0); in nvmf_connect_admin_queue()
486 dev_warn(ctrl->device, in nvmf_connect_admin_queue()
490 ret = nvme_auth_wait(ctrl, 0); in nvmf_connect_admin_queue()
492 dev_warn(ctrl->device, in nvmf_connect_admin_queue()
496 dev_info(ctrl->device, in nvmf_connect_admin_queue()
525 int nvmf_connect_io_queue(struct nvme_ctrl *ctrl, u16 qid) in nvmf_connect_io_queue() argument
533 nvmf_connect_cmd_prep(ctrl, qid, &cmd); in nvmf_connect_io_queue()
535 data = nvmf_connect_data_prep(ctrl, ctrl->cntlid); in nvmf_connect_io_queue()
539 ret = __nvme_submit_sync_cmd(ctrl->connect_q, &cmd, &res, in nvmf_connect_io_queue()
545 nvmf_log_connect_error(ctrl, ret, le32_to_cpu(res.u32), in nvmf_connect_io_queue()
553 dev_warn(ctrl->device, in nvmf_connect_io_queue()
559 ret = nvme_auth_negotiate(ctrl, qid); in nvmf_connect_io_queue()
561 dev_warn(ctrl->device, in nvmf_connect_io_queue()
565 ret = nvme_auth_wait(ctrl, qid); in nvmf_connect_io_queue()
567 dev_warn(ctrl->device, in nvmf_connect_io_queue()
590 bool nvmf_should_reconnect(struct nvme_ctrl *ctrl, int status) in nvmf_should_reconnect() argument
598 if (ctrl->opts->max_reconnects == -1 || in nvmf_should_reconnect()
599 ctrl->nr_reconnects < ctrl->opts->max_reconnects) in nvmf_should_reconnect()
1156 void nvmf_map_queues(struct blk_mq_tag_set *set, struct nvme_ctrl *ctrl, in nvmf_map_queues() argument
1159 struct nvmf_ctrl_options *opts = ctrl->opts; in nvmf_map_queues()
1191 dev_info(ctrl->device, in nvmf_map_queues()
1219 bool nvmf_ip_options_match(struct nvme_ctrl *ctrl, in nvmf_ip_options_match() argument
1222 if (!nvmf_ctlr_matches_baseopts(ctrl, opts) || in nvmf_ip_options_match()
1223 strcmp(opts->traddr, ctrl->opts->traddr) || in nvmf_ip_options_match()
1224 strcmp(opts->trsvcid, ctrl->opts->trsvcid)) in nvmf_ip_options_match()
1241 (ctrl->opts->mask & NVMF_OPT_HOST_TRADDR)) { in nvmf_ip_options_match()
1242 if (strcmp(opts->host_traddr, ctrl->opts->host_traddr)) in nvmf_ip_options_match()
1245 (ctrl->opts->mask & NVMF_OPT_HOST_TRADDR)) { in nvmf_ip_options_match()
1250 (ctrl->opts->mask & NVMF_OPT_HOST_IFACE)) { in nvmf_ip_options_match()
1251 if (strcmp(opts->host_iface, ctrl->opts->host_iface)) in nvmf_ip_options_match()
1254 (ctrl->opts->mask & NVMF_OPT_HOST_IFACE)) { in nvmf_ip_options_match()
1312 struct nvme_ctrl *ctrl; in nvmf_create_ctrl() local
1359 ctrl = ops->create_ctrl(dev, opts); in nvmf_create_ctrl()
1360 if (IS_ERR(ctrl)) { in nvmf_create_ctrl()
1361 ret = PTR_ERR(ctrl); in nvmf_create_ctrl()
1366 return ctrl; in nvmf_create_ctrl()
1389 struct nvme_ctrl *ctrl; in nvmf_dev_write() local
1406 ctrl = nvmf_create_ctrl(nvmf_device, buf); in nvmf_dev_write()
1407 if (IS_ERR(ctrl)) { in nvmf_dev_write()
1408 ret = PTR_ERR(ctrl); in nvmf_dev_write()
1412 seq_file->private = ctrl; in nvmf_dev_write()
1442 struct nvme_ctrl *ctrl; in nvmf_dev_show() local
1445 ctrl = seq_file->private; in nvmf_dev_show()
1446 if (!ctrl) { in nvmf_dev_show()
1452 ctrl->instance, ctrl->cntlid); in nvmf_dev_show()
1472 struct nvme_ctrl *ctrl = seq_file->private; in nvmf_dev_release() local
1474 if (ctrl) in nvmf_dev_release()
1475 nvme_put_ctrl(ctrl); in nvmf_dev_release()