linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] qla2xxx: Set NVME status code for failed NVME FCP request
@ 2020-06-04 10:07 Daniel Wagner
  2020-06-12 17:48 ` Hannes Reinecke
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Daniel Wagner @ 2020-06-04 10:07 UTC (permalink / raw)
  To: linux-scsi
  Cc: Nilesh Javali, GR-QLogic-Storage-Upstream, linux-kernel, Daniel Wagner

The qla2xxx driver knows when request was processed successfully or
not. But it always sets the NVME status code to 0/NVME_SC_SUCCESS. The
upper layer needs to figure out from the rcv_rsplen and
transferred_length variables if the request was successfully. This is
not always possible, e.g. when the request data length is 0, the
transferred_length is also set 0 which is interpreted as success in
nvme_fc_fcpio_done(). Let's inform the upper
layer (nvme_fc_fcpio_done()) when something went wrong.

nvme_fc_fcpio_done() maps all non NVME_SC_SUCCESS status codes to
NVME_SC_HOST_PATH_ERROR. There isn't any benefit to map the QLA status
code to the NVME status code. Therefore, let's use NVME_SC_INTERNAL to
indicate an error which aligns it with the lpfc driver.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 drivers/scsi/qla2xxx/qla_nvme.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c
index d66d47a0f958..fa695a4007f8 100644
--- a/drivers/scsi/qla2xxx/qla_nvme.c
+++ b/drivers/scsi/qla2xxx/qla_nvme.c
@@ -139,11 +139,12 @@ static void qla_nvme_release_fcp_cmd_kref(struct kref *kref)
 	sp->priv = NULL;
 	if (priv->comp_status == QLA_SUCCESS) {
 		fd->rcv_rsplen = le16_to_cpu(nvme->u.nvme.rsp_pyld_len);
+		fd->status = NVME_SC_SUCCESS;
 	} else {
 		fd->rcv_rsplen = 0;
 		fd->transferred_length = 0;
+		fd->status = NVME_SC_INTERNAL;
 	}
-	fd->status = 0;
 	spin_unlock_irqrestore(&priv->cmd_lock, flags);
 
 	fd->done(fd);
-- 
2.16.4


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

* Re: [PATCH] qla2xxx: Set NVME status code for failed NVME FCP request
  2020-06-04 10:07 [PATCH] qla2xxx: Set NVME status code for failed NVME FCP request Daniel Wagner
@ 2020-06-12 17:48 ` Hannes Reinecke
  2020-06-22 17:35 ` Himanshu Madhani
  2020-06-24  4:29 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Hannes Reinecke @ 2020-06-12 17:48 UTC (permalink / raw)
  To: Daniel Wagner, linux-scsi
  Cc: Nilesh Javali, GR-QLogic-Storage-Upstream, linux-kernel

On 6/4/20 12:07 PM, Daniel Wagner wrote:
> The qla2xxx driver knows when request was processed successfully or
> not. But it always sets the NVME status code to 0/NVME_SC_SUCCESS. The
> upper layer needs to figure out from the rcv_rsplen and
> transferred_length variables if the request was successfully. This is
> not always possible, e.g. when the request data length is 0, the
> transferred_length is also set 0 which is interpreted as success in
> nvme_fc_fcpio_done(). Let's inform the upper
> layer (nvme_fc_fcpio_done()) when something went wrong.
> 
> nvme_fc_fcpio_done() maps all non NVME_SC_SUCCESS status codes to
> NVME_SC_HOST_PATH_ERROR. There isn't any benefit to map the QLA status
> code to the NVME status code. Therefore, let's use NVME_SC_INTERNAL to
> indicate an error which aligns it with the lpfc driver.
> 
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
>   drivers/scsi/qla2xxx/qla_nvme.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c
> index d66d47a0f958..fa695a4007f8 100644
> --- a/drivers/scsi/qla2xxx/qla_nvme.c
> +++ b/drivers/scsi/qla2xxx/qla_nvme.c
> @@ -139,11 +139,12 @@ static void qla_nvme_release_fcp_cmd_kref(struct kref *kref)
>   	sp->priv = NULL;
>   	if (priv->comp_status == QLA_SUCCESS) {
>   		fd->rcv_rsplen = le16_to_cpu(nvme->u.nvme.rsp_pyld_len);
> +		fd->status = NVME_SC_SUCCESS;
>   	} else {
>   		fd->rcv_rsplen = 0;
>   		fd->transferred_length = 0;
> +		fd->status = NVME_SC_INTERNAL;
>   	}
> -	fd->status = 0;
>   	spin_unlock_irqrestore(&priv->cmd_lock, flags);
>   
>   	fd->done(fd);
> 
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke            Teamlead Storage & Networking
hare@suse.de                               +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer

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

* Re: [PATCH] qla2xxx: Set NVME status code for failed NVME FCP request
  2020-06-04 10:07 [PATCH] qla2xxx: Set NVME status code for failed NVME FCP request Daniel Wagner
  2020-06-12 17:48 ` Hannes Reinecke
@ 2020-06-22 17:35 ` Himanshu Madhani
  2020-06-24  4:29 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Himanshu Madhani @ 2020-06-22 17:35 UTC (permalink / raw)
  To: Daniel Wagner, linux-scsi
  Cc: Nilesh Javali, GR-QLogic-Storage-Upstream, linux-kernel



On 6/4/20 5:07 AM, Daniel Wagner wrote:
> The qla2xxx driver knows when request was processed successfully or
> not. But it always sets the NVME status code to 0/NVME_SC_SUCCESS. The
> upper layer needs to figure out from the rcv_rsplen and
> transferred_length variables if the request was successfully. This is
> not always possible, e.g. when the request data length is 0, the
> transferred_length is also set 0 which is interpreted as success in
> nvme_fc_fcpio_done(). Let's inform the upper
> layer (nvme_fc_fcpio_done()) when something went wrong.
> 
> nvme_fc_fcpio_done() maps all non NVME_SC_SUCCESS status codes to
> NVME_SC_HOST_PATH_ERROR. There isn't any benefit to map the QLA status
> code to the NVME status code. Therefore, let's use NVME_SC_INTERNAL to
> indicate an error which aligns it with the lpfc driver.
> 
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
>   drivers/scsi/qla2xxx/qla_nvme.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c
> index d66d47a0f958..fa695a4007f8 100644
> --- a/drivers/scsi/qla2xxx/qla_nvme.c
> +++ b/drivers/scsi/qla2xxx/qla_nvme.c
> @@ -139,11 +139,12 @@ static void qla_nvme_release_fcp_cmd_kref(struct kref *kref)
>   	sp->priv = NULL;
>   	if (priv->comp_status == QLA_SUCCESS) {
>   		fd->rcv_rsplen = le16_to_cpu(nvme->u.nvme.rsp_pyld_len);
> +		fd->status = NVME_SC_SUCCESS;
>   	} else {
>   		fd->rcv_rsplen = 0;
>   		fd->transferred_length = 0;
> +		fd->status = NVME_SC_INTERNAL;
>   	}
> -	fd->status = 0;
>   	spin_unlock_irqrestore(&priv->cmd_lock, flags);
>   
>   	fd->done(fd);
> 

Makes sense.

Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>

-- 
Himanshu Madhani                     Oracle Linux Engineering

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

* Re: [PATCH] qla2xxx: Set NVME status code for failed NVME FCP request
  2020-06-04 10:07 [PATCH] qla2xxx: Set NVME status code for failed NVME FCP request Daniel Wagner
  2020-06-12 17:48 ` Hannes Reinecke
  2020-06-22 17:35 ` Himanshu Madhani
@ 2020-06-24  4:29 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2020-06-24  4:29 UTC (permalink / raw)
  To: linux-scsi, Daniel Wagner
  Cc: Martin K . Petersen, linux-kernel, GR-QLogic-Storage-Upstream,
	Nilesh Javali

On Thu, 4 Jun 2020 12:07:45 +0200, Daniel Wagner wrote:

> The qla2xxx driver knows when request was processed successfully or
> not. But it always sets the NVME status code to 0/NVME_SC_SUCCESS. The
> upper layer needs to figure out from the rcv_rsplen and
> transferred_length variables if the request was successfully. This is
> not always possible, e.g. when the request data length is 0, the
> transferred_length is also set 0 which is interpreted as success in
> nvme_fc_fcpio_done(). Let's inform the upper
> layer (nvme_fc_fcpio_done()) when something went wrong.
> 
> [...]

Applied to 5.8/scsi-fixes, thanks!

[1/1] scsi: qla2xxx: Set NVMe status code for failed NVMe FCP request
      https://git.kernel.org/mkp/scsi/c/ef2e3ec520a8

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2020-06-24  4:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-04 10:07 [PATCH] qla2xxx: Set NVME status code for failed NVME FCP request Daniel Wagner
2020-06-12 17:48 ` Hannes Reinecke
2020-06-22 17:35 ` Himanshu Madhani
2020-06-24  4:29 ` Martin K. Petersen

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).