diff options
author | Selvin Xavier <selvin.xavier@emulex.com> | 2014-12-18 03:42:59 -0500 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2015-02-18 11:31:02 -0500 |
commit | ad56ebb414a46f7afe84f73f28a39c7971cc8283 (patch) | |
tree | 7832a95d2b9507a87d1621ad6d3237e1fba3f3fa /drivers/infiniband/hw/ocrdma | |
parent | 0c0eacdc9d96b62302efaece8b313cf4f4976aaa (diff) |
RDMA/ocrdma: Debugfs enhancments for ocrdma driver
1. Add statistics counters for error cqes.
2. Add file ("reset_stats") to reset rdma stats in Debugfs.
Signed-off-by: Selvin Xavier <selvin.xavier@emulex.com>
Signed-off-by: Mitesh Ahuja <mitesh.ahuja@emulex.com>
Signed-off-by: Devesh Sharma <devesh.sharma@emulex.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/infiniband/hw/ocrdma')
-rw-r--r-- | drivers/infiniband/hw/ocrdma/ocrdma.h | 4 | ||||
-rw-r--r-- | drivers/infiniband/hw/ocrdma/ocrdma_hw.c | 3 | ||||
-rw-r--r-- | drivers/infiniband/hw/ocrdma/ocrdma_sli.h | 8 | ||||
-rw-r--r-- | drivers/infiniband/hw/ocrdma/ocrdma_stats.c | 160 | ||||
-rw-r--r-- | drivers/infiniband/hw/ocrdma/ocrdma_stats.h | 4 | ||||
-rw-r--r-- | drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 7 |
6 files changed, 183 insertions, 3 deletions
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma.h b/drivers/infiniband/hw/ocrdma/ocrdma.h index 013cc7ec1e9b..933b38af13f0 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma.h +++ b/drivers/infiniband/hw/ocrdma/ocrdma.h | |||
@@ -271,7 +271,11 @@ struct ocrdma_dev { | |||
271 | struct ocrdma_stats rx_qp_err_stats; | 271 | struct ocrdma_stats rx_qp_err_stats; |
272 | struct ocrdma_stats tx_dbg_stats; | 272 | struct ocrdma_stats tx_dbg_stats; |
273 | struct ocrdma_stats rx_dbg_stats; | 273 | struct ocrdma_stats rx_dbg_stats; |
274 | struct ocrdma_stats driver_stats; | ||
275 | struct ocrdma_stats reset_stats; | ||
274 | struct dentry *dir; | 276 | struct dentry *dir; |
277 | atomic_t async_err_stats[OCRDMA_MAX_ASYNC_ERRORS]; | ||
278 | atomic_t cqe_err_stats[OCRDMA_MAX_CQE_ERR]; | ||
275 | struct ocrdma_pd_resource_mgr *pd_mgr; | 279 | struct ocrdma_pd_resource_mgr *pd_mgr; |
276 | }; | 280 | }; |
277 | 281 | ||
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c index 037893a967c2..47999bb2b5f5 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c | |||
@@ -734,6 +734,9 @@ static void ocrdma_dispatch_ibevent(struct ocrdma_dev *dev, | |||
734 | break; | 734 | break; |
735 | } | 735 | } |
736 | 736 | ||
737 | if (type < OCRDMA_MAX_ASYNC_ERRORS) | ||
738 | atomic_inc(&dev->async_err_stats[type]); | ||
739 | |||
737 | if (qp_event) { | 740 | if (qp_event) { |
738 | if (qp->ibqp.event_handler) | 741 | if (qp->ibqp.event_handler) |
739 | qp->ibqp.event_handler(&ib_evt, qp->ibqp.qp_context); | 742 | qp->ibqp.event_handler(&ib_evt, qp->ibqp.qp_context); |
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_sli.h b/drivers/infiniband/hw/ocrdma/ocrdma_sli.h index e252f1b14f53..6ba9939868a3 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_sli.h +++ b/drivers/infiniband/hw/ocrdma/ocrdma_sli.h | |||
@@ -443,7 +443,9 @@ enum OCRDMA_ASYNC_EVENT_TYPE { | |||
443 | OCRDMA_DEVICE_FATAL_EVENT = 0x08, | 443 | OCRDMA_DEVICE_FATAL_EVENT = 0x08, |
444 | OCRDMA_SRQCAT_ERROR = 0x0E, | 444 | OCRDMA_SRQCAT_ERROR = 0x0E, |
445 | OCRDMA_SRQ_LIMIT_EVENT = 0x0F, | 445 | OCRDMA_SRQ_LIMIT_EVENT = 0x0F, |
446 | OCRDMA_QP_LAST_WQE_EVENT = 0x10 | 446 | OCRDMA_QP_LAST_WQE_EVENT = 0x10, |
447 | |||
448 | OCRDMA_MAX_ASYNC_ERRORS | ||
447 | }; | 449 | }; |
448 | 450 | ||
449 | /* mailbox command request and responses */ | 451 | /* mailbox command request and responses */ |
@@ -1630,7 +1632,9 @@ enum OCRDMA_CQE_STATUS { | |||
1630 | OCRDMA_CQE_INV_EEC_STATE_ERR, | 1632 | OCRDMA_CQE_INV_EEC_STATE_ERR, |
1631 | OCRDMA_CQE_FATAL_ERR, | 1633 | OCRDMA_CQE_FATAL_ERR, |
1632 | OCRDMA_CQE_RESP_TIMEOUT_ERR, | 1634 | OCRDMA_CQE_RESP_TIMEOUT_ERR, |
1633 | OCRDMA_CQE_GENERAL_ERR | 1635 | OCRDMA_CQE_GENERAL_ERR, |
1636 | |||
1637 | OCRDMA_MAX_CQE_ERR | ||
1634 | }; | 1638 | }; |
1635 | 1639 | ||
1636 | enum { | 1640 | enum { |
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_stats.c b/drivers/infiniband/hw/ocrdma/ocrdma_stats.c index ac98721d61f8..48d7ef51aa0c 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_stats.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_stats.c | |||
@@ -485,6 +485,111 @@ static char *ocrdma_rx_dbg_stats(struct ocrdma_dev *dev) | |||
485 | return dev->stats_mem.debugfs_mem; | 485 | return dev->stats_mem.debugfs_mem; |
486 | } | 486 | } |
487 | 487 | ||
488 | static char *ocrdma_driver_dbg_stats(struct ocrdma_dev *dev) | ||
489 | { | ||
490 | char *stats = dev->stats_mem.debugfs_mem, *pcur; | ||
491 | |||
492 | |||
493 | memset(stats, 0, (OCRDMA_MAX_DBGFS_MEM)); | ||
494 | |||
495 | pcur = stats; | ||
496 | pcur += ocrdma_add_stat(stats, pcur, "async_cq_err", | ||
497 | (u64)(dev->async_err_stats | ||
498 | [OCRDMA_CQ_ERROR].counter)); | ||
499 | pcur += ocrdma_add_stat(stats, pcur, "async_cq_overrun_err", | ||
500 | (u64)dev->async_err_stats | ||
501 | [OCRDMA_CQ_OVERRUN_ERROR].counter); | ||
502 | pcur += ocrdma_add_stat(stats, pcur, "async_cq_qpcat_err", | ||
503 | (u64)dev->async_err_stats | ||
504 | [OCRDMA_CQ_QPCAT_ERROR].counter); | ||
505 | pcur += ocrdma_add_stat(stats, pcur, "async_qp_access_err", | ||
506 | (u64)dev->async_err_stats | ||
507 | [OCRDMA_QP_ACCESS_ERROR].counter); | ||
508 | pcur += ocrdma_add_stat(stats, pcur, "async_qp_commm_est_evt", | ||
509 | (u64)dev->async_err_stats | ||
510 | [OCRDMA_QP_COMM_EST_EVENT].counter); | ||
511 | pcur += ocrdma_add_stat(stats, pcur, "async_sq_drained_evt", | ||
512 | (u64)dev->async_err_stats | ||
513 | [OCRDMA_SQ_DRAINED_EVENT].counter); | ||
514 | pcur += ocrdma_add_stat(stats, pcur, "async_dev_fatal_evt", | ||
515 | (u64)dev->async_err_stats | ||
516 | [OCRDMA_DEVICE_FATAL_EVENT].counter); | ||
517 | pcur += ocrdma_add_stat(stats, pcur, "async_srqcat_err", | ||
518 | (u64)dev->async_err_stats | ||
519 | [OCRDMA_SRQCAT_ERROR].counter); | ||
520 | pcur += ocrdma_add_stat(stats, pcur, "async_srq_limit_evt", | ||
521 | (u64)dev->async_err_stats | ||
522 | [OCRDMA_SRQ_LIMIT_EVENT].counter); | ||
523 | pcur += ocrdma_add_stat(stats, pcur, "async_qp_last_wqe_evt", | ||
524 | (u64)dev->async_err_stats | ||
525 | [OCRDMA_QP_LAST_WQE_EVENT].counter); | ||
526 | |||
527 | pcur += ocrdma_add_stat(stats, pcur, "cqe_loc_len_err", | ||
528 | (u64)dev->cqe_err_stats | ||
529 | [OCRDMA_CQE_LOC_LEN_ERR].counter); | ||
530 | pcur += ocrdma_add_stat(stats, pcur, "cqe_loc_qp_op_err", | ||
531 | (u64)dev->cqe_err_stats | ||
532 | [OCRDMA_CQE_LOC_QP_OP_ERR].counter); | ||
533 | pcur += ocrdma_add_stat(stats, pcur, "cqe_loc_eec_op_err", | ||
534 | (u64)dev->cqe_err_stats | ||
535 | [OCRDMA_CQE_LOC_EEC_OP_ERR].counter); | ||
536 | pcur += ocrdma_add_stat(stats, pcur, "cqe_loc_prot_err", | ||
537 | (u64)dev->cqe_err_stats | ||
538 | [OCRDMA_CQE_LOC_PROT_ERR].counter); | ||
539 | pcur += ocrdma_add_stat(stats, pcur, "cqe_wr_flush_err", | ||
540 | (u64)dev->cqe_err_stats | ||
541 | [OCRDMA_CQE_WR_FLUSH_ERR].counter); | ||
542 | pcur += ocrdma_add_stat(stats, pcur, "cqe_mw_bind_err", | ||
543 | (u64)dev->cqe_err_stats | ||
544 | [OCRDMA_CQE_MW_BIND_ERR].counter); | ||
545 | pcur += ocrdma_add_stat(stats, pcur, "cqe_bad_resp_err", | ||
546 | (u64)dev->cqe_err_stats | ||
547 | [OCRDMA_CQE_BAD_RESP_ERR].counter); | ||
548 | pcur += ocrdma_add_stat(stats, pcur, "cqe_loc_access_err", | ||
549 | (u64)dev->cqe_err_stats | ||
550 | [OCRDMA_CQE_LOC_ACCESS_ERR].counter); | ||
551 | pcur += ocrdma_add_stat(stats, pcur, "cqe_rem_inv_req_err", | ||
552 | (u64)dev->cqe_err_stats | ||
553 | [OCRDMA_CQE_REM_INV_REQ_ERR].counter); | ||
554 | pcur += ocrdma_add_stat(stats, pcur, "cqe_rem_access_err", | ||
555 | (u64)dev->cqe_err_stats | ||
556 | [OCRDMA_CQE_REM_ACCESS_ERR].counter); | ||
557 | pcur += ocrdma_add_stat(stats, pcur, "cqe_rem_op_err", | ||
558 | (u64)dev->cqe_err_stats | ||
559 | [OCRDMA_CQE_REM_OP_ERR].counter); | ||
560 | pcur += ocrdma_add_stat(stats, pcur, "cqe_retry_exc_err", | ||
561 | (u64)dev->cqe_err_stats | ||
562 | [OCRDMA_CQE_RETRY_EXC_ERR].counter); | ||
563 | pcur += ocrdma_add_stat(stats, pcur, "cqe_rnr_retry_exc_err", | ||
564 | (u64)dev->cqe_err_stats | ||
565 | [OCRDMA_CQE_RNR_RETRY_EXC_ERR].counter); | ||
566 | pcur += ocrdma_add_stat(stats, pcur, "cqe_loc_rdd_viol_err", | ||
567 | (u64)dev->cqe_err_stats | ||
568 | [OCRDMA_CQE_LOC_RDD_VIOL_ERR].counter); | ||
569 | pcur += ocrdma_add_stat(stats, pcur, "cqe_rem_inv_rd_req_err", | ||
570 | (u64)dev->cqe_err_stats | ||
571 | [OCRDMA_CQE_REM_INV_RD_REQ_ERR].counter); | ||
572 | pcur += ocrdma_add_stat(stats, pcur, "cqe_rem_abort_err", | ||
573 | (u64)dev->cqe_err_stats | ||
574 | [OCRDMA_CQE_REM_ABORT_ERR].counter); | ||
575 | pcur += ocrdma_add_stat(stats, pcur, "cqe_inv_eecn_err", | ||
576 | (u64)dev->cqe_err_stats | ||
577 | [OCRDMA_CQE_INV_EECN_ERR].counter); | ||
578 | pcur += ocrdma_add_stat(stats, pcur, "cqe_inv_eec_state_err", | ||
579 | (u64)dev->cqe_err_stats | ||
580 | [OCRDMA_CQE_INV_EEC_STATE_ERR].counter); | ||
581 | pcur += ocrdma_add_stat(stats, pcur, "cqe_fatal_err", | ||
582 | (u64)dev->cqe_err_stats | ||
583 | [OCRDMA_CQE_FATAL_ERR].counter); | ||
584 | pcur += ocrdma_add_stat(stats, pcur, "cqe_resp_timeout_err", | ||
585 | (u64)dev->cqe_err_stats | ||
586 | [OCRDMA_CQE_RESP_TIMEOUT_ERR].counter); | ||
587 | pcur += ocrdma_add_stat(stats, pcur, "cqe_general_err", | ||
588 | (u64)dev->cqe_err_stats | ||
589 | [OCRDMA_CQE_GENERAL_ERR].counter); | ||
590 | return stats; | ||
591 | } | ||
592 | |||
488 | static void ocrdma_update_stats(struct ocrdma_dev *dev) | 593 | static void ocrdma_update_stats(struct ocrdma_dev *dev) |
489 | { | 594 | { |
490 | ulong now = jiffies, secs; | 595 | ulong now = jiffies, secs; |
@@ -513,6 +618,45 @@ static void ocrdma_update_stats(struct ocrdma_dev *dev) | |||
513 | } | 618 | } |
514 | } | 619 | } |
515 | 620 | ||
621 | static ssize_t ocrdma_dbgfs_ops_write(struct file *filp, | ||
622 | const char __user *buffer, | ||
623 | size_t count, loff_t *ppos) | ||
624 | { | ||
625 | char tmp_str[32]; | ||
626 | long reset; | ||
627 | int status = 0; | ||
628 | struct ocrdma_stats *pstats = filp->private_data; | ||
629 | struct ocrdma_dev *dev = pstats->dev; | ||
630 | |||
631 | if (count > 32) | ||
632 | goto err; | ||
633 | |||
634 | if (copy_from_user(tmp_str, buffer, count)) | ||
635 | goto err; | ||
636 | |||
637 | tmp_str[count-1] = '\0'; | ||
638 | if (kstrtol(tmp_str, 10, &reset)) | ||
639 | goto err; | ||
640 | |||
641 | switch (pstats->type) { | ||
642 | case OCRDMA_RESET_STATS: | ||
643 | if (reset) { | ||
644 | status = ocrdma_mbx_rdma_stats(dev, true); | ||
645 | if (status) { | ||
646 | pr_err("Failed to reset stats = %d", status); | ||
647 | goto err; | ||
648 | } | ||
649 | } | ||
650 | break; | ||
651 | default: | ||
652 | goto err; | ||
653 | } | ||
654 | |||
655 | return count; | ||
656 | err: | ||
657 | return -EFAULT; | ||
658 | } | ||
659 | |||
516 | int ocrdma_pma_counters(struct ocrdma_dev *dev, | 660 | int ocrdma_pma_counters(struct ocrdma_dev *dev, |
517 | struct ib_mad *out_mad) | 661 | struct ib_mad *out_mad) |
518 | { | 662 | { |
@@ -573,6 +717,9 @@ static ssize_t ocrdma_dbgfs_ops_read(struct file *filp, char __user *buffer, | |||
573 | case OCRDMA_RX_DBG_STATS: | 717 | case OCRDMA_RX_DBG_STATS: |
574 | data = ocrdma_rx_dbg_stats(dev); | 718 | data = ocrdma_rx_dbg_stats(dev); |
575 | break; | 719 | break; |
720 | case OCRDMA_DRV_STATS: | ||
721 | data = ocrdma_driver_dbg_stats(dev); | ||
722 | break; | ||
576 | 723 | ||
577 | default: | 724 | default: |
578 | status = -EFAULT; | 725 | status = -EFAULT; |
@@ -595,6 +742,7 @@ static const struct file_operations ocrdma_dbg_ops = { | |||
595 | .owner = THIS_MODULE, | 742 | .owner = THIS_MODULE, |
596 | .open = simple_open, | 743 | .open = simple_open, |
597 | .read = ocrdma_dbgfs_ops_read, | 744 | .read = ocrdma_dbgfs_ops_read, |
745 | .write = ocrdma_dbgfs_ops_write, | ||
598 | }; | 746 | }; |
599 | 747 | ||
600 | void ocrdma_add_port_stats(struct ocrdma_dev *dev) | 748 | void ocrdma_add_port_stats(struct ocrdma_dev *dev) |
@@ -663,6 +811,18 @@ void ocrdma_add_port_stats(struct ocrdma_dev *dev) | |||
663 | &dev->rx_dbg_stats, &ocrdma_dbg_ops)) | 811 | &dev->rx_dbg_stats, &ocrdma_dbg_ops)) |
664 | goto err; | 812 | goto err; |
665 | 813 | ||
814 | dev->driver_stats.type = OCRDMA_DRV_STATS; | ||
815 | dev->driver_stats.dev = dev; | ||
816 | if (!debugfs_create_file("driver_dbg_stats", S_IRUSR, dev->dir, | ||
817 | &dev->driver_stats, &ocrdma_dbg_ops)) | ||
818 | goto err; | ||
819 | |||
820 | dev->reset_stats.type = OCRDMA_RESET_STATS; | ||
821 | dev->reset_stats.dev = dev; | ||
822 | if (!debugfs_create_file("reset_stats", S_IRUSR, dev->dir, | ||
823 | &dev->reset_stats, &ocrdma_dbg_ops)) | ||
824 | goto err; | ||
825 | |||
666 | /* Now create dma_mem for stats mbx command */ | 826 | /* Now create dma_mem for stats mbx command */ |
667 | if (!ocrdma_alloc_stats_mem(dev)) | 827 | if (!ocrdma_alloc_stats_mem(dev)) |
668 | goto err; | 828 | goto err; |
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_stats.h b/drivers/infiniband/hw/ocrdma/ocrdma_stats.h index 89afe06eca32..091edd68a8a3 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_stats.h +++ b/drivers/infiniband/hw/ocrdma/ocrdma_stats.h | |||
@@ -43,7 +43,9 @@ enum OCRDMA_STATS_TYPE { | |||
43 | OCRDMA_RXQP_ERRSTATS, | 43 | OCRDMA_RXQP_ERRSTATS, |
44 | OCRDMA_TXQP_ERRSTATS, | 44 | OCRDMA_TXQP_ERRSTATS, |
45 | OCRDMA_TX_DBG_STATS, | 45 | OCRDMA_TX_DBG_STATS, |
46 | OCRDMA_RX_DBG_STATS | 46 | OCRDMA_RX_DBG_STATS, |
47 | OCRDMA_DRV_STATS, | ||
48 | OCRDMA_RESET_STATS | ||
47 | }; | 49 | }; |
48 | 50 | ||
49 | void ocrdma_rem_debugfs(void); | 51 | void ocrdma_rem_debugfs(void); |
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c index 4593f9d8ad25..fd9359171fcd 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | |||
@@ -2594,8 +2594,11 @@ static bool ocrdma_poll_err_scqe(struct ocrdma_qp *qp, | |||
2594 | bool *polled, bool *stop) | 2594 | bool *polled, bool *stop) |
2595 | { | 2595 | { |
2596 | bool expand; | 2596 | bool expand; |
2597 | struct ocrdma_dev *dev = get_ocrdma_dev(qp->ibqp.device); | ||
2597 | int status = (le32_to_cpu(cqe->flags_status_srcqpn) & | 2598 | int status = (le32_to_cpu(cqe->flags_status_srcqpn) & |
2598 | OCRDMA_CQE_STATUS_MASK) >> OCRDMA_CQE_STATUS_SHIFT; | 2599 | OCRDMA_CQE_STATUS_MASK) >> OCRDMA_CQE_STATUS_SHIFT; |
2600 | if (status < OCRDMA_MAX_CQE_ERR) | ||
2601 | atomic_inc(&dev->cqe_err_stats[status]); | ||
2599 | 2602 | ||
2600 | /* when hw sq is empty, but rq is not empty, so we continue | 2603 | /* when hw sq is empty, but rq is not empty, so we continue |
2601 | * to keep the cqe in order to get the cq event again. | 2604 | * to keep the cqe in order to get the cq event again. |
@@ -2714,6 +2717,10 @@ static bool ocrdma_poll_err_rcqe(struct ocrdma_qp *qp, struct ocrdma_cqe *cqe, | |||
2714 | int status) | 2717 | int status) |
2715 | { | 2718 | { |
2716 | bool expand; | 2719 | bool expand; |
2720 | struct ocrdma_dev *dev = get_ocrdma_dev(qp->ibqp.device); | ||
2721 | |||
2722 | if (status < OCRDMA_MAX_CQE_ERR) | ||
2723 | atomic_inc(&dev->cqe_err_stats[status]); | ||
2717 | 2724 | ||
2718 | /* when hw_rq is empty, but wq is not empty, so continue | 2725 | /* when hw_rq is empty, but wq is not empty, so continue |
2719 | * to keep the cqe to get the cq event again. | 2726 | * to keep the cqe to get the cq event again. |