Skip to content

Commit

Permalink
[SCSI] qla2xxx: Correct fc_host port_state display.
Browse files Browse the repository at this point in the history
[jejb: checkpatch fixes]
Add more fine grain parsing of vha->loop_state to export a more accurate
fc_host port_state.

Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Chad Dupuis <chad.dupuis@qlogic.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
  • Loading branch information
Saurav Kashyap authored and James Bottomley committed Dec 12, 2011
1 parent 6315491 commit 49e85c2
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions drivers/scsi/qla2xxx/qla_attr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1762,12 +1762,31 @@ qla2x00_get_host_port_state(struct Scsi_Host *shost)
scsi_qla_host_t *vha = shost_priv(shost);
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;
else if (atomic_read(&base_vha->loop_state) == LOOP_TIMEOUT)
fc_host_port_state(shost) = FC_PORTSTATE_UNKNOWN;
else
return;
}

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
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;
break;
default:
fc_host_port_state(shost) = FC_PORTSTATE_UNKNOWN;
break;
}
}

static int
Expand Down

0 comments on commit 49e85c2

Please sign in to comment.