All of lore.kernel.org
 help / color / mirror / Atom feed
From: Justin Tee <justintee8345@gmail.com>
To: linux-scsi@vger.kernel.org
Cc: jsmart2021@gmail.com, justin.tee@broadcom.com,
	Justin Tee <justintee8345@gmail.com>
Subject: [PATCH 05/10] lpfc: Add handling for LS_RJT reason explanation authentication required
Date: Thu, 12 Dec 2024 15:33:04 -0800	[thread overview]
Message-ID: <20241212233309.71356-6-justintee8345@gmail.com> (raw)
In-Reply-To: <20241212233309.71356-1-justintee8345@gmail.com>

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>
---
 drivers/scsi/lpfc/lpfc_els.c | 26 ++++++++++++++++++++++++++
 drivers/scsi/lpfc/lpfc_hw.h  |  1 +
 2 files changed, 27 insertions(+)

diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index 842b67e37f10..32e5e99ebbd4 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -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;
 
diff --git a/drivers/scsi/lpfc/lpfc_hw.h b/drivers/scsi/lpfc/lpfc_hw.h
index d5c15742f7f2..71d3e60f4b20 100644
--- a/drivers/scsi/lpfc/lpfc_hw.h
+++ b/drivers/scsi/lpfc/lpfc_hw.h
@@ -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;
-- 
2.38.0


  parent reply	other threads:[~2024-12-12 23:14 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-12 23:32 [PATCH 00/10] Update lpfc to revision 14.4.0.7 Justin Tee
2024-12-12 23:33 ` [PATCH 01/10] lpfc: Redefine incorrect type in lpfc_create_device_data Justin Tee
2024-12-12 23:33 ` [PATCH 02/10] lpfc: Restrict the REG_FCFI MAM field to FCoE adapters only Justin Tee
2024-12-12 23:33 ` [PATCH 03/10] lpfc: Delete NLP_TARGET_REMOVE flag due to obsolete usage Justin Tee
2024-12-12 23:33 ` [PATCH 04/10] lpfc: Modify handling of ADISC based on ndlp state and RPI registration Justin Tee
2024-12-12 23:33 ` Justin Tee [this message]
2024-12-12 23:33 ` [PATCH 06/10] lpfc: Change lpfc_nodelist save_flags member into a bitmask Justin Tee
2024-12-12 23:33 ` [PATCH 07/10] lpfc: Update definition of firmware configuration mbox cmds Justin Tee
2024-12-12 23:33 ` [PATCH 08/10] lpfc: Add support for large fw object application layer reads Justin Tee
2024-12-12 23:33 ` [PATCH 09/10] lpfc: Update lpfc version to 14.4.0.7 Justin Tee
2024-12-12 23:33 ` [PATCH 10/10] lpfc: Copyright updates for 14.4.0.7 patches Justin Tee
2025-01-02 20:03 ` [PATCH 00/10] Update lpfc to revision 14.4.0.7 Martin K. Petersen
2025-01-10 21:16 ` Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241212233309.71356-6-justintee8345@gmail.com \
    --to=justintee8345@gmail.com \
    --cc=jsmart2021@gmail.com \
    --cc=justin.tee@broadcom.com \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.