This brings back the original probing logic by adding the dropped code to lpfc_sli_hba_setup(). Fixes: d2f2547efd39 ("scsi: lpfc: Fix auto sli_mode and its effect on CONFIG_PORT for SLI3") Signed-off-by: Daniel Wagner <dwagner@xxxxxxx> --- Hi James, after a back and forth, this version of the patch 'fixes' the problem with older hardware. I just post for reference. Daniel See also: https://lore.kernel.org/linux-scsi/20210618085257.ouah6xsjv3akkjhz@xxxxxxxxxxxxx/ drivers/scsi/lpfc/lpfc_attr.c | 2 +- drivers/scsi/lpfc/lpfc_init.c | 8 ++++++-- drivers/scsi/lpfc/lpfc_sli.c | 34 +++++++++++++++++++++++++++++++++- 3 files changed, 40 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index 7a7f17d71811..5730ac6462fa 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c @@ -3632,7 +3632,7 @@ unsigned long lpfc_no_hba_reset[MAX_HBAS_NO_RESET] = { module_param_array(lpfc_no_hba_reset, ulong, &lpfc_no_hba_reset_cnt, 0444); MODULE_PARM_DESC(lpfc_no_hba_reset, "WWPN of HBAs that should not be reset"); -LPFC_ATTR(sli_mode, 3, 3, 3, +LPFC_ATTR(sli_mode, 3, 0, 3, "SLI mode selector: 3 - select SLI-3"); LPFC_ATTR_R(enable_npiv, 1, 0, 1, diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 2fe7d9d885d9..3f3734127a7f 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -12112,8 +12112,12 @@ lpfc_sli_enable_intr(struct lpfc_hba *phba, uint32_t cfg_mode) /* Need to issue conf_port mbox cmd before conf_msi mbox cmd */ retval = lpfc_sli_config_port(phba, LPFC_SLI_REV3); - if (retval) - return intr_mode; + if (retval) { + /* Try SLI-2 before erroring out */ + retval = lpfc_sli_config_port(phba, LPFC_SLI_REV2); + if (retval) + return intr_mode; + } phba->hba_flag &= ~HBA_NEEDS_CFG_PORT; if (cfg_mode == 2) { diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 513a78d08b1d..5f32b5243302 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -5602,7 +5602,39 @@ lpfc_sli_hba_setup(struct lpfc_hba *phba) /* Enable ISR already does config_port because of config_msi mbx */ if (phba->hba_flag & HBA_NEEDS_CFG_PORT) { - rc = lpfc_sli_config_port(phba, LPFC_SLI_REV3); + int mode = 3; + + switch (phba->cfg_sli_mode) { + case 2: + if (phba->cfg_enable_npiv) { + lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, + "1824 NPIV enabled: Override sli_mode " + "parameter (%d) to auto (0).\n", + phba->cfg_sli_mode); + break; + } + mode = 2; + break; + case 0: + case 3: + break; + default: + lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, + "1819 Unrecognized sli_mode parameter: %d.\n", + phba->cfg_sli_mode); + break; + } + + rc = lpfc_sli_config_port(phba, mode); + + if (rc && phba->cfg_sli_mode == 3) + lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, + "1820 Unable to select SLI-3. " + "Not supported by adapter.\n"); + if (rc && mode != 2) + rc = lpfc_sli_config_port(phba, 2); + else if (rc && mode == 2) + rc = lpfc_sli_config_port(phba, 3); if (rc) return -EIO; phba->hba_flag &= ~HBA_NEEDS_CFG_PORT; -- 2.29.2