]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
scsi: lpfc: Add handling for LS_RJT reason explanation authentication required
authorJustin Tee <justin.tee@broadcom.com>
Thu, 12 Dec 2024 23:33:04 +0000 (15:33 -0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 2 Jan 2025 20:01:22 +0000 (15:01 -0500)
When a LS_RJT is received with reason explanation authentication required,
current driver logic is to retry the PLOGI up to 48 times.  In the worse
case scenario, 48 retries can take longer than dev_loss_tmo and if there is
an RSCN received indicating an authentication requirement change, the
driver may miss processing it.  Fix by adding logic to specifically handle
reason explanation authentication required and set the max retry count to 8
times.

Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Link: https://lore.kernel.org/r/20241212233309.71356-6-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/lpfc/lpfc_els.c
drivers/scsi/lpfc/lpfc_hw.h

index 842b67e37f108c4b251e8e73bcc8fd05cab71890..32e5e99ebbd4f80052ac2a35d23957ee29ef6c3d 100644 (file)
@@ -4570,6 +4570,7 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
        int link_reset = 0, rc;
        u32 ulp_status = get_job_ulpstatus(phba, rspiocb);
        u32 ulp_word4 = get_job_word4(phba, rspiocb);
+       u8 rsn_code_exp = 0;
 
 
        /* Note: cmd_dmabuf may be 0 for internal driver abort
@@ -4785,11 +4786,22 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
                        break;
 
                case LSRJT_LOGICAL_BSY:
+                       rsn_code_exp = stat.un.b.lsRjtRsnCodeExp;
                        if ((cmd == ELS_CMD_PLOGI) ||
                            (cmd == ELS_CMD_PRLI) ||
                            (cmd == ELS_CMD_NVMEPRLI)) {
                                delay = 1000;
                                maxretry = 48;
+
+                               /* An authentication LS_RJT reason code
+                                * explanation means some error in the
+                                * security settings end-to-end.  Reduce
+                                * the retry count to allow lpfc to clear
+                                * RSCN mode and not race with dev_loss.
+                                */
+                               if (cmd == ELS_CMD_PLOGI &&
+                                   rsn_code_exp == LSEXP_AUTH_REQ)
+                                       maxretry = 8;
                        } else if (cmd == ELS_CMD_FDISC) {
                                /* FDISC retry policy */
                                maxretry = 48;
@@ -4818,6 +4830,20 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
                                              "0820 FLOGI (x%x). "
                                              "BBCredit Not Supported\n",
                                              stat.un.lsRjtError);
+                       } else if (cmd == ELS_CMD_PLOGI) {
+                               rsn_code_exp = stat.un.b.lsRjtRsnCodeExp;
+
+                               /* An authentication LS_RJT reason code
+                                * explanation means some error in the
+                                * security settings end-to-end.  Reduce
+                                * the retry count to allow lpfc to clear
+                                * RSCN mode and not race with dev_loss.
+                                */
+                               if (rsn_code_exp == LSEXP_AUTH_REQ) {
+                                       delay = 1000;
+                                       retry = 1;
+                                       maxretry = 8;
+                               }
                        }
                        break;
 
index d5c15742f7f29cee5643536885c5244e1eae7390..71d3e60f4b2036bf43d3dfc2c5f4f0e3ee6fedcd 100644 (file)
@@ -724,6 +724,7 @@ struct ls_rjt {     /* Structure is in Big Endian format */
 #define LSEXP_OUT_OF_RESOURCE   0x29
 #define LSEXP_CANT_GIVE_DATA    0x2A
 #define LSEXP_REQ_UNSUPPORTED   0x2C
+#define LSEXP_AUTH_REQ          0x48
 #define LSEXP_NO_RSRC_ASSIGN    0x52
                        uint8_t vendorUnique;   /* FC Word 0, bit  0: 7 */
                } b;