Lines Matching full:ctrl
35 struct nvme_fc_ctrl *ctrl; member
99 struct nvme_fc_ctrl *ctrl; member
179 struct nvme_ctrl ctrl; member
183 to_fc_ctrl(struct nvme_ctrl *ctrl) in to_fc_ctrl() argument
185 return container_of(ctrl, struct nvme_fc_ctrl, ctrl); in to_fc_ctrl()
550 nvme_fc_resume_controller(struct nvme_fc_ctrl *ctrl) in nvme_fc_resume_controller() argument
552 switch (nvme_ctrl_state(&ctrl->ctrl)) { in nvme_fc_resume_controller()
559 dev_info(ctrl->ctrl.device, in nvme_fc_resume_controller()
561 "Attempting reconnect\n", ctrl->cnum); in nvme_fc_resume_controller()
563 queue_delayed_work(nvme_wq, &ctrl->connect_work, 0); in nvme_fc_resume_controller()
585 struct nvme_fc_ctrl *ctrl; in nvme_fc_attach_to_suspended_rport() local
621 list_for_each_entry(ctrl, &rport->ctrl_list, ctrl_list) in nvme_fc_attach_to_suspended_rport()
622 nvme_fc_resume_controller(ctrl); in nvme_fc_attach_to_suspended_rport()
782 nvme_fc_ctrl_connectivity_loss(struct nvme_fc_ctrl *ctrl) in nvme_fc_ctrl_connectivity_loss() argument
784 dev_info(ctrl->ctrl.device, in nvme_fc_ctrl_connectivity_loss()
786 "Reconnect", ctrl->cnum); in nvme_fc_ctrl_connectivity_loss()
788 set_bit(ASSOC_FAILED, &ctrl->flags); in nvme_fc_ctrl_connectivity_loss()
789 nvme_reset_ctrl(&ctrl->ctrl); in nvme_fc_ctrl_connectivity_loss()
807 struct nvme_fc_ctrl *ctrl; in nvme_fc_unregister_remoteport() local
823 list_for_each_entry(ctrl, &rport->ctrl_list, ctrl_list) { in nvme_fc_unregister_remoteport()
826 dev_warn(ctrl->ctrl.device, in nvme_fc_unregister_remoteport()
828 ctrl->cnum); in nvme_fc_unregister_remoteport()
829 nvme_delete_ctrl(&ctrl->ctrl); in nvme_fc_unregister_remoteport()
831 nvme_fc_ctrl_connectivity_loss(ctrl); in nvme_fc_unregister_remoteport()
986 static void nvme_fc_error_recovery(struct nvme_fc_ctrl *ctrl, char *errmsg);
1128 nvme_fc_connect_admin_queue(struct nvme_fc_ctrl *ctrl, in nvme_fc_connect_admin_queue() argument
1140 ctrl->lport->ops->lsrqst_priv_sz), GFP_KERNEL); in nvme_fc_connect_admin_queue()
1142 dev_info(ctrl->ctrl.device, in nvme_fc_connect_admin_queue()
1144 ctrl->cnum); in nvme_fc_connect_admin_queue()
1152 if (ctrl->lport->ops->lsrqst_priv_sz) in nvme_fc_connect_admin_queue()
1171 uuid_copy(&assoc_rqst->assoc_cmd.hostid, &ctrl->ctrl.opts->host->id); in nvme_fc_connect_admin_queue()
1172 strscpy(assoc_rqst->assoc_cmd.hostnqn, ctrl->ctrl.opts->host->nqn, in nvme_fc_connect_admin_queue()
1174 strscpy(assoc_rqst->assoc_cmd.subnqn, ctrl->ctrl.opts->subsysnqn, in nvme_fc_connect_admin_queue()
1184 ret = nvme_fc_send_ls_req(ctrl->rport, lsop); in nvme_fc_connect_admin_queue()
1221 dev_err(ctrl->dev, in nvme_fc_connect_admin_queue()
1225 spin_lock_irqsave(&ctrl->lock, flags); in nvme_fc_connect_admin_queue()
1226 ctrl->association_id = in nvme_fc_connect_admin_queue()
1231 spin_unlock_irqrestore(&ctrl->lock, flags); in nvme_fc_connect_admin_queue()
1238 dev_err(ctrl->dev, in nvme_fc_connect_admin_queue()
1245 nvme_fc_connect_queue(struct nvme_fc_ctrl *ctrl, struct nvme_fc_queue *queue, in nvme_fc_connect_queue() argument
1256 ctrl->lport->ops->lsrqst_priv_sz), GFP_KERNEL); in nvme_fc_connect_queue()
1258 dev_info(ctrl->ctrl.device, in nvme_fc_connect_queue()
1260 ctrl->cnum); in nvme_fc_connect_queue()
1268 if (ctrl->lport->ops->lsrqst_priv_sz) in nvme_fc_connect_queue()
1282 conn_rqst->associd.association_id = cpu_to_be64(ctrl->association_id); in nvme_fc_connect_queue()
1299 ret = nvme_fc_send_ls_req(ctrl->rport, lsop); in nvme_fc_connect_queue()
1327 dev_err(ctrl->dev, in nvme_fc_connect_queue()
1340 dev_err(ctrl->dev, in nvme_fc_connect_queue()
1376 nvme_fc_xmt_disconnect_assoc(struct nvme_fc_ctrl *ctrl) in nvme_fc_xmt_disconnect_assoc() argument
1386 ctrl->lport->ops->lsrqst_priv_sz), GFP_KERNEL); in nvme_fc_xmt_disconnect_assoc()
1388 dev_info(ctrl->ctrl.device, in nvme_fc_xmt_disconnect_assoc()
1391 ctrl->cnum); in nvme_fc_xmt_disconnect_assoc()
1398 if (ctrl->lport->ops->lsrqst_priv_sz) in nvme_fc_xmt_disconnect_assoc()
1404 ctrl->association_id); in nvme_fc_xmt_disconnect_assoc()
1406 ret = nvme_fc_send_ls_req_async(ctrl->rport, lsop, in nvme_fc_xmt_disconnect_assoc()
1464 struct nvme_fc_ctrl *ctrl, *ret = NULL; in nvme_fc_match_disconn_ls() local
1471 list_for_each_entry(ctrl, &rport->ctrl_list, ctrl_list) { in nvme_fc_match_disconn_ls()
1472 if (!nvme_fc_ctrl_get(ctrl)) in nvme_fc_match_disconn_ls()
1474 spin_lock(&ctrl->lock); in nvme_fc_match_disconn_ls()
1475 if (association_id == ctrl->association_id) { in nvme_fc_match_disconn_ls()
1476 oldls = ctrl->rcv_disconn; in nvme_fc_match_disconn_ls()
1477 ctrl->rcv_disconn = lsop; in nvme_fc_match_disconn_ls()
1478 ret = ctrl; in nvme_fc_match_disconn_ls()
1480 spin_unlock(&ctrl->lock); in nvme_fc_match_disconn_ls()
1482 /* leave the ctrl get reference */ in nvme_fc_match_disconn_ls()
1484 nvme_fc_ctrl_put(ctrl); in nvme_fc_match_disconn_ls()
1493 "LS's received\n", ctrl->cnum); in nvme_fc_match_disconn_ls()
1519 struct nvme_fc_ctrl *ctrl = NULL; in nvme_fc_ls_disconnect_assoc() local
1527 ctrl = nvme_fc_match_disconn_ls(rport, lsop); in nvme_fc_ls_disconnect_assoc()
1528 if (!ctrl) in nvme_fc_ls_disconnect_assoc()
1561 nvme_fc_error_recovery(ctrl, "Disconnect Association LS received"); in nvme_fc_ls_disconnect_assoc()
1564 nvme_fc_ctrl_put(ctrl); in nvme_fc_ls_disconnect_assoc()
1776 /* *********************** NVME Ctrl Routines **************************** */
1779 __nvme_fc_exit_request(struct nvme_fc_ctrl *ctrl, in __nvme_fc_exit_request() argument
1782 fc_dma_unmap_single(ctrl->lport->dev, op->fcp_req.rspdma, in __nvme_fc_exit_request()
1784 fc_dma_unmap_single(ctrl->lport->dev, op->fcp_req.cmddma, in __nvme_fc_exit_request()
1800 __nvme_fc_abort_op(struct nvme_fc_ctrl *ctrl, struct nvme_fc_fcp_op *op) in __nvme_fc_abort_op() argument
1805 spin_lock_irqsave(&ctrl->lock, flags); in __nvme_fc_abort_op()
1809 else if (test_bit(FCCTRL_TERMIO, &ctrl->flags)) { in __nvme_fc_abort_op()
1811 ctrl->iocnt++; in __nvme_fc_abort_op()
1813 spin_unlock_irqrestore(&ctrl->lock, flags); in __nvme_fc_abort_op()
1818 ctrl->lport->ops->fcp_abort(&ctrl->lport->localport, in __nvme_fc_abort_op()
1819 &ctrl->rport->remoteport, in __nvme_fc_abort_op()
1827 nvme_fc_abort_aen_ops(struct nvme_fc_ctrl *ctrl) in nvme_fc_abort_aen_ops() argument
1829 struct nvme_fc_fcp_op *aen_op = ctrl->aen_ops; in nvme_fc_abort_aen_ops()
1837 __nvme_fc_abort_op(ctrl, aen_op); in nvme_fc_abort_aen_ops()
1841 __nvme_fc_fcpop_chk_teardowns(struct nvme_fc_ctrl *ctrl, in __nvme_fc_fcpop_chk_teardowns() argument
1847 spin_lock_irqsave(&ctrl->lock, flags); in __nvme_fc_fcpop_chk_teardowns()
1848 if (test_bit(FCCTRL_TERMIO, &ctrl->flags) && in __nvme_fc_fcpop_chk_teardowns()
1850 if (!--ctrl->iocnt) in __nvme_fc_fcpop_chk_teardowns()
1851 wake_up(&ctrl->ioabort_wait); in __nvme_fc_fcpop_chk_teardowns()
1853 spin_unlock_irqrestore(&ctrl->lock, flags); in __nvme_fc_fcpop_chk_teardowns()
1860 struct nvme_fc_ctrl *ctrl = in nvme_fc_ctrl_ioerr_work() local
1863 nvme_fc_error_recovery(ctrl, "transport detected io error"); in nvme_fc_ctrl_ioerr_work()
1890 struct nvme_fc_ctrl *ctrl = op->ctrl; in nvme_fc_fcpio_done() local
1938 fc_dma_sync_single_for_cpu(ctrl->lport->dev, op->fcp_req.rspdma, in nvme_fc_fcpio_done()
1945 dev_info(ctrl->ctrl.device, in nvme_fc_fcpio_done()
1947 ctrl->cnum, freq->status); in nvme_fc_fcpio_done()
1977 dev_info(ctrl->ctrl.device, in nvme_fc_fcpio_done()
1980 ctrl->cnum, freq->transferred_length, in nvme_fc_fcpio_done()
1999 dev_info(ctrl->ctrl.device, in nvme_fc_fcpio_done()
2003 ctrl->cnum, be16_to_cpu(op->rsp_iu.iu_len), in nvme_fc_fcpio_done()
2017 dev_info(ctrl->ctrl.device, in nvme_fc_fcpio_done()
2020 ctrl->cnum, freq->rcv_rsplen); in nvme_fc_fcpio_done()
2028 nvme_complete_async_event(&queue->ctrl->ctrl, status, &result); in nvme_fc_fcpio_done()
2029 __nvme_fc_fcpop_chk_teardowns(ctrl, op, opstate); in nvme_fc_fcpio_done()
2032 nvme_fc_ctrl_put(ctrl); in nvme_fc_fcpio_done()
2036 __nvme_fc_fcpop_chk_teardowns(ctrl, op, opstate); in nvme_fc_fcpio_done()
2042 nvme_ctrl_state(&ctrl->ctrl) != NVME_CTRL_RESETTING) in nvme_fc_fcpio_done()
2043 queue_work(nvme_reset_wq, &ctrl->ioerr_work); in nvme_fc_fcpio_done()
2047 __nvme_fc_init_request(struct nvme_fc_ctrl *ctrl, in __nvme_fc_init_request() argument
2062 op->ctrl = ctrl; in __nvme_fc_init_request()
2076 op->fcp_req.cmddma = fc_dma_map_single(ctrl->lport->dev, in __nvme_fc_init_request()
2078 if (fc_dma_mapping_error(ctrl->lport->dev, op->fcp_req.cmddma)) { in __nvme_fc_init_request()
2079 dev_err(ctrl->dev, in __nvme_fc_init_request()
2085 op->fcp_req.rspdma = fc_dma_map_single(ctrl->lport->dev, in __nvme_fc_init_request()
2088 if (fc_dma_mapping_error(ctrl->lport->dev, op->fcp_req.rspdma)) { in __nvme_fc_init_request()
2089 dev_err(ctrl->dev, in __nvme_fc_init_request()
2103 struct nvme_fc_ctrl *ctrl = to_fc_ctrl(set->driver_data); in nvme_fc_init_request() local
2105 int queue_idx = (set == &ctrl->tag_set) ? hctx_idx + 1 : 0; in nvme_fc_init_request()
2106 struct nvme_fc_queue *queue = &ctrl->queues[queue_idx]; in nvme_fc_init_request()
2109 res = __nvme_fc_init_request(ctrl, queue, &op->op, rq, queue->rqcnt++); in nvme_fc_init_request()
2114 nvme_req(rq)->ctrl = &ctrl->ctrl; in nvme_fc_init_request()
2120 nvme_fc_init_aen_ops(struct nvme_fc_ctrl *ctrl) in nvme_fc_init_aen_ops() argument
2128 aen_op = ctrl->aen_ops; in nvme_fc_init_aen_ops()
2130 if (ctrl->lport->ops->fcprqst_priv_sz) { in nvme_fc_init_aen_ops()
2131 private = kzalloc(ctrl->lport->ops->fcprqst_priv_sz, in nvme_fc_init_aen_ops()
2139 ret = __nvme_fc_init_request(ctrl, &ctrl->queues[0], in nvme_fc_init_aen_ops()
2159 nvme_fc_term_aen_ops(struct nvme_fc_ctrl *ctrl) in nvme_fc_term_aen_ops() argument
2164 cancel_work_sync(&ctrl->ctrl.async_event_work); in nvme_fc_term_aen_ops()
2165 aen_op = ctrl->aen_ops; in nvme_fc_term_aen_ops()
2167 __nvme_fc_exit_request(ctrl, aen_op); in nvme_fc_term_aen_ops()
2177 struct nvme_fc_ctrl *ctrl = to_fc_ctrl(data); in __nvme_fc_init_hctx() local
2178 struct nvme_fc_queue *queue = &ctrl->queues[qidx]; in __nvme_fc_init_hctx()
2199 nvme_fc_init_queue(struct nvme_fc_ctrl *ctrl, int idx) in nvme_fc_init_queue() argument
2203 queue = &ctrl->queues[idx]; in nvme_fc_init_queue()
2205 queue->ctrl = ctrl; in nvme_fc_init_queue()
2208 queue->dev = ctrl->dev; in nvme_fc_init_queue()
2211 queue->cmnd_capsule_len = ctrl->ctrl.ioccsz * 16; in nvme_fc_init_queue()
2253 __nvme_fc_delete_hw_queue(struct nvme_fc_ctrl *ctrl, in __nvme_fc_delete_hw_queue() argument
2256 if (ctrl->lport->ops->delete_queue) in __nvme_fc_delete_hw_queue()
2257 ctrl->lport->ops->delete_queue(&ctrl->lport->localport, qidx, in __nvme_fc_delete_hw_queue()
2263 nvme_fc_free_io_queues(struct nvme_fc_ctrl *ctrl) in nvme_fc_free_io_queues() argument
2267 for (i = 1; i < ctrl->ctrl.queue_count; i++) in nvme_fc_free_io_queues()
2268 nvme_fc_free_queue(&ctrl->queues[i]); in nvme_fc_free_io_queues()
2272 __nvme_fc_create_hw_queue(struct nvme_fc_ctrl *ctrl, in __nvme_fc_create_hw_queue() argument
2278 if (ctrl->lport->ops->create_queue) in __nvme_fc_create_hw_queue()
2279 ret = ctrl->lport->ops->create_queue(&ctrl->lport->localport, in __nvme_fc_create_hw_queue()
2286 nvme_fc_delete_hw_io_queues(struct nvme_fc_ctrl *ctrl) in nvme_fc_delete_hw_io_queues() argument
2288 struct nvme_fc_queue *queue = &ctrl->queues[ctrl->ctrl.queue_count - 1]; in nvme_fc_delete_hw_io_queues()
2291 for (i = ctrl->ctrl.queue_count - 1; i >= 1; i--, queue--) in nvme_fc_delete_hw_io_queues()
2292 __nvme_fc_delete_hw_queue(ctrl, queue, i); in nvme_fc_delete_hw_io_queues()
2296 nvme_fc_create_hw_io_queues(struct nvme_fc_ctrl *ctrl, u16 qsize) in nvme_fc_create_hw_io_queues() argument
2298 struct nvme_fc_queue *queue = &ctrl->queues[1]; in nvme_fc_create_hw_io_queues()
2301 for (i = 1; i < ctrl->ctrl.queue_count; i++, queue++) { in nvme_fc_create_hw_io_queues()
2302 ret = __nvme_fc_create_hw_queue(ctrl, queue, i, qsize); in nvme_fc_create_hw_io_queues()
2311 __nvme_fc_delete_hw_queue(ctrl, &ctrl->queues[i], i); in nvme_fc_create_hw_io_queues()
2316 nvme_fc_connect_io_queues(struct nvme_fc_ctrl *ctrl, u16 qsize) in nvme_fc_connect_io_queues() argument
2320 for (i = 1; i < ctrl->ctrl.queue_count; i++) { in nvme_fc_connect_io_queues()
2321 ret = nvme_fc_connect_queue(ctrl, &ctrl->queues[i], qsize, in nvme_fc_connect_io_queues()
2325 ret = nvmf_connect_io_queue(&ctrl->ctrl, i); in nvme_fc_connect_io_queues()
2329 set_bit(NVME_FC_Q_LIVE, &ctrl->queues[i].flags); in nvme_fc_connect_io_queues()
2336 nvme_fc_init_io_queues(struct nvme_fc_ctrl *ctrl) in nvme_fc_init_io_queues() argument
2340 for (i = 1; i < ctrl->ctrl.queue_count; i++) in nvme_fc_init_io_queues()
2341 nvme_fc_init_queue(ctrl, i); in nvme_fc_init_io_queues()
2347 struct nvme_fc_ctrl *ctrl = in nvme_fc_ctrl_free() local
2351 if (ctrl->ctrl.tagset) in nvme_fc_ctrl_free()
2352 nvme_remove_io_tag_set(&ctrl->ctrl); in nvme_fc_ctrl_free()
2355 spin_lock_irqsave(&ctrl->rport->lock, flags); in nvme_fc_ctrl_free()
2356 list_del(&ctrl->ctrl_list); in nvme_fc_ctrl_free()
2357 spin_unlock_irqrestore(&ctrl->rport->lock, flags); in nvme_fc_ctrl_free()
2359 nvme_unquiesce_admin_queue(&ctrl->ctrl); in nvme_fc_ctrl_free()
2360 nvme_remove_admin_tag_set(&ctrl->ctrl); in nvme_fc_ctrl_free()
2362 kfree(ctrl->queues); in nvme_fc_ctrl_free()
2364 put_device(ctrl->dev); in nvme_fc_ctrl_free()
2365 nvme_fc_rport_put(ctrl->rport); in nvme_fc_ctrl_free()
2367 ida_free(&nvme_fc_ctrl_cnt, ctrl->cnum); in nvme_fc_ctrl_free()
2368 if (ctrl->ctrl.opts) in nvme_fc_ctrl_free()
2369 nvmf_free_options(ctrl->ctrl.opts); in nvme_fc_ctrl_free()
2370 kfree(ctrl); in nvme_fc_ctrl_free()
2374 nvme_fc_ctrl_put(struct nvme_fc_ctrl *ctrl) in nvme_fc_ctrl_put() argument
2376 kref_put(&ctrl->ref, nvme_fc_ctrl_free); in nvme_fc_ctrl_put()
2380 nvme_fc_ctrl_get(struct nvme_fc_ctrl *ctrl) in nvme_fc_ctrl_get() argument
2382 return kref_get_unless_zero(&ctrl->ref); in nvme_fc_ctrl_get()
2392 struct nvme_fc_ctrl *ctrl = to_fc_ctrl(nctrl); in nvme_fc_free_ctrl() local
2394 WARN_ON(nctrl != &ctrl->ctrl); in nvme_fc_free_ctrl()
2396 nvme_fc_ctrl_put(ctrl); in nvme_fc_free_ctrl()
2415 struct nvme_fc_ctrl *ctrl = to_fc_ctrl(nctrl); in nvme_fc_terminate_exchange() local
2419 __nvme_fc_abort_op(ctrl, op); in nvme_fc_terminate_exchange()
2433 __nvme_fc_abort_outstanding_ios(struct nvme_fc_ctrl *ctrl, bool start_queues) in __nvme_fc_abort_outstanding_ios() argument
2441 if (ctrl->ctrl.queue_count > 1) { in __nvme_fc_abort_outstanding_ios()
2442 for (q = 1; q < ctrl->ctrl.queue_count; q++) in __nvme_fc_abort_outstanding_ios()
2443 clear_bit(NVME_FC_Q_LIVE, &ctrl->queues[q].flags); in __nvme_fc_abort_outstanding_ios()
2445 clear_bit(NVME_FC_Q_LIVE, &ctrl->queues[0].flags); in __nvme_fc_abort_outstanding_ios()
2459 if (ctrl->ctrl.queue_count > 1) { in __nvme_fc_abort_outstanding_ios()
2460 nvme_quiesce_io_queues(&ctrl->ctrl); in __nvme_fc_abort_outstanding_ios()
2461 nvme_sync_io_queues(&ctrl->ctrl); in __nvme_fc_abort_outstanding_ios()
2462 blk_mq_tagset_busy_iter(&ctrl->tag_set, in __nvme_fc_abort_outstanding_ios()
2463 nvme_fc_terminate_exchange, &ctrl->ctrl); in __nvme_fc_abort_outstanding_ios()
2464 blk_mq_tagset_wait_completed_request(&ctrl->tag_set); in __nvme_fc_abort_outstanding_ios()
2466 nvme_unquiesce_io_queues(&ctrl->ctrl); in __nvme_fc_abort_outstanding_ios()
2484 nvme_quiesce_admin_queue(&ctrl->ctrl); in __nvme_fc_abort_outstanding_ios()
2485 blk_sync_queue(ctrl->ctrl.admin_q); in __nvme_fc_abort_outstanding_ios()
2486 blk_mq_tagset_busy_iter(&ctrl->admin_tag_set, in __nvme_fc_abort_outstanding_ios()
2487 nvme_fc_terminate_exchange, &ctrl->ctrl); in __nvme_fc_abort_outstanding_ios()
2488 blk_mq_tagset_wait_completed_request(&ctrl->admin_tag_set); in __nvme_fc_abort_outstanding_ios()
2490 nvme_unquiesce_admin_queue(&ctrl->ctrl); in __nvme_fc_abort_outstanding_ios()
2494 nvme_fc_error_recovery(struct nvme_fc_ctrl *ctrl, char *errmsg) in nvme_fc_error_recovery() argument
2496 enum nvme_ctrl_state state = nvme_ctrl_state(&ctrl->ctrl); in nvme_fc_error_recovery()
2506 __nvme_fc_abort_outstanding_ios(ctrl, true); in nvme_fc_error_recovery()
2507 dev_warn(ctrl->ctrl.device, in nvme_fc_error_recovery()
2509 ctrl->cnum); in nvme_fc_error_recovery()
2517 dev_warn(ctrl->ctrl.device, in nvme_fc_error_recovery()
2519 ctrl->cnum, errmsg); in nvme_fc_error_recovery()
2520 dev_warn(ctrl->ctrl.device, in nvme_fc_error_recovery()
2521 "NVME-FC{%d}: resetting controller\n", ctrl->cnum); in nvme_fc_error_recovery()
2523 nvme_reset_ctrl(&ctrl->ctrl); in nvme_fc_error_recovery()
2529 struct nvme_fc_ctrl *ctrl = op->ctrl; in nvme_fc_timeout() local
2538 dev_info(ctrl->ctrl.device, in nvme_fc_timeout()
2541 ctrl->cnum, qnum, sqe->common.opcode, sqe->fabrics.fctype, in nvme_fc_timeout()
2544 if (__nvme_fc_abort_op(ctrl, op)) in nvme_fc_timeout()
2545 nvme_fc_error_recovery(ctrl, "io timeout abort failed"); in nvme_fc_timeout()
2556 nvme_fc_map_data(struct nvme_fc_ctrl *ctrl, struct request *rq, in nvme_fc_map_data() argument
2576 freq->sg_cnt = fc_dma_map_sg(ctrl->lport->dev, freq->sg_table.sgl, in nvme_fc_map_data()
2591 nvme_fc_unmap_data(struct nvme_fc_ctrl *ctrl, struct request *rq, in nvme_fc_unmap_data() argument
2599 fc_dma_unmap_sg(ctrl->lport->dev, freq->sg_table.sgl, op->nents, in nvme_fc_unmap_data()
2631 nvme_fc_start_fcp_op(struct nvme_fc_ctrl *ctrl, struct nvme_fc_queue *queue, in nvme_fc_start_fcp_op() argument
2643 if (ctrl->rport->remoteport.port_state != FC_OBJSTATE_ONLINE) in nvme_fc_start_fcp_op()
2646 if (!nvme_fc_ctrl_get(ctrl)) in nvme_fc_start_fcp_op()
2690 ret = nvme_fc_map_data(ctrl, op->rq, op); in nvme_fc_start_fcp_op()
2693 nvme_fc_ctrl_put(ctrl); in nvme_fc_start_fcp_op()
2700 fc_dma_sync_single_for_device(ctrl->lport->dev, op->fcp_req.cmddma, in nvme_fc_start_fcp_op()
2709 ret = ctrl->lport->ops->fcp_io(&ctrl->lport->localport, in nvme_fc_start_fcp_op()
2710 &ctrl->rport->remoteport, in nvme_fc_start_fcp_op()
2727 __nvme_fc_fcpop_chk_teardowns(ctrl, op, opstate); in nvme_fc_start_fcp_op()
2730 nvme_fc_unmap_data(ctrl, op->rq, op); in nvme_fc_start_fcp_op()
2734 nvme_fc_ctrl_put(ctrl); in nvme_fc_start_fcp_op()
2736 if (ctrl->rport->remoteport.port_state == FC_OBJSTATE_ONLINE && in nvme_fc_start_fcp_op()
2752 struct nvme_fc_ctrl *ctrl = queue->ctrl; in nvme_fc_queue_rq() local
2760 if (ctrl->rport->remoteport.port_state != FC_OBJSTATE_ONLINE || in nvme_fc_queue_rq()
2761 !nvme_check_ready(&queue->ctrl->ctrl, rq, queue_ready)) in nvme_fc_queue_rq()
2762 return nvme_fail_nonready_command(&queue->ctrl->ctrl, rq); in nvme_fc_queue_rq()
2786 return nvme_fc_start_fcp_op(ctrl, queue, op, data_len, io_dir); in nvme_fc_queue_rq()
2792 struct nvme_fc_ctrl *ctrl = to_fc_ctrl(arg); in nvme_fc_submit_async_event() local
2796 if (test_bit(FCCTRL_TERMIO, &ctrl->flags)) in nvme_fc_submit_async_event()
2799 aen_op = &ctrl->aen_ops[0]; in nvme_fc_submit_async_event()
2801 ret = nvme_fc_start_fcp_op(ctrl, aen_op->queue, aen_op, 0, in nvme_fc_submit_async_event()
2804 dev_err(ctrl->ctrl.device, in nvme_fc_submit_async_event()
2812 struct nvme_fc_ctrl *ctrl = op->ctrl; in nvme_fc_complete_rq() local
2817 nvme_fc_unmap_data(ctrl, rq, op); in nvme_fc_complete_rq()
2819 nvme_fc_ctrl_put(ctrl); in nvme_fc_complete_rq()
2824 struct nvme_fc_ctrl *ctrl = to_fc_ctrl(set->driver_data); in nvme_fc_map_queues() local
2836 if (ctrl->lport->ops->map_queues) in nvme_fc_map_queues()
2837 ctrl->lport->ops->map_queues(&ctrl->lport->localport, in nvme_fc_map_queues()
2855 nvme_fc_create_io_queues(struct nvme_fc_ctrl *ctrl) in nvme_fc_create_io_queues() argument
2857 struct nvmf_ctrl_options *opts = ctrl->ctrl.opts; in nvme_fc_create_io_queues()
2862 ctrl->lport->ops->max_hw_queues); in nvme_fc_create_io_queues()
2863 ret = nvme_set_queue_count(&ctrl->ctrl, &nr_io_queues); in nvme_fc_create_io_queues()
2865 dev_info(ctrl->ctrl.device, in nvme_fc_create_io_queues()
2870 ctrl->ctrl.queue_count = nr_io_queues + 1; in nvme_fc_create_io_queues()
2874 nvme_fc_init_io_queues(ctrl); in nvme_fc_create_io_queues()
2876 ret = nvme_alloc_io_tag_set(&ctrl->ctrl, &ctrl->tag_set, in nvme_fc_create_io_queues()
2879 ctrl->lport->ops->fcprqst_priv_sz)); in nvme_fc_create_io_queues()
2883 ret = nvme_fc_create_hw_io_queues(ctrl, ctrl->ctrl.sqsize + 1); in nvme_fc_create_io_queues()
2887 ret = nvme_fc_connect_io_queues(ctrl, ctrl->ctrl.sqsize + 1); in nvme_fc_create_io_queues()
2891 ctrl->ioq_live = true; in nvme_fc_create_io_queues()
2896 nvme_fc_delete_hw_io_queues(ctrl); in nvme_fc_create_io_queues()
2898 nvme_remove_io_tag_set(&ctrl->ctrl); in nvme_fc_create_io_queues()
2899 nvme_fc_free_io_queues(ctrl); in nvme_fc_create_io_queues()
2902 ctrl->ctrl.tagset = NULL; in nvme_fc_create_io_queues()
2908 nvme_fc_recreate_io_queues(struct nvme_fc_ctrl *ctrl) in nvme_fc_recreate_io_queues() argument
2910 struct nvmf_ctrl_options *opts = ctrl->ctrl.opts; in nvme_fc_recreate_io_queues()
2911 u32 prior_ioq_cnt = ctrl->ctrl.queue_count - 1; in nvme_fc_recreate_io_queues()
2916 ctrl->lport->ops->max_hw_queues); in nvme_fc_recreate_io_queues()
2917 ret = nvme_set_queue_count(&ctrl->ctrl, &nr_io_queues); in nvme_fc_recreate_io_queues()
2919 dev_info(ctrl->ctrl.device, in nvme_fc_recreate_io_queues()
2925 dev_info(ctrl->ctrl.device, in nvme_fc_recreate_io_queues()
2931 ctrl->ctrl.queue_count = nr_io_queues + 1; in nvme_fc_recreate_io_queues()
2933 if (ctrl->ctrl.queue_count == 1) in nvme_fc_recreate_io_queues()
2937 dev_info(ctrl->ctrl.device, in nvme_fc_recreate_io_queues()
2940 blk_mq_update_nr_hw_queues(&ctrl->tag_set, nr_io_queues); in nvme_fc_recreate_io_queues()
2943 ret = nvme_fc_create_hw_io_queues(ctrl, ctrl->ctrl.sqsize + 1); in nvme_fc_recreate_io_queues()
2947 ret = nvme_fc_connect_io_queues(ctrl, ctrl->ctrl.sqsize + 1); in nvme_fc_recreate_io_queues()
2954 nvme_fc_delete_hw_io_queues(ctrl); in nvme_fc_recreate_io_queues()
2956 nvme_fc_free_io_queues(ctrl); in nvme_fc_recreate_io_queues()
2980 nvme_fc_ctlr_active_on_rport(struct nvme_fc_ctrl *ctrl) in nvme_fc_ctlr_active_on_rport() argument
2982 struct nvme_fc_rport *rport = ctrl->rport; in nvme_fc_ctlr_active_on_rport()
2985 if (test_and_set_bit(ASSOC_ACTIVE, &ctrl->flags)) in nvme_fc_ctlr_active_on_rport()
2996 nvme_fc_ctlr_inactive_on_rport(struct nvme_fc_ctrl *ctrl) in nvme_fc_ctlr_inactive_on_rport() argument
2998 struct nvme_fc_rport *rport = ctrl->rport; in nvme_fc_ctlr_inactive_on_rport()
3002 /* clearing of ctrl->flags ASSOC_ACTIVE bit is in association delete */ in nvme_fc_ctlr_inactive_on_rport()
3019 nvme_fc_create_association(struct nvme_fc_ctrl *ctrl) in nvme_fc_create_association() argument
3021 struct nvmf_ctrl_options *opts = ctrl->ctrl.opts; in nvme_fc_create_association()
3026 ++ctrl->ctrl.nr_reconnects; in nvme_fc_create_association()
3028 if (ctrl->rport->remoteport.port_state != FC_OBJSTATE_ONLINE) in nvme_fc_create_association()
3031 if (nvme_fc_ctlr_active_on_rport(ctrl)) in nvme_fc_create_association()
3034 dev_info(ctrl->ctrl.device, in nvme_fc_create_association()
3037 ctrl->cnum, ctrl->lport->localport.port_name, in nvme_fc_create_association()
3038 ctrl->rport->remoteport.port_name, ctrl->ctrl.opts->subsysnqn); in nvme_fc_create_association()
3040 clear_bit(ASSOC_FAILED, &ctrl->flags); in nvme_fc_create_association()
3046 ret = __nvme_fc_create_hw_queue(ctrl, &ctrl->queues[0], 0, in nvme_fc_create_association()
3051 ret = nvme_fc_connect_admin_queue(ctrl, &ctrl->queues[0], in nvme_fc_create_association()
3056 ret = nvmf_connect_admin_queue(&ctrl->ctrl); in nvme_fc_create_association()
3060 set_bit(NVME_FC_Q_LIVE, &ctrl->queues[0].flags); in nvme_fc_create_association()
3065 * todo:- add code to check if ctrl attributes changed from in nvme_fc_create_association()
3069 ret = nvme_enable_ctrl(&ctrl->ctrl); in nvme_fc_create_association()
3070 if (!ret && test_bit(ASSOC_FAILED, &ctrl->flags)) in nvme_fc_create_association()
3075 ctrl->ctrl.max_segments = ctrl->lport->ops->max_sgl_segments; in nvme_fc_create_association()
3076 ctrl->ctrl.max_hw_sectors = ctrl->ctrl.max_segments << in nvme_fc_create_association()
3079 nvme_unquiesce_admin_queue(&ctrl->ctrl); in nvme_fc_create_association()
3081 ret = nvme_init_ctrl_finish(&ctrl->ctrl, false); in nvme_fc_create_association()
3084 if (test_bit(ASSOC_FAILED, &ctrl->flags)) { in nvme_fc_create_association()
3091 if (ctrl->ctrl.icdoff) { in nvme_fc_create_association()
3092 dev_err(ctrl->ctrl.device, "icdoff %d is not supported!\n", in nvme_fc_create_association()
3093 ctrl->ctrl.icdoff); in nvme_fc_create_association()
3099 if (!nvme_ctrl_sgl_supported(&ctrl->ctrl)) { in nvme_fc_create_association()
3100 dev_err(ctrl->ctrl.device, in nvme_fc_create_association()
3106 if (opts->queue_size > ctrl->ctrl.maxcmd) { in nvme_fc_create_association()
3108 dev_warn(ctrl->ctrl.device, in nvme_fc_create_association()
3109 "queue_size %zu > ctrl maxcmd %u, reducing " in nvme_fc_create_association()
3111 opts->queue_size, ctrl->ctrl.maxcmd); in nvme_fc_create_association()
3112 opts->queue_size = ctrl->ctrl.maxcmd; in nvme_fc_create_association()
3113 ctrl->ctrl.sqsize = opts->queue_size - 1; in nvme_fc_create_association()
3116 ret = nvme_fc_init_aen_ops(ctrl); in nvme_fc_create_association()
3124 if (ctrl->ctrl.queue_count > 1) { in nvme_fc_create_association()
3125 if (!ctrl->ioq_live) in nvme_fc_create_association()
3126 ret = nvme_fc_create_io_queues(ctrl); in nvme_fc_create_association()
3128 ret = nvme_fc_recreate_io_queues(ctrl); in nvme_fc_create_association()
3130 if (!ret && test_bit(ASSOC_FAILED, &ctrl->flags)) in nvme_fc_create_association()
3135 if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_LIVE)) { in nvme_fc_create_association()
3140 ctrl->ctrl.nr_reconnects = 0; in nvme_fc_create_association()
3141 nvme_start_ctrl(&ctrl->ctrl); in nvme_fc_create_association()
3146 nvme_fc_term_aen_ops(ctrl); in nvme_fc_create_association()
3148 nvme_stop_keep_alive(&ctrl->ctrl); in nvme_fc_create_association()
3150 dev_warn(ctrl->ctrl.device, in nvme_fc_create_association()
3152 ctrl->cnum, ctrl->association_id, ret); in nvme_fc_create_association()
3154 nvme_fc_xmt_disconnect_assoc(ctrl); in nvme_fc_create_association()
3155 spin_lock_irqsave(&ctrl->lock, flags); in nvme_fc_create_association()
3156 ctrl->association_id = 0; in nvme_fc_create_association()
3157 disls = ctrl->rcv_disconn; in nvme_fc_create_association()
3158 ctrl->rcv_disconn = NULL; in nvme_fc_create_association()
3159 spin_unlock_irqrestore(&ctrl->lock, flags); in nvme_fc_create_association()
3163 __nvme_fc_delete_hw_queue(ctrl, &ctrl->queues[0], 0); in nvme_fc_create_association()
3165 nvme_fc_free_queue(&ctrl->queues[0]); in nvme_fc_create_association()
3166 clear_bit(ASSOC_ACTIVE, &ctrl->flags); in nvme_fc_create_association()
3167 nvme_fc_ctlr_inactive_on_rport(ctrl); in nvme_fc_create_association()
3180 nvme_fc_delete_association(struct nvme_fc_ctrl *ctrl) in nvme_fc_delete_association() argument
3185 if (!test_and_clear_bit(ASSOC_ACTIVE, &ctrl->flags)) in nvme_fc_delete_association()
3188 spin_lock_irqsave(&ctrl->lock, flags); in nvme_fc_delete_association()
3189 set_bit(FCCTRL_TERMIO, &ctrl->flags); in nvme_fc_delete_association()
3190 ctrl->iocnt = 0; in nvme_fc_delete_association()
3191 spin_unlock_irqrestore(&ctrl->lock, flags); in nvme_fc_delete_association()
3193 __nvme_fc_abort_outstanding_ios(ctrl, false); in nvme_fc_delete_association()
3196 nvme_fc_abort_aen_ops(ctrl); in nvme_fc_delete_association()
3199 spin_lock_irq(&ctrl->lock); in nvme_fc_delete_association()
3200 wait_event_lock_irq(ctrl->ioabort_wait, ctrl->iocnt == 0, ctrl->lock); in nvme_fc_delete_association()
3201 clear_bit(FCCTRL_TERMIO, &ctrl->flags); in nvme_fc_delete_association()
3202 spin_unlock_irq(&ctrl->lock); in nvme_fc_delete_association()
3204 nvme_fc_term_aen_ops(ctrl); in nvme_fc_delete_association()
3212 if (ctrl->association_id) in nvme_fc_delete_association()
3213 nvme_fc_xmt_disconnect_assoc(ctrl); in nvme_fc_delete_association()
3215 spin_lock_irqsave(&ctrl->lock, flags); in nvme_fc_delete_association()
3216 ctrl->association_id = 0; in nvme_fc_delete_association()
3217 disls = ctrl->rcv_disconn; in nvme_fc_delete_association()
3218 ctrl->rcv_disconn = NULL; in nvme_fc_delete_association()
3219 spin_unlock_irqrestore(&ctrl->lock, flags); in nvme_fc_delete_association()
3227 if (ctrl->ctrl.tagset) { in nvme_fc_delete_association()
3228 nvme_fc_delete_hw_io_queues(ctrl); in nvme_fc_delete_association()
3229 nvme_fc_free_io_queues(ctrl); in nvme_fc_delete_association()
3232 __nvme_fc_delete_hw_queue(ctrl, &ctrl->queues[0], 0); in nvme_fc_delete_association()
3233 nvme_fc_free_queue(&ctrl->queues[0]); in nvme_fc_delete_association()
3236 nvme_unquiesce_admin_queue(&ctrl->ctrl); in nvme_fc_delete_association()
3239 nvme_unquiesce_io_queues(&ctrl->ctrl); in nvme_fc_delete_association()
3241 nvme_fc_ctlr_inactive_on_rport(ctrl); in nvme_fc_delete_association()
3247 struct nvme_fc_ctrl *ctrl = to_fc_ctrl(nctrl); in nvme_fc_delete_ctrl() local
3249 cancel_work_sync(&ctrl->ioerr_work); in nvme_fc_delete_ctrl()
3250 cancel_delayed_work_sync(&ctrl->connect_work); in nvme_fc_delete_ctrl()
3255 nvme_fc_delete_association(ctrl); in nvme_fc_delete_ctrl()
3259 nvme_fc_reconnect_or_delete(struct nvme_fc_ctrl *ctrl, int status) in nvme_fc_reconnect_or_delete() argument
3261 struct nvme_fc_rport *rport = ctrl->rport; in nvme_fc_reconnect_or_delete()
3263 unsigned long recon_delay = ctrl->ctrl.opts->reconnect_delay * HZ; in nvme_fc_reconnect_or_delete()
3266 if (nvme_ctrl_state(&ctrl->ctrl) != NVME_CTRL_CONNECTING) in nvme_fc_reconnect_or_delete()
3270 dev_info(ctrl->ctrl.device, in nvme_fc_reconnect_or_delete()
3272 ctrl->cnum, status); in nvme_fc_reconnect_or_delete()
3276 if (recon && nvmf_should_reconnect(&ctrl->ctrl, status)) { in nvme_fc_reconnect_or_delete()
3278 dev_info(ctrl->ctrl.device, in nvme_fc_reconnect_or_delete()
3281 ctrl->cnum, recon_delay / HZ); in nvme_fc_reconnect_or_delete()
3285 queue_delayed_work(nvme_wq, &ctrl->connect_work, recon_delay); in nvme_fc_reconnect_or_delete()
3289 dev_warn(ctrl->ctrl.device, in nvme_fc_reconnect_or_delete()
3291 ctrl->cnum); in nvme_fc_reconnect_or_delete()
3293 dev_warn(ctrl->ctrl.device, in nvme_fc_reconnect_or_delete()
3296 ctrl->cnum, ctrl->ctrl.nr_reconnects); in nvme_fc_reconnect_or_delete()
3298 dev_warn(ctrl->ctrl.device, in nvme_fc_reconnect_or_delete()
3301 ctrl->cnum, min_t(int, portptr->dev_loss_tmo, in nvme_fc_reconnect_or_delete()
3302 (ctrl->ctrl.opts->max_reconnects * in nvme_fc_reconnect_or_delete()
3303 ctrl->ctrl.opts->reconnect_delay))); in nvme_fc_reconnect_or_delete()
3304 WARN_ON(nvme_delete_ctrl(&ctrl->ctrl)); in nvme_fc_reconnect_or_delete()
3311 struct nvme_fc_ctrl *ctrl = in nvme_fc_reset_ctrl_work() local
3312 container_of(work, struct nvme_fc_ctrl, ctrl.reset_work); in nvme_fc_reset_ctrl_work()
3314 nvme_stop_ctrl(&ctrl->ctrl); in nvme_fc_reset_ctrl_work()
3317 nvme_fc_delete_association(ctrl); in nvme_fc_reset_ctrl_work()
3319 if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_CONNECTING)) in nvme_fc_reset_ctrl_work()
3320 dev_err(ctrl->ctrl.device, in nvme_fc_reset_ctrl_work()
3322 "to CONNECTING\n", ctrl->cnum); in nvme_fc_reset_ctrl_work()
3324 if (ctrl->rport->remoteport.port_state == FC_OBJSTATE_ONLINE) { in nvme_fc_reset_ctrl_work()
3325 if (!queue_delayed_work(nvme_wq, &ctrl->connect_work, 0)) { in nvme_fc_reset_ctrl_work()
3326 dev_err(ctrl->ctrl.device, in nvme_fc_reset_ctrl_work()
3328 "after reset\n", ctrl->cnum); in nvme_fc_reset_ctrl_work()
3330 flush_delayed_work(&ctrl->connect_work); in nvme_fc_reset_ctrl_work()
3333 nvme_fc_reconnect_or_delete(ctrl, -ENOTCONN); in nvme_fc_reset_ctrl_work()
3357 struct nvme_fc_ctrl *ctrl = in nvme_fc_connect_ctrl_work() local
3361 ret = nvme_fc_create_association(ctrl); in nvme_fc_connect_ctrl_work()
3363 nvme_fc_reconnect_or_delete(ctrl, ret); in nvme_fc_connect_ctrl_work()
3365 dev_info(ctrl->ctrl.device, in nvme_fc_connect_ctrl_work()
3367 ctrl->cnum); in nvme_fc_connect_ctrl_work()
3393 struct nvme_fc_ctrl *ctrl; in nvme_fc_existing_controller() local
3398 list_for_each_entry(ctrl, &rport->ctrl_list, ctrl_list) { in nvme_fc_existing_controller()
3399 found = nvmf_ctlr_matches_baseopts(&ctrl->ctrl, opts); in nvme_fc_existing_controller()
3412 struct nvme_fc_ctrl *ctrl; in nvme_fc_alloc_ctrl() local
3427 ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL); in nvme_fc_alloc_ctrl()
3428 if (!ctrl) { in nvme_fc_alloc_ctrl()
3452 ctrl->ctrl.opts = opts; in nvme_fc_alloc_ctrl()
3453 ctrl->ctrl.nr_reconnects = 0; in nvme_fc_alloc_ctrl()
3454 INIT_LIST_HEAD(&ctrl->ctrl_list); in nvme_fc_alloc_ctrl()
3455 ctrl->lport = lport; in nvme_fc_alloc_ctrl()
3456 ctrl->rport = rport; in nvme_fc_alloc_ctrl()
3457 ctrl->dev = lport->dev; in nvme_fc_alloc_ctrl()
3458 ctrl->cnum = idx; in nvme_fc_alloc_ctrl()
3459 ctrl->ioq_live = false; in nvme_fc_alloc_ctrl()
3460 init_waitqueue_head(&ctrl->ioabort_wait); in nvme_fc_alloc_ctrl()
3462 get_device(ctrl->dev); in nvme_fc_alloc_ctrl()
3463 kref_init(&ctrl->ref); in nvme_fc_alloc_ctrl()
3465 INIT_WORK(&ctrl->ctrl.reset_work, nvme_fc_reset_ctrl_work); in nvme_fc_alloc_ctrl()
3466 INIT_DELAYED_WORK(&ctrl->connect_work, nvme_fc_connect_ctrl_work); in nvme_fc_alloc_ctrl()
3467 INIT_WORK(&ctrl->ioerr_work, nvme_fc_ctrl_ioerr_work); in nvme_fc_alloc_ctrl()
3468 spin_lock_init(&ctrl->lock); in nvme_fc_alloc_ctrl()
3471 ctrl->ctrl.queue_count = min_t(unsigned int, in nvme_fc_alloc_ctrl()
3474 ctrl->ctrl.queue_count++; /* +1 for admin queue */ in nvme_fc_alloc_ctrl()
3476 ctrl->ctrl.sqsize = opts->queue_size - 1; in nvme_fc_alloc_ctrl()
3477 ctrl->ctrl.kato = opts->kato; in nvme_fc_alloc_ctrl()
3478 ctrl->ctrl.cntlid = 0xffff; in nvme_fc_alloc_ctrl()
3481 ctrl->queues = kcalloc(ctrl->ctrl.queue_count, in nvme_fc_alloc_ctrl()
3483 if (!ctrl->queues) in nvme_fc_alloc_ctrl()
3486 nvme_fc_init_queue(ctrl, 0); in nvme_fc_alloc_ctrl()
3495 ret = nvme_init_ctrl(&ctrl->ctrl, dev, &nvme_fc_ctrl_ops, 0); in nvme_fc_alloc_ctrl()
3499 ctrl->ctrl.numa_node = dev_to_node(lport->dev); in nvme_fc_alloc_ctrl()
3501 return ctrl; in nvme_fc_alloc_ctrl()
3504 kfree(ctrl->queues); in nvme_fc_alloc_ctrl()
3506 put_device(ctrl->dev); in nvme_fc_alloc_ctrl()
3507 ida_free(&nvme_fc_ctrl_cnt, ctrl->cnum); in nvme_fc_alloc_ctrl()
3509 kfree(ctrl); in nvme_fc_alloc_ctrl()
3519 struct nvme_fc_ctrl *ctrl; in nvme_fc_init_ctrl() local
3523 ctrl = nvme_fc_alloc_ctrl(dev, opts, lport, rport); in nvme_fc_init_ctrl()
3524 if (IS_ERR(ctrl)) in nvme_fc_init_ctrl()
3525 return ERR_CAST(ctrl); in nvme_fc_init_ctrl()
3527 ret = nvme_add_ctrl(&ctrl->ctrl); in nvme_fc_init_ctrl()
3531 ret = nvme_alloc_admin_tag_set(&ctrl->ctrl, &ctrl->admin_tag_set, in nvme_fc_init_ctrl()
3534 ctrl->lport->ops->fcprqst_priv_sz)); in nvme_fc_init_ctrl()
3539 list_add_tail(&ctrl->ctrl_list, &rport->ctrl_list); in nvme_fc_init_ctrl()
3542 if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_CONNECTING)) { in nvme_fc_init_ctrl()
3543 dev_err(ctrl->ctrl.device, in nvme_fc_init_ctrl()
3544 "NVME-FC{%d}: failed to init ctrl state\n", ctrl->cnum); in nvme_fc_init_ctrl()
3548 if (!queue_delayed_work(nvme_wq, &ctrl->connect_work, 0)) { in nvme_fc_init_ctrl()
3549 dev_err(ctrl->ctrl.device, in nvme_fc_init_ctrl()
3551 ctrl->cnum); in nvme_fc_init_ctrl()
3555 flush_delayed_work(&ctrl->connect_work); in nvme_fc_init_ctrl()
3557 dev_info(ctrl->ctrl.device, in nvme_fc_init_ctrl()
3558 "NVME-FC{%d}: new ctrl: NQN \"%s\", hostnqn: %s\n", in nvme_fc_init_ctrl()
3559 ctrl->cnum, nvmf_ctrl_subsysnqn(&ctrl->ctrl), opts->host->nqn); in nvme_fc_init_ctrl()
3561 return &ctrl->ctrl; in nvme_fc_init_ctrl()
3564 nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_DELETING); in nvme_fc_init_ctrl()
3565 cancel_work_sync(&ctrl->ioerr_work); in nvme_fc_init_ctrl()
3566 cancel_work_sync(&ctrl->ctrl.reset_work); in nvme_fc_init_ctrl()
3567 cancel_delayed_work_sync(&ctrl->connect_work); in nvme_fc_init_ctrl()
3569 ctrl->ctrl.opts = NULL; in nvme_fc_init_ctrl()
3571 /* initiate nvme ctrl ref counting teardown */ in nvme_fc_init_ctrl()
3572 nvme_uninit_ctrl(&ctrl->ctrl); in nvme_fc_init_ctrl()
3575 /* Remove core ctrl ref. */ in nvme_fc_init_ctrl()
3576 nvme_put_ctrl(&ctrl->ctrl); in nvme_fc_init_ctrl()
3660 struct nvme_ctrl *ctrl; in nvme_fc_create_ctrl() local
3694 ctrl = nvme_fc_init_ctrl(dev, opts, lport, rport); in nvme_fc_create_ctrl()
3695 if (IS_ERR(ctrl)) in nvme_fc_create_ctrl()
3697 return ctrl; in nvme_fc_create_ctrl()
3914 struct nvme_fc_ctrl *ctrl; in nvme_fc_delete_controllers() local
3917 list_for_each_entry(ctrl, &rport->ctrl_list, ctrl_list) { in nvme_fc_delete_controllers()
3918 dev_warn(ctrl->ctrl.device, in nvme_fc_delete_controllers()
3919 "NVME-FC{%d}: transport unloading: deleting ctrl\n", in nvme_fc_delete_controllers()
3920 ctrl->cnum); in nvme_fc_delete_controllers()
3921 nvme_delete_ctrl(&ctrl->ctrl); in nvme_fc_delete_controllers()