qla2xxx: Add FA-WWN functionality.
authorJoe Carnuccio <joe.carnuccio@qlogic.com>
Thu, 25 Sep 2014 09:16:47 +0000 (05:16 -0400)
committerChristoph Hellwig <hch@lst.de>
Thu, 25 Sep 2014 12:25:03 +0000 (14:25 +0200)
Add support for the FA-WWN (fabric assigned wwn) fabric switch feature.

(Fabric Assigned World Wide Port Name)

Signed-off-by: Joe Carnuccio <joe.carnuccio@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/scsi/qla2xxx/qla_dbg.c
drivers/scsi/qla2xxx/qla_fw.h
drivers/scsi/qla2xxx/qla_mbx.c

index 28442d082ba10603a2190f67d53a5510eb02fbce..b33eec01d6dc92f3f1e9bee17c3773d37ebc75c4 100644 (file)
  * |                              |                    | 0x0144,0x0146 |
  * |                              |                    | 0x015b-0x0160 |
  * |                              |                    | 0x016e-0x0170 |
- * | Mailbox commands             |       0x118d       | 0x1018-0x1019 |
- * |                              |                    | 0x10ca         |
- * |                              |                    | 0x1115-0x1116  |
- * |                              |                    | 0x111a-0x111b |
- * |                              |                    | 0x1155-0x1158  |
+ * | Mailbox commands             |       0x118d       | 0x1115-0x1116 |
+ * |                              |                    | 0x111a-0x111b  |
  * | Device Discovery             |       0x2016       | 0x2020-0x2022, |
  * |                              |                    | 0x2011-0x2012, |
  * |                              |                    | 0x2099-0x20a4  |
index c7d1c4569fa1a0d00ad0b514af44e858561fc4fe..e8669aa7e0024c5ed92a53722dba14a8ea4fbf34 100644 (file)
@@ -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
index ca7f4f012511d029fcea74d50d975bfe89d4b35a..2de901bf87aba32b15e9af495570e0ef2952fd41 100644 (file)
@@ -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) {