[SCSI] qla2xxx: Correctly handle 'global port-unavailable' AEN.
[deliverable/linux.git] / drivers / scsi / qla2xxx / qla_isr.c
index 245e7afb4c4dcf897c54029f8a3940408a2a4fbe..417a9b9fb19c5da27a6751da86509c11b6392e54 100644 (file)
@@ -599,8 +599,36 @@ skip_rio:
 
        case MBA_PORT_UPDATE:           /* Port database update */
                /* Only handle SCNs for our Vport index. */
-               if (vha->vp_idx && vha->vp_idx != (mb[3] & 0xff))
+               if (mb[1] != 0xffff &&
+                   vha->vp_idx && vha->vp_idx != (mb[3] & 0xff))
+                       break;
+
+               /* Global event -- port logout or port unavailable. */
+               if (mb[1] == 0xffff && mb[2] == 0x7) {
+                       DEBUG2(printk("scsi(%ld): Asynchronous PORT UPDATE.\n",
+                           vha->host_no));
+                       DEBUG(printk(KERN_INFO
+                           "scsi(%ld): Port unavailable %04x %04x %04x.\n",
+                           vha->host_no, mb[1], mb[2], mb[3]));
+
+                       if (atomic_read(&vha->loop_state) != LOOP_DOWN) {
+                               atomic_set(&vha->loop_state, LOOP_DOWN);
+                               atomic_set(&vha->loop_down_timer,
+                                   LOOP_DOWN_TIME);
+                               vha->device_flags |= DFLG_NO_CABLE;
+                               qla2x00_mark_all_devices_lost(vha, 1);
+                       }
+
+                       if (vha->vp_idx) {
+                               atomic_set(&vha->vp_state, VP_FAILED);
+                               fc_vport_set_state(vha->fc_vport,
+                                   FC_VPORT_FAILED);
+                       }
+
+                       vha->flags.management_server_logged_in = 0;
+                       ha->link_data_rate = PORT_SPEED_UNKNOWN;
                        break;
+               }
 
                /*
                 * If PORT UPDATE is global (received LIP_OCCURRED/LIP_RESET
@@ -1223,6 +1251,7 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt)
                                        cp->device->id, cp->device->lun, resid,
                                        scsi_bufflen(cp)));
 
+                               scsi_set_resid(cp, resid);
                                cp->result = DID_ERROR << 16;
                                break;
                        }
This page took 0.025418 seconds and 5 git commands to generate.