forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 072de836f53be56a70cecf70b43ae43b7ce17376
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,228 @@
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
+
2163
+ memset(mybuf, 0, sizeof(mybuf));
2164
+
2165
+ if (copy_from_user(mybuf, buf, nbytes))
2166
+ return -EFAULT;
2167
+ pbuf = &mybuf[0];
2168
+
2169
+ if ((strncmp(pbuf, "reset", strlen("reset")) == 0) ||
2170
+ (strncmp(pbuf, "zero", strlen("zero")) == 0)) {
2171
+ for (i = 0; i < phba->cfg_hdw_queue; i++) {
2172
+ qp = &phba->sli4_hba.hdwq[i];
2173
+ qp->lock_conflict.alloc_xri_get = 0;
2174
+ qp->lock_conflict.alloc_xri_put = 0;
2175
+ qp->lock_conflict.free_xri = 0;
2176
+ qp->lock_conflict.wq_access = 0;
2177
+ qp->lock_conflict.alloc_pvt_pool = 0;
2178
+ qp->lock_conflict.mv_from_pvt_pool = 0;
2179
+ qp->lock_conflict.mv_to_pub_pool = 0;
2180
+ qp->lock_conflict.mv_to_pvt_pool = 0;
2181
+ qp->lock_conflict.free_pvt_pool = 0;
2182
+ qp->lock_conflict.free_pub_pool = 0;
2183
+ qp->lock_conflict.wq_access = 0;
2184
+ }
2185
+ }
2186
+ return nbytes;
2187
+}
2188
+#endif
2189
+
2190
+static int lpfc_debugfs_ras_log_data(struct lpfc_hba *phba,
2191
+ char *buffer, int size)
2192
+{
2193
+ int copied = 0;
2194
+ struct lpfc_dmabuf *dmabuf, *next;
2195
+
2196
+ memset(buffer, 0, size);
2197
+
2198
+ spin_lock_irq(&phba->hbalock);
2199
+ if (phba->ras_fwlog.state != ACTIVE) {
2200
+ spin_unlock_irq(&phba->hbalock);
2201
+ return -EINVAL;
2202
+ }
2203
+ spin_unlock_irq(&phba->hbalock);
2204
+
2205
+ list_for_each_entry_safe(dmabuf, next,
2206
+ &phba->ras_fwlog.fwlog_buff_list, list) {
2207
+ /* Check if copying will go over size and a '\0' char */
2208
+ if ((copied + LPFC_RAS_MAX_ENTRY_SIZE) >= (size - 1)) {
2209
+ memcpy(buffer + copied, dmabuf->virt,
2210
+ size - copied - 1);
2211
+ copied += size - copied - 1;
2212
+ break;
2213
+ }
2214
+ memcpy(buffer + copied, dmabuf->virt, LPFC_RAS_MAX_ENTRY_SIZE);
2215
+ copied += LPFC_RAS_MAX_ENTRY_SIZE;
2216
+ }
2217
+ return copied;
2218
+}
2219
+
2220
+static int
2221
+lpfc_debugfs_ras_log_release(struct inode *inode, struct file *file)
2222
+{
2223
+ struct lpfc_debug *debug = file->private_data;
2224
+
2225
+ vfree(debug->buffer);
2226
+ kfree(debug);
2227
+
2228
+ return 0;
2229
+}
2230
+
2231
+/**
2232
+ * lpfc_debugfs_ras_log_open - Open the RAS log debugfs buffer
2233
+ * @inode: The inode pointer that contains a vport pointer.
2234
+ * @file: The file pointer to attach the log output.
2235
+ *
2236
+ * Description:
2237
+ * This routine is the entry point for the debugfs open file operation. It gets
2238
+ * the vport from the i_private field in @inode, allocates the necessary buffer
2239
+ * for the log, fills the buffer from the in-memory log for this vport, and then
2240
+ * returns a pointer to that log in the private_data field in @file.
2241
+ *
2242
+ * Returns:
2243
+ * This function returns zero if successful. On error it will return a negative
2244
+ * error value.
2245
+ **/
2246
+static int
2247
+lpfc_debugfs_ras_log_open(struct inode *inode, struct file *file)
2248
+{
2249
+ struct lpfc_hba *phba = inode->i_private;
2250
+ struct lpfc_debug *debug;
2251
+ int size;
2252
+ int rc = -ENOMEM;
2253
+
2254
+ spin_lock_irq(&phba->hbalock);
2255
+ if (phba->ras_fwlog.state != ACTIVE) {
2256
+ spin_unlock_irq(&phba->hbalock);
2257
+ rc = -EINVAL;
2258
+ goto out;
2259
+ }
2260
+ spin_unlock_irq(&phba->hbalock);
2261
+ debug = kmalloc(sizeof(*debug), GFP_KERNEL);
2262
+ if (!debug)
2263
+ goto out;
2264
+
2265
+ size = LPFC_RAS_MIN_BUFF_POST_SIZE * phba->cfg_ras_fwlog_buffsize;
2266
+ debug->buffer = vmalloc(size);
2267
+ if (!debug->buffer)
2268
+ goto free_debug;
2269
+
2270
+ debug->len = lpfc_debugfs_ras_log_data(phba, debug->buffer, size);
2271
+ if (debug->len < 0) {
2272
+ rc = -EINVAL;
2273
+ goto free_buffer;
2274
+ }
2275
+ file->private_data = debug;
2276
+
2277
+ return 0;
2278
+
2279
+free_buffer:
2280
+ vfree(debug->buffer);
2281
+free_debug:
2282
+ kfree(debug);
16202283 out:
16212284 return rc;
16222285 }
....@@ -1705,89 +2368,6 @@
17052368 return rc;
17062369 }
17072370
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
-
17912371 static ssize_t
17922372 lpfc_debugfs_dif_err_read(struct file *file, char __user *buf,
17932373 size_t nbytes, loff_t *ppos)
....@@ -1846,7 +2426,8 @@
18462426 return -EFAULT;
18472427
18482428 if (dent == phba->debug_InjErrLBA) {
1849
- if ((buf[0] == 'o') && (buf[1] == 'f') && (buf[2] == 'f'))
2429
+ if ((dstbuf[0] == 'o') && (dstbuf[1] == 'f') &&
2430
+ (dstbuf[2] == 'f'))
18502431 tmp = (uint64_t)(-1);
18512432 }
18522433
....@@ -2000,17 +2581,71 @@
20002581 return 0;
20012582 }
20022583
2003
-static int
2004
-lpfc_debugfs_dumpDataDif_release(struct inode *inode, struct file *file)
2584
+/**
2585
+ * lpfc_debugfs_multixripools_write - Clear multi-XRI pools statistics
2586
+ * @file: The file pointer to read from.
2587
+ * @buf: The buffer to copy the user data from.
2588
+ * @nbytes: The number of bytes to get.
2589
+ * @ppos: The position in the file to start reading from.
2590
+ *
2591
+ * Description:
2592
+ * This routine clears multi-XRI pools statistics when buf contains "clear".
2593
+ *
2594
+ * Return Value:
2595
+ * It returns the @nbytges passing in from debugfs user space when successful.
2596
+ * In case of error conditions, it returns proper error code back to the user
2597
+ * space.
2598
+ **/
2599
+static ssize_t
2600
+lpfc_debugfs_multixripools_write(struct file *file, const char __user *buf,
2601
+ size_t nbytes, loff_t *ppos)
20052602 {
20062603 struct lpfc_debug *debug = file->private_data;
2604
+ struct lpfc_hba *phba = (struct lpfc_hba *)debug->i_private;
2605
+ char mybuf[64];
2606
+ char *pbuf;
2607
+ u32 i;
2608
+ u32 hwq_count;
2609
+ struct lpfc_sli4_hdw_queue *qp;
2610
+ struct lpfc_multixri_pool *multixri_pool;
20072611
2008
- debug->buffer = NULL;
2009
- kfree(debug);
2612
+ if (nbytes > sizeof(mybuf) - 1)
2613
+ nbytes = sizeof(mybuf) - 1;
20102614
2011
- return 0;
2615
+ memset(mybuf, 0, sizeof(mybuf));
2616
+
2617
+ if (copy_from_user(mybuf, buf, nbytes))
2618
+ return -EFAULT;
2619
+ pbuf = &mybuf[0];
2620
+
2621
+ if ((strncmp(pbuf, "clear", strlen("clear"))) == 0) {
2622
+ hwq_count = phba->cfg_hdw_queue;
2623
+ for (i = 0; i < hwq_count; i++) {
2624
+ qp = &phba->sli4_hba.hdwq[i];
2625
+ multixri_pool = qp->p_multixri_pool;
2626
+ if (!multixri_pool)
2627
+ continue;
2628
+
2629
+ qp->empty_io_bufs = 0;
2630
+ multixri_pool->pbl_empty_count = 0;
2631
+#ifdef LPFC_MXP_STAT
2632
+ multixri_pool->above_limit_count = 0;
2633
+ multixri_pool->below_limit_count = 0;
2634
+ multixri_pool->stat_max_hwm = 0;
2635
+ multixri_pool->local_pbl_hit_count = 0;
2636
+ multixri_pool->other_pbl_hit_count = 0;
2637
+
2638
+ multixri_pool->stat_pbl_count = 0;
2639
+ multixri_pool->stat_pvt_count = 0;
2640
+ multixri_pool->stat_busy_count = 0;
2641
+ multixri_pool->stat_snapshot_taken = 0;
2642
+#endif
2643
+ }
2644
+ return strlen(pbuf);
2645
+ }
2646
+
2647
+ return -EINVAL;
20122648 }
2013
-
20142649
20152650 static int
20162651 lpfc_debugfs_nvmestat_open(struct inode *inode, struct file *file)
....@@ -2055,8 +2690,8 @@
20552690 if (!phba->targetport)
20562691 return -ENXIO;
20572692
2058
- if (nbytes > 64)
2059
- nbytes = 64;
2693
+ if (nbytes > sizeof(mybuf) - 1)
2694
+ nbytes = sizeof(mybuf) - 1;
20602695
20612696 memset(mybuf, 0, sizeof(mybuf));
20622697
....@@ -2101,7 +2736,7 @@
21012736 }
21022737
21032738 static int
2104
-lpfc_debugfs_nvmektime_open(struct inode *inode, struct file *file)
2739
+lpfc_debugfs_scsistat_open(struct inode *inode, struct file *file)
21052740 {
21062741 struct lpfc_vport *vport = inode->i_private;
21072742 struct lpfc_debug *debug;
....@@ -2112,14 +2747,14 @@
21122747 goto out;
21132748
21142749 /* Round to page boundary */
2115
- debug->buffer = kmalloc(LPFC_NVMEKTIME_SIZE, GFP_KERNEL);
2750
+ debug->buffer = kzalloc(LPFC_SCSISTAT_SIZE, GFP_KERNEL);
21162751 if (!debug->buffer) {
21172752 kfree(debug);
21182753 goto out;
21192754 }
21202755
2121
- debug->len = lpfc_debugfs_nvmektime_data(vport, debug->buffer,
2122
- LPFC_NVMEKTIME_SIZE);
2756
+ debug->len = lpfc_debugfs_scsistat_data(vport, debug->buffer,
2757
+ LPFC_SCSISTAT_SIZE);
21232758
21242759 debug->i_private = inode->i_private;
21252760 file->private_data = debug;
....@@ -2130,8 +2765,62 @@
21302765 }
21312766
21322767 static ssize_t
2133
-lpfc_debugfs_nvmektime_write(struct file *file, const char __user *buf,
2134
- size_t nbytes, loff_t *ppos)
2768
+lpfc_debugfs_scsistat_write(struct file *file, const char __user *buf,
2769
+ size_t nbytes, loff_t *ppos)
2770
+{
2771
+ struct lpfc_debug *debug = file->private_data;
2772
+ struct lpfc_vport *vport = (struct lpfc_vport *)debug->i_private;
2773
+ struct lpfc_hba *phba = vport->phba;
2774
+ char mybuf[6] = {0};
2775
+ int i;
2776
+
2777
+ if (copy_from_user(mybuf, buf, (nbytes >= sizeof(mybuf)) ?
2778
+ (sizeof(mybuf) - 1) : nbytes))
2779
+ return -EFAULT;
2780
+
2781
+ if ((strncmp(&mybuf[0], "reset", strlen("reset")) == 0) ||
2782
+ (strncmp(&mybuf[0], "zero", strlen("zero")) == 0)) {
2783
+ for (i = 0; i < phba->cfg_hdw_queue; i++) {
2784
+ memset(&phba->sli4_hba.hdwq[i].scsi_cstat, 0,
2785
+ sizeof(phba->sli4_hba.hdwq[i].scsi_cstat));
2786
+ }
2787
+ }
2788
+
2789
+ return nbytes;
2790
+}
2791
+
2792
+static int
2793
+lpfc_debugfs_ioktime_open(struct inode *inode, struct file *file)
2794
+{
2795
+ struct lpfc_vport *vport = inode->i_private;
2796
+ struct lpfc_debug *debug;
2797
+ int rc = -ENOMEM;
2798
+
2799
+ debug = kmalloc(sizeof(*debug), GFP_KERNEL);
2800
+ if (!debug)
2801
+ goto out;
2802
+
2803
+ /* Round to page boundary */
2804
+ debug->buffer = kmalloc(LPFC_IOKTIME_SIZE, GFP_KERNEL);
2805
+ if (!debug->buffer) {
2806
+ kfree(debug);
2807
+ goto out;
2808
+ }
2809
+
2810
+ debug->len = lpfc_debugfs_ioktime_data(vport, debug->buffer,
2811
+ LPFC_IOKTIME_SIZE);
2812
+
2813
+ debug->i_private = inode->i_private;
2814
+ file->private_data = debug;
2815
+
2816
+ rc = 0;
2817
+out:
2818
+ return rc;
2819
+}
2820
+
2821
+static ssize_t
2822
+lpfc_debugfs_ioktime_write(struct file *file, const char __user *buf,
2823
+ size_t nbytes, loff_t *ppos)
21352824 {
21362825 struct lpfc_debug *debug = file->private_data;
21372826 struct lpfc_vport *vport = (struct lpfc_vport *)debug->i_private;
....@@ -2139,8 +2828,8 @@
21392828 char mybuf[64];
21402829 char *pbuf;
21412830
2142
- if (nbytes > 64)
2143
- nbytes = 64;
2831
+ if (nbytes > sizeof(mybuf) - 1)
2832
+ nbytes = sizeof(mybuf) - 1;
21442833
21452834 memset(mybuf, 0, sizeof(mybuf));
21462835
....@@ -2267,8 +2956,8 @@
22672956 char mybuf[64];
22682957 char *pbuf;
22692958
2270
- if (nbytes > 63)
2271
- nbytes = 63;
2959
+ if (nbytes > sizeof(mybuf) - 1)
2960
+ nbytes = sizeof(mybuf) - 1;
22722961
22732962 memset(mybuf, 0, sizeof(mybuf));
22742963
....@@ -2333,7 +3022,7 @@
23333022 }
23343023
23353024 static int
2336
-lpfc_debugfs_cpucheck_open(struct inode *inode, struct file *file)
3025
+lpfc_debugfs_hdwqstat_open(struct inode *inode, struct file *file)
23373026 {
23383027 struct lpfc_vport *vport = inode->i_private;
23393028 struct lpfc_debug *debug;
....@@ -2344,14 +3033,14 @@
23443033 goto out;
23453034
23463035 /* Round to page boundary */
2347
- debug->buffer = kmalloc(LPFC_CPUCHECK_SIZE, GFP_KERNEL);
3036
+ debug->buffer = kcalloc(1, LPFC_SCSISTAT_SIZE, GFP_KERNEL);
23483037 if (!debug->buffer) {
23493038 kfree(debug);
23503039 goto out;
23513040 }
23523041
2353
- debug->len = lpfc_debugfs_cpucheck_data(vport, debug->buffer,
2354
- LPFC_NVMEKTIME_SIZE);
3042
+ debug->len = lpfc_debugfs_hdwqstat_data(vport, debug->buffer,
3043
+ LPFC_SCSISTAT_SIZE);
23553044
23563045 debug->i_private = inode->i_private;
23573046 file->private_data = debug;
....@@ -2362,18 +3051,19 @@
23623051 }
23633052
23643053 static ssize_t
2365
-lpfc_debugfs_cpucheck_write(struct file *file, const char __user *buf,
3054
+lpfc_debugfs_hdwqstat_write(struct file *file, const char __user *buf,
23663055 size_t nbytes, loff_t *ppos)
23673056 {
23683057 struct lpfc_debug *debug = file->private_data;
23693058 struct lpfc_vport *vport = (struct lpfc_vport *)debug->i_private;
23703059 struct lpfc_hba *phba = vport->phba;
3060
+ struct lpfc_hdwq_stat *c_stat;
23713061 char mybuf[64];
23723062 char *pbuf;
23733063 int i;
23743064
2375
- if (nbytes > 64)
2376
- nbytes = 64;
3065
+ if (nbytes > sizeof(mybuf) - 1)
3066
+ nbytes = sizeof(mybuf) - 1;
23773067
23783068 memset(mybuf, 0, sizeof(mybuf));
23793069
....@@ -2383,30 +3073,39 @@
23833073
23843074 if ((strncmp(pbuf, "on", sizeof("on") - 1) == 0)) {
23853075 if (phba->nvmet_support)
2386
- phba->cpucheck_on |= LPFC_CHECK_NVMET_IO;
3076
+ phba->hdwqstat_on |= LPFC_CHECK_NVMET_IO;
23873077 else
2388
- phba->cpucheck_on |= LPFC_CHECK_NVME_IO;
3078
+ phba->hdwqstat_on |= (LPFC_CHECK_NVME_IO |
3079
+ LPFC_CHECK_SCSI_IO);
23893080 return strlen(pbuf);
2390
- } else if ((strncmp(pbuf, "rcv",
2391
- sizeof("rcv") - 1) == 0)) {
3081
+ } else if ((strncmp(pbuf, "nvme_on", sizeof("nvme_on") - 1) == 0)) {
23923082 if (phba->nvmet_support)
2393
- phba->cpucheck_on |= LPFC_CHECK_NVMET_RCV;
3083
+ phba->hdwqstat_on |= LPFC_CHECK_NVMET_IO;
23943084 else
2395
- return -EINVAL;
3085
+ phba->hdwqstat_on |= LPFC_CHECK_NVME_IO;
3086
+ return strlen(pbuf);
3087
+ } else if ((strncmp(pbuf, "scsi_on", sizeof("scsi_on") - 1) == 0)) {
3088
+ if (!phba->nvmet_support)
3089
+ phba->hdwqstat_on |= LPFC_CHECK_SCSI_IO;
3090
+ return strlen(pbuf);
3091
+ } else if ((strncmp(pbuf, "nvme_off", sizeof("nvme_off") - 1) == 0)) {
3092
+ phba->hdwqstat_on &= ~(LPFC_CHECK_NVME_IO |
3093
+ LPFC_CHECK_NVMET_IO);
3094
+ return strlen(pbuf);
3095
+ } else if ((strncmp(pbuf, "scsi_off", sizeof("scsi_off") - 1) == 0)) {
3096
+ phba->hdwqstat_on &= ~LPFC_CHECK_SCSI_IO;
23963097 return strlen(pbuf);
23973098 } else if ((strncmp(pbuf, "off",
23983099 sizeof("off") - 1) == 0)) {
2399
- phba->cpucheck_on = LPFC_CHECK_OFF;
3100
+ phba->hdwqstat_on = LPFC_CHECK_OFF;
24003101 return strlen(pbuf);
24013102 } else if ((strncmp(pbuf, "zero",
24023103 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;
3104
+ for_each_present_cpu(i) {
3105
+ c_stat = per_cpu_ptr(phba->sli4_hba.c_stat, i);
3106
+ c_stat->xmt_io = 0;
3107
+ c_stat->cmpl_io = 0;
3108
+ c_stat->rcv_io = 0;
24103109 }
24113110 return strlen(pbuf);
24123111 }
....@@ -3169,10 +3868,10 @@
31693868 (unsigned long long)qp->q_cnt_4);
31703869 len += scnprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len,
31713870 "\t\tWQID[%02d], QE-CNT[%04d], QE-SZ[%04d], "
3172
- "HST-IDX[%04d], PRT-IDX[%04d], PST[%03d]",
3871
+ "HST-IDX[%04d], PRT-IDX[%04d], NTFI[%03d]",
31733872 qp->queue_id, qp->entry_count,
31743873 qp->entry_size, qp->host_index,
3175
- qp->hba_index, qp->entry_repost);
3874
+ qp->hba_index, qp->notify_interval);
31763875 len += scnprintf(pbuffer + len,
31773876 LPFC_QUE_INFO_GET_BUF_SIZE - len, "\n");
31783877 return len;
....@@ -3185,16 +3884,8 @@
31853884 struct lpfc_queue *qp;
31863885 int qidx;
31873886
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];
3887
+ for (qidx = 0; qidx < phba->cfg_hdw_queue; qidx++) {
3888
+ qp = phba->sli4_hba.hdwq[qidx].io_wq;
31983889 if (qp->assoc_qid != cq_id)
31993890 continue;
32003891 *len = __lpfc_idiag_print_wq(qp, wqtype, pbuffer, *len);
....@@ -3220,12 +3911,13 @@
32203911 qp->q_cnt_3, (unsigned long long)qp->q_cnt_4);
32213912 len += scnprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len,
32223913 "\tCQID[%02d], QE-CNT[%04d], QE-SZ[%04d], "
3223
- "HST-IDX[%04d], PRT-IDX[%04d], PST[%03d]",
3914
+ "HST-IDX[%04d], NTFI[%03d], PLMT[%03d]",
32243915 qp->queue_id, qp->entry_count,
32253916 qp->entry_size, qp->host_index,
3226
- qp->hba_index, qp->entry_repost);
3917
+ qp->notify_interval, qp->max_proc_limit);
32273918
3228
- len += scnprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len, "\n");
3919
+ len += scnprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len,
3920
+ "\n");
32293921
32303922 return len;
32313923 }
....@@ -3246,15 +3938,15 @@
32463938 qp->q_cnt_3, (unsigned long long)qp->q_cnt_4);
32473939 len += scnprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len,
32483940 "\t\tHQID[%02d], QE-CNT[%04d], QE-SZ[%04d], "
3249
- "HST-IDX[%04d], PRT-IDX[%04d], PST[%03d]\n",
3941
+ "HST-IDX[%04d], PRT-IDX[%04d], NTFI[%03d]\n",
32503942 qp->queue_id, qp->entry_count, qp->entry_size,
3251
- qp->host_index, qp->hba_index, qp->entry_repost);
3943
+ qp->host_index, qp->hba_index, qp->notify_interval);
32523944 len += scnprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len,
32533945 "\t\tDQID[%02d], QE-CNT[%04d], QE-SZ[%04d], "
3254
- "HST-IDX[%04d], PRT-IDX[%04d], PST[%03d]\n",
3946
+ "HST-IDX[%04d], PRT-IDX[%04d], NTFI[%03d]\n",
32553947 datqp->queue_id, datqp->entry_count,
32563948 datqp->entry_size, datqp->host_index,
3257
- datqp->hba_index, datqp->entry_repost);
3949
+ datqp->hba_index, datqp->notify_interval);
32583950 return len;
32593951 }
32603952
....@@ -3263,45 +3955,22 @@
32633955 int *len, int max_cnt, int eqidx, int eq_id)
32643956 {
32653957 struct lpfc_queue *qp;
3266
- int qidx, rc;
3958
+ int rc;
32673959
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;
3960
+ qp = phba->sli4_hba.hdwq[eqidx].io_cq;
32723961
3273
- *len = __lpfc_idiag_print_cq(qp, "FCP", pbuffer, *len);
3962
+ *len = __lpfc_idiag_print_cq(qp, "IO", pbuffer, *len);
32743963
3275
- /* Reset max counter */
3276
- qp->CQ_max_cqe = 0;
3964
+ /* Reset max counter */
3965
+ qp->CQ_max_cqe = 0;
32773966
3278
- if (*len >= max_cnt)
3279
- return 1;
3967
+ if (*len >= max_cnt)
3968
+ return 1;
32803969
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
- }
3970
+ rc = lpfc_idiag_wqs_for_cq(phba, "IO", pbuffer, len,
3971
+ max_cnt, qp->queue_id);
3972
+ if (rc)
3973
+ return 1;
33053974
33063975 if ((eqidx < phba->cfg_nvmet_mrq) && phba->nvmet_support) {
33073976 /* NVMET CQset */
....@@ -3341,10 +4010,12 @@
33414010 (unsigned long long)qp->q_cnt_4, qp->q_mode);
33424011 len += scnprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len,
33434012 "EQID[%02d], QE-CNT[%04d], QE-SZ[%04d], "
3344
- "HST-IDX[%04d], PRT-IDX[%04d], PST[%03d]",
4013
+ "HST-IDX[%04d], NTFI[%03d], PLMT[%03d], AFFIN[%03d]",
33454014 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");
4015
+ qp->host_index, qp->notify_interval,
4016
+ qp->max_proc_limit, qp->chann);
4017
+ len += scnprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len,
4018
+ "\n");
33484019
33494020 return len;
33504021 }
....@@ -3390,24 +4061,20 @@
33904061 spin_lock_irq(&phba->hbalock);
33914062
33924063 /* Fast-path event queue */
3393
- if (phba->sli4_hba.hba_eq && phba->io_channel_irqs) {
4064
+ if (phba->sli4_hba.hdwq && phba->cfg_hdw_queue) {
33944065
33954066 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
- }
34004067 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;
4068
+ if (phba->lpfc_idiag_last_eq >= phba->cfg_hdw_queue)
4069
+ phba->lpfc_idiag_last_eq = 0;
34044070
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);
4071
+ len += scnprintf(pbuffer + len,
4072
+ LPFC_QUE_INFO_GET_BUF_SIZE - len,
4073
+ "HDWQ %d out of %d HBA HDWQs\n",
4074
+ x, phba->cfg_hdw_queue);
34084075
34094076 /* Fast-path EQ */
3410
- qp = phba->sli4_hba.hba_eq[x];
4077
+ qp = phba->sli4_hba.hdwq[x].hba_eq;
34114078 if (!qp)
34124079 goto out;
34134080
....@@ -3482,35 +4149,6 @@
34824149 goto out;
34834150 }
34844151
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
-
35144152 spin_unlock_irq(&phba->hbalock);
35154153 return simple_read_from_buffer(buf, nbytes, ppos, pbuffer, len);
35164154
....@@ -3575,7 +4213,7 @@
35754213 "QE-INDEX[%04d]:\n", index);
35764214
35774215 offset = 0;
3578
- pentry = pque->qe[index].address;
4216
+ pentry = lpfc_sli4_qe(pque, index);
35794217 while (esize > 0) {
35804218 len += scnprintf(pbuffer+len, LPFC_QUE_ACC_BUF_SIZE-len,
35814219 "%08x ", *pentry);
....@@ -3728,9 +4366,9 @@
37284366 switch (quetp) {
37294367 case LPFC_IDIAG_EQ:
37304368 /* 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];
4369
+ if (phba->sli4_hba.hdwq) {
4370
+ for (qidx = 0; qidx < phba->cfg_hdw_queue; qidx++) {
4371
+ qp = phba->sli4_hba.hdwq[qidx].hba_eq;
37344372 if (qp && qp->queue_id == queid) {
37354373 /* Sanity check */
37364374 rc = lpfc_idiag_que_param_check(qp,
....@@ -3779,10 +4417,10 @@
37794417 goto pass_check;
37804418 }
37814419 /* FCP complete queue */
3782
- if (phba->sli4_hba.fcp_cq) {
3783
- for (qidx = 0; qidx < phba->cfg_fcp_io_channel;
4420
+ if (phba->sli4_hba.hdwq) {
4421
+ for (qidx = 0; qidx < phba->cfg_hdw_queue;
37844422 qidx++) {
3785
- qp = phba->sli4_hba.fcp_cq[qidx];
4423
+ qp = phba->sli4_hba.hdwq[qidx].io_cq;
37864424 if (qp && qp->queue_id == queid) {
37874425 /* Sanity check */
37884426 rc = lpfc_idiag_que_param_check(
....@@ -3793,25 +4431,6 @@
37934431 goto pass_check;
37944432 }
37954433 }
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);
38154434 }
38164435 goto error_out;
38174436 break;
....@@ -3852,27 +4471,11 @@
38524471 idiag.ptr_private = phba->sli4_hba.nvmels_wq;
38534472 goto pass_check;
38544473 }
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];
4474
+
4475
+ if (phba->sli4_hba.hdwq) {
4476
+ /* FCP/SCSI work queue */
4477
+ for (qidx = 0; qidx < phba->cfg_hdw_queue; qidx++) {
4478
+ qp = phba->sli4_hba.hdwq[qidx].io_wq;
38764479 if (qp && qp->queue_id == queid) {
38774480 /* Sanity check */
38784481 rc = lpfc_idiag_que_param_check(
....@@ -3885,26 +4488,6 @@
38854488 }
38864489 }
38874490
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
- }
39084491 goto error_out;
39094492 break;
39104493 case LPFC_IDIAG_RQ:
....@@ -3951,7 +4534,7 @@
39514534 pque = (struct lpfc_queue *)idiag.ptr_private;
39524535 if (offset > pque->entry_size/sizeof(uint32_t) - 1)
39534536 goto error_out;
3954
- pentry = pque->qe[index].address;
4537
+ pentry = lpfc_sli4_qe(pque, index);
39554538 pentry += offset;
39564539 if (idiag.cmd.opcode == LPFC_IDIAG_CMD_QUEACC_WR)
39574540 *pentry = value;
....@@ -3972,7 +4555,7 @@
39724555 * lpfc_idiag_drbacc_read_reg - idiag debugfs read a doorbell register
39734556 * @phba: The pointer to hba structure.
39744557 * @pbuffer: The pointer to the buffer to copy the data to.
3975
- * @len: The lenght of bytes to copied.
4558
+ * @len: The length of bytes to copied.
39764559 * @drbregid: The id to doorbell registers.
39774560 *
39784561 * Description:
....@@ -4182,7 +4765,7 @@
41824765 * lpfc_idiag_ctlacc_read_reg - idiag debugfs read a control registers
41834766 * @phba: The pointer to hba structure.
41844767 * @pbuffer: The pointer to the buffer to copy the data to.
4185
- * @len: The lenght of bytes to copied.
4768
+ * @len: The length of bytes to copied.
41864769 * @drbregid: The id to doorbell registers.
41874770 *
41884771 * Description:
....@@ -4869,6 +5452,16 @@
48695452 .release = lpfc_debugfs_release,
48705453 };
48715454
5455
+#undef lpfc_debugfs_op_multixripools
5456
+static const struct file_operations lpfc_debugfs_op_multixripools = {
5457
+ .owner = THIS_MODULE,
5458
+ .open = lpfc_debugfs_multixripools_open,
5459
+ .llseek = lpfc_debugfs_lseek,
5460
+ .read = lpfc_debugfs_read,
5461
+ .write = lpfc_debugfs_multixripools_write,
5462
+ .release = lpfc_debugfs_release,
5463
+};
5464
+
48725465 #undef lpfc_debugfs_op_hbqinfo
48735466 static const struct file_operations lpfc_debugfs_op_hbqinfo = {
48745467 .owner = THIS_MODULE,
....@@ -4876,6 +5469,27 @@
48765469 .llseek = lpfc_debugfs_lseek,
48775470 .read = lpfc_debugfs_read,
48785471 .release = lpfc_debugfs_release,
5472
+};
5473
+
5474
+#ifdef LPFC_HDWQ_LOCK_STAT
5475
+#undef lpfc_debugfs_op_lockstat
5476
+static const struct file_operations lpfc_debugfs_op_lockstat = {
5477
+ .owner = THIS_MODULE,
5478
+ .open = lpfc_debugfs_lockstat_open,
5479
+ .llseek = lpfc_debugfs_lseek,
5480
+ .read = lpfc_debugfs_read,
5481
+ .write = lpfc_debugfs_lockstat_write,
5482
+ .release = lpfc_debugfs_release,
5483
+};
5484
+#endif
5485
+
5486
+#undef lpfc_debugfs_ras_log
5487
+static const struct file_operations lpfc_debugfs_ras_log = {
5488
+ .owner = THIS_MODULE,
5489
+ .open = lpfc_debugfs_ras_log_open,
5490
+ .llseek = lpfc_debugfs_lseek,
5491
+ .read = lpfc_debugfs_read,
5492
+ .release = lpfc_debugfs_ras_log_release,
48795493 };
48805494
48815495 #undef lpfc_debugfs_op_dumpHBASlim
....@@ -4906,13 +5520,23 @@
49065520 .release = lpfc_debugfs_release,
49075521 };
49085522
4909
-#undef lpfc_debugfs_op_nvmektime
4910
-static const struct file_operations lpfc_debugfs_op_nvmektime = {
5523
+#undef lpfc_debugfs_op_scsistat
5524
+static const struct file_operations lpfc_debugfs_op_scsistat = {
49115525 .owner = THIS_MODULE,
4912
- .open = lpfc_debugfs_nvmektime_open,
5526
+ .open = lpfc_debugfs_scsistat_open,
49135527 .llseek = lpfc_debugfs_lseek,
49145528 .read = lpfc_debugfs_read,
4915
- .write = lpfc_debugfs_nvmektime_write,
5529
+ .write = lpfc_debugfs_scsistat_write,
5530
+ .release = lpfc_debugfs_release,
5531
+};
5532
+
5533
+#undef lpfc_debugfs_op_ioktime
5534
+static const struct file_operations lpfc_debugfs_op_ioktime = {
5535
+ .owner = THIS_MODULE,
5536
+ .open = lpfc_debugfs_ioktime_open,
5537
+ .llseek = lpfc_debugfs_lseek,
5538
+ .read = lpfc_debugfs_read,
5539
+ .write = lpfc_debugfs_ioktime_write,
49165540 .release = lpfc_debugfs_release,
49175541 };
49185542
....@@ -4926,34 +5550,14 @@
49265550 .release = lpfc_debugfs_release,
49275551 };
49285552
4929
-#undef lpfc_debugfs_op_cpucheck
4930
-static const struct file_operations lpfc_debugfs_op_cpucheck = {
5553
+#undef lpfc_debugfs_op_hdwqstat
5554
+static const struct file_operations lpfc_debugfs_op_hdwqstat = {
49315555 .owner = THIS_MODULE,
4932
- .open = lpfc_debugfs_cpucheck_open,
5556
+ .open = lpfc_debugfs_hdwqstat_open,
49335557 .llseek = lpfc_debugfs_lseek,
49345558 .read = lpfc_debugfs_read,
4935
- .write = lpfc_debugfs_cpucheck_write,
5559
+ .write = lpfc_debugfs_hdwqstat_write,
49365560 .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,
49575561 };
49585562
49595563 #undef lpfc_debugfs_op_dif_err
....@@ -5058,7 +5662,6 @@
50585662 .write = lpfc_idiag_extacc_write,
50595663 .release = lpfc_idiag_cmd_release,
50605664 };
5061
-
50625665 #endif
50635666
50645667 /* lpfc_idiag_mbxacc_dump_bsg_mbox - idiag debugfs dump bsg mailbox command
....@@ -5283,11 +5886,6 @@
52835886 if (!lpfc_debugfs_root) {
52845887 lpfc_debugfs_root = debugfs_create_dir("lpfc", NULL);
52855888 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
- }
52915889 }
52925890 if (!lpfc_debugfs_start_time)
52935891 lpfc_debugfs_start_time = jiffies;
....@@ -5298,25 +5896,55 @@
52985896 pport_setup = true;
52995897 phba->hba_debugfs_root =
53005898 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
- }
53065899 atomic_inc(&lpfc_debugfs_hba_count);
53075900 atomic_set(&phba->debugfs_vport_count, 0);
5901
+
5902
+ /* Multi-XRI pools */
5903
+ snprintf(name, sizeof(name), "multixripools");
5904
+ phba->debug_multixri_pools =
5905
+ debugfs_create_file(name, S_IFREG | 0644,
5906
+ phba->hba_debugfs_root,
5907
+ phba,
5908
+ &lpfc_debugfs_op_multixripools);
5909
+ if (!phba->debug_multixri_pools) {
5910
+ lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
5911
+ "0527 Cannot create debugfs multixripools\n");
5912
+ goto debug_failed;
5913
+ }
5914
+
5915
+ /* RAS log */
5916
+ snprintf(name, sizeof(name), "ras_log");
5917
+ phba->debug_ras_log =
5918
+ debugfs_create_file(name, 0644,
5919
+ phba->hba_debugfs_root,
5920
+ phba, &lpfc_debugfs_ras_log);
5921
+ if (!phba->debug_ras_log) {
5922
+ lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
5923
+ "6148 Cannot create debugfs"
5924
+ " ras_log\n");
5925
+ goto debug_failed;
5926
+ }
53085927
53095928 /* Setup hbqinfo */
53105929 snprintf(name, sizeof(name), "hbqinfo");
53115930 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) {
5931
+ debugfs_create_file(name, S_IFREG | 0644,
5932
+ phba->hba_debugfs_root,
5933
+ phba, &lpfc_debugfs_op_hbqinfo);
5934
+
5935
+#ifdef LPFC_HDWQ_LOCK_STAT
5936
+ /* Setup lockstat */
5937
+ snprintf(name, sizeof(name), "lockstat");
5938
+ phba->debug_lockstat =
5939
+ debugfs_create_file(name, S_IFREG | 0644,
5940
+ phba->hba_debugfs_root,
5941
+ phba, &lpfc_debugfs_op_lockstat);
5942
+ if (!phba->debug_lockstat) {
53165943 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
5317
- "0411 Cannot create debugfs hbqinfo\n");
5944
+ "4610 Can't create debugfs lockstat\n");
53185945 goto debug_failed;
53195946 }
5947
+#endif
53205948
53215949 /* Setup dumpHBASlim */
53225950 if (phba->sli_rev < LPFC_SLI_REV4) {
....@@ -5326,12 +5954,6 @@
53265954 S_IFREG|S_IRUGO|S_IWUSR,
53275955 phba->hba_debugfs_root,
53285956 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
- }
53355957 } else
53365958 phba->debug_dumpHBASlim = NULL;
53375959
....@@ -5343,38 +5965,8 @@
53435965 S_IFREG|S_IRUGO|S_IWUSR,
53445966 phba->hba_debugfs_root,
53455967 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
- }
53525968 } else
53535969 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
- }
53785970
53795971 /* Setup DIF Error Injections */
53805972 snprintf(name, sizeof(name), "InjErrLBA");
....@@ -5382,11 +5974,6 @@
53825974 debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
53835975 phba->hba_debugfs_root,
53845976 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
- }
53905977 phba->lpfc_injerr_lba = LPFC_INJERR_LBA_OFF;
53915978
53925979 snprintf(name, sizeof(name), "InjErrNPortID");
....@@ -5394,88 +5981,48 @@
53945981 debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
53955982 phba->hba_debugfs_root,
53965983 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
- }
54025984
54035985 snprintf(name, sizeof(name), "InjErrWWPN");
54045986 phba->debug_InjErrWWPN =
54055987 debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
54065988 phba->hba_debugfs_root,
54075989 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
- }
54135990
54145991 snprintf(name, sizeof(name), "writeGuardInjErr");
54155992 phba->debug_writeGuard =
54165993 debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
54175994 phba->hba_debugfs_root,
54185995 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
- }
54245996
54255997 snprintf(name, sizeof(name), "writeAppInjErr");
54265998 phba->debug_writeApp =
54275999 debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
54286000 phba->hba_debugfs_root,
54296001 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
- }
54356002
54366003 snprintf(name, sizeof(name), "writeRefInjErr");
54376004 phba->debug_writeRef =
54386005 debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
54396006 phba->hba_debugfs_root,
54406007 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
- }
54466008
54476009 snprintf(name, sizeof(name), "readGuardInjErr");
54486010 phba->debug_readGuard =
54496011 debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
54506012 phba->hba_debugfs_root,
54516013 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
- }
54576014
54586015 snprintf(name, sizeof(name), "readAppInjErr");
54596016 phba->debug_readApp =
54606017 debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
54616018 phba->hba_debugfs_root,
54626019 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
- }
54686020
54696021 snprintf(name, sizeof(name), "readRefInjErr");
54706022 phba->debug_readRef =
54716023 debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
54726024 phba->hba_debugfs_root,
54736025 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
- }
54796026
54806027 /* Setup slow ring trace */
54816028 if (lpfc_debugfs_max_slow_ring_trc) {
....@@ -5499,12 +6046,6 @@
54996046 debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
55006047 phba->hba_debugfs_root,
55016048 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
- }
55086049 if (!phba->slow_ring_trc) {
55096050 phba->slow_ring_trc = kmalloc(
55106051 (sizeof(struct lpfc_debugfs_trc) *
....@@ -5527,11 +6068,6 @@
55276068 debugfs_create_file(name, 0644,
55286069 phba->hba_debugfs_root,
55296070 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
- }
55356071
55366072 atomic_set(&phba->nvmeio_trc_cnt, 0);
55376073 if (lpfc_debugfs_max_nvmeio_trc) {
....@@ -5579,11 +6115,6 @@
55796115 if (!vport->vport_debugfs_root) {
55806116 vport->vport_debugfs_root =
55816117 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
- }
55876118 atomic_inc(&phba->debugfs_vport_count);
55886119 }
55896120
....@@ -5620,55 +6151,45 @@
56206151 debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
56216152 vport->vport_debugfs_root,
56226153 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
- }
56296154 snprintf(name, sizeof(name), "nodelist");
56306155 vport->debug_nodelist =
56316156 debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
56326157 vport->vport_debugfs_root,
56336158 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
- }
56396159
56406160 snprintf(name, sizeof(name), "nvmestat");
56416161 vport->debug_nvmestat =
56426162 debugfs_create_file(name, 0644,
56436163 vport->vport_debugfs_root,
56446164 vport, &lpfc_debugfs_op_nvmestat);
5645
- if (!vport->debug_nvmestat) {
6165
+
6166
+ snprintf(name, sizeof(name), "scsistat");
6167
+ vport->debug_scsistat =
6168
+ debugfs_create_file(name, 0644,
6169
+ vport->vport_debugfs_root,
6170
+ vport, &lpfc_debugfs_op_scsistat);
6171
+ if (!vport->debug_scsistat) {
56466172 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
5647
- "0811 Cannot create debugfs nvmestat\n");
6173
+ "4611 Cannot create debugfs scsistat\n");
56486174 goto debug_failed;
56496175 }
56506176
5651
- snprintf(name, sizeof(name), "nvmektime");
5652
- vport->debug_nvmektime =
6177
+ snprintf(name, sizeof(name), "ioktime");
6178
+ vport->debug_ioktime =
56536179 debugfs_create_file(name, 0644,
56546180 vport->vport_debugfs_root,
5655
- vport, &lpfc_debugfs_op_nvmektime);
5656
- if (!vport->debug_nvmektime) {
6181
+ vport, &lpfc_debugfs_op_ioktime);
6182
+ if (!vport->debug_ioktime) {
56576183 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
5658
- "0815 Cannot create debugfs nvmektime\n");
6184
+ "0815 Cannot create debugfs ioktime\n");
56596185 goto debug_failed;
56606186 }
56616187
5662
- snprintf(name, sizeof(name), "cpucheck");
5663
- vport->debug_cpucheck =
6188
+ snprintf(name, sizeof(name), "hdwqstat");
6189
+ vport->debug_hdwqstat =
56646190 debugfs_create_file(name, 0644,
56656191 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
- }
6192
+ vport, &lpfc_debugfs_op_hdwqstat);
56726193
56736194 /*
56746195 * The following section is for additional directories/files for the
....@@ -5688,11 +6209,6 @@
56886209 if (!phba->idiag_root) {
56896210 phba->idiag_root =
56906211 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
- }
56966212 /* Initialize iDiag data structure */
56976213 memset(&idiag, 0, sizeof(idiag));
56986214 }
....@@ -5703,11 +6219,6 @@
57036219 phba->idiag_pci_cfg =
57046220 debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
57056221 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
- }
57116222 idiag.offset.last_rd = 0;
57126223 }
57136224
....@@ -5717,11 +6228,6 @@
57176228 phba->idiag_bar_acc =
57186229 debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
57196230 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
- }
57256231 idiag.offset.last_rd = 0;
57266232 }
57276233
....@@ -5731,11 +6237,6 @@
57316237 phba->idiag_que_info =
57326238 debugfs_create_file(name, S_IFREG|S_IRUGO,
57336239 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
- }
57396240 }
57406241
57416242 /* iDiag access PCI function queue */
....@@ -5744,11 +6245,6 @@
57446245 phba->idiag_que_acc =
57456246 debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
57466247 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
- }
57526248 }
57536249
57546250 /* iDiag access PCI function doorbell registers */
....@@ -5757,11 +6253,6 @@
57576253 phba->idiag_drb_acc =
57586254 debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
57596255 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
- }
57656256 }
57666257
57676258 /* iDiag access PCI function control registers */
....@@ -5770,11 +6261,6 @@
57706261 phba->idiag_ctl_acc =
57716262 debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
57726263 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
- }
57786264 }
57796265
57806266 /* iDiag access mbox commands */
....@@ -5783,11 +6269,6 @@
57836269 phba->idiag_mbx_acc =
57846270 debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
57856271 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
- }
57916272 }
57926273
57936274 /* iDiag extents access commands */
....@@ -5799,12 +6280,6 @@
57996280 S_IFREG|S_IRUGO|S_IWUSR,
58006281 phba->idiag_root, phba,
58016282 &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
- }
58086283 }
58096284 }
58106285
....@@ -5842,11 +6317,14 @@
58426317 debugfs_remove(vport->debug_nvmestat); /* nvmestat */
58436318 vport->debug_nvmestat = NULL;
58446319
5845
- debugfs_remove(vport->debug_nvmektime); /* nvmektime */
5846
- vport->debug_nvmektime = NULL;
6320
+ debugfs_remove(vport->debug_scsistat); /* scsistat */
6321
+ vport->debug_scsistat = NULL;
58476322
5848
- debugfs_remove(vport->debug_cpucheck); /* cpucheck */
5849
- vport->debug_cpucheck = NULL;
6323
+ debugfs_remove(vport->debug_ioktime); /* ioktime */
6324
+ vport->debug_ioktime = NULL;
6325
+
6326
+ debugfs_remove(vport->debug_hdwqstat); /* hdwqstat */
6327
+ vport->debug_hdwqstat = NULL;
58506328
58516329 if (vport->vport_debugfs_root) {
58526330 debugfs_remove(vport->vport_debugfs_root); /* vportX */
....@@ -5856,20 +6334,24 @@
58566334
58576335 if (atomic_read(&phba->debugfs_vport_count) == 0) {
58586336
6337
+ debugfs_remove(phba->debug_multixri_pools); /* multixripools*/
6338
+ phba->debug_multixri_pools = NULL;
6339
+
58596340 debugfs_remove(phba->debug_hbqinfo); /* hbqinfo */
58606341 phba->debug_hbqinfo = NULL;
58616342
6343
+ debugfs_remove(phba->debug_ras_log);
6344
+ phba->debug_ras_log = NULL;
6345
+
6346
+#ifdef LPFC_HDWQ_LOCK_STAT
6347
+ debugfs_remove(phba->debug_lockstat); /* lockstat */
6348
+ phba->debug_lockstat = NULL;
6349
+#endif
58626350 debugfs_remove(phba->debug_dumpHBASlim); /* HBASlim */
58636351 phba->debug_dumpHBASlim = NULL;
58646352
58656353 debugfs_remove(phba->debug_dumpHostSlim); /* HostSlim */
58666354 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;
58736355
58746356 debugfs_remove(phba->debug_InjErrLBA); /* InjErrLBA */
58756357 phba->debug_InjErrLBA = NULL;
....@@ -5991,11 +6473,8 @@
59916473 lpfc_debug_dump_wq(phba, DUMP_ELS, 0);
59926474 lpfc_debug_dump_wq(phba, DUMP_NVMELS, 0);
59936475
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);
6476
+ for (idx = 0; idx < phba->cfg_hdw_queue; idx++)
6477
+ lpfc_debug_dump_wq(phba, DUMP_IO, idx);
59996478
60006479 lpfc_debug_dump_hdr_rq(phba);
60016480 lpfc_debug_dump_dat_rq(phba);
....@@ -6006,15 +6485,12 @@
60066485 lpfc_debug_dump_cq(phba, DUMP_ELS, 0);
60076486 lpfc_debug_dump_cq(phba, DUMP_NVMELS, 0);
60086487
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);
6488
+ for (idx = 0; idx < phba->cfg_hdw_queue; idx++)
6489
+ lpfc_debug_dump_cq(phba, DUMP_IO, idx);
60146490
60156491 /*
60166492 * Dump Event Queues (EQs)
60176493 */
6018
- for (idx = 0; idx < phba->io_channel_irqs; idx++)
6494
+ for (idx = 0; idx < phba->cfg_hdw_queue; idx++)
60196495 lpfc_debug_dump_hba_eq(phba, idx);
60206496 }