Lines Matching full:ctrl
87 struct nvme_rdma_ctrl *ctrl; member
120 struct nvme_ctrl ctrl; member
125 static inline struct nvme_rdma_ctrl *to_rdma_ctrl(struct nvme_ctrl *ctrl) in to_rdma_ctrl() argument
127 return container_of(ctrl, struct nvme_rdma_ctrl, ctrl); in to_rdma_ctrl()
163 return queue - queue->ctrl->queues; in nvme_rdma_queue_idx()
271 struct nvme_rdma_ctrl *ctrl = set->driver_data; in nvme_rdma_exit_request() local
273 int queue_idx = (set == &ctrl->tag_set) ? hctx_idx + 1 : 0; in nvme_rdma_exit_request()
274 struct nvme_rdma_queue *queue = &ctrl->queues[queue_idx]; in nvme_rdma_exit_request()
285 struct nvme_rdma_ctrl *ctrl = set->driver_data; in nvme_rdma_init_request() local
287 int queue_idx = (set == &ctrl->tag_set) ? hctx_idx + 1 : 0; in nvme_rdma_init_request()
288 struct nvme_rdma_queue *queue = &ctrl->queues[queue_idx]; in nvme_rdma_init_request()
293 nvme_req(rq)->ctrl = &ctrl->ctrl; in nvme_rdma_init_request()
307 struct nvme_rdma_ctrl *ctrl = data; in nvme_rdma_init_hctx() local
308 struct nvme_rdma_queue *queue = &ctrl->queues[hctx_idx + 1]; in nvme_rdma_init_hctx()
310 BUG_ON(hctx_idx >= ctrl->ctrl.queue_count); in nvme_rdma_init_hctx()
319 struct nvme_rdma_ctrl *ctrl = data; in nvme_rdma_init_admin_hctx() local
320 struct nvme_rdma_queue *queue = &ctrl->queues[0]; in nvme_rdma_init_admin_hctx()
478 dev_err(queue->ctrl->ctrl.device, in nvme_rdma_create_queue_ib()
500 static int nvme_rdma_alloc_queue(struct nvme_rdma_ctrl *ctrl, in nvme_rdma_alloc_queue() argument
507 queue = &ctrl->queues[idx]; in nvme_rdma_alloc_queue()
508 queue->ctrl = ctrl; in nvme_rdma_alloc_queue()
512 queue->cmnd_capsule_len = ctrl->ctrl.ioccsz * 16; in nvme_rdma_alloc_queue()
521 dev_info(ctrl->ctrl.device, in nvme_rdma_alloc_queue()
526 if (ctrl->ctrl.opts->mask & NVMF_OPT_HOST_TRADDR) in nvme_rdma_alloc_queue()
527 src_addr = (struct sockaddr *)&ctrl->src_addr; in nvme_rdma_alloc_queue()
531 (struct sockaddr *)&ctrl->addr, in nvme_rdma_alloc_queue()
534 dev_info(ctrl->ctrl.device, in nvme_rdma_alloc_queue()
541 dev_info(ctrl->ctrl.device, in nvme_rdma_alloc_queue()
574 static void nvme_rdma_free_io_queues(struct nvme_rdma_ctrl *ctrl) in nvme_rdma_free_io_queues() argument
578 for (i = 1; i < ctrl->ctrl.queue_count; i++) in nvme_rdma_free_io_queues()
579 nvme_rdma_free_queue(&ctrl->queues[i]); in nvme_rdma_free_io_queues()
582 static void nvme_rdma_stop_io_queues(struct nvme_rdma_ctrl *ctrl) in nvme_rdma_stop_io_queues() argument
586 for (i = 1; i < ctrl->ctrl.queue_count; i++) in nvme_rdma_stop_io_queues()
587 nvme_rdma_stop_queue(&ctrl->queues[i]); in nvme_rdma_stop_io_queues()
590 static int nvme_rdma_start_queue(struct nvme_rdma_ctrl *ctrl, int idx) in nvme_rdma_start_queue() argument
595 ret = nvmf_connect_io_queue(&ctrl->ctrl, idx); in nvme_rdma_start_queue()
597 ret = nvmf_connect_admin_queue(&ctrl->ctrl); in nvme_rdma_start_queue()
600 set_bit(NVME_RDMA_Q_LIVE, &ctrl->queues[idx].flags); in nvme_rdma_start_queue()
602 dev_info(ctrl->ctrl.device, in nvme_rdma_start_queue()
607 static int nvme_rdma_start_io_queues(struct nvme_rdma_ctrl *ctrl) in nvme_rdma_start_io_queues() argument
611 for (i = 1; i < ctrl->ctrl.queue_count; i++) { in nvme_rdma_start_io_queues()
612 ret = nvme_rdma_start_queue(ctrl, i); in nvme_rdma_start_io_queues()
621 nvme_rdma_stop_queue(&ctrl->queues[i]); in nvme_rdma_start_io_queues()
625 static int nvme_rdma_alloc_io_queues(struct nvme_rdma_ctrl *ctrl) in nvme_rdma_alloc_io_queues() argument
627 struct nvmf_ctrl_options *opts = ctrl->ctrl.opts; in nvme_rdma_alloc_io_queues()
628 struct ib_device *ibdev = ctrl->device->dev; in nvme_rdma_alloc_io_queues()
642 ret = nvme_set_queue_count(&ctrl->ctrl, &nr_io_queues); in nvme_rdma_alloc_io_queues()
646 ctrl->ctrl.queue_count = nr_io_queues + 1; in nvme_rdma_alloc_io_queues()
647 if (ctrl->ctrl.queue_count < 2) in nvme_rdma_alloc_io_queues()
650 dev_info(ctrl->ctrl.device, in nvme_rdma_alloc_io_queues()
653 for (i = 1; i < ctrl->ctrl.queue_count; i++) { in nvme_rdma_alloc_io_queues()
654 ret = nvme_rdma_alloc_queue(ctrl, i, in nvme_rdma_alloc_io_queues()
655 ctrl->ctrl.sqsize + 1); in nvme_rdma_alloc_io_queues()
664 nvme_rdma_free_queue(&ctrl->queues[i]); in nvme_rdma_alloc_io_queues()
672 struct nvme_rdma_ctrl *ctrl = to_rdma_ctrl(nctrl); in nvme_rdma_free_tagset() local
675 nvme_rdma_dev_put(ctrl->device); in nvme_rdma_free_tagset()
681 struct nvme_rdma_ctrl *ctrl = to_rdma_ctrl(nctrl); in nvme_rdma_alloc_tagset() local
686 set = &ctrl->admin_tag_set; in nvme_rdma_alloc_tagset()
694 set->driver_data = ctrl; in nvme_rdma_alloc_tagset()
699 set = &ctrl->tag_set; in nvme_rdma_alloc_tagset()
708 set->driver_data = ctrl; in nvme_rdma_alloc_tagset()
721 ret = nvme_rdma_dev_get(ctrl->device); in nvme_rdma_alloc_tagset()
735 static void nvme_rdma_destroy_admin_queue(struct nvme_rdma_ctrl *ctrl, in nvme_rdma_destroy_admin_queue() argument
739 blk_cleanup_queue(ctrl->ctrl.admin_q); in nvme_rdma_destroy_admin_queue()
740 nvme_rdma_free_tagset(&ctrl->ctrl, ctrl->ctrl.admin_tagset); in nvme_rdma_destroy_admin_queue()
742 if (ctrl->async_event_sqe.data) { in nvme_rdma_destroy_admin_queue()
743 cancel_work_sync(&ctrl->ctrl.async_event_work); in nvme_rdma_destroy_admin_queue()
744 nvme_rdma_free_qe(ctrl->device->dev, &ctrl->async_event_sqe, in nvme_rdma_destroy_admin_queue()
746 ctrl->async_event_sqe.data = NULL; in nvme_rdma_destroy_admin_queue()
748 nvme_rdma_free_queue(&ctrl->queues[0]); in nvme_rdma_destroy_admin_queue()
751 static int nvme_rdma_configure_admin_queue(struct nvme_rdma_ctrl *ctrl, in nvme_rdma_configure_admin_queue() argument
756 error = nvme_rdma_alloc_queue(ctrl, 0, NVME_AQ_DEPTH); in nvme_rdma_configure_admin_queue()
760 ctrl->device = ctrl->queues[0].device; in nvme_rdma_configure_admin_queue()
762 ctrl->max_fr_pages = nvme_rdma_get_max_fr_pages(ctrl->device->dev); in nvme_rdma_configure_admin_queue()
764 error = nvme_rdma_alloc_qe(ctrl->device->dev, &ctrl->async_event_sqe, in nvme_rdma_configure_admin_queue()
770 ctrl->ctrl.admin_tagset = nvme_rdma_alloc_tagset(&ctrl->ctrl, true); in nvme_rdma_configure_admin_queue()
771 if (IS_ERR(ctrl->ctrl.admin_tagset)) { in nvme_rdma_configure_admin_queue()
772 error = PTR_ERR(ctrl->ctrl.admin_tagset); in nvme_rdma_configure_admin_queue()
776 ctrl->ctrl.admin_q = blk_mq_init_queue(&ctrl->admin_tag_set); in nvme_rdma_configure_admin_queue()
777 if (IS_ERR(ctrl->ctrl.admin_q)) { in nvme_rdma_configure_admin_queue()
778 error = PTR_ERR(ctrl->ctrl.admin_q); in nvme_rdma_configure_admin_queue()
783 error = nvme_rdma_start_queue(ctrl, 0); in nvme_rdma_configure_admin_queue()
787 error = ctrl->ctrl.ops->reg_read64(&ctrl->ctrl, NVME_REG_CAP, in nvme_rdma_configure_admin_queue()
788 &ctrl->ctrl.cap); in nvme_rdma_configure_admin_queue()
790 dev_err(ctrl->ctrl.device, in nvme_rdma_configure_admin_queue()
795 ctrl->ctrl.sqsize = in nvme_rdma_configure_admin_queue()
796 min_t(int, NVME_CAP_MQES(ctrl->ctrl.cap), ctrl->ctrl.sqsize); in nvme_rdma_configure_admin_queue()
798 error = nvme_enable_ctrl(&ctrl->ctrl, ctrl->ctrl.cap); in nvme_rdma_configure_admin_queue()
802 ctrl->ctrl.max_hw_sectors = in nvme_rdma_configure_admin_queue()
803 (ctrl->max_fr_pages - 1) << (ilog2(SZ_4K) - 9); in nvme_rdma_configure_admin_queue()
805 error = nvme_init_identify(&ctrl->ctrl); in nvme_rdma_configure_admin_queue()
812 nvme_rdma_stop_queue(&ctrl->queues[0]); in nvme_rdma_configure_admin_queue()
815 blk_cleanup_queue(ctrl->ctrl.admin_q); in nvme_rdma_configure_admin_queue()
818 nvme_rdma_free_tagset(&ctrl->ctrl, ctrl->ctrl.admin_tagset); in nvme_rdma_configure_admin_queue()
820 if (ctrl->async_event_sqe.data) { in nvme_rdma_configure_admin_queue()
821 nvme_rdma_free_qe(ctrl->device->dev, &ctrl->async_event_sqe, in nvme_rdma_configure_admin_queue()
823 ctrl->async_event_sqe.data = NULL; in nvme_rdma_configure_admin_queue()
826 nvme_rdma_free_queue(&ctrl->queues[0]); in nvme_rdma_configure_admin_queue()
830 static void nvme_rdma_destroy_io_queues(struct nvme_rdma_ctrl *ctrl, in nvme_rdma_destroy_io_queues() argument
834 blk_cleanup_queue(ctrl->ctrl.connect_q); in nvme_rdma_destroy_io_queues()
835 nvme_rdma_free_tagset(&ctrl->ctrl, ctrl->ctrl.tagset); in nvme_rdma_destroy_io_queues()
837 nvme_rdma_free_io_queues(ctrl); in nvme_rdma_destroy_io_queues()
840 static int nvme_rdma_configure_io_queues(struct nvme_rdma_ctrl *ctrl, bool new) in nvme_rdma_configure_io_queues() argument
844 ret = nvme_rdma_alloc_io_queues(ctrl); in nvme_rdma_configure_io_queues()
849 ctrl->ctrl.tagset = nvme_rdma_alloc_tagset(&ctrl->ctrl, false); in nvme_rdma_configure_io_queues()
850 if (IS_ERR(ctrl->ctrl.tagset)) { in nvme_rdma_configure_io_queues()
851 ret = PTR_ERR(ctrl->ctrl.tagset); in nvme_rdma_configure_io_queues()
855 ctrl->ctrl.connect_q = blk_mq_init_queue(&ctrl->tag_set); in nvme_rdma_configure_io_queues()
856 if (IS_ERR(ctrl->ctrl.connect_q)) { in nvme_rdma_configure_io_queues()
857 ret = PTR_ERR(ctrl->ctrl.connect_q); in nvme_rdma_configure_io_queues()
861 blk_mq_update_nr_hw_queues(&ctrl->tag_set, in nvme_rdma_configure_io_queues()
862 ctrl->ctrl.queue_count - 1); in nvme_rdma_configure_io_queues()
865 ret = nvme_rdma_start_io_queues(ctrl); in nvme_rdma_configure_io_queues()
873 blk_cleanup_queue(ctrl->ctrl.connect_q); in nvme_rdma_configure_io_queues()
876 nvme_rdma_free_tagset(&ctrl->ctrl, ctrl->ctrl.tagset); in nvme_rdma_configure_io_queues()
878 nvme_rdma_free_io_queues(ctrl); in nvme_rdma_configure_io_queues()
882 static void nvme_rdma_teardown_admin_queue(struct nvme_rdma_ctrl *ctrl, in nvme_rdma_teardown_admin_queue() argument
885 mutex_lock(&ctrl->teardown_lock); in nvme_rdma_teardown_admin_queue()
886 blk_mq_quiesce_queue(ctrl->ctrl.admin_q); in nvme_rdma_teardown_admin_queue()
887 nvme_rdma_stop_queue(&ctrl->queues[0]); in nvme_rdma_teardown_admin_queue()
888 if (ctrl->ctrl.admin_tagset) in nvme_rdma_teardown_admin_queue()
889 blk_mq_tagset_busy_iter(ctrl->ctrl.admin_tagset, in nvme_rdma_teardown_admin_queue()
890 nvme_cancel_request, &ctrl->ctrl); in nvme_rdma_teardown_admin_queue()
891 blk_mq_unquiesce_queue(ctrl->ctrl.admin_q); in nvme_rdma_teardown_admin_queue()
892 nvme_rdma_destroy_admin_queue(ctrl, remove); in nvme_rdma_teardown_admin_queue()
893 mutex_unlock(&ctrl->teardown_lock); in nvme_rdma_teardown_admin_queue()
896 static void nvme_rdma_teardown_io_queues(struct nvme_rdma_ctrl *ctrl, in nvme_rdma_teardown_io_queues() argument
899 mutex_lock(&ctrl->teardown_lock); in nvme_rdma_teardown_io_queues()
900 if (ctrl->ctrl.queue_count > 1) { in nvme_rdma_teardown_io_queues()
901 nvme_stop_queues(&ctrl->ctrl); in nvme_rdma_teardown_io_queues()
902 nvme_rdma_stop_io_queues(ctrl); in nvme_rdma_teardown_io_queues()
903 if (ctrl->ctrl.tagset) in nvme_rdma_teardown_io_queues()
904 blk_mq_tagset_busy_iter(ctrl->ctrl.tagset, in nvme_rdma_teardown_io_queues()
905 nvme_cancel_request, &ctrl->ctrl); in nvme_rdma_teardown_io_queues()
907 nvme_start_queues(&ctrl->ctrl); in nvme_rdma_teardown_io_queues()
908 nvme_rdma_destroy_io_queues(ctrl, remove); in nvme_rdma_teardown_io_queues()
910 mutex_unlock(&ctrl->teardown_lock); in nvme_rdma_teardown_io_queues()
915 struct nvme_rdma_ctrl *ctrl = to_rdma_ctrl(nctrl); in nvme_rdma_stop_ctrl() local
917 cancel_work_sync(&ctrl->err_work); in nvme_rdma_stop_ctrl()
918 cancel_delayed_work_sync(&ctrl->reconnect_work); in nvme_rdma_stop_ctrl()
923 struct nvme_rdma_ctrl *ctrl = to_rdma_ctrl(nctrl); in nvme_rdma_free_ctrl() local
925 if (list_empty(&ctrl->list)) in nvme_rdma_free_ctrl()
929 list_del(&ctrl->list); in nvme_rdma_free_ctrl()
934 kfree(ctrl->queues); in nvme_rdma_free_ctrl()
935 kfree(ctrl); in nvme_rdma_free_ctrl()
938 static void nvme_rdma_reconnect_or_remove(struct nvme_rdma_ctrl *ctrl) in nvme_rdma_reconnect_or_remove() argument
941 if (ctrl->ctrl.state != NVME_CTRL_CONNECTING) { in nvme_rdma_reconnect_or_remove()
942 WARN_ON_ONCE(ctrl->ctrl.state == NVME_CTRL_NEW || in nvme_rdma_reconnect_or_remove()
943 ctrl->ctrl.state == NVME_CTRL_LIVE); in nvme_rdma_reconnect_or_remove()
947 if (nvmf_should_reconnect(&ctrl->ctrl)) { in nvme_rdma_reconnect_or_remove()
948 dev_info(ctrl->ctrl.device, "Reconnecting in %d seconds...\n", in nvme_rdma_reconnect_or_remove()
949 ctrl->ctrl.opts->reconnect_delay); in nvme_rdma_reconnect_or_remove()
950 queue_delayed_work(nvme_wq, &ctrl->reconnect_work, in nvme_rdma_reconnect_or_remove()
951 ctrl->ctrl.opts->reconnect_delay * HZ); in nvme_rdma_reconnect_or_remove()
953 nvme_delete_ctrl(&ctrl->ctrl); in nvme_rdma_reconnect_or_remove()
957 static int nvme_rdma_setup_ctrl(struct nvme_rdma_ctrl *ctrl, bool new) in nvme_rdma_setup_ctrl() argument
962 ret = nvme_rdma_configure_admin_queue(ctrl, new); in nvme_rdma_setup_ctrl()
966 if (ctrl->ctrl.icdoff) { in nvme_rdma_setup_ctrl()
967 dev_err(ctrl->ctrl.device, "icdoff is not supported!\n"); in nvme_rdma_setup_ctrl()
971 if (!(ctrl->ctrl.sgls & (1 << 2))) { in nvme_rdma_setup_ctrl()
972 dev_err(ctrl->ctrl.device, in nvme_rdma_setup_ctrl()
977 if (ctrl->ctrl.opts->queue_size > ctrl->ctrl.sqsize + 1) { in nvme_rdma_setup_ctrl()
978 dev_warn(ctrl->ctrl.device, in nvme_rdma_setup_ctrl()
979 "queue_size %zu > ctrl sqsize %u, clamping down\n", in nvme_rdma_setup_ctrl()
980 ctrl->ctrl.opts->queue_size, ctrl->ctrl.sqsize + 1); in nvme_rdma_setup_ctrl()
983 if (ctrl->ctrl.sqsize + 1 > ctrl->ctrl.maxcmd) { in nvme_rdma_setup_ctrl()
984 dev_warn(ctrl->ctrl.device, in nvme_rdma_setup_ctrl()
985 "sqsize %u > ctrl maxcmd %u, clamping down\n", in nvme_rdma_setup_ctrl()
986 ctrl->ctrl.sqsize + 1, ctrl->ctrl.maxcmd); in nvme_rdma_setup_ctrl()
987 ctrl->ctrl.sqsize = ctrl->ctrl.maxcmd - 1; in nvme_rdma_setup_ctrl()
990 if (ctrl->ctrl.sgls & (1 << 20)) in nvme_rdma_setup_ctrl()
991 ctrl->use_inline_data = true; in nvme_rdma_setup_ctrl()
993 if (ctrl->ctrl.queue_count > 1) { in nvme_rdma_setup_ctrl()
994 ret = nvme_rdma_configure_io_queues(ctrl, new); in nvme_rdma_setup_ctrl()
999 changed = nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_LIVE); in nvme_rdma_setup_ctrl()
1002 WARN_ON_ONCE(ctrl->ctrl.state != NVME_CTRL_DELETING); in nvme_rdma_setup_ctrl()
1007 nvme_start_ctrl(&ctrl->ctrl); in nvme_rdma_setup_ctrl()
1011 if (ctrl->ctrl.queue_count > 1) in nvme_rdma_setup_ctrl()
1012 nvme_rdma_destroy_io_queues(ctrl, new); in nvme_rdma_setup_ctrl()
1014 nvme_rdma_stop_queue(&ctrl->queues[0]); in nvme_rdma_setup_ctrl()
1015 nvme_rdma_destroy_admin_queue(ctrl, new); in nvme_rdma_setup_ctrl()
1021 struct nvme_rdma_ctrl *ctrl = container_of(to_delayed_work(work), in nvme_rdma_reconnect_ctrl_work() local
1024 ++ctrl->ctrl.nr_reconnects; in nvme_rdma_reconnect_ctrl_work()
1026 if (nvme_rdma_setup_ctrl(ctrl, false)) in nvme_rdma_reconnect_ctrl_work()
1029 dev_info(ctrl->ctrl.device, "Successfully reconnected (%d attempts)\n", in nvme_rdma_reconnect_ctrl_work()
1030 ctrl->ctrl.nr_reconnects); in nvme_rdma_reconnect_ctrl_work()
1032 ctrl->ctrl.nr_reconnects = 0; in nvme_rdma_reconnect_ctrl_work()
1037 dev_info(ctrl->ctrl.device, "Failed reconnect attempt %d\n", in nvme_rdma_reconnect_ctrl_work()
1038 ctrl->ctrl.nr_reconnects); in nvme_rdma_reconnect_ctrl_work()
1039 nvme_rdma_reconnect_or_remove(ctrl); in nvme_rdma_reconnect_ctrl_work()
1044 struct nvme_rdma_ctrl *ctrl = container_of(work, in nvme_rdma_error_recovery_work() local
1047 nvme_stop_keep_alive(&ctrl->ctrl); in nvme_rdma_error_recovery_work()
1048 nvme_rdma_teardown_io_queues(ctrl, false); in nvme_rdma_error_recovery_work()
1049 nvme_start_queues(&ctrl->ctrl); in nvme_rdma_error_recovery_work()
1050 nvme_rdma_teardown_admin_queue(ctrl, false); in nvme_rdma_error_recovery_work()
1052 if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_CONNECTING)) { in nvme_rdma_error_recovery_work()
1054 WARN_ON_ONCE(ctrl->ctrl.state != NVME_CTRL_DELETING); in nvme_rdma_error_recovery_work()
1058 nvme_rdma_reconnect_or_remove(ctrl); in nvme_rdma_error_recovery_work()
1061 static void nvme_rdma_error_recovery(struct nvme_rdma_ctrl *ctrl) in nvme_rdma_error_recovery() argument
1063 if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_RESETTING)) in nvme_rdma_error_recovery()
1066 queue_work(nvme_wq, &ctrl->err_work); in nvme_rdma_error_recovery()
1073 struct nvme_rdma_ctrl *ctrl = queue->ctrl; in nvme_rdma_wr_error() local
1075 if (ctrl->ctrl.state == NVME_CTRL_LIVE) in nvme_rdma_wr_error()
1076 dev_info(ctrl->ctrl.device, in nvme_rdma_wr_error()
1080 nvme_rdma_error_recovery(ctrl); in nvme_rdma_wr_error()
1173 sg->addr = cpu_to_le64(queue->ctrl->ctrl.icdoff); in nvme_rdma_map_sg_inline()
1205 * Align the MR to a 4K page size to match the ctrl page size and in nvme_rdma_map_sg_fr()
1272 queue->ctrl->use_inline_data && in nvme_rdma_map_data()
1343 dev_err(queue->ctrl->ctrl.device, in nvme_rdma_post_send()
1369 dev_err(queue->ctrl->ctrl.device, in nvme_rdma_post_recv()
1380 return queue->ctrl->admin_tag_set.tags[queue_idx]; in nvme_rdma_tagset()
1381 return queue->ctrl->tag_set.tags[queue_idx - 1]; in nvme_rdma_tagset()
1392 struct nvme_rdma_ctrl *ctrl = to_rdma_ctrl(arg); in nvme_rdma_submit_async_event() local
1393 struct nvme_rdma_queue *queue = &ctrl->queues[0]; in nvme_rdma_submit_async_event()
1395 struct nvme_rdma_qe *sqe = &ctrl->async_event_sqe; in nvme_rdma_submit_async_event()
1426 dev_err(queue->ctrl->ctrl.device, in nvme_rdma_process_nvme_rsp()
1429 nvme_rdma_error_recovery(queue->ctrl); in nvme_rdma_process_nvme_rsp()
1439 dev_err(queue->ctrl->ctrl.device, in nvme_rdma_process_nvme_rsp()
1442 nvme_rdma_error_recovery(queue->ctrl); in nvme_rdma_process_nvme_rsp()
1447 dev_err(queue->ctrl->ctrl.device, in nvme_rdma_process_nvme_rsp()
1450 nvme_rdma_error_recovery(queue->ctrl); in nvme_rdma_process_nvme_rsp()
1489 nvme_complete_async_event(&queue->ctrl->ctrl, cqe->status, in __nvme_rdma_recv_done()
1536 dev_err(queue->ctrl->ctrl.device, in nvme_rdma_conn_rejected()
1540 dev_err(queue->ctrl->ctrl.device, in nvme_rdma_conn_rejected()
1557 dev_err(queue->ctrl->ctrl.device, in nvme_rdma_addr_resolved()
1572 struct nvme_rdma_ctrl *ctrl = queue->ctrl; in nvme_rdma_route_resolved() local
1603 priv.hsqsize = cpu_to_le16(queue->ctrl->ctrl.sqsize); in nvme_rdma_route_resolved()
1608 dev_err(ctrl->ctrl.device, in nvme_rdma_route_resolved()
1626 dev_dbg(queue->ctrl->ctrl.device, "%s (%d): status %d id %p\n", in nvme_rdma_cm_handler()
1651 dev_dbg(queue->ctrl->ctrl.device, in nvme_rdma_cm_handler()
1658 dev_dbg(queue->ctrl->ctrl.device, in nvme_rdma_cm_handler()
1660 nvme_rdma_error_recovery(queue->ctrl); in nvme_rdma_cm_handler()
1666 dev_err(queue->ctrl->ctrl.device, in nvme_rdma_cm_handler()
1668 nvme_rdma_error_recovery(queue->ctrl); in nvme_rdma_cm_handler()
1685 struct nvme_rdma_ctrl *ctrl = queue->ctrl; in nvme_rdma_timeout() local
1687 dev_warn(ctrl->ctrl.device, "I/O %d QID %d timeout\n", in nvme_rdma_timeout()
1690 if (ctrl->ctrl.state != NVME_CTRL_LIVE) { in nvme_rdma_timeout()
1696 flush_work(&ctrl->err_work); in nvme_rdma_timeout()
1697 nvme_rdma_teardown_io_queues(ctrl, false); in nvme_rdma_timeout()
1698 nvme_rdma_teardown_admin_queue(ctrl, false); in nvme_rdma_timeout()
1702 dev_warn(ctrl->ctrl.device, "starting error recovery\n"); in nvme_rdma_timeout()
1703 nvme_rdma_error_recovery(ctrl); in nvme_rdma_timeout()
1724 if (!nvmf_check_ready(&queue->ctrl->ctrl, rq, queue_ready)) in nvme_rdma_queue_rq()
1725 return nvmf_fail_nonready_command(&queue->ctrl->ctrl, rq); in nvme_rdma_queue_rq()
1739 dev_err(queue->ctrl->ctrl.device, in nvme_rdma_queue_rq()
1795 struct nvme_rdma_ctrl *ctrl = set->driver_data; in nvme_rdma_map_queues() local
1797 return blk_mq_rdma_map_queues(set, ctrl->device->dev, 0); in nvme_rdma_map_queues()
1820 static void nvme_rdma_shutdown_ctrl(struct nvme_rdma_ctrl *ctrl, bool shutdown) in nvme_rdma_shutdown_ctrl() argument
1822 nvme_rdma_teardown_io_queues(ctrl, shutdown); in nvme_rdma_shutdown_ctrl()
1824 nvme_shutdown_ctrl(&ctrl->ctrl); in nvme_rdma_shutdown_ctrl()
1826 nvme_disable_ctrl(&ctrl->ctrl, ctrl->ctrl.cap); in nvme_rdma_shutdown_ctrl()
1827 nvme_rdma_teardown_admin_queue(ctrl, shutdown); in nvme_rdma_shutdown_ctrl()
1830 static void nvme_rdma_delete_ctrl(struct nvme_ctrl *ctrl) in nvme_rdma_delete_ctrl() argument
1832 nvme_rdma_shutdown_ctrl(to_rdma_ctrl(ctrl), true); in nvme_rdma_delete_ctrl()
1837 struct nvme_rdma_ctrl *ctrl = in nvme_rdma_reset_ctrl_work() local
1838 container_of(work, struct nvme_rdma_ctrl, ctrl.reset_work); in nvme_rdma_reset_ctrl_work()
1840 nvme_stop_ctrl(&ctrl->ctrl); in nvme_rdma_reset_ctrl_work()
1841 nvme_rdma_shutdown_ctrl(ctrl, false); in nvme_rdma_reset_ctrl_work()
1843 if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_CONNECTING)) { in nvme_rdma_reset_ctrl_work()
1849 if (nvme_rdma_setup_ctrl(ctrl, false)) in nvme_rdma_reset_ctrl_work()
1855 ++ctrl->ctrl.nr_reconnects; in nvme_rdma_reset_ctrl_work()
1856 nvme_rdma_reconnect_or_remove(ctrl); in nvme_rdma_reset_ctrl_work()
1874 __nvme_rdma_options_match(struct nvme_rdma_ctrl *ctrl, in __nvme_rdma_options_match() argument
1880 if (!nvmf_ctlr_matches_baseopts(&ctrl->ctrl, opts) || in __nvme_rdma_options_match()
1881 strcmp(opts->traddr, ctrl->ctrl.opts->traddr)) in __nvme_rdma_options_match()
1885 ctrl->ctrl.opts->mask & NVMF_OPT_TRSVCID) { in __nvme_rdma_options_match()
1886 if (strcmp(opts->trsvcid, ctrl->ctrl.opts->trsvcid)) in __nvme_rdma_options_match()
1891 } else if (ctrl->ctrl.opts->mask & NVMF_OPT_TRSVCID) { in __nvme_rdma_options_match()
1892 if (strcmp(stdport, ctrl->ctrl.opts->trsvcid)) in __nvme_rdma_options_match()
1907 ctrl->ctrl.opts->mask & NVMF_OPT_HOST_TRADDR) { in __nvme_rdma_options_match()
1908 if (strcmp(opts->host_traddr, ctrl->ctrl.opts->host_traddr)) in __nvme_rdma_options_match()
1911 ctrl->ctrl.opts->mask & NVMF_OPT_HOST_TRADDR) in __nvme_rdma_options_match()
1936 struct nvme_rdma_ctrl *ctrl; in nvme_rdma_existing_controller() local
1940 list_for_each_entry(ctrl, &nvme_rdma_ctrl_list, list) { in nvme_rdma_existing_controller()
1941 found = __nvme_rdma_options_match(ctrl, opts); in nvme_rdma_existing_controller()
1953 struct nvme_rdma_ctrl *ctrl; in nvme_rdma_create_ctrl() local
1958 ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL); in nvme_rdma_create_ctrl()
1959 if (!ctrl) in nvme_rdma_create_ctrl()
1961 ctrl->ctrl.opts = opts; in nvme_rdma_create_ctrl()
1962 INIT_LIST_HEAD(&ctrl->list); in nvme_rdma_create_ctrl()
1963 mutex_init(&ctrl->teardown_lock); in nvme_rdma_create_ctrl()
1971 opts->traddr, port, &ctrl->addr); in nvme_rdma_create_ctrl()
1979 opts->host_traddr, NULL, &ctrl->src_addr); in nvme_rdma_create_ctrl()
1992 INIT_DELAYED_WORK(&ctrl->reconnect_work, in nvme_rdma_create_ctrl()
1994 INIT_WORK(&ctrl->err_work, nvme_rdma_error_recovery_work); in nvme_rdma_create_ctrl()
1995 INIT_WORK(&ctrl->ctrl.reset_work, nvme_rdma_reset_ctrl_work); in nvme_rdma_create_ctrl()
1997 ctrl->ctrl.queue_count = opts->nr_io_queues + 1; /* +1 for admin queue */ in nvme_rdma_create_ctrl()
1998 ctrl->ctrl.sqsize = opts->queue_size - 1; in nvme_rdma_create_ctrl()
1999 ctrl->ctrl.kato = opts->kato; in nvme_rdma_create_ctrl()
2002 ctrl->queues = kcalloc(ctrl->ctrl.queue_count, sizeof(*ctrl->queues), in nvme_rdma_create_ctrl()
2004 if (!ctrl->queues) in nvme_rdma_create_ctrl()
2007 ret = nvme_init_ctrl(&ctrl->ctrl, dev, &nvme_rdma_ctrl_ops, in nvme_rdma_create_ctrl()
2012 changed = nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_CONNECTING); in nvme_rdma_create_ctrl()
2015 ret = nvme_rdma_setup_ctrl(ctrl, true); in nvme_rdma_create_ctrl()
2019 dev_info(ctrl->ctrl.device, "new ctrl: NQN \"%s\", addr %pISpcs\n", in nvme_rdma_create_ctrl()
2020 ctrl->ctrl.opts->subsysnqn, &ctrl->addr); in nvme_rdma_create_ctrl()
2022 nvme_get_ctrl(&ctrl->ctrl); in nvme_rdma_create_ctrl()
2025 list_add_tail(&ctrl->list, &nvme_rdma_ctrl_list); in nvme_rdma_create_ctrl()
2028 return &ctrl->ctrl; in nvme_rdma_create_ctrl()
2031 nvme_uninit_ctrl(&ctrl->ctrl); in nvme_rdma_create_ctrl()
2032 nvme_put_ctrl(&ctrl->ctrl); in nvme_rdma_create_ctrl()
2037 kfree(ctrl->queues); in nvme_rdma_create_ctrl()
2039 kfree(ctrl); in nvme_rdma_create_ctrl()
2054 struct nvme_rdma_ctrl *ctrl; in nvme_rdma_remove_one() local
2072 list_for_each_entry(ctrl, &nvme_rdma_ctrl_list, list) { in nvme_rdma_remove_one()
2073 if (ctrl->device->dev != ib_device) in nvme_rdma_remove_one()
2075 nvme_delete_ctrl(&ctrl->ctrl); in nvme_rdma_remove_one()