qla2xxx: Restore WWPN in case of Loop Dead.
authorHimanshu Madhani <himanshu.madhani@qlogic.com>
Thu, 25 Sep 2014 09:17:00 +0000 (05:17 -0400)
committerChristoph Hellwig <hch@lst.de>
Thu, 25 Sep 2014 12:25:05 +0000 (14:25 +0200)
For FA-WWPN capable device, ISP2031 and ISP27XX, when loop
dead is detected by a driver, restore WWPN from NVRAM.

Signed-off-by: Himanshu Madhani <himanshu.madhani@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_def.h
drivers/scsi/qla2xxx/qla_init.c
drivers/scsi/qla2xxx/qla_isr.c

index b21adb3d5e6708383f43888165f0d0645c9eacab..5f25cf0db56884514776716d0d97eaf2e24e697e 100644 (file)
@@ -11,8 +11,7 @@
  * ----------------------------------------------------------------------
  * |             Level            |   Last Value Used  |     Holes     |
  * ----------------------------------------------------------------------
- * | Module Init and Probe        |       0x017d       | 0x0141                |
- * |                              |                    | 0x0144,0x0146 |
+ * | Module Init and Probe        |       0x017d       | 0x0144,0x0146 |
  * |                              |                    | 0x015b-0x0160 |
  * |                              |                    | 0x016e-0x0170 |
  * | Mailbox commands             |       0x118d       | 0x1115-0x1116 |
index d529510bbc6cc4b6612dbb514ad5adc6207aaee5..a3bab3a3efdd553417d705e68674bce5f3830f3b 100644 (file)
@@ -2945,7 +2945,8 @@ struct qla_hw_data {
 
                uint32_t        mr_reset_hdlr_active:1;
                uint32_t        mr_intr_valid:1;
-               /* 34 bits */
+               uint32_t        fawwpn_enabled:1;
+               /* 35 bits */
        } flags;
 
        /* This spinlock is used to protect "io transactions", you must
index 51cabb953552b312cb6b4f2742706fe31ed700f9..23f12dddcb4a859dc4e917b63ae963265f557fb0 100644 (file)
@@ -2202,6 +2202,11 @@ qla2x00_init_rings(scsi_qla_host_t *vha)
                if (IS_DPORT_CAPABLE(ha))
                        mid_init_cb->init_cb.firmware_options_1 |=
                            cpu_to_le16(BIT_7);
+               /* Enable FA-WWPN */
+               ha->flags.fawwpn_enabled =
+                   (mid_init_cb->init_cb.firmware_options_1 & BIT_6) ? 1 : 0;
+               ql_dbg(ql_dbg_init, vha, 0x0141, "FA-WWPN Support: %s.\n",
+                   (ha->flags.fawwpn_enabled) ? "enabled" : "disabled");
        }
 
        rval = qla2x00_init_firmware(vha, ha->init_cb_size);
index f15f87e1abd837f8186aa95a2e03fcd4269bbf81..696e4a2d3fa74f602aee0f683b4496c41bc331ab 100644 (file)
@@ -752,6 +752,16 @@ skip_rio:
                if (atomic_read(&vha->loop_state) != LOOP_DOWN) {
                        atomic_set(&vha->loop_state, LOOP_DOWN);
                        atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME);
+                       /*
+                        * In case of loop down, restore WWPN from
+                        * NVRAM in case of FA-WWPN capable ISP
+                        */
+                       if (ha->flags.fawwpn_enabled) {
+                               void *wwpn = ha->init_cb->port_name;
+
+                               memcpy(vha->port_name, wwpn, WWN_SIZE);
+                       }
+
                        vha->device_flags |= DFLG_NO_CABLE;
                        qla2x00_mark_all_devices_lost(vha, 1);
                }