diff options
author | andrew.vasquez@qlogic.com <andrew.vasquez@qlogic.com> | 2006-01-31 19:05:02 -0500 |
---|---|---|
committer | <jejb@mulgrave.il.steeleye.com> | 2006-02-04 17:11:35 -0500 |
commit | 392e2f651c8a83484116a407a9f121e534c22b5a (patch) | |
tree | 7e36db1064949fe3ec4d6e6cd51b4ef1f70b5c70 /drivers/scsi/qla2xxx/qla_attr.c | |
parent | 8d067623adf119081b7a2683cdc6ee90eb8a70b2 (diff) |
[SCSI] qla2xxx: Add host-statistics FC transport attributes.
Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_attr.c')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_attr.c | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index 55016328bd78..5a8d5c4c69ba 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c | |||
@@ -7,7 +7,6 @@ | |||
7 | #include "qla_def.h" | 7 | #include "qla_def.h" |
8 | 8 | ||
9 | #include <linux/vmalloc.h> | 9 | #include <linux/vmalloc.h> |
10 | #include <scsi/scsi_transport_fc.h> | ||
11 | 10 | ||
12 | /* SYSFS attributes --------------------------------------------------------- */ | 11 | /* SYSFS attributes --------------------------------------------------------- */ |
13 | 12 | ||
@@ -555,6 +554,41 @@ qla2x00_issue_lip(struct Scsi_Host *shost) | |||
555 | return 0; | 554 | return 0; |
556 | } | 555 | } |
557 | 556 | ||
557 | static struct fc_host_statistics * | ||
558 | qla2x00_get_fc_host_stats(struct Scsi_Host *shost) | ||
559 | { | ||
560 | scsi_qla_host_t *ha = to_qla_host(shost); | ||
561 | int rval; | ||
562 | uint16_t mb_stat[1]; | ||
563 | link_stat_t stat_buf; | ||
564 | struct fc_host_statistics *pfc_host_stat; | ||
565 | |||
566 | pfc_host_stat = &ha->fc_host_stat; | ||
567 | memset(pfc_host_stat, -1, sizeof(struct fc_host_statistics)); | ||
568 | |||
569 | if (IS_QLA24XX(ha) || IS_QLA25XX(ha)) { | ||
570 | rval = qla24xx_get_isp_stats(ha, (uint32_t *)&stat_buf, | ||
571 | sizeof(stat_buf) / 4, mb_stat); | ||
572 | } else { | ||
573 | rval = qla2x00_get_link_status(ha, ha->loop_id, &stat_buf, | ||
574 | mb_stat); | ||
575 | } | ||
576 | if (rval != 0) { | ||
577 | qla_printk(KERN_WARNING, ha, | ||
578 | "Unable to retrieve host statistics (%d).\n", mb_stat[0]); | ||
579 | return pfc_host_stat; | ||
580 | } | ||
581 | |||
582 | pfc_host_stat->link_failure_count = stat_buf.link_fail_cnt; | ||
583 | pfc_host_stat->loss_of_sync_count = stat_buf.loss_sync_cnt; | ||
584 | pfc_host_stat->loss_of_signal_count = stat_buf.loss_sig_cnt; | ||
585 | pfc_host_stat->prim_seq_protocol_err_count = stat_buf.prim_seq_err_cnt; | ||
586 | pfc_host_stat->invalid_tx_word_count = stat_buf.inval_xmit_word_cnt; | ||
587 | pfc_host_stat->invalid_crc_count = stat_buf.inval_crc_cnt; | ||
588 | |||
589 | return pfc_host_stat; | ||
590 | } | ||
591 | |||
558 | struct fc_function_template qla2xxx_transport_functions = { | 592 | struct fc_function_template qla2xxx_transport_functions = { |
559 | 593 | ||
560 | .show_host_node_name = 1, | 594 | .show_host_node_name = 1, |
@@ -583,6 +617,7 @@ struct fc_function_template qla2xxx_transport_functions = { | |||
583 | .show_rport_dev_loss_tmo = 1, | 617 | .show_rport_dev_loss_tmo = 1, |
584 | 618 | ||
585 | .issue_fc_host_lip = qla2x00_issue_lip, | 619 | .issue_fc_host_lip = qla2x00_issue_lip, |
620 | .get_fc_host_stats = qla2x00_get_fc_host_stats, | ||
586 | }; | 621 | }; |
587 | 622 | ||
588 | void | 623 | void |