Skip to contentSkip to conversation

lpfc: use NVMe error codes for LS request done callback

PATCH In review Hannes Reinecke 2 participants 4 messages Sep 16, 2020 – Sep 18, 2020

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

PATCH 1/1 lpfc: use NVMe error codes for LS request done callback

The LS request callback requires a 'status' argument, but that one should be an NVMe error code, not a driver specific one which has no meaning in the nvme layer.

---
 drivers/scsi/lpfc/lpfc_nvme.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/scsi/lpfc/lpfc_nvme.c +3 -1
index e5be334d6a11..4b007a28014b 100644
@@ -498,7 +498,9 @@ __lpfc_nvme_ls_req_cmp(struct lpfc_hba *phba,  struct lpfc_vport *vport,
 		cmdwqe->context3 = NULL;
 	}
 	if (pnvme_lsreq->done)
-		pnvme_lsreq->done(pnvme_lsreq, status);
+		pnvme_lsreq->done(pnvme_lsreq,
+				  status == IOSTAT_SUCCESS ?
+				  NVME_SC_SUCCESS : NVME_SC_INTERNAL);
 	else
 		lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT,
 				 "6046 NVMEx cmpl without done call back? "
Signature · 1 line
2.16.4
#1 lore raw
Quoted 14 lines · Hannes Reinecke

The LS request callback requires a 'status' argument, but that one should be an NVMe error code, not a driver specific one which has no meaning in the nvme layer.

---
  drivers/scsi/lpfc/lpfc_nvme.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
drivers/scsi/lpfc/lpfc_nvme.c +0 -0
index e5be334d6a11..4b007a28014b 100644

drivers/scsi/lpfc/lpfc_nvme.c __lpfc_nvme_ls_req_cmp(struct lpfc_hba *phba, struct lpfc_vport *vport, · line 506

Quoted 10 lines
drivers/scsi/lpfc/lpfc_nvme.c +3 -1
@@ -498,7 +498,9 @@ __lpfc_nvme_ls_req_cmp(struct lpfc_hba *phba,  struct lpfc_vport *vport,
  		cmdwqe->context3 = NULL;
  	}
  	if (pnvme_lsreq->done)
-		pnvme_lsreq->done(pnvme_lsreq, status);
+		pnvme_lsreq->done(pnvme_lsreq,
+				  status == IOSTAT_SUCCESS ?
+				  NVME_SC_SUCCESS : NVME_SC_INTERNAL);
  	else
  		lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT,
  				 "6046 NVMEx cmpl without done call back? "

No - it's not a nvme command, so doesn't need a nvme status code. It should be a -Exxx  value or a 0 (success).  nvme_fc_send_ls_req() for example calls __nvme_fc_send_ls_req(), which can return any number of -Exxx values, and the routine returns the value returned by the done call after waiting for it to complete - so they should all follow the same form.

-- james

#2 lore raw
Quoted 24 lines · James Smart
Quoted 21 lines · Hannes Reinecke

The LS request callback requires a 'status' argument, but that one should be an NVMe error code, not a driver specific one which has no meaning in the nvme layer.

---
  drivers/scsi/lpfc/lpfc_nvme.c | 4 +++-

  1 file changed, 3 insertions(+), 1 deletion(-)
drivers/scsi/lpfc/lpfc_nvme.c +2 -1
index e5be334d6a11..4b007a28014b 100644
@@ -498,7 +498,9 @@ __lpfc_nvme_ls_req_cmp(struct lpfc_hba *phba,  
 struct lpfc_vport *vport,
           cmdwqe->context3 = NULL;
       }
       if (pnvme_lsreq->done)
-        pnvme_lsreq->done(pnvme_lsreq, status);
+        pnvme_lsreq->done(pnvme_lsreq,
+                  status == IOSTAT_SUCCESS ?
Quoted 9 lines
Quoted 4 lines
drivers/scsi/lpfc/lpfc_nvme.c +1 -0
+                  NVME_SC_SUCCESS : NVME_SC_INTERNAL);

      else
          lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, "6046 NVMEx cmpl without done call back? "

No - it's not a nvme command, so doesn't need a nvme status code. It should be a -Exxx  value or a 0 (success).  nvme_fc_send_ls_req() for example calls __nvme_fc_send_ls_req(), which can return any number of -Exxx values, and the routine returns the value returned by the done
call after waiting for it to complete - so they should all follow the same form.

Right. But returning IOSTAT definitions is still wrong :->

Will be updating the patch.

Cheers,

Hannes

Signature · 4 lines
Dr. Hannes Reinecke                Kernel Storage Architect
[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
#3 lore raw
Quoted 34 lines · Hannes Reinecke
Quoted 24 lines · James Smart
Quoted 21 lines · Hannes Reinecke

The LS request callback requires a 'status' argument, but that one should be an NVMe error code, not a driver specific one which has no meaning in the nvme layer.

---
  drivers/scsi/lpfc/lpfc_nvme.c | 4 +++-

  1 file changed, 3 insertions(+), 1 deletion(-)
drivers/scsi/lpfc/lpfc_nvme.c +2 -1
index e5be334d6a11..4b007a28014b 100644
@@ -498,7 +498,9 @@ __lpfc_nvme_ls_req_cmp(struct lpfc_hba *phba,  
 struct lpfc_vport *vport,
           cmdwqe->context3 = NULL;
       }
       if (pnvme_lsreq->done)
-        pnvme_lsreq->done(pnvme_lsreq, status);
+        pnvme_lsreq->done(pnvme_lsreq,
+                  status == IOSTAT_SUCCESS ?
Quoted 9 lines
Quoted 4 lines
drivers/scsi/lpfc/lpfc_nvme.c +1 -0
+                  NVME_SC_SUCCESS : NVME_SC_INTERNAL);

      else
          lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, "6046 NVMEx cmpl without done call back? "

No - it's not a nvme command, so doesn't need a nvme status code. It should be a -Exxx  value or a 0 (success). nvme_fc_send_ls_req() for example calls __nvme_fc_send_ls_req(), which can return any number of -Exxx values, and the routine returns the value returned by the done
call after waiting for it to complete - so they should all follow the same form.

Quoted 1 line

Right. But returning IOSTAT definitions is still wrong :->

true..  :)

-- james