scsi: lpfc: Fix attempted FA-PWWN usage after feature disable
authorJames Smart <jsmart2021@gmail.com>
Fri, 1 Jul 2022 21:14:19 +0000 (14:14 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 7 Jul 2022 21:21:43 +0000 (17:21 -0400)
Disabling FA-PWWN should be effective after port reset, but in some cases
it was found to be impossible to clear FA-PWWN usage without a driver
reload.

Clean up FA-PWWN flag management to make enable and disable of the feature
more robust.

Link: https://lore.kernel.org/r/20220701211425.2708-7-jsmart2021@gmail.com
Co-developed-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/lpfc/lpfc_init.c
drivers/scsi/lpfc/lpfc_sli.c

index 750dd1e..7424b19 100644 (file)
@@ -375,6 +375,9 @@ lpfc_update_vport_wwn(struct lpfc_vport *vport)
                if (phba->sli_rev == LPFC_SLI_REV4 &&
                    vport->port_type == LPFC_PHYSICAL_PORT &&
                    phba->sli4_hba.fawwpn_flag & LPFC_FAWWPN_FABRIC) {
+                       if (!(phba->sli4_hba.fawwpn_flag & LPFC_FAWWPN_CONFIG))
+                               phba->sli4_hba.fawwpn_flag &=
+                                               ~LPFC_FAWWPN_FABRIC;
                        lpfc_printf_log(phba, KERN_INFO,
                                        LOG_SLI | LOG_DISCOVERY | LOG_ELS,
                                        "2701 FA-PWWN change WWPN from %llx to "
@@ -9975,7 +9978,8 @@ lpfc_sli4_read_config(struct lpfc_hba *phba)
                                        "configured on\n");
                        phba->sli4_hba.fawwpn_flag |= LPFC_FAWWPN_CONFIG;
                } else {
-                       phba->sli4_hba.fawwpn_flag = 0;
+                       /* Clear FW configured flag, preserve driver flag */
+                       phba->sli4_hba.fawwpn_flag &= ~LPFC_FAWWPN_CONFIG;
                }
 
                phba->sli4_hba.conf_trunk =
index 81c61d3..71442fa 100644 (file)
@@ -5265,7 +5265,8 @@ lpfc_sli_brdrestart_s4(struct lpfc_hba *phba)
        phba->pport->stopped = 0;
        phba->link_state = LPFC_INIT_START;
        phba->hba_flag = 0;
-       phba->sli4_hba.fawwpn_flag = 0;
+       /* Preserve FA-PWWN expectation */
+       phba->sli4_hba.fawwpn_flag &= LPFC_FAWWPN_FABRIC;
        spin_unlock_irq(&phba->hbalock);
 
        memset(&psli->lnk_stat_offsets, 0, sizeof(psli->lnk_stat_offsets));
@@ -6054,6 +6055,10 @@ lpfc_sli4_retrieve_pport_name(struct lpfc_hba *phba)
        /* obtain link type and link number via READ_CONFIG */
        phba->sli4_hba.lnk_info.lnk_dv = LPFC_LNK_DAT_INVAL;
        lpfc_sli4_read_config(phba);
+
+       if (phba->sli4_hba.fawwpn_flag & LPFC_FAWWPN_CONFIG)
+               phba->sli4_hba.fawwpn_flag |= LPFC_FAWWPN_FABRIC;
+
        if (phba->sli4_hba.lnk_info.lnk_dv == LPFC_LNK_DAT_VAL)
                goto retrieve_ppname;