Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2011, 2014-2015 The Linux Foundation. All rights reserved. |
| 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | |
| 22 | /* |
| 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
| 26 | */ |
| 27 | |
| 28 | /** |
| 29 | * @file ol_txrx_dbg.h |
| 30 | * @brief Functions provided for visibility and debugging. |
| 31 | */ |
| 32 | #ifndef _OL_TXRX_DBG__H_ |
| 33 | #define _OL_TXRX_DBG__H_ |
| 34 | |
| 35 | #include <athdefs.h> /* A_STATUS, uint64_t */ |
| 36 | #include <cdf_lock.h> /* cdf_semaphore_t */ |
| 37 | #include <htt.h> /* htt_dbg_stats_type */ |
| 38 | #include <ol_txrx_stats.h> /* ol_txrx_stats */ |
| 39 | |
| 40 | typedef void (*ol_txrx_stats_callback)(void *ctxt, |
| 41 | enum htt_dbg_stats_type type, |
| 42 | uint8_t *buf, int bytes); |
| 43 | |
| 44 | struct ol_txrx_stats_req { |
| 45 | uint32_t stats_type_upload_mask; /* which stats to upload */ |
| 46 | uint32_t stats_type_reset_mask; /* which stats to reset */ |
| 47 | |
| 48 | /* stats will be printed if either print element is set */ |
| 49 | struct { |
| 50 | int verbose; /* verbose stats printout */ |
| 51 | int concise; /* concise stats printout (takes precedence) */ |
| 52 | } print; /* print uploaded stats */ |
| 53 | |
| 54 | /* stats notify callback will be invoked if fp is non-NULL */ |
| 55 | struct { |
| 56 | ol_txrx_stats_callback fp; |
| 57 | void *ctxt; |
| 58 | } callback; |
| 59 | |
| 60 | /* stats will be copied into the specified buffer if buf is non-NULL */ |
| 61 | struct { |
| 62 | uint8_t *buf; |
| 63 | int byte_limit; /* don't copy more than this */ |
| 64 | } copy; |
| 65 | |
| 66 | /* |
| 67 | * If blocking is true, the caller will take the specified semaphore |
| 68 | * to wait for the stats to be uploaded, and the driver will release |
| 69 | * the semaphore when the stats are done being uploaded. |
| 70 | */ |
| 71 | struct { |
| 72 | int blocking; |
| 73 | cdf_semaphore_t *sem_ptr; |
| 74 | } wait; |
| 75 | }; |
| 76 | |
| 77 | #ifndef TXRX_DEBUG_LEVEL |
| 78 | #define TXRX_DEBUG_LEVEL 0 /* no debug info */ |
| 79 | #endif |
| 80 | |
| 81 | #ifndef ATH_PERF_PWR_OFFLOAD /*---------------------------------------------*/ |
| 82 | |
| 83 | #define ol_txrx_debug(vdev, debug_specs) 0 |
| 84 | #define ol_txrx_fw_stats_cfg(vdev, type, val) 0 |
| 85 | #define ol_txrx_fw_stats_get(vdev, req) 0 |
| 86 | #define ol_txrx_aggr_cfg(vdev, max_subfrms_ampdu, max_subfrms_amsdu) 0 |
| 87 | |
| 88 | #else /*---------------------------------------------------------------------*/ |
| 89 | |
| 90 | #include <ol_txrx_api.h> /* ol_txrx_pdev_handle, etc. */ |
| 91 | |
| 92 | int ol_txrx_debug(ol_txrx_vdev_handle vdev, int debug_specs); |
| 93 | |
| 94 | void ol_txrx_fw_stats_cfg(ol_txrx_vdev_handle vdev, |
| 95 | uint8_t cfg_stats_type, uint32_t cfg_val); |
| 96 | |
| 97 | int ol_txrx_fw_stats_get(ol_txrx_vdev_handle vdev, |
| 98 | struct ol_txrx_stats_req *req); |
| 99 | |
| 100 | int ol_txrx_aggr_cfg(ol_txrx_vdev_handle vdev, |
| 101 | int max_subfrms_ampdu, int max_subfrms_amsdu); |
| 102 | |
| 103 | enum { |
| 104 | TXRX_DBG_MASK_OBJS = 0x01, |
| 105 | TXRX_DBG_MASK_STATS = 0x02, |
| 106 | TXRX_DBG_MASK_PROT_ANALYZE = 0x04, |
| 107 | TXRX_DBG_MASK_RX_REORDER_TRACE = 0x08, |
| 108 | TXRX_DBG_MASK_RX_PN_TRACE = 0x10 |
| 109 | }; |
| 110 | |
| 111 | /*--- txrx printouts ---*/ |
| 112 | |
| 113 | /* |
| 114 | * Uncomment this to enable txrx printouts with dynamically adjustable |
| 115 | * verbosity. These printouts should not impact performance. |
| 116 | */ |
| 117 | #define TXRX_PRINT_ENABLE 1 |
| 118 | /* uncomment this for verbose txrx printouts (may impact performance) */ |
| 119 | /* #define TXRX_PRINT_VERBOSE_ENABLE 1 */ |
| 120 | |
| 121 | void ol_txrx_print_level_set(unsigned level); |
| 122 | |
| 123 | /*--- txrx object (pdev, vdev, peer) display debug functions ---*/ |
| 124 | |
| 125 | #if TXRX_DEBUG_LEVEL > 5 |
| 126 | void ol_txrx_pdev_display(ol_txrx_pdev_handle pdev, int indent); |
| 127 | void ol_txrx_vdev_display(ol_txrx_vdev_handle vdev, int indent); |
| 128 | void ol_txrx_peer_display(ol_txrx_peer_handle peer, int indent); |
| 129 | #else |
| 130 | #define ol_txrx_pdev_display(pdev, indent) |
| 131 | #define ol_txrx_vdev_display(vdev, indent) |
| 132 | #define ol_txrx_peer_display(peer, indent) |
| 133 | #endif |
| 134 | |
| 135 | /*--- txrx stats display debug functions ---*/ |
| 136 | |
| 137 | |
| 138 | void ol_txrx_stats_display(ol_txrx_pdev_handle pdev); |
| 139 | |
| 140 | void ol_txrx_stats_clear(ol_txrx_pdev_handle pdev); |
| 141 | |
| 142 | |
| 143 | /*--- txrx protocol analyzer debug feature ---*/ |
| 144 | |
| 145 | /* uncomment this to enable the protocol analzyer feature */ |
| 146 | /* #define ENABLE_TXRX_PROT_ANALYZE 1 */ |
| 147 | |
| 148 | #if defined(ENABLE_TXRX_PROT_ANALYZE) |
| 149 | |
| 150 | void ol_txrx_prot_ans_display(ol_txrx_pdev_handle pdev); |
| 151 | |
| 152 | #else |
| 153 | |
| 154 | #define ol_txrx_prot_ans_display(pdev) |
| 155 | |
| 156 | #endif /* ENABLE_TXRX_PROT_ANALYZE */ |
| 157 | |
| 158 | /*--- txrx sequence number trace debug feature ---*/ |
| 159 | |
| 160 | /* uncomment this to enable the rx reorder trace feature */ |
| 161 | /* #define ENABLE_RX_REORDER_TRACE 1 */ |
| 162 | |
| 163 | #define ol_txrx_seq_num_trace_display(pdev) \ |
| 164 | ol_rx_reorder_trace_display(pdev, 0, 0) |
| 165 | |
| 166 | #if defined(ENABLE_RX_REORDER_TRACE) |
| 167 | |
| 168 | void |
| 169 | ol_rx_reorder_trace_display(ol_txrx_pdev_handle pdev, int just_once, int limit); |
| 170 | |
| 171 | #else |
| 172 | |
| 173 | #define ol_rx_reorder_trace_display(pdev, just_once, limit) |
| 174 | |
| 175 | #endif /* ENABLE_RX_REORDER_TRACE */ |
| 176 | |
| 177 | /*--- txrx packet number trace debug feature ---*/ |
| 178 | |
| 179 | /* uncomment this to enable the rx PN trace feature */ |
| 180 | /* #define ENABLE_RX_PN_TRACE 1 */ |
| 181 | |
| 182 | #define ol_txrx_pn_trace_display(pdev) ol_rx_pn_trace_display(pdev, 0) |
| 183 | |
| 184 | #if defined(ENABLE_RX_PN_TRACE) |
| 185 | |
| 186 | void ol_rx_pn_trace_display(ol_txrx_pdev_handle pdev, int just_once); |
| 187 | |
| 188 | #else |
| 189 | |
| 190 | #define ol_rx_pn_trace_display(pdev, just_once) |
| 191 | |
| 192 | #endif /* ENABLE_RX_PN_TRACE */ |
| 193 | |
| 194 | /*--- tx queue log debug feature ---*/ |
| 195 | /* uncomment this to enable the tx queue log feature */ |
| 196 | /* #define ENABLE_TX_QUEUE_LOG 1 */ |
| 197 | |
| 198 | #define ol_tx_queue_log_display(pdev) |
| 199 | |
| 200 | #endif /* ATH_PERF_PWR_OFFLOAD */ |
| 201 | /*----------------------------------------*/ |
| 202 | |
| 203 | #endif /* _OL_TXRX_DBG__H_ */ |