Commit f6c5e6c4 authored by James Smart's avatar James Smart Committed by Martin K. Petersen

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.comCo-developed-by: default avatarJustin Tee <justin.tee@broadcom.com>
Signed-off-by: default avatarJustin Tee <justin.tee@broadcom.com>
Signed-off-by: default avatarJames Smart <jsmart2021@gmail.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent df3d78c3
...@@ -4038,6 +4038,7 @@ lpfc_topology_store(struct device *dev, struct device_attribute *attr, ...@@ -4038,6 +4038,7 @@ lpfc_topology_store(struct device *dev, struct device_attribute *attr,
const char *val_buf = buf; const char *val_buf = buf;
int err; int err;
uint32_t prev_val; uint32_t prev_val;
u8 sli_family, if_type;
if (!strncmp(buf, "nolip ", strlen("nolip "))) { if (!strncmp(buf, "nolip ", strlen("nolip "))) {
nolip = 1; nolip = 1;
...@@ -4061,13 +4062,16 @@ lpfc_topology_store(struct device *dev, struct device_attribute *attr, ...@@ -4061,13 +4062,16 @@ lpfc_topology_store(struct device *dev, struct device_attribute *attr,
/* /*
* The 'topology' is not a configurable parameter if : * The 'topology' is not a configurable parameter if :
* - persistent topology enabled * - persistent topology enabled
* - G7/G6 with no private loop support * - ASIC_GEN_NUM >= 0xC, with no private loop support
*/ */
sli_family = bf_get(lpfc_sli_intf_sli_family,
&phba->sli4_hba.sli_intf);
if_type = bf_get(lpfc_sli_intf_if_type,
&phba->sli4_hba.sli_intf);
if ((phba->hba_flag & HBA_PERSISTENT_TOPO || if ((phba->hba_flag & HBA_PERSISTENT_TOPO ||
(!phba->sli4_hba.pc_sli4_params.pls && (!phba->sli4_hba.pc_sli4_params.pls &&
(phba->pcidev->device == PCI_DEVICE_ID_LANCER_G6_FC || (sli_family == LPFC_SLI_INTF_FAMILY_G6 ||
phba->pcidev->device == PCI_DEVICE_ID_LANCER_G7_FC))) && if_type == LPFC_SLI_INTF_IF_TYPE_6))) &&
val == 4) { val == 4) {
lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
"3114 Loop mode not supported\n"); "3114 Loop mode not supported\n");
......
...@@ -94,6 +94,9 @@ struct lpfc_sli_intf { ...@@ -94,6 +94,9 @@ struct lpfc_sli_intf {
#define LPFC_SLI_INTF_FAMILY_BE3 0x1 #define LPFC_SLI_INTF_FAMILY_BE3 0x1
#define LPFC_SLI_INTF_FAMILY_LNCR_A0 0xa #define LPFC_SLI_INTF_FAMILY_LNCR_A0 0xa
#define LPFC_SLI_INTF_FAMILY_LNCR_B0 0xb #define LPFC_SLI_INTF_FAMILY_LNCR_B0 0xb
#define LPFC_SLI_INTF_FAMILY_G6 0xc
#define LPFC_SLI_INTF_FAMILY_G7 0xd
#define LPFC_SLI_INTF_FAMILY_G7P 0xe
#define lpfc_sli_intf_slirev_SHIFT 4 #define lpfc_sli_intf_slirev_SHIFT 4
#define lpfc_sli_intf_slirev_MASK 0x0000000F #define lpfc_sli_intf_slirev_MASK 0x0000000F
#define lpfc_sli_intf_slirev_WORD word0 #define lpfc_sli_intf_slirev_WORD word0
...@@ -4719,6 +4722,7 @@ union lpfc_wqe128 { ...@@ -4719,6 +4722,7 @@ union lpfc_wqe128 {
#define MAGIC_NUMBER_G6 0xFEAA0003 #define MAGIC_NUMBER_G6 0xFEAA0003
#define MAGIC_NUMBER_G7 0xFEAA0005 #define MAGIC_NUMBER_G7 0xFEAA0005
#define MAGIC_NUMBER_G7P 0xFEAA0020
struct lpfc_grp_hdr { struct lpfc_grp_hdr {
uint32_t size; uint32_t size;
......
...@@ -8550,9 +8550,12 @@ lpfc_map_topology(struct lpfc_hba *phba, struct lpfc_mbx_read_config *rd_config) ...@@ -8550,9 +8550,12 @@ lpfc_map_topology(struct lpfc_hba *phba, struct lpfc_mbx_read_config *rd_config)
} }
/* FW supports persistent topology - override module parameter value */ /* FW supports persistent topology - override module parameter value */
phba->hba_flag |= HBA_PERSISTENT_TOPO; phba->hba_flag |= HBA_PERSISTENT_TOPO;
switch (phba->pcidev->device) {
case PCI_DEVICE_ID_LANCER_G7_FC: /* if ASIC_GEN_NUM >= 0xC) */
case PCI_DEVICE_ID_LANCER_G6_FC: if ((bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) ==
LPFC_SLI_INTF_IF_TYPE_6) ||
(bf_get(lpfc_sli_intf_sli_family, &phba->sli4_hba.sli_intf) ==
LPFC_SLI_INTF_FAMILY_G6)) {
if (!tf) { if (!tf) {
phba->cfg_topology = ((pt == LINK_FLAGS_LOOP) phba->cfg_topology = ((pt == LINK_FLAGS_LOOP)
? FLAGS_TOPOLOGY_MODE_LOOP ? FLAGS_TOPOLOGY_MODE_LOOP
...@@ -8560,8 +8563,7 @@ lpfc_map_topology(struct lpfc_hba *phba, struct lpfc_mbx_read_config *rd_config) ...@@ -8560,8 +8563,7 @@ lpfc_map_topology(struct lpfc_hba *phba, struct lpfc_mbx_read_config *rd_config)
} else { } else {
phba->hba_flag &= ~HBA_PERSISTENT_TOPO; phba->hba_flag &= ~HBA_PERSISTENT_TOPO;
} }
break; } else { /* G5 */
default: /* G5 */
if (tf) { if (tf) {
/* If topology failover set - pt is '0' or '1' */ /* If topology failover set - pt is '0' or '1' */
phba->cfg_topology = (pt ? FLAGS_TOPOLOGY_MODE_PT_LOOP : phba->cfg_topology = (pt ? FLAGS_TOPOLOGY_MODE_PT_LOOP :
...@@ -8571,7 +8573,6 @@ lpfc_map_topology(struct lpfc_hba *phba, struct lpfc_mbx_read_config *rd_config) ...@@ -8571,7 +8573,6 @@ lpfc_map_topology(struct lpfc_hba *phba, struct lpfc_mbx_read_config *rd_config)
? FLAGS_TOPOLOGY_MODE_PT_PT ? FLAGS_TOPOLOGY_MODE_PT_PT
: FLAGS_TOPOLOGY_MODE_LOOP); : FLAGS_TOPOLOGY_MODE_LOOP);
} }
break;
} }
if (phba->hba_flag & HBA_PERSISTENT_TOPO) { if (phba->hba_flag & HBA_PERSISTENT_TOPO) {
lpfc_printf_log(phba, KERN_INFO, LOG_SLI, lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
...@@ -12991,7 +12992,9 @@ lpfc_log_write_firmware_error(struct lpfc_hba *phba, uint32_t offset, ...@@ -12991,7 +12992,9 @@ lpfc_log_write_firmware_error(struct lpfc_hba *phba, uint32_t offset,
const struct firmware *fw) const struct firmware *fw)
{ {
int rc; int rc;
u8 sli_family;
sli_family = bf_get(lpfc_sli_intf_sli_family, &phba->sli4_hba.sli_intf);
/* Three cases: (1) FW was not supported on the detected adapter. /* Three cases: (1) FW was not supported on the detected adapter.
* (2) FW update has been locked out administratively. * (2) FW update has been locked out administratively.
* (3) Some other error during FW update. * (3) Some other error during FW update.
...@@ -12999,10 +13002,12 @@ lpfc_log_write_firmware_error(struct lpfc_hba *phba, uint32_t offset, ...@@ -12999,10 +13002,12 @@ lpfc_log_write_firmware_error(struct lpfc_hba *phba, uint32_t offset,
* for admin diagnosis. * for admin diagnosis.
*/ */
if (offset == ADD_STATUS_FW_NOT_SUPPORTED || if (offset == ADD_STATUS_FW_NOT_SUPPORTED ||
(phba->pcidev->device == PCI_DEVICE_ID_LANCER_G6_FC && (sli_family == LPFC_SLI_INTF_FAMILY_G6 &&
magic_number != MAGIC_NUMBER_G6) || magic_number != MAGIC_NUMBER_G6) ||
(phba->pcidev->device == PCI_DEVICE_ID_LANCER_G7_FC && (sli_family == LPFC_SLI_INTF_FAMILY_G7 &&
magic_number != MAGIC_NUMBER_G7)) { magic_number != MAGIC_NUMBER_G7) ||
(sli_family == LPFC_SLI_INTF_FAMILY_G7P &&
magic_number != MAGIC_NUMBER_G7P)) {
lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
"3030 This firmware version is not supported on" "3030 This firmware version is not supported on"
" this HBA model. Device:%x Magic:%x Type:%x " " this HBA model. Device:%x Magic:%x Type:%x "
...@@ -14053,17 +14058,18 @@ lpfc_sli4_oas_verify(struct lpfc_hba *phba) ...@@ -14053,17 +14058,18 @@ lpfc_sli4_oas_verify(struct lpfc_hba *phba)
void void
lpfc_sli4_ras_init(struct lpfc_hba *phba) lpfc_sli4_ras_init(struct lpfc_hba *phba)
{ {
switch (phba->pcidev->device) { /* if ASIC_GEN_NUM >= 0xC) */
case PCI_DEVICE_ID_LANCER_G6_FC: if ((bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) ==
case PCI_DEVICE_ID_LANCER_G7_FC: LPFC_SLI_INTF_IF_TYPE_6) ||
(bf_get(lpfc_sli_intf_sli_family, &phba->sli4_hba.sli_intf) ==
LPFC_SLI_INTF_FAMILY_G6)) {
phba->ras_fwlog.ras_hwsupport = true; phba->ras_fwlog.ras_hwsupport = true;
if (phba->cfg_ras_fwlog_func == PCI_FUNC(phba->pcidev->devfn) && if (phba->cfg_ras_fwlog_func == PCI_FUNC(phba->pcidev->devfn) &&
phba->cfg_ras_fwlog_buffsize) phba->cfg_ras_fwlog_buffsize)
phba->ras_fwlog.ras_enabled = true; phba->ras_fwlog.ras_enabled = true;
else else
phba->ras_fwlog.ras_enabled = false; phba->ras_fwlog.ras_enabled = false;
break; } else {
default:
phba->ras_fwlog.ras_hwsupport = false; phba->ras_fwlog.ras_hwsupport = false;
} }
} }
......
...@@ -513,8 +513,9 @@ lpfc_init_link(struct lpfc_hba * phba, ...@@ -513,8 +513,9 @@ lpfc_init_link(struct lpfc_hba * phba,
break; break;
} }
if ((phba->pcidev->device == PCI_DEVICE_ID_LANCER_G6_FC || /* Topology handling for ASIC_GEN_NUM 0xC and later */
phba->pcidev->device == PCI_DEVICE_ID_LANCER_G7_FC) && if ((phba->sli4_hba.pc_sli4_params.sli_family == LPFC_SLI_INTF_FAMILY_G6 ||
phba->sli4_hba.pc_sli4_params.if_type == LPFC_SLI_INTF_IF_TYPE_6) &&
!(phba->sli4_hba.pc_sli4_params.pls) && !(phba->sli4_hba.pc_sli4_params.pls) &&
mb->un.varInitLnk.link_flags & FLAGS_TOPOLOGY_MODE_LOOP) { mb->un.varInitLnk.link_flags & FLAGS_TOPOLOGY_MODE_LOOP) {
mb->un.varInitLnk.link_flags = FLAGS_TOPOLOGY_MODE_PT_PT; mb->un.varInitLnk.link_flags = FLAGS_TOPOLOGY_MODE_PT_PT;
......
...@@ -5029,12 +5029,8 @@ lpfc_check_pci_resettable(struct lpfc_hba *phba) ...@@ -5029,12 +5029,8 @@ lpfc_check_pci_resettable(struct lpfc_hba *phba)
} }
/* Check for valid Emulex Device ID */ /* Check for valid Emulex Device ID */
switch (ptr->device) { if (phba->sli_rev != LPFC_SLI_REV4 ||
case PCI_DEVICE_ID_LANCER_FC: phba->hba_flag & HBA_FCOE_MODE) {
case PCI_DEVICE_ID_LANCER_G6_FC:
case PCI_DEVICE_ID_LANCER_G7_FC:
break;
default:
lpfc_printf_log(phba, KERN_INFO, LOG_INIT, lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
"8347 Incapable PCI reset device: " "8347 Incapable PCI reset device: "
"0x%04x\n", ptr->device); "0x%04x\n", ptr->device);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment