Skip to content

Commit 5e77d61

Browse files
sagigrimbergChristoph Hellwig
authored andcommitted
nvme-rdma: don't override opts->queue_size
That is user argument, and theoretically controller limits can change over time (over reconnects/resets). Instead, use the sqsize controller attribute to check queue depth boundaries and use it to the tagset allocation. Signed-off-by: Sagi Grimberg <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]>
1 parent c947657 commit 5e77d61

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

drivers/nvme/host/rdma.c

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,7 @@ static struct blk_mq_tag_set *nvme_rdma_alloc_tagset(struct nvme_ctrl *nctrl,
692692
set = &ctrl->tag_set;
693693
memset(set, 0, sizeof(*set));
694694
set->ops = &nvme_rdma_mq_ops;
695-
set->queue_depth = nctrl->opts->queue_size;
695+
set->queue_depth = nctrl->sqsize + 1;
696696
set->reserved_tags = 1; /* fabric connect */
697697
set->numa_node = NUMA_NO_NODE;
698698
set->flags = BLK_MQ_F_SHOULD_MERGE;
@@ -1975,20 +1975,19 @@ static struct nvme_ctrl *nvme_rdma_create_ctrl(struct device *dev,
19751975
goto out_remove_admin_queue;
19761976
}
19771977

1978-
if (opts->queue_size > ctrl->ctrl.maxcmd) {
1979-
/* warn if maxcmd is lower than queue_size */
1980-
dev_warn(ctrl->ctrl.device,
1981-
"queue_size %zu > ctrl maxcmd %u, clamping down\n",
1982-
opts->queue_size, ctrl->ctrl.maxcmd);
1983-
opts->queue_size = ctrl->ctrl.maxcmd;
1984-
}
1985-
1978+
/* only warn if argument is too large here, will clamp later */
19861979
if (opts->queue_size > ctrl->ctrl.sqsize + 1) {
1987-
/* warn if sqsize is lower than queue_size */
19881980
dev_warn(ctrl->ctrl.device,
19891981
"queue_size %zu > ctrl sqsize %u, clamping down\n",
19901982
opts->queue_size, ctrl->ctrl.sqsize + 1);
1991-
opts->queue_size = ctrl->ctrl.sqsize + 1;
1983+
}
1984+
1985+
/* warn if maxcmd is lower than sqsize+1 */
1986+
if (ctrl->ctrl.sqsize + 1 > ctrl->ctrl.maxcmd) {
1987+
dev_warn(ctrl->ctrl.device,
1988+
"sqsize %u > ctrl maxcmd %u, clamping down\n",
1989+
ctrl->ctrl.sqsize + 1, ctrl->ctrl.maxcmd);
1990+
ctrl->ctrl.sqsize = ctrl->ctrl.maxcmd - 1;
19921991
}
19931992

19941993
if (opts->nr_io_queues) {

0 commit comments

Comments
 (0)