aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/qla2xxx/qla_attr.c37
-rw-r--r--drivers/scsi/qla2xxx/qla_def.h2
-rw-r--r--drivers/scsi/qla2xxx/qla_gbl.h7
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c1
-rw-r--r--drivers/scsi/qla2xxx/qla_mbx.c105
-rw-r--r--drivers/scsi/qla2xxx/qla_rscn.c2
6 files changed, 147 insertions, 7 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
557static struct fc_host_statistics *
558qla2x00_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
558struct fc_function_template qla2xxx_transport_functions = { 592struct 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
588void 623void
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 26af5319c219..414580800dc0 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -29,6 +29,7 @@
29#include <scsi/scsi_host.h> 29#include <scsi/scsi_host.h>
30#include <scsi/scsi_device.h> 30#include <scsi/scsi_device.h>
31#include <scsi/scsi_cmnd.h> 31#include <scsi/scsi_cmnd.h>
32#include <scsi/scsi_transport_fc.h>
32 33
33#if defined(CONFIG_SCSI_QLA2XXX_EMBEDDED_FIRMWARE) 34#if defined(CONFIG_SCSI_QLA2XXX_EMBEDDED_FIRMWARE)
34#if defined(CONFIG_SCSI_QLA21XX) || defined(CONFIG_SCSI_QLA21XX_MODULE) 35#if defined(CONFIG_SCSI_QLA21XX) || defined(CONFIG_SCSI_QLA21XX_MODULE)
@@ -2496,6 +2497,7 @@ typedef struct scsi_qla_host {
2496 2497
2497 uint16_t zio_mode; 2498 uint16_t zio_mode;
2498 uint16_t zio_timer; 2499 uint16_t zio_timer;
2500 struct fc_host_statistics fc_host_stat;
2499} scsi_qla_host_t; 2501} scsi_qla_host_t;
2500 2502
2501 2503
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
index 35266bd5d538..f2f5454a05e9 100644
--- a/drivers/scsi/qla2xxx/qla_gbl.h
+++ b/drivers/scsi/qla2xxx/qla_gbl.h
@@ -185,6 +185,13 @@ qla2x00_get_resource_cnts(scsi_qla_host_t *, uint16_t *, uint16_t *, uint16_t *,
185extern int 185extern int
186qla2x00_get_fcal_position_map(scsi_qla_host_t *ha, char *pos_map); 186qla2x00_get_fcal_position_map(scsi_qla_host_t *ha, char *pos_map);
187 187
188extern int
189qla2x00_get_link_status(scsi_qla_host_t *, uint16_t, link_stat_t *,
190 uint16_t *);
191
192extern int
193qla24xx_get_isp_stats(scsi_qla_host_t *, uint32_t *, uint32_t, uint16_t *);
194
188extern int qla24xx_abort_command(scsi_qla_host_t *, srb_t *); 195extern int qla24xx_abort_command(scsi_qla_host_t *, srb_t *);
189extern int qla24xx_abort_target(fc_port_t *); 196extern int qla24xx_abort_target(fc_port_t *);
190 197
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index e67bb0997818..634ee174bff2 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -8,7 +8,6 @@
8 8
9#include <linux/delay.h> 9#include <linux/delay.h>
10#include <linux/vmalloc.h> 10#include <linux/vmalloc.h>
11#include <scsi/scsi_transport_fc.h>
12 11
13#include "qla_devtbl.h" 12#include "qla_devtbl.h"
14 13
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index 3099b379de9d..49ce197876b4 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -7,7 +7,6 @@
7#include "qla_def.h" 7#include "qla_def.h"
8 8
9#include <linux/delay.h> 9#include <linux/delay.h>
10#include <scsi/scsi_transport_fc.h>
11 10
12static void 11static void
13qla2x00_mbx_sem_timeout(unsigned long data) 12qla2x00_mbx_sem_timeout(unsigned long data)
@@ -2017,8 +2016,109 @@ qla2x00_get_fcal_position_map(scsi_qla_host_t *ha, char *pos_map)
2017 2016
2018 return rval; 2017 return rval;
2019} 2018}
2019#endif
2020
2021/*
2022 * qla2x00_get_link_status
2023 *
2024 * Input:
2025 * ha = adapter block pointer.
2026 * loop_id = device loop ID.
2027 * ret_buf = pointer to link status return buffer.
2028 *
2029 * Returns:
2030 * 0 = success.
2031 * BIT_0 = mem alloc error.
2032 * BIT_1 = mailbox error.
2033 */
2034int
2035qla2x00_get_link_status(scsi_qla_host_t *ha, uint16_t loop_id,
2036 link_stat_t *ret_buf, uint16_t *status)
2037{
2038 int rval;
2039 mbx_cmd_t mc;
2040 mbx_cmd_t *mcp = &mc;
2041 link_stat_t *stat_buf;
2042 dma_addr_t stat_buf_dma;
2043
2044 DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no);)
2045
2046 stat_buf = dma_pool_alloc(ha->s_dma_pool, GFP_ATOMIC, &stat_buf_dma);
2047 if (stat_buf == NULL) {
2048 DEBUG2_3_11(printk("%s(%ld): Failed to allocate memory.\n",
2049 __func__, ha->host_no));
2050 return BIT_0;
2051 }
2052 memset(stat_buf, 0, sizeof(link_stat_t));
2053
2054 mcp->mb[0] = MBC_GET_LINK_STATUS;
2055 mcp->mb[2] = MSW(stat_buf_dma);
2056 mcp->mb[3] = LSW(stat_buf_dma);
2057 mcp->mb[6] = MSW(MSD(stat_buf_dma));
2058 mcp->mb[7] = LSW(MSD(stat_buf_dma));
2059 mcp->out_mb = MBX_7|MBX_6|MBX_3|MBX_2|MBX_0;
2060 mcp->in_mb = MBX_0;
2061 if (IS_QLA24XX(ha) || IS_QLA25XX(ha)) {
2062 mcp->mb[1] = loop_id;
2063 mcp->mb[4] = 0;
2064 mcp->mb[10] = 0;
2065 mcp->out_mb |= MBX_10|MBX_4|MBX_1;
2066 mcp->in_mb |= MBX_1;
2067 } else if (HAS_EXTENDED_IDS(ha)) {
2068 mcp->mb[1] = loop_id;
2069 mcp->mb[10] = 0;
2070 mcp->out_mb |= MBX_10|MBX_1;
2071 } else {
2072 mcp->mb[1] = loop_id << 8;
2073 mcp->out_mb |= MBX_1;
2074 }
2075 mcp->tov = 30;
2076 mcp->flags = IOCTL_CMD;
2077 rval = qla2x00_mailbox_command(ha, mcp);
2078
2079 if (rval == QLA_SUCCESS) {
2080 if (mcp->mb[0] != MBS_COMMAND_COMPLETE) {
2081 DEBUG2_3_11(printk("%s(%ld): cmd failed. mbx0=%x.\n",
2082 __func__, ha->host_no, mcp->mb[0]);)
2083 status[0] = mcp->mb[0];
2084 rval = BIT_1;
2085 } else {
2086 /* copy over data -- firmware data is LE. */
2087 ret_buf->link_fail_cnt =
2088 le32_to_cpu(stat_buf->link_fail_cnt);
2089 ret_buf->loss_sync_cnt =
2090 le32_to_cpu(stat_buf->loss_sync_cnt);
2091 ret_buf->loss_sig_cnt =
2092 le32_to_cpu(stat_buf->loss_sig_cnt);
2093 ret_buf->prim_seq_err_cnt =
2094 le32_to_cpu(stat_buf->prim_seq_err_cnt);
2095 ret_buf->inval_xmit_word_cnt =
2096 le32_to_cpu(stat_buf->inval_xmit_word_cnt);
2097 ret_buf->inval_crc_cnt =
2098 le32_to_cpu(stat_buf->inval_crc_cnt);
2099
2100 DEBUG11(printk("%s(%ld): stat dump: fail_cnt=%d "
2101 "loss_sync=%d loss_sig=%d seq_err=%d "
2102 "inval_xmt_word=%d inval_crc=%d.\n", __func__,
2103 ha->host_no, stat_buf->link_fail_cnt,
2104 stat_buf->loss_sync_cnt, stat_buf->loss_sig_cnt,
2105 stat_buf->prim_seq_err_cnt,
2106 stat_buf->inval_xmit_word_cnt,
2107 stat_buf->inval_crc_cnt);)
2108 }
2109 } else {
2110 /* Failed. */
2111 DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__,
2112 ha->host_no, rval);)
2113 rval = BIT_1;
2114 }
2115
2116 dma_pool_free(ha->s_dma_pool, stat_buf, stat_buf_dma);
2020 2117
2021uint8_t 2118 return rval;
2119}
2120
2121int
2022qla24xx_get_isp_stats(scsi_qla_host_t *ha, uint32_t *dwbuf, uint32_t dwords, 2122qla24xx_get_isp_stats(scsi_qla_host_t *ha, uint32_t *dwbuf, uint32_t dwords,
2023 uint16_t *status) 2123 uint16_t *status)
2024{ 2124{
@@ -2080,7 +2180,6 @@ qla24xx_get_isp_stats(scsi_qla_host_t *ha, uint32_t *dwbuf, uint32_t dwords,
2080 2180
2081 return rval; 2181 return rval;
2082} 2182}
2083#endif
2084 2183
2085int 2184int
2086qla24xx_abort_command(scsi_qla_host_t *ha, srb_t *sp) 2185qla24xx_abort_command(scsi_qla_host_t *ha, srb_t *sp)
diff --git a/drivers/scsi/qla2xxx/qla_rscn.c b/drivers/scsi/qla2xxx/qla_rscn.c
index 2c3342108dd8..b70bebe18c01 100644
--- a/drivers/scsi/qla2xxx/qla_rscn.c
+++ b/drivers/scsi/qla2xxx/qla_rscn.c
@@ -6,8 +6,6 @@
6 */ 6 */
7#include "qla_def.h" 7#include "qla_def.h"
8 8
9#include <scsi/scsi_transport_fc.h>
10
11/** 9/**
12 * IO descriptor handle definitions. 10 * IO descriptor handle definitions.
13 * 11 *