Skip to content

Commit ad178ba

Browse files
mgurtovoykeithbusch
authored andcommitted
nvme-rdma: clamp queue size according to ctrl cap
If a controller is configured with metadata support, clamp the maximal queue size to be 128 since there are more resources that are needed for metadata operations. Otherwise, clamp it to 256. Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Reviewed-by: Israel Rukshin <israelr@nvidia.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Max Gurtovoy <mgurtovoy@nvidia.com> Signed-off-by: Keith Busch <kbusch@kernel.org>
1 parent 3614496 commit ad178ba

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

drivers/nvme/host/rdma.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,6 +1006,7 @@ static int nvme_rdma_setup_ctrl(struct nvme_rdma_ctrl *ctrl, bool new)
10061006
{
10071007
int ret;
10081008
bool changed;
1009+
u16 max_queue_size;
10091010

10101011
ret = nvme_rdma_configure_admin_queue(ctrl, new);
10111012
if (ret)
@@ -1030,11 +1031,16 @@ static int nvme_rdma_setup_ctrl(struct nvme_rdma_ctrl *ctrl, bool new)
10301031
ctrl->ctrl.opts->queue_size, ctrl->ctrl.sqsize + 1);
10311032
}
10321033

1033-
if (ctrl->ctrl.sqsize + 1 > NVME_RDMA_MAX_QUEUE_SIZE) {
1034+
if (ctrl->ctrl.max_integrity_segments)
1035+
max_queue_size = NVME_RDMA_MAX_METADATA_QUEUE_SIZE;
1036+
else
1037+
max_queue_size = NVME_RDMA_MAX_QUEUE_SIZE;
1038+
1039+
if (ctrl->ctrl.sqsize + 1 > max_queue_size) {
10341040
dev_warn(ctrl->ctrl.device,
1035-
"ctrl sqsize %u > max queue size %u, clamping down\n",
1036-
ctrl->ctrl.sqsize + 1, NVME_RDMA_MAX_QUEUE_SIZE);
1037-
ctrl->ctrl.sqsize = NVME_RDMA_MAX_QUEUE_SIZE - 1;
1041+
"ctrl sqsize %u > max queue size %u, clamping down\n",
1042+
ctrl->ctrl.sqsize + 1, max_queue_size);
1043+
ctrl->ctrl.sqsize = max_queue_size - 1;
10381044
}
10391045

10401046
if (ctrl->ctrl.sqsize + 1 > ctrl->ctrl.maxcmd) {

0 commit comments

Comments
 (0)