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:
@@ -480,22 +480,16 @@ static void nvmet_execute_keep_alive(struct nvmet_req *req)
|
||||
nvmet_req_complete(req, 0);
|
||||
}
|
||||
|
||||
int nvmet_parse_admin_cmd(struct nvmet_req *req)
|
||||
u16 nvmet_parse_admin_cmd(struct nvmet_req *req)
|
||||
{
|
||||
struct nvme_command *cmd = req->cmd;
|
||||
u16 ret;
|
||||
|
||||
req->ns = NULL;
|
||||
|
||||
if (unlikely(!(req->sq->ctrl->cc & NVME_CC_ENABLE))) {
|
||||
pr_err("got admin cmd %d while CC.EN == 0\n",
|
||||
cmd->common.opcode);
|
||||
return NVME_SC_CMD_SEQ_ERROR | NVME_SC_DNR;
|
||||
}
|
||||
if (unlikely(!(req->sq->ctrl->csts & NVME_CSTS_RDY))) {
|
||||
pr_err("got admin cmd %d while CSTS.RDY == 0\n",
|
||||
cmd->common.opcode);
|
||||
return NVME_SC_CMD_SEQ_ERROR | NVME_SC_DNR;
|
||||
}
|
||||
ret = nvmet_check_ctrl_status(req, cmd);
|
||||
if (unlikely(ret))
|
||||
return ret;
|
||||
|
||||
switch (cmd->common.opcode) {
|
||||
case nvme_admin_get_log_page:
|
||||
@@ -545,6 +539,7 @@ int nvmet_parse_admin_cmd(struct nvmet_req *req)
|
||||
return 0;
|
||||
}
|
||||
|
||||
pr_err("unhandled cmd %d\n", cmd->common.opcode);
|
||||
pr_err("unhandled cmd %d on qid %d\n", cmd->common.opcode,
|
||||
req->sq->qid);
|
||||
return NVME_SC_INVALID_OPCODE | NVME_SC_DNR;
|
||||
}
|
||||
|
Reference in New Issue
Block a user