Lines Matching refs:ctrl
36 struct nvme_fc_ctrl *ctrl; member
100 struct nvme_fc_ctrl *ctrl; member
180 struct nvme_ctrl ctrl; member
184 to_fc_ctrl(struct nvme_ctrl *ctrl) in to_fc_ctrl() argument
186 return container_of(ctrl, struct nvme_fc_ctrl, ctrl); in to_fc_ctrl()
551 nvme_fc_resume_controller(struct nvme_fc_ctrl *ctrl) in nvme_fc_resume_controller() argument
553 switch (nvme_ctrl_state(&ctrl->ctrl)) { in nvme_fc_resume_controller()
560 dev_info(ctrl->ctrl.device, in nvme_fc_resume_controller()
562 "Attempting reconnect\n", ctrl->cnum); in nvme_fc_resume_controller()
564 queue_delayed_work(nvme_wq, &ctrl->connect_work, 0); in nvme_fc_resume_controller()
586 struct nvme_fc_ctrl *ctrl; in nvme_fc_attach_to_suspended_rport() local
622 list_for_each_entry(ctrl, &rport->ctrl_list, ctrl_list) in nvme_fc_attach_to_suspended_rport()
623 nvme_fc_resume_controller(ctrl); in nvme_fc_attach_to_suspended_rport()
783 nvme_fc_ctrl_connectivity_loss(struct nvme_fc_ctrl *ctrl) in nvme_fc_ctrl_connectivity_loss() argument
785 dev_info(ctrl->ctrl.device, in nvme_fc_ctrl_connectivity_loss()
787 "Reconnect", ctrl->cnum); in nvme_fc_ctrl_connectivity_loss()
789 switch (nvme_ctrl_state(&ctrl->ctrl)) { in nvme_fc_ctrl_connectivity_loss()
799 if (nvme_reset_ctrl(&ctrl->ctrl)) { in nvme_fc_ctrl_connectivity_loss()
800 dev_warn(ctrl->ctrl.device, in nvme_fc_ctrl_connectivity_loss()
802 ctrl->cnum); in nvme_fc_ctrl_connectivity_loss()
803 nvme_delete_ctrl(&ctrl->ctrl); in nvme_fc_ctrl_connectivity_loss()
849 struct nvme_fc_ctrl *ctrl; in nvme_fc_unregister_remoteport() local
865 list_for_each_entry(ctrl, &rport->ctrl_list, ctrl_list) { in nvme_fc_unregister_remoteport()
868 dev_warn(ctrl->ctrl.device, in nvme_fc_unregister_remoteport()
870 ctrl->cnum); in nvme_fc_unregister_remoteport()
871 nvme_delete_ctrl(&ctrl->ctrl); in nvme_fc_unregister_remoteport()
873 nvme_fc_ctrl_connectivity_loss(ctrl); in nvme_fc_unregister_remoteport()
1028 static void nvme_fc_error_recovery(struct nvme_fc_ctrl *ctrl, char *errmsg);
1170 nvme_fc_connect_admin_queue(struct nvme_fc_ctrl *ctrl, in nvme_fc_connect_admin_queue() argument
1182 ctrl->lport->ops->lsrqst_priv_sz), GFP_KERNEL); in nvme_fc_connect_admin_queue()
1184 dev_info(ctrl->ctrl.device, in nvme_fc_connect_admin_queue()
1186 ctrl->cnum); in nvme_fc_connect_admin_queue()
1194 if (ctrl->lport->ops->lsrqst_priv_sz) in nvme_fc_connect_admin_queue()
1213 uuid_copy(&assoc_rqst->assoc_cmd.hostid, &ctrl->ctrl.opts->host->id); in nvme_fc_connect_admin_queue()
1214 strncpy(assoc_rqst->assoc_cmd.hostnqn, ctrl->ctrl.opts->host->nqn, in nvme_fc_connect_admin_queue()
1216 strncpy(assoc_rqst->assoc_cmd.subnqn, ctrl->ctrl.opts->subsysnqn, in nvme_fc_connect_admin_queue()
1226 ret = nvme_fc_send_ls_req(ctrl->rport, lsop); in nvme_fc_connect_admin_queue()
1263 dev_err(ctrl->dev, in nvme_fc_connect_admin_queue()
1267 spin_lock_irqsave(&ctrl->lock, flags); in nvme_fc_connect_admin_queue()
1268 ctrl->association_id = in nvme_fc_connect_admin_queue()
1273 spin_unlock_irqrestore(&ctrl->lock, flags); in nvme_fc_connect_admin_queue()
1280 dev_err(ctrl->dev, in nvme_fc_connect_admin_queue()
1287 nvme_fc_connect_queue(struct nvme_fc_ctrl *ctrl, struct nvme_fc_queue *queue, in nvme_fc_connect_queue() argument
1298 ctrl->lport->ops->lsrqst_priv_sz), GFP_KERNEL); in nvme_fc_connect_queue()
1300 dev_info(ctrl->ctrl.device, in nvme_fc_connect_queue()
1302 ctrl->cnum); in nvme_fc_connect_queue()
1310 if (ctrl->lport->ops->lsrqst_priv_sz) in nvme_fc_connect_queue()
1324 conn_rqst->associd.association_id = cpu_to_be64(ctrl->association_id); in nvme_fc_connect_queue()
1341 ret = nvme_fc_send_ls_req(ctrl->rport, lsop); in nvme_fc_connect_queue()
1369 dev_err(ctrl->dev, in nvme_fc_connect_queue()
1382 dev_err(ctrl->dev, in nvme_fc_connect_queue()
1418 nvme_fc_xmt_disconnect_assoc(struct nvme_fc_ctrl *ctrl) in nvme_fc_xmt_disconnect_assoc() argument
1428 ctrl->lport->ops->lsrqst_priv_sz), GFP_KERNEL); in nvme_fc_xmt_disconnect_assoc()
1430 dev_info(ctrl->ctrl.device, in nvme_fc_xmt_disconnect_assoc()
1433 ctrl->cnum); in nvme_fc_xmt_disconnect_assoc()
1440 if (ctrl->lport->ops->lsrqst_priv_sz) in nvme_fc_xmt_disconnect_assoc()
1446 ctrl->association_id); in nvme_fc_xmt_disconnect_assoc()
1448 ret = nvme_fc_send_ls_req_async(ctrl->rport, lsop, in nvme_fc_xmt_disconnect_assoc()
1506 struct nvme_fc_ctrl *ctrl, *ret = NULL; in nvme_fc_match_disconn_ls() local
1513 list_for_each_entry(ctrl, &rport->ctrl_list, ctrl_list) { in nvme_fc_match_disconn_ls()
1514 if (!nvme_fc_ctrl_get(ctrl)) in nvme_fc_match_disconn_ls()
1516 spin_lock(&ctrl->lock); in nvme_fc_match_disconn_ls()
1517 if (association_id == ctrl->association_id) { in nvme_fc_match_disconn_ls()
1518 oldls = ctrl->rcv_disconn; in nvme_fc_match_disconn_ls()
1519 ctrl->rcv_disconn = lsop; in nvme_fc_match_disconn_ls()
1520 ret = ctrl; in nvme_fc_match_disconn_ls()
1522 spin_unlock(&ctrl->lock); in nvme_fc_match_disconn_ls()
1526 nvme_fc_ctrl_put(ctrl); in nvme_fc_match_disconn_ls()
1535 "LS's received\n", ctrl->cnum); in nvme_fc_match_disconn_ls()
1561 struct nvme_fc_ctrl *ctrl = NULL; in nvme_fc_ls_disconnect_assoc() local
1569 ctrl = nvme_fc_match_disconn_ls(rport, lsop); in nvme_fc_ls_disconnect_assoc()
1570 if (!ctrl) in nvme_fc_ls_disconnect_assoc()
1603 nvme_fc_error_recovery(ctrl, "Disconnect Association LS received"); in nvme_fc_ls_disconnect_assoc()
1606 nvme_fc_ctrl_put(ctrl); in nvme_fc_ls_disconnect_assoc()
1821 __nvme_fc_exit_request(struct nvme_fc_ctrl *ctrl, in __nvme_fc_exit_request() argument
1824 fc_dma_unmap_single(ctrl->lport->dev, op->fcp_req.rspdma, in __nvme_fc_exit_request()
1826 fc_dma_unmap_single(ctrl->lport->dev, op->fcp_req.cmddma, in __nvme_fc_exit_request()
1842 __nvme_fc_abort_op(struct nvme_fc_ctrl *ctrl, struct nvme_fc_fcp_op *op) in __nvme_fc_abort_op() argument
1847 spin_lock_irqsave(&ctrl->lock, flags); in __nvme_fc_abort_op()
1851 else if (test_bit(FCCTRL_TERMIO, &ctrl->flags)) { in __nvme_fc_abort_op()
1853 ctrl->iocnt++; in __nvme_fc_abort_op()
1855 spin_unlock_irqrestore(&ctrl->lock, flags); in __nvme_fc_abort_op()
1860 ctrl->lport->ops->fcp_abort(&ctrl->lport->localport, in __nvme_fc_abort_op()
1861 &ctrl->rport->remoteport, in __nvme_fc_abort_op()
1869 nvme_fc_abort_aen_ops(struct nvme_fc_ctrl *ctrl) in nvme_fc_abort_aen_ops() argument
1871 struct nvme_fc_fcp_op *aen_op = ctrl->aen_ops; in nvme_fc_abort_aen_ops()
1879 __nvme_fc_abort_op(ctrl, aen_op); in nvme_fc_abort_aen_ops()
1883 __nvme_fc_fcpop_chk_teardowns(struct nvme_fc_ctrl *ctrl, in __nvme_fc_fcpop_chk_teardowns() argument
1889 spin_lock_irqsave(&ctrl->lock, flags); in __nvme_fc_fcpop_chk_teardowns()
1890 if (test_bit(FCCTRL_TERMIO, &ctrl->flags) && in __nvme_fc_fcpop_chk_teardowns()
1892 if (!--ctrl->iocnt) in __nvme_fc_fcpop_chk_teardowns()
1893 wake_up(&ctrl->ioabort_wait); in __nvme_fc_fcpop_chk_teardowns()
1895 spin_unlock_irqrestore(&ctrl->lock, flags); in __nvme_fc_fcpop_chk_teardowns()
1902 struct nvme_fc_ctrl *ctrl = in nvme_fc_ctrl_ioerr_work() local
1905 nvme_fc_error_recovery(ctrl, "transport detected io error"); in nvme_fc_ctrl_ioerr_work()
1932 struct nvme_fc_ctrl *ctrl = op->ctrl; in nvme_fc_fcpio_done() local
1980 fc_dma_sync_single_for_cpu(ctrl->lport->dev, op->fcp_req.rspdma, in nvme_fc_fcpio_done()
1987 dev_info(ctrl->ctrl.device, in nvme_fc_fcpio_done()
1989 ctrl->cnum, freq->status); in nvme_fc_fcpio_done()
2019 dev_info(ctrl->ctrl.device, in nvme_fc_fcpio_done()
2022 ctrl->cnum, freq->transferred_length, in nvme_fc_fcpio_done()
2041 dev_info(ctrl->ctrl.device, in nvme_fc_fcpio_done()
2045 ctrl->cnum, be16_to_cpu(op->rsp_iu.iu_len), in nvme_fc_fcpio_done()
2059 dev_info(ctrl->ctrl.device, in nvme_fc_fcpio_done()
2062 ctrl->cnum, freq->rcv_rsplen); in nvme_fc_fcpio_done()
2070 nvme_complete_async_event(&queue->ctrl->ctrl, status, &result); in nvme_fc_fcpio_done()
2071 __nvme_fc_fcpop_chk_teardowns(ctrl, op, opstate); in nvme_fc_fcpio_done()
2074 nvme_fc_ctrl_put(ctrl); in nvme_fc_fcpio_done()
2078 __nvme_fc_fcpop_chk_teardowns(ctrl, op, opstate); in nvme_fc_fcpio_done()
2083 if (terminate_assoc && ctrl->ctrl.state != NVME_CTRL_RESETTING) in nvme_fc_fcpio_done()
2084 queue_work(nvme_reset_wq, &ctrl->ioerr_work); in nvme_fc_fcpio_done()
2088 __nvme_fc_init_request(struct nvme_fc_ctrl *ctrl, in __nvme_fc_init_request() argument
2103 op->ctrl = ctrl; in __nvme_fc_init_request()
2117 op->fcp_req.cmddma = fc_dma_map_single(ctrl->lport->dev, in __nvme_fc_init_request()
2119 if (fc_dma_mapping_error(ctrl->lport->dev, op->fcp_req.cmddma)) { in __nvme_fc_init_request()
2120 dev_err(ctrl->dev, in __nvme_fc_init_request()
2126 op->fcp_req.rspdma = fc_dma_map_single(ctrl->lport->dev, in __nvme_fc_init_request()
2129 if (fc_dma_mapping_error(ctrl->lport->dev, op->fcp_req.rspdma)) { in __nvme_fc_init_request()
2130 dev_err(ctrl->dev, in __nvme_fc_init_request()
2144 struct nvme_fc_ctrl *ctrl = to_fc_ctrl(set->driver_data); in nvme_fc_init_request() local
2146 int queue_idx = (set == &ctrl->tag_set) ? hctx_idx + 1 : 0; in nvme_fc_init_request()
2147 struct nvme_fc_queue *queue = &ctrl->queues[queue_idx]; in nvme_fc_init_request()
2150 res = __nvme_fc_init_request(ctrl, queue, &op->op, rq, queue->rqcnt++); in nvme_fc_init_request()
2155 nvme_req(rq)->ctrl = &ctrl->ctrl; in nvme_fc_init_request()
2161 nvme_fc_init_aen_ops(struct nvme_fc_ctrl *ctrl) in nvme_fc_init_aen_ops() argument
2169 aen_op = ctrl->aen_ops; in nvme_fc_init_aen_ops()
2171 if (ctrl->lport->ops->fcprqst_priv_sz) { in nvme_fc_init_aen_ops()
2172 private = kzalloc(ctrl->lport->ops->fcprqst_priv_sz, in nvme_fc_init_aen_ops()
2180 ret = __nvme_fc_init_request(ctrl, &ctrl->queues[0], in nvme_fc_init_aen_ops()
2200 nvme_fc_term_aen_ops(struct nvme_fc_ctrl *ctrl) in nvme_fc_term_aen_ops() argument
2205 cancel_work_sync(&ctrl->ctrl.async_event_work); in nvme_fc_term_aen_ops()
2206 aen_op = ctrl->aen_ops; in nvme_fc_term_aen_ops()
2208 __nvme_fc_exit_request(ctrl, aen_op); in nvme_fc_term_aen_ops()
2218 struct nvme_fc_ctrl *ctrl = to_fc_ctrl(data); in __nvme_fc_init_hctx() local
2219 struct nvme_fc_queue *queue = &ctrl->queues[qidx]; in __nvme_fc_init_hctx()
2240 nvme_fc_init_queue(struct nvme_fc_ctrl *ctrl, int idx) in nvme_fc_init_queue() argument
2244 queue = &ctrl->queues[idx]; in nvme_fc_init_queue()
2246 queue->ctrl = ctrl; in nvme_fc_init_queue()
2249 queue->dev = ctrl->dev; in nvme_fc_init_queue()
2252 queue->cmnd_capsule_len = ctrl->ctrl.ioccsz * 16; in nvme_fc_init_queue()
2294 __nvme_fc_delete_hw_queue(struct nvme_fc_ctrl *ctrl, in __nvme_fc_delete_hw_queue() argument
2297 if (ctrl->lport->ops->delete_queue) in __nvme_fc_delete_hw_queue()
2298 ctrl->lport->ops->delete_queue(&ctrl->lport->localport, qidx, in __nvme_fc_delete_hw_queue()
2304 nvme_fc_free_io_queues(struct nvme_fc_ctrl *ctrl) in nvme_fc_free_io_queues() argument
2308 for (i = 1; i < ctrl->ctrl.queue_count; i++) in nvme_fc_free_io_queues()
2309 nvme_fc_free_queue(&ctrl->queues[i]); in nvme_fc_free_io_queues()
2313 __nvme_fc_create_hw_queue(struct nvme_fc_ctrl *ctrl, in __nvme_fc_create_hw_queue() argument
2319 if (ctrl->lport->ops->create_queue) in __nvme_fc_create_hw_queue()
2320 ret = ctrl->lport->ops->create_queue(&ctrl->lport->localport, in __nvme_fc_create_hw_queue()
2327 nvme_fc_delete_hw_io_queues(struct nvme_fc_ctrl *ctrl) in nvme_fc_delete_hw_io_queues() argument
2329 struct nvme_fc_queue *queue = &ctrl->queues[ctrl->ctrl.queue_count - 1]; in nvme_fc_delete_hw_io_queues()
2332 for (i = ctrl->ctrl.queue_count - 1; i >= 1; i--, queue--) in nvme_fc_delete_hw_io_queues()
2333 __nvme_fc_delete_hw_queue(ctrl, queue, i); in nvme_fc_delete_hw_io_queues()
2337 nvme_fc_create_hw_io_queues(struct nvme_fc_ctrl *ctrl, u16 qsize) in nvme_fc_create_hw_io_queues() argument
2339 struct nvme_fc_queue *queue = &ctrl->queues[1]; in nvme_fc_create_hw_io_queues()
2342 for (i = 1; i < ctrl->ctrl.queue_count; i++, queue++) { in nvme_fc_create_hw_io_queues()
2343 ret = __nvme_fc_create_hw_queue(ctrl, queue, i, qsize); in nvme_fc_create_hw_io_queues()
2352 __nvme_fc_delete_hw_queue(ctrl, &ctrl->queues[i], i); in nvme_fc_create_hw_io_queues()
2357 nvme_fc_connect_io_queues(struct nvme_fc_ctrl *ctrl, u16 qsize) in nvme_fc_connect_io_queues() argument
2361 for (i = 1; i < ctrl->ctrl.queue_count; i++) { in nvme_fc_connect_io_queues()
2362 ret = nvme_fc_connect_queue(ctrl, &ctrl->queues[i], qsize, in nvme_fc_connect_io_queues()
2366 ret = nvmf_connect_io_queue(&ctrl->ctrl, i); in nvme_fc_connect_io_queues()
2370 set_bit(NVME_FC_Q_LIVE, &ctrl->queues[i].flags); in nvme_fc_connect_io_queues()
2377 nvme_fc_init_io_queues(struct nvme_fc_ctrl *ctrl) in nvme_fc_init_io_queues() argument
2381 for (i = 1; i < ctrl->ctrl.queue_count; i++) in nvme_fc_init_io_queues()
2382 nvme_fc_init_queue(ctrl, i); in nvme_fc_init_io_queues()
2388 struct nvme_fc_ctrl *ctrl = in nvme_fc_ctrl_free() local
2392 if (ctrl->ctrl.tagset) in nvme_fc_ctrl_free()
2393 nvme_remove_io_tag_set(&ctrl->ctrl); in nvme_fc_ctrl_free()
2396 spin_lock_irqsave(&ctrl->rport->lock, flags); in nvme_fc_ctrl_free()
2397 list_del(&ctrl->ctrl_list); in nvme_fc_ctrl_free()
2398 spin_unlock_irqrestore(&ctrl->rport->lock, flags); in nvme_fc_ctrl_free()
2400 nvme_unquiesce_admin_queue(&ctrl->ctrl); in nvme_fc_ctrl_free()
2401 nvme_remove_admin_tag_set(&ctrl->ctrl); in nvme_fc_ctrl_free()
2403 kfree(ctrl->queues); in nvme_fc_ctrl_free()
2405 put_device(ctrl->dev); in nvme_fc_ctrl_free()
2406 nvme_fc_rport_put(ctrl->rport); in nvme_fc_ctrl_free()
2408 ida_free(&nvme_fc_ctrl_cnt, ctrl->cnum); in nvme_fc_ctrl_free()
2409 if (ctrl->ctrl.opts) in nvme_fc_ctrl_free()
2410 nvmf_free_options(ctrl->ctrl.opts); in nvme_fc_ctrl_free()
2411 kfree(ctrl); in nvme_fc_ctrl_free()
2415 nvme_fc_ctrl_put(struct nvme_fc_ctrl *ctrl) in nvme_fc_ctrl_put() argument
2417 kref_put(&ctrl->ref, nvme_fc_ctrl_free); in nvme_fc_ctrl_put()
2421 nvme_fc_ctrl_get(struct nvme_fc_ctrl *ctrl) in nvme_fc_ctrl_get() argument
2423 return kref_get_unless_zero(&ctrl->ref); in nvme_fc_ctrl_get()
2433 struct nvme_fc_ctrl *ctrl = to_fc_ctrl(nctrl); in nvme_fc_nvme_ctrl_freed() local
2435 WARN_ON(nctrl != &ctrl->ctrl); in nvme_fc_nvme_ctrl_freed()
2437 nvme_fc_ctrl_put(ctrl); in nvme_fc_nvme_ctrl_freed()
2456 struct nvme_fc_ctrl *ctrl = to_fc_ctrl(nctrl); in nvme_fc_terminate_exchange() local
2460 __nvme_fc_abort_op(ctrl, op); in nvme_fc_terminate_exchange()
2474 __nvme_fc_abort_outstanding_ios(struct nvme_fc_ctrl *ctrl, bool start_queues) in __nvme_fc_abort_outstanding_ios() argument
2482 if (ctrl->ctrl.queue_count > 1) { in __nvme_fc_abort_outstanding_ios()
2483 for (q = 1; q < ctrl->ctrl.queue_count; q++) in __nvme_fc_abort_outstanding_ios()
2484 clear_bit(NVME_FC_Q_LIVE, &ctrl->queues[q].flags); in __nvme_fc_abort_outstanding_ios()
2486 clear_bit(NVME_FC_Q_LIVE, &ctrl->queues[0].flags); in __nvme_fc_abort_outstanding_ios()
2500 if (ctrl->ctrl.queue_count > 1) { in __nvme_fc_abort_outstanding_ios()
2501 nvme_quiesce_io_queues(&ctrl->ctrl); in __nvme_fc_abort_outstanding_ios()
2502 nvme_sync_io_queues(&ctrl->ctrl); in __nvme_fc_abort_outstanding_ios()
2503 blk_mq_tagset_busy_iter(&ctrl->tag_set, in __nvme_fc_abort_outstanding_ios()
2504 nvme_fc_terminate_exchange, &ctrl->ctrl); in __nvme_fc_abort_outstanding_ios()
2505 blk_mq_tagset_wait_completed_request(&ctrl->tag_set); in __nvme_fc_abort_outstanding_ios()
2507 nvme_unquiesce_io_queues(&ctrl->ctrl); in __nvme_fc_abort_outstanding_ios()
2525 nvme_quiesce_admin_queue(&ctrl->ctrl); in __nvme_fc_abort_outstanding_ios()
2526 blk_sync_queue(ctrl->ctrl.admin_q); in __nvme_fc_abort_outstanding_ios()
2527 blk_mq_tagset_busy_iter(&ctrl->admin_tag_set, in __nvme_fc_abort_outstanding_ios()
2528 nvme_fc_terminate_exchange, &ctrl->ctrl); in __nvme_fc_abort_outstanding_ios()
2529 blk_mq_tagset_wait_completed_request(&ctrl->admin_tag_set); in __nvme_fc_abort_outstanding_ios()
2531 nvme_unquiesce_admin_queue(&ctrl->ctrl); in __nvme_fc_abort_outstanding_ios()
2535 nvme_fc_error_recovery(struct nvme_fc_ctrl *ctrl, char *errmsg) in nvme_fc_error_recovery() argument
2544 if (ctrl->ctrl.state == NVME_CTRL_CONNECTING) { in nvme_fc_error_recovery()
2545 __nvme_fc_abort_outstanding_ios(ctrl, true); in nvme_fc_error_recovery()
2546 set_bit(ASSOC_FAILED, &ctrl->flags); in nvme_fc_error_recovery()
2547 dev_warn(ctrl->ctrl.device, in nvme_fc_error_recovery()
2549 ctrl->cnum); in nvme_fc_error_recovery()
2554 if (ctrl->ctrl.state != NVME_CTRL_LIVE) in nvme_fc_error_recovery()
2557 dev_warn(ctrl->ctrl.device, in nvme_fc_error_recovery()
2559 ctrl->cnum, errmsg); in nvme_fc_error_recovery()
2560 dev_warn(ctrl->ctrl.device, in nvme_fc_error_recovery()
2561 "NVME-FC{%d}: resetting controller\n", ctrl->cnum); in nvme_fc_error_recovery()
2563 nvme_reset_ctrl(&ctrl->ctrl); in nvme_fc_error_recovery()
2569 struct nvme_fc_ctrl *ctrl = op->ctrl; in nvme_fc_timeout() local
2577 dev_info(ctrl->ctrl.device, in nvme_fc_timeout()
2580 ctrl->cnum, op->queue->qnum, sqe->common.opcode, in nvme_fc_timeout()
2582 if (__nvme_fc_abort_op(ctrl, op)) in nvme_fc_timeout()
2583 nvme_fc_error_recovery(ctrl, "io timeout abort failed"); in nvme_fc_timeout()
2594 nvme_fc_map_data(struct nvme_fc_ctrl *ctrl, struct request *rq, in nvme_fc_map_data() argument
2614 freq->sg_cnt = fc_dma_map_sg(ctrl->lport->dev, freq->sg_table.sgl, in nvme_fc_map_data()
2629 nvme_fc_unmap_data(struct nvme_fc_ctrl *ctrl, struct request *rq, in nvme_fc_unmap_data() argument
2637 fc_dma_unmap_sg(ctrl->lport->dev, freq->sg_table.sgl, op->nents, in nvme_fc_unmap_data()
2669 nvme_fc_start_fcp_op(struct nvme_fc_ctrl *ctrl, struct nvme_fc_queue *queue, in nvme_fc_start_fcp_op() argument
2681 if (ctrl->rport->remoteport.port_state != FC_OBJSTATE_ONLINE) in nvme_fc_start_fcp_op()
2684 if (!nvme_fc_ctrl_get(ctrl)) in nvme_fc_start_fcp_op()
2728 ret = nvme_fc_map_data(ctrl, op->rq, op); in nvme_fc_start_fcp_op()
2731 nvme_fc_ctrl_put(ctrl); in nvme_fc_start_fcp_op()
2738 fc_dma_sync_single_for_device(ctrl->lport->dev, op->fcp_req.cmddma, in nvme_fc_start_fcp_op()
2747 ret = ctrl->lport->ops->fcp_io(&ctrl->lport->localport, in nvme_fc_start_fcp_op()
2748 &ctrl->rport->remoteport, in nvme_fc_start_fcp_op()
2765 __nvme_fc_fcpop_chk_teardowns(ctrl, op, opstate); in nvme_fc_start_fcp_op()
2768 nvme_fc_unmap_data(ctrl, op->rq, op); in nvme_fc_start_fcp_op()
2772 nvme_fc_ctrl_put(ctrl); in nvme_fc_start_fcp_op()
2774 if (ctrl->rport->remoteport.port_state == FC_OBJSTATE_ONLINE && in nvme_fc_start_fcp_op()
2790 struct nvme_fc_ctrl *ctrl = queue->ctrl; in nvme_fc_queue_rq() local
2798 if (ctrl->rport->remoteport.port_state != FC_OBJSTATE_ONLINE || in nvme_fc_queue_rq()
2799 !nvme_check_ready(&queue->ctrl->ctrl, rq, queue_ready)) in nvme_fc_queue_rq()
2800 return nvme_fail_nonready_command(&queue->ctrl->ctrl, rq); in nvme_fc_queue_rq()
2824 return nvme_fc_start_fcp_op(ctrl, queue, op, data_len, io_dir); in nvme_fc_queue_rq()
2830 struct nvme_fc_ctrl *ctrl = to_fc_ctrl(arg); in nvme_fc_submit_async_event() local
2834 if (test_bit(FCCTRL_TERMIO, &ctrl->flags)) in nvme_fc_submit_async_event()
2837 aen_op = &ctrl->aen_ops[0]; in nvme_fc_submit_async_event()
2839 ret = nvme_fc_start_fcp_op(ctrl, aen_op->queue, aen_op, 0, in nvme_fc_submit_async_event()
2842 dev_err(ctrl->ctrl.device, in nvme_fc_submit_async_event()
2850 struct nvme_fc_ctrl *ctrl = op->ctrl; in nvme_fc_complete_rq() local
2855 nvme_fc_unmap_data(ctrl, rq, op); in nvme_fc_complete_rq()
2857 nvme_fc_ctrl_put(ctrl); in nvme_fc_complete_rq()
2862 struct nvme_fc_ctrl *ctrl = to_fc_ctrl(set->driver_data); in nvme_fc_map_queues() local
2874 if (ctrl->lport->ops->map_queues) in nvme_fc_map_queues()
2875 ctrl->lport->ops->map_queues(&ctrl->lport->localport, in nvme_fc_map_queues()
2893 nvme_fc_create_io_queues(struct nvme_fc_ctrl *ctrl) in nvme_fc_create_io_queues() argument
2895 struct nvmf_ctrl_options *opts = ctrl->ctrl.opts; in nvme_fc_create_io_queues()
2900 ctrl->lport->ops->max_hw_queues); in nvme_fc_create_io_queues()
2901 ret = nvme_set_queue_count(&ctrl->ctrl, &nr_io_queues); in nvme_fc_create_io_queues()
2903 dev_info(ctrl->ctrl.device, in nvme_fc_create_io_queues()
2908 ctrl->ctrl.queue_count = nr_io_queues + 1; in nvme_fc_create_io_queues()
2912 nvme_fc_init_io_queues(ctrl); in nvme_fc_create_io_queues()
2914 ret = nvme_alloc_io_tag_set(&ctrl->ctrl, &ctrl->tag_set, in nvme_fc_create_io_queues()
2917 ctrl->lport->ops->fcprqst_priv_sz)); in nvme_fc_create_io_queues()
2921 ret = nvme_fc_create_hw_io_queues(ctrl, ctrl->ctrl.sqsize + 1); in nvme_fc_create_io_queues()
2925 ret = nvme_fc_connect_io_queues(ctrl, ctrl->ctrl.sqsize + 1); in nvme_fc_create_io_queues()
2929 ctrl->ioq_live = true; in nvme_fc_create_io_queues()
2934 nvme_fc_delete_hw_io_queues(ctrl); in nvme_fc_create_io_queues()
2936 nvme_remove_io_tag_set(&ctrl->ctrl); in nvme_fc_create_io_queues()
2937 nvme_fc_free_io_queues(ctrl); in nvme_fc_create_io_queues()
2940 ctrl->ctrl.tagset = NULL; in nvme_fc_create_io_queues()
2946 nvme_fc_recreate_io_queues(struct nvme_fc_ctrl *ctrl) in nvme_fc_recreate_io_queues() argument
2948 struct nvmf_ctrl_options *opts = ctrl->ctrl.opts; in nvme_fc_recreate_io_queues()
2949 u32 prior_ioq_cnt = ctrl->ctrl.queue_count - 1; in nvme_fc_recreate_io_queues()
2954 ctrl->lport->ops->max_hw_queues); in nvme_fc_recreate_io_queues()
2955 ret = nvme_set_queue_count(&ctrl->ctrl, &nr_io_queues); in nvme_fc_recreate_io_queues()
2957 dev_info(ctrl->ctrl.device, in nvme_fc_recreate_io_queues()
2963 dev_info(ctrl->ctrl.device, in nvme_fc_recreate_io_queues()
2969 ctrl->ctrl.queue_count = nr_io_queues + 1; in nvme_fc_recreate_io_queues()
2971 if (ctrl->ctrl.queue_count == 1) in nvme_fc_recreate_io_queues()
2975 dev_info(ctrl->ctrl.device, in nvme_fc_recreate_io_queues()
2978 blk_mq_update_nr_hw_queues(&ctrl->tag_set, nr_io_queues); in nvme_fc_recreate_io_queues()
2981 ret = nvme_fc_create_hw_io_queues(ctrl, ctrl->ctrl.sqsize + 1); in nvme_fc_recreate_io_queues()
2985 ret = nvme_fc_connect_io_queues(ctrl, ctrl->ctrl.sqsize + 1); in nvme_fc_recreate_io_queues()
2992 nvme_fc_delete_hw_io_queues(ctrl); in nvme_fc_recreate_io_queues()
2994 nvme_fc_free_io_queues(ctrl); in nvme_fc_recreate_io_queues()
3018 nvme_fc_ctlr_active_on_rport(struct nvme_fc_ctrl *ctrl) in nvme_fc_ctlr_active_on_rport() argument
3020 struct nvme_fc_rport *rport = ctrl->rport; in nvme_fc_ctlr_active_on_rport()
3023 if (test_and_set_bit(ASSOC_ACTIVE, &ctrl->flags)) in nvme_fc_ctlr_active_on_rport()
3034 nvme_fc_ctlr_inactive_on_rport(struct nvme_fc_ctrl *ctrl) in nvme_fc_ctlr_inactive_on_rport() argument
3036 struct nvme_fc_rport *rport = ctrl->rport; in nvme_fc_ctlr_inactive_on_rport()
3057 nvme_fc_create_association(struct nvme_fc_ctrl *ctrl) in nvme_fc_create_association() argument
3059 struct nvmf_ctrl_options *opts = ctrl->ctrl.opts; in nvme_fc_create_association()
3065 ++ctrl->ctrl.nr_reconnects; in nvme_fc_create_association()
3067 if (ctrl->rport->remoteport.port_state != FC_OBJSTATE_ONLINE) in nvme_fc_create_association()
3070 if (nvme_fc_ctlr_active_on_rport(ctrl)) in nvme_fc_create_association()
3073 dev_info(ctrl->ctrl.device, in nvme_fc_create_association()
3076 ctrl->cnum, ctrl->lport->localport.port_name, in nvme_fc_create_association()
3077 ctrl->rport->remoteport.port_name, ctrl->ctrl.opts->subsysnqn); in nvme_fc_create_association()
3079 clear_bit(ASSOC_FAILED, &ctrl->flags); in nvme_fc_create_association()
3085 ret = __nvme_fc_create_hw_queue(ctrl, &ctrl->queues[0], 0, in nvme_fc_create_association()
3090 ret = nvme_fc_connect_admin_queue(ctrl, &ctrl->queues[0], in nvme_fc_create_association()
3095 ret = nvmf_connect_admin_queue(&ctrl->ctrl); in nvme_fc_create_association()
3099 set_bit(NVME_FC_Q_LIVE, &ctrl->queues[0].flags); in nvme_fc_create_association()
3108 ret = nvme_enable_ctrl(&ctrl->ctrl); in nvme_fc_create_association()
3109 if (!ret && test_bit(ASSOC_FAILED, &ctrl->flags)) in nvme_fc_create_association()
3114 ctrl->ctrl.max_segments = ctrl->lport->ops->max_sgl_segments; in nvme_fc_create_association()
3115 ctrl->ctrl.max_hw_sectors = ctrl->ctrl.max_segments << in nvme_fc_create_association()
3118 nvme_unquiesce_admin_queue(&ctrl->ctrl); in nvme_fc_create_association()
3120 ret = nvme_init_ctrl_finish(&ctrl->ctrl, false); in nvme_fc_create_association()
3121 if (!ret && test_bit(ASSOC_FAILED, &ctrl->flags)) in nvme_fc_create_association()
3129 if (ctrl->ctrl.icdoff) { in nvme_fc_create_association()
3130 dev_err(ctrl->ctrl.device, "icdoff %d is not supported!\n", in nvme_fc_create_association()
3131 ctrl->ctrl.icdoff); in nvme_fc_create_association()
3137 if (!nvme_ctrl_sgl_supported(&ctrl->ctrl)) { in nvme_fc_create_association()
3138 dev_err(ctrl->ctrl.device, in nvme_fc_create_association()
3144 if (opts->queue_size > ctrl->ctrl.maxcmd) { in nvme_fc_create_association()
3146 dev_warn(ctrl->ctrl.device, in nvme_fc_create_association()
3149 opts->queue_size, ctrl->ctrl.maxcmd); in nvme_fc_create_association()
3150 opts->queue_size = ctrl->ctrl.maxcmd; in nvme_fc_create_association()
3151 ctrl->ctrl.sqsize = opts->queue_size - 1; in nvme_fc_create_association()
3154 ret = nvme_fc_init_aen_ops(ctrl); in nvme_fc_create_association()
3162 if (ctrl->ctrl.queue_count > 1) { in nvme_fc_create_association()
3163 if (!ctrl->ioq_live) in nvme_fc_create_association()
3164 ret = nvme_fc_create_io_queues(ctrl); in nvme_fc_create_association()
3166 ret = nvme_fc_recreate_io_queues(ctrl); in nvme_fc_create_association()
3168 if (!ret && test_bit(ASSOC_FAILED, &ctrl->flags)) in nvme_fc_create_association()
3173 changed = nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_LIVE); in nvme_fc_create_association()
3175 ctrl->ctrl.nr_reconnects = 0; in nvme_fc_create_association()
3178 nvme_start_ctrl(&ctrl->ctrl); in nvme_fc_create_association()
3183 nvme_fc_term_aen_ops(ctrl); in nvme_fc_create_association()
3185 dev_warn(ctrl->ctrl.device, in nvme_fc_create_association()
3187 ctrl->cnum, ctrl->association_id, ret); in nvme_fc_create_association()
3189 nvme_fc_xmt_disconnect_assoc(ctrl); in nvme_fc_create_association()
3190 spin_lock_irqsave(&ctrl->lock, flags); in nvme_fc_create_association()
3191 ctrl->association_id = 0; in nvme_fc_create_association()
3192 disls = ctrl->rcv_disconn; in nvme_fc_create_association()
3193 ctrl->rcv_disconn = NULL; in nvme_fc_create_association()
3194 spin_unlock_irqrestore(&ctrl->lock, flags); in nvme_fc_create_association()
3198 __nvme_fc_delete_hw_queue(ctrl, &ctrl->queues[0], 0); in nvme_fc_create_association()
3200 nvme_fc_free_queue(&ctrl->queues[0]); in nvme_fc_create_association()
3201 clear_bit(ASSOC_ACTIVE, &ctrl->flags); in nvme_fc_create_association()
3202 nvme_fc_ctlr_inactive_on_rport(ctrl); in nvme_fc_create_association()
3215 nvme_fc_delete_association(struct nvme_fc_ctrl *ctrl) in nvme_fc_delete_association() argument
3220 if (!test_and_clear_bit(ASSOC_ACTIVE, &ctrl->flags)) in nvme_fc_delete_association()
3223 spin_lock_irqsave(&ctrl->lock, flags); in nvme_fc_delete_association()
3224 set_bit(FCCTRL_TERMIO, &ctrl->flags); in nvme_fc_delete_association()
3225 ctrl->iocnt = 0; in nvme_fc_delete_association()
3226 spin_unlock_irqrestore(&ctrl->lock, flags); in nvme_fc_delete_association()
3228 __nvme_fc_abort_outstanding_ios(ctrl, false); in nvme_fc_delete_association()
3231 nvme_fc_abort_aen_ops(ctrl); in nvme_fc_delete_association()
3234 spin_lock_irq(&ctrl->lock); in nvme_fc_delete_association()
3235 wait_event_lock_irq(ctrl->ioabort_wait, ctrl->iocnt == 0, ctrl->lock); in nvme_fc_delete_association()
3236 clear_bit(FCCTRL_TERMIO, &ctrl->flags); in nvme_fc_delete_association()
3237 spin_unlock_irq(&ctrl->lock); in nvme_fc_delete_association()
3239 nvme_fc_term_aen_ops(ctrl); in nvme_fc_delete_association()
3247 if (ctrl->association_id) in nvme_fc_delete_association()
3248 nvme_fc_xmt_disconnect_assoc(ctrl); in nvme_fc_delete_association()
3250 spin_lock_irqsave(&ctrl->lock, flags); in nvme_fc_delete_association()
3251 ctrl->association_id = 0; in nvme_fc_delete_association()
3252 disls = ctrl->rcv_disconn; in nvme_fc_delete_association()
3253 ctrl->rcv_disconn = NULL; in nvme_fc_delete_association()
3254 spin_unlock_irqrestore(&ctrl->lock, flags); in nvme_fc_delete_association()
3262 if (ctrl->ctrl.tagset) { in nvme_fc_delete_association()
3263 nvme_fc_delete_hw_io_queues(ctrl); in nvme_fc_delete_association()
3264 nvme_fc_free_io_queues(ctrl); in nvme_fc_delete_association()
3267 __nvme_fc_delete_hw_queue(ctrl, &ctrl->queues[0], 0); in nvme_fc_delete_association()
3268 nvme_fc_free_queue(&ctrl->queues[0]); in nvme_fc_delete_association()
3271 nvme_unquiesce_admin_queue(&ctrl->ctrl); in nvme_fc_delete_association()
3274 nvme_unquiesce_io_queues(&ctrl->ctrl); in nvme_fc_delete_association()
3276 nvme_fc_ctlr_inactive_on_rport(ctrl); in nvme_fc_delete_association()
3282 struct nvme_fc_ctrl *ctrl = to_fc_ctrl(nctrl); in nvme_fc_delete_ctrl() local
3284 cancel_work_sync(&ctrl->ioerr_work); in nvme_fc_delete_ctrl()
3285 cancel_delayed_work_sync(&ctrl->connect_work); in nvme_fc_delete_ctrl()
3290 nvme_fc_delete_association(ctrl); in nvme_fc_delete_ctrl()
3294 nvme_fc_reconnect_or_delete(struct nvme_fc_ctrl *ctrl, int status) in nvme_fc_reconnect_or_delete() argument
3296 struct nvme_fc_rport *rport = ctrl->rport; in nvme_fc_reconnect_or_delete()
3298 unsigned long recon_delay = ctrl->ctrl.opts->reconnect_delay * HZ; in nvme_fc_reconnect_or_delete()
3301 if (nvme_ctrl_state(&ctrl->ctrl) != NVME_CTRL_CONNECTING) in nvme_fc_reconnect_or_delete()
3305 dev_info(ctrl->ctrl.device, in nvme_fc_reconnect_or_delete()
3307 ctrl->cnum, status); in nvme_fc_reconnect_or_delete()
3313 if (recon && nvmf_should_reconnect(&ctrl->ctrl)) { in nvme_fc_reconnect_or_delete()
3315 dev_info(ctrl->ctrl.device, in nvme_fc_reconnect_or_delete()
3318 ctrl->cnum, recon_delay / HZ); in nvme_fc_reconnect_or_delete()
3322 queue_delayed_work(nvme_wq, &ctrl->connect_work, recon_delay); in nvme_fc_reconnect_or_delete()
3326 dev_warn(ctrl->ctrl.device, in nvme_fc_reconnect_or_delete()
3328 ctrl->cnum); in nvme_fc_reconnect_or_delete()
3330 dev_warn(ctrl->ctrl.device, in nvme_fc_reconnect_or_delete()
3333 ctrl->cnum, ctrl->ctrl.nr_reconnects); in nvme_fc_reconnect_or_delete()
3335 dev_warn(ctrl->ctrl.device, in nvme_fc_reconnect_or_delete()
3338 ctrl->cnum, min_t(int, portptr->dev_loss_tmo, in nvme_fc_reconnect_or_delete()
3339 (ctrl->ctrl.opts->max_reconnects * in nvme_fc_reconnect_or_delete()
3340 ctrl->ctrl.opts->reconnect_delay))); in nvme_fc_reconnect_or_delete()
3341 WARN_ON(nvme_delete_ctrl(&ctrl->ctrl)); in nvme_fc_reconnect_or_delete()
3348 struct nvme_fc_ctrl *ctrl = in nvme_fc_reset_ctrl_work() local
3349 container_of(work, struct nvme_fc_ctrl, ctrl.reset_work); in nvme_fc_reset_ctrl_work()
3351 nvme_stop_ctrl(&ctrl->ctrl); in nvme_fc_reset_ctrl_work()
3354 nvme_fc_delete_association(ctrl); in nvme_fc_reset_ctrl_work()
3356 if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_CONNECTING)) in nvme_fc_reset_ctrl_work()
3357 dev_err(ctrl->ctrl.device, in nvme_fc_reset_ctrl_work()
3359 "to CONNECTING\n", ctrl->cnum); in nvme_fc_reset_ctrl_work()
3361 if (ctrl->rport->remoteport.port_state == FC_OBJSTATE_ONLINE) { in nvme_fc_reset_ctrl_work()
3362 if (!queue_delayed_work(nvme_wq, &ctrl->connect_work, 0)) { in nvme_fc_reset_ctrl_work()
3363 dev_err(ctrl->ctrl.device, in nvme_fc_reset_ctrl_work()
3365 "after reset\n", ctrl->cnum); in nvme_fc_reset_ctrl_work()
3367 flush_delayed_work(&ctrl->connect_work); in nvme_fc_reset_ctrl_work()
3370 nvme_fc_reconnect_or_delete(ctrl, -ENOTCONN); in nvme_fc_reset_ctrl_work()
3393 struct nvme_fc_ctrl *ctrl = in nvme_fc_connect_ctrl_work() local
3397 ret = nvme_fc_create_association(ctrl); in nvme_fc_connect_ctrl_work()
3399 nvme_fc_reconnect_or_delete(ctrl, ret); in nvme_fc_connect_ctrl_work()
3401 dev_info(ctrl->ctrl.device, in nvme_fc_connect_ctrl_work()
3403 ctrl->cnum); in nvme_fc_connect_ctrl_work()
3429 struct nvme_fc_ctrl *ctrl; in nvme_fc_existing_controller() local
3434 list_for_each_entry(ctrl, &rport->ctrl_list, ctrl_list) { in nvme_fc_existing_controller()
3435 found = nvmf_ctlr_matches_baseopts(&ctrl->ctrl, opts); in nvme_fc_existing_controller()
3448 struct nvme_fc_ctrl *ctrl; in nvme_fc_init_ctrl() local
3464 ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL); in nvme_fc_init_ctrl()
3465 if (!ctrl) { in nvme_fc_init_ctrl()
3489 ctrl->ctrl.opts = opts; in nvme_fc_init_ctrl()
3490 ctrl->ctrl.nr_reconnects = 0; in nvme_fc_init_ctrl()
3492 ctrl->ctrl.numa_node = dev_to_node(lport->dev); in nvme_fc_init_ctrl()
3494 ctrl->ctrl.numa_node = NUMA_NO_NODE; in nvme_fc_init_ctrl()
3495 INIT_LIST_HEAD(&ctrl->ctrl_list); in nvme_fc_init_ctrl()
3496 ctrl->lport = lport; in nvme_fc_init_ctrl()
3497 ctrl->rport = rport; in nvme_fc_init_ctrl()
3498 ctrl->dev = lport->dev; in nvme_fc_init_ctrl()
3499 ctrl->cnum = idx; in nvme_fc_init_ctrl()
3500 ctrl->ioq_live = false; in nvme_fc_init_ctrl()
3501 init_waitqueue_head(&ctrl->ioabort_wait); in nvme_fc_init_ctrl()
3503 get_device(ctrl->dev); in nvme_fc_init_ctrl()
3504 kref_init(&ctrl->ref); in nvme_fc_init_ctrl()
3506 INIT_WORK(&ctrl->ctrl.reset_work, nvme_fc_reset_ctrl_work); in nvme_fc_init_ctrl()
3507 INIT_DELAYED_WORK(&ctrl->connect_work, nvme_fc_connect_ctrl_work); in nvme_fc_init_ctrl()
3508 INIT_WORK(&ctrl->ioerr_work, nvme_fc_ctrl_ioerr_work); in nvme_fc_init_ctrl()
3509 spin_lock_init(&ctrl->lock); in nvme_fc_init_ctrl()
3512 ctrl->ctrl.queue_count = min_t(unsigned int, in nvme_fc_init_ctrl()
3515 ctrl->ctrl.queue_count++; /* +1 for admin queue */ in nvme_fc_init_ctrl()
3517 ctrl->ctrl.sqsize = opts->queue_size - 1; in nvme_fc_init_ctrl()
3518 ctrl->ctrl.kato = opts->kato; in nvme_fc_init_ctrl()
3519 ctrl->ctrl.cntlid = 0xffff; in nvme_fc_init_ctrl()
3522 ctrl->queues = kcalloc(ctrl->ctrl.queue_count, in nvme_fc_init_ctrl()
3524 if (!ctrl->queues) in nvme_fc_init_ctrl()
3527 nvme_fc_init_queue(ctrl, 0); in nvme_fc_init_ctrl()
3536 ret = nvme_init_ctrl(&ctrl->ctrl, dev, &nvme_fc_ctrl_ops, 0); in nvme_fc_init_ctrl()
3542 ret = nvme_alloc_admin_tag_set(&ctrl->ctrl, &ctrl->admin_tag_set, in nvme_fc_init_ctrl()
3545 ctrl->lport->ops->fcprqst_priv_sz)); in nvme_fc_init_ctrl()
3550 list_add_tail(&ctrl->ctrl_list, &rport->ctrl_list); in nvme_fc_init_ctrl()
3553 if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_RESETTING) || in nvme_fc_init_ctrl()
3554 !nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_CONNECTING)) { in nvme_fc_init_ctrl()
3555 dev_err(ctrl->ctrl.device, in nvme_fc_init_ctrl()
3556 "NVME-FC{%d}: failed to init ctrl state\n", ctrl->cnum); in nvme_fc_init_ctrl()
3560 if (!queue_delayed_work(nvme_wq, &ctrl->connect_work, 0)) { in nvme_fc_init_ctrl()
3561 dev_err(ctrl->ctrl.device, in nvme_fc_init_ctrl()
3563 ctrl->cnum); in nvme_fc_init_ctrl()
3567 flush_delayed_work(&ctrl->connect_work); in nvme_fc_init_ctrl()
3569 dev_info(ctrl->ctrl.device, in nvme_fc_init_ctrl()
3571 ctrl->cnum, nvmf_ctrl_subsysnqn(&ctrl->ctrl)); in nvme_fc_init_ctrl()
3573 return &ctrl->ctrl; in nvme_fc_init_ctrl()
3576 nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_DELETING); in nvme_fc_init_ctrl()
3577 cancel_work_sync(&ctrl->ioerr_work); in nvme_fc_init_ctrl()
3578 cancel_work_sync(&ctrl->ctrl.reset_work); in nvme_fc_init_ctrl()
3579 cancel_delayed_work_sync(&ctrl->connect_work); in nvme_fc_init_ctrl()
3581 ctrl->ctrl.opts = NULL; in nvme_fc_init_ctrl()
3584 nvme_uninit_ctrl(&ctrl->ctrl); in nvme_fc_init_ctrl()
3587 nvme_put_ctrl(&ctrl->ctrl); in nvme_fc_init_ctrl()
3601 kfree(ctrl->queues); in nvme_fc_init_ctrl()
3603 put_device(ctrl->dev); in nvme_fc_init_ctrl()
3604 ida_free(&nvme_fc_ctrl_cnt, ctrl->cnum); in nvme_fc_init_ctrl()
3606 kfree(ctrl); in nvme_fc_init_ctrl()
3683 struct nvme_ctrl *ctrl; in nvme_fc_create_ctrl() local
3717 ctrl = nvme_fc_init_ctrl(dev, opts, lport, rport); in nvme_fc_create_ctrl()
3718 if (IS_ERR(ctrl)) in nvme_fc_create_ctrl()
3720 return ctrl; in nvme_fc_create_ctrl()
3937 struct nvme_fc_ctrl *ctrl; in nvme_fc_delete_controllers() local
3940 list_for_each_entry(ctrl, &rport->ctrl_list, ctrl_list) { in nvme_fc_delete_controllers()
3941 dev_warn(ctrl->ctrl.device, in nvme_fc_delete_controllers()
3943 ctrl->cnum); in nvme_fc_delete_controllers()
3944 nvme_delete_ctrl(&ctrl->ctrl); in nvme_fc_delete_controllers()