linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nvmet: pass back cntlid on successful completion
@ 2021-08-05 15:33 amit.engel
  2021-08-06 19:34 ` Sagi Grimberg
  0 siblings, 1 reply; 4+ messages in thread
From: amit.engel @ 2021-08-05 15:33 UTC (permalink / raw)
  To: linux-nvme, sagi, kbusch; +Cc: amit.engel

From: Amit Engel <amit.engel@dell.com>

According to NVMe specification,
connect response dword 0 value is based on status code:
return cntlid for successful compeltion
return IPO and IATTR for connect invalid parameters

Signed-off-by: Amit Engel <amit.engel@dell.com>
---
 drivers/nvme/target/fabrics-cmd.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/nvme/target/fabrics-cmd.c b/drivers/nvme/target/fabrics-cmd.c
index 7d0f3523fdab..eaaf179bec82 100644
--- a/drivers/nvme/target/fabrics-cmd.c
+++ b/drivers/nvme/target/fabrics-cmd.c
@@ -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;
 	}
@@ -260,11 +261,12 @@ 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);
 
-- 
2.18.2


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] nvmet: pass back cntlid on successful completion
  2021-08-05 15:33 [PATCH] nvmet: pass back cntlid on successful completion amit.engel
@ 2021-08-06 19:34 ` Sagi Grimberg
  0 siblings, 0 replies; 4+ messages in thread
From: Sagi Grimberg @ 2021-08-06 19:34 UTC (permalink / raw)
  To: amit.engel, linux-nvme, kbusch


>   	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);
> +

No need for this newline

> +	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);
>   
> 

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] nvmet: pass back cntlid on successful completion
  2021-08-08  6:20 amit.engel
@ 2021-08-10 16:19 ` Christoph Hellwig
  0 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2021-08-10 16:19 UTC (permalink / raw)
  To: amit.engel; +Cc: linux-nvme, sagi, kbusch

Thanks, applied with a slightly updated commit message.

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] nvmet: pass back cntlid on successful completion
@ 2021-08-08  6:20 amit.engel
  2021-08-10 16:19 ` Christoph Hellwig
  0 siblings, 1 reply; 4+ messages in thread
From: amit.engel @ 2021-08-08  6:20 UTC (permalink / raw)
  To: linux-nvme, sagi, kbusch; +Cc: amit.engel

From: Amit Engel <amit.engel@dell.com>

According to NVMe specification,
connect response dword 0 value is based on status code:
return cntlid for successful compeltion
return IPO and IATTR for connect invalid parameters

Signed-off-by: Amit Engel <amit.engel@dell.com>
---
 drivers/nvme/target/fabrics-cmd.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/nvme/target/fabrics-cmd.c b/drivers/nvme/target/fabrics-cmd.c
index 7d0f3523fdab..8ef564c3b32c 100644
--- a/drivers/nvme/target/fabrics-cmd.c
+++ b/drivers/nvme/target/fabrics-cmd.c
@@ -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;
 	}
@@ -260,11 +261,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);
 
-- 
2.18.2


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-08-10 16:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-05 15:33 [PATCH] nvmet: pass back cntlid on successful completion amit.engel
2021-08-06 19:34 ` Sagi Grimberg
2021-08-08  6:20 amit.engel
2021-08-10 16:19 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).