aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSagi Grimberg <sagi@grimberg.me>2018-06-19 08:34:13 -0400
committerChristoph Hellwig <hch@lst.de>2018-06-20 08:20:51 -0400
commit5e77d61cbc7e766778037127dab69e6410a8fc48 (patch)
tree4f9404d1b3994bb30281b9892c91b53b6226bbc5
parentc947657b15379505a9bba36a02005882b66abe57 (diff)
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 <sagi@grimberg.me> Signed-off-by: Christoph Hellwig <hch@lst.de>
-rw-r--r--drivers/nvme/host/rdma.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
index 2815749f4dfb..9544625c0b7d 100644
--- a/drivers/nvme/host/rdma.c
+++ b/drivers/nvme/host/rdma.c
@@ -692,7 +692,7 @@ static struct blk_mq_tag_set *nvme_rdma_alloc_tagset(struct nvme_ctrl *nctrl,
692 set = &ctrl->tag_set; 692 set = &ctrl->tag_set;
693 memset(set, 0, sizeof(*set)); 693 memset(set, 0, sizeof(*set));
694 set->ops = &nvme_rdma_mq_ops; 694 set->ops = &nvme_rdma_mq_ops;
695 set->queue_depth = nctrl->opts->queue_size; 695 set->queue_depth = nctrl->sqsize + 1;
696 set->reserved_tags = 1; /* fabric connect */ 696 set->reserved_tags = 1; /* fabric connect */
697 set->numa_node = NUMA_NO_NODE; 697 set->numa_node = NUMA_NO_NODE;
698 set->flags = BLK_MQ_F_SHOULD_MERGE; 698 set->flags = BLK_MQ_F_SHOULD_MERGE;
@@ -1975,20 +1975,19 @@ static struct nvme_ctrl *nvme_rdma_create_ctrl(struct device *dev,
1975 goto out_remove_admin_queue; 1975 goto out_remove_admin_queue;
1976 } 1976 }
1977 1977
1978 if (opts->queue_size > ctrl->ctrl.maxcmd) { 1978 /* only warn if argument is too large here, will clamp later */
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
1986 if (opts->queue_size > ctrl->ctrl.sqsize + 1) { 1979 if (opts->queue_size > ctrl->ctrl.sqsize + 1) {
1987 /* warn if sqsize is lower than queue_size */
1988 dev_warn(ctrl->ctrl.device, 1980 dev_warn(ctrl->ctrl.device,
1989 "queue_size %zu > ctrl sqsize %u, clamping down\n", 1981 "queue_size %zu > ctrl sqsize %u, clamping down\n",
1990 opts->queue_size, ctrl->ctrl.sqsize + 1); 1982 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;
1992 } 1991 }
1993 1992
1994 if (opts->nr_io_queues) { 1993 if (opts->nr_io_queues) {