1 /* 2 * Broadcom NetXtreme-E RoCE driver. 3 * 4 * Copyright (c) 2016 - 2017, Broadcom. All rights reserved. The term 5 * Broadcom refers to Broadcom Limited and/or its subsidiaries. 6 * 7 * This software is available to you under a choice of one of two 8 * licenses. You may choose to be licensed under the terms of the GNU 9 * General Public License (GPL) Version 2, available from the file 10 * COPYING in the main directory of this source tree, or the 11 * BSD license below: 12 * 13 * Redistribution and use in source and binary forms, with or without 14 * modification, are permitted provided that the following conditions 15 * are met: 16 * 17 * 1. Redistributions of source code must retain the above copyright 18 * notice, this list of conditions and the following disclaimer. 19 * 2. Redistributions in binary form must reproduce the above copyright 20 * notice, this list of conditions and the following disclaimer in 21 * the documentation and/or other materials provided with the 22 * distribution. 23 * 24 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 26 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 27 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS 28 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 29 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 31 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 32 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 33 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 34 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 * 36 * Description: Statistics (header) 37 * 38 */ 39 40 #ifndef __BNXT_RE_HW_STATS_H__ 41 #define __BNXT_RE_HW_STATS_H__ 42 43 enum bnxt_re_hw_stats { 44 BNXT_RE_ACTIVE_PD, 45 BNXT_RE_ACTIVE_AH, 46 BNXT_RE_ACTIVE_QP, 47 BNXT_RE_ACTIVE_RC_QP, 48 BNXT_RE_ACTIVE_UD_QP, 49 BNXT_RE_ACTIVE_SRQ, 50 BNXT_RE_ACTIVE_CQ, 51 BNXT_RE_ACTIVE_MR, 52 BNXT_RE_ACTIVE_MW, 53 BNXT_RE_WATERMARK_PD, 54 BNXT_RE_WATERMARK_AH, 55 BNXT_RE_WATERMARK_QP, 56 BNXT_RE_WATERMARK_RC_QP, 57 BNXT_RE_WATERMARK_UD_QP, 58 BNXT_RE_WATERMARK_SRQ, 59 BNXT_RE_WATERMARK_CQ, 60 BNXT_RE_WATERMARK_MR, 61 BNXT_RE_WATERMARK_MW, 62 BNXT_RE_RESIZE_CQ_CNT, 63 BNXT_RE_RX_PKTS, 64 BNXT_RE_RX_BYTES, 65 BNXT_RE_TX_PKTS, 66 BNXT_RE_TX_BYTES, 67 BNXT_RE_RECOVERABLE_ERRORS, 68 BNXT_RE_TX_ERRORS, 69 BNXT_RE_TX_DISCARDS, 70 BNXT_RE_RX_ERRORS, 71 BNXT_RE_RX_DISCARDS, 72 BNXT_RE_TO_RETRANSMITS, 73 BNXT_RE_SEQ_ERR_NAKS_RCVD, 74 BNXT_RE_MAX_RETRY_EXCEEDED, 75 BNXT_RE_RNR_NAKS_RCVD, 76 BNXT_RE_MISSING_RESP, 77 BNXT_RE_UNRECOVERABLE_ERR, 78 BNXT_RE_BAD_RESP_ERR, 79 BNXT_RE_LOCAL_QP_OP_ERR, 80 BNXT_RE_LOCAL_PROTECTION_ERR, 81 BNXT_RE_MEM_MGMT_OP_ERR, 82 BNXT_RE_REMOTE_INVALID_REQ_ERR, 83 BNXT_RE_REMOTE_ACCESS_ERR, 84 BNXT_RE_REMOTE_OP_ERR, 85 BNXT_RE_DUP_REQ, 86 BNXT_RE_RES_EXCEED_MAX, 87 BNXT_RE_RES_LENGTH_MISMATCH, 88 BNXT_RE_RES_EXCEEDS_WQE, 89 BNXT_RE_RES_OPCODE_ERR, 90 BNXT_RE_RES_RX_INVALID_RKEY, 91 BNXT_RE_RES_RX_DOMAIN_ERR, 92 BNXT_RE_RES_RX_NO_PERM, 93 BNXT_RE_RES_RX_RANGE_ERR, 94 BNXT_RE_RES_TX_INVALID_RKEY, 95 BNXT_RE_RES_TX_DOMAIN_ERR, 96 BNXT_RE_RES_TX_NO_PERM, 97 BNXT_RE_RES_TX_RANGE_ERR, 98 BNXT_RE_RES_IRRQ_OFLOW, 99 BNXT_RE_RES_UNSUP_OPCODE, 100 BNXT_RE_RES_UNALIGNED_ATOMIC, 101 BNXT_RE_RES_REM_INV_ERR, 102 BNXT_RE_RES_MEM_ERROR, 103 BNXT_RE_RES_SRQ_ERR, 104 BNXT_RE_RES_CMP_ERR, 105 BNXT_RE_RES_INVALID_DUP_RKEY, 106 BNXT_RE_RES_WQE_FORMAT_ERR, 107 BNXT_RE_RES_CQ_LOAD_ERR, 108 BNXT_RE_RES_SRQ_LOAD_ERR, 109 BNXT_RE_RES_TX_PCI_ERR, 110 BNXT_RE_RES_RX_PCI_ERR, 111 BNXT_RE_OUT_OF_SEQ_ERR, 112 BNXT_RE_TX_ATOMIC_REQ, 113 BNXT_RE_TX_READ_REQ, 114 BNXT_RE_TX_READ_RES, 115 BNXT_RE_TX_WRITE_REQ, 116 BNXT_RE_TX_SEND_REQ, 117 BNXT_RE_TX_ROCE_PKTS, 118 BNXT_RE_TX_ROCE_BYTES, 119 BNXT_RE_RX_ATOMIC_REQ, 120 BNXT_RE_RX_READ_REQ, 121 BNXT_RE_RX_READ_RESP, 122 BNXT_RE_RX_WRITE_REQ, 123 BNXT_RE_RX_SEND_REQ, 124 BNXT_RE_RX_ROCE_PKTS, 125 BNXT_RE_RX_ROCE_BYTES, 126 BNXT_RE_RX_ROCE_GOOD_PKTS, 127 BNXT_RE_RX_ROCE_GOOD_BYTES, 128 BNXT_RE_OOB, 129 BNXT_RE_TX_CNP, 130 BNXT_RE_RX_CNP, 131 BNXT_RE_RX_ECN, 132 BNXT_RE_PACING_RESCHED, 133 BNXT_RE_PACING_CMPL, 134 BNXT_RE_PACING_ALERT, 135 BNXT_RE_DB_FIFO_REG, 136 BNXT_RE_NUM_EXT_COUNTERS 137 }; 138 139 #define BNXT_RE_NUM_STD_COUNTERS (BNXT_RE_OUT_OF_SEQ_ERR + 1) 140 141 struct bnxt_re_db_pacing_stats { 142 u64 resched; 143 u64 complete; 144 u64 alerts; 145 }; 146 147 struct bnxt_re_res_cntrs { 148 atomic_t qp_count; 149 atomic_t rc_qp_count; 150 atomic_t ud_qp_count; 151 atomic_t cq_count; 152 atomic_t srq_count; 153 atomic_t mr_count; 154 atomic_t mw_count; 155 atomic_t ah_count; 156 atomic_t pd_count; 157 atomic_t resize_count; 158 u64 qp_watermark; 159 u64 rc_qp_watermark; 160 u64 ud_qp_watermark; 161 u64 cq_watermark; 162 u64 srq_watermark; 163 u64 mr_watermark; 164 u64 mw_watermark; 165 u64 ah_watermark; 166 u64 pd_watermark; 167 }; 168 169 struct bnxt_re_rstat { 170 struct bnxt_qplib_roce_stats errs; 171 struct bnxt_qplib_ext_stat ext_stat; 172 }; 173 174 struct bnxt_re_stats { 175 struct bnxt_re_rstat rstat; 176 struct bnxt_re_res_cntrs res; 177 struct bnxt_re_db_pacing_stats pacing; 178 }; 179 180 struct rdma_hw_stats *bnxt_re_ib_alloc_hw_port_stats(struct ib_device *ibdev, 181 u32 port_num); 182 int bnxt_re_ib_get_hw_stats(struct ib_device *ibdev, 183 struct rdma_hw_stats *stats, 184 u32 port, int index); 185 #endif /* __BNXT_RE_HW_STATS_H__ */ 186