Skip to content

Commit 06dbe31

Browse files
Justin Teemartinkpetersen
authored andcommitted
scsi: lpfc: Add handling for LS_RJT reason explanation authentication required
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
1 parent ee80d8c commit 06dbe31

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

drivers/scsi/lpfc/lpfc_els.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4570,6 +4570,7 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
45704570
int link_reset = 0, rc;
45714571
u32 ulp_status = get_job_ulpstatus(phba, rspiocb);
45724572
u32 ulp_word4 = get_job_word4(phba, rspiocb);
4573+
u8 rsn_code_exp = 0;
45734574

45744575

45754576
/* 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,
47854786
break;
47864787

47874788
case LSRJT_LOGICAL_BSY:
4789+
rsn_code_exp = stat.un.b.lsRjtRsnCodeExp;
47884790
if ((cmd == ELS_CMD_PLOGI) ||
47894791
(cmd == ELS_CMD_PRLI) ||
47904792
(cmd == ELS_CMD_NVMEPRLI)) {
47914793
delay = 1000;
47924794
maxretry = 48;
4795+
4796+
/* An authentication LS_RJT reason code
4797+
* explanation means some error in the
4798+
* security settings end-to-end. Reduce
4799+
* the retry count to allow lpfc to clear
4800+
* RSCN mode and not race with dev_loss.
4801+
*/
4802+
if (cmd == ELS_CMD_PLOGI &&
4803+
rsn_code_exp == LSEXP_AUTH_REQ)
4804+
maxretry = 8;
47934805
} else if (cmd == ELS_CMD_FDISC) {
47944806
/* FDISC retry policy */
47954807
maxretry = 48;
@@ -4818,6 +4830,20 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
48184830
"0820 FLOGI (x%x). "
48194831
"BBCredit Not Supported\n",
48204832
stat.un.lsRjtError);
4833+
} else if (cmd == ELS_CMD_PLOGI) {
4834+
rsn_code_exp = stat.un.b.lsRjtRsnCodeExp;
4835+
4836+
/* An authentication LS_RJT reason code
4837+
* explanation means some error in the
4838+
* security settings end-to-end. Reduce
4839+
* the retry count to allow lpfc to clear
4840+
* RSCN mode and not race with dev_loss.
4841+
*/
4842+
if (rsn_code_exp == LSEXP_AUTH_REQ) {
4843+
delay = 1000;
4844+
retry = 1;
4845+
maxretry = 8;
4846+
}
48214847
}
48224848
break;
48234849

drivers/scsi/lpfc/lpfc_hw.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,7 @@ struct ls_rjt { /* Structure is in Big Endian format */
724724
#define LSEXP_OUT_OF_RESOURCE 0x29
725725
#define LSEXP_CANT_GIVE_DATA 0x2A
726726
#define LSEXP_REQ_UNSUPPORTED 0x2C
727+
#define LSEXP_AUTH_REQ 0x48
727728
#define LSEXP_NO_RSRC_ASSIGN 0x52
728729
uint8_t vendorUnique; /* FC Word 0, bit 0: 7 */
729730
} b;

0 commit comments

Comments
 (0)