aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorJoe Carnuccio <joe.carnuccio@qlogic.com>2016-07-06 11:14:24 -0400
committerMartin K. Petersen <martin.petersen@oracle.com>2016-07-15 15:31:31 -0400
commitc6dc99058e5798958847eab7411083ca5b25643c (patch)
treeb109292e6dde38f052b2f775d95199fb62709c9d /drivers/scsi
parentfc90adaf05ada86d3fcd145045eac32ad81f41e9 (diff)
qla2xxx: Properly reset firmware statistics.
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>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/qla2xxx/qla_attr.c28
-rw-r--r--drivers/scsi/qla2xxx/qla_bsg.c2
-rw-r--r--drivers/scsi/qla2xxx/qla_dbg.c2
-rw-r--r--drivers/scsi/qla2xxx/qla_gbl.h2
-rw-r--r--drivers/scsi/qla2xxx/qla_mbx.c18
5 files changed, 35 insertions, 17 deletions
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index e0256a411cd5..8b06ce8fbb0f 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -1828,17 +1828,17 @@ qla2x00_get_fc_host_stats(struct Scsi_Host *shost)
1828 goto done; 1828 goto done;
1829 1829
1830 stats = dma_alloc_coherent(&ha->pdev->dev, 1830 stats = dma_alloc_coherent(&ha->pdev->dev,
1831 sizeof(struct link_statistics), &stats_dma, GFP_KERNEL); 1831 sizeof(*stats), &stats_dma, GFP_KERNEL);
1832 if (stats == NULL) { 1832 if (!stats) {
1833 ql_log(ql_log_warn, vha, 0x707d, 1833 ql_log(ql_log_warn, vha, 0x707d,
1834 "Failed to allocate memory for stats.\n"); 1834 "Failed to allocate memory for stats.\n");
1835 goto done; 1835 goto done;
1836 } 1836 }
1837 memset(stats, 0, DMA_POOL_SIZE); 1837 memset(stats, 0, sizeof(*stats));
1838 1838
1839 rval = QLA_FUNCTION_FAILED; 1839 rval = QLA_FUNCTION_FAILED;
1840 if (IS_FWI2_CAPABLE(ha)) { 1840 if (IS_FWI2_CAPABLE(ha)) {
1841 rval = qla24xx_get_isp_stats(base_vha, stats, stats_dma); 1841 rval = qla24xx_get_isp_stats(base_vha, stats, stats_dma, 0);
1842 } else if (atomic_read(&base_vha->loop_state) == LOOP_READY && 1842 } else if (atomic_read(&base_vha->loop_state) == LOOP_READY &&
1843 !ha->dpc_active) { 1843 !ha->dpc_active) {
1844 /* Must be in a 'READY' state for statistics retrieval. */ 1844 /* Must be in a 'READY' state for statistics retrieval. */
@@ -1886,11 +1886,31 @@ static void
1886qla2x00_reset_host_stats(struct Scsi_Host *shost) 1886qla2x00_reset_host_stats(struct Scsi_Host *shost)
1887{ 1887{
1888 scsi_qla_host_t *vha = shost_priv(shost); 1888 scsi_qla_host_t *vha = shost_priv(shost);
1889 struct qla_hw_data *ha = vha->hw;
1890 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev);
1891 struct link_statistics *stats;
1892 dma_addr_t stats_dma;
1889 1893
1890 memset(&vha->qla_stats, 0, sizeof(vha->qla_stats)); 1894 memset(&vha->qla_stats, 0, sizeof(vha->qla_stats));
1891 memset(&vha->fc_host_stat, 0, sizeof(vha->fc_host_stat)); 1895 memset(&vha->fc_host_stat, 0, sizeof(vha->fc_host_stat));
1892 1896
1893 vha->qla_stats.jiffies_at_last_reset = get_jiffies_64(); 1897 vha->qla_stats.jiffies_at_last_reset = get_jiffies_64();
1898
1899 if (IS_FWI2_CAPABLE(ha)) {
1900 stats = dma_alloc_coherent(&ha->pdev->dev,
1901 sizeof(*stats), &stats_dma, GFP_KERNEL);
1902 if (!stats) {
1903 ql_log(ql_log_warn, vha, 0x70d7,
1904 "Failed to allocate memory for stats.\n");
1905 return;
1906 }
1907
1908 /* reset firmware statistics */
1909 qla24xx_get_isp_stats(base_vha, stats, stats_dma, BIT_0);
1910
1911 dma_free_coherent(&ha->pdev->dev, sizeof(*stats),
1912 stats, stats_dma);
1913 }
1894} 1914}
1895 1915
1896static void 1916static void
diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c
index 392c147d5793..8cadc4da7d59 100644
--- a/drivers/scsi/qla2xxx/qla_bsg.c
+++ b/drivers/scsi/qla2xxx/qla_bsg.c
@@ -2270,7 +2270,7 @@ qla2x00_get_priv_stats(struct fc_bsg_job *bsg_job)
2270 2270
2271 memset(stats, 0, sizeof(struct link_statistics)); 2271 memset(stats, 0, sizeof(struct link_statistics));
2272 2272
2273 rval = qla24xx_get_isp_stats(base_vha, stats, stats_dma); 2273 rval = qla24xx_get_isp_stats(base_vha, stats, stats_dma, 0);
2274 2274
2275 if (rval != QLA_SUCCESS) 2275 if (rval != QLA_SUCCESS)
2276 goto done_free; 2276 goto done_free;
diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index 589cd13b5a0d..c6ccc8a86fa7 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -41,7 +41,7 @@
41 * | | | 0x70ad-0x70ae | 41 * | | | 0x70ad-0x70ae |
42 * | | | 0x70d0-0x70d6 | 42 * | | | 0x70d0-0x70d6 |
43 * | | | 0x70d7-0x70db | 43 * | | | 0x70d7-0x70db |
44 * | | | 0x70de-0x70df | 44 * | | | 0x70db |
45 * | Task Management | 0x803d | 0x8000,0x800b | 45 * | Task Management | 0x803d | 0x8000,0x800b |
46 * | | | 0x8019 | 46 * | | | 0x8019 |
47 * | | | 0x8025,0x8026 | 47 * | | | 0x8025,0x8026 |
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
index fe943772fe7b..be24e6260976 100644
--- a/drivers/scsi/qla2xxx/qla_gbl.h
+++ b/drivers/scsi/qla2xxx/qla_gbl.h
@@ -344,7 +344,7 @@ qla2x00_get_link_status(scsi_qla_host_t *, uint16_t, struct link_statistics *,
344 344
345extern int 345extern int
346qla24xx_get_isp_stats(scsi_qla_host_t *, struct link_statistics *, 346qla24xx_get_isp_stats(scsi_qla_host_t *, struct link_statistics *,
347 dma_addr_t); 347 dma_addr_t, uint);
348 348
349extern int qla24xx_abort_command(srb_t *); 349extern int qla24xx_abort_command(srb_t *);
350extern int qla24xx_async_abort_command(srb_t *); 350extern int qla24xx_async_abort_command(srb_t *);
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index 9673a0b645ee..583ad62f8d51 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -2762,15 +2762,16 @@ qla2x00_get_link_status(scsi_qla_host_t *vha, uint16_t loop_id,
2762 int rval; 2762 int rval;
2763 mbx_cmd_t mc; 2763 mbx_cmd_t mc;
2764 mbx_cmd_t *mcp = &mc; 2764 mbx_cmd_t *mcp = &mc;
2765 uint32_t *iter, dwords; 2765 uint32_t *iter = (void *)stats;
2766 ushort dwords = offsetof(typeof(*stats), link_up_cnt)/sizeof(*iter);
2766 struct qla_hw_data *ha = vha->hw; 2767 struct qla_hw_data *ha = vha->hw;
2767 2768
2768 ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x1084, 2769 ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x1084,
2769 "Entered %s.\n", __func__); 2770 "Entered %s.\n", __func__);
2770 2771
2771 mcp->mb[0] = MBC_GET_LINK_STATUS; 2772 mcp->mb[0] = MBC_GET_LINK_STATUS;
2772 mcp->mb[2] = MSW(stats_dma); 2773 mcp->mb[2] = MSW(LSD(stats_dma));
2773 mcp->mb[3] = LSW(stats_dma); 2774 mcp->mb[3] = LSW(LSD(stats_dma));
2774 mcp->mb[6] = MSW(MSD(stats_dma)); 2775 mcp->mb[6] = MSW(MSD(stats_dma));
2775 mcp->mb[7] = LSW(MSD(stats_dma)); 2776 mcp->mb[7] = LSW(MSD(stats_dma));
2776 mcp->out_mb = MBX_7|MBX_6|MBX_3|MBX_2|MBX_0; 2777 mcp->out_mb = MBX_7|MBX_6|MBX_3|MBX_2|MBX_0;
@@ -2799,12 +2800,9 @@ qla2x00_get_link_status(scsi_qla_host_t *vha, uint16_t loop_id,
2799 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]); 2800 "Failed=%x mb[0]=%x.\n", rval, mcp->mb[0]);
2800 rval = QLA_FUNCTION_FAILED; 2801 rval = QLA_FUNCTION_FAILED;
2801 } else { 2802 } else {
2802 /* Copy over data -- firmware data is LE. */ 2803 /* Re-endianize - firmware data is le32. */
2803 ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x1086, 2804 ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x1086,
2804 "Done %s.\n", __func__); 2805 "Done %s.\n", __func__);
2805 dwords = offsetof(struct link_statistics,
2806 link_up_cnt) / 4;
2807 iter = &stats->link_fail_cnt;
2808 for ( ; dwords--; iter++) 2806 for ( ; dwords--; iter++)
2809 le32_to_cpus(iter); 2807 le32_to_cpus(iter);
2810 } 2808 }
@@ -2818,7 +2816,7 @@ qla2x00_get_link_status(scsi_qla_host_t *vha, uint16_t loop_id,
2818 2816
2819int 2817int
2820qla24xx_get_isp_stats(scsi_qla_host_t *vha, struct link_statistics *stats, 2818qla24xx_get_isp_stats(scsi_qla_host_t *vha, struct link_statistics *stats,
2821 dma_addr_t stats_dma) 2819 dma_addr_t stats_dma, uint options)
2822{ 2820{
2823 int rval; 2821 int rval;
2824 mbx_cmd_t mc; 2822 mbx_cmd_t mc;
@@ -2835,7 +2833,7 @@ qla24xx_get_isp_stats(scsi_qla_host_t *vha, struct link_statistics *stats,
2835 mcp->mb[7] = LSW(MSD(stats_dma)); 2833 mcp->mb[7] = LSW(MSD(stats_dma));
2836 mcp->mb[8] = sizeof(struct link_statistics) / 4; 2834 mcp->mb[8] = sizeof(struct link_statistics) / 4;
2837 mcp->mb[9] = vha->vp_idx; 2835 mcp->mb[9] = vha->vp_idx;
2838 mcp->mb[10] = 0; 2836 mcp->mb[10] = options;
2839 mcp->out_mb = MBX_10|MBX_9|MBX_8|MBX_7|MBX_6|MBX_3|MBX_2|MBX_0; 2837 mcp->out_mb = MBX_10|MBX_9|MBX_8|MBX_7|MBX_6|MBX_3|MBX_2|MBX_0;
2840 mcp->in_mb = MBX_2|MBX_1|MBX_0; 2838 mcp->in_mb = MBX_2|MBX_1|MBX_0;
2841 mcp->tov = MBX_TOV_SECONDS; 2839 mcp->tov = MBX_TOV_SECONDS;
@@ -2850,7 +2848,7 @@ qla24xx_get_isp_stats(scsi_qla_host_t *vha, struct link_statistics *stats,
2850 } else { 2848 } else {
2851 ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x108a, 2849 ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x108a,
2852 "Done %s.\n", __func__); 2850 "Done %s.\n", __func__);
2853 /* Copy over data -- firmware data is LE. */ 2851 /* Re-endianize - firmware data is le32. */
2854 dwords = sizeof(struct link_statistics) / 4; 2852 dwords = sizeof(struct link_statistics) / 4;
2855 iter = &stats->link_fail_cnt; 2853 iter = &stats->link_fail_cnt;
2856 for ( ; dwords--; iter++) 2854 for ( ; dwords--; iter++)