diff options
author | Andrew Vasquez <andrew.vasquez@qlogic.com> | 2007-01-29 13:22:25 -0500 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2007-01-31 12:13:07 -0500 |
commit | 178779a6ca7c23b52d5537b972f2b54c830b4480 (patch) | |
tree | 5983c4f4b0f66c8a9edd4a1c7d2e3a06dc7859e1 /drivers/scsi | |
parent | 9bb9fcf2f2b4deeb3ae8a44ed4b8686302297030 (diff) |
[SCSI] qla2xxx: Check loop-state before reading host statistics.
Non-ISP24xx cards must have a loop-id in order to query host
statistics.
Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_attr.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index 78a5867bf515..834c404973b6 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c | |||
@@ -885,21 +885,24 @@ qla2x00_get_fc_host_stats(struct Scsi_Host *shost) | |||
885 | link_stat_t stat_buf; | 885 | link_stat_t stat_buf; |
886 | struct fc_host_statistics *pfc_host_stat; | 886 | struct fc_host_statistics *pfc_host_stat; |
887 | 887 | ||
888 | rval = QLA_FUNCTION_FAILED; | ||
888 | pfc_host_stat = &ha->fc_host_stat; | 889 | pfc_host_stat = &ha->fc_host_stat; |
889 | memset(pfc_host_stat, -1, sizeof(struct fc_host_statistics)); | 890 | memset(pfc_host_stat, -1, sizeof(struct fc_host_statistics)); |
890 | 891 | ||
891 | if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) { | 892 | if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) { |
892 | rval = qla24xx_get_isp_stats(ha, (uint32_t *)&stat_buf, | 893 | rval = qla24xx_get_isp_stats(ha, (uint32_t *)&stat_buf, |
893 | sizeof(stat_buf) / 4, mb_stat); | 894 | sizeof(stat_buf) / 4, mb_stat); |
894 | } else { | 895 | } else if (atomic_read(&ha->loop_state) == LOOP_READY && |
896 | !test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags) && | ||
897 | !test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) && | ||
898 | !ha->dpc_active) { | ||
899 | /* Must be in a 'READY' state for statistics retrieval. */ | ||
895 | rval = qla2x00_get_link_status(ha, ha->loop_id, &stat_buf, | 900 | rval = qla2x00_get_link_status(ha, ha->loop_id, &stat_buf, |
896 | mb_stat); | 901 | mb_stat); |
897 | } | 902 | } |
898 | if (rval != 0) { | 903 | |
899 | qla_printk(KERN_WARNING, ha, | 904 | if (rval != QLA_SUCCESS) |
900 | "Unable to retrieve host statistics (%d).\n", mb_stat[0]); | 905 | goto done; |
901 | return pfc_host_stat; | ||
902 | } | ||
903 | 906 | ||
904 | pfc_host_stat->link_failure_count = stat_buf.link_fail_cnt; | 907 | pfc_host_stat->link_failure_count = stat_buf.link_fail_cnt; |
905 | pfc_host_stat->loss_of_sync_count = stat_buf.loss_sync_cnt; | 908 | pfc_host_stat->loss_of_sync_count = stat_buf.loss_sync_cnt; |
@@ -907,7 +910,7 @@ qla2x00_get_fc_host_stats(struct Scsi_Host *shost) | |||
907 | pfc_host_stat->prim_seq_protocol_err_count = stat_buf.prim_seq_err_cnt; | 910 | pfc_host_stat->prim_seq_protocol_err_count = stat_buf.prim_seq_err_cnt; |
908 | pfc_host_stat->invalid_tx_word_count = stat_buf.inval_xmit_word_cnt; | 911 | pfc_host_stat->invalid_tx_word_count = stat_buf.inval_xmit_word_cnt; |
909 | pfc_host_stat->invalid_crc_count = stat_buf.inval_crc_cnt; | 912 | pfc_host_stat->invalid_crc_count = stat_buf.inval_crc_cnt; |
910 | 913 | done: | |
911 | return pfc_host_stat; | 914 | return pfc_host_stat; |
912 | } | 915 | } |
913 | 916 | ||