Commit 88d356ca authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

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: 0da7feaa ("nvme-pci: use the tagset alloc/free helpers")
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Acked-by: default avatarHugh Dickins <hughd@google.com>
Link: https://lore.kernel.org/r/20221225103234.226794-3-hch@lst.deSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 33b93727
...@@ -2333,10 +2333,12 @@ static int nvme_setup_io_queues(struct nvme_dev *dev) ...@@ -2333,10 +2333,12 @@ static int nvme_setup_io_queues(struct nvme_dev *dev)
if (dev->cmb_use_sqes) { if (dev->cmb_use_sqes) {
result = nvme_cmb_qdepth(dev, nr_io_queues, result = nvme_cmb_qdepth(dev, nr_io_queues,
sizeof(struct nvme_command)); sizeof(struct nvme_command));
if (result > 0) if (result > 0) {
dev->q_depth = result; dev->q_depth = result;
else dev->ctrl.sqsize = result - 1;
} else {
dev->cmb_use_sqes = false; dev->cmb_use_sqes = false;
}
} }
do { do {
...@@ -2537,7 +2539,6 @@ static int nvme_pci_enable(struct nvme_dev *dev) ...@@ -2537,7 +2539,6 @@ static int nvme_pci_enable(struct nvme_dev *dev)
dev->q_depth = min_t(u32, NVME_CAP_MQES(dev->ctrl.cap) + 1, dev->q_depth = min_t(u32, NVME_CAP_MQES(dev->ctrl.cap) + 1,
io_queue_depth); io_queue_depth);
dev->ctrl.sqsize = dev->q_depth - 1; /* 0's based queue depth */
dev->db_stride = 1 << NVME_CAP_STRIDE(dev->ctrl.cap); dev->db_stride = 1 << NVME_CAP_STRIDE(dev->ctrl.cap);
dev->dbs = dev->bar + 4096; dev->dbs = dev->bar + 4096;
...@@ -2578,7 +2579,7 @@ static int nvme_pci_enable(struct nvme_dev *dev) ...@@ -2578,7 +2579,7 @@ static int nvme_pci_enable(struct nvme_dev *dev)
dev_warn(dev->ctrl.device, "IO queue depth clamped to %d\n", dev_warn(dev->ctrl.device, "IO queue depth clamped to %d\n",
dev->q_depth); dev->q_depth);
} }
dev->ctrl.sqsize = dev->q_depth - 1; /* 0's based queue depth */
nvme_map_cmb(dev); nvme_map_cmb(dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment