Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi: lpfc: Revise Topology and RAS support checks for new adapters

Support for Topology and RAS logging capabilities were qualified by PCIe
device ID checks necessitating additional driver changes for new device
IDs.

Reduce reliance on specific PCIe device IDs by substituting checks for SLI
family information. This automatically picks up support on the newest
hardware.

Link: https://lore.kernel.org/r/20210722221721.74388-4-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>

authored by

James Smart and committed by
Martin K. Petersen
f6c5e6c4 df3d78c3

+38 -27
+9 -5
drivers/scsi/lpfc/lpfc_attr.c
··· 4038 4038 const char *val_buf = buf; 4039 4039 int err; 4040 4040 uint32_t prev_val; 4041 + u8 sli_family, if_type; 4041 4042 4042 4043 if (!strncmp(buf, "nolip ", strlen("nolip "))) { 4043 4044 nolip = 1; ··· 4062 4061 /* 4063 4062 * The 'topology' is not a configurable parameter if : 4064 4063 * - persistent topology enabled 4065 - * - G7/G6 with no private loop support 4064 + * - ASIC_GEN_NUM >= 0xC, with no private loop support 4066 4065 */ 4067 - 4066 + sli_family = bf_get(lpfc_sli_intf_sli_family, 4067 + &phba->sli4_hba.sli_intf); 4068 + if_type = bf_get(lpfc_sli_intf_if_type, 4069 + &phba->sli4_hba.sli_intf); 4068 4070 if ((phba->hba_flag & HBA_PERSISTENT_TOPO || 4069 - (!phba->sli4_hba.pc_sli4_params.pls && 4070 - (phba->pcidev->device == PCI_DEVICE_ID_LANCER_G6_FC || 4071 - phba->pcidev->device == PCI_DEVICE_ID_LANCER_G7_FC))) && 4071 + (!phba->sli4_hba.pc_sli4_params.pls && 4072 + (sli_family == LPFC_SLI_INTF_FAMILY_G6 || 4073 + if_type == LPFC_SLI_INTF_IF_TYPE_6))) && 4072 4074 val == 4) { 4073 4075 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, 4074 4076 "3114 Loop mode not supported\n");
+4
drivers/scsi/lpfc/lpfc_hw4.h
··· 94 94 #define LPFC_SLI_INTF_FAMILY_BE3 0x1 95 95 #define LPFC_SLI_INTF_FAMILY_LNCR_A0 0xa 96 96 #define LPFC_SLI_INTF_FAMILY_LNCR_B0 0xb 97 + #define LPFC_SLI_INTF_FAMILY_G6 0xc 98 + #define LPFC_SLI_INTF_FAMILY_G7 0xd 99 + #define LPFC_SLI_INTF_FAMILY_G7P 0xe 97 100 #define lpfc_sli_intf_slirev_SHIFT 4 98 101 #define lpfc_sli_intf_slirev_MASK 0x0000000F 99 102 #define lpfc_sli_intf_slirev_WORD word0 ··· 4722 4719 4723 4720 #define MAGIC_NUMBER_G6 0xFEAA0003 4724 4721 #define MAGIC_NUMBER_G7 0xFEAA0005 4722 + #define MAGIC_NUMBER_G7P 0xFEAA0020 4725 4723 4726 4724 struct lpfc_grp_hdr { 4727 4725 uint32_t size;
+20 -14
drivers/scsi/lpfc/lpfc_init.c
··· 8550 8550 } 8551 8551 /* FW supports persistent topology - override module parameter value */ 8552 8552 phba->hba_flag |= HBA_PERSISTENT_TOPO; 8553 - switch (phba->pcidev->device) { 8554 - case PCI_DEVICE_ID_LANCER_G7_FC: 8555 - case PCI_DEVICE_ID_LANCER_G6_FC: 8553 + 8554 + /* if ASIC_GEN_NUM >= 0xC) */ 8555 + if ((bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) == 8556 + LPFC_SLI_INTF_IF_TYPE_6) || 8557 + (bf_get(lpfc_sli_intf_sli_family, &phba->sli4_hba.sli_intf) == 8558 + LPFC_SLI_INTF_FAMILY_G6)) { 8556 8559 if (!tf) { 8557 8560 phba->cfg_topology = ((pt == LINK_FLAGS_LOOP) 8558 8561 ? FLAGS_TOPOLOGY_MODE_LOOP ··· 8563 8560 } else { 8564 8561 phba->hba_flag &= ~HBA_PERSISTENT_TOPO; 8565 8562 } 8566 - break; 8567 - default: /* G5 */ 8563 + } else { /* G5 */ 8568 8564 if (tf) { 8569 8565 /* If topology failover set - pt is '0' or '1' */ 8570 8566 phba->cfg_topology = (pt ? FLAGS_TOPOLOGY_MODE_PT_LOOP : ··· 8573 8571 ? FLAGS_TOPOLOGY_MODE_PT_PT 8574 8572 : FLAGS_TOPOLOGY_MODE_LOOP); 8575 8573 } 8576 - break; 8577 8574 } 8578 8575 if (phba->hba_flag & HBA_PERSISTENT_TOPO) { 8579 8576 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, ··· 12992 12991 const struct firmware *fw) 12993 12992 { 12994 12993 int rc; 12994 + u8 sli_family; 12995 12995 12996 + sli_family = bf_get(lpfc_sli_intf_sli_family, &phba->sli4_hba.sli_intf); 12996 12997 /* Three cases: (1) FW was not supported on the detected adapter. 12997 12998 * (2) FW update has been locked out administratively. 12998 12999 * (3) Some other error during FW update. ··· 13002 12999 * for admin diagnosis. 13003 13000 */ 13004 13001 if (offset == ADD_STATUS_FW_NOT_SUPPORTED || 13005 - (phba->pcidev->device == PCI_DEVICE_ID_LANCER_G6_FC && 13002 + (sli_family == LPFC_SLI_INTF_FAMILY_G6 && 13006 13003 magic_number != MAGIC_NUMBER_G6) || 13007 - (phba->pcidev->device == PCI_DEVICE_ID_LANCER_G7_FC && 13008 - magic_number != MAGIC_NUMBER_G7)) { 13004 + (sli_family == LPFC_SLI_INTF_FAMILY_G7 && 13005 + magic_number != MAGIC_NUMBER_G7) || 13006 + (sli_family == LPFC_SLI_INTF_FAMILY_G7P && 13007 + magic_number != MAGIC_NUMBER_G7P)) { 13009 13008 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, 13010 13009 "3030 This firmware version is not supported on" 13011 13010 " this HBA model. Device:%x Magic:%x Type:%x " ··· 14058 14053 void 14059 14054 lpfc_sli4_ras_init(struct lpfc_hba *phba) 14060 14055 { 14061 - switch (phba->pcidev->device) { 14062 - case PCI_DEVICE_ID_LANCER_G6_FC: 14063 - case PCI_DEVICE_ID_LANCER_G7_FC: 14056 + /* if ASIC_GEN_NUM >= 0xC) */ 14057 + if ((bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) == 14058 + LPFC_SLI_INTF_IF_TYPE_6) || 14059 + (bf_get(lpfc_sli_intf_sli_family, &phba->sli4_hba.sli_intf) == 14060 + LPFC_SLI_INTF_FAMILY_G6)) { 14064 14061 phba->ras_fwlog.ras_hwsupport = true; 14065 14062 if (phba->cfg_ras_fwlog_func == PCI_FUNC(phba->pcidev->devfn) && 14066 14063 phba->cfg_ras_fwlog_buffsize) 14067 14064 phba->ras_fwlog.ras_enabled = true; 14068 14065 else 14069 14066 phba->ras_fwlog.ras_enabled = false; 14070 - break; 14071 - default: 14067 + } else { 14072 14068 phba->ras_fwlog.ras_hwsupport = false; 14073 14069 } 14074 14070 }
+3 -2
drivers/scsi/lpfc/lpfc_mbox.c
··· 513 513 break; 514 514 } 515 515 516 - if ((phba->pcidev->device == PCI_DEVICE_ID_LANCER_G6_FC || 517 - phba->pcidev->device == PCI_DEVICE_ID_LANCER_G7_FC) && 516 + /* Topology handling for ASIC_GEN_NUM 0xC and later */ 517 + if ((phba->sli4_hba.pc_sli4_params.sli_family == LPFC_SLI_INTF_FAMILY_G6 || 518 + phba->sli4_hba.pc_sli4_params.if_type == LPFC_SLI_INTF_IF_TYPE_6) && 518 519 !(phba->sli4_hba.pc_sli4_params.pls) && 519 520 mb->un.varInitLnk.link_flags & FLAGS_TOPOLOGY_MODE_LOOP) { 520 521 mb->un.varInitLnk.link_flags = FLAGS_TOPOLOGY_MODE_PT_PT;
+2 -6
drivers/scsi/lpfc/lpfc_scsi.c
··· 5029 5029 } 5030 5030 5031 5031 /* Check for valid Emulex Device ID */ 5032 - switch (ptr->device) { 5033 - case PCI_DEVICE_ID_LANCER_FC: 5034 - case PCI_DEVICE_ID_LANCER_G6_FC: 5035 - case PCI_DEVICE_ID_LANCER_G7_FC: 5036 - break; 5037 - default: 5032 + if (phba->sli_rev != LPFC_SLI_REV4 || 5033 + phba->hba_flag & HBA_FCOE_MODE) { 5038 5034 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, 5039 5035 "8347 Incapable PCI reset device: " 5040 5036 "0x%04x\n", ptr->device);