aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/lpfc/lpfc_debugfs.c22
-rw-r--r--drivers/scsi/lpfc/lpfc_debugfs.h214
2 files changed, 101 insertions, 135 deletions
diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c
index 866361d4d637..93ddda16c632 100644
--- a/drivers/scsi/lpfc/lpfc_debugfs.c
+++ b/drivers/scsi/lpfc/lpfc_debugfs.c
@@ -4555,31 +4555,31 @@ lpfc_debugfs_terminate(struct lpfc_vport *vport)
4555void 4555void
4556lpfc_debug_dump_all_queues(struct lpfc_hba *phba) 4556lpfc_debug_dump_all_queues(struct lpfc_hba *phba)
4557{ 4557{
4558 int fcp_wqidx; 4558 int idx;
4559 4559
4560 /* 4560 /*
4561 * Dump Work Queues (WQs) 4561 * Dump Work Queues (WQs)
4562 */ 4562 */
4563 lpfc_debug_dump_mbx_wq(phba); 4563 lpfc_debug_dump_wq(phba, DUMP_MBX, 0);
4564 lpfc_debug_dump_els_wq(phba); 4564 lpfc_debug_dump_wq(phba, DUMP_ELS, 0);
4565 4565
4566 for (fcp_wqidx = 0; fcp_wqidx < phba->cfg_fcp_io_channel; fcp_wqidx++) 4566 for (idx = 0; idx < phba->cfg_fcp_io_channel; idx++)
4567 lpfc_debug_dump_fcp_wq(phba, fcp_wqidx); 4567 lpfc_debug_dump_wq(phba, DUMP_FCP, idx);
4568 4568
4569 lpfc_debug_dump_hdr_rq(phba); 4569 lpfc_debug_dump_hdr_rq(phba);
4570 lpfc_debug_dump_dat_rq(phba); 4570 lpfc_debug_dump_dat_rq(phba);
4571 /* 4571 /*
4572 * Dump Complete Queues (CQs) 4572 * Dump Complete Queues (CQs)
4573 */ 4573 */
4574 lpfc_debug_dump_mbx_cq(phba); 4574 lpfc_debug_dump_cq(phba, DUMP_MBX, 0);
4575 lpfc_debug_dump_els_cq(phba); 4575 lpfc_debug_dump_cq(phba, DUMP_ELS, 0);
4576 4576
4577 for (fcp_wqidx = 0; fcp_wqidx < phba->cfg_fcp_io_channel; fcp_wqidx++) 4577 for (idx = 0; idx < phba->cfg_fcp_io_channel; idx++)
4578 lpfc_debug_dump_fcp_cq(phba, fcp_wqidx); 4578 lpfc_debug_dump_cq(phba, DUMP_FCP, idx);
4579 4579
4580 /* 4580 /*
4581 * Dump Event Queues (EQs) 4581 * Dump Event Queues (EQs)
4582 */ 4582 */
4583 for (fcp_wqidx = 0; fcp_wqidx < phba->cfg_fcp_io_channel; fcp_wqidx++) 4583 for (idx = 0; idx < phba->cfg_fcp_io_channel; idx++)
4584 lpfc_debug_dump_hba_eq(phba, fcp_wqidx); 4584 lpfc_debug_dump_hba_eq(phba, idx);
4585} 4585}
diff --git a/drivers/scsi/lpfc/lpfc_debugfs.h b/drivers/scsi/lpfc/lpfc_debugfs.h
index 8b2b6a3bfc25..9ae2c4b5fd12 100644
--- a/drivers/scsi/lpfc/lpfc_debugfs.h
+++ b/drivers/scsi/lpfc/lpfc_debugfs.h
@@ -42,6 +42,12 @@
42/* hbqinfo output buffer size */ 42/* hbqinfo output buffer size */
43#define LPFC_HBQINFO_SIZE 8192 43#define LPFC_HBQINFO_SIZE 8192
44 44
45enum {
46 DUMP_FCP,
47 DUMP_MBX,
48 DUMP_ELS,
49};
50
45/* 51/*
46 * For SLI4 iDiag debugfs diagnostics tool 52 * For SLI4 iDiag debugfs diagnostics tool
47 */ 53 */
@@ -358,58 +364,97 @@ lpfc_debug_dump_q(struct lpfc_queue *q)
358} 364}
359 365
360/** 366/**
361 * lpfc_debug_dump_fcp_wq - dump all entries from a fcp work queue 367 * lpfc_debug_dump_wq - dump all entries from the fcp work queue
362 * @phba: Pointer to HBA context object. 368 * @phba: Pointer to HBA context object.
363 * @fcp_wqidx: Index to a FCP work queue. 369 * @wqidx: Index to a FCP work queue.
364 * 370 *
365 * This function dumps all entries from a FCP work queue specified by the 371 * This function dumps all entries from a FCP work queue specified
366 * @fcp_wqidx. 372 * by the wqidx.
367 **/ 373 **/
368static inline void 374static inline void
369lpfc_debug_dump_fcp_wq(struct lpfc_hba *phba, int fcp_wqidx) 375lpfc_debug_dump_wq(struct lpfc_hba *phba, int qtype, int wqidx)
370{ 376{
371 /* sanity check */ 377 struct lpfc_queue *wq;
372 if (fcp_wqidx >= phba->cfg_fcp_io_channel) 378 char *qtypestr;
379
380 if (qtype == DUMP_FCP) {
381 wq = phba->sli4_hba.fcp_wq[wqidx];
382 qtypestr = "FCP";
383 } else if (qtype == DUMP_MBX) {
384 wq = phba->sli4_hba.mbx_wq;
385 qtypestr = "MBX";
386 } else if (qtype == DUMP_ELS) {
387 wq = phba->sli4_hba.els_wq;
388 qtypestr = "ELS";
389 } else
373 return; 390 return;
374 391
375 printk(KERN_ERR "FCP WQ: WQ[Idx:%d|Qid:%d]\n", 392 if (qtype == DUMP_FCP)
376 fcp_wqidx, phba->sli4_hba.fcp_wq[fcp_wqidx]->queue_id); 393 pr_err("%s WQ: WQ[Idx:%d|Qid:%d]\n",
377 lpfc_debug_dump_q(phba->sli4_hba.fcp_wq[fcp_wqidx]); 394 qtypestr, wqidx, wq->queue_id);
395 else
396 pr_err("%s WQ: WQ[Qid:%d]\n",
397 qtypestr, wq->queue_id);
398
399 lpfc_debug_dump_q(wq);
378} 400}
379 401
380/** 402/**
381 * lpfc_debug_dump_fcp_cq - dump all entries from a fcp work queue's cmpl queue 403 * lpfc_debug_dump_cq - dump all entries from a fcp work queue's
404 * cmpl queue
382 * @phba: Pointer to HBA context object. 405 * @phba: Pointer to HBA context object.
383 * @fcp_wqidx: Index to a FCP work queue. 406 * @wqidx: Index to a FCP work queue.
384 * 407 *
385 * This function dumps all entries from a FCP complete queue which is 408 * This function dumps all entries from a FCP completion queue
386 * associated to the FCP work queue specified by the @fcp_wqidx. 409 * which is associated to the work queue specified by the @wqidx.
387 **/ 410 **/
388static inline void 411static inline void
389lpfc_debug_dump_fcp_cq(struct lpfc_hba *phba, int fcp_wqidx) 412lpfc_debug_dump_cq(struct lpfc_hba *phba, int qtype, int wqidx)
390{ 413{
391 int fcp_cqidx, fcp_cqid; 414 struct lpfc_queue *wq, *cq, *eq;
392 415 char *qtypestr;
393 /* sanity check */ 416 int eqidx;
394 if (fcp_wqidx >= phba->cfg_fcp_io_channel) 417
418 /* fcp wq and cq are 1:1, thus same indexes */
419
420 if (qtype == DUMP_FCP) {
421 wq = phba->sli4_hba.fcp_wq[wqidx];
422 cq = phba->sli4_hba.fcp_cq[wqidx];
423 qtypestr = "FCP";
424 } else if (qtype == DUMP_MBX) {
425 wq = phba->sli4_hba.mbx_wq;
426 cq = phba->sli4_hba.mbx_cq;
427 qtypestr = "MBX";
428 } else if (qtype == DUMP_ELS) {
429 wq = phba->sli4_hba.els_wq;
430 cq = phba->sli4_hba.els_cq;
431 qtypestr = "ELS";
432 } else
395 return; 433 return;
396 434
397 fcp_cqid = phba->sli4_hba.fcp_wq[fcp_wqidx]->assoc_qid; 435 for (eqidx = 0; eqidx < phba->cfg_fcp_io_channel; eqidx++) {
398 for (fcp_cqidx = 0; fcp_cqidx < phba->cfg_fcp_io_channel; fcp_cqidx++) 436 eq = phba->sli4_hba.hba_eq[eqidx];
399 if (phba->sli4_hba.fcp_cq[fcp_cqidx]->queue_id == fcp_cqid) 437 if (cq->assoc_qid == eq->queue_id)
400 break; 438 break;
401 if (phba->intr_type == MSIX) { 439 }
402 if (fcp_cqidx >= phba->cfg_fcp_io_channel) 440 if (eqidx == phba->cfg_fcp_io_channel) {
403 return; 441 pr_err("Couldn't find EQ for CQ. Using EQ[0]\n");
404 } else { 442 eqidx = 0;
405 if (fcp_cqidx > 0) 443 eq = phba->sli4_hba.hba_eq[0];
406 return;
407 } 444 }
408 445
409 printk(KERN_ERR "FCP CQ: WQ[Idx:%d|Qid%d]->CQ[Idx%d|Qid%d]:\n", 446 if (qtype == DUMP_FCP)
410 fcp_wqidx, phba->sli4_hba.fcp_wq[fcp_wqidx]->queue_id, 447 pr_err("%s CQ: WQ[Idx:%d|Qid%d]->CQ[Idx%d|Qid%d]"
411 fcp_cqidx, fcp_cqid); 448 "->EQ[Idx:%d|Qid:%d]:\n",
412 lpfc_debug_dump_q(phba->sli4_hba.fcp_cq[fcp_cqidx]); 449 qtypestr, wqidx, wq->queue_id, wqidx, cq->queue_id,
450 eqidx, eq->queue_id);
451 else
452 pr_err("%s CQ: WQ[Qid:%d]->CQ[Qid:%d]"
453 "->EQ[Idx:%d|Qid:%d]:\n",
454 qtypestr, wq->queue_id, cq->queue_id,
455 eqidx, eq->queue_id);
456
457 lpfc_debug_dump_q(cq);
413} 458}
414 459
415/** 460/**
@@ -421,64 +466,15 @@ lpfc_debug_dump_fcp_cq(struct lpfc_hba *phba, int fcp_wqidx)
421 * associated to the FCP work queue specified by the @fcp_wqidx. 466 * associated to the FCP work queue specified by the @fcp_wqidx.
422 **/ 467 **/
423static inline void 468static inline void
424lpfc_debug_dump_hba_eq(struct lpfc_hba *phba, int fcp_wqidx) 469lpfc_debug_dump_hba_eq(struct lpfc_hba *phba, int qidx)
425{ 470{
426 struct lpfc_queue *qdesc; 471 struct lpfc_queue *qp;
427 int fcp_eqidx, fcp_eqid;
428 int fcp_cqidx, fcp_cqid;
429
430 /* sanity check */
431 if (fcp_wqidx >= phba->cfg_fcp_io_channel)
432 return;
433 fcp_cqid = phba->sli4_hba.fcp_wq[fcp_wqidx]->assoc_qid;
434 for (fcp_cqidx = 0; fcp_cqidx < phba->cfg_fcp_io_channel; fcp_cqidx++)
435 if (phba->sli4_hba.fcp_cq[fcp_cqidx]->queue_id == fcp_cqid)
436 break;
437 if (phba->intr_type == MSIX) {
438 if (fcp_cqidx >= phba->cfg_fcp_io_channel)
439 return;
440 } else {
441 if (fcp_cqidx > 0)
442 return;
443 }
444 472
445 fcp_eqidx = fcp_cqidx; 473 qp = phba->sli4_hba.hba_eq[qidx];
446 fcp_eqid = phba->sli4_hba.hba_eq[fcp_eqidx]->queue_id;
447 qdesc = phba->sli4_hba.hba_eq[fcp_eqidx];
448 474
449 printk(KERN_ERR "FCP EQ: WQ[Idx:%d|Qid:%d]->CQ[Idx:%d|Qid:%d]->" 475 pr_err("EQ[Idx:%d|Qid:%d]\n", qidx, qp->queue_id);
450 "EQ[Idx:%d|Qid:%d]\n",
451 fcp_wqidx, phba->sli4_hba.fcp_wq[fcp_wqidx]->queue_id,
452 fcp_cqidx, fcp_cqid, fcp_eqidx, fcp_eqid);
453 lpfc_debug_dump_q(qdesc);
454}
455 476
456/** 477 lpfc_debug_dump_q(qp);
457 * lpfc_debug_dump_els_wq - dump all entries from the els work queue
458 * @phba: Pointer to HBA context object.
459 *
460 * This function dumps all entries from the ELS work queue.
461 **/
462static inline void
463lpfc_debug_dump_els_wq(struct lpfc_hba *phba)
464{
465 printk(KERN_ERR "ELS WQ: WQ[Qid:%d]:\n",
466 phba->sli4_hba.els_wq->queue_id);
467 lpfc_debug_dump_q(phba->sli4_hba.els_wq);
468}
469
470/**
471 * lpfc_debug_dump_mbx_wq - dump all entries from the mbox work queue
472 * @phba: Pointer to HBA context object.
473 *
474 * This function dumps all entries from the MBOX work queue.
475 **/
476static inline void
477lpfc_debug_dump_mbx_wq(struct lpfc_hba *phba)
478{
479 printk(KERN_ERR "MBX WQ: WQ[Qid:%d]\n",
480 phba->sli4_hba.mbx_wq->queue_id);
481 lpfc_debug_dump_q(phba->sli4_hba.mbx_wq);
482} 478}
483 479
484/** 480/**
@@ -510,36 +506,6 @@ lpfc_debug_dump_hdr_rq(struct lpfc_hba *phba)
510} 506}
511 507
512/** 508/**
513 * lpfc_debug_dump_els_cq - dump all entries from the els complete queue
514 * @phba: Pointer to HBA context object.
515 *
516 * This function dumps all entries from the els complete queue.
517 **/
518static inline void
519lpfc_debug_dump_els_cq(struct lpfc_hba *phba)
520{
521 printk(KERN_ERR "ELS CQ: WQ[Qid:%d]->CQ[Qid:%d]\n",
522 phba->sli4_hba.els_wq->queue_id,
523 phba->sli4_hba.els_cq->queue_id);
524 lpfc_debug_dump_q(phba->sli4_hba.els_cq);
525}
526
527/**
528 * lpfc_debug_dump_mbx_cq - dump all entries from the mbox complete queue
529 * @phba: Pointer to HBA context object.
530 *
531 * This function dumps all entries from the mbox complete queue.
532 **/
533static inline void
534lpfc_debug_dump_mbx_cq(struct lpfc_hba *phba)
535{
536 printk(KERN_ERR "MBX CQ: WQ[Qid:%d]->CQ[Qid:%d]\n",
537 phba->sli4_hba.mbx_wq->queue_id,
538 phba->sli4_hba.mbx_cq->queue_id);
539 lpfc_debug_dump_q(phba->sli4_hba.mbx_cq);
540}
541
542/**
543 * lpfc_debug_dump_wq_by_id - dump all entries from a work queue by queue id 509 * lpfc_debug_dump_wq_by_id - dump all entries from a work queue by queue id
544 * @phba: Pointer to HBA context object. 510 * @phba: Pointer to HBA context object.
545 * @qid: Work queue identifier. 511 * @qid: Work queue identifier.
@@ -556,14 +522,15 @@ lpfc_debug_dump_wq_by_id(struct lpfc_hba *phba, int qid)
556 if (phba->sli4_hba.fcp_wq[wq_idx]->queue_id == qid) 522 if (phba->sli4_hba.fcp_wq[wq_idx]->queue_id == qid)
557 break; 523 break;
558 if (wq_idx < phba->cfg_fcp_io_channel) { 524 if (wq_idx < phba->cfg_fcp_io_channel) {
559 printk(KERN_ERR "FCP WQ[Idx:%d|Qid:%d]\n", wq_idx, qid); 525 pr_err("FCP WQ[Idx:%d|Qid:%d]\n", wq_idx, qid);
560 lpfc_debug_dump_q(phba->sli4_hba.fcp_wq[wq_idx]); 526 lpfc_debug_dump_q(phba->sli4_hba.fcp_wq[wq_idx]);
561 return; 527 return;
562 } 528 }
563 529
564 if (phba->sli4_hba.els_wq->queue_id == qid) { 530 if (phba->sli4_hba.els_wq->queue_id == qid) {
565 printk(KERN_ERR "ELS WQ[Qid:%d]\n", qid); 531 pr_err("ELS WQ[Qid:%d]\n", qid);
566 lpfc_debug_dump_q(phba->sli4_hba.els_wq); 532 lpfc_debug_dump_q(phba->sli4_hba.els_wq);
533 return;
567 } 534 }
568} 535}
569 536
@@ -617,27 +584,26 @@ lpfc_debug_dump_rq_by_id(struct lpfc_hba *phba, int qid)
617static inline void 584static inline void
618lpfc_debug_dump_cq_by_id(struct lpfc_hba *phba, int qid) 585lpfc_debug_dump_cq_by_id(struct lpfc_hba *phba, int qid)
619{ 586{
620 int cq_idx = 0; 587 int cq_idx;
621 588
622 do { 589 for (cq_idx = 0; cq_idx < phba->cfg_fcp_io_channel; cq_idx++)
623 if (phba->sli4_hba.fcp_cq[cq_idx]->queue_id == qid) 590 if (phba->sli4_hba.fcp_cq[cq_idx]->queue_id == qid)
624 break; 591 break;
625 } while (++cq_idx < phba->cfg_fcp_io_channel);
626 592
627 if (cq_idx < phba->cfg_fcp_io_channel) { 593 if (cq_idx < phba->cfg_fcp_io_channel) {
628 printk(KERN_ERR "FCP CQ[Idx:%d|Qid:%d]\n", cq_idx, qid); 594 pr_err("FCP CQ[Idx:%d|Qid:%d]\n", cq_idx, qid);
629 lpfc_debug_dump_q(phba->sli4_hba.fcp_cq[cq_idx]); 595 lpfc_debug_dump_q(phba->sli4_hba.fcp_cq[cq_idx]);
630 return; 596 return;
631 } 597 }
632 598
633 if (phba->sli4_hba.els_cq->queue_id == qid) { 599 if (phba->sli4_hba.els_cq->queue_id == qid) {
634 printk(KERN_ERR "ELS CQ[Qid:%d]\n", qid); 600 pr_err("ELS CQ[Qid:%d]\n", qid);
635 lpfc_debug_dump_q(phba->sli4_hba.els_cq); 601 lpfc_debug_dump_q(phba->sli4_hba.els_cq);
636 return; 602 return;
637 } 603 }
638 604
639 if (phba->sli4_hba.mbx_cq->queue_id == qid) { 605 if (phba->sli4_hba.mbx_cq->queue_id == qid) {
640 printk(KERN_ERR "MBX CQ[Qid:%d]\n", qid); 606 pr_err("MBX CQ[Qid:%d]\n", qid);
641 lpfc_debug_dump_q(phba->sli4_hba.mbx_cq); 607 lpfc_debug_dump_q(phba->sli4_hba.mbx_cq);
642 } 608 }
643} 609}