• Home
  • Raw
  • Download

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 set_bit(ASSOC_FAILED, &ctrl->flags); in nvme_fc_ctrl_connectivity_loss()
790 nvme_reset_ctrl(&ctrl->ctrl); in nvme_fc_ctrl_connectivity_loss()
808 struct nvme_fc_ctrl *ctrl; in nvme_fc_unregister_remoteport() local
824 list_for_each_entry(ctrl, &rport->ctrl_list, ctrl_list) { in nvme_fc_unregister_remoteport()
827 dev_warn(ctrl->ctrl.device, in nvme_fc_unregister_remoteport()
829 ctrl->cnum); in nvme_fc_unregister_remoteport()
830 nvme_delete_ctrl(&ctrl->ctrl); in nvme_fc_unregister_remoteport()
832 nvme_fc_ctrl_connectivity_loss(ctrl); in nvme_fc_unregister_remoteport()
987 static void nvme_fc_error_recovery(struct nvme_fc_ctrl *ctrl, char *errmsg);
1129 nvme_fc_connect_admin_queue(struct nvme_fc_ctrl *ctrl, in nvme_fc_connect_admin_queue() argument
1141 ctrl->lport->ops->lsrqst_priv_sz), GFP_KERNEL); in nvme_fc_connect_admin_queue()
1143 dev_info(ctrl->ctrl.device, in nvme_fc_connect_admin_queue()
1145 ctrl->cnum); in nvme_fc_connect_admin_queue()
1153 if (ctrl->lport->ops->lsrqst_priv_sz) in nvme_fc_connect_admin_queue()
1172 uuid_copy(&assoc_rqst->assoc_cmd.hostid, &ctrl->ctrl.opts->host->id); in nvme_fc_connect_admin_queue()
1173 strscpy(assoc_rqst->assoc_cmd.hostnqn, ctrl->ctrl.opts->host->nqn, in nvme_fc_connect_admin_queue()
1175 strscpy(assoc_rqst->assoc_cmd.subnqn, ctrl->ctrl.opts->subsysnqn, in nvme_fc_connect_admin_queue()
1185 ret = nvme_fc_send_ls_req(ctrl->rport, lsop); in nvme_fc_connect_admin_queue()
1222 dev_err(ctrl->dev, in nvme_fc_connect_admin_queue()
1226 spin_lock_irqsave(&ctrl->lock, flags); in nvme_fc_connect_admin_queue()
1227 ctrl->association_id = in nvme_fc_connect_admin_queue()
1232 spin_unlock_irqrestore(&ctrl->lock, flags); in nvme_fc_connect_admin_queue()
1239 dev_err(ctrl->dev, in nvme_fc_connect_admin_queue()
1246 nvme_fc_connect_queue(struct nvme_fc_ctrl *ctrl, struct nvme_fc_queue *queue, in nvme_fc_connect_queue() argument
1257 ctrl->lport->ops->lsrqst_priv_sz), GFP_KERNEL); in nvme_fc_connect_queue()
1259 dev_info(ctrl->ctrl.device, in nvme_fc_connect_queue()
1261 ctrl->cnum); in nvme_fc_connect_queue()
1269 if (ctrl->lport->ops->lsrqst_priv_sz) in nvme_fc_connect_queue()
1283 conn_rqst->associd.association_id = cpu_to_be64(ctrl->association_id); in nvme_fc_connect_queue()
1300 ret = nvme_fc_send_ls_req(ctrl->rport, lsop); in nvme_fc_connect_queue()
1328 dev_err(ctrl->dev, in nvme_fc_connect_queue()
1341 dev_err(ctrl->dev, in nvme_fc_connect_queue()
1377 nvme_fc_xmt_disconnect_assoc(struct nvme_fc_ctrl *ctrl) in nvme_fc_xmt_disconnect_assoc() argument
1387 ctrl->lport->ops->lsrqst_priv_sz), GFP_KERNEL); in nvme_fc_xmt_disconnect_assoc()
1389 dev_info(ctrl->ctrl.device, in nvme_fc_xmt_disconnect_assoc()
1392 ctrl->cnum); in nvme_fc_xmt_disconnect_assoc()
1399 if (ctrl->lport->ops->lsrqst_priv_sz) in nvme_fc_xmt_disconnect_assoc()
1405 ctrl->association_id); in nvme_fc_xmt_disconnect_assoc()
1407 ret = nvme_fc_send_ls_req_async(ctrl->rport, lsop, in nvme_fc_xmt_disconnect_assoc()
1465 struct nvme_fc_ctrl *ctrl, *ret = NULL; in nvme_fc_match_disconn_ls() local
1472 list_for_each_entry(ctrl, &rport->ctrl_list, ctrl_list) { in nvme_fc_match_disconn_ls()
1473 if (!nvme_fc_ctrl_get(ctrl)) in nvme_fc_match_disconn_ls()
1475 spin_lock(&ctrl->lock); in nvme_fc_match_disconn_ls()
1476 if (association_id == ctrl->association_id) { in nvme_fc_match_disconn_ls()
1477 oldls = ctrl->rcv_disconn; in nvme_fc_match_disconn_ls()
1478 ctrl->rcv_disconn = lsop; in nvme_fc_match_disconn_ls()
1479 ret = ctrl; in nvme_fc_match_disconn_ls()
1481 spin_unlock(&ctrl->lock); in nvme_fc_match_disconn_ls()
1485 nvme_fc_ctrl_put(ctrl); in nvme_fc_match_disconn_ls()
1494 "LS's received\n", ctrl->cnum); in nvme_fc_match_disconn_ls()
1520 struct nvme_fc_ctrl *ctrl = NULL; in nvme_fc_ls_disconnect_assoc() local
1528 ctrl = nvme_fc_match_disconn_ls(rport, lsop); in nvme_fc_ls_disconnect_assoc()
1529 if (!ctrl) in nvme_fc_ls_disconnect_assoc()
1562 nvme_fc_error_recovery(ctrl, "Disconnect Association LS received"); in nvme_fc_ls_disconnect_assoc()
1565 nvme_fc_ctrl_put(ctrl); in nvme_fc_ls_disconnect_assoc()
1780 __nvme_fc_exit_request(struct nvme_fc_ctrl *ctrl, in __nvme_fc_exit_request() argument
1783 fc_dma_unmap_single(ctrl->lport->dev, op->fcp_req.rspdma, in __nvme_fc_exit_request()
1785 fc_dma_unmap_single(ctrl->lport->dev, op->fcp_req.cmddma, in __nvme_fc_exit_request()
1801 __nvme_fc_abort_op(struct nvme_fc_ctrl *ctrl, struct nvme_fc_fcp_op *op) in __nvme_fc_abort_op() argument
1806 spin_lock_irqsave(&ctrl->lock, flags); in __nvme_fc_abort_op()
1810 else if (test_bit(FCCTRL_TERMIO, &ctrl->flags)) { in __nvme_fc_abort_op()
1812 ctrl->iocnt++; in __nvme_fc_abort_op()
1814 spin_unlock_irqrestore(&ctrl->lock, flags); in __nvme_fc_abort_op()
1819 ctrl->lport->ops->fcp_abort(&ctrl->lport->localport, in __nvme_fc_abort_op()
1820 &ctrl->rport->remoteport, in __nvme_fc_abort_op()
1828 nvme_fc_abort_aen_ops(struct nvme_fc_ctrl *ctrl) in nvme_fc_abort_aen_ops() argument
1830 struct nvme_fc_fcp_op *aen_op = ctrl->aen_ops; in nvme_fc_abort_aen_ops()
1838 __nvme_fc_abort_op(ctrl, aen_op); in nvme_fc_abort_aen_ops()
1842 __nvme_fc_fcpop_chk_teardowns(struct nvme_fc_ctrl *ctrl, in __nvme_fc_fcpop_chk_teardowns() argument
1848 spin_lock_irqsave(&ctrl->lock, flags); in __nvme_fc_fcpop_chk_teardowns()
1849 if (test_bit(FCCTRL_TERMIO, &ctrl->flags) && in __nvme_fc_fcpop_chk_teardowns()
1851 if (!--ctrl->iocnt) in __nvme_fc_fcpop_chk_teardowns()
1852 wake_up(&ctrl->ioabort_wait); in __nvme_fc_fcpop_chk_teardowns()
1854 spin_unlock_irqrestore(&ctrl->lock, flags); in __nvme_fc_fcpop_chk_teardowns()
1861 struct nvme_fc_ctrl *ctrl = in nvme_fc_ctrl_ioerr_work() local
1864 nvme_fc_error_recovery(ctrl, "transport detected io error"); in nvme_fc_ctrl_ioerr_work()
1891 struct nvme_fc_ctrl *ctrl = op->ctrl; in nvme_fc_fcpio_done() local
1939 fc_dma_sync_single_for_cpu(ctrl->lport->dev, op->fcp_req.rspdma, in nvme_fc_fcpio_done()
1946 dev_info(ctrl->ctrl.device, in nvme_fc_fcpio_done()
1948 ctrl->cnum, freq->status); in nvme_fc_fcpio_done()
1978 dev_info(ctrl->ctrl.device, in nvme_fc_fcpio_done()
1981 ctrl->cnum, freq->transferred_length, in nvme_fc_fcpio_done()
2000 dev_info(ctrl->ctrl.device, in nvme_fc_fcpio_done()
2004 ctrl->cnum, be16_to_cpu(op->rsp_iu.iu_len), in nvme_fc_fcpio_done()
2018 dev_info(ctrl->ctrl.device, in nvme_fc_fcpio_done()
2021 ctrl->cnum, freq->rcv_rsplen); in nvme_fc_fcpio_done()
2029 nvme_complete_async_event(&queue->ctrl->ctrl, status, &result); in nvme_fc_fcpio_done()
2030 __nvme_fc_fcpop_chk_teardowns(ctrl, op, opstate); in nvme_fc_fcpio_done()
2033 nvme_fc_ctrl_put(ctrl); in nvme_fc_fcpio_done()
2037 __nvme_fc_fcpop_chk_teardowns(ctrl, op, opstate); in nvme_fc_fcpio_done()
2043 nvme_ctrl_state(&ctrl->ctrl) != NVME_CTRL_RESETTING) in nvme_fc_fcpio_done()
2044 queue_work(nvme_reset_wq, &ctrl->ioerr_work); in nvme_fc_fcpio_done()
2048 __nvme_fc_init_request(struct nvme_fc_ctrl *ctrl, in __nvme_fc_init_request() argument
2063 op->ctrl = ctrl; in __nvme_fc_init_request()
2077 op->fcp_req.cmddma = fc_dma_map_single(ctrl->lport->dev, in __nvme_fc_init_request()
2079 if (fc_dma_mapping_error(ctrl->lport->dev, op->fcp_req.cmddma)) { in __nvme_fc_init_request()
2080 dev_err(ctrl->dev, in __nvme_fc_init_request()
2086 op->fcp_req.rspdma = fc_dma_map_single(ctrl->lport->dev, in __nvme_fc_init_request()
2089 if (fc_dma_mapping_error(ctrl->lport->dev, op->fcp_req.rspdma)) { in __nvme_fc_init_request()
2090 dev_err(ctrl->dev, in __nvme_fc_init_request()
2104 struct nvme_fc_ctrl *ctrl = to_fc_ctrl(set->driver_data); in nvme_fc_init_request() local
2106 int queue_idx = (set == &ctrl->tag_set) ? hctx_idx + 1 : 0; in nvme_fc_init_request()
2107 struct nvme_fc_queue *queue = &ctrl->queues[queue_idx]; in nvme_fc_init_request()
2110 res = __nvme_fc_init_request(ctrl, queue, &op->op, rq, queue->rqcnt++); in nvme_fc_init_request()
2115 nvme_req(rq)->ctrl = &ctrl->ctrl; in nvme_fc_init_request()
2121 nvme_fc_init_aen_ops(struct nvme_fc_ctrl *ctrl) in nvme_fc_init_aen_ops() argument
2129 aen_op = ctrl->aen_ops; in nvme_fc_init_aen_ops()
2131 if (ctrl->lport->ops->fcprqst_priv_sz) { in nvme_fc_init_aen_ops()
2132 private = kzalloc(ctrl->lport->ops->fcprqst_priv_sz, in nvme_fc_init_aen_ops()
2140 ret = __nvme_fc_init_request(ctrl, &ctrl->queues[0], in nvme_fc_init_aen_ops()
2160 nvme_fc_term_aen_ops(struct nvme_fc_ctrl *ctrl) in nvme_fc_term_aen_ops() argument
2165 cancel_work_sync(&ctrl->ctrl.async_event_work); in nvme_fc_term_aen_ops()
2166 aen_op = ctrl->aen_ops; in nvme_fc_term_aen_ops()
2168 __nvme_fc_exit_request(ctrl, aen_op); in nvme_fc_term_aen_ops()
2178 struct nvme_fc_ctrl *ctrl = to_fc_ctrl(data); in __nvme_fc_init_hctx() local
2179 struct nvme_fc_queue *queue = &ctrl->queues[qidx]; in __nvme_fc_init_hctx()
2200 nvme_fc_init_queue(struct nvme_fc_ctrl *ctrl, int idx) in nvme_fc_init_queue() argument
2204 queue = &ctrl->queues[idx]; in nvme_fc_init_queue()
2206 queue->ctrl = ctrl; in nvme_fc_init_queue()
2209 queue->dev = ctrl->dev; in nvme_fc_init_queue()
2212 queue->cmnd_capsule_len = ctrl->ctrl.ioccsz * 16; in nvme_fc_init_queue()
2254 __nvme_fc_delete_hw_queue(struct nvme_fc_ctrl *ctrl, in __nvme_fc_delete_hw_queue() argument
2257 if (ctrl->lport->ops->delete_queue) in __nvme_fc_delete_hw_queue()
2258 ctrl->lport->ops->delete_queue(&ctrl->lport->localport, qidx, in __nvme_fc_delete_hw_queue()
2264 nvme_fc_free_io_queues(struct nvme_fc_ctrl *ctrl) in nvme_fc_free_io_queues() argument
2268 for (i = 1; i < ctrl->ctrl.queue_count; i++) in nvme_fc_free_io_queues()
2269 nvme_fc_free_queue(&ctrl->queues[i]); in nvme_fc_free_io_queues()
2273 __nvme_fc_create_hw_queue(struct nvme_fc_ctrl *ctrl, in __nvme_fc_create_hw_queue() argument
2279 if (ctrl->lport->ops->create_queue) in __nvme_fc_create_hw_queue()
2280 ret = ctrl->lport->ops->create_queue(&ctrl->lport->localport, in __nvme_fc_create_hw_queue()
2287 nvme_fc_delete_hw_io_queues(struct nvme_fc_ctrl *ctrl) in nvme_fc_delete_hw_io_queues() argument
2289 struct nvme_fc_queue *queue = &ctrl->queues[ctrl->ctrl.queue_count - 1]; in nvme_fc_delete_hw_io_queues()
2292 for (i = ctrl->ctrl.queue_count - 1; i >= 1; i--, queue--) in nvme_fc_delete_hw_io_queues()
2293 __nvme_fc_delete_hw_queue(ctrl, queue, i); in nvme_fc_delete_hw_io_queues()
2297 nvme_fc_create_hw_io_queues(struct nvme_fc_ctrl *ctrl, u16 qsize) in nvme_fc_create_hw_io_queues() argument
2299 struct nvme_fc_queue *queue = &ctrl->queues[1]; in nvme_fc_create_hw_io_queues()
2302 for (i = 1; i < ctrl->ctrl.queue_count; i++, queue++) { in nvme_fc_create_hw_io_queues()
2303 ret = __nvme_fc_create_hw_queue(ctrl, queue, i, qsize); in nvme_fc_create_hw_io_queues()
2312 __nvme_fc_delete_hw_queue(ctrl, &ctrl->queues[i], i); in nvme_fc_create_hw_io_queues()
2317 nvme_fc_connect_io_queues(struct nvme_fc_ctrl *ctrl, u16 qsize) in nvme_fc_connect_io_queues() argument
2321 for (i = 1; i < ctrl->ctrl.queue_count; i++) { in nvme_fc_connect_io_queues()
2322 ret = nvme_fc_connect_queue(ctrl, &ctrl->queues[i], qsize, in nvme_fc_connect_io_queues()
2326 ret = nvmf_connect_io_queue(&ctrl->ctrl, i); in nvme_fc_connect_io_queues()
2330 set_bit(NVME_FC_Q_LIVE, &ctrl->queues[i].flags); in nvme_fc_connect_io_queues()
2337 nvme_fc_init_io_queues(struct nvme_fc_ctrl *ctrl) in nvme_fc_init_io_queues() argument
2341 for (i = 1; i < ctrl->ctrl.queue_count; i++) in nvme_fc_init_io_queues()
2342 nvme_fc_init_queue(ctrl, i); in nvme_fc_init_io_queues()
2348 struct nvme_fc_ctrl *ctrl = in nvme_fc_ctrl_free() local
2352 if (ctrl->ctrl.tagset) in nvme_fc_ctrl_free()
2353 nvme_remove_io_tag_set(&ctrl->ctrl); in nvme_fc_ctrl_free()
2356 spin_lock_irqsave(&ctrl->rport->lock, flags); in nvme_fc_ctrl_free()
2357 list_del(&ctrl->ctrl_list); in nvme_fc_ctrl_free()
2358 spin_unlock_irqrestore(&ctrl->rport->lock, flags); in nvme_fc_ctrl_free()
2360 nvme_unquiesce_admin_queue(&ctrl->ctrl); in nvme_fc_ctrl_free()
2361 nvme_remove_admin_tag_set(&ctrl->ctrl); in nvme_fc_ctrl_free()
2363 kfree(ctrl->queues); in nvme_fc_ctrl_free()
2365 put_device(ctrl->dev); in nvme_fc_ctrl_free()
2366 nvme_fc_rport_put(ctrl->rport); in nvme_fc_ctrl_free()
2368 ida_free(&nvme_fc_ctrl_cnt, ctrl->cnum); in nvme_fc_ctrl_free()
2369 if (ctrl->ctrl.opts) in nvme_fc_ctrl_free()
2370 nvmf_free_options(ctrl->ctrl.opts); in nvme_fc_ctrl_free()
2371 kfree(ctrl); in nvme_fc_ctrl_free()
2375 nvme_fc_ctrl_put(struct nvme_fc_ctrl *ctrl) in nvme_fc_ctrl_put() argument
2377 kref_put(&ctrl->ref, nvme_fc_ctrl_free); in nvme_fc_ctrl_put()
2381 nvme_fc_ctrl_get(struct nvme_fc_ctrl *ctrl) in nvme_fc_ctrl_get() argument
2383 return kref_get_unless_zero(&ctrl->ref); in nvme_fc_ctrl_get()
2393 struct nvme_fc_ctrl *ctrl = to_fc_ctrl(nctrl); in nvme_fc_free_ctrl() local
2395 WARN_ON(nctrl != &ctrl->ctrl); in nvme_fc_free_ctrl()
2397 nvme_fc_ctrl_put(ctrl); in nvme_fc_free_ctrl()
2416 struct nvme_fc_ctrl *ctrl = to_fc_ctrl(nctrl); in nvme_fc_terminate_exchange() local
2420 __nvme_fc_abort_op(ctrl, op); in nvme_fc_terminate_exchange()
2434 __nvme_fc_abort_outstanding_ios(struct nvme_fc_ctrl *ctrl, bool start_queues) in __nvme_fc_abort_outstanding_ios() argument
2442 if (ctrl->ctrl.queue_count > 1) { in __nvme_fc_abort_outstanding_ios()
2443 for (q = 1; q < ctrl->ctrl.queue_count; q++) in __nvme_fc_abort_outstanding_ios()
2444 clear_bit(NVME_FC_Q_LIVE, &ctrl->queues[q].flags); in __nvme_fc_abort_outstanding_ios()
2446 clear_bit(NVME_FC_Q_LIVE, &ctrl->queues[0].flags); in __nvme_fc_abort_outstanding_ios()
2460 if (ctrl->ctrl.queue_count > 1) { in __nvme_fc_abort_outstanding_ios()
2461 nvme_quiesce_io_queues(&ctrl->ctrl); in __nvme_fc_abort_outstanding_ios()
2462 nvme_sync_io_queues(&ctrl->ctrl); in __nvme_fc_abort_outstanding_ios()
2463 blk_mq_tagset_busy_iter(&ctrl->tag_set, in __nvme_fc_abort_outstanding_ios()
2464 nvme_fc_terminate_exchange, &ctrl->ctrl); in __nvme_fc_abort_outstanding_ios()
2465 blk_mq_tagset_wait_completed_request(&ctrl->tag_set); in __nvme_fc_abort_outstanding_ios()
2467 nvme_unquiesce_io_queues(&ctrl->ctrl); in __nvme_fc_abort_outstanding_ios()
2485 nvme_quiesce_admin_queue(&ctrl->ctrl); in __nvme_fc_abort_outstanding_ios()
2486 blk_sync_queue(ctrl->ctrl.admin_q); in __nvme_fc_abort_outstanding_ios()
2487 blk_mq_tagset_busy_iter(&ctrl->admin_tag_set, in __nvme_fc_abort_outstanding_ios()
2488 nvme_fc_terminate_exchange, &ctrl->ctrl); in __nvme_fc_abort_outstanding_ios()
2489 blk_mq_tagset_wait_completed_request(&ctrl->admin_tag_set); in __nvme_fc_abort_outstanding_ios()
2491 nvme_unquiesce_admin_queue(&ctrl->ctrl); in __nvme_fc_abort_outstanding_ios()
2495 nvme_fc_error_recovery(struct nvme_fc_ctrl *ctrl, char *errmsg) in nvme_fc_error_recovery() argument
2497 enum nvme_ctrl_state state = nvme_ctrl_state(&ctrl->ctrl); in nvme_fc_error_recovery()
2507 __nvme_fc_abort_outstanding_ios(ctrl, true); in nvme_fc_error_recovery()
2508 dev_warn(ctrl->ctrl.device, in nvme_fc_error_recovery()
2510 ctrl->cnum); in nvme_fc_error_recovery()
2518 dev_warn(ctrl->ctrl.device, in nvme_fc_error_recovery()
2520 ctrl->cnum, errmsg); in nvme_fc_error_recovery()
2521 dev_warn(ctrl->ctrl.device, in nvme_fc_error_recovery()
2522 "NVME-FC{%d}: resetting controller\n", ctrl->cnum); in nvme_fc_error_recovery()
2524 nvme_reset_ctrl(&ctrl->ctrl); in nvme_fc_error_recovery()
2530 struct nvme_fc_ctrl *ctrl = op->ctrl; in nvme_fc_timeout() local
2539 dev_info(ctrl->ctrl.device, in nvme_fc_timeout()
2542 ctrl->cnum, qnum, sqe->common.opcode, sqe->fabrics.fctype, in nvme_fc_timeout()
2545 if (__nvme_fc_abort_op(ctrl, op)) in nvme_fc_timeout()
2546 nvme_fc_error_recovery(ctrl, "io timeout abort failed"); in nvme_fc_timeout()
2557 nvme_fc_map_data(struct nvme_fc_ctrl *ctrl, struct request *rq, in nvme_fc_map_data() argument
2577 freq->sg_cnt = fc_dma_map_sg(ctrl->lport->dev, freq->sg_table.sgl, in nvme_fc_map_data()
2592 nvme_fc_unmap_data(struct nvme_fc_ctrl *ctrl, struct request *rq, in nvme_fc_unmap_data() argument
2600 fc_dma_unmap_sg(ctrl->lport->dev, freq->sg_table.sgl, op->nents, in nvme_fc_unmap_data()
2632 nvme_fc_start_fcp_op(struct nvme_fc_ctrl *ctrl, struct nvme_fc_queue *queue, in nvme_fc_start_fcp_op() argument
2644 if (ctrl->rport->remoteport.port_state != FC_OBJSTATE_ONLINE) in nvme_fc_start_fcp_op()
2647 if (!nvme_fc_ctrl_get(ctrl)) in nvme_fc_start_fcp_op()
2691 ret = nvme_fc_map_data(ctrl, op->rq, op); in nvme_fc_start_fcp_op()
2694 nvme_fc_ctrl_put(ctrl); in nvme_fc_start_fcp_op()
2701 fc_dma_sync_single_for_device(ctrl->lport->dev, op->fcp_req.cmddma, in nvme_fc_start_fcp_op()
2710 ret = ctrl->lport->ops->fcp_io(&ctrl->lport->localport, in nvme_fc_start_fcp_op()
2711 &ctrl->rport->remoteport, in nvme_fc_start_fcp_op()
2728 __nvme_fc_fcpop_chk_teardowns(ctrl, op, opstate); in nvme_fc_start_fcp_op()
2731 nvme_fc_unmap_data(ctrl, op->rq, op); in nvme_fc_start_fcp_op()
2735 nvme_fc_ctrl_put(ctrl); in nvme_fc_start_fcp_op()
2737 if (ctrl->rport->remoteport.port_state == FC_OBJSTATE_ONLINE && in nvme_fc_start_fcp_op()
2753 struct nvme_fc_ctrl *ctrl = queue->ctrl; in nvme_fc_queue_rq() local
2761 if (ctrl->rport->remoteport.port_state != FC_OBJSTATE_ONLINE || in nvme_fc_queue_rq()
2762 !nvme_check_ready(&queue->ctrl->ctrl, rq, queue_ready)) in nvme_fc_queue_rq()
2763 return nvme_fail_nonready_command(&queue->ctrl->ctrl, rq); in nvme_fc_queue_rq()
2787 return nvme_fc_start_fcp_op(ctrl, queue, op, data_len, io_dir); in nvme_fc_queue_rq()
2793 struct nvme_fc_ctrl *ctrl = to_fc_ctrl(arg); in nvme_fc_submit_async_event() local
2797 if (test_bit(FCCTRL_TERMIO, &ctrl->flags)) in nvme_fc_submit_async_event()
2800 aen_op = &ctrl->aen_ops[0]; in nvme_fc_submit_async_event()
2802 ret = nvme_fc_start_fcp_op(ctrl, aen_op->queue, aen_op, 0, in nvme_fc_submit_async_event()
2805 dev_err(ctrl->ctrl.device, in nvme_fc_submit_async_event()
2813 struct nvme_fc_ctrl *ctrl = op->ctrl; in nvme_fc_complete_rq() local
2818 nvme_fc_unmap_data(ctrl, rq, op); in nvme_fc_complete_rq()
2820 nvme_fc_ctrl_put(ctrl); in nvme_fc_complete_rq()
2825 struct nvme_fc_ctrl *ctrl = to_fc_ctrl(set->driver_data); in nvme_fc_map_queues() local
2837 if (ctrl->lport->ops->map_queues) in nvme_fc_map_queues()
2838 ctrl->lport->ops->map_queues(&ctrl->lport->localport, in nvme_fc_map_queues()
2856 nvme_fc_create_io_queues(struct nvme_fc_ctrl *ctrl) in nvme_fc_create_io_queues() argument
2858 struct nvmf_ctrl_options *opts = ctrl->ctrl.opts; in nvme_fc_create_io_queues()
2863 ctrl->lport->ops->max_hw_queues); in nvme_fc_create_io_queues()
2864 ret = nvme_set_queue_count(&ctrl->ctrl, &nr_io_queues); in nvme_fc_create_io_queues()
2866 dev_info(ctrl->ctrl.device, in nvme_fc_create_io_queues()
2871 ctrl->ctrl.queue_count = nr_io_queues + 1; in nvme_fc_create_io_queues()
2875 nvme_fc_init_io_queues(ctrl); in nvme_fc_create_io_queues()
2877 ret = nvme_alloc_io_tag_set(&ctrl->ctrl, &ctrl->tag_set, in nvme_fc_create_io_queues()
2880 ctrl->lport->ops->fcprqst_priv_sz)); in nvme_fc_create_io_queues()
2884 ret = nvme_fc_create_hw_io_queues(ctrl, ctrl->ctrl.sqsize + 1); in nvme_fc_create_io_queues()
2888 ret = nvme_fc_connect_io_queues(ctrl, ctrl->ctrl.sqsize + 1); in nvme_fc_create_io_queues()
2892 ctrl->ioq_live = true; in nvme_fc_create_io_queues()
2897 nvme_fc_delete_hw_io_queues(ctrl); in nvme_fc_create_io_queues()
2899 nvme_remove_io_tag_set(&ctrl->ctrl); in nvme_fc_create_io_queues()
2900 nvme_fc_free_io_queues(ctrl); in nvme_fc_create_io_queues()
2903 ctrl->ctrl.tagset = NULL; in nvme_fc_create_io_queues()
2909 nvme_fc_recreate_io_queues(struct nvme_fc_ctrl *ctrl) in nvme_fc_recreate_io_queues() argument
2911 struct nvmf_ctrl_options *opts = ctrl->ctrl.opts; in nvme_fc_recreate_io_queues()
2912 u32 prior_ioq_cnt = ctrl->ctrl.queue_count - 1; in nvme_fc_recreate_io_queues()
2917 ctrl->lport->ops->max_hw_queues); in nvme_fc_recreate_io_queues()
2918 ret = nvme_set_queue_count(&ctrl->ctrl, &nr_io_queues); in nvme_fc_recreate_io_queues()
2920 dev_info(ctrl->ctrl.device, in nvme_fc_recreate_io_queues()
2926 dev_info(ctrl->ctrl.device, in nvme_fc_recreate_io_queues()
2932 ctrl->ctrl.queue_count = nr_io_queues + 1; in nvme_fc_recreate_io_queues()
2934 if (ctrl->ctrl.queue_count == 1) in nvme_fc_recreate_io_queues()
2938 dev_info(ctrl->ctrl.device, in nvme_fc_recreate_io_queues()
2941 blk_mq_update_nr_hw_queues(&ctrl->tag_set, nr_io_queues); in nvme_fc_recreate_io_queues()
2944 ret = nvme_fc_create_hw_io_queues(ctrl, ctrl->ctrl.sqsize + 1); in nvme_fc_recreate_io_queues()
2948 ret = nvme_fc_connect_io_queues(ctrl, ctrl->ctrl.sqsize + 1); in nvme_fc_recreate_io_queues()
2955 nvme_fc_delete_hw_io_queues(ctrl); in nvme_fc_recreate_io_queues()
2957 nvme_fc_free_io_queues(ctrl); in nvme_fc_recreate_io_queues()
2981 nvme_fc_ctlr_active_on_rport(struct nvme_fc_ctrl *ctrl) in nvme_fc_ctlr_active_on_rport() argument
2983 struct nvme_fc_rport *rport = ctrl->rport; in nvme_fc_ctlr_active_on_rport()
2986 if (test_and_set_bit(ASSOC_ACTIVE, &ctrl->flags)) in nvme_fc_ctlr_active_on_rport()
2997 nvme_fc_ctlr_inactive_on_rport(struct nvme_fc_ctrl *ctrl) in nvme_fc_ctlr_inactive_on_rport() argument
2999 struct nvme_fc_rport *rport = ctrl->rport; in nvme_fc_ctlr_inactive_on_rport()
3020 nvme_fc_create_association(struct nvme_fc_ctrl *ctrl) in nvme_fc_create_association() argument
3022 struct nvmf_ctrl_options *opts = ctrl->ctrl.opts; in nvme_fc_create_association()
3027 ++ctrl->ctrl.nr_reconnects; in nvme_fc_create_association()
3029 if (ctrl->rport->remoteport.port_state != FC_OBJSTATE_ONLINE) in nvme_fc_create_association()
3032 if (nvme_fc_ctlr_active_on_rport(ctrl)) in nvme_fc_create_association()
3035 dev_info(ctrl->ctrl.device, in nvme_fc_create_association()
3038 ctrl->cnum, ctrl->lport->localport.port_name, in nvme_fc_create_association()
3039 ctrl->rport->remoteport.port_name, ctrl->ctrl.opts->subsysnqn); in nvme_fc_create_association()
3041 clear_bit(ASSOC_FAILED, &ctrl->flags); in nvme_fc_create_association()
3047 ret = __nvme_fc_create_hw_queue(ctrl, &ctrl->queues[0], 0, in nvme_fc_create_association()
3052 ret = nvme_fc_connect_admin_queue(ctrl, &ctrl->queues[0], in nvme_fc_create_association()
3057 ret = nvmf_connect_admin_queue(&ctrl->ctrl); in nvme_fc_create_association()
3061 set_bit(NVME_FC_Q_LIVE, &ctrl->queues[0].flags); in nvme_fc_create_association()
3070 ret = nvme_enable_ctrl(&ctrl->ctrl); in nvme_fc_create_association()
3071 if (!ret && test_bit(ASSOC_FAILED, &ctrl->flags)) in nvme_fc_create_association()
3076 ctrl->ctrl.max_segments = ctrl->lport->ops->max_sgl_segments; in nvme_fc_create_association()
3077 ctrl->ctrl.max_hw_sectors = ctrl->ctrl.max_segments << in nvme_fc_create_association()
3080 nvme_unquiesce_admin_queue(&ctrl->ctrl); in nvme_fc_create_association()
3082 ret = nvme_init_ctrl_finish(&ctrl->ctrl, false); in nvme_fc_create_association()
3085 if (test_bit(ASSOC_FAILED, &ctrl->flags)) { in nvme_fc_create_association()
3092 if (ctrl->ctrl.icdoff) { in nvme_fc_create_association()
3093 dev_err(ctrl->ctrl.device, "icdoff %d is not supported!\n", in nvme_fc_create_association()
3094 ctrl->ctrl.icdoff); in nvme_fc_create_association()
3100 if (!nvme_ctrl_sgl_supported(&ctrl->ctrl)) { in nvme_fc_create_association()
3101 dev_err(ctrl->ctrl.device, in nvme_fc_create_association()
3107 if (opts->queue_size > ctrl->ctrl.maxcmd) { in nvme_fc_create_association()
3109 dev_warn(ctrl->ctrl.device, in nvme_fc_create_association()
3112 opts->queue_size, ctrl->ctrl.maxcmd); in nvme_fc_create_association()
3113 opts->queue_size = ctrl->ctrl.maxcmd; in nvme_fc_create_association()
3114 ctrl->ctrl.sqsize = opts->queue_size - 1; in nvme_fc_create_association()
3117 ret = nvme_fc_init_aen_ops(ctrl); in nvme_fc_create_association()
3125 if (ctrl->ctrl.queue_count > 1) { in nvme_fc_create_association()
3126 if (!ctrl->ioq_live) in nvme_fc_create_association()
3127 ret = nvme_fc_create_io_queues(ctrl); in nvme_fc_create_association()
3129 ret = nvme_fc_recreate_io_queues(ctrl); in nvme_fc_create_association()
3131 if (!ret && test_bit(ASSOC_FAILED, &ctrl->flags)) in nvme_fc_create_association()
3136 if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_LIVE)) { in nvme_fc_create_association()
3141 ctrl->ctrl.nr_reconnects = 0; in nvme_fc_create_association()
3142 nvme_start_ctrl(&ctrl->ctrl); in nvme_fc_create_association()
3147 nvme_fc_term_aen_ops(ctrl); in nvme_fc_create_association()
3149 nvme_stop_keep_alive(&ctrl->ctrl); in nvme_fc_create_association()
3151 dev_warn(ctrl->ctrl.device, in nvme_fc_create_association()
3153 ctrl->cnum, ctrl->association_id, ret); in nvme_fc_create_association()
3155 nvme_fc_xmt_disconnect_assoc(ctrl); in nvme_fc_create_association()
3156 spin_lock_irqsave(&ctrl->lock, flags); in nvme_fc_create_association()
3157 ctrl->association_id = 0; in nvme_fc_create_association()
3158 disls = ctrl->rcv_disconn; in nvme_fc_create_association()
3159 ctrl->rcv_disconn = NULL; in nvme_fc_create_association()
3160 spin_unlock_irqrestore(&ctrl->lock, flags); in nvme_fc_create_association()
3164 __nvme_fc_delete_hw_queue(ctrl, &ctrl->queues[0], 0); in nvme_fc_create_association()
3166 nvme_fc_free_queue(&ctrl->queues[0]); in nvme_fc_create_association()
3167 clear_bit(ASSOC_ACTIVE, &ctrl->flags); in nvme_fc_create_association()
3168 nvme_fc_ctlr_inactive_on_rport(ctrl); in nvme_fc_create_association()
3181 nvme_fc_delete_association(struct nvme_fc_ctrl *ctrl) in nvme_fc_delete_association() argument
3186 if (!test_and_clear_bit(ASSOC_ACTIVE, &ctrl->flags)) in nvme_fc_delete_association()
3189 spin_lock_irqsave(&ctrl->lock, flags); in nvme_fc_delete_association()
3190 set_bit(FCCTRL_TERMIO, &ctrl->flags); in nvme_fc_delete_association()
3191 ctrl->iocnt = 0; in nvme_fc_delete_association()
3192 spin_unlock_irqrestore(&ctrl->lock, flags); in nvme_fc_delete_association()
3194 __nvme_fc_abort_outstanding_ios(ctrl, false); in nvme_fc_delete_association()
3197 nvme_fc_abort_aen_ops(ctrl); in nvme_fc_delete_association()
3200 spin_lock_irq(&ctrl->lock); in nvme_fc_delete_association()
3201 wait_event_lock_irq(ctrl->ioabort_wait, ctrl->iocnt == 0, ctrl->lock); in nvme_fc_delete_association()
3202 clear_bit(FCCTRL_TERMIO, &ctrl->flags); in nvme_fc_delete_association()
3203 spin_unlock_irq(&ctrl->lock); in nvme_fc_delete_association()
3205 nvme_fc_term_aen_ops(ctrl); in nvme_fc_delete_association()
3213 if (ctrl->association_id) in nvme_fc_delete_association()
3214 nvme_fc_xmt_disconnect_assoc(ctrl); in nvme_fc_delete_association()
3216 spin_lock_irqsave(&ctrl->lock, flags); in nvme_fc_delete_association()
3217 ctrl->association_id = 0; in nvme_fc_delete_association()
3218 disls = ctrl->rcv_disconn; in nvme_fc_delete_association()
3219 ctrl->rcv_disconn = NULL; in nvme_fc_delete_association()
3220 spin_unlock_irqrestore(&ctrl->lock, flags); in nvme_fc_delete_association()
3228 if (ctrl->ctrl.tagset) { in nvme_fc_delete_association()
3229 nvme_fc_delete_hw_io_queues(ctrl); in nvme_fc_delete_association()
3230 nvme_fc_free_io_queues(ctrl); in nvme_fc_delete_association()
3233 __nvme_fc_delete_hw_queue(ctrl, &ctrl->queues[0], 0); in nvme_fc_delete_association()
3234 nvme_fc_free_queue(&ctrl->queues[0]); in nvme_fc_delete_association()
3237 nvme_unquiesce_admin_queue(&ctrl->ctrl); in nvme_fc_delete_association()
3240 nvme_unquiesce_io_queues(&ctrl->ctrl); in nvme_fc_delete_association()
3242 nvme_fc_ctlr_inactive_on_rport(ctrl); in nvme_fc_delete_association()
3248 struct nvme_fc_ctrl *ctrl = to_fc_ctrl(nctrl); in nvme_fc_delete_ctrl() local
3250 cancel_work_sync(&ctrl->ioerr_work); in nvme_fc_delete_ctrl()
3251 cancel_delayed_work_sync(&ctrl->connect_work); in nvme_fc_delete_ctrl()
3256 nvme_fc_delete_association(ctrl); in nvme_fc_delete_ctrl()
3260 nvme_fc_reconnect_or_delete(struct nvme_fc_ctrl *ctrl, int status) in nvme_fc_reconnect_or_delete() argument
3262 struct nvme_fc_rport *rport = ctrl->rport; in nvme_fc_reconnect_or_delete()
3264 unsigned long recon_delay = ctrl->ctrl.opts->reconnect_delay * HZ; in nvme_fc_reconnect_or_delete()
3267 if (nvme_ctrl_state(&ctrl->ctrl) != NVME_CTRL_CONNECTING) in nvme_fc_reconnect_or_delete()
3271 dev_info(ctrl->ctrl.device, in nvme_fc_reconnect_or_delete()
3273 ctrl->cnum, status); in nvme_fc_reconnect_or_delete()
3277 if (recon && nvmf_should_reconnect(&ctrl->ctrl, status)) { in nvme_fc_reconnect_or_delete()
3279 dev_info(ctrl->ctrl.device, in nvme_fc_reconnect_or_delete()
3282 ctrl->cnum, recon_delay / HZ); in nvme_fc_reconnect_or_delete()
3286 queue_delayed_work(nvme_wq, &ctrl->connect_work, recon_delay); in nvme_fc_reconnect_or_delete()
3290 dev_warn(ctrl->ctrl.device, in nvme_fc_reconnect_or_delete()
3292 ctrl->cnum); in nvme_fc_reconnect_or_delete()
3294 dev_warn(ctrl->ctrl.device, in nvme_fc_reconnect_or_delete()
3297 ctrl->cnum, ctrl->ctrl.nr_reconnects); in nvme_fc_reconnect_or_delete()
3299 dev_warn(ctrl->ctrl.device, in nvme_fc_reconnect_or_delete()
3302 ctrl->cnum, min_t(int, portptr->dev_loss_tmo, in nvme_fc_reconnect_or_delete()
3303 (ctrl->ctrl.opts->max_reconnects * in nvme_fc_reconnect_or_delete()
3304 ctrl->ctrl.opts->reconnect_delay))); in nvme_fc_reconnect_or_delete()
3305 WARN_ON(nvme_delete_ctrl(&ctrl->ctrl)); in nvme_fc_reconnect_or_delete()
3312 struct nvme_fc_ctrl *ctrl = in nvme_fc_reset_ctrl_work() local
3313 container_of(work, struct nvme_fc_ctrl, ctrl.reset_work); in nvme_fc_reset_ctrl_work()
3315 nvme_stop_ctrl(&ctrl->ctrl); in nvme_fc_reset_ctrl_work()
3318 nvme_fc_delete_association(ctrl); in nvme_fc_reset_ctrl_work()
3320 if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_CONNECTING)) in nvme_fc_reset_ctrl_work()
3321 dev_err(ctrl->ctrl.device, in nvme_fc_reset_ctrl_work()
3323 "to CONNECTING\n", ctrl->cnum); in nvme_fc_reset_ctrl_work()
3325 if (ctrl->rport->remoteport.port_state == FC_OBJSTATE_ONLINE) { in nvme_fc_reset_ctrl_work()
3326 if (!queue_delayed_work(nvme_wq, &ctrl->connect_work, 0)) { in nvme_fc_reset_ctrl_work()
3327 dev_err(ctrl->ctrl.device, in nvme_fc_reset_ctrl_work()
3329 "after reset\n", ctrl->cnum); in nvme_fc_reset_ctrl_work()
3331 flush_delayed_work(&ctrl->connect_work); in nvme_fc_reset_ctrl_work()
3334 nvme_fc_reconnect_or_delete(ctrl, -ENOTCONN); in nvme_fc_reset_ctrl_work()
3358 struct nvme_fc_ctrl *ctrl = in nvme_fc_connect_ctrl_work() local
3362 ret = nvme_fc_create_association(ctrl); in nvme_fc_connect_ctrl_work()
3364 nvme_fc_reconnect_or_delete(ctrl, ret); in nvme_fc_connect_ctrl_work()
3366 dev_info(ctrl->ctrl.device, in nvme_fc_connect_ctrl_work()
3368 ctrl->cnum); in nvme_fc_connect_ctrl_work()
3394 struct nvme_fc_ctrl *ctrl; in nvme_fc_existing_controller() local
3399 list_for_each_entry(ctrl, &rport->ctrl_list, ctrl_list) { in nvme_fc_existing_controller()
3400 found = nvmf_ctlr_matches_baseopts(&ctrl->ctrl, opts); in nvme_fc_existing_controller()
3413 struct nvme_fc_ctrl *ctrl; in nvme_fc_alloc_ctrl() local
3428 ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL); in nvme_fc_alloc_ctrl()
3429 if (!ctrl) { in nvme_fc_alloc_ctrl()
3453 ctrl->ctrl.opts = opts; in nvme_fc_alloc_ctrl()
3454 ctrl->ctrl.nr_reconnects = 0; in nvme_fc_alloc_ctrl()
3455 INIT_LIST_HEAD(&ctrl->ctrl_list); in nvme_fc_alloc_ctrl()
3456 ctrl->lport = lport; in nvme_fc_alloc_ctrl()
3457 ctrl->rport = rport; in nvme_fc_alloc_ctrl()
3458 ctrl->dev = lport->dev; in nvme_fc_alloc_ctrl()
3459 ctrl->cnum = idx; in nvme_fc_alloc_ctrl()
3460 ctrl->ioq_live = false; in nvme_fc_alloc_ctrl()
3461 init_waitqueue_head(&ctrl->ioabort_wait); in nvme_fc_alloc_ctrl()
3463 get_device(ctrl->dev); in nvme_fc_alloc_ctrl()
3464 kref_init(&ctrl->ref); in nvme_fc_alloc_ctrl()
3466 INIT_WORK(&ctrl->ctrl.reset_work, nvme_fc_reset_ctrl_work); in nvme_fc_alloc_ctrl()
3467 INIT_DELAYED_WORK(&ctrl->connect_work, nvme_fc_connect_ctrl_work); in nvme_fc_alloc_ctrl()
3468 INIT_WORK(&ctrl->ioerr_work, nvme_fc_ctrl_ioerr_work); in nvme_fc_alloc_ctrl()
3469 spin_lock_init(&ctrl->lock); in nvme_fc_alloc_ctrl()
3472 ctrl->ctrl.queue_count = min_t(unsigned int, in nvme_fc_alloc_ctrl()
3475 ctrl->ctrl.queue_count++; /* +1 for admin queue */ in nvme_fc_alloc_ctrl()
3477 ctrl->ctrl.sqsize = opts->queue_size - 1; in nvme_fc_alloc_ctrl()
3478 ctrl->ctrl.kato = opts->kato; in nvme_fc_alloc_ctrl()
3479 ctrl->ctrl.cntlid = 0xffff; in nvme_fc_alloc_ctrl()
3482 ctrl->queues = kcalloc(ctrl->ctrl.queue_count, in nvme_fc_alloc_ctrl()
3484 if (!ctrl->queues) in nvme_fc_alloc_ctrl()
3487 nvme_fc_init_queue(ctrl, 0); in nvme_fc_alloc_ctrl()
3496 ret = nvme_init_ctrl(&ctrl->ctrl, dev, &nvme_fc_ctrl_ops, 0); in nvme_fc_alloc_ctrl()
3500 ctrl->ctrl.numa_node = dev_to_node(lport->dev); in nvme_fc_alloc_ctrl()
3502 return ctrl; in nvme_fc_alloc_ctrl()
3505 kfree(ctrl->queues); in nvme_fc_alloc_ctrl()
3507 put_device(ctrl->dev); in nvme_fc_alloc_ctrl()
3508 ida_free(&nvme_fc_ctrl_cnt, ctrl->cnum); in nvme_fc_alloc_ctrl()
3510 kfree(ctrl); in nvme_fc_alloc_ctrl()
3520 struct nvme_fc_ctrl *ctrl; in nvme_fc_init_ctrl() local
3524 ctrl = nvme_fc_alloc_ctrl(dev, opts, lport, rport); in nvme_fc_init_ctrl()
3525 if (IS_ERR(ctrl)) in nvme_fc_init_ctrl()
3526 return ERR_CAST(ctrl); in nvme_fc_init_ctrl()
3528 ret = nvme_add_ctrl(&ctrl->ctrl); in nvme_fc_init_ctrl()
3532 ret = nvme_alloc_admin_tag_set(&ctrl->ctrl, &ctrl->admin_tag_set, in nvme_fc_init_ctrl()
3535 ctrl->lport->ops->fcprqst_priv_sz)); in nvme_fc_init_ctrl()
3540 list_add_tail(&ctrl->ctrl_list, &rport->ctrl_list); in nvme_fc_init_ctrl()
3543 if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_CONNECTING)) { in nvme_fc_init_ctrl()
3544 dev_err(ctrl->ctrl.device, in nvme_fc_init_ctrl()
3545 "NVME-FC{%d}: failed to init ctrl state\n", ctrl->cnum); in nvme_fc_init_ctrl()
3549 if (!queue_delayed_work(nvme_wq, &ctrl->connect_work, 0)) { in nvme_fc_init_ctrl()
3550 dev_err(ctrl->ctrl.device, in nvme_fc_init_ctrl()
3552 ctrl->cnum); in nvme_fc_init_ctrl()
3556 flush_delayed_work(&ctrl->connect_work); in nvme_fc_init_ctrl()
3558 dev_info(ctrl->ctrl.device, in nvme_fc_init_ctrl()
3560 ctrl->cnum, nvmf_ctrl_subsysnqn(&ctrl->ctrl), opts->host->nqn); in nvme_fc_init_ctrl()
3562 return &ctrl->ctrl; in nvme_fc_init_ctrl()
3565 nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_DELETING); in nvme_fc_init_ctrl()
3566 cancel_work_sync(&ctrl->ioerr_work); in nvme_fc_init_ctrl()
3567 cancel_work_sync(&ctrl->ctrl.reset_work); in nvme_fc_init_ctrl()
3568 cancel_delayed_work_sync(&ctrl->connect_work); in nvme_fc_init_ctrl()
3570 ctrl->ctrl.opts = NULL; in nvme_fc_init_ctrl()
3573 nvme_uninit_ctrl(&ctrl->ctrl); in nvme_fc_init_ctrl()
3577 nvme_put_ctrl(&ctrl->ctrl); in nvme_fc_init_ctrl()
3661 struct nvme_ctrl *ctrl; in nvme_fc_create_ctrl() local
3695 ctrl = nvme_fc_init_ctrl(dev, opts, lport, rport); in nvme_fc_create_ctrl()
3696 if (IS_ERR(ctrl)) in nvme_fc_create_ctrl()
3698 return ctrl; in nvme_fc_create_ctrl()
3915 struct nvme_fc_ctrl *ctrl; in nvme_fc_delete_controllers() local
3918 list_for_each_entry(ctrl, &rport->ctrl_list, ctrl_list) { in nvme_fc_delete_controllers()
3919 dev_warn(ctrl->ctrl.device, in nvme_fc_delete_controllers()
3921 ctrl->cnum); in nvme_fc_delete_controllers()
3922 nvme_delete_ctrl(&ctrl->ctrl); in nvme_fc_delete_controllers()