]> www.infradead.org Git - users/hch/block.git/commitdiff
nvme-rdma: initialize max_hw_sectors earlier
authorChristoph Hellwig <hch@lst.de>
Mon, 26 Feb 2024 18:09:26 +0000 (13:09 -0500)
committerChristoph Hellwig <hch@lst.de>
Thu, 29 Feb 2024 15:23:08 +0000 (07:23 -0800)
Initialize max_fr_pages and the values depending on it a little earlier
so that nvme_alloc_admin_tag_set can rely on it to set the initial
queue limits.

Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/host/rdma.c

index 20fdd40b1879f5796ab768acade2096eefde9e93..04a69f7bd48f46dcf3150272757fb34ca285ed45 100644 (file)
@@ -797,6 +797,12 @@ static int nvme_rdma_configure_admin_queue(struct nvme_rdma_ctrl *ctrl,
 
        ctrl->max_fr_pages = nvme_rdma_get_max_fr_pages(ctrl->device->dev,
                                                        pi_capable);
+       ctrl->ctrl.max_segments = ctrl->max_fr_pages;
+       ctrl->ctrl.max_hw_sectors = ctrl->max_fr_pages << (ilog2(SZ_4K) - 9);
+       if (pi_capable)
+               ctrl->ctrl.max_integrity_segments = ctrl->max_fr_pages;
+       else
+               ctrl->ctrl.max_integrity_segments = 0;
 
        /*
         * Bind the async event SQE DMA mapping to the admin queue lifetime.
@@ -826,13 +832,6 @@ static int nvme_rdma_configure_admin_queue(struct nvme_rdma_ctrl *ctrl,
        if (error)
                goto out_stop_queue;
 
-       ctrl->ctrl.max_segments = ctrl->max_fr_pages;
-       ctrl->ctrl.max_hw_sectors = ctrl->max_fr_pages << (ilog2(SZ_4K) - 9);
-       if (pi_capable)
-               ctrl->ctrl.max_integrity_segments = ctrl->max_fr_pages;
-       else
-               ctrl->ctrl.max_integrity_segments = 0;
-
        nvme_unquiesce_admin_queue(&ctrl->ctrl);
 
        error = nvme_init_ctrl_finish(&ctrl->ctrl, false);