Commit 49e85c23 authored by Saurav Kashyap's avatar Saurav Kashyap Committed by James Bottomley

[SCSI] qla2xxx: Correct fc_host port_state display.

[jejb: checkpatch fixes]
Add more fine grain parsing of vha->loop_state to export a more accurate
fc_host port_state.
Signed-off-by: default avatarSaurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: default avatarChad Dupuis <chad.dupuis@qlogic.com>
Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
parent 63154916
...@@ -1762,12 +1762,31 @@ qla2x00_get_host_port_state(struct Scsi_Host *shost) ...@@ -1762,12 +1762,31 @@ qla2x00_get_host_port_state(struct Scsi_Host *shost)
scsi_qla_host_t *vha = shost_priv(shost); scsi_qla_host_t *vha = shost_priv(shost);
struct scsi_qla_host *base_vha = pci_get_drvdata(vha->hw->pdev); struct scsi_qla_host *base_vha = pci_get_drvdata(vha->hw->pdev);
if (!base_vha->flags.online) if (!base_vha->flags.online) {
fc_host_port_state(shost) = FC_PORTSTATE_OFFLINE; fc_host_port_state(shost) = FC_PORTSTATE_OFFLINE;
else if (atomic_read(&base_vha->loop_state) == LOOP_TIMEOUT) return;
fc_host_port_state(shost) = FC_PORTSTATE_UNKNOWN; }
switch (atomic_read(&base_vha->loop_state)) {
case LOOP_UPDATE:
fc_host_port_state(shost) = FC_PORTSTATE_DIAGNOSTICS;
break;
case LOOP_DOWN:
if (test_bit(LOOP_RESYNC_NEEDED, &base_vha->dpc_flags))
fc_host_port_state(shost) = FC_PORTSTATE_DIAGNOSTICS;
else else
fc_host_port_state(shost) = FC_PORTSTATE_LINKDOWN;
break;
case LOOP_DEAD:
fc_host_port_state(shost) = FC_PORTSTATE_LINKDOWN;
break;
case LOOP_READY:
fc_host_port_state(shost) = FC_PORTSTATE_ONLINE; fc_host_port_state(shost) = FC_PORTSTATE_ONLINE;
break;
default:
fc_host_port_state(shost) = FC_PORTSTATE_UNKNOWN;
break;
}
} }
static int static int
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment