hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/scsi/lpfc/lpfc_debugfs.c
....@@ -1,7 +1,7 @@
11 /*******************************************************************
22 * This file is part of the Emulex Linux Device Driver for *
33 * Fibre Channel Host Bus Adapters. *
4
- * Copyright (C) 2017-2018 Broadcom. All Rights Reserved. The term *
4
+ * Copyright (C) 2017-2019 Broadcom. All Rights Reserved. The term *
55 * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. *
66 * Copyright (C) 2007-2015 Emulex. All rights reserved. *
77 * EMULEX and SLI are trademarks of Emulex. *
....@@ -31,14 +31,13 @@
3131 #include <linux/pci.h>
3232 #include <linux/spinlock.h>
3333 #include <linux/ctype.h>
34
+#include <linux/vmalloc.h>
3435
3536 #include <scsi/scsi.h>
3637 #include <scsi/scsi_device.h>
3738 #include <scsi/scsi_host.h>
3839 #include <scsi/scsi_transport_fc.h>
3940 #include <scsi/fc/fc_fs.h>
40
-
41
-#include <linux/nvme-fc-driver.h>
4241
4342 #include "lpfc_hw4.h"
4443 #include "lpfc_hw.h"
....@@ -49,7 +48,6 @@
4948 #include "lpfc.h"
5049 #include "lpfc_scsi.h"
5150 #include "lpfc_nvme.h"
52
-#include "lpfc_nvmet.h"
5351 #include "lpfc_logmsg.h"
5452 #include "lpfc_crtn.h"
5553 #include "lpfc_vport.h"
....@@ -361,7 +359,7 @@
361359 phys = ((uint64_t)hbq_buf->dbuf.phys & 0xffffffff);
362360 if (phys == le32_to_cpu(hbqe->bde.addrLow)) {
363361 len += scnprintf(buf+len, size-len,
364
- "Buf%d: %p %06x\n", i,
362
+ "Buf%d: x%px %06x\n", i,
365363 hbq_buf->dbuf.virt, hbq_buf->tag);
366364 found = 1;
367365 break;
....@@ -379,6 +377,267 @@
379377 spin_unlock_irq(&phba->hbalock);
380378 return len;
381379 }
380
+
381
+static int lpfc_debugfs_last_xripool;
382
+
383
+/**
384
+ * lpfc_debugfs_common_xri_data - Dump Hardware Queue info to a buffer
385
+ * @phba: The HBA to gather host buffer info from.
386
+ * @buf: The buffer to dump log into.
387
+ * @size: The maximum amount of data to process.
388
+ *
389
+ * Description:
390
+ * This routine dumps the Hardware Queue info from the @phba to @buf up to
391
+ * @size number of bytes. A header that describes the current hdwq state will be
392
+ * dumped to @buf first and then info on each hdwq entry will be dumped to @buf
393
+ * until @size bytes have been dumped or all the hdwq info has been dumped.
394
+ *
395
+ * Notes:
396
+ * This routine will rotate through each configured Hardware Queue each
397
+ * time called.
398
+ *
399
+ * Return Value:
400
+ * This routine returns the amount of bytes that were dumped into @buf and will
401
+ * not exceed @size.
402
+ **/
403
+static int
404
+lpfc_debugfs_commonxripools_data(struct lpfc_hba *phba, char *buf, int size)
405
+{
406
+ struct lpfc_sli4_hdw_queue *qp;
407
+ int len = 0;
408
+ int i, out;
409
+ unsigned long iflag;
410
+
411
+ for (i = 0; i < phba->cfg_hdw_queue; i++) {
412
+ if (len > (LPFC_DUMP_MULTIXRIPOOL_SIZE - 80))
413
+ break;
414
+ qp = &phba->sli4_hba.hdwq[lpfc_debugfs_last_xripool];
415
+
416
+ len += scnprintf(buf + len, size - len, "HdwQ %d Info ", i);
417
+ spin_lock_irqsave(&qp->abts_io_buf_list_lock, iflag);
418
+ spin_lock(&qp->io_buf_list_get_lock);
419
+ spin_lock(&qp->io_buf_list_put_lock);
420
+ out = qp->total_io_bufs - (qp->get_io_bufs + qp->put_io_bufs +
421
+ qp->abts_scsi_io_bufs + qp->abts_nvme_io_bufs);
422
+ len += scnprintf(buf + len, size - len,
423
+ "tot:%d get:%d put:%d mt:%d "
424
+ "ABTS scsi:%d nvme:%d Out:%d\n",
425
+ qp->total_io_bufs, qp->get_io_bufs, qp->put_io_bufs,
426
+ qp->empty_io_bufs, qp->abts_scsi_io_bufs,
427
+ qp->abts_nvme_io_bufs, out);
428
+ spin_unlock(&qp->io_buf_list_put_lock);
429
+ spin_unlock(&qp->io_buf_list_get_lock);
430
+ spin_unlock_irqrestore(&qp->abts_io_buf_list_lock, iflag);
431
+
432
+ lpfc_debugfs_last_xripool++;
433
+ if (lpfc_debugfs_last_xripool >= phba->cfg_hdw_queue)
434
+ lpfc_debugfs_last_xripool = 0;
435
+ }
436
+
437
+ return len;
438
+}
439
+
440
+/**
441
+ * lpfc_debugfs_multixripools_data - Display multi-XRI pools information
442
+ * @phba: The HBA to gather host buffer info from.
443
+ * @buf: The buffer to dump log into.
444
+ * @size: The maximum amount of data to process.
445
+ *
446
+ * Description:
447
+ * This routine displays current multi-XRI pools information including XRI
448
+ * count in public, private and txcmplq. It also displays current high and
449
+ * low watermark.
450
+ *
451
+ * Return Value:
452
+ * This routine returns the amount of bytes that were dumped into @buf and will
453
+ * not exceed @size.
454
+ **/
455
+static int
456
+lpfc_debugfs_multixripools_data(struct lpfc_hba *phba, char *buf, int size)
457
+{
458
+ u32 i;
459
+ u32 hwq_count;
460
+ struct lpfc_sli4_hdw_queue *qp;
461
+ struct lpfc_multixri_pool *multixri_pool;
462
+ struct lpfc_pvt_pool *pvt_pool;
463
+ struct lpfc_pbl_pool *pbl_pool;
464
+ u32 txcmplq_cnt;
465
+ char tmp[LPFC_DEBUG_OUT_LINE_SZ] = {0};
466
+
467
+ if (phba->sli_rev != LPFC_SLI_REV4)
468
+ return 0;
469
+
470
+ if (!phba->sli4_hba.hdwq)
471
+ return 0;
472
+
473
+ if (!phba->cfg_xri_rebalancing) {
474
+ i = lpfc_debugfs_commonxripools_data(phba, buf, size);
475
+ return i;
476
+ }
477
+
478
+ /*
479
+ * Pbl: Current number of free XRIs in public pool
480
+ * Pvt: Current number of free XRIs in private pool
481
+ * Busy: Current number of outstanding XRIs
482
+ * HWM: Current high watermark
483
+ * pvt_empty: Incremented by 1 when IO submission fails (no xri)
484
+ * pbl_empty: Incremented by 1 when all pbl_pool are empty during
485
+ * IO submission
486
+ */
487
+ scnprintf(tmp, sizeof(tmp),
488
+ "HWQ: Pbl Pvt Busy HWM | pvt_empty pbl_empty ");
489
+ if (strlcat(buf, tmp, size) >= size)
490
+ return strnlen(buf, size);
491
+
492
+#ifdef LPFC_MXP_STAT
493
+ /*
494
+ * MAXH: Max high watermark seen so far
495
+ * above_lmt: Incremented by 1 if xri_owned > xri_limit during
496
+ * IO submission
497
+ * below_lmt: Incremented by 1 if xri_owned <= xri_limit during
498
+ * IO submission
499
+ * locPbl_hit: Incremented by 1 if successfully get a batch of XRI from
500
+ * local pbl_pool
501
+ * othPbl_hit: Incremented by 1 if successfully get a batch of XRI from
502
+ * other pbl_pool
503
+ */
504
+ scnprintf(tmp, sizeof(tmp),
505
+ "MAXH above_lmt below_lmt locPbl_hit othPbl_hit");
506
+ if (strlcat(buf, tmp, size) >= size)
507
+ return strnlen(buf, size);
508
+
509
+ /*
510
+ * sPbl: snapshot of Pbl 15 sec after stat gets cleared
511
+ * sPvt: snapshot of Pvt 15 sec after stat gets cleared
512
+ * sBusy: snapshot of Busy 15 sec after stat gets cleared
513
+ */
514
+ scnprintf(tmp, sizeof(tmp),
515
+ " | sPbl sPvt sBusy");
516
+ if (strlcat(buf, tmp, size) >= size)
517
+ return strnlen(buf, size);
518
+#endif
519
+
520
+ scnprintf(tmp, sizeof(tmp), "\n");
521
+ if (strlcat(buf, tmp, size) >= size)
522
+ return strnlen(buf, size);
523
+
524
+ hwq_count = phba->cfg_hdw_queue;
525
+ for (i = 0; i < hwq_count; i++) {
526
+ qp = &phba->sli4_hba.hdwq[i];
527
+ multixri_pool = qp->p_multixri_pool;
528
+ if (!multixri_pool)
529
+ continue;
530
+ pbl_pool = &multixri_pool->pbl_pool;
531
+ pvt_pool = &multixri_pool->pvt_pool;
532
+ txcmplq_cnt = qp->io_wq->pring->txcmplq_cnt;
533
+
534
+ scnprintf(tmp, sizeof(tmp),
535
+ "%03d: %4d %4d %4d %4d | %10d %10d ",
536
+ i, pbl_pool->count, pvt_pool->count,
537
+ txcmplq_cnt, pvt_pool->high_watermark,
538
+ qp->empty_io_bufs, multixri_pool->pbl_empty_count);
539
+ if (strlcat(buf, tmp, size) >= size)
540
+ break;
541
+
542
+#ifdef LPFC_MXP_STAT
543
+ scnprintf(tmp, sizeof(tmp),
544
+ "%4d %10d %10d %10d %10d",
545
+ multixri_pool->stat_max_hwm,
546
+ multixri_pool->above_limit_count,
547
+ multixri_pool->below_limit_count,
548
+ multixri_pool->local_pbl_hit_count,
549
+ multixri_pool->other_pbl_hit_count);
550
+ if (strlcat(buf, tmp, size) >= size)
551
+ break;
552
+
553
+ scnprintf(tmp, sizeof(tmp),
554
+ " | %4d %4d %5d",
555
+ multixri_pool->stat_pbl_count,
556
+ multixri_pool->stat_pvt_count,
557
+ multixri_pool->stat_busy_count);
558
+ if (strlcat(buf, tmp, size) >= size)
559
+ break;
560
+#endif
561
+
562
+ scnprintf(tmp, sizeof(tmp), "\n");
563
+ if (strlcat(buf, tmp, size) >= size)
564
+ break;
565
+ }
566
+ return strnlen(buf, size);
567
+}
568
+
569
+
570
+#ifdef LPFC_HDWQ_LOCK_STAT
571
+static int lpfc_debugfs_last_lock;
572
+
573
+/**
574
+ * lpfc_debugfs_lockstat_data - Dump Hardware Queue info to a buffer
575
+ * @phba: The HBA to gather host buffer info from.
576
+ * @buf: The buffer to dump log into.
577
+ * @size: The maximum amount of data to process.
578
+ *
579
+ * Description:
580
+ * This routine dumps the Hardware Queue info from the @phba to @buf up to
581
+ * @size number of bytes. A header that describes the current hdwq state will be
582
+ * dumped to @buf first and then info on each hdwq entry will be dumped to @buf
583
+ * until @size bytes have been dumped or all the hdwq info has been dumped.
584
+ *
585
+ * Notes:
586
+ * This routine will rotate through each configured Hardware Queue each
587
+ * time called.
588
+ *
589
+ * Return Value:
590
+ * This routine returns the amount of bytes that were dumped into @buf and will
591
+ * not exceed @size.
592
+ **/
593
+static int
594
+lpfc_debugfs_lockstat_data(struct lpfc_hba *phba, char *buf, int size)
595
+{
596
+ struct lpfc_sli4_hdw_queue *qp;
597
+ int len = 0;
598
+ int i;
599
+
600
+ if (phba->sli_rev != LPFC_SLI_REV4)
601
+ return 0;
602
+
603
+ if (!phba->sli4_hba.hdwq)
604
+ return 0;
605
+
606
+ for (i = 0; i < phba->cfg_hdw_queue; i++) {
607
+ if (len > (LPFC_HDWQINFO_SIZE - 100))
608
+ break;
609
+ qp = &phba->sli4_hba.hdwq[lpfc_debugfs_last_lock];
610
+
611
+ len += scnprintf(buf + len, size - len, "HdwQ %03d Lock ", i);
612
+ if (phba->cfg_xri_rebalancing) {
613
+ len += scnprintf(buf + len, size - len,
614
+ "get_pvt:%d mv_pvt:%d "
615
+ "mv2pub:%d mv2pvt:%d "
616
+ "put_pvt:%d put_pub:%d wq:%d\n",
617
+ qp->lock_conflict.alloc_pvt_pool,
618
+ qp->lock_conflict.mv_from_pvt_pool,
619
+ qp->lock_conflict.mv_to_pub_pool,
620
+ qp->lock_conflict.mv_to_pvt_pool,
621
+ qp->lock_conflict.free_pvt_pool,
622
+ qp->lock_conflict.free_pub_pool,
623
+ qp->lock_conflict.wq_access);
624
+ } else {
625
+ len += scnprintf(buf + len, size - len,
626
+ "get:%d put:%d free:%d wq:%d\n",
627
+ qp->lock_conflict.alloc_xri_get,
628
+ qp->lock_conflict.alloc_xri_put,
629
+ qp->lock_conflict.free_xri,
630
+ qp->lock_conflict.wq_access);
631
+ }
632
+
633
+ lpfc_debugfs_last_lock++;
634
+ if (lpfc_debugfs_last_lock >= phba->cfg_hdw_queue)
635
+ lpfc_debugfs_last_lock = 0;
636
+ }
637
+
638
+ return len;
639
+}
640
+#endif
382641
383642 static int lpfc_debugfs_last_hba_slim_off;
384643
....@@ -552,7 +811,6 @@
552811 struct lpfc_nodelist *ndlp;
553812 unsigned char *statep;
554813 struct nvme_fc_local_port *localport;
555
- struct lpfc_nvmet_tgtport *tgtp;
556814 struct nvme_fc_remote_port *nrport = NULL;
557815 struct lpfc_nvme_rport *rport;
558816
....@@ -648,6 +906,8 @@
648906 i, ndlp->cmd_qdepth);
649907 outio += i;
650908 }
909
+ len += scnprintf(buf + len, size - len, "defer:%x ",
910
+ ndlp->nlp_defer_did);
651911 len += scnprintf(buf+len, size-len, "\n");
652912 }
653913 spin_unlock_irq(shost->host_lock);
....@@ -656,7 +916,6 @@
656916 "\nOutstanding IO x%x\n", outio);
657917
658918 if (phba->nvmet_support && phba->targetport && (vport == phba->pport)) {
659
- tgtp = (struct lpfc_nvmet_tgtport *)phba->targetport->private;
660919 len += scnprintf(buf + len, size - len,
661920 "\nNVME Targetport Entry ...\n");
662921
....@@ -773,13 +1032,13 @@
7731032 {
7741033 struct lpfc_hba *phba = vport->phba;
7751034 struct lpfc_nvmet_tgtport *tgtp;
776
- struct lpfc_nvmet_rcv_ctx *ctxp, *next_ctxp;
1035
+ struct lpfc_async_xchg_ctx *ctxp, *next_ctxp;
7771036 struct nvme_fc_local_port *localport;
778
- struct lpfc_nvme_ctrl_stat *cstat;
1037
+ struct lpfc_fc4_ctrl_stat *cstat;
7791038 struct lpfc_nvme_lport *lport;
7801039 uint64_t data1, data2, data3;
7811040 uint64_t tot, totin, totout;
782
- int cnt, i, maxch;
1041
+ int cnt, i;
7831042 int len = 0;
7841043
7851044 if (phba->nvmet_support) {
....@@ -865,17 +1124,17 @@
8651124 len += scnprintf(buf + len, size - len, "\n");
8661125
8671126 cnt = 0;
868
- spin_lock(&phba->sli4_hba.abts_nvme_buf_list_lock);
1127
+ spin_lock(&phba->sli4_hba.abts_nvmet_buf_list_lock);
8691128 list_for_each_entry_safe(ctxp, next_ctxp,
8701129 &phba->sli4_hba.lpfc_abts_nvmet_ctx_list,
8711130 list) {
8721131 cnt++;
8731132 }
874
- spin_unlock(&phba->sli4_hba.abts_nvme_buf_list_lock);
1133
+ spin_unlock(&phba->sli4_hba.abts_nvmet_buf_list_lock);
8751134 if (cnt) {
8761135 len += scnprintf(buf + len, size - len,
8771136 "ABORT: %d ctx entries\n", cnt);
878
- spin_lock(&phba->sli4_hba.abts_nvme_buf_list_lock);
1137
+ spin_lock(&phba->sli4_hba.abts_nvmet_buf_list_lock);
8791138 list_for_each_entry_safe(ctxp, next_ctxp,
8801139 &phba->sli4_hba.lpfc_abts_nvmet_ctx_list,
8811140 list) {
....@@ -887,7 +1146,7 @@
8871146 ctxp->oxid, ctxp->state,
8881147 ctxp->flag);
8891148 }
890
- spin_unlock(&phba->sli4_hba.abts_nvme_buf_list_lock);
1149
+ spin_unlock(&phba->sli4_hba.abts_nvmet_buf_list_lock);
8911150 }
8921151
8931152 /* Calculate outstanding IOs */
....@@ -903,7 +1162,7 @@
9031162 phba->sli4_hba.nvmet_io_wait_total,
9041163 tot);
9051164 } else {
906
- if (!(phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME))
1165
+ if (!(vport->cfg_enable_fc4_type & LPFC_ENABLE_NVME))
9071166 return len;
9081167
9091168 localport = vport->localport;
....@@ -914,26 +1173,22 @@
9141173 return len;
9151174
9161175 len += scnprintf(buf + len, size - len,
917
- "\nNVME Lport Statistics\n");
1176
+ "\nNVME HDWQ Statistics\n");
9181177
9191178 len += scnprintf(buf + len, size - len,
9201179 "LS: Xmt %016x Cmpl %016x\n",
9211180 atomic_read(&lport->fc4NvmeLsRequests),
9221181 atomic_read(&lport->fc4NvmeLsCmpls));
9231182
924
- if (phba->cfg_nvme_io_channel < 32)
925
- maxch = phba->cfg_nvme_io_channel;
926
- else
927
- maxch = 32;
9281183 totin = 0;
9291184 totout = 0;
930
- for (i = 0; i < phba->cfg_nvme_io_channel; i++) {
931
- cstat = &lport->cstat[i];
932
- tot = atomic_read(&cstat->fc4NvmeIoCmpls);
1185
+ for (i = 0; i < phba->cfg_hdw_queue; i++) {
1186
+ cstat = &phba->sli4_hba.hdwq[i].nvme_cstat;
1187
+ tot = cstat->io_cmpls;
9331188 totin += tot;
934
- data1 = atomic_read(&cstat->fc4NvmeInputRequests);
935
- data2 = atomic_read(&cstat->fc4NvmeOutputRequests);
936
- data3 = atomic_read(&cstat->fc4NvmeControlRequests);
1189
+ data1 = cstat->input_requests;
1190
+ data2 = cstat->output_requests;
1191
+ data3 = cstat->control_requests;
9371192 totout += (data1 + data2 + data3);
9381193
9391194 /* Limit to 32, debugfs display buffer limitation */
....@@ -941,7 +1196,7 @@
9411196 continue;
9421197
9431198 len += scnprintf(buf + len, PAGE_SIZE - len,
944
- "FCP (%d): Rd %016llx Wr %016llx "
1199
+ "HDWQ (%d): Rd %016llx Wr %016llx "
9451200 "IO %016llx ",
9461201 i, data1, data2, data3);
9471202 len += scnprintf(buf + len, PAGE_SIZE - len,
....@@ -981,9 +1236,149 @@
9811236 return len;
9821237 }
9831238
1239
+/**
1240
+ * lpfc_debugfs_scsistat_data - Dump target node list to a buffer
1241
+ * @vport: The vport to gather target node info from.
1242
+ * @buf: The buffer to dump log into.
1243
+ * @size: The maximum amount of data to process.
1244
+ *
1245
+ * Description:
1246
+ * This routine dumps the SCSI statistics associated with @vport
1247
+ *
1248
+ * Return Value:
1249
+ * This routine returns the amount of bytes that were dumped into @buf and will
1250
+ * not exceed @size.
1251
+ **/
1252
+static int
1253
+lpfc_debugfs_scsistat_data(struct lpfc_vport *vport, char *buf, int size)
1254
+{
1255
+ int len;
1256
+ struct lpfc_hba *phba = vport->phba;
1257
+ struct lpfc_fc4_ctrl_stat *cstat;
1258
+ u64 data1, data2, data3;
1259
+ u64 tot, totin, totout;
1260
+ int i;
1261
+ char tmp[LPFC_MAX_SCSI_INFO_TMP_LEN] = {0};
1262
+
1263
+ if (!(vport->cfg_enable_fc4_type & LPFC_ENABLE_FCP) ||
1264
+ (phba->sli_rev != LPFC_SLI_REV4))
1265
+ return 0;
1266
+
1267
+ scnprintf(buf, size, "SCSI HDWQ Statistics\n");
1268
+
1269
+ totin = 0;
1270
+ totout = 0;
1271
+ for (i = 0; i < phba->cfg_hdw_queue; i++) {
1272
+ cstat = &phba->sli4_hba.hdwq[i].scsi_cstat;
1273
+ tot = cstat->io_cmpls;
1274
+ totin += tot;
1275
+ data1 = cstat->input_requests;
1276
+ data2 = cstat->output_requests;
1277
+ data3 = cstat->control_requests;
1278
+ totout += (data1 + data2 + data3);
1279
+
1280
+ scnprintf(tmp, sizeof(tmp), "HDWQ (%d): Rd %016llx Wr %016llx "
1281
+ "IO %016llx ", i, data1, data2, data3);
1282
+ if (strlcat(buf, tmp, size) >= size)
1283
+ goto buffer_done;
1284
+
1285
+ scnprintf(tmp, sizeof(tmp), "Cmpl %016llx OutIO %016llx\n",
1286
+ tot, ((data1 + data2 + data3) - tot));
1287
+ if (strlcat(buf, tmp, size) >= size)
1288
+ goto buffer_done;
1289
+ }
1290
+ scnprintf(tmp, sizeof(tmp), "Total FCP Cmpl %016llx Issue %016llx "
1291
+ "OutIO %016llx\n", totin, totout, totout - totin);
1292
+ strlcat(buf, tmp, size);
1293
+
1294
+buffer_done:
1295
+ len = strnlen(buf, size);
1296
+
1297
+ return len;
1298
+}
1299
+
1300
+void
1301
+lpfc_io_ktime(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd)
1302
+{
1303
+ uint64_t seg1, seg2, seg3, seg4;
1304
+ uint64_t segsum;
1305
+
1306
+ if (!lpfc_cmd->ts_last_cmd ||
1307
+ !lpfc_cmd->ts_cmd_start ||
1308
+ !lpfc_cmd->ts_cmd_wqput ||
1309
+ !lpfc_cmd->ts_isr_cmpl ||
1310
+ !lpfc_cmd->ts_data_io)
1311
+ return;
1312
+
1313
+ if (lpfc_cmd->ts_data_io < lpfc_cmd->ts_cmd_start)
1314
+ return;
1315
+ if (lpfc_cmd->ts_cmd_start < lpfc_cmd->ts_last_cmd)
1316
+ return;
1317
+ if (lpfc_cmd->ts_cmd_wqput < lpfc_cmd->ts_cmd_start)
1318
+ return;
1319
+ if (lpfc_cmd->ts_isr_cmpl < lpfc_cmd->ts_cmd_wqput)
1320
+ return;
1321
+ if (lpfc_cmd->ts_data_io < lpfc_cmd->ts_isr_cmpl)
1322
+ return;
1323
+ /*
1324
+ * Segment 1 - Time from Last FCP command cmpl is handed
1325
+ * off to NVME Layer to start of next command.
1326
+ * Segment 2 - Time from Driver receives a IO cmd start
1327
+ * from NVME Layer to WQ put is done on IO cmd.
1328
+ * Segment 3 - Time from Driver WQ put is done on IO cmd
1329
+ * to MSI-X ISR for IO cmpl.
1330
+ * Segment 4 - Time from MSI-X ISR for IO cmpl to when
1331
+ * cmpl is handled off to the NVME Layer.
1332
+ */
1333
+ seg1 = lpfc_cmd->ts_cmd_start - lpfc_cmd->ts_last_cmd;
1334
+ if (seg1 > 5000000) /* 5 ms - for sequential IOs only */
1335
+ seg1 = 0;
1336
+
1337
+ /* Calculate times relative to start of IO */
1338
+ seg2 = (lpfc_cmd->ts_cmd_wqput - lpfc_cmd->ts_cmd_start);
1339
+ segsum = seg2;
1340
+ seg3 = lpfc_cmd->ts_isr_cmpl - lpfc_cmd->ts_cmd_start;
1341
+ if (segsum > seg3)
1342
+ return;
1343
+ seg3 -= segsum;
1344
+ segsum += seg3;
1345
+
1346
+ seg4 = lpfc_cmd->ts_data_io - lpfc_cmd->ts_cmd_start;
1347
+ if (segsum > seg4)
1348
+ return;
1349
+ seg4 -= segsum;
1350
+
1351
+ phba->ktime_data_samples++;
1352
+ phba->ktime_seg1_total += seg1;
1353
+ if (seg1 < phba->ktime_seg1_min)
1354
+ phba->ktime_seg1_min = seg1;
1355
+ else if (seg1 > phba->ktime_seg1_max)
1356
+ phba->ktime_seg1_max = seg1;
1357
+ phba->ktime_seg2_total += seg2;
1358
+ if (seg2 < phba->ktime_seg2_min)
1359
+ phba->ktime_seg2_min = seg2;
1360
+ else if (seg2 > phba->ktime_seg2_max)
1361
+ phba->ktime_seg2_max = seg2;
1362
+ phba->ktime_seg3_total += seg3;
1363
+ if (seg3 < phba->ktime_seg3_min)
1364
+ phba->ktime_seg3_min = seg3;
1365
+ else if (seg3 > phba->ktime_seg3_max)
1366
+ phba->ktime_seg3_max = seg3;
1367
+ phba->ktime_seg4_total += seg4;
1368
+ if (seg4 < phba->ktime_seg4_min)
1369
+ phba->ktime_seg4_min = seg4;
1370
+ else if (seg4 > phba->ktime_seg4_max)
1371
+ phba->ktime_seg4_max = seg4;
1372
+
1373
+ lpfc_cmd->ts_last_cmd = 0;
1374
+ lpfc_cmd->ts_cmd_start = 0;
1375
+ lpfc_cmd->ts_cmd_wqput = 0;
1376
+ lpfc_cmd->ts_isr_cmpl = 0;
1377
+ lpfc_cmd->ts_data_io = 0;
1378
+}
9841379
9851380 /**
986
- * lpfc_debugfs_nvmektime_data - Dump target node list to a buffer
1381
+ * lpfc_debugfs_ioktime_data - Dump target node list to a buffer
9871382 * @vport: The vport to gather target node info from.
9881383 * @buf: The buffer to dump log into.
9891384 * @size: The maximum amount of data to process.
....@@ -996,13 +1391,13 @@
9961391 * not exceed @size.
9971392 **/
9981393 static int
999
-lpfc_debugfs_nvmektime_data(struct lpfc_vport *vport, char *buf, int size)
1394
+lpfc_debugfs_ioktime_data(struct lpfc_vport *vport, char *buf, int size)
10001395 {
10011396 struct lpfc_hba *phba = vport->phba;
10021397 int len = 0;
10031398
10041399 if (phba->nvmet_support == 0) {
1005
- /* NVME Initiator */
1400
+ /* Initiator */
10061401 len += scnprintf(buf + len, PAGE_SIZE - len,
10071402 "ktime %s: Total Samples: %lld\n",
10081403 (phba->ktime_on ? "Enabled" : "Disabled"),
....@@ -1012,8 +1407,8 @@
10121407
10131408 len += scnprintf(
10141409 buf + len, PAGE_SIZE - len,
1015
- "Segment 1: Last NVME Cmd cmpl "
1016
- "done -to- Start of next NVME cnd (in driver)\n");
1410
+ "Segment 1: Last Cmd cmpl "
1411
+ "done -to- Start of next Cmd (in driver)\n");
10171412 len += scnprintf(
10181413 buf + len, PAGE_SIZE - len,
10191414 "avg:%08lld min:%08lld max %08lld\n",
....@@ -1023,7 +1418,7 @@
10231418 phba->ktime_seg1_max);
10241419 len += scnprintf(
10251420 buf + len, PAGE_SIZE - len,
1026
- "Segment 2: Driver start of NVME cmd "
1421
+ "Segment 2: Driver start of Cmd "
10271422 "-to- Firmware WQ doorbell\n");
10281423 len += scnprintf(
10291424 buf + len, PAGE_SIZE - len,
....@@ -1046,7 +1441,7 @@
10461441 len += scnprintf(
10471442 buf + len, PAGE_SIZE - len,
10481443 "Segment 4: MSI-X ISR cmpl -to- "
1049
- "NVME cmpl done\n");
1444
+ "Cmd cmpl done\n");
10501445 len += scnprintf(
10511446 buf + len, PAGE_SIZE - len,
10521447 "avg:%08lld min:%08lld max %08lld\n",
....@@ -1285,78 +1680,124 @@
12851680 }
12861681
12871682 /**
1288
- * lpfc_debugfs_cpucheck_data - Dump target node list to a buffer
1683
+ * lpfc_debugfs_hdwqstat_data - Dump I/O stats to a buffer
12891684 * @vport: The vport to gather target node info from.
12901685 * @buf: The buffer to dump log into.
12911686 * @size: The maximum amount of data to process.
12921687 *
12931688 * Description:
1294
- * This routine dumps the NVME statistics associated with @vport
1689
+ * This routine dumps the NVME + SCSI statistics associated with @vport
12951690 *
12961691 * Return Value:
12971692 * This routine returns the amount of bytes that were dumped into @buf and will
12981693 * not exceed @size.
12991694 **/
13001695 static int
1301
-lpfc_debugfs_cpucheck_data(struct lpfc_vport *vport, char *buf, int size)
1696
+lpfc_debugfs_hdwqstat_data(struct lpfc_vport *vport, char *buf, int size)
13021697 {
13031698 struct lpfc_hba *phba = vport->phba;
1304
- int i;
1305
- int len = 0;
1306
- uint32_t tot_xmt = 0;
1307
- uint32_t tot_rcv = 0;
1308
- uint32_t tot_cmpl = 0;
1309
- uint32_t tot_ccmpl = 0;
1699
+ struct lpfc_hdwq_stat *c_stat;
1700
+ int i, j, len;
1701
+ uint32_t tot_xmt;
1702
+ uint32_t tot_rcv;
1703
+ uint32_t tot_cmpl;
1704
+ char tmp[LPFC_MAX_SCSI_INFO_TMP_LEN] = {0};
13101705
1311
- if (phba->nvmet_support == 0) {
1312
- /* NVME Initiator */
1313
- len += scnprintf(buf + len, PAGE_SIZE - len,
1314
- "CPUcheck %s\n",
1315
- (phba->cpucheck_on & LPFC_CHECK_NVME_IO ?
1316
- "Enabled" : "Disabled"));
1317
- for (i = 0; i < phba->sli4_hba.num_present_cpu; i++) {
1318
- if (i >= LPFC_CHECK_CPU_CNT)
1319
- break;
1320
- len += scnprintf(buf + len, PAGE_SIZE - len,
1321
- "%02d: xmit x%08x cmpl x%08x\n",
1322
- i, phba->cpucheck_xmt_io[i],
1323
- phba->cpucheck_cmpl_io[i]);
1324
- tot_xmt += phba->cpucheck_xmt_io[i];
1325
- tot_cmpl += phba->cpucheck_cmpl_io[i];
1706
+ scnprintf(tmp, sizeof(tmp), "HDWQ Stats:\n\n");
1707
+ if (strlcat(buf, tmp, size) >= size)
1708
+ goto buffer_done;
1709
+
1710
+ scnprintf(tmp, sizeof(tmp), "(NVME Accounting: %s) ",
1711
+ (phba->hdwqstat_on &
1712
+ (LPFC_CHECK_NVME_IO | LPFC_CHECK_NVMET_IO) ?
1713
+ "Enabled" : "Disabled"));
1714
+ if (strlcat(buf, tmp, size) >= size)
1715
+ goto buffer_done;
1716
+
1717
+ scnprintf(tmp, sizeof(tmp), "(SCSI Accounting: %s) ",
1718
+ (phba->hdwqstat_on & LPFC_CHECK_SCSI_IO ?
1719
+ "Enabled" : "Disabled"));
1720
+ if (strlcat(buf, tmp, size) >= size)
1721
+ goto buffer_done;
1722
+
1723
+ scnprintf(tmp, sizeof(tmp), "\n\n");
1724
+ if (strlcat(buf, tmp, size) >= size)
1725
+ goto buffer_done;
1726
+
1727
+ for (i = 0; i < phba->cfg_hdw_queue; i++) {
1728
+ tot_rcv = 0;
1729
+ tot_xmt = 0;
1730
+ tot_cmpl = 0;
1731
+
1732
+ for_each_present_cpu(j) {
1733
+ c_stat = per_cpu_ptr(phba->sli4_hba.c_stat, j);
1734
+
1735
+ /* Only display for this HDWQ */
1736
+ if (i != c_stat->hdwq_no)
1737
+ continue;
1738
+
1739
+ /* Only display non-zero counters */
1740
+ if (!c_stat->xmt_io && !c_stat->cmpl_io &&
1741
+ !c_stat->rcv_io)
1742
+ continue;
1743
+
1744
+ if (!tot_xmt && !tot_cmpl && !tot_rcv) {
1745
+ /* Print HDWQ string only the first time */
1746
+ scnprintf(tmp, sizeof(tmp), "[HDWQ %d]:\t", i);
1747
+ if (strlcat(buf, tmp, size) >= size)
1748
+ goto buffer_done;
1749
+ }
1750
+
1751
+ tot_xmt += c_stat->xmt_io;
1752
+ tot_cmpl += c_stat->cmpl_io;
1753
+ if (phba->nvmet_support)
1754
+ tot_rcv += c_stat->rcv_io;
1755
+
1756
+ scnprintf(tmp, sizeof(tmp), "| [CPU %d]: ", j);
1757
+ if (strlcat(buf, tmp, size) >= size)
1758
+ goto buffer_done;
1759
+
1760
+ if (phba->nvmet_support) {
1761
+ scnprintf(tmp, sizeof(tmp),
1762
+ "XMT 0x%x CMPL 0x%x RCV 0x%x |",
1763
+ c_stat->xmt_io, c_stat->cmpl_io,
1764
+ c_stat->rcv_io);
1765
+ if (strlcat(buf, tmp, size) >= size)
1766
+ goto buffer_done;
1767
+ } else {
1768
+ scnprintf(tmp, sizeof(tmp),
1769
+ "XMT 0x%x CMPL 0x%x |",
1770
+ c_stat->xmt_io, c_stat->cmpl_io);
1771
+ if (strlcat(buf, tmp, size) >= size)
1772
+ goto buffer_done;
1773
+ }
13261774 }
1327
- len += scnprintf(buf + len, PAGE_SIZE - len,
1328
- "tot:xmit x%08x cmpl x%08x\n",
1329
- tot_xmt, tot_cmpl);
1330
- return len;
1775
+
1776
+ /* Check if nothing to display */
1777
+ if (!tot_xmt && !tot_cmpl && !tot_rcv)
1778
+ continue;
1779
+
1780
+ scnprintf(tmp, sizeof(tmp), "\t->\t[HDWQ Total: ");
1781
+ if (strlcat(buf, tmp, size) >= size)
1782
+ goto buffer_done;
1783
+
1784
+ if (phba->nvmet_support) {
1785
+ scnprintf(tmp, sizeof(tmp),
1786
+ "XMT 0x%x CMPL 0x%x RCV 0x%x]\n\n",
1787
+ tot_xmt, tot_cmpl, tot_rcv);
1788
+ if (strlcat(buf, tmp, size) >= size)
1789
+ goto buffer_done;
1790
+ } else {
1791
+ scnprintf(tmp, sizeof(tmp),
1792
+ "XMT 0x%x CMPL 0x%x]\n\n",
1793
+ tot_xmt, tot_cmpl);
1794
+ if (strlcat(buf, tmp, size) >= size)
1795
+ goto buffer_done;
1796
+ }
13311797 }
13321798
1333
- /* NVME Target */
1334
- len += scnprintf(buf + len, PAGE_SIZE - len,
1335
- "CPUcheck %s ",
1336
- (phba->cpucheck_on & LPFC_CHECK_NVMET_IO ?
1337
- "IO Enabled - " : "IO Disabled - "));
1338
- len += scnprintf(buf + len, PAGE_SIZE - len,
1339
- "%s\n",
1340
- (phba->cpucheck_on & LPFC_CHECK_NVMET_RCV ?
1341
- "Rcv Enabled\n" : "Rcv Disabled\n"));
1342
- for (i = 0; i < phba->sli4_hba.num_present_cpu; i++) {
1343
- if (i >= LPFC_CHECK_CPU_CNT)
1344
- break;
1345
- len += scnprintf(buf + len, PAGE_SIZE - len,
1346
- "%02d: xmit x%08x ccmpl x%08x "
1347
- "cmpl x%08x rcv x%08x\n",
1348
- i, phba->cpucheck_xmt_io[i],
1349
- phba->cpucheck_ccmpl_io[i],
1350
- phba->cpucheck_cmpl_io[i],
1351
- phba->cpucheck_rcv_io[i]);
1352
- tot_xmt += phba->cpucheck_xmt_io[i];
1353
- tot_rcv += phba->cpucheck_rcv_io[i];
1354
- tot_cmpl += phba->cpucheck_cmpl_io[i];
1355
- tot_ccmpl += phba->cpucheck_ccmpl_io[i];
1356
- }
1357
- len += scnprintf(buf + len, PAGE_SIZE - len,
1358
- "tot:xmit x%08x ccmpl x%08x cmpl x%08x rcv x%08x\n",
1359
- tot_xmt, tot_ccmpl, tot_cmpl, tot_rcv);
1799
+buffer_done:
1800
+ len = strnlen(buf, size);
13601801 return len;
13611802 }
13621803
....@@ -1503,7 +1944,7 @@
15031944 int rc = -ENOMEM;
15041945
15051946 if (!lpfc_debugfs_max_disc_trc) {
1506
- rc = -ENOSPC;
1947
+ rc = -ENOSPC;
15071948 goto out;
15081949 }
15091950
....@@ -1553,7 +1994,7 @@
15531994 int rc = -ENOMEM;
15541995
15551996 if (!lpfc_debugfs_max_slow_ring_trc) {
1556
- rc = -ENOSPC;
1997
+ rc = -ENOSPC;
15571998 goto out;
15581999 }
15592000
....@@ -1617,6 +2058,231 @@
16172058 file->private_data = debug;
16182059
16192060 rc = 0;
2061
+out:
2062
+ return rc;
2063
+}
2064
+
2065
+/**
2066
+ * lpfc_debugfs_multixripools_open - Open the multixripool debugfs buffer
2067
+ * @inode: The inode pointer that contains a hba pointer.
2068
+ * @file: The file pointer to attach the log output.
2069
+ *
2070
+ * Description:
2071
+ * This routine is the entry point for the debugfs open file operation. It gets
2072
+ * the hba from the i_private field in @inode, allocates the necessary buffer
2073
+ * for the log, fills the buffer from the in-memory log for this hba, and then
2074
+ * returns a pointer to that log in the private_data field in @file.
2075
+ *
2076
+ * Returns:
2077
+ * This function returns zero if successful. On error it will return a negative
2078
+ * error value.
2079
+ **/
2080
+static int
2081
+lpfc_debugfs_multixripools_open(struct inode *inode, struct file *file)
2082
+{
2083
+ struct lpfc_hba *phba = inode->i_private;
2084
+ struct lpfc_debug *debug;
2085
+ int rc = -ENOMEM;
2086
+
2087
+ debug = kmalloc(sizeof(*debug), GFP_KERNEL);
2088
+ if (!debug)
2089
+ goto out;
2090
+
2091
+ /* Round to page boundary */
2092
+ debug->buffer = kzalloc(LPFC_DUMP_MULTIXRIPOOL_SIZE, GFP_KERNEL);
2093
+ if (!debug->buffer) {
2094
+ kfree(debug);
2095
+ goto out;
2096
+ }
2097
+
2098
+ debug->len = lpfc_debugfs_multixripools_data(
2099
+ phba, debug->buffer, LPFC_DUMP_MULTIXRIPOOL_SIZE);
2100
+
2101
+ debug->i_private = inode->i_private;
2102
+ file->private_data = debug;
2103
+
2104
+ rc = 0;
2105
+out:
2106
+ return rc;
2107
+}
2108
+
2109
+#ifdef LPFC_HDWQ_LOCK_STAT
2110
+/**
2111
+ * lpfc_debugfs_lockstat_open - Open the lockstat debugfs buffer
2112
+ * @inode: The inode pointer that contains a vport pointer.
2113
+ * @file: The file pointer to attach the log output.
2114
+ *
2115
+ * Description:
2116
+ * This routine is the entry point for the debugfs open file operation. It gets
2117
+ * the vport from the i_private field in @inode, allocates the necessary buffer
2118
+ * for the log, fills the buffer from the in-memory log for this vport, and then
2119
+ * returns a pointer to that log in the private_data field in @file.
2120
+ *
2121
+ * Returns:
2122
+ * This function returns zero if successful. On error it will return a negative
2123
+ * error value.
2124
+ **/
2125
+static int
2126
+lpfc_debugfs_lockstat_open(struct inode *inode, struct file *file)
2127
+{
2128
+ struct lpfc_hba *phba = inode->i_private;
2129
+ struct lpfc_debug *debug;
2130
+ int rc = -ENOMEM;
2131
+
2132
+ debug = kmalloc(sizeof(*debug), GFP_KERNEL);
2133
+ if (!debug)
2134
+ goto out;
2135
+
2136
+ /* Round to page boundary */
2137
+ debug->buffer = kmalloc(LPFC_HDWQINFO_SIZE, GFP_KERNEL);
2138
+ if (!debug->buffer) {
2139
+ kfree(debug);
2140
+ goto out;
2141
+ }
2142
+
2143
+ debug->len = lpfc_debugfs_lockstat_data(phba, debug->buffer,
2144
+ LPFC_HBQINFO_SIZE);
2145
+ file->private_data = debug;
2146
+
2147
+ rc = 0;
2148
+out:
2149
+ return rc;
2150
+}
2151
+
2152
+static ssize_t
2153
+lpfc_debugfs_lockstat_write(struct file *file, const char __user *buf,
2154
+ size_t nbytes, loff_t *ppos)
2155
+{
2156
+ struct lpfc_debug *debug = file->private_data;
2157
+ struct lpfc_hba *phba = (struct lpfc_hba *)debug->i_private;
2158
+ struct lpfc_sli4_hdw_queue *qp;
2159
+ char mybuf[64];
2160
+ char *pbuf;
2161
+ int i;
2162
+ size_t bsize;
2163
+
2164
+ memset(mybuf, 0, sizeof(mybuf));
2165
+
2166
+ bsize = min(nbytes, (sizeof(mybuf) - 1));
2167
+
2168
+ if (copy_from_user(mybuf, buf, bsize))
2169
+ return -EFAULT;
2170
+ pbuf = &mybuf[0];
2171
+
2172
+ if ((strncmp(pbuf, "reset", strlen("reset")) == 0) ||
2173
+ (strncmp(pbuf, "zero", strlen("zero")) == 0)) {
2174
+ for (i = 0; i < phba->cfg_hdw_queue; i++) {
2175
+ qp = &phba->sli4_hba.hdwq[i];
2176
+ qp->lock_conflict.alloc_xri_get = 0;
2177
+ qp->lock_conflict.alloc_xri_put = 0;
2178
+ qp->lock_conflict.free_xri = 0;
2179
+ qp->lock_conflict.wq_access = 0;
2180
+ qp->lock_conflict.alloc_pvt_pool = 0;
2181
+ qp->lock_conflict.mv_from_pvt_pool = 0;
2182
+ qp->lock_conflict.mv_to_pub_pool = 0;
2183
+ qp->lock_conflict.mv_to_pvt_pool = 0;
2184
+ qp->lock_conflict.free_pvt_pool = 0;
2185
+ qp->lock_conflict.free_pub_pool = 0;
2186
+ qp->lock_conflict.wq_access = 0;
2187
+ }
2188
+ }
2189
+ return bsize;
2190
+}
2191
+#endif
2192
+
2193
+static int lpfc_debugfs_ras_log_data(struct lpfc_hba *phba,
2194
+ char *buffer, int size)
2195
+{
2196
+ int copied = 0;
2197
+ struct lpfc_dmabuf *dmabuf, *next;
2198
+
2199
+ memset(buffer, 0, size);
2200
+
2201
+ spin_lock_irq(&phba->hbalock);
2202
+ if (phba->ras_fwlog.state != ACTIVE) {
2203
+ spin_unlock_irq(&phba->hbalock);
2204
+ return -EINVAL;
2205
+ }
2206
+ spin_unlock_irq(&phba->hbalock);
2207
+
2208
+ list_for_each_entry_safe(dmabuf, next,
2209
+ &phba->ras_fwlog.fwlog_buff_list, list) {
2210
+ /* Check if copying will go over size and a '\0' char */
2211
+ if ((copied + LPFC_RAS_MAX_ENTRY_SIZE) >= (size - 1)) {
2212
+ memcpy(buffer + copied, dmabuf->virt,
2213
+ size - copied - 1);
2214
+ copied += size - copied - 1;
2215
+ break;
2216
+ }
2217
+ memcpy(buffer + copied, dmabuf->virt, LPFC_RAS_MAX_ENTRY_SIZE);
2218
+ copied += LPFC_RAS_MAX_ENTRY_SIZE;
2219
+ }
2220
+ return copied;
2221
+}
2222
+
2223
+static int
2224
+lpfc_debugfs_ras_log_release(struct inode *inode, struct file *file)
2225
+{
2226
+ struct lpfc_debug *debug = file->private_data;
2227
+
2228
+ vfree(debug->buffer);
2229
+ kfree(debug);
2230
+
2231
+ return 0;
2232
+}
2233
+
2234
+/**
2235
+ * lpfc_debugfs_ras_log_open - Open the RAS log debugfs buffer
2236
+ * @inode: The inode pointer that contains a vport pointer.
2237
+ * @file: The file pointer to attach the log output.
2238
+ *
2239
+ * Description:
2240
+ * This routine is the entry point for the debugfs open file operation. It gets
2241
+ * the vport from the i_private field in @inode, allocates the necessary buffer
2242
+ * for the log, fills the buffer from the in-memory log for this vport, and then
2243
+ * returns a pointer to that log in the private_data field in @file.
2244
+ *
2245
+ * Returns:
2246
+ * This function returns zero if successful. On error it will return a negative
2247
+ * error value.
2248
+ **/
2249
+static int
2250
+lpfc_debugfs_ras_log_open(struct inode *inode, struct file *file)
2251
+{
2252
+ struct lpfc_hba *phba = inode->i_private;
2253
+ struct lpfc_debug *debug;
2254
+ int size;
2255
+ int rc = -ENOMEM;
2256
+
2257
+ spin_lock_irq(&phba->hbalock);
2258
+ if (phba->ras_fwlog.state != ACTIVE) {
2259
+ spin_unlock_irq(&phba->hbalock);
2260
+ rc = -EINVAL;
2261
+ goto out;
2262
+ }
2263
+ spin_unlock_irq(&phba->hbalock);
2264
+ debug = kmalloc(sizeof(*debug), GFP_KERNEL);
2265
+ if (!debug)
2266
+ goto out;
2267
+
2268
+ size = LPFC_RAS_MIN_BUFF_POST_SIZE * phba->cfg_ras_fwlog_buffsize;
2269
+ debug->buffer = vmalloc(size);
2270
+ if (!debug->buffer)
2271
+ goto free_debug;
2272
+
2273
+ debug->len = lpfc_debugfs_ras_log_data(phba, debug->buffer, size);
2274
+ if (debug->len < 0) {
2275
+ rc = -EINVAL;
2276
+ goto free_buffer;
2277
+ }
2278
+ file->private_data = debug;
2279
+
2280
+ return 0;
2281
+
2282
+free_buffer:
2283
+ vfree(debug->buffer);
2284
+free_debug:
2285
+ kfree(debug);
16202286 out:
16212287 return rc;
16222288 }
....@@ -1705,89 +2371,6 @@
17052371 return rc;
17062372 }
17072373
1708
-static int
1709
-lpfc_debugfs_dumpData_open(struct inode *inode, struct file *file)
1710
-{
1711
- struct lpfc_debug *debug;
1712
- int rc = -ENOMEM;
1713
-
1714
- if (!_dump_buf_data)
1715
- return -EBUSY;
1716
-
1717
- debug = kmalloc(sizeof(*debug), GFP_KERNEL);
1718
- if (!debug)
1719
- goto out;
1720
-
1721
- /* Round to page boundary */
1722
- pr_err("9059 BLKGRD: %s: _dump_buf_data=0x%p\n",
1723
- __func__, _dump_buf_data);
1724
- debug->buffer = _dump_buf_data;
1725
- if (!debug->buffer) {
1726
- kfree(debug);
1727
- goto out;
1728
- }
1729
-
1730
- debug->len = (1 << _dump_buf_data_order) << PAGE_SHIFT;
1731
- file->private_data = debug;
1732
-
1733
- rc = 0;
1734
-out:
1735
- return rc;
1736
-}
1737
-
1738
-static int
1739
-lpfc_debugfs_dumpDif_open(struct inode *inode, struct file *file)
1740
-{
1741
- struct lpfc_debug *debug;
1742
- int rc = -ENOMEM;
1743
-
1744
- if (!_dump_buf_dif)
1745
- return -EBUSY;
1746
-
1747
- debug = kmalloc(sizeof(*debug), GFP_KERNEL);
1748
- if (!debug)
1749
- goto out;
1750
-
1751
- /* Round to page boundary */
1752
- pr_err("9060 BLKGRD: %s: _dump_buf_dif=0x%p file=%pD\n",
1753
- __func__, _dump_buf_dif, file);
1754
- debug->buffer = _dump_buf_dif;
1755
- if (!debug->buffer) {
1756
- kfree(debug);
1757
- goto out;
1758
- }
1759
-
1760
- debug->len = (1 << _dump_buf_dif_order) << PAGE_SHIFT;
1761
- file->private_data = debug;
1762
-
1763
- rc = 0;
1764
-out:
1765
- return rc;
1766
-}
1767
-
1768
-static ssize_t
1769
-lpfc_debugfs_dumpDataDif_write(struct file *file, const char __user *buf,
1770
- size_t nbytes, loff_t *ppos)
1771
-{
1772
- /*
1773
- * The Data/DIF buffers only save one failing IO
1774
- * The write op is used as a reset mechanism after an IO has
1775
- * already been saved to the next one can be saved
1776
- */
1777
- spin_lock(&_dump_buf_lock);
1778
-
1779
- memset((void *)_dump_buf_data, 0,
1780
- ((1 << PAGE_SHIFT) << _dump_buf_data_order));
1781
- memset((void *)_dump_buf_dif, 0,
1782
- ((1 << PAGE_SHIFT) << _dump_buf_dif_order));
1783
-
1784
- _dump_buf_done = 0;
1785
-
1786
- spin_unlock(&_dump_buf_lock);
1787
-
1788
- return nbytes;
1789
-}
1790
-
17912374 static ssize_t
17922375 lpfc_debugfs_dif_err_read(struct file *file, char __user *buf,
17932376 size_t nbytes, loff_t *ppos)
....@@ -1846,7 +2429,8 @@
18462429 return -EFAULT;
18472430
18482431 if (dent == phba->debug_InjErrLBA) {
1849
- if ((buf[0] == 'o') && (buf[1] == 'f') && (buf[2] == 'f'))
2432
+ if ((dstbuf[0] == 'o') && (dstbuf[1] == 'f') &&
2433
+ (dstbuf[2] == 'f'))
18502434 tmp = (uint64_t)(-1);
18512435 }
18522436
....@@ -2000,17 +2584,71 @@
20002584 return 0;
20012585 }
20022586
2003
-static int
2004
-lpfc_debugfs_dumpDataDif_release(struct inode *inode, struct file *file)
2587
+/**
2588
+ * lpfc_debugfs_multixripools_write - Clear multi-XRI pools statistics
2589
+ * @file: The file pointer to read from.
2590
+ * @buf: The buffer to copy the user data from.
2591
+ * @nbytes: The number of bytes to get.
2592
+ * @ppos: The position in the file to start reading from.
2593
+ *
2594
+ * Description:
2595
+ * This routine clears multi-XRI pools statistics when buf contains "clear".
2596
+ *
2597
+ * Return Value:
2598
+ * It returns the @nbytges passing in from debugfs user space when successful.
2599
+ * In case of error conditions, it returns proper error code back to the user
2600
+ * space.
2601
+ **/
2602
+static ssize_t
2603
+lpfc_debugfs_multixripools_write(struct file *file, const char __user *buf,
2604
+ size_t nbytes, loff_t *ppos)
20052605 {
20062606 struct lpfc_debug *debug = file->private_data;
2607
+ struct lpfc_hba *phba = (struct lpfc_hba *)debug->i_private;
2608
+ char mybuf[64];
2609
+ char *pbuf;
2610
+ u32 i;
2611
+ u32 hwq_count;
2612
+ struct lpfc_sli4_hdw_queue *qp;
2613
+ struct lpfc_multixri_pool *multixri_pool;
20072614
2008
- debug->buffer = NULL;
2009
- kfree(debug);
2615
+ if (nbytes > sizeof(mybuf) - 1)
2616
+ nbytes = sizeof(mybuf) - 1;
20102617
2011
- return 0;
2618
+ memset(mybuf, 0, sizeof(mybuf));
2619
+
2620
+ if (copy_from_user(mybuf, buf, nbytes))
2621
+ return -EFAULT;
2622
+ pbuf = &mybuf[0];
2623
+
2624
+ if ((strncmp(pbuf, "clear", strlen("clear"))) == 0) {
2625
+ hwq_count = phba->cfg_hdw_queue;
2626
+ for (i = 0; i < hwq_count; i++) {
2627
+ qp = &phba->sli4_hba.hdwq[i];
2628
+ multixri_pool = qp->p_multixri_pool;
2629
+ if (!multixri_pool)
2630
+ continue;
2631
+
2632
+ qp->empty_io_bufs = 0;
2633
+ multixri_pool->pbl_empty_count = 0;
2634
+#ifdef LPFC_MXP_STAT
2635
+ multixri_pool->above_limit_count = 0;
2636
+ multixri_pool->below_limit_count = 0;
2637
+ multixri_pool->stat_max_hwm = 0;
2638
+ multixri_pool->local_pbl_hit_count = 0;
2639
+ multixri_pool->other_pbl_hit_count = 0;
2640
+
2641
+ multixri_pool->stat_pbl_count = 0;
2642
+ multixri_pool->stat_pvt_count = 0;
2643
+ multixri_pool->stat_busy_count = 0;
2644
+ multixri_pool->stat_snapshot_taken = 0;
2645
+#endif
2646
+ }
2647
+ return strlen(pbuf);
2648
+ }
2649
+
2650
+ return -EINVAL;
20122651 }
2013
-
20142652
20152653 static int
20162654 lpfc_debugfs_nvmestat_open(struct inode *inode, struct file *file)
....@@ -2055,8 +2693,8 @@
20552693 if (!phba->targetport)
20562694 return -ENXIO;
20572695
2058
- if (nbytes > 64)
2059
- nbytes = 64;
2696
+ if (nbytes > sizeof(mybuf) - 1)
2697
+ nbytes = sizeof(mybuf) - 1;
20602698
20612699 memset(mybuf, 0, sizeof(mybuf));
20622700
....@@ -2101,7 +2739,7 @@
21012739 }
21022740
21032741 static int
2104
-lpfc_debugfs_nvmektime_open(struct inode *inode, struct file *file)
2742
+lpfc_debugfs_scsistat_open(struct inode *inode, struct file *file)
21052743 {
21062744 struct lpfc_vport *vport = inode->i_private;
21072745 struct lpfc_debug *debug;
....@@ -2112,14 +2750,14 @@
21122750 goto out;
21132751
21142752 /* Round to page boundary */
2115
- debug->buffer = kmalloc(LPFC_NVMEKTIME_SIZE, GFP_KERNEL);
2753
+ debug->buffer = kzalloc(LPFC_SCSISTAT_SIZE, GFP_KERNEL);
21162754 if (!debug->buffer) {
21172755 kfree(debug);
21182756 goto out;
21192757 }
21202758
2121
- debug->len = lpfc_debugfs_nvmektime_data(vport, debug->buffer,
2122
- LPFC_NVMEKTIME_SIZE);
2759
+ debug->len = lpfc_debugfs_scsistat_data(vport, debug->buffer,
2760
+ LPFC_SCSISTAT_SIZE);
21232761
21242762 debug->i_private = inode->i_private;
21252763 file->private_data = debug;
....@@ -2130,8 +2768,62 @@
21302768 }
21312769
21322770 static ssize_t
2133
-lpfc_debugfs_nvmektime_write(struct file *file, const char __user *buf,
2134
- size_t nbytes, loff_t *ppos)
2771
+lpfc_debugfs_scsistat_write(struct file *file, const char __user *buf,
2772
+ size_t nbytes, loff_t *ppos)
2773
+{
2774
+ struct lpfc_debug *debug = file->private_data;
2775
+ struct lpfc_vport *vport = (struct lpfc_vport *)debug->i_private;
2776
+ struct lpfc_hba *phba = vport->phba;
2777
+ char mybuf[6] = {0};
2778
+ int i;
2779
+
2780
+ if (copy_from_user(mybuf, buf, (nbytes >= sizeof(mybuf)) ?
2781
+ (sizeof(mybuf) - 1) : nbytes))
2782
+ return -EFAULT;
2783
+
2784
+ if ((strncmp(&mybuf[0], "reset", strlen("reset")) == 0) ||
2785
+ (strncmp(&mybuf[0], "zero", strlen("zero")) == 0)) {
2786
+ for (i = 0; i < phba->cfg_hdw_queue; i++) {
2787
+ memset(&phba->sli4_hba.hdwq[i].scsi_cstat, 0,
2788
+ sizeof(phba->sli4_hba.hdwq[i].scsi_cstat));
2789
+ }
2790
+ }
2791
+
2792
+ return nbytes;
2793
+}
2794
+
2795
+static int
2796
+lpfc_debugfs_ioktime_open(struct inode *inode, struct file *file)
2797
+{
2798
+ struct lpfc_vport *vport = inode->i_private;
2799
+ struct lpfc_debug *debug;
2800
+ int rc = -ENOMEM;
2801
+
2802
+ debug = kmalloc(sizeof(*debug), GFP_KERNEL);
2803
+ if (!debug)
2804
+ goto out;
2805
+
2806
+ /* Round to page boundary */
2807
+ debug->buffer = kmalloc(LPFC_IOKTIME_SIZE, GFP_KERNEL);
2808
+ if (!debug->buffer) {
2809
+ kfree(debug);
2810
+ goto out;
2811
+ }
2812
+
2813
+ debug->len = lpfc_debugfs_ioktime_data(vport, debug->buffer,
2814
+ LPFC_IOKTIME_SIZE);
2815
+
2816
+ debug->i_private = inode->i_private;
2817
+ file->private_data = debug;
2818
+
2819
+ rc = 0;
2820
+out:
2821
+ return rc;
2822
+}
2823
+
2824
+static ssize_t
2825
+lpfc_debugfs_ioktime_write(struct file *file, const char __user *buf,
2826
+ size_t nbytes, loff_t *ppos)
21352827 {
21362828 struct lpfc_debug *debug = file->private_data;
21372829 struct lpfc_vport *vport = (struct lpfc_vport *)debug->i_private;
....@@ -2139,8 +2831,8 @@
21392831 char mybuf[64];
21402832 char *pbuf;
21412833
2142
- if (nbytes > 64)
2143
- nbytes = 64;
2834
+ if (nbytes > sizeof(mybuf) - 1)
2835
+ nbytes = sizeof(mybuf) - 1;
21442836
21452837 memset(mybuf, 0, sizeof(mybuf));
21462838
....@@ -2267,8 +2959,8 @@
22672959 char mybuf[64];
22682960 char *pbuf;
22692961
2270
- if (nbytes > 63)
2271
- nbytes = 63;
2962
+ if (nbytes > sizeof(mybuf) - 1)
2963
+ nbytes = sizeof(mybuf) - 1;
22722964
22732965 memset(mybuf, 0, sizeof(mybuf));
22742966
....@@ -2333,7 +3025,7 @@
23333025 }
23343026
23353027 static int
2336
-lpfc_debugfs_cpucheck_open(struct inode *inode, struct file *file)
3028
+lpfc_debugfs_hdwqstat_open(struct inode *inode, struct file *file)
23373029 {
23383030 struct lpfc_vport *vport = inode->i_private;
23393031 struct lpfc_debug *debug;
....@@ -2344,14 +3036,14 @@
23443036 goto out;
23453037
23463038 /* Round to page boundary */
2347
- debug->buffer = kmalloc(LPFC_CPUCHECK_SIZE, GFP_KERNEL);
3039
+ debug->buffer = kcalloc(1, LPFC_SCSISTAT_SIZE, GFP_KERNEL);
23483040 if (!debug->buffer) {
23493041 kfree(debug);
23503042 goto out;
23513043 }
23523044
2353
- debug->len = lpfc_debugfs_cpucheck_data(vport, debug->buffer,
2354
- LPFC_NVMEKTIME_SIZE);
3045
+ debug->len = lpfc_debugfs_hdwqstat_data(vport, debug->buffer,
3046
+ LPFC_SCSISTAT_SIZE);
23553047
23563048 debug->i_private = inode->i_private;
23573049 file->private_data = debug;
....@@ -2362,18 +3054,19 @@
23623054 }
23633055
23643056 static ssize_t
2365
-lpfc_debugfs_cpucheck_write(struct file *file, const char __user *buf,
3057
+lpfc_debugfs_hdwqstat_write(struct file *file, const char __user *buf,
23663058 size_t nbytes, loff_t *ppos)
23673059 {
23683060 struct lpfc_debug *debug = file->private_data;
23693061 struct lpfc_vport *vport = (struct lpfc_vport *)debug->i_private;
23703062 struct lpfc_hba *phba = vport->phba;
3063
+ struct lpfc_hdwq_stat *c_stat;
23713064 char mybuf[64];
23723065 char *pbuf;
23733066 int i;
23743067
2375
- if (nbytes > 64)
2376
- nbytes = 64;
3068
+ if (nbytes > sizeof(mybuf) - 1)
3069
+ nbytes = sizeof(mybuf) - 1;
23773070
23783071 memset(mybuf, 0, sizeof(mybuf));
23793072
....@@ -2383,30 +3076,39 @@
23833076
23843077 if ((strncmp(pbuf, "on", sizeof("on") - 1) == 0)) {
23853078 if (phba->nvmet_support)
2386
- phba->cpucheck_on |= LPFC_CHECK_NVMET_IO;
3079
+ phba->hdwqstat_on |= LPFC_CHECK_NVMET_IO;
23873080 else
2388
- phba->cpucheck_on |= LPFC_CHECK_NVME_IO;
3081
+ phba->hdwqstat_on |= (LPFC_CHECK_NVME_IO |
3082
+ LPFC_CHECK_SCSI_IO);
23893083 return strlen(pbuf);
2390
- } else if ((strncmp(pbuf, "rcv",
2391
- sizeof("rcv") - 1) == 0)) {
3084
+ } else if ((strncmp(pbuf, "nvme_on", sizeof("nvme_on") - 1) == 0)) {
23923085 if (phba->nvmet_support)
2393
- phba->cpucheck_on |= LPFC_CHECK_NVMET_RCV;
3086
+ phba->hdwqstat_on |= LPFC_CHECK_NVMET_IO;
23943087 else
2395
- return -EINVAL;
3088
+ phba->hdwqstat_on |= LPFC_CHECK_NVME_IO;
3089
+ return strlen(pbuf);
3090
+ } else if ((strncmp(pbuf, "scsi_on", sizeof("scsi_on") - 1) == 0)) {
3091
+ if (!phba->nvmet_support)
3092
+ phba->hdwqstat_on |= LPFC_CHECK_SCSI_IO;
3093
+ return strlen(pbuf);
3094
+ } else if ((strncmp(pbuf, "nvme_off", sizeof("nvme_off") - 1) == 0)) {
3095
+ phba->hdwqstat_on &= ~(LPFC_CHECK_NVME_IO |
3096
+ LPFC_CHECK_NVMET_IO);
3097
+ return strlen(pbuf);
3098
+ } else if ((strncmp(pbuf, "scsi_off", sizeof("scsi_off") - 1) == 0)) {
3099
+ phba->hdwqstat_on &= ~LPFC_CHECK_SCSI_IO;
23963100 return strlen(pbuf);
23973101 } else if ((strncmp(pbuf, "off",
23983102 sizeof("off") - 1) == 0)) {
2399
- phba->cpucheck_on = LPFC_CHECK_OFF;
3103
+ phba->hdwqstat_on = LPFC_CHECK_OFF;
24003104 return strlen(pbuf);
24013105 } else if ((strncmp(pbuf, "zero",
24023106 sizeof("zero") - 1) == 0)) {
2403
- for (i = 0; i < phba->sli4_hba.num_present_cpu; i++) {
2404
- if (i >= LPFC_CHECK_CPU_CNT)
2405
- break;
2406
- phba->cpucheck_rcv_io[i] = 0;
2407
- phba->cpucheck_xmt_io[i] = 0;
2408
- phba->cpucheck_cmpl_io[i] = 0;
2409
- phba->cpucheck_ccmpl_io[i] = 0;
3107
+ for_each_present_cpu(i) {
3108
+ c_stat = per_cpu_ptr(phba->sli4_hba.c_stat, i);
3109
+ c_stat->xmt_io = 0;
3110
+ c_stat->cmpl_io = 0;
3111
+ c_stat->rcv_io = 0;
24103112 }
24113113 return strlen(pbuf);
24123114 }
....@@ -3169,10 +3871,10 @@
31693871 (unsigned long long)qp->q_cnt_4);
31703872 len += scnprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len,
31713873 "\t\tWQID[%02d], QE-CNT[%04d], QE-SZ[%04d], "
3172
- "HST-IDX[%04d], PRT-IDX[%04d], PST[%03d]",
3874
+ "HST-IDX[%04d], PRT-IDX[%04d], NTFI[%03d]",
31733875 qp->queue_id, qp->entry_count,
31743876 qp->entry_size, qp->host_index,
3175
- qp->hba_index, qp->entry_repost);
3877
+ qp->hba_index, qp->notify_interval);
31763878 len += scnprintf(pbuffer + len,
31773879 LPFC_QUE_INFO_GET_BUF_SIZE - len, "\n");
31783880 return len;
....@@ -3185,16 +3887,8 @@
31853887 struct lpfc_queue *qp;
31863888 int qidx;
31873889
3188
- for (qidx = 0; qidx < phba->cfg_fcp_io_channel; qidx++) {
3189
- qp = phba->sli4_hba.fcp_wq[qidx];
3190
- if (qp->assoc_qid != cq_id)
3191
- continue;
3192
- *len = __lpfc_idiag_print_wq(qp, wqtype, pbuffer, *len);
3193
- if (*len >= max_cnt)
3194
- return 1;
3195
- }
3196
- for (qidx = 0; qidx < phba->cfg_nvme_io_channel; qidx++) {
3197
- qp = phba->sli4_hba.nvme_wq[qidx];
3890
+ for (qidx = 0; qidx < phba->cfg_hdw_queue; qidx++) {
3891
+ qp = phba->sli4_hba.hdwq[qidx].io_wq;
31983892 if (qp->assoc_qid != cq_id)
31993893 continue;
32003894 *len = __lpfc_idiag_print_wq(qp, wqtype, pbuffer, *len);
....@@ -3220,12 +3914,13 @@
32203914 qp->q_cnt_3, (unsigned long long)qp->q_cnt_4);
32213915 len += scnprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len,
32223916 "\tCQID[%02d], QE-CNT[%04d], QE-SZ[%04d], "
3223
- "HST-IDX[%04d], PRT-IDX[%04d], PST[%03d]",
3917
+ "HST-IDX[%04d], NTFI[%03d], PLMT[%03d]",
32243918 qp->queue_id, qp->entry_count,
32253919 qp->entry_size, qp->host_index,
3226
- qp->hba_index, qp->entry_repost);
3920
+ qp->notify_interval, qp->max_proc_limit);
32273921
3228
- len += scnprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len, "\n");
3922
+ len += scnprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len,
3923
+ "\n");
32293924
32303925 return len;
32313926 }
....@@ -3246,15 +3941,15 @@
32463941 qp->q_cnt_3, (unsigned long long)qp->q_cnt_4);
32473942 len += scnprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len,
32483943 "\t\tHQID[%02d], QE-CNT[%04d], QE-SZ[%04d], "
3249
- "HST-IDX[%04d], PRT-IDX[%04d], PST[%03d]\n",
3944
+ "HST-IDX[%04d], PRT-IDX[%04d], NTFI[%03d]\n",
32503945 qp->queue_id, qp->entry_count, qp->entry_size,
3251
- qp->host_index, qp->hba_index, qp->entry_repost);
3946
+ qp->host_index, qp->hba_index, qp->notify_interval);
32523947 len += scnprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len,
32533948 "\t\tDQID[%02d], QE-CNT[%04d], QE-SZ[%04d], "
3254
- "HST-IDX[%04d], PRT-IDX[%04d], PST[%03d]\n",
3949
+ "HST-IDX[%04d], PRT-IDX[%04d], NTFI[%03d]\n",
32553950 datqp->queue_id, datqp->entry_count,
32563951 datqp->entry_size, datqp->host_index,
3257
- datqp->hba_index, datqp->entry_repost);
3952
+ datqp->hba_index, datqp->notify_interval);
32583953 return len;
32593954 }
32603955
....@@ -3263,45 +3958,22 @@
32633958 int *len, int max_cnt, int eqidx, int eq_id)
32643959 {
32653960 struct lpfc_queue *qp;
3266
- int qidx, rc;
3961
+ int rc;
32673962
3268
- for (qidx = 0; qidx < phba->cfg_fcp_io_channel; qidx++) {
3269
- qp = phba->sli4_hba.fcp_cq[qidx];
3270
- if (qp->assoc_qid != eq_id)
3271
- continue;
3963
+ qp = phba->sli4_hba.hdwq[eqidx].io_cq;
32723964
3273
- *len = __lpfc_idiag_print_cq(qp, "FCP", pbuffer, *len);
3965
+ *len = __lpfc_idiag_print_cq(qp, "IO", pbuffer, *len);
32743966
3275
- /* Reset max counter */
3276
- qp->CQ_max_cqe = 0;
3967
+ /* Reset max counter */
3968
+ qp->CQ_max_cqe = 0;
32773969
3278
- if (*len >= max_cnt)
3279
- return 1;
3970
+ if (*len >= max_cnt)
3971
+ return 1;
32803972
3281
- rc = lpfc_idiag_wqs_for_cq(phba, "FCP", pbuffer, len,
3282
- max_cnt, qp->queue_id);
3283
- if (rc)
3284
- return 1;
3285
- }
3286
-
3287
- for (qidx = 0; qidx < phba->cfg_nvme_io_channel; qidx++) {
3288
- qp = phba->sli4_hba.nvme_cq[qidx];
3289
- if (qp->assoc_qid != eq_id)
3290
- continue;
3291
-
3292
- *len = __lpfc_idiag_print_cq(qp, "NVME", pbuffer, *len);
3293
-
3294
- /* Reset max counter */
3295
- qp->CQ_max_cqe = 0;
3296
-
3297
- if (*len >= max_cnt)
3298
- return 1;
3299
-
3300
- rc = lpfc_idiag_wqs_for_cq(phba, "NVME", pbuffer, len,
3301
- max_cnt, qp->queue_id);
3302
- if (rc)
3303
- return 1;
3304
- }
3973
+ rc = lpfc_idiag_wqs_for_cq(phba, "IO", pbuffer, len,
3974
+ max_cnt, qp->queue_id);
3975
+ if (rc)
3976
+ return 1;
33053977
33063978 if ((eqidx < phba->cfg_nvmet_mrq) && phba->nvmet_support) {
33073979 /* NVMET CQset */
....@@ -3341,10 +4013,12 @@
33414013 (unsigned long long)qp->q_cnt_4, qp->q_mode);
33424014 len += scnprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len,
33434015 "EQID[%02d], QE-CNT[%04d], QE-SZ[%04d], "
3344
- "HST-IDX[%04d], PRT-IDX[%04d], PST[%03d]",
4016
+ "HST-IDX[%04d], NTFI[%03d], PLMT[%03d], AFFIN[%03d]",
33454017 qp->queue_id, qp->entry_count, qp->entry_size,
3346
- qp->host_index, qp->hba_index, qp->entry_repost);
3347
- len += scnprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len, "\n");
4018
+ qp->host_index, qp->notify_interval,
4019
+ qp->max_proc_limit, qp->chann);
4020
+ len += scnprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len,
4021
+ "\n");
33484022
33494023 return len;
33504024 }
....@@ -3390,24 +4064,20 @@
33904064 spin_lock_irq(&phba->hbalock);
33914065
33924066 /* Fast-path event queue */
3393
- if (phba->sli4_hba.hba_eq && phba->io_channel_irqs) {
4067
+ if (phba->sli4_hba.hdwq && phba->cfg_hdw_queue) {
33944068
33954069 x = phba->lpfc_idiag_last_eq;
3396
- if (phba->cfg_fof && (x >= phba->io_channel_irqs)) {
3397
- phba->lpfc_idiag_last_eq = 0;
3398
- goto fof;
3399
- }
34004070 phba->lpfc_idiag_last_eq++;
3401
- if (phba->lpfc_idiag_last_eq >= phba->io_channel_irqs)
3402
- if (phba->cfg_fof == 0)
3403
- phba->lpfc_idiag_last_eq = 0;
4071
+ if (phba->lpfc_idiag_last_eq >= phba->cfg_hdw_queue)
4072
+ phba->lpfc_idiag_last_eq = 0;
34044073
3405
- len += scnprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len,
3406
- "EQ %d out of %d HBA EQs\n",
3407
- x, phba->io_channel_irqs);
4074
+ len += scnprintf(pbuffer + len,
4075
+ LPFC_QUE_INFO_GET_BUF_SIZE - len,
4076
+ "HDWQ %d out of %d HBA HDWQs\n",
4077
+ x, phba->cfg_hdw_queue);
34084078
34094079 /* Fast-path EQ */
3410
- qp = phba->sli4_hba.hba_eq[x];
4080
+ qp = phba->sli4_hba.hdwq[x].hba_eq;
34114081 if (!qp)
34124082 goto out;
34134083
....@@ -3482,35 +4152,6 @@
34824152 goto out;
34834153 }
34844154
3485
-fof:
3486
- if (phba->cfg_fof) {
3487
- /* FOF EQ */
3488
- qp = phba->sli4_hba.fof_eq;
3489
- len = __lpfc_idiag_print_eq(qp, "FOF", pbuffer, len);
3490
-
3491
- /* Reset max counter */
3492
- if (qp)
3493
- qp->EQ_max_eqe = 0;
3494
-
3495
- if (len >= max_cnt)
3496
- goto too_big;
3497
-
3498
- /* OAS CQ */
3499
- qp = phba->sli4_hba.oas_cq;
3500
- len = __lpfc_idiag_print_cq(qp, "OAS", pbuffer, len);
3501
- /* Reset max counter */
3502
- if (qp)
3503
- qp->CQ_max_cqe = 0;
3504
- if (len >= max_cnt)
3505
- goto too_big;
3506
-
3507
- /* OAS WQ */
3508
- qp = phba->sli4_hba.oas_wq;
3509
- len = __lpfc_idiag_print_wq(qp, "OAS", pbuffer, len);
3510
- if (len >= max_cnt)
3511
- goto too_big;
3512
- }
3513
-
35144155 spin_unlock_irq(&phba->hbalock);
35154156 return simple_read_from_buffer(buf, nbytes, ppos, pbuffer, len);
35164157
....@@ -3575,7 +4216,7 @@
35754216 "QE-INDEX[%04d]:\n", index);
35764217
35774218 offset = 0;
3578
- pentry = pque->qe[index].address;
4219
+ pentry = lpfc_sli4_qe(pque, index);
35794220 while (esize > 0) {
35804221 len += scnprintf(pbuffer+len, LPFC_QUE_ACC_BUF_SIZE-len,
35814222 "%08x ", *pentry);
....@@ -3728,9 +4369,9 @@
37284369 switch (quetp) {
37294370 case LPFC_IDIAG_EQ:
37304371 /* HBA event queue */
3731
- if (phba->sli4_hba.hba_eq) {
3732
- for (qidx = 0; qidx < phba->io_channel_irqs; qidx++) {
3733
- qp = phba->sli4_hba.hba_eq[qidx];
4372
+ if (phba->sli4_hba.hdwq) {
4373
+ for (qidx = 0; qidx < phba->cfg_hdw_queue; qidx++) {
4374
+ qp = phba->sli4_hba.hdwq[qidx].hba_eq;
37344375 if (qp && qp->queue_id == queid) {
37354376 /* Sanity check */
37364377 rc = lpfc_idiag_que_param_check(qp,
....@@ -3779,10 +4420,10 @@
37794420 goto pass_check;
37804421 }
37814422 /* FCP complete queue */
3782
- if (phba->sli4_hba.fcp_cq) {
3783
- for (qidx = 0; qidx < phba->cfg_fcp_io_channel;
4423
+ if (phba->sli4_hba.hdwq) {
4424
+ for (qidx = 0; qidx < phba->cfg_hdw_queue;
37844425 qidx++) {
3785
- qp = phba->sli4_hba.fcp_cq[qidx];
4426
+ qp = phba->sli4_hba.hdwq[qidx].io_cq;
37864427 if (qp && qp->queue_id == queid) {
37874428 /* Sanity check */
37884429 rc = lpfc_idiag_que_param_check(
....@@ -3793,25 +4434,6 @@
37934434 goto pass_check;
37944435 }
37954436 }
3796
- }
3797
- /* NVME complete queue */
3798
- if (phba->sli4_hba.nvme_cq) {
3799
- qidx = 0;
3800
- do {
3801
- if (phba->sli4_hba.nvme_cq[qidx] &&
3802
- phba->sli4_hba.nvme_cq[qidx]->queue_id ==
3803
- queid) {
3804
- /* Sanity check */
3805
- rc = lpfc_idiag_que_param_check(
3806
- phba->sli4_hba.nvme_cq[qidx],
3807
- index, count);
3808
- if (rc)
3809
- goto error_out;
3810
- idiag.ptr_private =
3811
- phba->sli4_hba.nvme_cq[qidx];
3812
- goto pass_check;
3813
- }
3814
- } while (++qidx < phba->cfg_nvme_io_channel);
38154437 }
38164438 goto error_out;
38174439 break;
....@@ -3852,27 +4474,11 @@
38524474 idiag.ptr_private = phba->sli4_hba.nvmels_wq;
38534475 goto pass_check;
38544476 }
3855
- /* FCP work queue */
3856
- if (phba->sli4_hba.fcp_wq) {
3857
- for (qidx = 0; qidx < phba->cfg_fcp_io_channel;
3858
- qidx++) {
3859
- qp = phba->sli4_hba.fcp_wq[qidx];
3860
- if (qp && qp->queue_id == queid) {
3861
- /* Sanity check */
3862
- rc = lpfc_idiag_que_param_check(
3863
- qp, index, count);
3864
- if (rc)
3865
- goto error_out;
3866
- idiag.ptr_private = qp;
3867
- goto pass_check;
3868
- }
3869
- }
3870
- }
3871
- /* NVME work queue */
3872
- if (phba->sli4_hba.nvme_wq) {
3873
- for (qidx = 0; qidx < phba->cfg_nvme_io_channel;
3874
- qidx++) {
3875
- qp = phba->sli4_hba.nvme_wq[qidx];
4477
+
4478
+ if (phba->sli4_hba.hdwq) {
4479
+ /* FCP/SCSI work queue */
4480
+ for (qidx = 0; qidx < phba->cfg_hdw_queue; qidx++) {
4481
+ qp = phba->sli4_hba.hdwq[qidx].io_wq;
38764482 if (qp && qp->queue_id == queid) {
38774483 /* Sanity check */
38784484 rc = lpfc_idiag_que_param_check(
....@@ -3885,26 +4491,6 @@
38854491 }
38864492 }
38874493
3888
- /* NVME work queues */
3889
- if (phba->sli4_hba.nvme_wq) {
3890
- for (qidx = 0; qidx < phba->cfg_nvme_io_channel;
3891
- qidx++) {
3892
- if (!phba->sli4_hba.nvme_wq[qidx])
3893
- continue;
3894
- if (phba->sli4_hba.nvme_wq[qidx]->queue_id ==
3895
- queid) {
3896
- /* Sanity check */
3897
- rc = lpfc_idiag_que_param_check(
3898
- phba->sli4_hba.nvme_wq[qidx],
3899
- index, count);
3900
- if (rc)
3901
- goto error_out;
3902
- idiag.ptr_private =
3903
- phba->sli4_hba.nvme_wq[qidx];
3904
- goto pass_check;
3905
- }
3906
- }
3907
- }
39084494 goto error_out;
39094495 break;
39104496 case LPFC_IDIAG_RQ:
....@@ -3951,7 +4537,7 @@
39514537 pque = (struct lpfc_queue *)idiag.ptr_private;
39524538 if (offset > pque->entry_size/sizeof(uint32_t) - 1)
39534539 goto error_out;
3954
- pentry = pque->qe[index].address;
4540
+ pentry = lpfc_sli4_qe(pque, index);
39554541 pentry += offset;
39564542 if (idiag.cmd.opcode == LPFC_IDIAG_CMD_QUEACC_WR)
39574543 *pentry = value;
....@@ -3972,7 +4558,7 @@
39724558 * lpfc_idiag_drbacc_read_reg - idiag debugfs read a doorbell register
39734559 * @phba: The pointer to hba structure.
39744560 * @pbuffer: The pointer to the buffer to copy the data to.
3975
- * @len: The lenght of bytes to copied.
4561
+ * @len: The length of bytes to copied.
39764562 * @drbregid: The id to doorbell registers.
39774563 *
39784564 * Description:
....@@ -4182,7 +4768,7 @@
41824768 * lpfc_idiag_ctlacc_read_reg - idiag debugfs read a control registers
41834769 * @phba: The pointer to hba structure.
41844770 * @pbuffer: The pointer to the buffer to copy the data to.
4185
- * @len: The lenght of bytes to copied.
4771
+ * @len: The length of bytes to copied.
41864772 * @drbregid: The id to doorbell registers.
41874773 *
41884774 * Description:
....@@ -4869,6 +5455,16 @@
48695455 .release = lpfc_debugfs_release,
48705456 };
48715457
5458
+#undef lpfc_debugfs_op_multixripools
5459
+static const struct file_operations lpfc_debugfs_op_multixripools = {
5460
+ .owner = THIS_MODULE,
5461
+ .open = lpfc_debugfs_multixripools_open,
5462
+ .llseek = lpfc_debugfs_lseek,
5463
+ .read = lpfc_debugfs_read,
5464
+ .write = lpfc_debugfs_multixripools_write,
5465
+ .release = lpfc_debugfs_release,
5466
+};
5467
+
48725468 #undef lpfc_debugfs_op_hbqinfo
48735469 static const struct file_operations lpfc_debugfs_op_hbqinfo = {
48745470 .owner = THIS_MODULE,
....@@ -4876,6 +5472,27 @@
48765472 .llseek = lpfc_debugfs_lseek,
48775473 .read = lpfc_debugfs_read,
48785474 .release = lpfc_debugfs_release,
5475
+};
5476
+
5477
+#ifdef LPFC_HDWQ_LOCK_STAT
5478
+#undef lpfc_debugfs_op_lockstat
5479
+static const struct file_operations lpfc_debugfs_op_lockstat = {
5480
+ .owner = THIS_MODULE,
5481
+ .open = lpfc_debugfs_lockstat_open,
5482
+ .llseek = lpfc_debugfs_lseek,
5483
+ .read = lpfc_debugfs_read,
5484
+ .write = lpfc_debugfs_lockstat_write,
5485
+ .release = lpfc_debugfs_release,
5486
+};
5487
+#endif
5488
+
5489
+#undef lpfc_debugfs_ras_log
5490
+static const struct file_operations lpfc_debugfs_ras_log = {
5491
+ .owner = THIS_MODULE,
5492
+ .open = lpfc_debugfs_ras_log_open,
5493
+ .llseek = lpfc_debugfs_lseek,
5494
+ .read = lpfc_debugfs_read,
5495
+ .release = lpfc_debugfs_ras_log_release,
48795496 };
48805497
48815498 #undef lpfc_debugfs_op_dumpHBASlim
....@@ -4906,13 +5523,23 @@
49065523 .release = lpfc_debugfs_release,
49075524 };
49085525
4909
-#undef lpfc_debugfs_op_nvmektime
4910
-static const struct file_operations lpfc_debugfs_op_nvmektime = {
5526
+#undef lpfc_debugfs_op_scsistat
5527
+static const struct file_operations lpfc_debugfs_op_scsistat = {
49115528 .owner = THIS_MODULE,
4912
- .open = lpfc_debugfs_nvmektime_open,
5529
+ .open = lpfc_debugfs_scsistat_open,
49135530 .llseek = lpfc_debugfs_lseek,
49145531 .read = lpfc_debugfs_read,
4915
- .write = lpfc_debugfs_nvmektime_write,
5532
+ .write = lpfc_debugfs_scsistat_write,
5533
+ .release = lpfc_debugfs_release,
5534
+};
5535
+
5536
+#undef lpfc_debugfs_op_ioktime
5537
+static const struct file_operations lpfc_debugfs_op_ioktime = {
5538
+ .owner = THIS_MODULE,
5539
+ .open = lpfc_debugfs_ioktime_open,
5540
+ .llseek = lpfc_debugfs_lseek,
5541
+ .read = lpfc_debugfs_read,
5542
+ .write = lpfc_debugfs_ioktime_write,
49165543 .release = lpfc_debugfs_release,
49175544 };
49185545
....@@ -4926,34 +5553,14 @@
49265553 .release = lpfc_debugfs_release,
49275554 };
49285555
4929
-#undef lpfc_debugfs_op_cpucheck
4930
-static const struct file_operations lpfc_debugfs_op_cpucheck = {
5556
+#undef lpfc_debugfs_op_hdwqstat
5557
+static const struct file_operations lpfc_debugfs_op_hdwqstat = {
49315558 .owner = THIS_MODULE,
4932
- .open = lpfc_debugfs_cpucheck_open,
5559
+ .open = lpfc_debugfs_hdwqstat_open,
49335560 .llseek = lpfc_debugfs_lseek,
49345561 .read = lpfc_debugfs_read,
4935
- .write = lpfc_debugfs_cpucheck_write,
5562
+ .write = lpfc_debugfs_hdwqstat_write,
49365563 .release = lpfc_debugfs_release,
4937
-};
4938
-
4939
-#undef lpfc_debugfs_op_dumpData
4940
-static const struct file_operations lpfc_debugfs_op_dumpData = {
4941
- .owner = THIS_MODULE,
4942
- .open = lpfc_debugfs_dumpData_open,
4943
- .llseek = lpfc_debugfs_lseek,
4944
- .read = lpfc_debugfs_read,
4945
- .write = lpfc_debugfs_dumpDataDif_write,
4946
- .release = lpfc_debugfs_dumpDataDif_release,
4947
-};
4948
-
4949
-#undef lpfc_debugfs_op_dumpDif
4950
-static const struct file_operations lpfc_debugfs_op_dumpDif = {
4951
- .owner = THIS_MODULE,
4952
- .open = lpfc_debugfs_dumpDif_open,
4953
- .llseek = lpfc_debugfs_lseek,
4954
- .read = lpfc_debugfs_read,
4955
- .write = lpfc_debugfs_dumpDataDif_write,
4956
- .release = lpfc_debugfs_dumpDataDif_release,
49575564 };
49585565
49595566 #undef lpfc_debugfs_op_dif_err
....@@ -5058,7 +5665,6 @@
50585665 .write = lpfc_idiag_extacc_write,
50595666 .release = lpfc_idiag_cmd_release,
50605667 };
5061
-
50625668 #endif
50635669
50645670 /* lpfc_idiag_mbxacc_dump_bsg_mbox - idiag debugfs dump bsg mailbox command
....@@ -5283,11 +5889,6 @@
52835889 if (!lpfc_debugfs_root) {
52845890 lpfc_debugfs_root = debugfs_create_dir("lpfc", NULL);
52855891 atomic_set(&lpfc_debugfs_hba_count, 0);
5286
- if (!lpfc_debugfs_root) {
5287
- lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
5288
- "0408 Cannot create debugfs root\n");
5289
- goto debug_failed;
5290
- }
52915892 }
52925893 if (!lpfc_debugfs_start_time)
52935894 lpfc_debugfs_start_time = jiffies;
....@@ -5298,25 +5899,55 @@
52985899 pport_setup = true;
52995900 phba->hba_debugfs_root =
53005901 debugfs_create_dir(name, lpfc_debugfs_root);
5301
- if (!phba->hba_debugfs_root) {
5302
- lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
5303
- "0412 Cannot create debugfs hba\n");
5304
- goto debug_failed;
5305
- }
53065902 atomic_inc(&lpfc_debugfs_hba_count);
53075903 atomic_set(&phba->debugfs_vport_count, 0);
5904
+
5905
+ /* Multi-XRI pools */
5906
+ snprintf(name, sizeof(name), "multixripools");
5907
+ phba->debug_multixri_pools =
5908
+ debugfs_create_file(name, S_IFREG | 0644,
5909
+ phba->hba_debugfs_root,
5910
+ phba,
5911
+ &lpfc_debugfs_op_multixripools);
5912
+ if (IS_ERR(phba->debug_multixri_pools)) {
5913
+ lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
5914
+ "0527 Cannot create debugfs multixripools\n");
5915
+ goto debug_failed;
5916
+ }
5917
+
5918
+ /* RAS log */
5919
+ snprintf(name, sizeof(name), "ras_log");
5920
+ phba->debug_ras_log =
5921
+ debugfs_create_file(name, 0644,
5922
+ phba->hba_debugfs_root,
5923
+ phba, &lpfc_debugfs_ras_log);
5924
+ if (IS_ERR(phba->debug_ras_log)) {
5925
+ lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
5926
+ "6148 Cannot create debugfs"
5927
+ " ras_log\n");
5928
+ goto debug_failed;
5929
+ }
53085930
53095931 /* Setup hbqinfo */
53105932 snprintf(name, sizeof(name), "hbqinfo");
53115933 phba->debug_hbqinfo =
5312
- debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
5313
- phba->hba_debugfs_root,
5314
- phba, &lpfc_debugfs_op_hbqinfo);
5315
- if (!phba->debug_hbqinfo) {
5934
+ debugfs_create_file(name, S_IFREG | 0644,
5935
+ phba->hba_debugfs_root,
5936
+ phba, &lpfc_debugfs_op_hbqinfo);
5937
+
5938
+#ifdef LPFC_HDWQ_LOCK_STAT
5939
+ /* Setup lockstat */
5940
+ snprintf(name, sizeof(name), "lockstat");
5941
+ phba->debug_lockstat =
5942
+ debugfs_create_file(name, S_IFREG | 0644,
5943
+ phba->hba_debugfs_root,
5944
+ phba, &lpfc_debugfs_op_lockstat);
5945
+ if (IS_ERR(phba->debug_lockstat)) {
53165946 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
5317
- "0411 Cannot create debugfs hbqinfo\n");
5947
+ "4610 Can't create debugfs lockstat\n");
53185948 goto debug_failed;
53195949 }
5950
+#endif
53205951
53215952 /* Setup dumpHBASlim */
53225953 if (phba->sli_rev < LPFC_SLI_REV4) {
....@@ -5326,12 +5957,6 @@
53265957 S_IFREG|S_IRUGO|S_IWUSR,
53275958 phba->hba_debugfs_root,
53285959 phba, &lpfc_debugfs_op_dumpHBASlim);
5329
- if (!phba->debug_dumpHBASlim) {
5330
- lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
5331
- "0413 Cannot create debugfs "
5332
- "dumpHBASlim\n");
5333
- goto debug_failed;
5334
- }
53355960 } else
53365961 phba->debug_dumpHBASlim = NULL;
53375962
....@@ -5343,38 +5968,8 @@
53435968 S_IFREG|S_IRUGO|S_IWUSR,
53445969 phba->hba_debugfs_root,
53455970 phba, &lpfc_debugfs_op_dumpHostSlim);
5346
- if (!phba->debug_dumpHostSlim) {
5347
- lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
5348
- "0414 Cannot create debugfs "
5349
- "dumpHostSlim\n");
5350
- goto debug_failed;
5351
- }
53525971 } else
53535972 phba->debug_dumpHostSlim = NULL;
5354
-
5355
- /* Setup dumpData */
5356
- snprintf(name, sizeof(name), "dumpData");
5357
- phba->debug_dumpData =
5358
- debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
5359
- phba->hba_debugfs_root,
5360
- phba, &lpfc_debugfs_op_dumpData);
5361
- if (!phba->debug_dumpData) {
5362
- lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
5363
- "0800 Cannot create debugfs dumpData\n");
5364
- goto debug_failed;
5365
- }
5366
-
5367
- /* Setup dumpDif */
5368
- snprintf(name, sizeof(name), "dumpDif");
5369
- phba->debug_dumpDif =
5370
- debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
5371
- phba->hba_debugfs_root,
5372
- phba, &lpfc_debugfs_op_dumpDif);
5373
- if (!phba->debug_dumpDif) {
5374
- lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
5375
- "0801 Cannot create debugfs dumpDif\n");
5376
- goto debug_failed;
5377
- }
53785973
53795974 /* Setup DIF Error Injections */
53805975 snprintf(name, sizeof(name), "InjErrLBA");
....@@ -5382,11 +5977,6 @@
53825977 debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
53835978 phba->hba_debugfs_root,
53845979 phba, &lpfc_debugfs_op_dif_err);
5385
- if (!phba->debug_InjErrLBA) {
5386
- lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
5387
- "0807 Cannot create debugfs InjErrLBA\n");
5388
- goto debug_failed;
5389
- }
53905980 phba->lpfc_injerr_lba = LPFC_INJERR_LBA_OFF;
53915981
53925982 snprintf(name, sizeof(name), "InjErrNPortID");
....@@ -5394,88 +5984,48 @@
53945984 debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
53955985 phba->hba_debugfs_root,
53965986 phba, &lpfc_debugfs_op_dif_err);
5397
- if (!phba->debug_InjErrNPortID) {
5398
- lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
5399
- "0809 Cannot create debugfs InjErrNPortID\n");
5400
- goto debug_failed;
5401
- }
54025987
54035988 snprintf(name, sizeof(name), "InjErrWWPN");
54045989 phba->debug_InjErrWWPN =
54055990 debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
54065991 phba->hba_debugfs_root,
54075992 phba, &lpfc_debugfs_op_dif_err);
5408
- if (!phba->debug_InjErrWWPN) {
5409
- lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
5410
- "0810 Cannot create debugfs InjErrWWPN\n");
5411
- goto debug_failed;
5412
- }
54135993
54145994 snprintf(name, sizeof(name), "writeGuardInjErr");
54155995 phba->debug_writeGuard =
54165996 debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
54175997 phba->hba_debugfs_root,
54185998 phba, &lpfc_debugfs_op_dif_err);
5419
- if (!phba->debug_writeGuard) {
5420
- lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
5421
- "0802 Cannot create debugfs writeGuard\n");
5422
- goto debug_failed;
5423
- }
54245999
54256000 snprintf(name, sizeof(name), "writeAppInjErr");
54266001 phba->debug_writeApp =
54276002 debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
54286003 phba->hba_debugfs_root,
54296004 phba, &lpfc_debugfs_op_dif_err);
5430
- if (!phba->debug_writeApp) {
5431
- lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
5432
- "0803 Cannot create debugfs writeApp\n");
5433
- goto debug_failed;
5434
- }
54356005
54366006 snprintf(name, sizeof(name), "writeRefInjErr");
54376007 phba->debug_writeRef =
54386008 debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
54396009 phba->hba_debugfs_root,
54406010 phba, &lpfc_debugfs_op_dif_err);
5441
- if (!phba->debug_writeRef) {
5442
- lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
5443
- "0804 Cannot create debugfs writeRef\n");
5444
- goto debug_failed;
5445
- }
54466011
54476012 snprintf(name, sizeof(name), "readGuardInjErr");
54486013 phba->debug_readGuard =
54496014 debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
54506015 phba->hba_debugfs_root,
54516016 phba, &lpfc_debugfs_op_dif_err);
5452
- if (!phba->debug_readGuard) {
5453
- lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
5454
- "0808 Cannot create debugfs readGuard\n");
5455
- goto debug_failed;
5456
- }
54576017
54586018 snprintf(name, sizeof(name), "readAppInjErr");
54596019 phba->debug_readApp =
54606020 debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
54616021 phba->hba_debugfs_root,
54626022 phba, &lpfc_debugfs_op_dif_err);
5463
- if (!phba->debug_readApp) {
5464
- lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
5465
- "0805 Cannot create debugfs readApp\n");
5466
- goto debug_failed;
5467
- }
54686023
54696024 snprintf(name, sizeof(name), "readRefInjErr");
54706025 phba->debug_readRef =
54716026 debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
54726027 phba->hba_debugfs_root,
54736028 phba, &lpfc_debugfs_op_dif_err);
5474
- if (!phba->debug_readRef) {
5475
- lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
5476
- "0806 Cannot create debugfs readApp\n");
5477
- goto debug_failed;
5478
- }
54796029
54806030 /* Setup slow ring trace */
54816031 if (lpfc_debugfs_max_slow_ring_trc) {
....@@ -5499,12 +6049,6 @@
54996049 debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
55006050 phba->hba_debugfs_root,
55016051 phba, &lpfc_debugfs_op_slow_ring_trc);
5502
- if (!phba->debug_slow_ring_trc) {
5503
- lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
5504
- "0415 Cannot create debugfs "
5505
- "slow_ring_trace\n");
5506
- goto debug_failed;
5507
- }
55086052 if (!phba->slow_ring_trc) {
55096053 phba->slow_ring_trc = kmalloc(
55106054 (sizeof(struct lpfc_debugfs_trc) *
....@@ -5527,11 +6071,6 @@
55276071 debugfs_create_file(name, 0644,
55286072 phba->hba_debugfs_root,
55296073 phba, &lpfc_debugfs_op_nvmeio_trc);
5530
- if (!phba->debug_nvmeio_trc) {
5531
- lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
5532
- "0574 No create debugfs nvmeio_trc\n");
5533
- goto debug_failed;
5534
- }
55356074
55366075 atomic_set(&phba->nvmeio_trc_cnt, 0);
55376076 if (lpfc_debugfs_max_nvmeio_trc) {
....@@ -5579,11 +6118,6 @@
55796118 if (!vport->vport_debugfs_root) {
55806119 vport->vport_debugfs_root =
55816120 debugfs_create_dir(name, phba->hba_debugfs_root);
5582
- if (!vport->vport_debugfs_root) {
5583
- lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
5584
- "0417 Can't create debugfs\n");
5585
- goto debug_failed;
5586
- }
55876121 atomic_inc(&phba->debugfs_vport_count);
55886122 }
55896123
....@@ -5620,55 +6154,45 @@
56206154 debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
56216155 vport->vport_debugfs_root,
56226156 vport, &lpfc_debugfs_op_disc_trc);
5623
- if (!vport->debug_disc_trc) {
5624
- lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
5625
- "0419 Cannot create debugfs "
5626
- "discovery_trace\n");
5627
- goto debug_failed;
5628
- }
56296157 snprintf(name, sizeof(name), "nodelist");
56306158 vport->debug_nodelist =
56316159 debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
56326160 vport->vport_debugfs_root,
56336161 vport, &lpfc_debugfs_op_nodelist);
5634
- if (!vport->debug_nodelist) {
5635
- lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
5636
- "2985 Can't create debugfs nodelist\n");
5637
- goto debug_failed;
5638
- }
56396162
56406163 snprintf(name, sizeof(name), "nvmestat");
56416164 vport->debug_nvmestat =
56426165 debugfs_create_file(name, 0644,
56436166 vport->vport_debugfs_root,
56446167 vport, &lpfc_debugfs_op_nvmestat);
5645
- if (!vport->debug_nvmestat) {
6168
+
6169
+ snprintf(name, sizeof(name), "scsistat");
6170
+ vport->debug_scsistat =
6171
+ debugfs_create_file(name, 0644,
6172
+ vport->vport_debugfs_root,
6173
+ vport, &lpfc_debugfs_op_scsistat);
6174
+ if (IS_ERR(vport->debug_scsistat)) {
56466175 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
5647
- "0811 Cannot create debugfs nvmestat\n");
6176
+ "4611 Cannot create debugfs scsistat\n");
56486177 goto debug_failed;
56496178 }
56506179
5651
- snprintf(name, sizeof(name), "nvmektime");
5652
- vport->debug_nvmektime =
6180
+ snprintf(name, sizeof(name), "ioktime");
6181
+ vport->debug_ioktime =
56536182 debugfs_create_file(name, 0644,
56546183 vport->vport_debugfs_root,
5655
- vport, &lpfc_debugfs_op_nvmektime);
5656
- if (!vport->debug_nvmektime) {
6184
+ vport, &lpfc_debugfs_op_ioktime);
6185
+ if (IS_ERR(vport->debug_ioktime)) {
56576186 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
5658
- "0815 Cannot create debugfs nvmektime\n");
6187
+ "0815 Cannot create debugfs ioktime\n");
56596188 goto debug_failed;
56606189 }
56616190
5662
- snprintf(name, sizeof(name), "cpucheck");
5663
- vport->debug_cpucheck =
6191
+ snprintf(name, sizeof(name), "hdwqstat");
6192
+ vport->debug_hdwqstat =
56646193 debugfs_create_file(name, 0644,
56656194 vport->vport_debugfs_root,
5666
- vport, &lpfc_debugfs_op_cpucheck);
5667
- if (!vport->debug_cpucheck) {
5668
- lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
5669
- "0819 Cannot create debugfs cpucheck\n");
5670
- goto debug_failed;
5671
- }
6195
+ vport, &lpfc_debugfs_op_hdwqstat);
56726196
56736197 /*
56746198 * The following section is for additional directories/files for the
....@@ -5688,11 +6212,6 @@
56886212 if (!phba->idiag_root) {
56896213 phba->idiag_root =
56906214 debugfs_create_dir(name, phba->hba_debugfs_root);
5691
- if (!phba->idiag_root) {
5692
- lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
5693
- "2922 Can't create idiag debugfs\n");
5694
- goto debug_failed;
5695
- }
56966215 /* Initialize iDiag data structure */
56976216 memset(&idiag, 0, sizeof(idiag));
56986217 }
....@@ -5703,11 +6222,6 @@
57036222 phba->idiag_pci_cfg =
57046223 debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
57056224 phba->idiag_root, phba, &lpfc_idiag_op_pciCfg);
5706
- if (!phba->idiag_pci_cfg) {
5707
- lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
5708
- "2923 Can't create idiag debugfs\n");
5709
- goto debug_failed;
5710
- }
57116225 idiag.offset.last_rd = 0;
57126226 }
57136227
....@@ -5717,11 +6231,6 @@
57176231 phba->idiag_bar_acc =
57186232 debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
57196233 phba->idiag_root, phba, &lpfc_idiag_op_barAcc);
5720
- if (!phba->idiag_bar_acc) {
5721
- lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
5722
- "3056 Can't create idiag debugfs\n");
5723
- goto debug_failed;
5724
- }
57256234 idiag.offset.last_rd = 0;
57266235 }
57276236
....@@ -5731,11 +6240,6 @@
57316240 phba->idiag_que_info =
57326241 debugfs_create_file(name, S_IFREG|S_IRUGO,
57336242 phba->idiag_root, phba, &lpfc_idiag_op_queInfo);
5734
- if (!phba->idiag_que_info) {
5735
- lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
5736
- "2924 Can't create idiag debugfs\n");
5737
- goto debug_failed;
5738
- }
57396243 }
57406244
57416245 /* iDiag access PCI function queue */
....@@ -5744,11 +6248,6 @@
57446248 phba->idiag_que_acc =
57456249 debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
57466250 phba->idiag_root, phba, &lpfc_idiag_op_queAcc);
5747
- if (!phba->idiag_que_acc) {
5748
- lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
5749
- "2926 Can't create idiag debugfs\n");
5750
- goto debug_failed;
5751
- }
57526251 }
57536252
57546253 /* iDiag access PCI function doorbell registers */
....@@ -5757,11 +6256,6 @@
57576256 phba->idiag_drb_acc =
57586257 debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
57596258 phba->idiag_root, phba, &lpfc_idiag_op_drbAcc);
5760
- if (!phba->idiag_drb_acc) {
5761
- lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
5762
- "2927 Can't create idiag debugfs\n");
5763
- goto debug_failed;
5764
- }
57656259 }
57666260
57676261 /* iDiag access PCI function control registers */
....@@ -5770,11 +6264,6 @@
57706264 phba->idiag_ctl_acc =
57716265 debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
57726266 phba->idiag_root, phba, &lpfc_idiag_op_ctlAcc);
5773
- if (!phba->idiag_ctl_acc) {
5774
- lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
5775
- "2981 Can't create idiag debugfs\n");
5776
- goto debug_failed;
5777
- }
57786267 }
57796268
57806269 /* iDiag access mbox commands */
....@@ -5783,11 +6272,6 @@
57836272 phba->idiag_mbx_acc =
57846273 debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
57856274 phba->idiag_root, phba, &lpfc_idiag_op_mbxAcc);
5786
- if (!phba->idiag_mbx_acc) {
5787
- lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
5788
- "2980 Can't create idiag debugfs\n");
5789
- goto debug_failed;
5790
- }
57916275 }
57926276
57936277 /* iDiag extents access commands */
....@@ -5799,12 +6283,6 @@
57996283 S_IFREG|S_IRUGO|S_IWUSR,
58006284 phba->idiag_root, phba,
58016285 &lpfc_idiag_op_extAcc);
5802
- if (!phba->idiag_ext_acc) {
5803
- lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
5804
- "2986 Cant create "
5805
- "idiag debugfs\n");
5806
- goto debug_failed;
5807
- }
58086286 }
58096287 }
58106288
....@@ -5842,11 +6320,14 @@
58426320 debugfs_remove(vport->debug_nvmestat); /* nvmestat */
58436321 vport->debug_nvmestat = NULL;
58446322
5845
- debugfs_remove(vport->debug_nvmektime); /* nvmektime */
5846
- vport->debug_nvmektime = NULL;
6323
+ debugfs_remove(vport->debug_scsistat); /* scsistat */
6324
+ vport->debug_scsistat = NULL;
58476325
5848
- debugfs_remove(vport->debug_cpucheck); /* cpucheck */
5849
- vport->debug_cpucheck = NULL;
6326
+ debugfs_remove(vport->debug_ioktime); /* ioktime */
6327
+ vport->debug_ioktime = NULL;
6328
+
6329
+ debugfs_remove(vport->debug_hdwqstat); /* hdwqstat */
6330
+ vport->debug_hdwqstat = NULL;
58506331
58516332 if (vport->vport_debugfs_root) {
58526333 debugfs_remove(vport->vport_debugfs_root); /* vportX */
....@@ -5856,20 +6337,24 @@
58566337
58576338 if (atomic_read(&phba->debugfs_vport_count) == 0) {
58586339
6340
+ debugfs_remove(phba->debug_multixri_pools); /* multixripools*/
6341
+ phba->debug_multixri_pools = NULL;
6342
+
58596343 debugfs_remove(phba->debug_hbqinfo); /* hbqinfo */
58606344 phba->debug_hbqinfo = NULL;
58616345
6346
+ debugfs_remove(phba->debug_ras_log);
6347
+ phba->debug_ras_log = NULL;
6348
+
6349
+#ifdef LPFC_HDWQ_LOCK_STAT
6350
+ debugfs_remove(phba->debug_lockstat); /* lockstat */
6351
+ phba->debug_lockstat = NULL;
6352
+#endif
58626353 debugfs_remove(phba->debug_dumpHBASlim); /* HBASlim */
58636354 phba->debug_dumpHBASlim = NULL;
58646355
58656356 debugfs_remove(phba->debug_dumpHostSlim); /* HostSlim */
58666357 phba->debug_dumpHostSlim = NULL;
5867
-
5868
- debugfs_remove(phba->debug_dumpData); /* dumpData */
5869
- phba->debug_dumpData = NULL;
5870
-
5871
- debugfs_remove(phba->debug_dumpDif); /* dumpDif */
5872
- phba->debug_dumpDif = NULL;
58736358
58746359 debugfs_remove(phba->debug_InjErrLBA); /* InjErrLBA */
58756360 phba->debug_InjErrLBA = NULL;
....@@ -5991,11 +6476,8 @@
59916476 lpfc_debug_dump_wq(phba, DUMP_ELS, 0);
59926477 lpfc_debug_dump_wq(phba, DUMP_NVMELS, 0);
59936478
5994
- for (idx = 0; idx < phba->cfg_fcp_io_channel; idx++)
5995
- lpfc_debug_dump_wq(phba, DUMP_FCP, idx);
5996
-
5997
- for (idx = 0; idx < phba->cfg_nvme_io_channel; idx++)
5998
- lpfc_debug_dump_wq(phba, DUMP_NVME, idx);
6479
+ for (idx = 0; idx < phba->cfg_hdw_queue; idx++)
6480
+ lpfc_debug_dump_wq(phba, DUMP_IO, idx);
59996481
60006482 lpfc_debug_dump_hdr_rq(phba);
60016483 lpfc_debug_dump_dat_rq(phba);
....@@ -6006,15 +6488,12 @@
60066488 lpfc_debug_dump_cq(phba, DUMP_ELS, 0);
60076489 lpfc_debug_dump_cq(phba, DUMP_NVMELS, 0);
60086490
6009
- for (idx = 0; idx < phba->cfg_fcp_io_channel; idx++)
6010
- lpfc_debug_dump_cq(phba, DUMP_FCP, idx);
6011
-
6012
- for (idx = 0; idx < phba->cfg_nvme_io_channel; idx++)
6013
- lpfc_debug_dump_cq(phba, DUMP_NVME, idx);
6491
+ for (idx = 0; idx < phba->cfg_hdw_queue; idx++)
6492
+ lpfc_debug_dump_cq(phba, DUMP_IO, idx);
60146493
60156494 /*
60166495 * Dump Event Queues (EQs)
60176496 */
6018
- for (idx = 0; idx < phba->io_channel_irqs; idx++)
6497
+ for (idx = 0; idx < phba->cfg_hdw_queue; idx++)
60196498 lpfc_debug_dump_hba_eq(phba, idx);
60206499 }