aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/qla2xxx/qla_attr.c6
-rw-r--r--drivers/scsi/qla2xxx/qla_bsg.c61
-rw-r--r--drivers/scsi/qla2xxx/qla_bsg.h1
-rw-r--r--drivers/scsi/qla2xxx/qla_dbg.c2
-rw-r--r--drivers/scsi/qla2xxx/qla_def.h32
-rw-r--r--drivers/scsi/qla2xxx/qla_mbx.c3
6 files changed, 99 insertions, 6 deletions
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index fef659a9835c..fadce04095f1 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -1917,7 +1917,8 @@ qla2x00_get_fc_host_stats(struct Scsi_Host *shost)
1917 if (qla2x00_reset_active(vha)) 1917 if (qla2x00_reset_active(vha))
1918 goto done; 1918 goto done;
1919 1919
1920 stats = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &stats_dma); 1920 stats = dma_alloc_coherent(&ha->pdev->dev,
1921 sizeof(struct link_statistics), &stats_dma, GFP_KERNEL);
1921 if (stats == NULL) { 1922 if (stats == NULL) {
1922 ql_log(ql_log_warn, vha, 0x707d, 1923 ql_log(ql_log_warn, vha, 0x707d,
1923 "Failed to allocate memory for stats.\n"); 1924 "Failed to allocate memory for stats.\n");
@@ -1965,7 +1966,8 @@ qla2x00_get_fc_host_stats(struct Scsi_Host *shost)
1965 do_div(pfc_host_stat->seconds_since_last_reset, HZ); 1966 do_div(pfc_host_stat->seconds_since_last_reset, HZ);
1966 1967
1967done_free: 1968done_free:
1968 dma_pool_free(ha->s_dma_pool, stats, stats_dma); 1969 dma_free_coherent(&ha->pdev->dev, sizeof(struct link_statistics),
1970 stats, stats_dma);
1969done: 1971done:
1970 return pfc_host_stat; 1972 return pfc_host_stat;
1971} 1973}
diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c
index d135d6a4ccac..913fef20cd68 100644
--- a/drivers/scsi/qla2xxx/qla_bsg.c
+++ b/drivers/scsi/qla2xxx/qla_bsg.c
@@ -2233,6 +2233,64 @@ qla27xx_get_bbcr_data(struct fc_bsg_job *bsg_job)
2233} 2233}
2234 2234
2235static int 2235static int
2236qla2x00_get_priv_stats(struct fc_bsg_job *bsg_job)
2237{
2238 struct Scsi_Host *host = bsg_job->shost;
2239 scsi_qla_host_t *vha = shost_priv(host);
2240 struct qla_hw_data *ha = vha->hw;
2241 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev);
2242 struct link_statistics *stats = NULL;
2243 dma_addr_t stats_dma;
2244 int rval = QLA_FUNCTION_FAILED;
2245
2246 if (test_bit(UNLOADING, &vha->dpc_flags))
2247 goto done;
2248
2249 if (unlikely(pci_channel_offline(ha->pdev)))
2250 goto done;
2251
2252 if (qla2x00_reset_active(vha))
2253 goto done;
2254
2255 if (!IS_FWI2_CAPABLE(ha))
2256 goto done;
2257
2258 stats = dma_alloc_coherent(&ha->pdev->dev,
2259 sizeof(struct link_statistics), &stats_dma, GFP_KERNEL);
2260 if (!stats) {
2261 ql_log(ql_log_warn, vha, 0x70e2,
2262 "Failed to allocate memory for stats.\n");
2263 goto done;
2264 }
2265
2266 memset(stats, 0, sizeof(struct link_statistics));
2267
2268 rval = qla24xx_get_isp_stats(base_vha, stats, stats_dma);
2269
2270 if (rval != QLA_SUCCESS)
2271 goto done_free;
2272
2273 ql_dump_buffer(ql_dbg_user + ql_dbg_verbose, vha, 0x70e3,
2274 (uint8_t *)stats, sizeof(struct link_statistics));
2275
2276 sg_copy_from_buffer(bsg_job->reply_payload.sg_list,
2277 bsg_job->reply_payload.sg_cnt, stats, sizeof(struct link_statistics));
2278 bsg_job->reply->reply_payload_rcv_len = sizeof(struct link_statistics);
2279
2280 bsg_job->reply->reply_data.vendor_reply.vendor_rsp[0] = EXT_STATUS_OK;
2281
2282 bsg_job->reply_len = sizeof(struct fc_bsg_reply);
2283 bsg_job->reply->result = DID_OK << 16;
2284 bsg_job->job_done(bsg_job);
2285
2286done_free:
2287 dma_free_coherent(&ha->pdev->dev, sizeof(struct link_statistics),
2288 stats, stats_dma);
2289done:
2290 return rval;
2291}
2292
2293static int
2236qla2x00_process_vendor_specific(struct fc_bsg_job *bsg_job) 2294qla2x00_process_vendor_specific(struct fc_bsg_job *bsg_job)
2237{ 2295{
2238 switch (bsg_job->request->rqst_data.h_vendor.vendor_cmd[0]) { 2296 switch (bsg_job->request->rqst_data.h_vendor.vendor_cmd[0]) {
@@ -2296,6 +2354,9 @@ qla2x00_process_vendor_specific(struct fc_bsg_job *bsg_job)
2296 case QL_VND_GET_BBCR_DATA: 2354 case QL_VND_GET_BBCR_DATA:
2297 return qla27xx_get_bbcr_data(bsg_job); 2355 return qla27xx_get_bbcr_data(bsg_job);
2298 2356
2357 case QL_VND_GET_PRIV_STATS:
2358 return qla2x00_get_priv_stats(bsg_job);
2359
2299 default: 2360 default:
2300 return -ENOSYS; 2361 return -ENOSYS;
2301 } 2362 }
diff --git a/drivers/scsi/qla2xxx/qla_bsg.h b/drivers/scsi/qla2xxx/qla_bsg.h
index 42751776f363..c40dd8b608a0 100644
--- a/drivers/scsi/qla2xxx/qla_bsg.h
+++ b/drivers/scsi/qla2xxx/qla_bsg.h
@@ -28,6 +28,7 @@
28#define QL_VND_GET_FLASH_UPDATE_CAPS 0x15 28#define QL_VND_GET_FLASH_UPDATE_CAPS 0x15
29#define QL_VND_SET_FLASH_UPDATE_CAPS 0x16 29#define QL_VND_SET_FLASH_UPDATE_CAPS 0x16
30#define QL_VND_GET_BBCR_DATA 0x17 30#define QL_VND_GET_BBCR_DATA 0x17
31#define QL_VND_GET_PRIV_STATS 0x18
31 32
32/* BSG Vendor specific subcode returns */ 33/* BSG Vendor specific subcode returns */
33#define EXT_STATUS_OK 0 34#define EXT_STATUS_OK 0
diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index 493a3ea81e79..aa6694bbc303 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -32,7 +32,7 @@
32 * | | | 0x503d,0x5044 | 32 * | | | 0x503d,0x5044 |
33 * | | | 0x507b,0x505f | 33 * | | | 0x507b,0x505f |
34 * | Timer Routines | 0x6012 | | 34 * | Timer Routines | 0x6012 | |
35 * | User Space Interactions | 0x70e65 | 0x7018,0x702e | 35 * | User Space Interactions | 0x70e3 | 0x7018,0x702e |
36 * | | | 0x7020,0x7024 | 36 * | | | 0x7020,0x7024 |
37 * | | | 0x7039,0x7045 | 37 * | | | 0x7039,0x7045 |
38 * | | | 0x7073-0x7075 | 38 * | | | 0x7073-0x7075 |
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index c4bd62ade713..ceb452dd143c 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -1254,13 +1254,41 @@ struct link_statistics {
1254 uint32_t inval_xmit_word_cnt; 1254 uint32_t inval_xmit_word_cnt;
1255 uint32_t inval_crc_cnt; 1255 uint32_t inval_crc_cnt;
1256 uint32_t lip_cnt; 1256 uint32_t lip_cnt;
1257 uint32_t unused1[0x1a]; 1257 uint32_t link_up_cnt;
1258 uint32_t link_down_loop_init_tmo;
1259 uint32_t link_down_los;
1260 uint32_t link_down_loss_rcv_clk;
1261 uint32_t reserved0[5];
1262 uint32_t port_cfg_chg;
1263 uint32_t reserved1[11];
1264 uint32_t rsp_q_full;
1265 uint32_t atio_q_full;
1266 uint32_t drop_ae;
1267 uint32_t els_proto_err;
1268 uint32_t reserved2;
1258 uint32_t tx_frames; 1269 uint32_t tx_frames;
1259 uint32_t rx_frames; 1270 uint32_t rx_frames;
1260 uint32_t discarded_frames; 1271 uint32_t discarded_frames;
1261 uint32_t dropped_frames; 1272 uint32_t dropped_frames;
1262 uint32_t unused2[1]; 1273 uint32_t reserved3;
1263 uint32_t nos_rcvd; 1274 uint32_t nos_rcvd;
1275 uint32_t reserved4[4];
1276 uint32_t tx_prjt;
1277 uint32_t rcv_exfail;
1278 uint32_t rcv_abts;
1279 uint32_t seq_frm_miss;
1280 uint32_t corr_err;
1281 uint32_t mb_rqst;
1282 uint32_t nport_full;
1283 uint32_t eofa;
1284 uint32_t reserved5;
1285 uint32_t fpm_recv_word_cnt_lo;
1286 uint32_t fpm_recv_word_cnt_hi;
1287 uint32_t fpm_disc_word_cnt_lo;
1288 uint32_t fpm_disc_word_cnt_hi;
1289 uint32_t fpm_xmit_word_cnt_lo;
1290 uint32_t fpm_xmit_word_cnt_hi;
1291 uint32_t reserved6[70];
1264}; 1292};
1265 1293
1266/* 1294/*
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index 4433cfb8f0e6..3dd339846a55 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -2799,7 +2799,8 @@ qla2x00_get_link_status(scsi_qla_host_t *vha, uint16_t loop_id,
2799 /* Copy over data -- firmware data is LE. */ 2799 /* Copy over data -- firmware data is LE. */
2800 ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x1086, 2800 ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x1086,
2801 "Done %s.\n", __func__); 2801 "Done %s.\n", __func__);
2802 dwords = offsetof(struct link_statistics, unused1) / 4; 2802 dwords = offsetof(struct link_statistics,
2803 link_up_cnt) / 4;
2803 siter = diter = &stats->link_fail_cnt; 2804 siter = diter = &stats->link_fail_cnt;
2804 while (dwords--) 2805 while (dwords--)
2805 *diter++ = le32_to_cpu(*siter++); 2806 *diter++ = le32_to_cpu(*siter++);