Lines Matching +full:sig +full:- +full:dir

1 // SPDX-License-Identifier: GPL-2.0
4 * Copyright (c) 2015-2016 HGST, a Western Digital Company.
14 #include <linux/blk-mq.h>
15 #include <linux/blk-mq-rdma.h>
25 #include <linux/nvme-rdma.h>
161 return queue - queue->ctrl->queues; in nvme_rdma_queue_idx()
167 queue->ctrl->io_queues[HCTX_TYPE_DEFAULT] + in nvme_rdma_poll_queue()
168 queue->ctrl->io_queues[HCTX_TYPE_READ]; in nvme_rdma_poll_queue()
173 return queue->cmnd_capsule_len - sizeof(struct nvme_command); in nvme_rdma_inline_data_size()
177 size_t capsule_size, enum dma_data_direction dir) in nvme_rdma_free_qe() argument
179 ib_dma_unmap_single(ibdev, qe->dma, capsule_size, dir); in nvme_rdma_free_qe()
180 kfree(qe->data); in nvme_rdma_free_qe()
184 size_t capsule_size, enum dma_data_direction dir) in nvme_rdma_alloc_qe() argument
186 qe->data = kzalloc(capsule_size, GFP_KERNEL); in nvme_rdma_alloc_qe()
187 if (!qe->data) in nvme_rdma_alloc_qe()
188 return -ENOMEM; in nvme_rdma_alloc_qe()
190 qe->dma = ib_dma_map_single(ibdev, qe->data, capsule_size, dir); in nvme_rdma_alloc_qe()
191 if (ib_dma_mapping_error(ibdev, qe->dma)) { in nvme_rdma_alloc_qe()
192 kfree(qe->data); in nvme_rdma_alloc_qe()
193 qe->data = NULL; in nvme_rdma_alloc_qe()
194 return -ENOMEM; in nvme_rdma_alloc_qe()
202 size_t capsule_size, enum dma_data_direction dir) in nvme_rdma_free_ring() argument
207 nvme_rdma_free_qe(ibdev, &ring[i], capsule_size, dir); in nvme_rdma_free_ring()
213 enum dma_data_direction dir) in nvme_rdma_alloc_ring() argument
225 * will issue error recovery and queue re-creation. in nvme_rdma_alloc_ring()
228 if (nvme_rdma_alloc_qe(ibdev, &ring[i], capsule_size, dir)) in nvme_rdma_alloc_ring()
235 nvme_rdma_free_ring(ibdev, ring, i, capsule_size, dir); in nvme_rdma_alloc_ring()
242 ib_event_msg(event->event), event->event); in nvme_rdma_qp_event()
250 ret = wait_for_completion_interruptible_timeout(&queue->cm_done, in nvme_rdma_wait_for_cm()
255 return -ETIMEDOUT; in nvme_rdma_wait_for_cm()
256 WARN_ON_ONCE(queue->cm_error > 0); in nvme_rdma_wait_for_cm()
257 return queue->cm_error; in nvme_rdma_wait_for_cm()
262 struct nvme_rdma_device *dev = queue->device; in nvme_rdma_create_qp()
269 init_attr.cap.max_send_wr = factor * queue->queue_size + 1; in nvme_rdma_create_qp()
271 init_attr.cap.max_recv_wr = queue->queue_size + 1; in nvme_rdma_create_qp()
273 init_attr.cap.max_send_sge = 1 + dev->num_inline_segments; in nvme_rdma_create_qp()
276 init_attr.send_cq = queue->ib_cq; in nvme_rdma_create_qp()
277 init_attr.recv_cq = queue->ib_cq; in nvme_rdma_create_qp()
278 if (queue->pi_support) in nvme_rdma_create_qp()
282 ret = rdma_create_qp(queue->cm_id, dev->pd, &init_attr); in nvme_rdma_create_qp()
284 queue->qp = queue->cm_id->qp; in nvme_rdma_create_qp()
293 kfree(req->sqe.data); in nvme_rdma_exit_request()
300 struct nvme_rdma_ctrl *ctrl = set->driver_data; in nvme_rdma_init_request()
302 int queue_idx = (set == &ctrl->tag_set) ? hctx_idx + 1 : 0; in nvme_rdma_init_request()
303 struct nvme_rdma_queue *queue = &ctrl->queues[queue_idx]; in nvme_rdma_init_request()
305 nvme_req(rq)->ctrl = &ctrl->ctrl; in nvme_rdma_init_request()
306 req->sqe.data = kzalloc(sizeof(struct nvme_command), GFP_KERNEL); in nvme_rdma_init_request()
307 if (!req->sqe.data) in nvme_rdma_init_request()
308 return -ENOMEM; in nvme_rdma_init_request()
311 if (queue->pi_support) in nvme_rdma_init_request()
312 req->metadata_sgl = (void *)nvme_req(rq) + in nvme_rdma_init_request()
316 req->queue = queue; in nvme_rdma_init_request()
317 nvme_req(rq)->cmd = req->sqe.data; in nvme_rdma_init_request()
326 struct nvme_rdma_queue *queue = &ctrl->queues[hctx_idx + 1]; in nvme_rdma_init_hctx()
328 BUG_ON(hctx_idx >= ctrl->ctrl.queue_count); in nvme_rdma_init_hctx()
330 hctx->driver_data = queue; in nvme_rdma_init_hctx()
338 struct nvme_rdma_queue *queue = &ctrl->queues[0]; in nvme_rdma_init_admin_hctx()
342 hctx->driver_data = queue; in nvme_rdma_init_admin_hctx()
352 list_del(&ndev->entry); in nvme_rdma_free_dev()
355 ib_dealloc_pd(ndev->pd); in nvme_rdma_free_dev()
361 kref_put(&dev->ref, nvme_rdma_free_dev); in nvme_rdma_dev_put()
366 return kref_get_unless_zero(&dev->ref); in nvme_rdma_dev_get()
376 if (ndev->dev->node_guid == cm_id->device->node_guid && in nvme_rdma_find_get_device()
385 ndev->dev = cm_id->device; in nvme_rdma_find_get_device()
386 kref_init(&ndev->ref); in nvme_rdma_find_get_device()
388 ndev->pd = ib_alloc_pd(ndev->dev, in nvme_rdma_find_get_device()
390 if (IS_ERR(ndev->pd)) in nvme_rdma_find_get_device()
393 if (!(ndev->dev->attrs.device_cap_flags & in nvme_rdma_find_get_device()
395 dev_err(&ndev->dev->dev, in nvme_rdma_find_get_device()
400 ndev->num_inline_segments = min(NVME_RDMA_MAX_INLINE_SEGMENTS, in nvme_rdma_find_get_device()
401 ndev->dev->attrs.max_send_sge - 1); in nvme_rdma_find_get_device()
402 list_add(&ndev->entry, &device_list); in nvme_rdma_find_get_device()
408 ib_dealloc_pd(ndev->pd); in nvme_rdma_find_get_device()
419 ib_free_cq(queue->ib_cq); in nvme_rdma_free_cq()
421 ib_cq_pool_put(queue->ib_cq, queue->cq_size); in nvme_rdma_free_cq()
429 if (!test_and_clear_bit(NVME_RDMA_Q_TR_READY, &queue->flags)) in nvme_rdma_destroy_queue_ib()
432 dev = queue->device; in nvme_rdma_destroy_queue_ib()
433 ibdev = dev->dev; in nvme_rdma_destroy_queue_ib()
435 if (queue->pi_support) in nvme_rdma_destroy_queue_ib()
436 ib_mr_pool_destroy(queue->qp, &queue->qp->sig_mrs); in nvme_rdma_destroy_queue_ib()
437 ib_mr_pool_destroy(queue->qp, &queue->qp->rdma_mrs); in nvme_rdma_destroy_queue_ib()
444 ib_destroy_qp(queue->qp); in nvme_rdma_destroy_queue_ib()
447 nvme_rdma_free_ring(ibdev, queue->rsp_ring, queue->queue_size, in nvme_rdma_destroy_queue_ib()
458 max_page_list_len = ibdev->attrs.max_pi_fast_reg_page_list_len; in nvme_rdma_get_max_fr_pages()
460 max_page_list_len = ibdev->attrs.max_fast_reg_page_list_len; in nvme_rdma_get_max_fr_pages()
462 return min_t(u32, NVME_RDMA_MAX_SEGMENTS, max_page_list_len - 1); in nvme_rdma_get_max_fr_pages()
475 comp_vector = (idx == 0 ? idx : idx - 1) % ibdev->num_comp_vectors; in nvme_rdma_create_cq()
480 queue->ib_cq = ib_alloc_cq(ibdev, queue, queue->cq_size, in nvme_rdma_create_cq()
484 queue->ib_cq = ib_cq_pool_get(ibdev, queue->cq_size, in nvme_rdma_create_cq()
488 if (IS_ERR(queue->ib_cq)) { in nvme_rdma_create_cq()
489 ret = PTR_ERR(queue->ib_cq); in nvme_rdma_create_cq()
503 queue->device = nvme_rdma_find_get_device(queue->cm_id); in nvme_rdma_create_queue_ib()
504 if (!queue->device) { in nvme_rdma_create_queue_ib()
505 dev_err(queue->cm_id->device->dev.parent, in nvme_rdma_create_queue_ib()
507 return -ECONNREFUSED; in nvme_rdma_create_queue_ib()
509 ibdev = queue->device->dev; in nvme_rdma_create_queue_ib()
512 queue->cq_size = cq_factor * queue->queue_size + 1; in nvme_rdma_create_queue_ib()
522 queue->rsp_ring = nvme_rdma_alloc_ring(ibdev, queue->queue_size, in nvme_rdma_create_queue_ib()
524 if (!queue->rsp_ring) { in nvme_rdma_create_queue_ib()
525 ret = -ENOMEM; in nvme_rdma_create_queue_ib()
534 pages_per_mr = nvme_rdma_get_max_fr_pages(ibdev, queue->pi_support) + 1; in nvme_rdma_create_queue_ib()
535 ret = ib_mr_pool_init(queue->qp, &queue->qp->rdma_mrs, in nvme_rdma_create_queue_ib()
536 queue->queue_size, in nvme_rdma_create_queue_ib()
540 dev_err(queue->ctrl->ctrl.device, in nvme_rdma_create_queue_ib()
542 queue->queue_size, nvme_rdma_queue_idx(queue)); in nvme_rdma_create_queue_ib()
546 if (queue->pi_support) { in nvme_rdma_create_queue_ib()
547 ret = ib_mr_pool_init(queue->qp, &queue->qp->sig_mrs, in nvme_rdma_create_queue_ib()
548 queue->queue_size, IB_MR_TYPE_INTEGRITY, in nvme_rdma_create_queue_ib()
551 dev_err(queue->ctrl->ctrl.device, in nvme_rdma_create_queue_ib()
553 queue->queue_size, nvme_rdma_queue_idx(queue)); in nvme_rdma_create_queue_ib()
558 set_bit(NVME_RDMA_Q_TR_READY, &queue->flags); in nvme_rdma_create_queue_ib()
563 ib_mr_pool_destroy(queue->qp, &queue->qp->rdma_mrs); in nvme_rdma_create_queue_ib()
565 nvme_rdma_free_ring(ibdev, queue->rsp_ring, queue->queue_size, in nvme_rdma_create_queue_ib()
568 rdma_destroy_qp(queue->cm_id); in nvme_rdma_create_queue_ib()
572 nvme_rdma_dev_put(queue->device); in nvme_rdma_create_queue_ib()
583 queue = &ctrl->queues[idx]; in nvme_rdma_alloc_queue()
584 mutex_init(&queue->queue_lock); in nvme_rdma_alloc_queue()
585 queue->ctrl = ctrl; in nvme_rdma_alloc_queue()
586 if (idx && ctrl->ctrl.max_integrity_segments) in nvme_rdma_alloc_queue()
587 queue->pi_support = true; in nvme_rdma_alloc_queue()
589 queue->pi_support = false; in nvme_rdma_alloc_queue()
590 init_completion(&queue->cm_done); in nvme_rdma_alloc_queue()
593 queue->cmnd_capsule_len = ctrl->ctrl.ioccsz * 16; in nvme_rdma_alloc_queue()
595 queue->cmnd_capsule_len = sizeof(struct nvme_command); in nvme_rdma_alloc_queue()
597 queue->queue_size = queue_size; in nvme_rdma_alloc_queue()
599 queue->cm_id = rdma_create_id(&init_net, nvme_rdma_cm_handler, queue, in nvme_rdma_alloc_queue()
601 if (IS_ERR(queue->cm_id)) { in nvme_rdma_alloc_queue()
602 dev_info(ctrl->ctrl.device, in nvme_rdma_alloc_queue()
603 "failed to create CM ID: %ld\n", PTR_ERR(queue->cm_id)); in nvme_rdma_alloc_queue()
604 ret = PTR_ERR(queue->cm_id); in nvme_rdma_alloc_queue()
608 if (ctrl->ctrl.opts->mask & NVMF_OPT_HOST_TRADDR) in nvme_rdma_alloc_queue()
609 src_addr = (struct sockaddr *)&ctrl->src_addr; in nvme_rdma_alloc_queue()
611 queue->cm_error = -ETIMEDOUT; in nvme_rdma_alloc_queue()
612 ret = rdma_resolve_addr(queue->cm_id, src_addr, in nvme_rdma_alloc_queue()
613 (struct sockaddr *)&ctrl->addr, in nvme_rdma_alloc_queue()
616 dev_info(ctrl->ctrl.device, in nvme_rdma_alloc_queue()
623 dev_info(ctrl->ctrl.device, in nvme_rdma_alloc_queue()
628 set_bit(NVME_RDMA_Q_ALLOCATED, &queue->flags); in nvme_rdma_alloc_queue()
633 rdma_destroy_id(queue->cm_id); in nvme_rdma_alloc_queue()
636 mutex_destroy(&queue->queue_lock); in nvme_rdma_alloc_queue()
642 rdma_disconnect(queue->cm_id); in __nvme_rdma_stop_queue()
643 ib_drain_qp(queue->qp); in __nvme_rdma_stop_queue()
648 mutex_lock(&queue->queue_lock); in nvme_rdma_stop_queue()
649 if (test_and_clear_bit(NVME_RDMA_Q_LIVE, &queue->flags)) in nvme_rdma_stop_queue()
651 mutex_unlock(&queue->queue_lock); in nvme_rdma_stop_queue()
656 if (!test_and_clear_bit(NVME_RDMA_Q_ALLOCATED, &queue->flags)) in nvme_rdma_free_queue()
659 rdma_destroy_id(queue->cm_id); in nvme_rdma_free_queue()
661 mutex_destroy(&queue->queue_lock); in nvme_rdma_free_queue()
668 for (i = 1; i < ctrl->ctrl.queue_count; i++) in nvme_rdma_free_io_queues()
669 nvme_rdma_free_queue(&ctrl->queues[i]); in nvme_rdma_free_io_queues()
676 for (i = 1; i < ctrl->ctrl.queue_count; i++) in nvme_rdma_stop_io_queues()
677 nvme_rdma_stop_queue(&ctrl->queues[i]); in nvme_rdma_stop_io_queues()
682 struct nvme_rdma_queue *queue = &ctrl->queues[idx]; in nvme_rdma_start_queue()
686 ret = nvmf_connect_io_queue(&ctrl->ctrl, idx); in nvme_rdma_start_queue()
688 ret = nvmf_connect_admin_queue(&ctrl->ctrl); in nvme_rdma_start_queue()
691 set_bit(NVME_RDMA_Q_LIVE, &queue->flags); in nvme_rdma_start_queue()
693 if (test_bit(NVME_RDMA_Q_ALLOCATED, &queue->flags)) in nvme_rdma_start_queue()
695 dev_info(ctrl->ctrl.device, in nvme_rdma_start_queue()
705 for (i = 1; i < ctrl->ctrl.queue_count; i++) { in nvme_rdma_start_io_queues()
714 for (i--; i >= 1; i--) in nvme_rdma_start_io_queues()
715 nvme_rdma_stop_queue(&ctrl->queues[i]); in nvme_rdma_start_io_queues()
721 struct nvmf_ctrl_options *opts = ctrl->ctrl.opts; in nvme_rdma_alloc_io_queues()
722 struct ib_device *ibdev = ctrl->device->dev; in nvme_rdma_alloc_io_queues()
727 nr_read_queues = min_t(unsigned int, ibdev->num_comp_vectors, in nvme_rdma_alloc_io_queues()
728 min(opts->nr_io_queues, num_online_cpus())); in nvme_rdma_alloc_io_queues()
729 nr_default_queues = min_t(unsigned int, ibdev->num_comp_vectors, in nvme_rdma_alloc_io_queues()
730 min(opts->nr_write_queues, num_online_cpus())); in nvme_rdma_alloc_io_queues()
731 nr_poll_queues = min(opts->nr_poll_queues, num_online_cpus()); in nvme_rdma_alloc_io_queues()
734 ret = nvme_set_queue_count(&ctrl->ctrl, &nr_io_queues); in nvme_rdma_alloc_io_queues()
739 dev_err(ctrl->ctrl.device, in nvme_rdma_alloc_io_queues()
741 return -ENOMEM; in nvme_rdma_alloc_io_queues()
744 ctrl->ctrl.queue_count = nr_io_queues + 1; in nvme_rdma_alloc_io_queues()
745 dev_info(ctrl->ctrl.device, in nvme_rdma_alloc_io_queues()
748 if (opts->nr_write_queues && nr_read_queues < nr_io_queues) { in nvme_rdma_alloc_io_queues()
754 ctrl->io_queues[HCTX_TYPE_READ] = nr_read_queues; in nvme_rdma_alloc_io_queues()
755 nr_io_queues -= ctrl->io_queues[HCTX_TYPE_READ]; in nvme_rdma_alloc_io_queues()
756 ctrl->io_queues[HCTX_TYPE_DEFAULT] = in nvme_rdma_alloc_io_queues()
758 nr_io_queues -= ctrl->io_queues[HCTX_TYPE_DEFAULT]; in nvme_rdma_alloc_io_queues()
765 ctrl->io_queues[HCTX_TYPE_DEFAULT] = in nvme_rdma_alloc_io_queues()
767 nr_io_queues -= ctrl->io_queues[HCTX_TYPE_DEFAULT]; in nvme_rdma_alloc_io_queues()
770 if (opts->nr_poll_queues && nr_io_queues) { in nvme_rdma_alloc_io_queues()
772 ctrl->io_queues[HCTX_TYPE_POLL] = in nvme_rdma_alloc_io_queues()
776 for (i = 1; i < ctrl->ctrl.queue_count; i++) { in nvme_rdma_alloc_io_queues()
778 ctrl->ctrl.sqsize + 1); in nvme_rdma_alloc_io_queues()
786 for (i--; i >= 1; i--) in nvme_rdma_alloc_io_queues()
787 nvme_rdma_free_queue(&ctrl->queues[i]); in nvme_rdma_alloc_io_queues()
800 set = &ctrl->admin_tag_set; in nvme_rdma_alloc_tagset()
802 set->ops = &nvme_rdma_admin_mq_ops; in nvme_rdma_alloc_tagset()
803 set->queue_depth = NVME_AQ_MQ_TAG_DEPTH; in nvme_rdma_alloc_tagset()
804 set->reserved_tags = NVMF_RESERVED_TAGS; in nvme_rdma_alloc_tagset()
805 set->numa_node = nctrl->numa_node; in nvme_rdma_alloc_tagset()
806 set->cmd_size = sizeof(struct nvme_rdma_request) + in nvme_rdma_alloc_tagset()
808 set->driver_data = ctrl; in nvme_rdma_alloc_tagset()
809 set->nr_hw_queues = 1; in nvme_rdma_alloc_tagset()
810 set->timeout = NVME_ADMIN_TIMEOUT; in nvme_rdma_alloc_tagset()
811 set->flags = BLK_MQ_F_NO_SCHED; in nvme_rdma_alloc_tagset()
813 set = &ctrl->tag_set; in nvme_rdma_alloc_tagset()
815 set->ops = &nvme_rdma_mq_ops; in nvme_rdma_alloc_tagset()
816 set->queue_depth = nctrl->sqsize + 1; in nvme_rdma_alloc_tagset()
817 set->reserved_tags = NVMF_RESERVED_TAGS; in nvme_rdma_alloc_tagset()
818 set->numa_node = nctrl->numa_node; in nvme_rdma_alloc_tagset()
819 set->flags = BLK_MQ_F_SHOULD_MERGE; in nvme_rdma_alloc_tagset()
820 set->cmd_size = sizeof(struct nvme_rdma_request) + in nvme_rdma_alloc_tagset()
822 if (nctrl->max_integrity_segments) in nvme_rdma_alloc_tagset()
823 set->cmd_size += sizeof(struct nvme_rdma_sgl) + in nvme_rdma_alloc_tagset()
825 set->driver_data = ctrl; in nvme_rdma_alloc_tagset()
826 set->nr_hw_queues = nctrl->queue_count - 1; in nvme_rdma_alloc_tagset()
827 set->timeout = NVME_IO_TIMEOUT; in nvme_rdma_alloc_tagset()
828 set->nr_maps = nctrl->opts->nr_poll_queues ? HCTX_MAX_TYPES : 2; in nvme_rdma_alloc_tagset()
842 blk_cleanup_queue(ctrl->ctrl.admin_q); in nvme_rdma_destroy_admin_queue()
843 blk_cleanup_queue(ctrl->ctrl.fabrics_q); in nvme_rdma_destroy_admin_queue()
844 blk_mq_free_tag_set(ctrl->ctrl.admin_tagset); in nvme_rdma_destroy_admin_queue()
846 if (ctrl->async_event_sqe.data) { in nvme_rdma_destroy_admin_queue()
847 cancel_work_sync(&ctrl->ctrl.async_event_work); in nvme_rdma_destroy_admin_queue()
848 nvme_rdma_free_qe(ctrl->device->dev, &ctrl->async_event_sqe, in nvme_rdma_destroy_admin_queue()
850 ctrl->async_event_sqe.data = NULL; in nvme_rdma_destroy_admin_queue()
852 nvme_rdma_free_queue(&ctrl->queues[0]); in nvme_rdma_destroy_admin_queue()
865 ctrl->device = ctrl->queues[0].device; in nvme_rdma_configure_admin_queue()
866 ctrl->ctrl.numa_node = ibdev_to_node(ctrl->device->dev); in nvme_rdma_configure_admin_queue()
868 /* T10-PI support */ in nvme_rdma_configure_admin_queue()
869 if (ctrl->device->dev->attrs.device_cap_flags & in nvme_rdma_configure_admin_queue()
873 ctrl->max_fr_pages = nvme_rdma_get_max_fr_pages(ctrl->device->dev, in nvme_rdma_configure_admin_queue()
879 * error recovery and queue re-creation. in nvme_rdma_configure_admin_queue()
881 error = nvme_rdma_alloc_qe(ctrl->device->dev, &ctrl->async_event_sqe, in nvme_rdma_configure_admin_queue()
887 ctrl->ctrl.admin_tagset = nvme_rdma_alloc_tagset(&ctrl->ctrl, true); in nvme_rdma_configure_admin_queue()
888 if (IS_ERR(ctrl->ctrl.admin_tagset)) { in nvme_rdma_configure_admin_queue()
889 error = PTR_ERR(ctrl->ctrl.admin_tagset); in nvme_rdma_configure_admin_queue()
893 ctrl->ctrl.fabrics_q = blk_mq_init_queue(&ctrl->admin_tag_set); in nvme_rdma_configure_admin_queue()
894 if (IS_ERR(ctrl->ctrl.fabrics_q)) { in nvme_rdma_configure_admin_queue()
895 error = PTR_ERR(ctrl->ctrl.fabrics_q); in nvme_rdma_configure_admin_queue()
899 ctrl->ctrl.admin_q = blk_mq_init_queue(&ctrl->admin_tag_set); in nvme_rdma_configure_admin_queue()
900 if (IS_ERR(ctrl->ctrl.admin_q)) { in nvme_rdma_configure_admin_queue()
901 error = PTR_ERR(ctrl->ctrl.admin_q); in nvme_rdma_configure_admin_queue()
910 error = nvme_enable_ctrl(&ctrl->ctrl); in nvme_rdma_configure_admin_queue()
914 ctrl->ctrl.max_segments = ctrl->max_fr_pages; in nvme_rdma_configure_admin_queue()
915 ctrl->ctrl.max_hw_sectors = ctrl->max_fr_pages << (ilog2(SZ_4K) - 9); in nvme_rdma_configure_admin_queue()
917 ctrl->ctrl.max_integrity_segments = ctrl->max_fr_pages; in nvme_rdma_configure_admin_queue()
919 ctrl->ctrl.max_integrity_segments = 0; in nvme_rdma_configure_admin_queue()
921 blk_mq_unquiesce_queue(ctrl->ctrl.admin_q); in nvme_rdma_configure_admin_queue()
923 error = nvme_init_ctrl_finish(&ctrl->ctrl); in nvme_rdma_configure_admin_queue()
930 blk_mq_quiesce_queue(ctrl->ctrl.admin_q); in nvme_rdma_configure_admin_queue()
931 blk_sync_queue(ctrl->ctrl.admin_q); in nvme_rdma_configure_admin_queue()
933 nvme_rdma_stop_queue(&ctrl->queues[0]); in nvme_rdma_configure_admin_queue()
934 nvme_cancel_admin_tagset(&ctrl->ctrl); in nvme_rdma_configure_admin_queue()
937 blk_cleanup_queue(ctrl->ctrl.admin_q); in nvme_rdma_configure_admin_queue()
940 blk_cleanup_queue(ctrl->ctrl.fabrics_q); in nvme_rdma_configure_admin_queue()
943 blk_mq_free_tag_set(ctrl->ctrl.admin_tagset); in nvme_rdma_configure_admin_queue()
945 if (ctrl->async_event_sqe.data) { in nvme_rdma_configure_admin_queue()
946 nvme_rdma_free_qe(ctrl->device->dev, &ctrl->async_event_sqe, in nvme_rdma_configure_admin_queue()
948 ctrl->async_event_sqe.data = NULL; in nvme_rdma_configure_admin_queue()
951 nvme_rdma_free_queue(&ctrl->queues[0]); in nvme_rdma_configure_admin_queue()
959 blk_cleanup_queue(ctrl->ctrl.connect_q); in nvme_rdma_destroy_io_queues()
960 blk_mq_free_tag_set(ctrl->ctrl.tagset); in nvme_rdma_destroy_io_queues()
974 ctrl->ctrl.tagset = nvme_rdma_alloc_tagset(&ctrl->ctrl, false); in nvme_rdma_configure_io_queues()
975 if (IS_ERR(ctrl->ctrl.tagset)) { in nvme_rdma_configure_io_queues()
976 ret = PTR_ERR(ctrl->ctrl.tagset); in nvme_rdma_configure_io_queues()
980 ctrl->ctrl.connect_q = blk_mq_init_queue(&ctrl->tag_set); in nvme_rdma_configure_io_queues()
981 if (IS_ERR(ctrl->ctrl.connect_q)) { in nvme_rdma_configure_io_queues()
982 ret = PTR_ERR(ctrl->ctrl.connect_q); in nvme_rdma_configure_io_queues()
992 nvme_start_queues(&ctrl->ctrl); in nvme_rdma_configure_io_queues()
993 if (!nvme_wait_freeze_timeout(&ctrl->ctrl, NVME_IO_TIMEOUT)) { in nvme_rdma_configure_io_queues()
999 ret = -ENODEV; in nvme_rdma_configure_io_queues()
1002 blk_mq_update_nr_hw_queues(ctrl->ctrl.tagset, in nvme_rdma_configure_io_queues()
1003 ctrl->ctrl.queue_count - 1); in nvme_rdma_configure_io_queues()
1004 nvme_unfreeze(&ctrl->ctrl); in nvme_rdma_configure_io_queues()
1010 nvme_stop_queues(&ctrl->ctrl); in nvme_rdma_configure_io_queues()
1011 nvme_sync_io_queues(&ctrl->ctrl); in nvme_rdma_configure_io_queues()
1014 nvme_cancel_tagset(&ctrl->ctrl); in nvme_rdma_configure_io_queues()
1016 blk_cleanup_queue(ctrl->ctrl.connect_q); in nvme_rdma_configure_io_queues()
1019 blk_mq_free_tag_set(ctrl->ctrl.tagset); in nvme_rdma_configure_io_queues()
1028 blk_mq_quiesce_queue(ctrl->ctrl.admin_q); in nvme_rdma_teardown_admin_queue()
1029 blk_sync_queue(ctrl->ctrl.admin_q); in nvme_rdma_teardown_admin_queue()
1030 nvme_rdma_stop_queue(&ctrl->queues[0]); in nvme_rdma_teardown_admin_queue()
1031 nvme_cancel_admin_tagset(&ctrl->ctrl); in nvme_rdma_teardown_admin_queue()
1033 blk_mq_unquiesce_queue(ctrl->ctrl.admin_q); in nvme_rdma_teardown_admin_queue()
1040 if (ctrl->ctrl.queue_count > 1) { in nvme_rdma_teardown_io_queues()
1041 nvme_start_freeze(&ctrl->ctrl); in nvme_rdma_teardown_io_queues()
1042 nvme_stop_queues(&ctrl->ctrl); in nvme_rdma_teardown_io_queues()
1043 nvme_sync_io_queues(&ctrl->ctrl); in nvme_rdma_teardown_io_queues()
1045 nvme_cancel_tagset(&ctrl->ctrl); in nvme_rdma_teardown_io_queues()
1047 nvme_start_queues(&ctrl->ctrl); in nvme_rdma_teardown_io_queues()
1056 if (list_empty(&ctrl->list)) in nvme_rdma_free_ctrl()
1060 list_del(&ctrl->list); in nvme_rdma_free_ctrl()
1063 nvmf_free_options(nctrl->opts); in nvme_rdma_free_ctrl()
1065 kfree(ctrl->queues); in nvme_rdma_free_ctrl()
1072 if (ctrl->ctrl.state != NVME_CTRL_CONNECTING) { in nvme_rdma_reconnect_or_remove()
1073 WARN_ON_ONCE(ctrl->ctrl.state == NVME_CTRL_NEW || in nvme_rdma_reconnect_or_remove()
1074 ctrl->ctrl.state == NVME_CTRL_LIVE); in nvme_rdma_reconnect_or_remove()
1078 if (nvmf_should_reconnect(&ctrl->ctrl)) { in nvme_rdma_reconnect_or_remove()
1079 dev_info(ctrl->ctrl.device, "Reconnecting in %d seconds...\n", in nvme_rdma_reconnect_or_remove()
1080 ctrl->ctrl.opts->reconnect_delay); in nvme_rdma_reconnect_or_remove()
1081 queue_delayed_work(nvme_wq, &ctrl->reconnect_work, in nvme_rdma_reconnect_or_remove()
1082 ctrl->ctrl.opts->reconnect_delay * HZ); in nvme_rdma_reconnect_or_remove()
1084 nvme_delete_ctrl(&ctrl->ctrl); in nvme_rdma_reconnect_or_remove()
1097 if (ctrl->ctrl.icdoff) { in nvme_rdma_setup_ctrl()
1098 dev_err(ctrl->ctrl.device, "icdoff is not supported!\n"); in nvme_rdma_setup_ctrl()
1102 if (!(ctrl->ctrl.sgls & (1 << 2))) { in nvme_rdma_setup_ctrl()
1103 dev_err(ctrl->ctrl.device, in nvme_rdma_setup_ctrl()
1108 if (ctrl->ctrl.opts->queue_size > ctrl->ctrl.sqsize + 1) { in nvme_rdma_setup_ctrl()
1109 dev_warn(ctrl->ctrl.device, in nvme_rdma_setup_ctrl()
1111 ctrl->ctrl.opts->queue_size, ctrl->ctrl.sqsize + 1); in nvme_rdma_setup_ctrl()
1114 if (ctrl->ctrl.sqsize + 1 > ctrl->ctrl.maxcmd) { in nvme_rdma_setup_ctrl()
1115 dev_warn(ctrl->ctrl.device, in nvme_rdma_setup_ctrl()
1117 ctrl->ctrl.sqsize + 1, ctrl->ctrl.maxcmd); in nvme_rdma_setup_ctrl()
1118 ctrl->ctrl.sqsize = ctrl->ctrl.maxcmd - 1; in nvme_rdma_setup_ctrl()
1121 if (ctrl->ctrl.sgls & (1 << 20)) in nvme_rdma_setup_ctrl()
1122 ctrl->use_inline_data = true; in nvme_rdma_setup_ctrl()
1124 if (ctrl->ctrl.queue_count > 1) { in nvme_rdma_setup_ctrl()
1130 changed = nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_LIVE); in nvme_rdma_setup_ctrl()
1137 WARN_ON_ONCE(ctrl->ctrl.state != NVME_CTRL_DELETING && in nvme_rdma_setup_ctrl()
1138 ctrl->ctrl.state != NVME_CTRL_DELETING_NOIO); in nvme_rdma_setup_ctrl()
1140 ret = -EINVAL; in nvme_rdma_setup_ctrl()
1144 nvme_start_ctrl(&ctrl->ctrl); in nvme_rdma_setup_ctrl()
1148 if (ctrl->ctrl.queue_count > 1) { in nvme_rdma_setup_ctrl()
1149 nvme_stop_queues(&ctrl->ctrl); in nvme_rdma_setup_ctrl()
1150 nvme_sync_io_queues(&ctrl->ctrl); in nvme_rdma_setup_ctrl()
1152 nvme_cancel_tagset(&ctrl->ctrl); in nvme_rdma_setup_ctrl()
1156 blk_mq_quiesce_queue(ctrl->ctrl.admin_q); in nvme_rdma_setup_ctrl()
1157 blk_sync_queue(ctrl->ctrl.admin_q); in nvme_rdma_setup_ctrl()
1158 nvme_rdma_stop_queue(&ctrl->queues[0]); in nvme_rdma_setup_ctrl()
1159 nvme_cancel_admin_tagset(&ctrl->ctrl); in nvme_rdma_setup_ctrl()
1169 ++ctrl->ctrl.nr_reconnects; in nvme_rdma_reconnect_ctrl_work()
1174 dev_info(ctrl->ctrl.device, "Successfully reconnected (%d attempts)\n", in nvme_rdma_reconnect_ctrl_work()
1175 ctrl->ctrl.nr_reconnects); in nvme_rdma_reconnect_ctrl_work()
1177 ctrl->ctrl.nr_reconnects = 0; in nvme_rdma_reconnect_ctrl_work()
1182 dev_info(ctrl->ctrl.device, "Failed reconnect attempt %d\n", in nvme_rdma_reconnect_ctrl_work()
1183 ctrl->ctrl.nr_reconnects); in nvme_rdma_reconnect_ctrl_work()
1192 nvme_stop_keep_alive(&ctrl->ctrl); in nvme_rdma_error_recovery_work()
1194 nvme_start_queues(&ctrl->ctrl); in nvme_rdma_error_recovery_work()
1196 blk_mq_unquiesce_queue(ctrl->ctrl.admin_q); in nvme_rdma_error_recovery_work()
1198 if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_CONNECTING)) { in nvme_rdma_error_recovery_work()
1200 WARN_ON_ONCE(ctrl->ctrl.state != NVME_CTRL_DELETING && in nvme_rdma_error_recovery_work()
1201 ctrl->ctrl.state != NVME_CTRL_DELETING_NOIO); in nvme_rdma_error_recovery_work()
1210 if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_RESETTING)) in nvme_rdma_error_recovery()
1213 dev_warn(ctrl->ctrl.device, "starting error recovery\n"); in nvme_rdma_error_recovery()
1214 queue_work(nvme_reset_wq, &ctrl->err_work); in nvme_rdma_error_recovery()
1221 if (!refcount_dec_and_test(&req->ref)) in nvme_rdma_end_request()
1223 if (!nvme_try_complete_req(rq, req->status, req->result)) in nvme_rdma_end_request()
1230 struct nvme_rdma_queue *queue = wc->qp->qp_context; in nvme_rdma_wr_error()
1231 struct nvme_rdma_ctrl *ctrl = queue->ctrl; in nvme_rdma_wr_error()
1233 if (ctrl->ctrl.state == NVME_CTRL_LIVE) in nvme_rdma_wr_error()
1234 dev_info(ctrl->ctrl.device, in nvme_rdma_wr_error()
1236 op, wc->wr_cqe, in nvme_rdma_wr_error()
1237 ib_wc_status_msg(wc->status), wc->status); in nvme_rdma_wr_error()
1243 if (unlikely(wc->status != IB_WC_SUCCESS)) in nvme_rdma_memreg_done()
1250 container_of(wc->wr_cqe, struct nvme_rdma_request, reg_cqe); in nvme_rdma_inv_rkey_done()
1252 if (unlikely(wc->status != IB_WC_SUCCESS)) in nvme_rdma_inv_rkey_done()
1266 .ex.invalidate_rkey = req->mr->rkey, in nvme_rdma_inv_rkey()
1269 req->reg_cqe.done = nvme_rdma_inv_rkey_done; in nvme_rdma_inv_rkey()
1270 wr.wr_cqe = &req->reg_cqe; in nvme_rdma_inv_rkey()
1272 return ib_post_send(queue->qp, &wr, NULL); in nvme_rdma_inv_rkey()
1279 struct nvme_rdma_device *dev = queue->device; in nvme_rdma_unmap_data()
1280 struct ib_device *ibdev = dev->dev; in nvme_rdma_unmap_data()
1281 struct list_head *pool = &queue->qp->rdma_mrs; in nvme_rdma_unmap_data()
1287 ib_dma_unmap_sg(ibdev, req->metadata_sgl->sg_table.sgl, in nvme_rdma_unmap_data()
1288 req->metadata_sgl->nents, rq_dma_dir(rq)); in nvme_rdma_unmap_data()
1289 sg_free_table_chained(&req->metadata_sgl->sg_table, in nvme_rdma_unmap_data()
1293 if (req->use_sig_mr) in nvme_rdma_unmap_data()
1294 pool = &queue->qp->sig_mrs; in nvme_rdma_unmap_data()
1296 if (req->mr) { in nvme_rdma_unmap_data()
1297 ib_mr_pool_put(queue->qp, pool, req->mr); in nvme_rdma_unmap_data()
1298 req->mr = NULL; in nvme_rdma_unmap_data()
1301 ib_dma_unmap_sg(ibdev, req->data_sgl.sg_table.sgl, req->data_sgl.nents, in nvme_rdma_unmap_data()
1303 sg_free_table_chained(&req->data_sgl.sg_table, NVME_INLINE_SG_CNT); in nvme_rdma_unmap_data()
1308 struct nvme_keyed_sgl_desc *sg = &c->common.dptr.ksgl; in nvme_rdma_set_sg_null()
1310 sg->addr = 0; in nvme_rdma_set_sg_null()
1311 put_unaligned_le24(0, sg->length); in nvme_rdma_set_sg_null()
1312 put_unaligned_le32(0, sg->key); in nvme_rdma_set_sg_null()
1313 sg->type = NVME_KEY_SGL_FMT_DATA_DESC << 4; in nvme_rdma_set_sg_null()
1321 struct nvme_sgl_desc *sg = &c->common.dptr.sgl; in nvme_rdma_map_sg_inline()
1322 struct ib_sge *sge = &req->sge[1]; in nvme_rdma_map_sg_inline()
1327 for_each_sg(req->data_sgl.sg_table.sgl, sgl, count, i) { in nvme_rdma_map_sg_inline()
1328 sge->addr = sg_dma_address(sgl); in nvme_rdma_map_sg_inline()
1329 sge->length = sg_dma_len(sgl); in nvme_rdma_map_sg_inline()
1330 sge->lkey = queue->device->pd->local_dma_lkey; in nvme_rdma_map_sg_inline()
1331 len += sge->length; in nvme_rdma_map_sg_inline()
1335 sg->addr = cpu_to_le64(queue->ctrl->ctrl.icdoff); in nvme_rdma_map_sg_inline()
1336 sg->length = cpu_to_le32(len); in nvme_rdma_map_sg_inline()
1337 sg->type = (NVME_SGL_FMT_DATA_DESC << 4) | NVME_SGL_FMT_OFFSET; in nvme_rdma_map_sg_inline()
1339 req->num_sge += count; in nvme_rdma_map_sg_inline()
1346 struct nvme_keyed_sgl_desc *sg = &c->common.dptr.ksgl; in nvme_rdma_map_sg_single()
1348 sg->addr = cpu_to_le64(sg_dma_address(req->data_sgl.sg_table.sgl)); in nvme_rdma_map_sg_single()
1349 put_unaligned_le24(sg_dma_len(req->data_sgl.sg_table.sgl), sg->length); in nvme_rdma_map_sg_single()
1350 put_unaligned_le32(queue->device->pd->unsafe_global_rkey, sg->key); in nvme_rdma_map_sg_single()
1351 sg->type = NVME_KEY_SGL_FMT_DATA_DESC << 4; in nvme_rdma_map_sg_single()
1359 struct nvme_keyed_sgl_desc *sg = &c->common.dptr.ksgl; in nvme_rdma_map_sg_fr()
1362 req->mr = ib_mr_pool_get(queue->qp, &queue->qp->rdma_mrs); in nvme_rdma_map_sg_fr()
1363 if (WARN_ON_ONCE(!req->mr)) in nvme_rdma_map_sg_fr()
1364 return -EAGAIN; in nvme_rdma_map_sg_fr()
1370 nr = ib_map_mr_sg(req->mr, req->data_sgl.sg_table.sgl, count, NULL, in nvme_rdma_map_sg_fr()
1373 ib_mr_pool_put(queue->qp, &queue->qp->rdma_mrs, req->mr); in nvme_rdma_map_sg_fr()
1374 req->mr = NULL; in nvme_rdma_map_sg_fr()
1377 return -EINVAL; in nvme_rdma_map_sg_fr()
1380 ib_update_fast_reg_key(req->mr, ib_inc_rkey(req->mr->rkey)); in nvme_rdma_map_sg_fr()
1382 req->reg_cqe.done = nvme_rdma_memreg_done; in nvme_rdma_map_sg_fr()
1383 memset(&req->reg_wr, 0, sizeof(req->reg_wr)); in nvme_rdma_map_sg_fr()
1384 req->reg_wr.wr.opcode = IB_WR_REG_MR; in nvme_rdma_map_sg_fr()
1385 req->reg_wr.wr.wr_cqe = &req->reg_cqe; in nvme_rdma_map_sg_fr()
1386 req->reg_wr.wr.num_sge = 0; in nvme_rdma_map_sg_fr()
1387 req->reg_wr.mr = req->mr; in nvme_rdma_map_sg_fr()
1388 req->reg_wr.key = req->mr->rkey; in nvme_rdma_map_sg_fr()
1389 req->reg_wr.access = IB_ACCESS_LOCAL_WRITE | in nvme_rdma_map_sg_fr()
1393 sg->addr = cpu_to_le64(req->mr->iova); in nvme_rdma_map_sg_fr()
1394 put_unaligned_le24(req->mr->length, sg->length); in nvme_rdma_map_sg_fr()
1395 put_unaligned_le32(req->mr->rkey, sg->key); in nvme_rdma_map_sg_fr()
1396 sg->type = (NVME_KEY_SGL_FMT_DATA_DESC << 4) | in nvme_rdma_map_sg_fr()
1406 domain->sig_type = IB_SIG_TYPE_T10_DIF; in nvme_rdma_set_sig_domain()
1407 domain->sig.dif.bg_type = IB_T10DIF_CRC; in nvme_rdma_set_sig_domain()
1408 domain->sig.dif.pi_interval = 1 << bi->interval_exp; in nvme_rdma_set_sig_domain()
1409 domain->sig.dif.ref_tag = le32_to_cpu(cmd->rw.reftag); in nvme_rdma_set_sig_domain()
1411 domain->sig.dif.ref_remap = true; in nvme_rdma_set_sig_domain()
1413 domain->sig.dif.app_tag = le16_to_cpu(cmd->rw.apptag); in nvme_rdma_set_sig_domain()
1414 domain->sig.dif.apptag_check_mask = le16_to_cpu(cmd->rw.appmask); in nvme_rdma_set_sig_domain()
1415 domain->sig.dif.app_escape = true; in nvme_rdma_set_sig_domain()
1417 domain->sig.dif.ref_escape = true; in nvme_rdma_set_sig_domain()
1424 u16 control = le16_to_cpu(cmd->rw.control); in nvme_rdma_set_sig_attrs()
1429 sig_attrs->mem.sig_type = IB_SIG_TYPE_NONE; in nvme_rdma_set_sig_attrs()
1430 nvme_rdma_set_sig_domain(bi, cmd, &sig_attrs->wire, control, in nvme_rdma_set_sig_attrs()
1434 cmd->rw.control = cpu_to_le16(control); in nvme_rdma_set_sig_attrs()
1437 nvme_rdma_set_sig_domain(bi, cmd, &sig_attrs->wire, control, in nvme_rdma_set_sig_attrs()
1439 nvme_rdma_set_sig_domain(bi, cmd, &sig_attrs->mem, control, in nvme_rdma_set_sig_attrs()
1447 if (le16_to_cpu(cmd->rw.control) & NVME_RW_PRINFO_PRCHK_REF) in nvme_rdma_set_prot_checks()
1449 if (le16_to_cpu(cmd->rw.control) & NVME_RW_PRINFO_PRCHK_GUARD) in nvme_rdma_set_prot_checks()
1455 if (unlikely(wc->status != IB_WC_SUCCESS)) in nvme_rdma_sig_done()
1456 nvme_rdma_wr_error(cq, wc, "SIG"); in nvme_rdma_sig_done()
1463 struct nvme_rdma_sgl *sgl = &req->data_sgl; in nvme_rdma_map_sg_pi()
1464 struct ib_reg_wr *wr = &req->reg_wr; in nvme_rdma_map_sg_pi()
1466 struct nvme_ns *ns = rq->q->queuedata; in nvme_rdma_map_sg_pi()
1467 struct bio *bio = rq->bio; in nvme_rdma_map_sg_pi()
1468 struct nvme_keyed_sgl_desc *sg = &c->common.dptr.ksgl; in nvme_rdma_map_sg_pi()
1471 req->mr = ib_mr_pool_get(queue->qp, &queue->qp->sig_mrs); in nvme_rdma_map_sg_pi()
1472 if (WARN_ON_ONCE(!req->mr)) in nvme_rdma_map_sg_pi()
1473 return -EAGAIN; in nvme_rdma_map_sg_pi()
1475 nr = ib_map_mr_sg_pi(req->mr, sgl->sg_table.sgl, count, NULL, in nvme_rdma_map_sg_pi()
1476 req->metadata_sgl->sg_table.sgl, pi_count, NULL, in nvme_rdma_map_sg_pi()
1481 nvme_rdma_set_sig_attrs(blk_get_integrity(bio->bi_bdev->bd_disk), c, in nvme_rdma_map_sg_pi()
1482 req->mr->sig_attrs, ns->pi_type); in nvme_rdma_map_sg_pi()
1483 nvme_rdma_set_prot_checks(c, &req->mr->sig_attrs->check_mask); in nvme_rdma_map_sg_pi()
1485 ib_update_fast_reg_key(req->mr, ib_inc_rkey(req->mr->rkey)); in nvme_rdma_map_sg_pi()
1487 req->reg_cqe.done = nvme_rdma_sig_done; in nvme_rdma_map_sg_pi()
1489 wr->wr.opcode = IB_WR_REG_MR_INTEGRITY; in nvme_rdma_map_sg_pi()
1490 wr->wr.wr_cqe = &req->reg_cqe; in nvme_rdma_map_sg_pi()
1491 wr->wr.num_sge = 0; in nvme_rdma_map_sg_pi()
1492 wr->wr.send_flags = 0; in nvme_rdma_map_sg_pi()
1493 wr->mr = req->mr; in nvme_rdma_map_sg_pi()
1494 wr->key = req->mr->rkey; in nvme_rdma_map_sg_pi()
1495 wr->access = IB_ACCESS_LOCAL_WRITE | in nvme_rdma_map_sg_pi()
1499 sg->addr = cpu_to_le64(req->mr->iova); in nvme_rdma_map_sg_pi()
1500 put_unaligned_le24(req->mr->length, sg->length); in nvme_rdma_map_sg_pi()
1501 put_unaligned_le32(req->mr->rkey, sg->key); in nvme_rdma_map_sg_pi()
1502 sg->type = NVME_KEY_SGL_FMT_DATA_DESC << 4; in nvme_rdma_map_sg_pi()
1507 ib_mr_pool_put(queue->qp, &queue->qp->sig_mrs, req->mr); in nvme_rdma_map_sg_pi()
1508 req->mr = NULL; in nvme_rdma_map_sg_pi()
1511 return -EINVAL; in nvme_rdma_map_sg_pi()
1518 struct nvme_rdma_device *dev = queue->device; in nvme_rdma_map_data()
1519 struct ib_device *ibdev = dev->dev; in nvme_rdma_map_data()
1523 req->num_sge = 1; in nvme_rdma_map_data()
1524 refcount_set(&req->ref, 2); /* send and recv completions */ in nvme_rdma_map_data()
1526 c->common.flags |= NVME_CMD_SGL_METABUF; in nvme_rdma_map_data()
1531 req->data_sgl.sg_table.sgl = (struct scatterlist *)(req + 1); in nvme_rdma_map_data()
1532 ret = sg_alloc_table_chained(&req->data_sgl.sg_table, in nvme_rdma_map_data()
1533 blk_rq_nr_phys_segments(rq), req->data_sgl.sg_table.sgl, in nvme_rdma_map_data()
1536 return -ENOMEM; in nvme_rdma_map_data()
1538 req->data_sgl.nents = blk_rq_map_sg(rq->q, rq, in nvme_rdma_map_data()
1539 req->data_sgl.sg_table.sgl); in nvme_rdma_map_data()
1541 count = ib_dma_map_sg(ibdev, req->data_sgl.sg_table.sgl, in nvme_rdma_map_data()
1542 req->data_sgl.nents, rq_dma_dir(rq)); in nvme_rdma_map_data()
1544 ret = -EIO; in nvme_rdma_map_data()
1549 req->metadata_sgl->sg_table.sgl = in nvme_rdma_map_data()
1550 (struct scatterlist *)(req->metadata_sgl + 1); in nvme_rdma_map_data()
1551 ret = sg_alloc_table_chained(&req->metadata_sgl->sg_table, in nvme_rdma_map_data()
1552 blk_rq_count_integrity_sg(rq->q, rq->bio), in nvme_rdma_map_data()
1553 req->metadata_sgl->sg_table.sgl, in nvme_rdma_map_data()
1556 ret = -ENOMEM; in nvme_rdma_map_data()
1560 req->metadata_sgl->nents = blk_rq_map_integrity_sg(rq->q, in nvme_rdma_map_data()
1561 rq->bio, req->metadata_sgl->sg_table.sgl); in nvme_rdma_map_data()
1563 req->metadata_sgl->sg_table.sgl, in nvme_rdma_map_data()
1564 req->metadata_sgl->nents, in nvme_rdma_map_data()
1567 ret = -EIO; in nvme_rdma_map_data()
1572 if (req->use_sig_mr) { in nvme_rdma_map_data()
1577 if (count <= dev->num_inline_segments) { in nvme_rdma_map_data()
1579 queue->ctrl->use_inline_data && in nvme_rdma_map_data()
1586 if (count == 1 && dev->pd->flags & IB_PD_UNSAFE_GLOBAL_RKEY) { in nvme_rdma_map_data()
1601 ib_dma_unmap_sg(ibdev, req->metadata_sgl->sg_table.sgl, in nvme_rdma_map_data()
1602 req->metadata_sgl->nents, rq_dma_dir(rq)); in nvme_rdma_map_data()
1605 sg_free_table_chained(&req->metadata_sgl->sg_table, in nvme_rdma_map_data()
1608 ib_dma_unmap_sg(ibdev, req->data_sgl.sg_table.sgl, req->data_sgl.nents, in nvme_rdma_map_data()
1611 sg_free_table_chained(&req->data_sgl.sg_table, NVME_INLINE_SG_CNT); in nvme_rdma_map_data()
1618 container_of(wc->wr_cqe, struct nvme_rdma_qe, cqe); in nvme_rdma_send_done()
1622 if (unlikely(wc->status != IB_WC_SUCCESS)) in nvme_rdma_send_done()
1635 sge->addr = qe->dma; in nvme_rdma_post_send()
1636 sge->length = sizeof(struct nvme_command); in nvme_rdma_post_send()
1637 sge->lkey = queue->device->pd->local_dma_lkey; in nvme_rdma_post_send()
1640 wr.wr_cqe = &qe->cqe; in nvme_rdma_post_send()
1647 first->next = &wr; in nvme_rdma_post_send()
1651 ret = ib_post_send(queue->qp, first, NULL); in nvme_rdma_post_send()
1653 dev_err(queue->ctrl->ctrl.device, in nvme_rdma_post_send()
1666 list.addr = qe->dma; in nvme_rdma_post_recv()
1668 list.lkey = queue->device->pd->local_dma_lkey; in nvme_rdma_post_recv()
1670 qe->cqe.done = nvme_rdma_recv_done; in nvme_rdma_post_recv()
1673 wr.wr_cqe = &qe->cqe; in nvme_rdma_post_recv()
1677 ret = ib_post_recv(queue->qp, &wr, NULL); in nvme_rdma_post_recv()
1679 dev_err(queue->ctrl->ctrl.device, in nvme_rdma_post_recv()
1690 return queue->ctrl->admin_tag_set.tags[queue_idx]; in nvme_rdma_tagset()
1691 return queue->ctrl->tag_set.tags[queue_idx - 1]; in nvme_rdma_tagset()
1696 if (unlikely(wc->status != IB_WC_SUCCESS)) in nvme_rdma_async_done()
1703 struct nvme_rdma_queue *queue = &ctrl->queues[0]; in nvme_rdma_submit_async_event()
1704 struct ib_device *dev = queue->device->dev; in nvme_rdma_submit_async_event()
1705 struct nvme_rdma_qe *sqe = &ctrl->async_event_sqe; in nvme_rdma_submit_async_event()
1706 struct nvme_command *cmd = sqe->data; in nvme_rdma_submit_async_event()
1710 ib_dma_sync_single_for_cpu(dev, sqe->dma, sizeof(*cmd), DMA_TO_DEVICE); in nvme_rdma_submit_async_event()
1713 cmd->common.opcode = nvme_admin_async_event; in nvme_rdma_submit_async_event()
1714 cmd->common.command_id = NVME_AQ_BLK_MQ_DEPTH; in nvme_rdma_submit_async_event()
1715 cmd->common.flags |= NVME_CMD_SGL_METABUF; in nvme_rdma_submit_async_event()
1718 sqe->cqe.done = nvme_rdma_async_done; in nvme_rdma_submit_async_event()
1720 ib_dma_sync_single_for_device(dev, sqe->dma, sizeof(*cmd), in nvme_rdma_submit_async_event()
1733 rq = nvme_find_rq(nvme_rdma_tagset(queue), cqe->command_id); in nvme_rdma_process_nvme_rsp()
1735 dev_err(queue->ctrl->ctrl.device, in nvme_rdma_process_nvme_rsp()
1737 cqe->command_id, queue->qp->qp_num); in nvme_rdma_process_nvme_rsp()
1738 nvme_rdma_error_recovery(queue->ctrl); in nvme_rdma_process_nvme_rsp()
1743 req->status = cqe->status; in nvme_rdma_process_nvme_rsp()
1744 req->result = cqe->result; in nvme_rdma_process_nvme_rsp()
1746 if (wc->wc_flags & IB_WC_WITH_INVALIDATE) { in nvme_rdma_process_nvme_rsp()
1747 if (unlikely(!req->mr || in nvme_rdma_process_nvme_rsp()
1748 wc->ex.invalidate_rkey != req->mr->rkey)) { in nvme_rdma_process_nvme_rsp()
1749 dev_err(queue->ctrl->ctrl.device, in nvme_rdma_process_nvme_rsp()
1751 req->mr ? req->mr->rkey : 0); in nvme_rdma_process_nvme_rsp()
1752 nvme_rdma_error_recovery(queue->ctrl); in nvme_rdma_process_nvme_rsp()
1754 } else if (req->mr) { in nvme_rdma_process_nvme_rsp()
1759 dev_err(queue->ctrl->ctrl.device, in nvme_rdma_process_nvme_rsp()
1761 req->mr->rkey, ret); in nvme_rdma_process_nvme_rsp()
1762 nvme_rdma_error_recovery(queue->ctrl); in nvme_rdma_process_nvme_rsp()
1774 container_of(wc->wr_cqe, struct nvme_rdma_qe, cqe); in nvme_rdma_recv_done()
1775 struct nvme_rdma_queue *queue = wc->qp->qp_context; in nvme_rdma_recv_done()
1776 struct ib_device *ibdev = queue->device->dev; in nvme_rdma_recv_done()
1777 struct nvme_completion *cqe = qe->data; in nvme_rdma_recv_done()
1780 if (unlikely(wc->status != IB_WC_SUCCESS)) { in nvme_rdma_recv_done()
1786 if (unlikely(wc->byte_len < len)) { in nvme_rdma_recv_done()
1787 dev_err(queue->ctrl->ctrl.device, in nvme_rdma_recv_done()
1788 "Unexpected nvme completion length(%d)\n", wc->byte_len); in nvme_rdma_recv_done()
1789 nvme_rdma_error_recovery(queue->ctrl); in nvme_rdma_recv_done()
1793 ib_dma_sync_single_for_cpu(ibdev, qe->dma, len, DMA_FROM_DEVICE); in nvme_rdma_recv_done()
1801 cqe->command_id))) in nvme_rdma_recv_done()
1802 nvme_complete_async_event(&queue->ctrl->ctrl, cqe->status, in nvme_rdma_recv_done()
1803 &cqe->result); in nvme_rdma_recv_done()
1806 ib_dma_sync_single_for_device(ibdev, qe->dma, len, DMA_FROM_DEVICE); in nvme_rdma_recv_done()
1815 for (i = 0; i < queue->queue_size; i++) { in nvme_rdma_conn_established()
1816 ret = nvme_rdma_post_recv(queue, &queue->rsp_ring[i]); in nvme_rdma_conn_established()
1827 struct rdma_cm_id *cm_id = queue->cm_id; in nvme_rdma_conn_rejected()
1828 int status = ev->status; in nvme_rdma_conn_rejected()
1837 u16 sts = le16_to_cpu(rej_data->sts); in nvme_rdma_conn_rejected()
1839 dev_err(queue->ctrl->ctrl.device, in nvme_rdma_conn_rejected()
1843 dev_err(queue->ctrl->ctrl.device, in nvme_rdma_conn_rejected()
1847 return -ECONNRESET; in nvme_rdma_conn_rejected()
1852 struct nvme_ctrl *ctrl = &queue->ctrl->ctrl; in nvme_rdma_addr_resolved()
1859 if (ctrl->opts->tos >= 0) in nvme_rdma_addr_resolved()
1860 rdma_set_service_type(queue->cm_id, ctrl->opts->tos); in nvme_rdma_addr_resolved()
1861 ret = rdma_resolve_route(queue->cm_id, NVME_RDMA_CONNECT_TIMEOUT_MS); in nvme_rdma_addr_resolved()
1863 dev_err(ctrl->device, "rdma_resolve_route failed (%d).\n", in nvme_rdma_addr_resolved()
1864 queue->cm_error); in nvme_rdma_addr_resolved()
1877 struct nvme_rdma_ctrl *ctrl = queue->ctrl; in nvme_rdma_route_resolved()
1882 param.qp_num = queue->qp->qp_num; in nvme_rdma_route_resolved()
1885 param.responder_resources = queue->device->dev->attrs.max_qp_rd_atom; in nvme_rdma_route_resolved()
1900 priv.hsqsize = cpu_to_le16(NVME_AQ_DEPTH - 1); in nvme_rdma_route_resolved()
1907 priv.hrqsize = cpu_to_le16(queue->queue_size); in nvme_rdma_route_resolved()
1908 priv.hsqsize = cpu_to_le16(queue->ctrl->ctrl.sqsize); in nvme_rdma_route_resolved()
1911 ret = rdma_connect_locked(queue->cm_id, &param); in nvme_rdma_route_resolved()
1913 dev_err(ctrl->ctrl.device, in nvme_rdma_route_resolved()
1924 struct nvme_rdma_queue *queue = cm_id->context; in nvme_rdma_cm_handler()
1927 dev_dbg(queue->ctrl->ctrl.device, "%s (%d): status %d id %p\n", in nvme_rdma_cm_handler()
1928 rdma_event_msg(ev->event), ev->event, in nvme_rdma_cm_handler()
1929 ev->status, cm_id); in nvme_rdma_cm_handler()
1931 switch (ev->event) { in nvme_rdma_cm_handler()
1939 queue->cm_error = nvme_rdma_conn_established(queue); in nvme_rdma_cm_handler()
1941 complete(&queue->cm_done); in nvme_rdma_cm_handler()
1950 dev_dbg(queue->ctrl->ctrl.device, in nvme_rdma_cm_handler()
1951 "CM error event %d\n", ev->event); in nvme_rdma_cm_handler()
1952 cm_error = -ECONNRESET; in nvme_rdma_cm_handler()
1957 dev_dbg(queue->ctrl->ctrl.device, in nvme_rdma_cm_handler()
1958 "disconnect received - connection closed\n"); in nvme_rdma_cm_handler()
1959 nvme_rdma_error_recovery(queue->ctrl); in nvme_rdma_cm_handler()
1965 dev_err(queue->ctrl->ctrl.device, in nvme_rdma_cm_handler()
1966 "Unexpected RDMA CM event (%d)\n", ev->event); in nvme_rdma_cm_handler()
1967 nvme_rdma_error_recovery(queue->ctrl); in nvme_rdma_cm_handler()
1972 queue->cm_error = cm_error; in nvme_rdma_cm_handler()
1973 complete(&queue->cm_done); in nvme_rdma_cm_handler()
1982 struct nvme_rdma_queue *queue = req->queue; in nvme_rdma_complete_timed_out()
1986 nvme_req(rq)->status = NVME_SC_HOST_ABORTED_CMD; in nvme_rdma_complete_timed_out()
1995 struct nvme_rdma_queue *queue = req->queue; in nvme_rdma_timeout()
1996 struct nvme_rdma_ctrl *ctrl = queue->ctrl; in nvme_rdma_timeout()
1998 dev_warn(ctrl->ctrl.device, "I/O %d QID %d timeout\n", in nvme_rdma_timeout()
1999 rq->tag, nvme_rdma_queue_idx(queue)); in nvme_rdma_timeout()
2001 if (ctrl->ctrl.state != NVME_CTRL_LIVE) { in nvme_rdma_timeout()
2006 * - ctrl disable/shutdown fabrics requests in nvme_rdma_timeout()
2007 * - connect requests in nvme_rdma_timeout()
2008 * - initialization admin requests in nvme_rdma_timeout()
2009 * - I/O requests that entered after unquiescing and in nvme_rdma_timeout()
2030 struct nvme_ns *ns = hctx->queue->queuedata; in nvme_rdma_queue_rq()
2031 struct nvme_rdma_queue *queue = hctx->driver_data; in nvme_rdma_queue_rq()
2032 struct request *rq = bd->rq; in nvme_rdma_queue_rq()
2034 struct nvme_rdma_qe *sqe = &req->sqe; in nvme_rdma_queue_rq()
2035 struct nvme_command *c = nvme_req(rq)->cmd; in nvme_rdma_queue_rq()
2037 bool queue_ready = test_bit(NVME_RDMA_Q_LIVE, &queue->flags); in nvme_rdma_queue_rq()
2041 WARN_ON_ONCE(rq->tag < 0); in nvme_rdma_queue_rq()
2043 if (!nvme_check_ready(&queue->ctrl->ctrl, rq, queue_ready)) in nvme_rdma_queue_rq()
2044 return nvme_fail_nonready_command(&queue->ctrl->ctrl, rq); in nvme_rdma_queue_rq()
2046 dev = queue->device->dev; in nvme_rdma_queue_rq()
2048 req->sqe.dma = ib_dma_map_single(dev, req->sqe.data, in nvme_rdma_queue_rq()
2051 err = ib_dma_mapping_error(dev, req->sqe.dma); in nvme_rdma_queue_rq()
2055 ib_dma_sync_single_for_cpu(dev, sqe->dma, in nvme_rdma_queue_rq()
2065 queue->pi_support && in nvme_rdma_queue_rq()
2066 (c->common.opcode == nvme_cmd_write || in nvme_rdma_queue_rq()
2067 c->common.opcode == nvme_cmd_read) && in nvme_rdma_queue_rq()
2069 req->use_sig_mr = true; in nvme_rdma_queue_rq()
2071 req->use_sig_mr = false; in nvme_rdma_queue_rq()
2075 dev_err(queue->ctrl->ctrl.device, in nvme_rdma_queue_rq()
2080 sqe->cqe.done = nvme_rdma_send_done; in nvme_rdma_queue_rq()
2082 ib_dma_sync_single_for_device(dev, sqe->dma, in nvme_rdma_queue_rq()
2085 err = nvme_rdma_post_send(queue, sqe, req->sge, req->num_sge, in nvme_rdma_queue_rq()
2086 req->mr ? &req->reg_wr.wr : NULL); in nvme_rdma_queue_rq()
2095 if (err == -EIO) in nvme_rdma_queue_rq()
2097 else if (err == -ENOMEM || err == -EAGAIN) in nvme_rdma_queue_rq()
2103 ib_dma_unmap_single(dev, req->sqe.dma, sizeof(struct nvme_command), in nvme_rdma_queue_rq()
2110 struct nvme_rdma_queue *queue = hctx->driver_data; in nvme_rdma_poll()
2112 return ib_process_cq_direct(queue->ib_cq, -1); in nvme_rdma_poll()
2121 ret = ib_check_mr_status(req->mr, IB_MR_CHECK_SIG_STATUS, &mr_status); in nvme_rdma_check_pi_status()
2124 nvme_req(rq)->status = NVME_SC_INVALID_PI; in nvme_rdma_check_pi_status()
2131 nvme_req(rq)->status = NVME_SC_GUARD_CHECK; in nvme_rdma_check_pi_status()
2134 nvme_req(rq)->status = NVME_SC_REFTAG_CHECK; in nvme_rdma_check_pi_status()
2137 nvme_req(rq)->status = NVME_SC_APPTAG_CHECK; in nvme_rdma_check_pi_status()
2149 struct nvme_rdma_queue *queue = req->queue; in nvme_rdma_complete_rq()
2150 struct ib_device *ibdev = queue->device->dev; in nvme_rdma_complete_rq()
2152 if (req->use_sig_mr) in nvme_rdma_complete_rq()
2156 ib_dma_unmap_single(ibdev, req->sqe.dma, sizeof(struct nvme_command), in nvme_rdma_complete_rq()
2163 struct nvme_rdma_ctrl *ctrl = set->driver_data; in nvme_rdma_map_queues()
2164 struct nvmf_ctrl_options *opts = ctrl->ctrl.opts; in nvme_rdma_map_queues()
2166 if (opts->nr_write_queues && ctrl->io_queues[HCTX_TYPE_READ]) { in nvme_rdma_map_queues()
2168 set->map[HCTX_TYPE_DEFAULT].nr_queues = in nvme_rdma_map_queues()
2169 ctrl->io_queues[HCTX_TYPE_DEFAULT]; in nvme_rdma_map_queues()
2170 set->map[HCTX_TYPE_DEFAULT].queue_offset = 0; in nvme_rdma_map_queues()
2171 set->map[HCTX_TYPE_READ].nr_queues = in nvme_rdma_map_queues()
2172 ctrl->io_queues[HCTX_TYPE_READ]; in nvme_rdma_map_queues()
2173 set->map[HCTX_TYPE_READ].queue_offset = in nvme_rdma_map_queues()
2174 ctrl->io_queues[HCTX_TYPE_DEFAULT]; in nvme_rdma_map_queues()
2177 set->map[HCTX_TYPE_DEFAULT].nr_queues = in nvme_rdma_map_queues()
2178 ctrl->io_queues[HCTX_TYPE_DEFAULT]; in nvme_rdma_map_queues()
2179 set->map[HCTX_TYPE_DEFAULT].queue_offset = 0; in nvme_rdma_map_queues()
2180 set->map[HCTX_TYPE_READ].nr_queues = in nvme_rdma_map_queues()
2181 ctrl->io_queues[HCTX_TYPE_DEFAULT]; in nvme_rdma_map_queues()
2182 set->map[HCTX_TYPE_READ].queue_offset = 0; in nvme_rdma_map_queues()
2184 blk_mq_rdma_map_queues(&set->map[HCTX_TYPE_DEFAULT], in nvme_rdma_map_queues()
2185 ctrl->device->dev, 0); in nvme_rdma_map_queues()
2186 blk_mq_rdma_map_queues(&set->map[HCTX_TYPE_READ], in nvme_rdma_map_queues()
2187 ctrl->device->dev, 0); in nvme_rdma_map_queues()
2189 if (opts->nr_poll_queues && ctrl->io_queues[HCTX_TYPE_POLL]) { in nvme_rdma_map_queues()
2191 set->map[HCTX_TYPE_POLL].nr_queues = in nvme_rdma_map_queues()
2192 ctrl->io_queues[HCTX_TYPE_POLL]; in nvme_rdma_map_queues()
2193 set->map[HCTX_TYPE_POLL].queue_offset = in nvme_rdma_map_queues()
2194 ctrl->io_queues[HCTX_TYPE_DEFAULT] + in nvme_rdma_map_queues()
2195 ctrl->io_queues[HCTX_TYPE_READ]; in nvme_rdma_map_queues()
2196 blk_mq_map_queues(&set->map[HCTX_TYPE_POLL]); in nvme_rdma_map_queues()
2199 dev_info(ctrl->ctrl.device, in nvme_rdma_map_queues()
2201 ctrl->io_queues[HCTX_TYPE_DEFAULT], in nvme_rdma_map_queues()
2202 ctrl->io_queues[HCTX_TYPE_READ], in nvme_rdma_map_queues()
2203 ctrl->io_queues[HCTX_TYPE_POLL]); in nvme_rdma_map_queues()
2230 cancel_work_sync(&ctrl->err_work); in nvme_rdma_shutdown_ctrl()
2231 cancel_delayed_work_sync(&ctrl->reconnect_work); in nvme_rdma_shutdown_ctrl()
2234 blk_mq_quiesce_queue(ctrl->ctrl.admin_q); in nvme_rdma_shutdown_ctrl()
2236 nvme_shutdown_ctrl(&ctrl->ctrl); in nvme_rdma_shutdown_ctrl()
2238 nvme_disable_ctrl(&ctrl->ctrl); in nvme_rdma_shutdown_ctrl()
2252 nvme_stop_ctrl(&ctrl->ctrl); in nvme_rdma_reset_ctrl_work()
2255 if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_CONNECTING)) { in nvme_rdma_reset_ctrl_work()
2267 ++ctrl->ctrl.nr_reconnects; in nvme_rdma_reset_ctrl_work()
2304 found = nvmf_ip_options_match(&ctrl->ctrl, opts); in nvme_rdma_existing_controller()
2322 return ERR_PTR(-ENOMEM); in nvme_rdma_create_ctrl()
2323 ctrl->ctrl.opts = opts; in nvme_rdma_create_ctrl()
2324 INIT_LIST_HEAD(&ctrl->list); in nvme_rdma_create_ctrl()
2326 if (!(opts->mask & NVMF_OPT_TRSVCID)) { in nvme_rdma_create_ctrl()
2327 opts->trsvcid = in nvme_rdma_create_ctrl()
2329 if (!opts->trsvcid) { in nvme_rdma_create_ctrl()
2330 ret = -ENOMEM; in nvme_rdma_create_ctrl()
2333 opts->mask |= NVMF_OPT_TRSVCID; in nvme_rdma_create_ctrl()
2337 opts->traddr, opts->trsvcid, &ctrl->addr); in nvme_rdma_create_ctrl()
2340 opts->traddr, opts->trsvcid); in nvme_rdma_create_ctrl()
2344 if (opts->mask & NVMF_OPT_HOST_TRADDR) { in nvme_rdma_create_ctrl()
2346 opts->host_traddr, NULL, &ctrl->src_addr); in nvme_rdma_create_ctrl()
2349 opts->host_traddr); in nvme_rdma_create_ctrl()
2354 if (!opts->duplicate_connect && nvme_rdma_existing_controller(opts)) { in nvme_rdma_create_ctrl()
2355 ret = -EALREADY; in nvme_rdma_create_ctrl()
2359 INIT_DELAYED_WORK(&ctrl->reconnect_work, in nvme_rdma_create_ctrl()
2361 INIT_WORK(&ctrl->err_work, nvme_rdma_error_recovery_work); in nvme_rdma_create_ctrl()
2362 INIT_WORK(&ctrl->ctrl.reset_work, nvme_rdma_reset_ctrl_work); in nvme_rdma_create_ctrl()
2364 ctrl->ctrl.queue_count = opts->nr_io_queues + opts->nr_write_queues + in nvme_rdma_create_ctrl()
2365 opts->nr_poll_queues + 1; in nvme_rdma_create_ctrl()
2366 ctrl->ctrl.sqsize = opts->queue_size - 1; in nvme_rdma_create_ctrl()
2367 ctrl->ctrl.kato = opts->kato; in nvme_rdma_create_ctrl()
2369 ret = -ENOMEM; in nvme_rdma_create_ctrl()
2370 ctrl->queues = kcalloc(ctrl->ctrl.queue_count, sizeof(*ctrl->queues), in nvme_rdma_create_ctrl()
2372 if (!ctrl->queues) in nvme_rdma_create_ctrl()
2375 ret = nvme_init_ctrl(&ctrl->ctrl, dev, &nvme_rdma_ctrl_ops, in nvme_rdma_create_ctrl()
2380 changed = nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_CONNECTING); in nvme_rdma_create_ctrl()
2387 dev_info(ctrl->ctrl.device, "new ctrl: NQN \"%s\", addr %pISpcs\n", in nvme_rdma_create_ctrl()
2388 ctrl->ctrl.opts->subsysnqn, &ctrl->addr); in nvme_rdma_create_ctrl()
2391 list_add_tail(&ctrl->list, &nvme_rdma_ctrl_list); in nvme_rdma_create_ctrl()
2394 return &ctrl->ctrl; in nvme_rdma_create_ctrl()
2397 nvme_uninit_ctrl(&ctrl->ctrl); in nvme_rdma_create_ctrl()
2398 nvme_put_ctrl(&ctrl->ctrl); in nvme_rdma_create_ctrl()
2400 ret = -EIO; in nvme_rdma_create_ctrl()
2403 kfree(ctrl->queues); in nvme_rdma_create_ctrl()
2428 if (ndev->dev == ib_device) { in nvme_rdma_remove_one()
2441 if (ctrl->device->dev != ib_device) in nvme_rdma_remove_one()
2443 nvme_delete_ctrl(&ctrl->ctrl); in nvme_rdma_remove_one()
2483 nvme_delete_ctrl(&ctrl->ctrl); in nvme_rdma_cleanup_module()