aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/qla2xxx/qla_attr.c17
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 913done:
911 return pfc_host_stat; 914 return pfc_host_stat;
912} 915}
913 916