18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci *  Copyright (C) 2017 Chelsio Communications.  All rights reserved.
48c2ecf20Sopenharmony_ci */
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci#ifndef __CUDBG_LIB_H__
78c2ecf20Sopenharmony_ci#define __CUDBG_LIB_H__
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ciint cudbg_collect_reg_dump(struct cudbg_init *pdbg_init,
108c2ecf20Sopenharmony_ci			   struct cudbg_buffer *dbg_buff,
118c2ecf20Sopenharmony_ci			   struct cudbg_error *cudbg_err);
128c2ecf20Sopenharmony_ciint cudbg_collect_fw_devlog(struct cudbg_init *pdbg_init,
138c2ecf20Sopenharmony_ci			    struct cudbg_buffer *dbg_buff,
148c2ecf20Sopenharmony_ci			    struct cudbg_error *cudbg_err);
158c2ecf20Sopenharmony_ciint cudbg_collect_cim_la(struct cudbg_init *pdbg_init,
168c2ecf20Sopenharmony_ci			 struct cudbg_buffer *dbg_buff,
178c2ecf20Sopenharmony_ci			 struct cudbg_error *cudbg_err);
188c2ecf20Sopenharmony_ciint cudbg_collect_cim_ma_la(struct cudbg_init *pdbg_init,
198c2ecf20Sopenharmony_ci			    struct cudbg_buffer *dbg_buff,
208c2ecf20Sopenharmony_ci			    struct cudbg_error *cudbg_err);
218c2ecf20Sopenharmony_ciint cudbg_collect_cim_qcfg(struct cudbg_init *pdbg_init,
228c2ecf20Sopenharmony_ci			   struct cudbg_buffer *dbg_buff,
238c2ecf20Sopenharmony_ci			   struct cudbg_error *cudbg_err);
248c2ecf20Sopenharmony_ciint cudbg_collect_cim_ibq_tp0(struct cudbg_init *pdbg_init,
258c2ecf20Sopenharmony_ci			      struct cudbg_buffer *dbg_buff,
268c2ecf20Sopenharmony_ci			      struct cudbg_error *cudbg_err);
278c2ecf20Sopenharmony_ciint cudbg_collect_cim_ibq_tp1(struct cudbg_init *pdbg_init,
288c2ecf20Sopenharmony_ci			      struct cudbg_buffer *dbg_buff,
298c2ecf20Sopenharmony_ci			      struct cudbg_error *cudbg_err);
308c2ecf20Sopenharmony_ciint cudbg_collect_cim_ibq_ulp(struct cudbg_init *pdbg_init,
318c2ecf20Sopenharmony_ci			      struct cudbg_buffer *dbg_buff,
328c2ecf20Sopenharmony_ci			      struct cudbg_error *cudbg_err);
338c2ecf20Sopenharmony_ciint cudbg_collect_cim_ibq_sge0(struct cudbg_init *pdbg_init,
348c2ecf20Sopenharmony_ci			       struct cudbg_buffer *dbg_buff,
358c2ecf20Sopenharmony_ci			       struct cudbg_error *cudbg_err);
368c2ecf20Sopenharmony_ciint cudbg_collect_cim_ibq_sge1(struct cudbg_init *pdbg_init,
378c2ecf20Sopenharmony_ci			       struct cudbg_buffer *dbg_buff,
388c2ecf20Sopenharmony_ci			       struct cudbg_error *cudbg_err);
398c2ecf20Sopenharmony_ciint cudbg_collect_cim_ibq_ncsi(struct cudbg_init *pdbg_init,
408c2ecf20Sopenharmony_ci			       struct cudbg_buffer *dbg_buff,
418c2ecf20Sopenharmony_ci			       struct cudbg_error *cudbg_err);
428c2ecf20Sopenharmony_ciint cudbg_collect_cim_obq_ulp0(struct cudbg_init *pdbg_init,
438c2ecf20Sopenharmony_ci			       struct cudbg_buffer *dbg_buff,
448c2ecf20Sopenharmony_ci			       struct cudbg_error *cudbg_err);
458c2ecf20Sopenharmony_ciint cudbg_collect_cim_obq_ulp1(struct cudbg_init *pdbg_init,
468c2ecf20Sopenharmony_ci			       struct cudbg_buffer *dbg_buff,
478c2ecf20Sopenharmony_ci			       struct cudbg_error *cudbg_err);
488c2ecf20Sopenharmony_ciint cudbg_collect_cim_obq_ulp2(struct cudbg_init *pdbg_init,
498c2ecf20Sopenharmony_ci			       struct cudbg_buffer *dbg_buff,
508c2ecf20Sopenharmony_ci			       struct cudbg_error *cudbg_err);
518c2ecf20Sopenharmony_ciint cudbg_collect_cim_obq_ulp3(struct cudbg_init *pdbg_init,
528c2ecf20Sopenharmony_ci			       struct cudbg_buffer *dbg_buff,
538c2ecf20Sopenharmony_ci			       struct cudbg_error *cudbg_err);
548c2ecf20Sopenharmony_ciint cudbg_collect_cim_obq_sge(struct cudbg_init *pdbg_init,
558c2ecf20Sopenharmony_ci			      struct cudbg_buffer *dbg_buff,
568c2ecf20Sopenharmony_ci			      struct cudbg_error *cudbg_err);
578c2ecf20Sopenharmony_ciint cudbg_collect_cim_obq_ncsi(struct cudbg_init *pdbg_init,
588c2ecf20Sopenharmony_ci			       struct cudbg_buffer *dbg_buff,
598c2ecf20Sopenharmony_ci			       struct cudbg_error *cudbg_err);
608c2ecf20Sopenharmony_ciint cudbg_collect_edc0_meminfo(struct cudbg_init *pdbg_init,
618c2ecf20Sopenharmony_ci			       struct cudbg_buffer *dbg_buff,
628c2ecf20Sopenharmony_ci			       struct cudbg_error *cudbg_err);
638c2ecf20Sopenharmony_ciint cudbg_collect_edc1_meminfo(struct cudbg_init *pdbg_init,
648c2ecf20Sopenharmony_ci			       struct cudbg_buffer *dbg_buff,
658c2ecf20Sopenharmony_ci			       struct cudbg_error *cudbg_err);
668c2ecf20Sopenharmony_ciint cudbg_collect_mc0_meminfo(struct cudbg_init *pdbg_init,
678c2ecf20Sopenharmony_ci			      struct cudbg_buffer *dbg_buff,
688c2ecf20Sopenharmony_ci			      struct cudbg_error *cudbg_err);
698c2ecf20Sopenharmony_ciint cudbg_collect_mc1_meminfo(struct cudbg_init *pdbg_init,
708c2ecf20Sopenharmony_ci			      struct cudbg_buffer *dbg_buff,
718c2ecf20Sopenharmony_ci			      struct cudbg_error *cudbg_err);
728c2ecf20Sopenharmony_ciint cudbg_collect_rss(struct cudbg_init *pdbg_init,
738c2ecf20Sopenharmony_ci		      struct cudbg_buffer *dbg_buff,
748c2ecf20Sopenharmony_ci		      struct cudbg_error *cudbg_err);
758c2ecf20Sopenharmony_ciint cudbg_collect_rss_vf_config(struct cudbg_init *pdbg_init,
768c2ecf20Sopenharmony_ci				struct cudbg_buffer *dbg_buff,
778c2ecf20Sopenharmony_ci				struct cudbg_error *cudbg_err);
788c2ecf20Sopenharmony_ciint cudbg_collect_tp_indirect(struct cudbg_init *pdbg_init,
798c2ecf20Sopenharmony_ci			      struct cudbg_buffer *dbg_buff,
808c2ecf20Sopenharmony_ci			      struct cudbg_error *cudbg_err);
818c2ecf20Sopenharmony_ciint cudbg_collect_path_mtu(struct cudbg_init *pdbg_init,
828c2ecf20Sopenharmony_ci			   struct cudbg_buffer *dbg_buff,
838c2ecf20Sopenharmony_ci			   struct cudbg_error *cudbg_err);
848c2ecf20Sopenharmony_ciint cudbg_collect_pm_stats(struct cudbg_init *pdbg_init,
858c2ecf20Sopenharmony_ci			   struct cudbg_buffer *dbg_buff,
868c2ecf20Sopenharmony_ci			   struct cudbg_error *cudbg_err);
878c2ecf20Sopenharmony_ciint cudbg_collect_hw_sched(struct cudbg_init *pdbg_init,
888c2ecf20Sopenharmony_ci			   struct cudbg_buffer *dbg_buff,
898c2ecf20Sopenharmony_ci			   struct cudbg_error *cudbg_err);
908c2ecf20Sopenharmony_ciint cudbg_collect_sge_indirect(struct cudbg_init *pdbg_init,
918c2ecf20Sopenharmony_ci			       struct cudbg_buffer *dbg_buff,
928c2ecf20Sopenharmony_ci			       struct cudbg_error *cudbg_err);
938c2ecf20Sopenharmony_ciint cudbg_collect_ulprx_la(struct cudbg_init *pdbg_init,
948c2ecf20Sopenharmony_ci			   struct cudbg_buffer *dbg_buff,
958c2ecf20Sopenharmony_ci			   struct cudbg_error *cudbg_err);
968c2ecf20Sopenharmony_ciint cudbg_collect_tp_la(struct cudbg_init *pdbg_init,
978c2ecf20Sopenharmony_ci			struct cudbg_buffer *dbg_buff,
988c2ecf20Sopenharmony_ci			struct cudbg_error *cudbg_err);
998c2ecf20Sopenharmony_ciint cudbg_collect_meminfo(struct cudbg_init *pdbg_init,
1008c2ecf20Sopenharmony_ci			  struct cudbg_buffer *dbg_buff,
1018c2ecf20Sopenharmony_ci			  struct cudbg_error *cudbg_err);
1028c2ecf20Sopenharmony_ciint cudbg_collect_cim_pif_la(struct cudbg_init *pdbg_init,
1038c2ecf20Sopenharmony_ci			     struct cudbg_buffer *dbg_buff,
1048c2ecf20Sopenharmony_ci			     struct cudbg_error *cudbg_err);
1058c2ecf20Sopenharmony_ciint cudbg_collect_clk_info(struct cudbg_init *pdbg_init,
1068c2ecf20Sopenharmony_ci			   struct cudbg_buffer *dbg_buff,
1078c2ecf20Sopenharmony_ci			   struct cudbg_error *cudbg_err);
1088c2ecf20Sopenharmony_ciint cudbg_collect_obq_sge_rx_q0(struct cudbg_init *pdbg_init,
1098c2ecf20Sopenharmony_ci				struct cudbg_buffer *dbg_buff,
1108c2ecf20Sopenharmony_ci				struct cudbg_error *cudbg_err);
1118c2ecf20Sopenharmony_ciint cudbg_collect_obq_sge_rx_q1(struct cudbg_init *pdbg_init,
1128c2ecf20Sopenharmony_ci				struct cudbg_buffer *dbg_buff,
1138c2ecf20Sopenharmony_ci				struct cudbg_error *cudbg_err);
1148c2ecf20Sopenharmony_ciint cudbg_collect_pcie_indirect(struct cudbg_init *pdbg_init,
1158c2ecf20Sopenharmony_ci				struct cudbg_buffer *dbg_buff,
1168c2ecf20Sopenharmony_ci				struct cudbg_error *cudbg_err);
1178c2ecf20Sopenharmony_ciint cudbg_collect_pm_indirect(struct cudbg_init *pdbg_init,
1188c2ecf20Sopenharmony_ci			      struct cudbg_buffer *dbg_buff,
1198c2ecf20Sopenharmony_ci			      struct cudbg_error *cudbg_err);
1208c2ecf20Sopenharmony_ciint cudbg_collect_tid(struct cudbg_init *pdbg_init,
1218c2ecf20Sopenharmony_ci		      struct cudbg_buffer *dbg_buff,
1228c2ecf20Sopenharmony_ci		      struct cudbg_error *cudbg_err);
1238c2ecf20Sopenharmony_ciint cudbg_collect_pcie_config(struct cudbg_init *pdbg_init,
1248c2ecf20Sopenharmony_ci			      struct cudbg_buffer *dbg_buff,
1258c2ecf20Sopenharmony_ci			      struct cudbg_error *cudbg_err);
1268c2ecf20Sopenharmony_ciint cudbg_collect_dump_context(struct cudbg_init *pdbg_init,
1278c2ecf20Sopenharmony_ci			       struct cudbg_buffer *dbg_buff,
1288c2ecf20Sopenharmony_ci			       struct cudbg_error *cudbg_err);
1298c2ecf20Sopenharmony_ciint cudbg_collect_mps_tcam(struct cudbg_init *pdbg_init,
1308c2ecf20Sopenharmony_ci			   struct cudbg_buffer *dbg_buff,
1318c2ecf20Sopenharmony_ci			   struct cudbg_error *cudbg_err);
1328c2ecf20Sopenharmony_ciint cudbg_collect_vpd_data(struct cudbg_init *pdbg_init,
1338c2ecf20Sopenharmony_ci			   struct cudbg_buffer *dbg_buff,
1348c2ecf20Sopenharmony_ci			   struct cudbg_error *cudbg_err);
1358c2ecf20Sopenharmony_ciint cudbg_collect_le_tcam(struct cudbg_init *pdbg_init,
1368c2ecf20Sopenharmony_ci			  struct cudbg_buffer *dbg_buff,
1378c2ecf20Sopenharmony_ci			  struct cudbg_error *cudbg_err);
1388c2ecf20Sopenharmony_ciint cudbg_collect_cctrl(struct cudbg_init *pdbg_init,
1398c2ecf20Sopenharmony_ci			struct cudbg_buffer *dbg_buff,
1408c2ecf20Sopenharmony_ci			struct cudbg_error *cudbg_err);
1418c2ecf20Sopenharmony_ciint cudbg_collect_ma_indirect(struct cudbg_init *pdbg_init,
1428c2ecf20Sopenharmony_ci			      struct cudbg_buffer *dbg_buff,
1438c2ecf20Sopenharmony_ci			      struct cudbg_error *cudbg_err);
1448c2ecf20Sopenharmony_ciint cudbg_collect_ulptx_la(struct cudbg_init *pdbg_init,
1458c2ecf20Sopenharmony_ci			   struct cudbg_buffer *dbg_buff,
1468c2ecf20Sopenharmony_ci			   struct cudbg_error *cudbg_err);
1478c2ecf20Sopenharmony_ciint cudbg_collect_up_cim_indirect(struct cudbg_init *pdbg_init,
1488c2ecf20Sopenharmony_ci				  struct cudbg_buffer *dbg_buff,
1498c2ecf20Sopenharmony_ci				  struct cudbg_error *cudbg_err);
1508c2ecf20Sopenharmony_ciint cudbg_collect_pbt_tables(struct cudbg_init *pdbg_init,
1518c2ecf20Sopenharmony_ci			     struct cudbg_buffer *dbg_buff,
1528c2ecf20Sopenharmony_ci			     struct cudbg_error *cudbg_err);
1538c2ecf20Sopenharmony_ciint cudbg_collect_mbox_log(struct cudbg_init *pdbg_init,
1548c2ecf20Sopenharmony_ci			   struct cudbg_buffer *dbg_buff,
1558c2ecf20Sopenharmony_ci			   struct cudbg_error *cudbg_err);
1568c2ecf20Sopenharmony_ciint cudbg_collect_hma_indirect(struct cudbg_init *pdbg_init,
1578c2ecf20Sopenharmony_ci			       struct cudbg_buffer *dbg_buff,
1588c2ecf20Sopenharmony_ci			       struct cudbg_error *cudbg_err);
1598c2ecf20Sopenharmony_ciint cudbg_collect_hma_meminfo(struct cudbg_init *pdbg_init,
1608c2ecf20Sopenharmony_ci			      struct cudbg_buffer *dbg_buff,
1618c2ecf20Sopenharmony_ci			      struct cudbg_error *cudbg_err);
1628c2ecf20Sopenharmony_ciint cudbg_collect_qdesc(struct cudbg_init *pdbg_init,
1638c2ecf20Sopenharmony_ci			struct cudbg_buffer *dbg_buff,
1648c2ecf20Sopenharmony_ci			struct cudbg_error *cudbg_err);
1658c2ecf20Sopenharmony_ciint cudbg_collect_flash(struct cudbg_init *pdbg_init,
1668c2ecf20Sopenharmony_ci			struct cudbg_buffer *dbg_buff,
1678c2ecf20Sopenharmony_ci			struct cudbg_error *cudbg_err);
1688c2ecf20Sopenharmony_ci
1698c2ecf20Sopenharmony_ciu32 cudbg_get_entity_length(struct adapter *adap, u32 entity);
1708c2ecf20Sopenharmony_cistruct cudbg_entity_hdr *cudbg_get_entity_hdr(void *outbuf, int i);
1718c2ecf20Sopenharmony_civoid cudbg_align_debug_buffer(struct cudbg_buffer *dbg_buff,
1728c2ecf20Sopenharmony_ci			      struct cudbg_entity_hdr *entity_hdr);
1738c2ecf20Sopenharmony_ciu32 cudbg_cim_obq_size(struct adapter *padap, int qid);
1748c2ecf20Sopenharmony_ciint cudbg_dump_context_size(struct adapter *padap);
1758c2ecf20Sopenharmony_ci
1768c2ecf20Sopenharmony_ciint cudbg_fill_meminfo(struct adapter *padap,
1778c2ecf20Sopenharmony_ci		       struct cudbg_meminfo *meminfo_buff);
1788c2ecf20Sopenharmony_civoid cudbg_fill_le_tcam_info(struct adapter *padap,
1798c2ecf20Sopenharmony_ci			     struct cudbg_tcam *tcam_region);
1808c2ecf20Sopenharmony_civoid cudbg_fill_qdesc_num_and_size(const struct adapter *padap,
1818c2ecf20Sopenharmony_ci				   u32 *num, u32 *size);
1828c2ecf20Sopenharmony_ci
1838c2ecf20Sopenharmony_cistatic inline u32 cudbg_uld_txq_to_qtype(u32 uld)
1848c2ecf20Sopenharmony_ci{
1858c2ecf20Sopenharmony_ci	switch (uld) {
1868c2ecf20Sopenharmony_ci	case CXGB4_TX_OFLD:
1878c2ecf20Sopenharmony_ci		return CUDBG_QTYPE_OFLD_TXQ;
1888c2ecf20Sopenharmony_ci	case CXGB4_TX_CRYPTO:
1898c2ecf20Sopenharmony_ci		return CUDBG_QTYPE_CRYPTO_TXQ;
1908c2ecf20Sopenharmony_ci	}
1918c2ecf20Sopenharmony_ci
1928c2ecf20Sopenharmony_ci	return CUDBG_QTYPE_UNKNOWN;
1938c2ecf20Sopenharmony_ci}
1948c2ecf20Sopenharmony_ci
1958c2ecf20Sopenharmony_cistatic inline u32 cudbg_uld_rxq_to_qtype(u32 uld)
1968c2ecf20Sopenharmony_ci{
1978c2ecf20Sopenharmony_ci	switch (uld) {
1988c2ecf20Sopenharmony_ci	case CXGB4_ULD_RDMA:
1998c2ecf20Sopenharmony_ci		return CUDBG_QTYPE_RDMA_RXQ;
2008c2ecf20Sopenharmony_ci	case CXGB4_ULD_ISCSI:
2018c2ecf20Sopenharmony_ci		return CUDBG_QTYPE_ISCSI_RXQ;
2028c2ecf20Sopenharmony_ci	case CXGB4_ULD_ISCSIT:
2038c2ecf20Sopenharmony_ci		return CUDBG_QTYPE_ISCSIT_RXQ;
2048c2ecf20Sopenharmony_ci	case CXGB4_ULD_CRYPTO:
2058c2ecf20Sopenharmony_ci		return CUDBG_QTYPE_CRYPTO_RXQ;
2068c2ecf20Sopenharmony_ci	case CXGB4_ULD_TLS:
2078c2ecf20Sopenharmony_ci		return CUDBG_QTYPE_TLS_RXQ;
2088c2ecf20Sopenharmony_ci	}
2098c2ecf20Sopenharmony_ci
2108c2ecf20Sopenharmony_ci	return CUDBG_QTYPE_UNKNOWN;
2118c2ecf20Sopenharmony_ci}
2128c2ecf20Sopenharmony_ci
2138c2ecf20Sopenharmony_cistatic inline u32 cudbg_uld_flq_to_qtype(u32 uld)
2148c2ecf20Sopenharmony_ci{
2158c2ecf20Sopenharmony_ci	switch (uld) {
2168c2ecf20Sopenharmony_ci	case CXGB4_ULD_RDMA:
2178c2ecf20Sopenharmony_ci		return CUDBG_QTYPE_RDMA_FLQ;
2188c2ecf20Sopenharmony_ci	case CXGB4_ULD_ISCSI:
2198c2ecf20Sopenharmony_ci		return CUDBG_QTYPE_ISCSI_FLQ;
2208c2ecf20Sopenharmony_ci	case CXGB4_ULD_ISCSIT:
2218c2ecf20Sopenharmony_ci		return CUDBG_QTYPE_ISCSIT_FLQ;
2228c2ecf20Sopenharmony_ci	case CXGB4_ULD_CRYPTO:
2238c2ecf20Sopenharmony_ci		return CUDBG_QTYPE_CRYPTO_FLQ;
2248c2ecf20Sopenharmony_ci	case CXGB4_ULD_TLS:
2258c2ecf20Sopenharmony_ci		return CUDBG_QTYPE_TLS_FLQ;
2268c2ecf20Sopenharmony_ci	}
2278c2ecf20Sopenharmony_ci
2288c2ecf20Sopenharmony_ci	return CUDBG_QTYPE_UNKNOWN;
2298c2ecf20Sopenharmony_ci}
2308c2ecf20Sopenharmony_ci
2318c2ecf20Sopenharmony_cistatic inline u32 cudbg_uld_ciq_to_qtype(u32 uld)
2328c2ecf20Sopenharmony_ci{
2338c2ecf20Sopenharmony_ci	switch (uld) {
2348c2ecf20Sopenharmony_ci	case CXGB4_ULD_RDMA:
2358c2ecf20Sopenharmony_ci		return CUDBG_QTYPE_RDMA_CIQ;
2368c2ecf20Sopenharmony_ci	}
2378c2ecf20Sopenharmony_ci
2388c2ecf20Sopenharmony_ci	return CUDBG_QTYPE_UNKNOWN;
2398c2ecf20Sopenharmony_ci}
2408c2ecf20Sopenharmony_ci
2418c2ecf20Sopenharmony_cistatic inline void cudbg_fill_qdesc_txq(const struct sge_txq *txq,
2428c2ecf20Sopenharmony_ci					enum cudbg_qdesc_qtype type,
2438c2ecf20Sopenharmony_ci					struct cudbg_qdesc_entry *entry)
2448c2ecf20Sopenharmony_ci{
2458c2ecf20Sopenharmony_ci	entry->qtype = type;
2468c2ecf20Sopenharmony_ci	entry->qid = txq->cntxt_id;
2478c2ecf20Sopenharmony_ci	entry->desc_size = sizeof(struct tx_desc);
2488c2ecf20Sopenharmony_ci	entry->num_desc = txq->size;
2498c2ecf20Sopenharmony_ci	entry->data_size = txq->size * sizeof(struct tx_desc);
2508c2ecf20Sopenharmony_ci	memcpy(entry->data, txq->desc, entry->data_size);
2518c2ecf20Sopenharmony_ci}
2528c2ecf20Sopenharmony_ci
2538c2ecf20Sopenharmony_cistatic inline void cudbg_fill_qdesc_rxq(const struct sge_rspq *rxq,
2548c2ecf20Sopenharmony_ci					enum cudbg_qdesc_qtype type,
2558c2ecf20Sopenharmony_ci					struct cudbg_qdesc_entry *entry)
2568c2ecf20Sopenharmony_ci{
2578c2ecf20Sopenharmony_ci	entry->qtype = type;
2588c2ecf20Sopenharmony_ci	entry->qid = rxq->cntxt_id;
2598c2ecf20Sopenharmony_ci	entry->desc_size = rxq->iqe_len;
2608c2ecf20Sopenharmony_ci	entry->num_desc = rxq->size;
2618c2ecf20Sopenharmony_ci	entry->data_size = rxq->size * rxq->iqe_len;
2628c2ecf20Sopenharmony_ci	memcpy(entry->data, rxq->desc, entry->data_size);
2638c2ecf20Sopenharmony_ci}
2648c2ecf20Sopenharmony_ci
2658c2ecf20Sopenharmony_cistatic inline void cudbg_fill_qdesc_flq(const struct sge_fl *flq,
2668c2ecf20Sopenharmony_ci					enum cudbg_qdesc_qtype type,
2678c2ecf20Sopenharmony_ci					struct cudbg_qdesc_entry *entry)
2688c2ecf20Sopenharmony_ci{
2698c2ecf20Sopenharmony_ci	entry->qtype = type;
2708c2ecf20Sopenharmony_ci	entry->qid = flq->cntxt_id;
2718c2ecf20Sopenharmony_ci	entry->desc_size = sizeof(__be64);
2728c2ecf20Sopenharmony_ci	entry->num_desc = flq->size;
2738c2ecf20Sopenharmony_ci	entry->data_size = flq->size * sizeof(__be64);
2748c2ecf20Sopenharmony_ci	memcpy(entry->data, flq->desc, entry->data_size);
2758c2ecf20Sopenharmony_ci}
2768c2ecf20Sopenharmony_ci
2778c2ecf20Sopenharmony_cistatic inline
2788c2ecf20Sopenharmony_cistruct cudbg_qdesc_entry *cudbg_next_qdesc(struct cudbg_qdesc_entry *e)
2798c2ecf20Sopenharmony_ci{
2808c2ecf20Sopenharmony_ci	return (struct cudbg_qdesc_entry *)
2818c2ecf20Sopenharmony_ci	       ((u8 *)e + sizeof(*e) + e->data_size);
2828c2ecf20Sopenharmony_ci}
2838c2ecf20Sopenharmony_ci#endif /* __CUDBG_LIB_H__ */
284