aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx/qla_attr.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_attr.c')
-rw-r--r--drivers/scsi/qla2xxx/qla_attr.c54
1 files changed, 35 insertions, 19 deletions
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index fb388b8c07cf..adf97320574b 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -9,7 +9,7 @@
9#include <linux/kthread.h> 9#include <linux/kthread.h>
10#include <linux/vmalloc.h> 10#include <linux/vmalloc.h>
11 11
12int qla24xx_vport_disable(struct fc_vport *, bool); 12static int qla24xx_vport_disable(struct fc_vport *, bool);
13 13
14/* SYSFS attributes --------------------------------------------------------- */ 14/* SYSFS attributes --------------------------------------------------------- */
15 15
@@ -958,7 +958,7 @@ qla2x00_issue_lip(struct Scsi_Host *shost)
958{ 958{
959 scsi_qla_host_t *ha = shost_priv(shost); 959 scsi_qla_host_t *ha = shost_priv(shost);
960 960
961 set_bit(LOOP_RESET_NEEDED, &ha->dpc_flags); 961 qla2x00_loop_reset(ha);
962 return 0; 962 return 0;
963} 963}
964 964
@@ -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}
@@ -1113,7 +1129,7 @@ vport_create_failed_2:
1113 return FC_VPORT_FAILED; 1129 return FC_VPORT_FAILED;
1114} 1130}
1115 1131
1116int 1132static int
1117qla24xx_vport_delete(struct fc_vport *fc_vport) 1133qla24xx_vport_delete(struct fc_vport *fc_vport)
1118{ 1134{
1119 scsi_qla_host_t *ha = shost_priv(fc_vport->shost); 1135 scsi_qla_host_t *ha = shost_priv(fc_vport->shost);
@@ -1124,7 +1140,7 @@ qla24xx_vport_delete(struct fc_vport *fc_vport)
1124 1140
1125 down(&ha->vport_sem); 1141 down(&ha->vport_sem);
1126 ha->cur_vport_count--; 1142 ha->cur_vport_count--;
1127 clear_bit(vha->vp_idx, (unsigned long *)ha->vp_idx_map); 1143 clear_bit(vha->vp_idx, ha->vp_idx_map);
1128 up(&ha->vport_sem); 1144 up(&ha->vport_sem);
1129 1145
1130 kfree(vha->node_name); 1146 kfree(vha->node_name);
@@ -1146,7 +1162,7 @@ qla24xx_vport_delete(struct fc_vport *fc_vport)
1146 return 0; 1162 return 0;
1147} 1163}
1148 1164
1149int 1165static int
1150qla24xx_vport_disable(struct fc_vport *fc_vport, bool disable) 1166qla24xx_vport_disable(struct fc_vport *fc_vport, bool disable)
1151{ 1167{
1152 scsi_qla_host_t *vha = fc_vport->dd_data; 1168 scsi_qla_host_t *vha = fc_vport->dd_data;