Skip to content

Commit 88d356c

Browse files
Christoph Hellwigaxboe
authored andcommitted
nvme-pci: update sqsize when adjusting the queue depth
Update the core sqsize field in addition to the PCIe-specific q_depth field as the core tagset allocation helpers rely on it. Fixes: 0da7fea ("nvme-pci: use the tagset alloc/free helpers") Signed-off-by: Christoph Hellwig <[email protected]> Acked-by: Hugh Dickins <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 33b9372 commit 88d356c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

drivers/nvme/host/pci.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2333,10 +2333,12 @@ static int nvme_setup_io_queues(struct nvme_dev *dev)
23332333
if (dev->cmb_use_sqes) {
23342334
result = nvme_cmb_qdepth(dev, nr_io_queues,
23352335
sizeof(struct nvme_command));
2336-
if (result > 0)
2336+
if (result > 0) {
23372337
dev->q_depth = result;
2338-
else
2338+
dev->ctrl.sqsize = result - 1;
2339+
} else {
23392340
dev->cmb_use_sqes = false;
2341+
}
23402342
}
23412343

23422344
do {
@@ -2537,7 +2539,6 @@ static int nvme_pci_enable(struct nvme_dev *dev)
25372539

25382540
dev->q_depth = min_t(u32, NVME_CAP_MQES(dev->ctrl.cap) + 1,
25392541
io_queue_depth);
2540-
dev->ctrl.sqsize = dev->q_depth - 1; /* 0's based queue depth */
25412542
dev->db_stride = 1 << NVME_CAP_STRIDE(dev->ctrl.cap);
25422543
dev->dbs = dev->bar + 4096;
25432544

@@ -2578,7 +2579,7 @@ static int nvme_pci_enable(struct nvme_dev *dev)
25782579
dev_warn(dev->ctrl.device, "IO queue depth clamped to %d\n",
25792580
dev->q_depth);
25802581
}
2581-
2582+
dev->ctrl.sqsize = dev->q_depth - 1; /* 0's based queue depth */
25822583

25832584
nvme_map_cmb(dev);
25842585

0 commit comments

Comments
 (0)