Skip to content

Commit

Permalink
nvme: move the workaround for I/O queue-less controllers from PCIe to…
Browse files Browse the repository at this point in the history
… core

We want to apply this to Fabrics drivers as well, so move it to common
code.

Reviewed-by: Jay Freyensee <[email protected]>
Reviewed-by: Sagi Grimberg <[email protected]>
Tested-by: Ming Lin <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
Reviewed-by: Keith Busch <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
Christoph Hellwig authored and axboe committed Jun 12, 2016
1 parent 7a5abb4 commit f5fa90d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
17 changes: 14 additions & 3 deletions drivers/nvme/host/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
&result);
if (status)
if (status < 0)
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;
}
EXPORT_SYMBOL_GPL(nvme_set_queue_count);
Expand Down
10 changes: 1 addition & 9 deletions drivers/nvme/host/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -1383,16 +1383,8 @@ static int nvme_setup_io_queues(struct nvme_dev *dev)
if (result < 0)
return result;

/*
* 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);
if (nr_io_queues == 0)
return 0;
}

if (dev->cmb && NVME_CMB_SQS(dev->cmbsz)) {
result = nvme_cmb_qdepth(dev, nr_io_queues,
Expand Down

0 comments on commit f5fa90d

Please sign in to comment.