Skip to content

Commit

Permalink
nvmet: pass back cntlid on successful completion
Browse files Browse the repository at this point in the history
[ Upstream commit e804d5a ]

According to the NVMe specification, the response dword 0 value of the
Connect command is based on status code: return cntlid for successful
compeltion return IPO and IATTR for connect invalid parameters.  Fix
a missing error information for a zero sized queue, and return the
cntlid also for I/O queue Connect commands.

Signed-off-by: Amit Engel <amit.engel@dell.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Amit Engel authored and gregkh committed Sep 15, 2021
1 parent ea4a353 commit 10e759e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions drivers/nvme/target/fabrics-cmd.c
Expand Up @@ -120,6 +120,7 @@ static u16 nvmet_install_queue(struct nvmet_ctrl *ctrl, struct nvmet_req *req)
if (!sqsize) {
pr_warn("queue size zero!\n");
req->error_loc = offsetof(struct nvmf_connect_command, sqsize);
req->cqe->result.u32 = IPO_IATTR_CONNECT_SQE(sqsize);
ret = NVME_SC_CONNECT_INVALID_PARAM | NVME_SC_DNR;
goto err;
}
Expand Down Expand Up @@ -263,11 +264,11 @@ static void nvmet_execute_io_connect(struct nvmet_req *req)
}

status = nvmet_install_queue(ctrl, req);
if (status) {
/* pass back cntlid that had the issue of installing queue */
req->cqe->result.u16 = cpu_to_le16(ctrl->cntlid);
if (status)
goto out_ctrl_put;
}

/* pass back cntlid for successful completion */
req->cqe->result.u16 = cpu_to_le16(ctrl->cntlid);

pr_debug("adding queue %d to ctrl %d.\n", qid, ctrl->cntlid);

Expand Down

0 comments on commit 10e759e

Please sign in to comment.