nvmet: Introduced helper routine for controller status check.
This patch introduces helper function for checking controller status during admin and io command processing which returns u16 status. As to bring consistency on returning status, other friend functions also now return u16 status instead of int to match the spec. As part of the theseerror log prints in also prints qid on which command error occured. Signed-off-by: Parav Pandit <parav@mellanox.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Jens Axboe <axboe@fb.com>
This commit is contained in:
@@ -661,6 +661,23 @@ out:
|
||||
return status;
|
||||
}
|
||||
|
||||
u16 nvmet_check_ctrl_status(struct nvmet_req *req, struct nvme_command *cmd)
|
||||
{
|
||||
if (unlikely(!(req->sq->ctrl->cc & NVME_CC_ENABLE))) {
|
||||
pr_err("got io cmd %d while CC.EN == 0 on qid = %d\n",
|
||||
cmd->common.opcode, req->sq->qid);
|
||||
return NVME_SC_CMD_SEQ_ERROR | NVME_SC_DNR;
|
||||
}
|
||||
|
||||
if (unlikely(!(req->sq->ctrl->csts & NVME_CSTS_RDY))) {
|
||||
pr_err("got io cmd %d while CSTS.RDY == 0 on qid = %d\n",
|
||||
cmd->common.opcode, req->sq->qid);
|
||||
req->ns = NULL;
|
||||
return NVME_SC_CMD_SEQ_ERROR | NVME_SC_DNR;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool __nvmet_host_allowed(struct nvmet_subsys *subsys,
|
||||
const char *hostnqn)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user