qla2xxx: Handle AEN8014 incoming port logout.
authorJoe Carnuccio <joe.carnuccio@qlogic.com>
Tue, 4 Aug 2015 17:37:52 +0000 (13:37 -0400)
committerJames Bottomley <JBottomley@Odin.com>
Thu, 27 Aug 2015 00:39:16 +0000 (17:39 -0700)
When we get logged out, mark the port lost and set dpc flag for relogin.

Signed-off-by: Joe Carnuccio <joe.carnuccio@qlogic.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
drivers/scsi/qla2xxx/qla_dbg.c
drivers/scsi/qla2xxx/qla_isr.c

index 583d52aae79d2e0905a9b998c23a85cb2276b25c..05d8cf0165433058020684eed64aeb310b105f9a 100644 (file)
@@ -26,7 +26,7 @@
  * |                              |                    | 0x3036,0x3038  |
  * |                              |                    | 0x303a                |
  * | DPC Thread                   |       0x4023       | 0x4002,0x4013  |
- * | Async Events                 |       0x5087       | 0x502b-0x502f  |
+ * | Async Events                 |       0x508a       | 0x502b-0x502f  |
  * |                              |                    | 0x5047                |
  * |                              |                    | 0x5084,0x5075 |
  * |                              |                    | 0x503d,0x5044  |
index 2cb0fba38c9e85e606bb197186f7e3d2552c5862..b2b93dfbffd36fc8d089439b488a2c28daff68ab 100644 (file)
@@ -560,6 +560,17 @@ qla2x00_is_a_vp_did(scsi_qla_host_t *vha, uint32_t rscn_entry)
        return ret;
 }
 
+static inline fc_port_t *
+qla2x00_find_fcport_by_loopid(scsi_qla_host_t *vha, uint16_t loop_id)
+{
+       fc_port_t *fcport;
+
+       list_for_each_entry(fcport, &vha->vp_fcports, list)
+               if (fcport->loop_id == loop_id)
+                       return fcport;
+       return NULL;
+}
+
 /**
  * qla2x00_async_event() - Process aynchronous events.
  * @ha: SCSI driver HA context
@@ -897,11 +908,29 @@ skip_rio:
                        (mb[1] != 0xffff)) && vha->vp_idx != (mb[3] & 0xff))
                        break;
 
-               /* Global event -- port logout or port unavailable. */
-               if (mb[1] == 0xffff && mb[2] == 0x7) {
+               if (mb[2] == 0x7) {
                        ql_dbg(ql_dbg_async, vha, 0x5010,
-                           "Port unavailable %04x %04x %04x.\n",
+                           "Port %s %04x %04x %04x.\n",
+                           mb[1] == 0xffff ? "unavailable" : "logout",
                            mb[1], mb[2], mb[3]);
+
+                       if (mb[1] == 0xffff)
+                               goto global_port_update;
+
+                       /* Port logout */
+                       fcport = qla2x00_find_fcport_by_loopid(vha, mb[1]);
+                       if (!fcport)
+                               break;
+                       if (atomic_read(&fcport->state) != FCS_ONLINE)
+                               break;
+                       ql_dbg(ql_dbg_async, vha, 0x508a,
+                           "Marking port lost loopid=%04x portid=%06x.\n",
+                           fcport->loop_id, fcport->d_id.b24);
+                       qla2x00_mark_device_lost(fcport->vha, fcport, 1, 1);
+                       break;
+
+global_port_update:
+                       /* Port unavailable. */
                        ql_log(ql_log_warn, vha, 0x505e,
                            "Link is offline.\n");