diff mbox

[rfc,12/30] nvme-rdma: disable controller in reset instead of shutdown

Message ID 1497799324-19598-13-git-send-email-sagi@grimberg.me (mailing list archive)
State New, archived
Headers show

Commit Message

Sagi Grimberg June 18, 2017, 3:21 p.m. UTC
For controller resets we can avoid a full controller shutdown.
This makes rdma similar to pci.

Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
---
 drivers/nvme/host/rdma.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

Comments

Christoph Hellwig June 19, 2017, 12:43 p.m. UTC | #1
Looks fine,

Reviewed-by: Christoph Hellwig <hch@lst.de>
diff mbox

Patch

diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
index cd637e28647b..34518c90609a 100644
--- a/drivers/nvme/host/rdma.c
+++ b/drivers/nvme/host/rdma.c
@@ -1720,7 +1720,7 @@  static const struct blk_mq_ops nvme_rdma_admin_mq_ops = {
 	.timeout	= nvme_rdma_timeout,
 };
 
-static void nvme_rdma_shutdown_ctrl(struct nvme_rdma_ctrl *ctrl, bool shutdown)
+static void nvme_rdma_teardown_ctrl(struct nvme_rdma_ctrl *ctrl, bool shutdown)
 {
 	nvme_stop_keep_alive(&ctrl->ctrl);
 	cancel_work_sync(&ctrl->err_work);
@@ -1733,8 +1733,12 @@  static void nvme_rdma_shutdown_ctrl(struct nvme_rdma_ctrl *ctrl, bool shutdown)
 		nvme_rdma_destroy_io_queues(ctrl, shutdown);
 	}
 
-	if (test_bit(NVME_RDMA_Q_LIVE, &ctrl->queues[0].flags))
-		nvme_shutdown_ctrl(&ctrl->ctrl);
+	if (test_bit(NVME_RDMA_Q_LIVE, &ctrl->queues[0].flags)) {
+		if (shutdown)
+			nvme_shutdown_ctrl(&ctrl->ctrl);
+		else
+			nvme_disable_ctrl(&ctrl->ctrl, ctrl->ctrl.cap);
+	}
 
 	blk_mq_stop_hw_queues(ctrl->ctrl.admin_q);
 	blk_mq_tagset_busy_iter(&ctrl->admin_tag_set,
@@ -1748,7 +1752,7 @@  static void nvme_rdma_del_ctrl_work(struct work_struct *work)
 				struct nvme_rdma_ctrl, delete_work);
 
 	nvme_uninit_ctrl(&ctrl->ctrl);
-	nvme_rdma_shutdown_ctrl(ctrl, true);
+	nvme_rdma_teardown_ctrl(ctrl, true);
 	nvme_put_ctrl(&ctrl->ctrl);
 }
 
@@ -1788,7 +1792,7 @@  static void nvme_rdma_reset_ctrl_work(struct work_struct *work)
 	int ret;
 	bool changed;
 
-	nvme_rdma_shutdown_ctrl(ctrl, false);
+	nvme_rdma_teardown_ctrl(ctrl, false);
 
 	ret = nvme_rdma_configure_admin_queue(ctrl, false);
 	if (ret)