]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
qla2xxx: Properly initialize IO statistics.
authorJoe Carnuccio <joe.carnuccio@qlogic.com>
Thu, 10 Mar 2016 00:44:03 +0000 (16:44 -0800)
committerChuck Anderson <chuck.anderson@oracle.com>
Wed, 13 Jul 2016 07:41:33 +0000 (00:41 -0700)
Orabug: 23755773

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>
Signed-off-by: Ethan Zhao <ethan.zhao@oracle.com>
drivers/scsi/qla2xxx/qla_attr.c
drivers/scsi/qla2xxx/qla_def.h
drivers/scsi/qla2xxx/qla_init.c
drivers/scsi/qla2xxx/qla_target.c

index f961aa68d994d0c1265f8196947fbd5aae288012..a737e9b916c8a2b1292e20c9cf40e34cdd4c65f8 100644 (file)
@@ -1775,10 +1775,9 @@ qla2x00_get_fc_host_stats(struct Scsi_Host *shost)
        int rval;
        struct link_statistics *stats;
        dma_addr_t stats_dma;
-       struct fc_host_statistics *pfc_host_stat;
+       struct fc_host_statistics *p = &vha->fc_host_stat;
 
-       pfc_host_stat = &vha->fc_host_stat;
-       memset(pfc_host_stat, -1, sizeof(struct fc_host_statistics));
+       memset(p, -1, sizeof(*p));
 
        if (IS_QLAFX00(vha->hw))
                goto done;
@@ -1814,37 +1813,37 @@ qla2x00_get_fc_host_stats(struct Scsi_Host *shost)
        if (rval != QLA_SUCCESS)
                goto done_free;
 
-       pfc_host_stat->link_failure_count = stats->link_fail_cnt;
-       pfc_host_stat->loss_of_sync_count = stats->loss_sync_cnt;
-       pfc_host_stat->loss_of_signal_count = stats->loss_sig_cnt;
-       pfc_host_stat->prim_seq_protocol_err_count = stats->prim_seq_err_cnt;
-       pfc_host_stat->invalid_tx_word_count = stats->inval_xmit_word_cnt;
-       pfc_host_stat->invalid_crc_count = stats->inval_crc_cnt;
+       p->link_failure_count = stats->link_fail_cnt;
+       p->loss_of_sync_count = stats->loss_sync_cnt;
+       p->loss_of_signal_count = stats->loss_sig_cnt;
+       p->prim_seq_protocol_err_count = stats->prim_seq_err_cnt;
+       p->invalid_tx_word_count = stats->inval_xmit_word_cnt;
+       p->invalid_crc_count = stats->inval_crc_cnt;
        if (IS_FWI2_CAPABLE(ha)) {
-               pfc_host_stat->lip_count = stats->lip_cnt;
-               pfc_host_stat->tx_frames = stats->tx_frames;
-               pfc_host_stat->rx_frames = stats->rx_frames;
-               pfc_host_stat->dumped_frames = stats->discarded_frames;
-               pfc_host_stat->nos_count = stats->nos_rcvd;
-               pfc_host_stat->error_frames =
+               p->lip_count = stats->lip_cnt;
+               p->tx_frames = stats->tx_frames;
+               p->rx_frames = stats->rx_frames;
+               p->dumped_frames = stats->discarded_frames;
+               p->nos_count = stats->nos_rcvd;
+               p->error_frames =
                        stats->dropped_frames + stats->discarded_frames;
-               pfc_host_stat->rx_words = vha->qla_stats.input_bytes;
-               pfc_host_stat->tx_words = vha->qla_stats.output_bytes;
+               p->rx_words = vha->qla_stats.input_bytes;
+               p->tx_words = vha->qla_stats.output_bytes;
        }
-       pfc_host_stat->fcp_control_requests = vha->qla_stats.control_requests;
-       pfc_host_stat->fcp_input_requests = vha->qla_stats.input_requests;
-       pfc_host_stat->fcp_output_requests = vha->qla_stats.output_requests;
-       pfc_host_stat->fcp_input_megabytes = vha->qla_stats.input_bytes >> 20;
-       pfc_host_stat->fcp_output_megabytes = vha->qla_stats.output_bytes >> 20;
-       pfc_host_stat->seconds_since_last_reset =
+       p->fcp_control_requests = vha->qla_stats.control_requests;
+       p->fcp_input_requests = vha->qla_stats.input_requests;
+       p->fcp_output_requests = vha->qla_stats.output_requests;
+       p->fcp_input_megabytes = vha->qla_stats.input_bytes >> 20;
+       p->fcp_output_megabytes = vha->qla_stats.output_bytes >> 20;
+       p->seconds_since_last_reset =
                get_jiffies_64() - vha->qla_stats.jiffies_at_last_reset;
-       do_div(pfc_host_stat->seconds_since_last_reset, HZ);
+       do_div(p->seconds_since_last_reset, HZ);
 
 done_free:
        dma_free_coherent(&ha->pdev->dev, sizeof(struct link_statistics),
            stats, stats_dma);
 done:
-       return pfc_host_stat;
+       return p;
 }
 
 static void
@@ -1852,6 +1851,7 @@ qla2x00_reset_host_stats(struct Scsi_Host *shost)
 {
        scsi_qla_host_t *vha = shost_priv(shost);
 
+       memset(&vha->qla_stats, 0, sizeof(vha->qla_stats));
        memset(&vha->fc_host_stat, 0, sizeof(vha->fc_host_stat));
 
        vha->qla_stats.jiffies_at_last_reset = get_jiffies_64();
index 98c33fcd862c7788b1f7c91047965c57638eb8f8..033204ddc28f91c5e80ee0ca4ddd7a70494d00df 100644 (file)
@@ -3452,7 +3452,6 @@ struct qla_hw_data {
        int             cur_vport_count;
 
        struct qla_chip_state_84xx *cs84xx;
-       struct qla_statistics qla_stats;
        struct isp_operations *isp_ops;
        struct workqueue_struct *wq;
        struct qlfc_fw fw_buf;
index ad6d4adfeeed8bc04acf299a91bce72bc8efd48e..8b86f0b92fad54a1aa7e7ba9678c0b817397c1b5 100644 (file)
@@ -619,6 +619,9 @@ qla2x00_initialize_adapter(scsi_qla_host_t *vha)
        struct qla_hw_data *ha = vha->hw;
        struct req_que *req = ha->req_q_map[0];
 
+       memset(&vha->qla_stats, 0, sizeof(vha->qla_stats));
+       memset(&vha->fc_host_stat, 0, sizeof(vha->fc_host_stat));
+
        /* Clear adapter flags. */
        vha->flags.online = 0;
        ha->flags.chip_reset_done = 0;
index 496a733d0ca389ef18ac0e5bdcfa7698251450dd..0fe100df3ee20b95e118ac53f2f01ebdbe71781c 100644 (file)
@@ -198,8 +198,8 @@ static inline void qlt_incr_num_pend_cmds(struct scsi_qla_host *vha)
        spin_lock_irqsave(&vha->hw->tgt.q_full_lock, flags);
 
        vha->hw->tgt.num_pend_cmds++;
-       if (vha->hw->tgt.num_pend_cmds > vha->hw->qla_stats.stat_max_pend_cmds)
-               vha->hw->qla_stats.stat_max_pend_cmds =
+       if (vha->hw->tgt.num_pend_cmds > vha->qla_stats.stat_max_pend_cmds)
+               vha->qla_stats.stat_max_pend_cmds =
                        vha->hw->tgt.num_pend_cmds;
        spin_unlock_irqrestore(&vha->hw->tgt.q_full_lock, flags);
 }
@@ -4372,8 +4372,8 @@ qlt_alloc_qfull_cmd(struct scsi_qla_host *vha,
        if ((vha->hw->tgt.num_qfull_cmds_alloc + 1) > MAX_QFULL_CMDS_ALLOC) {
                vha->hw->tgt.num_qfull_cmds_dropped++;
                if (vha->hw->tgt.num_qfull_cmds_dropped >
-                       vha->hw->qla_stats.stat_max_qfull_cmds_dropped)
-                       vha->hw->qla_stats.stat_max_qfull_cmds_dropped =
+                       vha->qla_stats.stat_max_qfull_cmds_dropped)
+                       vha->qla_stats.stat_max_qfull_cmds_dropped =
                                vha->hw->tgt.num_qfull_cmds_dropped;
 
                ql_dbg(ql_dbg_io, vha, 0x3068,
@@ -4404,8 +4404,8 @@ qlt_alloc_qfull_cmd(struct scsi_qla_host *vha,
 
                vha->hw->tgt.num_qfull_cmds_dropped++;
                if (vha->hw->tgt.num_qfull_cmds_dropped >
-                       vha->hw->qla_stats.stat_max_qfull_cmds_dropped)
-                       vha->hw->qla_stats.stat_max_qfull_cmds_dropped =
+                       vha->qla_stats.stat_max_qfull_cmds_dropped)
+                       vha->qla_stats.stat_max_qfull_cmds_dropped =
                                vha->hw->tgt.num_qfull_cmds_dropped;
 
                qlt_chk_exch_leak_thresh_hold(vha);
@@ -4434,8 +4434,8 @@ qlt_alloc_qfull_cmd(struct scsi_qla_host *vha,
 
        vha->hw->tgt.num_qfull_cmds_alloc++;
        if (vha->hw->tgt.num_qfull_cmds_alloc >
-               vha->hw->qla_stats.stat_max_qfull_cmds_alloc)
-               vha->hw->qla_stats.stat_max_qfull_cmds_alloc =
+               vha->qla_stats.stat_max_qfull_cmds_alloc)
+               vha->qla_stats.stat_max_qfull_cmds_alloc =
                        vha->hw->tgt.num_qfull_cmds_alloc;
 }