提交 f5fa90dc 编写于 作者: C Christoph Hellwig 提交者: Jens Axboe

nvme: move the workaround for I/O queue-less controllers from PCIe to core

We want to apply this to Fabrics drivers as well, so move it to common
code.
Reviewed-by: NJay Freyensee <james.p.freyensee@intel.com>
Reviewed-by: NSagi Grimberg <sagi@grimberg.me>
Tested-by: NMing Lin <ming.l@ssi.samsung.com>
Signed-off-by: NChristoph Hellwig <hch@lst.de>
Reviewed-by: NKeith Busch <keith.busch@intel.com>
Signed-off-by: NJens Axboe <axboe@fb.com>
上级 7a5abb4b
...@@ -574,11 +574,22 @@ int nvme_set_queue_count(struct nvme_ctrl *ctrl, int *count) ...@@ -574,11 +574,22 @@ int nvme_set_queue_count(struct nvme_ctrl *ctrl, int *count)
status = nvme_set_features(ctrl, NVME_FEAT_NUM_QUEUES, q_count, 0, status = nvme_set_features(ctrl, NVME_FEAT_NUM_QUEUES, q_count, 0,
&result); &result);
if (status) if (status < 0)
return status; return status;
nr_io_queues = min(result & 0xffff, result >> 16) + 1; /*
*count = min(*count, nr_io_queues); * Degraded controllers might return an error when setting the queue
* count. We still want to be able to bring them online and offer
* access to the admin queue, as that might be only way to fix them up.
*/
if (status > 0) {
dev_err(ctrl->dev, "Could not set queue count (%d)\n", status);
*count = 0;
} else {
nr_io_queues = min(result & 0xffff, result >> 16) + 1;
*count = min(*count, nr_io_queues);
}
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(nvme_set_queue_count); EXPORT_SYMBOL_GPL(nvme_set_queue_count);
......
...@@ -1383,16 +1383,8 @@ static int nvme_setup_io_queues(struct nvme_dev *dev) ...@@ -1383,16 +1383,8 @@ static int nvme_setup_io_queues(struct nvme_dev *dev)
if (result < 0) if (result < 0)
return result; return result;
/* if (nr_io_queues == 0)
* Degraded controllers might return an error when setting the queue
* count. We still want to be able to bring them online and offer
* access to the admin queue, as that might be only way to fix them up.
*/
if (result > 0) {
dev_err(dev->ctrl.device,
"Could not set queue count (%d)\n", result);
return 0; return 0;
}
if (dev->cmb && NVME_CMB_SQS(dev->cmbsz)) { if (dev->cmb && NVME_CMB_SQS(dev->cmbsz)) {
result = nvme_cmb_qdepth(dev, nr_io_queues, result = nvme_cmb_qdepth(dev, nr_io_queues,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册