aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx/qla_attr.c
diff options
context:
space:
mode:
authorAndrew Vasquez <andrew.vasquez@qlogic.com>2008-01-17 12:02:08 -0500
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-01-23 12:29:29 -0500
commit43ef058010c79a967195539bbcdeee8c5b24219d (patch)
treeb0d13f3b2a79777a306d9c84adbfec3499c97af0 /drivers/scsi/qla2xxx/qla_attr.c
parent4733fcb1fe4d64402a8bd18cec766e8b8ad25eee (diff)
[SCSI] qla2xxx: Retrieve additional HBA port statistics from recent ISPs.
HBAs supporting these additional counters include ISP24xx and ISP25xx type boards. Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_attr.c')
-rw-r--r--drivers/scsi/qla2xxx/qla_attr.c44
1 files changed, 30 insertions, 14 deletions
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index 745283fcbf2c..e3bda8f7668c 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -967,35 +967,51 @@ qla2x00_get_fc_host_stats(struct Scsi_Host *shost)
967{ 967{
968 scsi_qla_host_t *ha = shost_priv(shost); 968 scsi_qla_host_t *ha = shost_priv(shost);
969 int rval; 969 int rval;
970 uint16_t mb_stat[1]; 970 struct link_statistics *stats;
971 link_stat_t stat_buf; 971 dma_addr_t stats_dma;
972 struct fc_host_statistics *pfc_host_stat; 972 struct fc_host_statistics *pfc_host_stat;
973 973
974 rval = QLA_FUNCTION_FAILED;
975 pfc_host_stat = &ha->fc_host_stat; 974 pfc_host_stat = &ha->fc_host_stat;
976 memset(pfc_host_stat, -1, sizeof(struct fc_host_statistics)); 975 memset(pfc_host_stat, -1, sizeof(struct fc_host_statistics));
977 976
977 stats = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &stats_dma);
978 if (stats == NULL) {
979 DEBUG2_3_11(printk("%s(%ld): Failed to allocate memory.\n",
980 __func__, ha->host_no));
981 goto done;
982 }
983 memset(stats, 0, DMA_POOL_SIZE);
984
985 rval = QLA_FUNCTION_FAILED;
978 if (IS_FWI2_CAPABLE(ha)) { 986 if (IS_FWI2_CAPABLE(ha)) {
979 rval = qla24xx_get_isp_stats(ha, (uint32_t *)&stat_buf, 987 rval = qla24xx_get_isp_stats(ha, stats, stats_dma);
980 sizeof(stat_buf) / 4, mb_stat);
981 } else if (atomic_read(&ha->loop_state) == LOOP_READY && 988 } else if (atomic_read(&ha->loop_state) == LOOP_READY &&
982 !test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags) && 989 !test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags) &&
983 !test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) && 990 !test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) &&
984 !ha->dpc_active) { 991 !ha->dpc_active) {
985 /* Must be in a 'READY' state for statistics retrieval. */ 992 /* Must be in a 'READY' state for statistics retrieval. */
986 rval = qla2x00_get_link_status(ha, ha->loop_id, &stat_buf, 993 rval = qla2x00_get_link_status(ha, ha->loop_id, stats,
987 mb_stat); 994 stats_dma);
988 } 995 }
989 996
990 if (rval != QLA_SUCCESS) 997 if (rval != QLA_SUCCESS)
991 goto done; 998 goto done_free;
999
1000 pfc_host_stat->link_failure_count = stats->link_fail_cnt;
1001 pfc_host_stat->loss_of_sync_count = stats->loss_sync_cnt;
1002 pfc_host_stat->loss_of_signal_count = stats->loss_sig_cnt;
1003 pfc_host_stat->prim_seq_protocol_err_count = stats->prim_seq_err_cnt;
1004 pfc_host_stat->invalid_tx_word_count = stats->inval_xmit_word_cnt;
1005 pfc_host_stat->invalid_crc_count = stats->inval_crc_cnt;
1006 if (IS_FWI2_CAPABLE(ha)) {
1007 pfc_host_stat->tx_frames = stats->tx_frames;
1008 pfc_host_stat->rx_frames = stats->rx_frames;
1009 pfc_host_stat->dumped_frames = stats->dumped_frames;
1010 pfc_host_stat->nos_count = stats->nos_rcvd;
1011 }
992 1012
993 pfc_host_stat->link_failure_count = stat_buf.link_fail_cnt; 1013done_free:
994 pfc_host_stat->loss_of_sync_count = stat_buf.loss_sync_cnt; 1014 dma_pool_free(ha->s_dma_pool, stats, stats_dma);
995 pfc_host_stat->loss_of_signal_count = stat_buf.loss_sig_cnt;
996 pfc_host_stat->prim_seq_protocol_err_count = stat_buf.prim_seq_err_cnt;
997 pfc_host_stat->invalid_tx_word_count = stat_buf.inval_xmit_word_cnt;
998 pfc_host_stat->invalid_crc_count = stat_buf.inval_crc_cnt;
999done: 1015done:
1000 return pfc_host_stat; 1016 return pfc_host_stat;
1001} 1017}