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()
558 nvme_fc_resume_controller(struct nvme_fc_ctrl *ctrl) in nvme_fc_resume_controller() argument
560 switch (ctrl->ctrl.state) { in nvme_fc_resume_controller()
567 dev_info(ctrl->ctrl.device, in nvme_fc_resume_controller()
569 "Attempting reconnect\n", ctrl->cnum); in nvme_fc_resume_controller()
571 queue_delayed_work(nvme_wq, &ctrl->connect_work, 0); in nvme_fc_resume_controller()
593 struct nvme_fc_ctrl *ctrl; in nvme_fc_attach_to_suspended_rport() local
629 list_for_each_entry(ctrl, &rport->ctrl_list, ctrl_list) in nvme_fc_attach_to_suspended_rport()
630 nvme_fc_resume_controller(ctrl); in nvme_fc_attach_to_suspended_rport()
790 nvme_fc_ctrl_connectivity_loss(struct nvme_fc_ctrl *ctrl) in nvme_fc_ctrl_connectivity_loss() argument
792 dev_info(ctrl->ctrl.device, in nvme_fc_ctrl_connectivity_loss()
794 "Reconnect", ctrl->cnum); in nvme_fc_ctrl_connectivity_loss()
796 switch (ctrl->ctrl.state) { in nvme_fc_ctrl_connectivity_loss()
806 if (nvme_reset_ctrl(&ctrl->ctrl)) { in nvme_fc_ctrl_connectivity_loss()
807 dev_warn(ctrl->ctrl.device, in nvme_fc_ctrl_connectivity_loss()
809 ctrl->cnum); in nvme_fc_ctrl_connectivity_loss()
810 nvme_delete_ctrl(&ctrl->ctrl); in nvme_fc_ctrl_connectivity_loss()
856 struct nvme_fc_ctrl *ctrl; in nvme_fc_unregister_remoteport() local
872 list_for_each_entry(ctrl, &rport->ctrl_list, ctrl_list) { in nvme_fc_unregister_remoteport()
875 dev_warn(ctrl->ctrl.device, in nvme_fc_unregister_remoteport()
877 ctrl->cnum); in nvme_fc_unregister_remoteport()
878 nvme_delete_ctrl(&ctrl->ctrl); in nvme_fc_unregister_remoteport()
880 nvme_fc_ctrl_connectivity_loss(ctrl); in nvme_fc_unregister_remoteport()
1035 static void nvme_fc_error_recovery(struct nvme_fc_ctrl *ctrl, char *errmsg);
1177 nvme_fc_connect_admin_queue(struct nvme_fc_ctrl *ctrl, in nvme_fc_connect_admin_queue() argument
1189 ctrl->lport->ops->lsrqst_priv_sz), GFP_KERNEL); in nvme_fc_connect_admin_queue()
1191 dev_info(ctrl->ctrl.device, in nvme_fc_connect_admin_queue()
1193 ctrl->cnum); in nvme_fc_connect_admin_queue()
1201 if (ctrl->lport->ops->lsrqst_priv_sz) in nvme_fc_connect_admin_queue()
1220 uuid_copy(&assoc_rqst->assoc_cmd.hostid, &ctrl->ctrl.opts->host->id); in nvme_fc_connect_admin_queue()
1221 strncpy(assoc_rqst->assoc_cmd.hostnqn, ctrl->ctrl.opts->host->nqn, in nvme_fc_connect_admin_queue()
1223 strncpy(assoc_rqst->assoc_cmd.subnqn, ctrl->ctrl.opts->subsysnqn, in nvme_fc_connect_admin_queue()
1233 ret = nvme_fc_send_ls_req(ctrl->rport, lsop); in nvme_fc_connect_admin_queue()
1270 dev_err(ctrl->dev, in nvme_fc_connect_admin_queue()
1274 spin_lock_irqsave(&ctrl->lock, flags); in nvme_fc_connect_admin_queue()
1275 ctrl->association_id = in nvme_fc_connect_admin_queue()
1280 spin_unlock_irqrestore(&ctrl->lock, flags); in nvme_fc_connect_admin_queue()
1287 dev_err(ctrl->dev, in nvme_fc_connect_admin_queue()
1294 nvme_fc_connect_queue(struct nvme_fc_ctrl *ctrl, struct nvme_fc_queue *queue, in nvme_fc_connect_queue() argument
1305 ctrl->lport->ops->lsrqst_priv_sz), GFP_KERNEL); in nvme_fc_connect_queue()
1307 dev_info(ctrl->ctrl.device, in nvme_fc_connect_queue()
1309 ctrl->cnum); in nvme_fc_connect_queue()
1317 if (ctrl->lport->ops->lsrqst_priv_sz) in nvme_fc_connect_queue()
1331 conn_rqst->associd.association_id = cpu_to_be64(ctrl->association_id); in nvme_fc_connect_queue()
1348 ret = nvme_fc_send_ls_req(ctrl->rport, lsop); in nvme_fc_connect_queue()
1376 dev_err(ctrl->dev, in nvme_fc_connect_queue()
1389 dev_err(ctrl->dev, in nvme_fc_connect_queue()
1425 nvme_fc_xmt_disconnect_assoc(struct nvme_fc_ctrl *ctrl) in nvme_fc_xmt_disconnect_assoc() argument
1435 ctrl->lport->ops->lsrqst_priv_sz), GFP_KERNEL); in nvme_fc_xmt_disconnect_assoc()
1437 dev_info(ctrl->ctrl.device, in nvme_fc_xmt_disconnect_assoc()
1440 ctrl->cnum); in nvme_fc_xmt_disconnect_assoc()
1447 if (ctrl->lport->ops->lsrqst_priv_sz) in nvme_fc_xmt_disconnect_assoc()
1453 ctrl->association_id); in nvme_fc_xmt_disconnect_assoc()
1455 ret = nvme_fc_send_ls_req_async(ctrl->rport, lsop, in nvme_fc_xmt_disconnect_assoc()
1511 struct nvme_fc_ctrl *ctrl, *ret = NULL; in nvme_fc_match_disconn_ls() local
1518 list_for_each_entry(ctrl, &rport->ctrl_list, ctrl_list) { in nvme_fc_match_disconn_ls()
1519 if (!nvme_fc_ctrl_get(ctrl)) in nvme_fc_match_disconn_ls()
1521 spin_lock(&ctrl->lock); in nvme_fc_match_disconn_ls()
1522 if (association_id == ctrl->association_id) { in nvme_fc_match_disconn_ls()
1523 oldls = ctrl->rcv_disconn; in nvme_fc_match_disconn_ls()
1524 ctrl->rcv_disconn = lsop; in nvme_fc_match_disconn_ls()
1525 ret = ctrl; in nvme_fc_match_disconn_ls()
1527 spin_unlock(&ctrl->lock); in nvme_fc_match_disconn_ls()
1531 nvme_fc_ctrl_put(ctrl); in nvme_fc_match_disconn_ls()
1540 "LS's received\n", ctrl->cnum); in nvme_fc_match_disconn_ls()
1566 struct nvme_fc_ctrl *ctrl = NULL; in nvme_fc_ls_disconnect_assoc() local
1574 ctrl = nvme_fc_match_disconn_ls(rport, lsop); in nvme_fc_ls_disconnect_assoc()
1575 if (!ctrl) in nvme_fc_ls_disconnect_assoc()
1608 nvme_fc_error_recovery(ctrl, "Disconnect Association LS received"); in nvme_fc_ls_disconnect_assoc()
1611 nvme_fc_ctrl_put(ctrl); in nvme_fc_ls_disconnect_assoc()
1815 __nvme_fc_exit_request(struct nvme_fc_ctrl *ctrl, in __nvme_fc_exit_request() argument
1818 fc_dma_unmap_single(ctrl->lport->dev, op->fcp_req.rspdma, in __nvme_fc_exit_request()
1820 fc_dma_unmap_single(ctrl->lport->dev, op->fcp_req.cmddma, in __nvme_fc_exit_request()
1836 __nvme_fc_abort_op(struct nvme_fc_ctrl *ctrl, struct nvme_fc_fcp_op *op) in __nvme_fc_abort_op() argument
1841 spin_lock_irqsave(&ctrl->lock, flags); in __nvme_fc_abort_op()
1845 else if (test_bit(FCCTRL_TERMIO, &ctrl->flags)) { in __nvme_fc_abort_op()
1847 ctrl->iocnt++; in __nvme_fc_abort_op()
1849 spin_unlock_irqrestore(&ctrl->lock, flags); in __nvme_fc_abort_op()
1854 ctrl->lport->ops->fcp_abort(&ctrl->lport->localport, in __nvme_fc_abort_op()
1855 &ctrl->rport->remoteport, in __nvme_fc_abort_op()
1863 nvme_fc_abort_aen_ops(struct nvme_fc_ctrl *ctrl) in nvme_fc_abort_aen_ops() argument
1865 struct nvme_fc_fcp_op *aen_op = ctrl->aen_ops; in nvme_fc_abort_aen_ops()
1873 __nvme_fc_abort_op(ctrl, aen_op); in nvme_fc_abort_aen_ops()
1877 __nvme_fc_fcpop_chk_teardowns(struct nvme_fc_ctrl *ctrl, in __nvme_fc_fcpop_chk_teardowns() argument
1883 spin_lock_irqsave(&ctrl->lock, flags); in __nvme_fc_fcpop_chk_teardowns()
1884 if (test_bit(FCCTRL_TERMIO, &ctrl->flags) && in __nvme_fc_fcpop_chk_teardowns()
1886 if (!--ctrl->iocnt) in __nvme_fc_fcpop_chk_teardowns()
1887 wake_up(&ctrl->ioabort_wait); in __nvme_fc_fcpop_chk_teardowns()
1889 spin_unlock_irqrestore(&ctrl->lock, flags); in __nvme_fc_fcpop_chk_teardowns()
1896 struct nvme_fc_ctrl *ctrl = in nvme_fc_ctrl_ioerr_work() local
1899 nvme_fc_error_recovery(ctrl, "transport detected io error"); in nvme_fc_ctrl_ioerr_work()
1926 struct nvme_fc_ctrl *ctrl = op->ctrl; in nvme_fc_fcpio_done() local
1974 fc_dma_sync_single_for_cpu(ctrl->lport->dev, op->fcp_req.rspdma, in nvme_fc_fcpio_done()
1981 dev_info(ctrl->ctrl.device, in nvme_fc_fcpio_done()
1983 ctrl->cnum, freq->status); in nvme_fc_fcpio_done()
2013 dev_info(ctrl->ctrl.device, in nvme_fc_fcpio_done()
2016 ctrl->cnum, freq->transferred_length, in nvme_fc_fcpio_done()
2035 dev_info(ctrl->ctrl.device, in nvme_fc_fcpio_done()
2039 ctrl->cnum, be16_to_cpu(op->rsp_iu.iu_len), in nvme_fc_fcpio_done()
2053 dev_info(ctrl->ctrl.device, in nvme_fc_fcpio_done()
2056 ctrl->cnum, freq->rcv_rsplen); in nvme_fc_fcpio_done()
2064 nvme_complete_async_event(&queue->ctrl->ctrl, status, &result); in nvme_fc_fcpio_done()
2065 __nvme_fc_fcpop_chk_teardowns(ctrl, op, opstate); in nvme_fc_fcpio_done()
2068 nvme_fc_ctrl_put(ctrl); in nvme_fc_fcpio_done()
2072 __nvme_fc_fcpop_chk_teardowns(ctrl, op, opstate); in nvme_fc_fcpio_done()
2077 if (terminate_assoc && ctrl->ctrl.state != NVME_CTRL_RESETTING) in nvme_fc_fcpio_done()
2078 queue_work(nvme_reset_wq, &ctrl->ioerr_work); in nvme_fc_fcpio_done()
2082 __nvme_fc_init_request(struct nvme_fc_ctrl *ctrl, in __nvme_fc_init_request() argument
2097 op->ctrl = ctrl; in __nvme_fc_init_request()
2111 op->fcp_req.cmddma = fc_dma_map_single(ctrl->lport->dev, in __nvme_fc_init_request()
2113 if (fc_dma_mapping_error(ctrl->lport->dev, op->fcp_req.cmddma)) { in __nvme_fc_init_request()
2114 dev_err(ctrl->dev, in __nvme_fc_init_request()
2120 op->fcp_req.rspdma = fc_dma_map_single(ctrl->lport->dev, in __nvme_fc_init_request()
2123 if (fc_dma_mapping_error(ctrl->lport->dev, op->fcp_req.rspdma)) { in __nvme_fc_init_request()
2124 dev_err(ctrl->dev, in __nvme_fc_init_request()
2138 struct nvme_fc_ctrl *ctrl = to_fc_ctrl(set->driver_data); in nvme_fc_init_request() local
2140 int queue_idx = (set == &ctrl->tag_set) ? hctx_idx + 1 : 0; in nvme_fc_init_request()
2141 struct nvme_fc_queue *queue = &ctrl->queues[queue_idx]; in nvme_fc_init_request()
2144 res = __nvme_fc_init_request(ctrl, queue, &op->op, rq, queue->rqcnt++); in nvme_fc_init_request()
2149 nvme_req(rq)->ctrl = &ctrl->ctrl; in nvme_fc_init_request()
2155 nvme_fc_init_aen_ops(struct nvme_fc_ctrl *ctrl) in nvme_fc_init_aen_ops() argument
2163 aen_op = ctrl->aen_ops; in nvme_fc_init_aen_ops()
2165 if (ctrl->lport->ops->fcprqst_priv_sz) { in nvme_fc_init_aen_ops()
2166 private = kzalloc(ctrl->lport->ops->fcprqst_priv_sz, in nvme_fc_init_aen_ops()
2174 ret = __nvme_fc_init_request(ctrl, &ctrl->queues[0], in nvme_fc_init_aen_ops()
2194 nvme_fc_term_aen_ops(struct nvme_fc_ctrl *ctrl) in nvme_fc_term_aen_ops() argument
2199 cancel_work_sync(&ctrl->ctrl.async_event_work); in nvme_fc_term_aen_ops()
2200 aen_op = ctrl->aen_ops; in nvme_fc_term_aen_ops()
2202 __nvme_fc_exit_request(ctrl, aen_op); in nvme_fc_term_aen_ops()
2212 struct nvme_fc_ctrl *ctrl = to_fc_ctrl(data); in __nvme_fc_init_hctx() local
2213 struct nvme_fc_queue *queue = &ctrl->queues[qidx]; in __nvme_fc_init_hctx()
2234 nvme_fc_init_queue(struct nvme_fc_ctrl *ctrl, int idx) in nvme_fc_init_queue() argument
2238 queue = &ctrl->queues[idx]; in nvme_fc_init_queue()
2240 queue->ctrl = ctrl; in nvme_fc_init_queue()
2243 queue->dev = ctrl->dev; in nvme_fc_init_queue()
2246 queue->cmnd_capsule_len = ctrl->ctrl.ioccsz * 16; in nvme_fc_init_queue()
2288 __nvme_fc_delete_hw_queue(struct nvme_fc_ctrl *ctrl, in __nvme_fc_delete_hw_queue() argument
2291 if (ctrl->lport->ops->delete_queue) in __nvme_fc_delete_hw_queue()
2292 ctrl->lport->ops->delete_queue(&ctrl->lport->localport, qidx, in __nvme_fc_delete_hw_queue()
2298 nvme_fc_free_io_queues(struct nvme_fc_ctrl *ctrl) in nvme_fc_free_io_queues() argument
2302 for (i = 1; i < ctrl->ctrl.queue_count; i++) in nvme_fc_free_io_queues()
2303 nvme_fc_free_queue(&ctrl->queues[i]); in nvme_fc_free_io_queues()
2307 __nvme_fc_create_hw_queue(struct nvme_fc_ctrl *ctrl, in __nvme_fc_create_hw_queue() argument
2313 if (ctrl->lport->ops->create_queue) in __nvme_fc_create_hw_queue()
2314 ret = ctrl->lport->ops->create_queue(&ctrl->lport->localport, in __nvme_fc_create_hw_queue()
2321 nvme_fc_delete_hw_io_queues(struct nvme_fc_ctrl *ctrl) in nvme_fc_delete_hw_io_queues() argument
2323 struct nvme_fc_queue *queue = &ctrl->queues[ctrl->ctrl.queue_count - 1]; in nvme_fc_delete_hw_io_queues()
2326 for (i = ctrl->ctrl.queue_count - 1; i >= 1; i--, queue--) in nvme_fc_delete_hw_io_queues()
2327 __nvme_fc_delete_hw_queue(ctrl, queue, i); in nvme_fc_delete_hw_io_queues()
2331 nvme_fc_create_hw_io_queues(struct nvme_fc_ctrl *ctrl, u16 qsize) in nvme_fc_create_hw_io_queues() argument
2333 struct nvme_fc_queue *queue = &ctrl->queues[1]; in nvme_fc_create_hw_io_queues()
2336 for (i = 1; i < ctrl->ctrl.queue_count; i++, queue++) { in nvme_fc_create_hw_io_queues()
2337 ret = __nvme_fc_create_hw_queue(ctrl, queue, i, qsize); in nvme_fc_create_hw_io_queues()
2346 __nvme_fc_delete_hw_queue(ctrl, &ctrl->queues[i], i); in nvme_fc_create_hw_io_queues()
2351 nvme_fc_connect_io_queues(struct nvme_fc_ctrl *ctrl, u16 qsize) in nvme_fc_connect_io_queues() argument
2355 for (i = 1; i < ctrl->ctrl.queue_count; i++) { in nvme_fc_connect_io_queues()
2356 ret = nvme_fc_connect_queue(ctrl, &ctrl->queues[i], qsize, in nvme_fc_connect_io_queues()
2360 ret = nvmf_connect_io_queue(&ctrl->ctrl, i); in nvme_fc_connect_io_queues()
2364 set_bit(NVME_FC_Q_LIVE, &ctrl->queues[i].flags); in nvme_fc_connect_io_queues()
2371 nvme_fc_init_io_queues(struct nvme_fc_ctrl *ctrl) in nvme_fc_init_io_queues() argument
2375 for (i = 1; i < ctrl->ctrl.queue_count; i++) in nvme_fc_init_io_queues()
2376 nvme_fc_init_queue(ctrl, i); in nvme_fc_init_io_queues()
2382 struct nvme_fc_ctrl *ctrl = in nvme_fc_ctrl_free() local
2386 if (ctrl->ctrl.tagset) in nvme_fc_ctrl_free()
2387 nvme_remove_io_tag_set(&ctrl->ctrl); in nvme_fc_ctrl_free()
2390 spin_lock_irqsave(&ctrl->rport->lock, flags); in nvme_fc_ctrl_free()
2391 list_del(&ctrl->ctrl_list); in nvme_fc_ctrl_free()
2392 spin_unlock_irqrestore(&ctrl->rport->lock, flags); in nvme_fc_ctrl_free()
2394 nvme_start_admin_queue(&ctrl->ctrl); in nvme_fc_ctrl_free()
2395 nvme_remove_admin_tag_set(&ctrl->ctrl); in nvme_fc_ctrl_free()
2397 kfree(ctrl->queues); in nvme_fc_ctrl_free()
2399 put_device(ctrl->dev); in nvme_fc_ctrl_free()
2400 nvme_fc_rport_put(ctrl->rport); in nvme_fc_ctrl_free()
2402 ida_free(&nvme_fc_ctrl_cnt, ctrl->cnum); in nvme_fc_ctrl_free()
2403 if (ctrl->ctrl.opts) in nvme_fc_ctrl_free()
2404 nvmf_free_options(ctrl->ctrl.opts); in nvme_fc_ctrl_free()
2405 kfree(ctrl); in nvme_fc_ctrl_free()
2409 nvme_fc_ctrl_put(struct nvme_fc_ctrl *ctrl) in nvme_fc_ctrl_put() argument
2411 kref_put(&ctrl->ref, nvme_fc_ctrl_free); in nvme_fc_ctrl_put()
2415 nvme_fc_ctrl_get(struct nvme_fc_ctrl *ctrl) in nvme_fc_ctrl_get() argument
2417 return kref_get_unless_zero(&ctrl->ref); in nvme_fc_ctrl_get()
2427 struct nvme_fc_ctrl *ctrl = to_fc_ctrl(nctrl); in nvme_fc_nvme_ctrl_freed() local
2429 WARN_ON(nctrl != &ctrl->ctrl); in nvme_fc_nvme_ctrl_freed()
2431 nvme_fc_ctrl_put(ctrl); in nvme_fc_nvme_ctrl_freed()
2450 struct nvme_fc_ctrl *ctrl = to_fc_ctrl(nctrl); in nvme_fc_terminate_exchange() local
2454 __nvme_fc_abort_op(ctrl, op); in nvme_fc_terminate_exchange()
2468 __nvme_fc_abort_outstanding_ios(struct nvme_fc_ctrl *ctrl, bool start_queues) in __nvme_fc_abort_outstanding_ios() argument
2476 if (ctrl->ctrl.queue_count > 1) { in __nvme_fc_abort_outstanding_ios()
2477 for (q = 1; q < ctrl->ctrl.queue_count; q++) in __nvme_fc_abort_outstanding_ios()
2478 clear_bit(NVME_FC_Q_LIVE, &ctrl->queues[q].flags); in __nvme_fc_abort_outstanding_ios()
2480 clear_bit(NVME_FC_Q_LIVE, &ctrl->queues[0].flags); in __nvme_fc_abort_outstanding_ios()
2494 if (ctrl->ctrl.queue_count > 1) { in __nvme_fc_abort_outstanding_ios()
2495 nvme_stop_queues(&ctrl->ctrl); in __nvme_fc_abort_outstanding_ios()
2496 nvme_sync_io_queues(&ctrl->ctrl); in __nvme_fc_abort_outstanding_ios()
2497 blk_mq_tagset_busy_iter(&ctrl->tag_set, in __nvme_fc_abort_outstanding_ios()
2498 nvme_fc_terminate_exchange, &ctrl->ctrl); in __nvme_fc_abort_outstanding_ios()
2499 blk_mq_tagset_wait_completed_request(&ctrl->tag_set); in __nvme_fc_abort_outstanding_ios()
2501 nvme_start_queues(&ctrl->ctrl); in __nvme_fc_abort_outstanding_ios()
2519 nvme_stop_admin_queue(&ctrl->ctrl); in __nvme_fc_abort_outstanding_ios()
2520 blk_sync_queue(ctrl->ctrl.admin_q); in __nvme_fc_abort_outstanding_ios()
2521 blk_mq_tagset_busy_iter(&ctrl->admin_tag_set, in __nvme_fc_abort_outstanding_ios()
2522 nvme_fc_terminate_exchange, &ctrl->ctrl); in __nvme_fc_abort_outstanding_ios()
2523 blk_mq_tagset_wait_completed_request(&ctrl->admin_tag_set); in __nvme_fc_abort_outstanding_ios()
2525 nvme_start_admin_queue(&ctrl->ctrl); in __nvme_fc_abort_outstanding_ios()
2529 nvme_fc_error_recovery(struct nvme_fc_ctrl *ctrl, char *errmsg) in nvme_fc_error_recovery() argument
2538 if (ctrl->ctrl.state == NVME_CTRL_CONNECTING) { in nvme_fc_error_recovery()
2539 __nvme_fc_abort_outstanding_ios(ctrl, true); in nvme_fc_error_recovery()
2540 set_bit(ASSOC_FAILED, &ctrl->flags); in nvme_fc_error_recovery()
2545 if (ctrl->ctrl.state != NVME_CTRL_LIVE) in nvme_fc_error_recovery()
2548 dev_warn(ctrl->ctrl.device, in nvme_fc_error_recovery()
2550 ctrl->cnum, errmsg); in nvme_fc_error_recovery()
2551 dev_warn(ctrl->ctrl.device, in nvme_fc_error_recovery()
2552 "NVME-FC{%d}: resetting controller\n", ctrl->cnum); in nvme_fc_error_recovery()
2554 nvme_reset_ctrl(&ctrl->ctrl); in nvme_fc_error_recovery()
2560 struct nvme_fc_ctrl *ctrl = op->ctrl; in nvme_fc_timeout() local
2568 dev_info(ctrl->ctrl.device, in nvme_fc_timeout()
2571 ctrl->cnum, op->queue->qnum, sqe->common.opcode, in nvme_fc_timeout()
2573 if (__nvme_fc_abort_op(ctrl, op)) in nvme_fc_timeout()
2574 nvme_fc_error_recovery(ctrl, "io timeout abort failed"); in nvme_fc_timeout()
2585 nvme_fc_map_data(struct nvme_fc_ctrl *ctrl, struct request *rq, in nvme_fc_map_data() argument
2605 freq->sg_cnt = fc_dma_map_sg(ctrl->lport->dev, freq->sg_table.sgl, in nvme_fc_map_data()
2620 nvme_fc_unmap_data(struct nvme_fc_ctrl *ctrl, struct request *rq, in nvme_fc_unmap_data() argument
2628 fc_dma_unmap_sg(ctrl->lport->dev, freq->sg_table.sgl, op->nents, in nvme_fc_unmap_data()
2660 nvme_fc_start_fcp_op(struct nvme_fc_ctrl *ctrl, struct nvme_fc_queue *queue, in nvme_fc_start_fcp_op() argument
2672 if (ctrl->rport->remoteport.port_state != FC_OBJSTATE_ONLINE) in nvme_fc_start_fcp_op()
2675 if (!nvme_fc_ctrl_get(ctrl)) in nvme_fc_start_fcp_op()
2719 ret = nvme_fc_map_data(ctrl, op->rq, op); in nvme_fc_start_fcp_op()
2722 nvme_fc_ctrl_put(ctrl); in nvme_fc_start_fcp_op()
2729 fc_dma_sync_single_for_device(ctrl->lport->dev, op->fcp_req.cmddma, in nvme_fc_start_fcp_op()
2738 ret = ctrl->lport->ops->fcp_io(&ctrl->lport->localport, in nvme_fc_start_fcp_op()
2739 &ctrl->rport->remoteport, in nvme_fc_start_fcp_op()
2756 __nvme_fc_fcpop_chk_teardowns(ctrl, op, opstate); in nvme_fc_start_fcp_op()
2759 nvme_fc_unmap_data(ctrl, op->rq, op); in nvme_fc_start_fcp_op()
2763 nvme_fc_ctrl_put(ctrl); in nvme_fc_start_fcp_op()
2765 if (ctrl->rport->remoteport.port_state == FC_OBJSTATE_ONLINE && in nvme_fc_start_fcp_op()
2781 struct nvme_fc_ctrl *ctrl = queue->ctrl; in nvme_fc_queue_rq() local
2789 if (ctrl->rport->remoteport.port_state != FC_OBJSTATE_ONLINE || in nvme_fc_queue_rq()
2790 !nvme_check_ready(&queue->ctrl->ctrl, rq, queue_ready)) in nvme_fc_queue_rq()
2791 return nvme_fail_nonready_command(&queue->ctrl->ctrl, rq); in nvme_fc_queue_rq()
2815 return nvme_fc_start_fcp_op(ctrl, queue, op, data_len, io_dir); in nvme_fc_queue_rq()
2821 struct nvme_fc_ctrl *ctrl = to_fc_ctrl(arg); in nvme_fc_submit_async_event() local
2825 if (test_bit(FCCTRL_TERMIO, &ctrl->flags)) in nvme_fc_submit_async_event()
2828 aen_op = &ctrl->aen_ops[0]; in nvme_fc_submit_async_event()
2830 ret = nvme_fc_start_fcp_op(ctrl, aen_op->queue, aen_op, 0, in nvme_fc_submit_async_event()
2833 dev_err(ctrl->ctrl.device, in nvme_fc_submit_async_event()
2841 struct nvme_fc_ctrl *ctrl = op->ctrl; in nvme_fc_complete_rq() local
2846 nvme_fc_unmap_data(ctrl, rq, op); in nvme_fc_complete_rq()
2848 nvme_fc_ctrl_put(ctrl); in nvme_fc_complete_rq()
2853 struct nvme_fc_ctrl *ctrl = to_fc_ctrl(set->driver_data); in nvme_fc_map_queues() local
2865 if (ctrl->lport->ops->map_queues) in nvme_fc_map_queues()
2866 ctrl->lport->ops->map_queues(&ctrl->lport->localport, in nvme_fc_map_queues()
2884 nvme_fc_create_io_queues(struct nvme_fc_ctrl *ctrl) in nvme_fc_create_io_queues() argument
2886 struct nvmf_ctrl_options *opts = ctrl->ctrl.opts; in nvme_fc_create_io_queues()
2891 ctrl->lport->ops->max_hw_queues); in nvme_fc_create_io_queues()
2892 ret = nvme_set_queue_count(&ctrl->ctrl, &nr_io_queues); in nvme_fc_create_io_queues()
2894 dev_info(ctrl->ctrl.device, in nvme_fc_create_io_queues()
2899 ctrl->ctrl.queue_count = nr_io_queues + 1; in nvme_fc_create_io_queues()
2903 nvme_fc_init_io_queues(ctrl); in nvme_fc_create_io_queues()
2905 ret = nvme_alloc_io_tag_set(&ctrl->ctrl, &ctrl->tag_set, in nvme_fc_create_io_queues()
2908 ctrl->lport->ops->fcprqst_priv_sz)); in nvme_fc_create_io_queues()
2912 ret = nvme_fc_create_hw_io_queues(ctrl, ctrl->ctrl.sqsize + 1); in nvme_fc_create_io_queues()
2916 ret = nvme_fc_connect_io_queues(ctrl, ctrl->ctrl.sqsize + 1); in nvme_fc_create_io_queues()
2920 ctrl->ioq_live = true; in nvme_fc_create_io_queues()
2925 nvme_fc_delete_hw_io_queues(ctrl); in nvme_fc_create_io_queues()
2927 nvme_remove_io_tag_set(&ctrl->ctrl); in nvme_fc_create_io_queues()
2928 nvme_fc_free_io_queues(ctrl); in nvme_fc_create_io_queues()
2931 ctrl->ctrl.tagset = NULL; in nvme_fc_create_io_queues()
2937 nvme_fc_recreate_io_queues(struct nvme_fc_ctrl *ctrl) in nvme_fc_recreate_io_queues() argument
2939 struct nvmf_ctrl_options *opts = ctrl->ctrl.opts; in nvme_fc_recreate_io_queues()
2940 u32 prior_ioq_cnt = ctrl->ctrl.queue_count - 1; in nvme_fc_recreate_io_queues()
2945 ctrl->lport->ops->max_hw_queues); in nvme_fc_recreate_io_queues()
2946 ret = nvme_set_queue_count(&ctrl->ctrl, &nr_io_queues); in nvme_fc_recreate_io_queues()
2948 dev_info(ctrl->ctrl.device, in nvme_fc_recreate_io_queues()
2954 dev_info(ctrl->ctrl.device, in nvme_fc_recreate_io_queues()
2960 ctrl->ctrl.queue_count = nr_io_queues + 1; in nvme_fc_recreate_io_queues()
2962 if (ctrl->ctrl.queue_count == 1) in nvme_fc_recreate_io_queues()
2966 dev_info(ctrl->ctrl.device, in nvme_fc_recreate_io_queues()
2969 blk_mq_update_nr_hw_queues(&ctrl->tag_set, nr_io_queues); in nvme_fc_recreate_io_queues()
2972 ret = nvme_fc_create_hw_io_queues(ctrl, ctrl->ctrl.sqsize + 1); in nvme_fc_recreate_io_queues()
2976 ret = nvme_fc_connect_io_queues(ctrl, ctrl->ctrl.sqsize + 1); in nvme_fc_recreate_io_queues()
2983 nvme_fc_delete_hw_io_queues(ctrl); in nvme_fc_recreate_io_queues()
2985 nvme_fc_free_io_queues(ctrl); in nvme_fc_recreate_io_queues()
3009 nvme_fc_ctlr_active_on_rport(struct nvme_fc_ctrl *ctrl) in nvme_fc_ctlr_active_on_rport() argument
3011 struct nvme_fc_rport *rport = ctrl->rport; in nvme_fc_ctlr_active_on_rport()
3014 if (test_and_set_bit(ASSOC_ACTIVE, &ctrl->flags)) in nvme_fc_ctlr_active_on_rport()
3025 nvme_fc_ctlr_inactive_on_rport(struct nvme_fc_ctrl *ctrl) in nvme_fc_ctlr_inactive_on_rport() argument
3027 struct nvme_fc_rport *rport = ctrl->rport; in nvme_fc_ctlr_inactive_on_rport()
3048 nvme_fc_create_association(struct nvme_fc_ctrl *ctrl) in nvme_fc_create_association() argument
3050 struct nvmf_ctrl_options *opts = ctrl->ctrl.opts; in nvme_fc_create_association()
3056 ++ctrl->ctrl.nr_reconnects; in nvme_fc_create_association()
3058 if (ctrl->rport->remoteport.port_state != FC_OBJSTATE_ONLINE) in nvme_fc_create_association()
3061 if (nvme_fc_ctlr_active_on_rport(ctrl)) in nvme_fc_create_association()
3064 dev_info(ctrl->ctrl.device, in nvme_fc_create_association()
3067 ctrl->cnum, ctrl->lport->localport.port_name, in nvme_fc_create_association()
3068 ctrl->rport->remoteport.port_name, ctrl->ctrl.opts->subsysnqn); in nvme_fc_create_association()
3070 clear_bit(ASSOC_FAILED, &ctrl->flags); in nvme_fc_create_association()
3076 ret = __nvme_fc_create_hw_queue(ctrl, &ctrl->queues[0], 0, in nvme_fc_create_association()
3081 ret = nvme_fc_connect_admin_queue(ctrl, &ctrl->queues[0], in nvme_fc_create_association()
3086 ret = nvmf_connect_admin_queue(&ctrl->ctrl); in nvme_fc_create_association()
3090 set_bit(NVME_FC_Q_LIVE, &ctrl->queues[0].flags); in nvme_fc_create_association()
3099 ret = nvme_enable_ctrl(&ctrl->ctrl); in nvme_fc_create_association()
3100 if (ret || test_bit(ASSOC_FAILED, &ctrl->flags)) in nvme_fc_create_association()
3103 ctrl->ctrl.max_segments = ctrl->lport->ops->max_sgl_segments; in nvme_fc_create_association()
3104 ctrl->ctrl.max_hw_sectors = ctrl->ctrl.max_segments << in nvme_fc_create_association()
3107 nvme_start_admin_queue(&ctrl->ctrl); in nvme_fc_create_association()
3109 ret = nvme_init_ctrl_finish(&ctrl->ctrl); in nvme_fc_create_association()
3110 if (ret || test_bit(ASSOC_FAILED, &ctrl->flags)) in nvme_fc_create_association()
3116 if (ctrl->ctrl.icdoff) { in nvme_fc_create_association()
3117 dev_err(ctrl->ctrl.device, "icdoff %d is not supported!\n", in nvme_fc_create_association()
3118 ctrl->ctrl.icdoff); in nvme_fc_create_association()
3124 if (!nvme_ctrl_sgl_supported(&ctrl->ctrl)) { in nvme_fc_create_association()
3125 dev_err(ctrl->ctrl.device, in nvme_fc_create_association()
3131 if (opts->queue_size > ctrl->ctrl.maxcmd) { in nvme_fc_create_association()
3133 dev_warn(ctrl->ctrl.device, in nvme_fc_create_association()
3136 opts->queue_size, ctrl->ctrl.maxcmd); in nvme_fc_create_association()
3137 opts->queue_size = ctrl->ctrl.maxcmd; in nvme_fc_create_association()
3138 ctrl->ctrl.sqsize = opts->queue_size - 1; in nvme_fc_create_association()
3141 ret = nvme_fc_init_aen_ops(ctrl); in nvme_fc_create_association()
3149 if (ctrl->ctrl.queue_count > 1) { in nvme_fc_create_association()
3150 if (!ctrl->ioq_live) in nvme_fc_create_association()
3151 ret = nvme_fc_create_io_queues(ctrl); in nvme_fc_create_association()
3153 ret = nvme_fc_recreate_io_queues(ctrl); in nvme_fc_create_association()
3155 if (ret || test_bit(ASSOC_FAILED, &ctrl->flags)) in nvme_fc_create_association()
3158 changed = nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_LIVE); in nvme_fc_create_association()
3160 ctrl->ctrl.nr_reconnects = 0; in nvme_fc_create_association()
3163 nvme_start_ctrl(&ctrl->ctrl); in nvme_fc_create_association()
3168 nvme_fc_term_aen_ops(ctrl); in nvme_fc_create_association()
3171 nvme_fc_xmt_disconnect_assoc(ctrl); in nvme_fc_create_association()
3172 spin_lock_irqsave(&ctrl->lock, flags); in nvme_fc_create_association()
3173 ctrl->association_id = 0; in nvme_fc_create_association()
3174 disls = ctrl->rcv_disconn; in nvme_fc_create_association()
3175 ctrl->rcv_disconn = NULL; in nvme_fc_create_association()
3176 spin_unlock_irqrestore(&ctrl->lock, flags); in nvme_fc_create_association()
3180 __nvme_fc_delete_hw_queue(ctrl, &ctrl->queues[0], 0); in nvme_fc_create_association()
3182 nvme_fc_free_queue(&ctrl->queues[0]); in nvme_fc_create_association()
3183 clear_bit(ASSOC_ACTIVE, &ctrl->flags); in nvme_fc_create_association()
3184 nvme_fc_ctlr_inactive_on_rport(ctrl); in nvme_fc_create_association()
3197 nvme_fc_delete_association(struct nvme_fc_ctrl *ctrl) in nvme_fc_delete_association() argument
3202 if (!test_and_clear_bit(ASSOC_ACTIVE, &ctrl->flags)) in nvme_fc_delete_association()
3205 spin_lock_irqsave(&ctrl->lock, flags); in nvme_fc_delete_association()
3206 set_bit(FCCTRL_TERMIO, &ctrl->flags); in nvme_fc_delete_association()
3207 ctrl->iocnt = 0; in nvme_fc_delete_association()
3208 spin_unlock_irqrestore(&ctrl->lock, flags); in nvme_fc_delete_association()
3210 __nvme_fc_abort_outstanding_ios(ctrl, false); in nvme_fc_delete_association()
3213 nvme_fc_abort_aen_ops(ctrl); in nvme_fc_delete_association()
3216 spin_lock_irq(&ctrl->lock); in nvme_fc_delete_association()
3217 wait_event_lock_irq(ctrl->ioabort_wait, ctrl->iocnt == 0, ctrl->lock); in nvme_fc_delete_association()
3218 clear_bit(FCCTRL_TERMIO, &ctrl->flags); in nvme_fc_delete_association()
3219 spin_unlock_irq(&ctrl->lock); in nvme_fc_delete_association()
3221 nvme_fc_term_aen_ops(ctrl); in nvme_fc_delete_association()
3229 if (ctrl->association_id) in nvme_fc_delete_association()
3230 nvme_fc_xmt_disconnect_assoc(ctrl); in nvme_fc_delete_association()
3232 spin_lock_irqsave(&ctrl->lock, flags); in nvme_fc_delete_association()
3233 ctrl->association_id = 0; in nvme_fc_delete_association()
3234 disls = ctrl->rcv_disconn; in nvme_fc_delete_association()
3235 ctrl->rcv_disconn = NULL; in nvme_fc_delete_association()
3236 spin_unlock_irqrestore(&ctrl->lock, flags); in nvme_fc_delete_association()
3244 if (ctrl->ctrl.tagset) { in nvme_fc_delete_association()
3245 nvme_fc_delete_hw_io_queues(ctrl); in nvme_fc_delete_association()
3246 nvme_fc_free_io_queues(ctrl); in nvme_fc_delete_association()
3249 __nvme_fc_delete_hw_queue(ctrl, &ctrl->queues[0], 0); in nvme_fc_delete_association()
3250 nvme_fc_free_queue(&ctrl->queues[0]); in nvme_fc_delete_association()
3253 nvme_start_admin_queue(&ctrl->ctrl); in nvme_fc_delete_association()
3256 nvme_start_queues(&ctrl->ctrl); in nvme_fc_delete_association()
3258 nvme_fc_ctlr_inactive_on_rport(ctrl); in nvme_fc_delete_association()
3264 struct nvme_fc_ctrl *ctrl = to_fc_ctrl(nctrl); in nvme_fc_delete_ctrl() local
3266 cancel_work_sync(&ctrl->ioerr_work); in nvme_fc_delete_ctrl()
3267 cancel_delayed_work_sync(&ctrl->connect_work); in nvme_fc_delete_ctrl()
3272 nvme_fc_delete_association(ctrl); in nvme_fc_delete_ctrl()
3276 nvme_fc_reconnect_or_delete(struct nvme_fc_ctrl *ctrl, int status) in nvme_fc_reconnect_or_delete() argument
3278 struct nvme_fc_rport *rport = ctrl->rport; in nvme_fc_reconnect_or_delete()
3280 unsigned long recon_delay = ctrl->ctrl.opts->reconnect_delay * HZ; in nvme_fc_reconnect_or_delete()
3283 if (ctrl->ctrl.state != NVME_CTRL_CONNECTING) in nvme_fc_reconnect_or_delete()
3287 dev_info(ctrl->ctrl.device, in nvme_fc_reconnect_or_delete()
3289 ctrl->cnum, status); in nvme_fc_reconnect_or_delete()
3295 if (recon && nvmf_should_reconnect(&ctrl->ctrl)) { in nvme_fc_reconnect_or_delete()
3297 dev_info(ctrl->ctrl.device, in nvme_fc_reconnect_or_delete()
3300 ctrl->cnum, recon_delay / HZ); in nvme_fc_reconnect_or_delete()
3304 queue_delayed_work(nvme_wq, &ctrl->connect_work, recon_delay); in nvme_fc_reconnect_or_delete()
3308 dev_warn(ctrl->ctrl.device, in nvme_fc_reconnect_or_delete()
3310 ctrl->cnum); in nvme_fc_reconnect_or_delete()
3312 dev_warn(ctrl->ctrl.device, in nvme_fc_reconnect_or_delete()
3315 ctrl->cnum, ctrl->ctrl.nr_reconnects); in nvme_fc_reconnect_or_delete()
3317 dev_warn(ctrl->ctrl.device, in nvme_fc_reconnect_or_delete()
3320 ctrl->cnum, min_t(int, portptr->dev_loss_tmo, in nvme_fc_reconnect_or_delete()
3321 (ctrl->ctrl.opts->max_reconnects * in nvme_fc_reconnect_or_delete()
3322 ctrl->ctrl.opts->reconnect_delay))); in nvme_fc_reconnect_or_delete()
3323 WARN_ON(nvme_delete_ctrl(&ctrl->ctrl)); in nvme_fc_reconnect_or_delete()
3330 struct nvme_fc_ctrl *ctrl = in nvme_fc_reset_ctrl_work() local
3331 container_of(work, struct nvme_fc_ctrl, ctrl.reset_work); in nvme_fc_reset_ctrl_work()
3333 nvme_stop_ctrl(&ctrl->ctrl); in nvme_fc_reset_ctrl_work()
3336 nvme_fc_delete_association(ctrl); in nvme_fc_reset_ctrl_work()
3338 if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_CONNECTING)) in nvme_fc_reset_ctrl_work()
3339 dev_err(ctrl->ctrl.device, in nvme_fc_reset_ctrl_work()
3341 "to CONNECTING\n", ctrl->cnum); in nvme_fc_reset_ctrl_work()
3343 if (ctrl->rport->remoteport.port_state == FC_OBJSTATE_ONLINE) { in nvme_fc_reset_ctrl_work()
3344 if (!queue_delayed_work(nvme_wq, &ctrl->connect_work, 0)) { in nvme_fc_reset_ctrl_work()
3345 dev_err(ctrl->ctrl.device, in nvme_fc_reset_ctrl_work()
3347 "after reset\n", ctrl->cnum); in nvme_fc_reset_ctrl_work()
3349 flush_delayed_work(&ctrl->connect_work); in nvme_fc_reset_ctrl_work()
3352 nvme_fc_reconnect_or_delete(ctrl, -ENOTCONN); in nvme_fc_reset_ctrl_work()
3375 struct nvme_fc_ctrl *ctrl = in nvme_fc_connect_ctrl_work() local
3379 ret = nvme_fc_create_association(ctrl); in nvme_fc_connect_ctrl_work()
3381 nvme_fc_reconnect_or_delete(ctrl, ret); in nvme_fc_connect_ctrl_work()
3383 dev_info(ctrl->ctrl.device, in nvme_fc_connect_ctrl_work()
3385 ctrl->cnum); in nvme_fc_connect_ctrl_work()
3411 struct nvme_fc_ctrl *ctrl; in nvme_fc_existing_controller() local
3416 list_for_each_entry(ctrl, &rport->ctrl_list, ctrl_list) { in nvme_fc_existing_controller()
3417 found = nvmf_ctlr_matches_baseopts(&ctrl->ctrl, opts); in nvme_fc_existing_controller()
3430 struct nvme_fc_ctrl *ctrl; in nvme_fc_init_ctrl() local
3446 ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL); in nvme_fc_init_ctrl()
3447 if (!ctrl) { in nvme_fc_init_ctrl()
3471 ctrl->ctrl.opts = opts; in nvme_fc_init_ctrl()
3472 ctrl->ctrl.nr_reconnects = 0; in nvme_fc_init_ctrl()
3474 ctrl->ctrl.numa_node = dev_to_node(lport->dev); in nvme_fc_init_ctrl()
3476 ctrl->ctrl.numa_node = NUMA_NO_NODE; in nvme_fc_init_ctrl()
3477 INIT_LIST_HEAD(&ctrl->ctrl_list); in nvme_fc_init_ctrl()
3478 ctrl->lport = lport; in nvme_fc_init_ctrl()
3479 ctrl->rport = rport; in nvme_fc_init_ctrl()
3480 ctrl->dev = lport->dev; in nvme_fc_init_ctrl()
3481 ctrl->cnum = idx; in nvme_fc_init_ctrl()
3482 ctrl->ioq_live = false; in nvme_fc_init_ctrl()
3483 init_waitqueue_head(&ctrl->ioabort_wait); in nvme_fc_init_ctrl()
3485 get_device(ctrl->dev); in nvme_fc_init_ctrl()
3486 kref_init(&ctrl->ref); in nvme_fc_init_ctrl()
3488 INIT_WORK(&ctrl->ctrl.reset_work, nvme_fc_reset_ctrl_work); in nvme_fc_init_ctrl()
3489 INIT_DELAYED_WORK(&ctrl->connect_work, nvme_fc_connect_ctrl_work); in nvme_fc_init_ctrl()
3490 INIT_WORK(&ctrl->ioerr_work, nvme_fc_ctrl_ioerr_work); in nvme_fc_init_ctrl()
3491 spin_lock_init(&ctrl->lock); in nvme_fc_init_ctrl()
3494 ctrl->ctrl.queue_count = min_t(unsigned int, in nvme_fc_init_ctrl()
3497 ctrl->ctrl.queue_count++; /* +1 for admin queue */ in nvme_fc_init_ctrl()
3499 ctrl->ctrl.sqsize = opts->queue_size - 1; in nvme_fc_init_ctrl()
3500 ctrl->ctrl.kato = opts->kato; in nvme_fc_init_ctrl()
3501 ctrl->ctrl.cntlid = 0xffff; in nvme_fc_init_ctrl()
3504 ctrl->queues = kcalloc(ctrl->ctrl.queue_count, in nvme_fc_init_ctrl()
3506 if (!ctrl->queues) in nvme_fc_init_ctrl()
3509 nvme_fc_init_queue(ctrl, 0); in nvme_fc_init_ctrl()
3518 ret = nvme_init_ctrl(&ctrl->ctrl, dev, &nvme_fc_ctrl_ops, 0); in nvme_fc_init_ctrl()
3524 ret = nvme_alloc_admin_tag_set(&ctrl->ctrl, &ctrl->admin_tag_set, in nvme_fc_init_ctrl()
3527 ctrl->lport->ops->fcprqst_priv_sz)); in nvme_fc_init_ctrl()
3532 list_add_tail(&ctrl->ctrl_list, &rport->ctrl_list); in nvme_fc_init_ctrl()
3535 if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_RESETTING) || in nvme_fc_init_ctrl()
3536 !nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_CONNECTING)) { in nvme_fc_init_ctrl()
3537 dev_err(ctrl->ctrl.device, in nvme_fc_init_ctrl()
3538 "NVME-FC{%d}: failed to init ctrl state\n", ctrl->cnum); in nvme_fc_init_ctrl()
3542 if (!queue_delayed_work(nvme_wq, &ctrl->connect_work, 0)) { in nvme_fc_init_ctrl()
3543 dev_err(ctrl->ctrl.device, in nvme_fc_init_ctrl()
3545 ctrl->cnum); in nvme_fc_init_ctrl()
3549 flush_delayed_work(&ctrl->connect_work); in nvme_fc_init_ctrl()
3551 dev_info(ctrl->ctrl.device, in nvme_fc_init_ctrl()
3553 ctrl->cnum, nvmf_ctrl_subsysnqn(&ctrl->ctrl)); in nvme_fc_init_ctrl()
3555 return &ctrl->ctrl; in nvme_fc_init_ctrl()
3558 nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_DELETING); in nvme_fc_init_ctrl()
3559 cancel_work_sync(&ctrl->ioerr_work); in nvme_fc_init_ctrl()
3560 cancel_work_sync(&ctrl->ctrl.reset_work); in nvme_fc_init_ctrl()
3561 cancel_delayed_work_sync(&ctrl->connect_work); in nvme_fc_init_ctrl()
3563 ctrl->ctrl.opts = NULL; in nvme_fc_init_ctrl()
3566 nvme_uninit_ctrl(&ctrl->ctrl); in nvme_fc_init_ctrl()
3569 nvme_put_ctrl(&ctrl->ctrl); in nvme_fc_init_ctrl()
3583 kfree(ctrl->queues); in nvme_fc_init_ctrl()
3585 put_device(ctrl->dev); in nvme_fc_init_ctrl()
3586 ida_free(&nvme_fc_ctrl_cnt, ctrl->cnum); in nvme_fc_init_ctrl()
3588 kfree(ctrl); in nvme_fc_init_ctrl()
3665 struct nvme_ctrl *ctrl; in nvme_fc_create_ctrl() local
3699 ctrl = nvme_fc_init_ctrl(dev, opts, lport, rport); in nvme_fc_create_ctrl()
3700 if (IS_ERR(ctrl)) in nvme_fc_create_ctrl()
3702 return ctrl; in nvme_fc_create_ctrl()
3926 struct nvme_fc_ctrl *ctrl; in nvme_fc_delete_controllers() local
3929 list_for_each_entry(ctrl, &rport->ctrl_list, ctrl_list) { in nvme_fc_delete_controllers()
3930 dev_warn(ctrl->ctrl.device, in nvme_fc_delete_controllers()
3932 ctrl->cnum); in nvme_fc_delete_controllers()
3933 nvme_delete_ctrl(&ctrl->ctrl); in nvme_fc_delete_controllers()