Commit 1b6f71f7 authored by James Smart's avatar James Smart Committed by Martin K. Petersen
Browse files

scsi: lpfc: Change FA-PWWN detection methodology

Do not rely on vendor version field of the CSPs to determine if we are in a
FA-PWWN environment. Instead, use the following procedure:

First, during HBA initialization, driver does a READ_CONFIG to determine if
FA-PWWN is configured on the HBA. A LPFC_FAWWPN_CONFIG hba_flag is set
accordingly.

Next, when the link comes up before the driver gets a link up event, the
firmware logs into the fabric with FA-PWWN. If the fabric port does not
support FA-PWWN, the driver will get a Misconfigured FA-WWN async event
before the link up. A LPFC_FAWWPN_FABRIC hba_flag will be set accordingly.

Finally, if the fabric supports FA-PWWN, the firmware will replace its CSPs
WWN with the Fabric Assigned ones. Then after link up, the driver will
retrieve the Fabric Assigned WWN when it does a READ_SPARAM mbox command.

Link: https://lore.kernel.org/r/20220412222008.126521-23-jsmart2021@gmail.com


Co-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 ef47575f
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -739,9 +739,8 @@ struct lpfc_vport {
	struct list_head rcv_buffer_list;
	unsigned long rcv_buffer_time_stamp;
	uint32_t vport_flag;
#define STATIC_VPORT	1
#define FAWWPN_SET	2
#define FAWWPN_PARAM_CHG	4
#define STATIC_VPORT		0x1
#define FAWWPN_PARAM_CHG	0x2

	uint16_t fdmi_num_disc;
	uint32_t fdmi_hba_mask;
+14 −4
Original line number Diff line number Diff line
@@ -1120,14 +1120,24 @@ lpfc_link_state_show(struct device *dev, struct device_attribute *attr,
				len += scnprintf(buf + len, PAGE_SIZE-len,
						"   Private Loop\n");
		} else {
			if (vport->fc_flag & FC_FABRIC)
				len += scnprintf(buf + len, PAGE_SIZE-len,
						"   Fabric\n");
			if (vport->fc_flag & FC_FABRIC) {
				if (phba->sli_rev == LPFC_SLI_REV4 &&
				    vport->port_type == LPFC_PHYSICAL_PORT &&
				    phba->sli4_hba.fawwpn_flag &
					LPFC_FAWWPN_FABRIC)
					len += scnprintf(buf + len,
							 PAGE_SIZE - len,
							 "   Fabric FA-PWWN\n");
				else
					len += scnprintf(buf + len,
							 PAGE_SIZE - len,
							 "   Fabric\n");
			} else {
				len += scnprintf(buf + len, PAGE_SIZE-len,
						"   Point-2-Point\n");
			}
		}
	}

	if ((phba->sli_rev == LPFC_SLI_REV4) &&
	    ((bf_get(lpfc_sli_intf_if_type,
+8 −0
Original line number Diff line number Diff line
@@ -1183,6 +1183,7 @@ lpfc_port_link_failure(struct lpfc_vport *vport)
void
lpfc_linkdown_port(struct lpfc_vport *vport)
{
	struct lpfc_hba *phba = vport->phba;
	struct Scsi_Host  *shost = lpfc_shost_from_vport(vport);

	if (vport->cfg_enable_fc4_type != LPFC_ENABLE_NVME)
@@ -1200,6 +1201,13 @@ lpfc_linkdown_port(struct lpfc_vport *vport)
	vport->fc_flag &= ~FC_DISC_DELAYED;
	spin_unlock_irq(shost->host_lock);
	del_timer_sync(&vport->delayed_disc_tmo);

	if (phba->sli_rev == LPFC_SLI_REV4 &&
	    vport->port_type == LPFC_PHYSICAL_PORT &&
	    phba->sli4_hba.fawwpn_flag & LPFC_FAWWPN_CONFIG) {
		/* Assume success on link up */
		phba->sli4_hba.fawwpn_flag |= LPFC_FAWWPN_FABRIC;
	}
}

int
+0 −2
Original line number Diff line number Diff line
@@ -511,8 +511,6 @@ struct class_parms {
	uint8_t word3Reserved2;	/* Fc Word 3, bit  0: 7 */
};

#define FAPWWN_KEY_VENDOR	0x42524344 /*valid vendor version fawwpn key*/

struct serv_parm {	/* Structure is in Big Endian format */
	struct csp cmn;
	struct lpfc_name portName;
+3 −0
Original line number Diff line number Diff line
@@ -2893,6 +2893,9 @@ struct lpfc_mbx_read_config {
#define lpfc_mbx_rd_conf_extnts_inuse_SHIFT	31
#define lpfc_mbx_rd_conf_extnts_inuse_MASK	0x00000001
#define lpfc_mbx_rd_conf_extnts_inuse_WORD	word1
#define lpfc_mbx_rd_conf_fawwpn_SHIFT		30
#define lpfc_mbx_rd_conf_fawwpn_MASK		0x00000001
#define lpfc_mbx_rd_conf_fawwpn_WORD		word1
#define lpfc_mbx_rd_conf_wcs_SHIFT		28	/* warning signaling */
#define lpfc_mbx_rd_conf_wcs_MASK		0x00000001
#define lpfc_mbx_rd_conf_wcs_WORD		word1
Loading