Commit 7c9c4766 authored by Joe Carnuccio's avatar Joe Carnuccio Committed by Christoph Hellwig
Browse files

qla2xxx: Add FA-WWN functionality.



Add support for the FA-WWN (fabric assigned wwn) fabric switch feature.

(Fabric Assigned World Wide Port Name)

Signed-off-by: default avatarJoe Carnuccio <joe.carnuccio@qlogic.com>
Signed-off-by: default avatarSaurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent df57caba
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -15,11 +15,8 @@
 * |                              |                    | 0x0144,0x0146	|
 * |                              |                    | 0x015b-0x0160	|
 * |                              |                    | 0x016e-0x0170	|
 * | Mailbox commands             |       0x118d       | 0x1018-0x1019	|
 * |                              |                    | 0x10ca         |
 * |                              |                    | 0x1115-0x1116  |
 * | Mailbox commands             |       0x118d       | 0x1115-0x1116	|
 * |                              |                    | 0x111a-0x111b  |
 * |                              |                    | 0x1155-0x1158  |
 * | Device Discovery             |       0x2016       | 0x2020-0x2022, |
 * |                              |                    | 0x2011-0x2012, |
 * |                              |                    | 0x2099-0x20a4  |
+1 −1
Original line number Diff line number Diff line
@@ -317,7 +317,7 @@ struct init_cb_24xx {
	 * BIT 3  = Reserved
	 * BIT 4  = Enable Target Mode
	 * BIT 5  = Disable Initiator Mode
	 * BIT 6  = Reserved
	 * BIT 6  = Acquire FA-WWN
	 * BIT 7  = Reserved
	 *
	 * BIT 8  = Reserved
+35 −1
Original line number Diff line number Diff line
@@ -1085,6 +1085,8 @@ qla2x00_get_adapter_id(scsi_qla_host_t *vha, uint16_t *id, uint8_t *al_pa,
	mcp->in_mb = MBX_9|MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0;
	if (IS_CNA_CAPABLE(vha->hw))
		mcp->in_mb |= MBX_13|MBX_12|MBX_11|MBX_10;
	if (IS_FWI2_CAPABLE(vha->hw))
		mcp->in_mb |= MBX_19|MBX_18|MBX_17|MBX_16;
	mcp->tov = MBX_TOV_SECONDS;
	mcp->flags = 0;
	rval = qla2x00_mailbox_command(vha, mcp);
@@ -1118,6 +1120,22 @@ qla2x00_get_adapter_id(scsi_qla_host_t *vha, uint16_t *id, uint8_t *al_pa,
			vha->fcoe_vn_port_mac[1] = mcp->mb[13] >> 8;
			vha->fcoe_vn_port_mac[0] = mcp->mb[13] & 0xff;
		}
		/* If FA-WWN supported */
		if (mcp->mb[7] & BIT_14) {
			vha->port_name[0] = MSB(mcp->mb[16]);
			vha->port_name[1] = LSB(mcp->mb[16]);
			vha->port_name[2] = MSB(mcp->mb[17]);
			vha->port_name[3] = LSB(mcp->mb[17]);
			vha->port_name[4] = MSB(mcp->mb[18]);
			vha->port_name[5] = LSB(mcp->mb[18]);
			vha->port_name[6] = MSB(mcp->mb[19]);
			vha->port_name[7] = LSB(mcp->mb[19]);
			fc_host_port_name(vha->host) =
			    wwn_to_u64(vha->port_name);
			ql_dbg(ql_dbg_mbx, vha, 0x10ca,
			    "FA-WWN acquired %016llx\n",
			    wwn_to_u64(vha->port_name));
		}
	}

	return rval;
@@ -3328,8 +3346,24 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha,
		    rptid_entry->port_id[2], rptid_entry->port_id[1],
		    rptid_entry->port_id[0]);

		/* FA-WWN is only for physical port */
		if (!vp_idx) {
			void *wwpn = ha->init_cb->port_name;

			if (!MSB(stat)) {
				if (rptid_entry->vp_idx_map[1] & BIT_6)
					wwpn = rptid_entry->reserved_4 + 8;
			}
			memcpy(vha->port_name, wwpn, WWN_SIZE);
			fc_host_port_name(vha->host) =
			    wwn_to_u64(vha->port_name);
			ql_dbg(ql_dbg_mbx, vha, 0x1018,
			    "FA-WWN portname %016llx (%x)\n",
			    fc_host_port_name(vha->host), MSB(stat));
		}

		vp = vha;
		if (vp_idx == 0 && (MSB(stat) != 1))
		if (vp_idx == 0)
			goto reg_needed;

		if (MSB(stat) != 0 && MSB(stat) != 2) {