.. | .. |
---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (C) 2017 Chelsio Communications. All rights reserved. |
---|
3 | | - * |
---|
4 | | - * This program is free software; you can redistribute it and/or modify it |
---|
5 | | - * under the terms and conditions of the GNU General Public License, |
---|
6 | | - * version 2, as published by the Free Software Foundation. |
---|
7 | | - * |
---|
8 | | - * This program is distributed in the hope it will be useful, but WITHOUT |
---|
9 | | - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
---|
10 | | - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
---|
11 | | - * more details. |
---|
12 | | - * |
---|
13 | | - * The full GNU General Public License is included in this distribution in |
---|
14 | | - * the file called "COPYING". |
---|
15 | | - * |
---|
16 | 4 | */ |
---|
17 | 5 | |
---|
18 | 6 | #ifndef __CUDBG_LIB_H__ |
---|
.. | .. |
---|
171 | 159 | int cudbg_collect_hma_meminfo(struct cudbg_init *pdbg_init, |
---|
172 | 160 | struct cudbg_buffer *dbg_buff, |
---|
173 | 161 | struct cudbg_error *cudbg_err); |
---|
| 162 | +int cudbg_collect_qdesc(struct cudbg_init *pdbg_init, |
---|
| 163 | + struct cudbg_buffer *dbg_buff, |
---|
| 164 | + struct cudbg_error *cudbg_err); |
---|
| 165 | +int cudbg_collect_flash(struct cudbg_init *pdbg_init, |
---|
| 166 | + struct cudbg_buffer *dbg_buff, |
---|
| 167 | + struct cudbg_error *cudbg_err); |
---|
174 | 168 | |
---|
| 169 | +u32 cudbg_get_entity_length(struct adapter *adap, u32 entity); |
---|
175 | 170 | struct cudbg_entity_hdr *cudbg_get_entity_hdr(void *outbuf, int i); |
---|
176 | 171 | void cudbg_align_debug_buffer(struct cudbg_buffer *dbg_buff, |
---|
177 | 172 | struct cudbg_entity_hdr *entity_hdr); |
---|
.. | .. |
---|
182 | 177 | struct cudbg_meminfo *meminfo_buff); |
---|
183 | 178 | void cudbg_fill_le_tcam_info(struct adapter *padap, |
---|
184 | 179 | struct cudbg_tcam *tcam_region); |
---|
| 180 | +void cudbg_fill_qdesc_num_and_size(const struct adapter *padap, |
---|
| 181 | + u32 *num, u32 *size); |
---|
| 182 | + |
---|
| 183 | +static inline u32 cudbg_uld_txq_to_qtype(u32 uld) |
---|
| 184 | +{ |
---|
| 185 | + switch (uld) { |
---|
| 186 | + case CXGB4_TX_OFLD: |
---|
| 187 | + return CUDBG_QTYPE_OFLD_TXQ; |
---|
| 188 | + case CXGB4_TX_CRYPTO: |
---|
| 189 | + return CUDBG_QTYPE_CRYPTO_TXQ; |
---|
| 190 | + } |
---|
| 191 | + |
---|
| 192 | + return CUDBG_QTYPE_UNKNOWN; |
---|
| 193 | +} |
---|
| 194 | + |
---|
| 195 | +static inline u32 cudbg_uld_rxq_to_qtype(u32 uld) |
---|
| 196 | +{ |
---|
| 197 | + switch (uld) { |
---|
| 198 | + case CXGB4_ULD_RDMA: |
---|
| 199 | + return CUDBG_QTYPE_RDMA_RXQ; |
---|
| 200 | + case CXGB4_ULD_ISCSI: |
---|
| 201 | + return CUDBG_QTYPE_ISCSI_RXQ; |
---|
| 202 | + case CXGB4_ULD_ISCSIT: |
---|
| 203 | + return CUDBG_QTYPE_ISCSIT_RXQ; |
---|
| 204 | + case CXGB4_ULD_CRYPTO: |
---|
| 205 | + return CUDBG_QTYPE_CRYPTO_RXQ; |
---|
| 206 | + case CXGB4_ULD_TLS: |
---|
| 207 | + return CUDBG_QTYPE_TLS_RXQ; |
---|
| 208 | + } |
---|
| 209 | + |
---|
| 210 | + return CUDBG_QTYPE_UNKNOWN; |
---|
| 211 | +} |
---|
| 212 | + |
---|
| 213 | +static inline u32 cudbg_uld_flq_to_qtype(u32 uld) |
---|
| 214 | +{ |
---|
| 215 | + switch (uld) { |
---|
| 216 | + case CXGB4_ULD_RDMA: |
---|
| 217 | + return CUDBG_QTYPE_RDMA_FLQ; |
---|
| 218 | + case CXGB4_ULD_ISCSI: |
---|
| 219 | + return CUDBG_QTYPE_ISCSI_FLQ; |
---|
| 220 | + case CXGB4_ULD_ISCSIT: |
---|
| 221 | + return CUDBG_QTYPE_ISCSIT_FLQ; |
---|
| 222 | + case CXGB4_ULD_CRYPTO: |
---|
| 223 | + return CUDBG_QTYPE_CRYPTO_FLQ; |
---|
| 224 | + case CXGB4_ULD_TLS: |
---|
| 225 | + return CUDBG_QTYPE_TLS_FLQ; |
---|
| 226 | + } |
---|
| 227 | + |
---|
| 228 | + return CUDBG_QTYPE_UNKNOWN; |
---|
| 229 | +} |
---|
| 230 | + |
---|
| 231 | +static inline u32 cudbg_uld_ciq_to_qtype(u32 uld) |
---|
| 232 | +{ |
---|
| 233 | + switch (uld) { |
---|
| 234 | + case CXGB4_ULD_RDMA: |
---|
| 235 | + return CUDBG_QTYPE_RDMA_CIQ; |
---|
| 236 | + } |
---|
| 237 | + |
---|
| 238 | + return CUDBG_QTYPE_UNKNOWN; |
---|
| 239 | +} |
---|
| 240 | + |
---|
| 241 | +static inline void cudbg_fill_qdesc_txq(const struct sge_txq *txq, |
---|
| 242 | + enum cudbg_qdesc_qtype type, |
---|
| 243 | + struct cudbg_qdesc_entry *entry) |
---|
| 244 | +{ |
---|
| 245 | + entry->qtype = type; |
---|
| 246 | + entry->qid = txq->cntxt_id; |
---|
| 247 | + entry->desc_size = sizeof(struct tx_desc); |
---|
| 248 | + entry->num_desc = txq->size; |
---|
| 249 | + entry->data_size = txq->size * sizeof(struct tx_desc); |
---|
| 250 | + memcpy(entry->data, txq->desc, entry->data_size); |
---|
| 251 | +} |
---|
| 252 | + |
---|
| 253 | +static inline void cudbg_fill_qdesc_rxq(const struct sge_rspq *rxq, |
---|
| 254 | + enum cudbg_qdesc_qtype type, |
---|
| 255 | + struct cudbg_qdesc_entry *entry) |
---|
| 256 | +{ |
---|
| 257 | + entry->qtype = type; |
---|
| 258 | + entry->qid = rxq->cntxt_id; |
---|
| 259 | + entry->desc_size = rxq->iqe_len; |
---|
| 260 | + entry->num_desc = rxq->size; |
---|
| 261 | + entry->data_size = rxq->size * rxq->iqe_len; |
---|
| 262 | + memcpy(entry->data, rxq->desc, entry->data_size); |
---|
| 263 | +} |
---|
| 264 | + |
---|
| 265 | +static inline void cudbg_fill_qdesc_flq(const struct sge_fl *flq, |
---|
| 266 | + enum cudbg_qdesc_qtype type, |
---|
| 267 | + struct cudbg_qdesc_entry *entry) |
---|
| 268 | +{ |
---|
| 269 | + entry->qtype = type; |
---|
| 270 | + entry->qid = flq->cntxt_id; |
---|
| 271 | + entry->desc_size = sizeof(__be64); |
---|
| 272 | + entry->num_desc = flq->size; |
---|
| 273 | + entry->data_size = flq->size * sizeof(__be64); |
---|
| 274 | + memcpy(entry->data, flq->desc, entry->data_size); |
---|
| 275 | +} |
---|
| 276 | + |
---|
| 277 | +static inline |
---|
| 278 | +struct cudbg_qdesc_entry *cudbg_next_qdesc(struct cudbg_qdesc_entry *e) |
---|
| 279 | +{ |
---|
| 280 | + return (struct cudbg_qdesc_entry *) |
---|
| 281 | + ((u8 *)e + sizeof(*e) + e->data_size); |
---|
| 282 | +} |
---|
185 | 283 | #endif /* __CUDBG_LIB_H__ */ |
---|