Skip to contentSkip to conversation

qla2xxx: Set NVME status code for failed NVME FCP request

PATCH Applied Daniel Wagner 4 participants 4 messages Jun 4, 2020 – Jun 24, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qla2xxx: Set NVME status code for failed NVME FCP request

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.

---
 drivers/scsi/qla2xxx/qla_nvme.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_nvme.c +2 -1
index d66d47a0f958..fa695a4007f8 100644
@@ -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);
Signature · 1 line
2.16.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 28 lines · 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.

---
  drivers/scsi/qla2xxx/qla_nvme.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_nvme.c +0 -0
index d66d47a0f958..fa695a4007f8 100644
@@ -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);

drivers/scsi/qla2xxx/qla_nvme.c static void qla_nvme_release_fcp_cmd_kref(struct kref *kref) · line 150

Quoted 10 lines
drivers/scsi/qla2xxx/qla_nvme.c +2 -1
+		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);

Cheers,

Hannes

Signature · 4 lines
Dr. Hannes Reinecke            Teamlead Storage & Networking
[email protected]                               +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
Reviewed-by on v1 1/1
#2 lore raw
In reply to Daniel Wagner
Quoted 28 lines · 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.

---
  drivers/scsi/qla2xxx/qla_nvme.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_nvme.c +0 -0
index d66d47a0f958..fa695a4007f8 100644
@@ -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);

drivers/scsi/qla2xxx/qla_nvme.c static void qla_nvme_release_fcp_cmd_kref(struct kref *kref) · line 150

Quoted 10 lines
drivers/scsi/qla2xxx/qla_nvme.c +2 -1
+		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.

Signature · 1 line
Himanshu Madhani                     Oracle Linux Engineering
#3 lore raw
In reply to Daniel Wagner
Quoted 10 lines · 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.

[...]

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
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering