aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe Carnuccio <joe.carnuccio@qlogic.com>2016-07-06 11:14:23 -0400
committerMartin K. Petersen <martin.petersen@oracle.com>2016-07-15 15:31:31 -0400
commitfc90adaf05ada86d3fcd145045eac32ad81f41e9 (patch)
tree5a6692655f67e680ccc675af57f3079076c69f57
parenta7ddd02b108ecada1cf5a5ccb9362179d5671db4 (diff)
qla2xxx: Properly initialize IO statistics.
Properly initialize IO statistics to avoid initial 0xFFFFFFF (-1) values. Cleanup/simplify usage of pointer to statistics structure. Signed-off-by: Joe Carnuccio <joe.carnuccio@qlogic.com> Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r--drivers/scsi/qla2xxx/qla_attr.c50
-rw-r--r--drivers/scsi/qla2xxx/qla_def.h1
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c3
-rw-r--r--drivers/scsi/qla2xxx/qla_target.c16
4 files changed, 36 insertions, 34 deletions
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index c9bcd82f08bc..e0256a411cd5 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -1811,10 +1811,9 @@ qla2x00_get_fc_host_stats(struct Scsi_Host *shost)
1811 int rval; 1811 int rval;
1812 struct link_statistics *stats; 1812 struct link_statistics *stats;
1813 dma_addr_t stats_dma; 1813 dma_addr_t stats_dma;
1814 struct fc_host_statistics *pfc_host_stat; 1814 struct fc_host_statistics *p = &vha->fc_host_stat;
1815 1815
1816 pfc_host_stat = &vha->fc_host_stat; 1816 memset(p, -1, sizeof(*p));
1817 memset(pfc_host_stat, -1, sizeof(struct fc_host_statistics));
1818 1817
1819 if (IS_QLAFX00(vha->hw)) 1818 if (IS_QLAFX00(vha->hw))
1820 goto done; 1819 goto done;
@@ -1850,37 +1849,37 @@ qla2x00_get_fc_host_stats(struct Scsi_Host *shost)
1850 if (rval != QLA_SUCCESS) 1849 if (rval != QLA_SUCCESS)
1851 goto done_free; 1850 goto done_free;
1852 1851
1853 pfc_host_stat->link_failure_count = stats->link_fail_cnt; 1852 p->link_failure_count = stats->link_fail_cnt;
1854 pfc_host_stat->loss_of_sync_count = stats->loss_sync_cnt; 1853 p->loss_of_sync_count = stats->loss_sync_cnt;
1855 pfc_host_stat->loss_of_signal_count = stats->loss_sig_cnt; 1854 p->loss_of_signal_count = stats->loss_sig_cnt;
1856 pfc_host_stat->prim_seq_protocol_err_count = stats->prim_seq_err_cnt; 1855 p->prim_seq_protocol_err_count = stats->prim_seq_err_cnt;
1857 pfc_host_stat->invalid_tx_word_count = stats->inval_xmit_word_cnt; 1856 p->invalid_tx_word_count = stats->inval_xmit_word_cnt;
1858 pfc_host_stat->invalid_crc_count = stats->inval_crc_cnt; 1857 p->invalid_crc_count = stats->inval_crc_cnt;
1859 if (IS_FWI2_CAPABLE(ha)) { 1858 if (IS_FWI2_CAPABLE(ha)) {
1860 pfc_host_stat->lip_count = stats->lip_cnt; 1859 p->lip_count = stats->lip_cnt;
1861 pfc_host_stat->tx_frames = stats->tx_frames; 1860 p->tx_frames = stats->tx_frames;
1862 pfc_host_stat->rx_frames = stats->rx_frames; 1861 p->rx_frames = stats->rx_frames;
1863 pfc_host_stat->dumped_frames = stats->discarded_frames; 1862 p->dumped_frames = stats->discarded_frames;
1864 pfc_host_stat->nos_count = stats->nos_rcvd; 1863 p->nos_count = stats->nos_rcvd;
1865 pfc_host_stat->error_frames = 1864 p->error_frames =
1866 stats->dropped_frames + stats->discarded_frames; 1865 stats->dropped_frames + stats->discarded_frames;
1867 pfc_host_stat->rx_words = vha->qla_stats.input_bytes; 1866 p->rx_words = vha->qla_stats.input_bytes;
1868 pfc_host_stat->tx_words = vha->qla_stats.output_bytes; 1867 p->tx_words = vha->qla_stats.output_bytes;
1869 } 1868 }
1870 pfc_host_stat->fcp_control_requests = vha->qla_stats.control_requests; 1869 p->fcp_control_requests = vha->qla_stats.control_requests;
1871 pfc_host_stat->fcp_input_requests = vha->qla_stats.input_requests; 1870 p->fcp_input_requests = vha->qla_stats.input_requests;
1872 pfc_host_stat->fcp_output_requests = vha->qla_stats.output_requests; 1871 p->fcp_output_requests = vha->qla_stats.output_requests;
1873 pfc_host_stat->fcp_input_megabytes = vha->qla_stats.input_bytes >> 20; 1872 p->fcp_input_megabytes = vha->qla_stats.input_bytes >> 20;
1874 pfc_host_stat->fcp_output_megabytes = vha->qla_stats.output_bytes >> 20; 1873 p->fcp_output_megabytes = vha->qla_stats.output_bytes >> 20;
1875 pfc_host_stat->seconds_since_last_reset = 1874 p->seconds_since_last_reset =
1876 get_jiffies_64() - vha->qla_stats.jiffies_at_last_reset; 1875 get_jiffies_64() - vha->qla_stats.jiffies_at_last_reset;
1877 do_div(pfc_host_stat->seconds_since_last_reset, HZ); 1876 do_div(p->seconds_since_last_reset, HZ);
1878 1877
1879done_free: 1878done_free:
1880 dma_free_coherent(&ha->pdev->dev, sizeof(struct link_statistics), 1879 dma_free_coherent(&ha->pdev->dev, sizeof(struct link_statistics),
1881 stats, stats_dma); 1880 stats, stats_dma);
1882done: 1881done:
1883 return pfc_host_stat; 1882 return p;
1884} 1883}
1885 1884
1886static void 1885static void
@@ -1888,6 +1887,7 @@ qla2x00_reset_host_stats(struct Scsi_Host *shost)
1888{ 1887{
1889 scsi_qla_host_t *vha = shost_priv(shost); 1888 scsi_qla_host_t *vha = shost_priv(shost);
1890 1889
1890 memset(&vha->qla_stats, 0, sizeof(vha->qla_stats));
1891 memset(&vha->fc_host_stat, 0, sizeof(vha->fc_host_stat)); 1891 memset(&vha->fc_host_stat, 0, sizeof(vha->fc_host_stat));
1892 1892
1893 vha->qla_stats.jiffies_at_last_reset = get_jiffies_64(); 1893 vha->qla_stats.jiffies_at_last_reset = get_jiffies_64();
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 2b7e4f5574bb..a73ecc780e1a 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -3508,7 +3508,6 @@ struct qla_hw_data {
3508 int cur_vport_count; 3508 int cur_vport_count;
3509 3509
3510 struct qla_chip_state_84xx *cs84xx; 3510 struct qla_chip_state_84xx *cs84xx;
3511 struct qla_statistics qla_stats;
3512 struct isp_operations *isp_ops; 3511 struct isp_operations *isp_ops;
3513 struct workqueue_struct *wq; 3512 struct workqueue_struct *wq;
3514 struct qlfc_fw fw_buf; 3513 struct qlfc_fw fw_buf;
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index a3685b683688..68e9309aa5d4 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -624,6 +624,9 @@ qla2x00_initialize_adapter(scsi_qla_host_t *vha)
624 struct qla_hw_data *ha = vha->hw; 624 struct qla_hw_data *ha = vha->hw;
625 struct req_que *req = ha->req_q_map[0]; 625 struct req_que *req = ha->req_q_map[0];
626 626
627 memset(&vha->qla_stats, 0, sizeof(vha->qla_stats));
628 memset(&vha->fc_host_stat, 0, sizeof(vha->fc_host_stat));
629
627 /* Clear adapter flags. */ 630 /* Clear adapter flags. */
628 vha->flags.online = 0; 631 vha->flags.online = 0;
629 ha->flags.chip_reset_done = 0; 632 ha->flags.chip_reset_done = 0;
diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
index ca39deb4ff5b..bff9689f5ca9 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -215,8 +215,8 @@ static inline void qlt_incr_num_pend_cmds(struct scsi_qla_host *vha)
215 spin_lock_irqsave(&vha->hw->tgt.q_full_lock, flags); 215 spin_lock_irqsave(&vha->hw->tgt.q_full_lock, flags);
216 216
217 vha->hw->tgt.num_pend_cmds++; 217 vha->hw->tgt.num_pend_cmds++;
218 if (vha->hw->tgt.num_pend_cmds > vha->hw->qla_stats.stat_max_pend_cmds) 218 if (vha->hw->tgt.num_pend_cmds > vha->qla_stats.stat_max_pend_cmds)
219 vha->hw->qla_stats.stat_max_pend_cmds = 219 vha->qla_stats.stat_max_pend_cmds =
220 vha->hw->tgt.num_pend_cmds; 220 vha->hw->tgt.num_pend_cmds;
221 spin_unlock_irqrestore(&vha->hw->tgt.q_full_lock, flags); 221 spin_unlock_irqrestore(&vha->hw->tgt.q_full_lock, flags);
222} 222}
@@ -5231,8 +5231,8 @@ qlt_alloc_qfull_cmd(struct scsi_qla_host *vha,
5231 if ((vha->hw->tgt.num_qfull_cmds_alloc + 1) > MAX_QFULL_CMDS_ALLOC) { 5231 if ((vha->hw->tgt.num_qfull_cmds_alloc + 1) > MAX_QFULL_CMDS_ALLOC) {
5232 vha->hw->tgt.num_qfull_cmds_dropped++; 5232 vha->hw->tgt.num_qfull_cmds_dropped++;
5233 if (vha->hw->tgt.num_qfull_cmds_dropped > 5233 if (vha->hw->tgt.num_qfull_cmds_dropped >
5234 vha->hw->qla_stats.stat_max_qfull_cmds_dropped) 5234 vha->qla_stats.stat_max_qfull_cmds_dropped)
5235 vha->hw->qla_stats.stat_max_qfull_cmds_dropped = 5235 vha->qla_stats.stat_max_qfull_cmds_dropped =
5236 vha->hw->tgt.num_qfull_cmds_dropped; 5236 vha->hw->tgt.num_qfull_cmds_dropped;
5237 5237
5238 ql_dbg(ql_dbg_io, vha, 0x3068, 5238 ql_dbg(ql_dbg_io, vha, 0x3068,
@@ -5263,8 +5263,8 @@ qlt_alloc_qfull_cmd(struct scsi_qla_host *vha,
5263 5263
5264 vha->hw->tgt.num_qfull_cmds_dropped++; 5264 vha->hw->tgt.num_qfull_cmds_dropped++;
5265 if (vha->hw->tgt.num_qfull_cmds_dropped > 5265 if (vha->hw->tgt.num_qfull_cmds_dropped >
5266 vha->hw->qla_stats.stat_max_qfull_cmds_dropped) 5266 vha->qla_stats.stat_max_qfull_cmds_dropped)
5267 vha->hw->qla_stats.stat_max_qfull_cmds_dropped = 5267 vha->qla_stats.stat_max_qfull_cmds_dropped =
5268 vha->hw->tgt.num_qfull_cmds_dropped; 5268 vha->hw->tgt.num_qfull_cmds_dropped;
5269 5269
5270 qlt_chk_exch_leak_thresh_hold(vha); 5270 qlt_chk_exch_leak_thresh_hold(vha);
@@ -5293,8 +5293,8 @@ qlt_alloc_qfull_cmd(struct scsi_qla_host *vha,
5293 5293
5294 vha->hw->tgt.num_qfull_cmds_alloc++; 5294 vha->hw->tgt.num_qfull_cmds_alloc++;
5295 if (vha->hw->tgt.num_qfull_cmds_alloc > 5295 if (vha->hw->tgt.num_qfull_cmds_alloc >
5296 vha->hw->qla_stats.stat_max_qfull_cmds_alloc) 5296 vha->qla_stats.stat_max_qfull_cmds_alloc)
5297 vha->hw->qla_stats.stat_max_qfull_cmds_alloc = 5297 vha->qla_stats.stat_max_qfull_cmds_alloc =
5298 vha->hw->tgt.num_qfull_cmds_alloc; 5298 vha->hw->tgt.num_qfull_cmds_alloc;
5299} 5299}
5300 5300