Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 2012-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 htt_fw_stats.c |
| 30 | * @brief Provide functions to process FW status retrieved from FW. |
| 31 | */ |
| 32 | |
| 33 | #include <htc_api.h> /* HTC_PACKET */ |
| 34 | #include <htt.h> /* HTT_T2H_MSG_TYPE, etc. */ |
| 35 | #include <cdf_nbuf.h> /* cdf_nbuf_t */ |
| 36 | #include <cdf_memory.h> /* cdf_mem_set */ |
| 37 | #include <ol_fw_tx_dbg.h> /* ol_fw_tx_dbg_ppdu_base */ |
| 38 | |
| 39 | #include <ol_htt_rx_api.h> |
| 40 | #include <ol_txrx_htt_api.h> /* htt_tx_status */ |
| 41 | |
| 42 | #include <htt_internal.h> |
| 43 | |
| 44 | #include <wlan_defs.h> |
| 45 | |
| 46 | #define ROUND_UP_TO_4(val) (((val) + 3) & ~0x3) |
| 47 | |
| 48 | |
| 49 | static char *bw_str_arr[] = {"20MHz", "40MHz", "80MHz", "160MHz"}; |
| 50 | |
| 51 | /* |
| 52 | * Defined the macro tx_rate_stats_print_cmn() |
| 53 | * so that this could be used in both |
| 54 | * htt_t2h_stats_tx_rate_stats_print() & |
| 55 | * htt_t2h_stats_tx_rate_stats_print_v2(). |
| 56 | * Each of these functions take a different structure as argument, |
| 57 | * but with common fields in the structures--so using a macro |
| 58 | * to bypass the strong type-checking of a function seems a simple |
| 59 | * trick to use to avoid the code duplication. |
| 60 | */ |
| 61 | #define tx_rate_stats_print_cmn(_tx_rate_info, _concise) \ |
| 62 | { \ |
| 63 | int i; \ |
| 64 | \ |
| 65 | cdf_print("TX Rate Info:\n"); \ |
| 66 | \ |
| 67 | /* MCS */ \ |
| 68 | cdf_print("MCS counts (0..9): "); \ |
| 69 | cdf_print("%d, %d, %d, %d, %d, %d, %d, %d, %d, %d\n",\ |
| 70 | _tx_rate_info->mcs[0], \ |
| 71 | _tx_rate_info->mcs[1], \ |
| 72 | _tx_rate_info->mcs[2], \ |
| 73 | _tx_rate_info->mcs[3], \ |
| 74 | _tx_rate_info->mcs[4], \ |
| 75 | _tx_rate_info->mcs[5], \ |
| 76 | _tx_rate_info->mcs[6], \ |
| 77 | _tx_rate_info->mcs[7], \ |
| 78 | _tx_rate_info->mcs[8], \ |
| 79 | _tx_rate_info->mcs[9]); \ |
| 80 | \ |
| 81 | /* SGI */ \ |
| 82 | cdf_print("SGI counts (0..9): "); \ |
| 83 | cdf_print("%d, %d, %d, %d, %d, %d, %d, %d, %d, %d\n",\ |
| 84 | _tx_rate_info->sgi[0], \ |
| 85 | _tx_rate_info->sgi[1], \ |
| 86 | _tx_rate_info->sgi[2], \ |
| 87 | _tx_rate_info->sgi[3], \ |
| 88 | _tx_rate_info->sgi[4], \ |
| 89 | _tx_rate_info->sgi[5], \ |
| 90 | _tx_rate_info->sgi[6], \ |
| 91 | _tx_rate_info->sgi[7], \ |
| 92 | _tx_rate_info->sgi[8], \ |
| 93 | _tx_rate_info->sgi[9]); \ |
| 94 | \ |
| 95 | /* NSS */ \ |
| 96 | cdf_print("NSS counts: "); \ |
| 97 | cdf_print("1x1 %d, 2x2 %d, 3x3 %d\n", \ |
| 98 | _tx_rate_info->nss[0], \ |
| 99 | _tx_rate_info->nss[1], _tx_rate_info->nss[2]);\ |
| 100 | \ |
| 101 | /* BW */ \ |
| 102 | cdf_print("BW counts: "); \ |
| 103 | \ |
| 104 | for (i = 0; \ |
| 105 | i < sizeof(_tx_rate_info->bw) / sizeof(_tx_rate_info->bw[0]);\ |
| 106 | i++) { \ |
| 107 | cdf_print("%s %d ", bw_str_arr[i], _tx_rate_info->bw[i]);\ |
| 108 | } \ |
| 109 | cdf_print("\n"); \ |
| 110 | \ |
| 111 | /* Preamble */ \ |
| 112 | cdf_print("Preamble (O C H V) counts: "); \ |
| 113 | cdf_print("%d, %d, %d, %d\n", \ |
| 114 | _tx_rate_info->pream[0], \ |
| 115 | _tx_rate_info->pream[1], \ |
| 116 | _tx_rate_info->pream[2], \ |
| 117 | _tx_rate_info->pream[3]); \ |
| 118 | \ |
| 119 | /* STBC rate counts */ \ |
| 120 | cdf_print("STBC rate counts (0..9): "); \ |
| 121 | cdf_print("%d, %d, %d, %d, %d, %d, %d, %d, %d, %d\n",\ |
| 122 | _tx_rate_info->stbc[0], \ |
| 123 | _tx_rate_info->stbc[1], \ |
| 124 | _tx_rate_info->stbc[2], \ |
| 125 | _tx_rate_info->stbc[3], \ |
| 126 | _tx_rate_info->stbc[4], \ |
| 127 | _tx_rate_info->stbc[5], \ |
| 128 | _tx_rate_info->stbc[6], \ |
| 129 | _tx_rate_info->stbc[7], \ |
| 130 | _tx_rate_info->stbc[8], \ |
| 131 | _tx_rate_info->stbc[9]); \ |
| 132 | \ |
| 133 | /* LDPC and TxBF counts */ \ |
| 134 | cdf_print("LDPC Counts: "); \ |
| 135 | cdf_print("%d\n", _tx_rate_info->ldpc); \ |
| 136 | cdf_print("RTS Counts: "); \ |
| 137 | cdf_print("%d\n", _tx_rate_info->rts_cnt); \ |
| 138 | /* RSSI Values for last ack frames */ \ |
| 139 | cdf_print("Ack RSSI: %d\n", _tx_rate_info->ack_rssi);\ |
| 140 | } |
| 141 | |
| 142 | static void htt_t2h_stats_tx_rate_stats_print(wlan_dbg_tx_rate_info_t * |
| 143 | tx_rate_info, int concise) |
| 144 | { |
| 145 | tx_rate_stats_print_cmn(tx_rate_info, concise); |
| 146 | } |
| 147 | |
| 148 | static void htt_t2h_stats_tx_rate_stats_print_v2(wlan_dbg_tx_rate_info_v2_t * |
| 149 | tx_rate_info, int concise) |
| 150 | { |
| 151 | tx_rate_stats_print_cmn(tx_rate_info, concise); |
| 152 | } |
| 153 | |
| 154 | /* |
| 155 | * Defined the macro rx_rate_stats_print_cmn() |
| 156 | * so that this could be used in both |
| 157 | * htt_t2h_stats_rx_rate_stats_print() & |
| 158 | * htt_t2h_stats_rx_rate_stats_print_v2(). |
| 159 | * Each of these functions take a different structure as argument, |
| 160 | * but with common fields in the structures -- so using a macro |
| 161 | * to bypass the strong type-checking of a function seems a simple |
| 162 | * trick to use to avoid the code duplication. |
| 163 | */ |
| 164 | #define rx_rate_stats_print_cmn(_rx_phy_info, _concise) \ |
| 165 | { \ |
| 166 | int i; \ |
| 167 | \ |
| 168 | cdf_print("RX Rate Info:\n"); \ |
| 169 | \ |
| 170 | /* MCS */ \ |
| 171 | cdf_print("MCS counts (0..9): "); \ |
| 172 | cdf_print("%d, %d, %d, %d, %d, %d, %d, %d, %d, %d\n",\ |
| 173 | _rx_phy_info->mcs[0], \ |
| 174 | _rx_phy_info->mcs[1], \ |
| 175 | _rx_phy_info->mcs[2], \ |
| 176 | _rx_phy_info->mcs[3], \ |
| 177 | _rx_phy_info->mcs[4], \ |
| 178 | _rx_phy_info->mcs[5], \ |
| 179 | _rx_phy_info->mcs[6], \ |
| 180 | _rx_phy_info->mcs[7], \ |
| 181 | _rx_phy_info->mcs[8], \ |
| 182 | _rx_phy_info->mcs[9]); \ |
| 183 | \ |
| 184 | /* SGI */ \ |
| 185 | cdf_print("SGI counts (0..9): "); \ |
| 186 | cdf_print("%d, %d, %d, %d, %d, %d, %d, %d, %d, %d\n",\ |
| 187 | _rx_phy_info->sgi[0], \ |
| 188 | _rx_phy_info->sgi[1], \ |
| 189 | _rx_phy_info->sgi[2], \ |
| 190 | _rx_phy_info->sgi[3], \ |
| 191 | _rx_phy_info->sgi[4], \ |
| 192 | _rx_phy_info->sgi[5], \ |
| 193 | _rx_phy_info->sgi[6], \ |
| 194 | _rx_phy_info->sgi[7], \ |
| 195 | _rx_phy_info->sgi[8], \ |
| 196 | _rx_phy_info->sgi[9]); \ |
| 197 | \ |
| 198 | /* NSS */ \ |
| 199 | cdf_print("NSS counts: "); \ |
| 200 | /* nss[0] just holds the count of non-stbc frames that were sent at 1x1 \ |
| 201 | * rates and nsts holds the count of frames sent with stbc. \ |
| 202 | * It was decided to not include PPDUs sent w/ STBC in nss[0]\ |
| 203 | * since it would be easier to change the value that needs to be\ |
| 204 | * printed (from "stbc+non-stbc count to only non-stbc count")\ |
| 205 | * if needed in the future. Hence the addition in the host code\ |
| 206 | * at this line. */ \ |
| 207 | cdf_print("1x1 %d, 2x2 %d, 3x3 %d, 4x4 %d\n", \ |
| 208 | _rx_phy_info->nss[0] + _rx_phy_info->nsts, \ |
| 209 | _rx_phy_info->nss[1], \ |
| 210 | _rx_phy_info->nss[2], \ |
| 211 | _rx_phy_info->nss[3]); \ |
| 212 | \ |
| 213 | /* NSTS */ \ |
| 214 | cdf_print("NSTS count: "); \ |
| 215 | cdf_print("%d\n", _rx_phy_info->nsts); \ |
| 216 | \ |
| 217 | /* BW */ \ |
| 218 | cdf_print("BW counts: "); \ |
| 219 | for (i = 0; \ |
| 220 | i < sizeof(_rx_phy_info->bw) / sizeof(_rx_phy_info->bw[0]); \ |
| 221 | i++) { \ |
| 222 | cdf_print("%s %d ", bw_str_arr[i], _rx_phy_info->bw[i]);\ |
| 223 | } \ |
| 224 | cdf_print("\n"); \ |
| 225 | \ |
| 226 | /* Preamble */ \ |
| 227 | cdf_print("Preamble counts: "); \ |
| 228 | cdf_print("%d, %d, %d, %d, %d, %d\n", \ |
| 229 | _rx_phy_info->pream[0], \ |
| 230 | _rx_phy_info->pream[1], \ |
| 231 | _rx_phy_info->pream[2], \ |
| 232 | _rx_phy_info->pream[3], \ |
| 233 | _rx_phy_info->pream[4], \ |
| 234 | _rx_phy_info->pream[5]); \ |
| 235 | \ |
| 236 | /* STBC rate counts */ \ |
| 237 | cdf_print("STBC rate counts (0..9): "); \ |
| 238 | cdf_print("%d, %d, %d, %d, %d, %d, %d, %d, %d, %d\n",\ |
| 239 | _rx_phy_info->stbc[0], \ |
| 240 | _rx_phy_info->stbc[1], \ |
| 241 | _rx_phy_info->stbc[2], \ |
| 242 | _rx_phy_info->stbc[3], \ |
| 243 | _rx_phy_info->stbc[4], \ |
| 244 | _rx_phy_info->stbc[5], \ |
| 245 | _rx_phy_info->stbc[6], \ |
| 246 | _rx_phy_info->stbc[7], \ |
| 247 | _rx_phy_info->stbc[8], \ |
| 248 | _rx_phy_info->stbc[9]); \ |
| 249 | \ |
| 250 | /* LDPC and TxBF counts */ \ |
| 251 | cdf_print("LDPC TXBF Counts: "); \ |
| 252 | cdf_print("%d, %d\n", _rx_phy_info->ldpc, _rx_phy_info->txbf);\ |
| 253 | /* RSSI Values for last received frames */ \ |
| 254 | cdf_print("RSSI (data, mgmt): %d, %d\n", _rx_phy_info->data_rssi,\ |
| 255 | _rx_phy_info->mgmt_rssi); \ |
| 256 | \ |
| 257 | cdf_print("RSSI Chain 0 (0x%02x 0x%02x 0x%02x 0x%02x)\n",\ |
| 258 | ((_rx_phy_info->rssi_chain0 >> 24) & 0xff), \ |
| 259 | ((_rx_phy_info->rssi_chain0 >> 16) & 0xff), \ |
| 260 | ((_rx_phy_info->rssi_chain0 >> 8) & 0xff), \ |
| 261 | ((_rx_phy_info->rssi_chain0 >> 0) & 0xff)); \ |
| 262 | \ |
| 263 | cdf_print("RSSI Chain 1 (0x%02x 0x%02x 0x%02x 0x%02x)\n",\ |
| 264 | ((_rx_phy_info->rssi_chain1 >> 24) & 0xff), \ |
| 265 | ((_rx_phy_info->rssi_chain1 >> 16) & 0xff), \ |
| 266 | ((_rx_phy_info->rssi_chain1 >> 8) & 0xff), \ |
| 267 | ((_rx_phy_info->rssi_chain1 >> 0) & 0xff)); \ |
| 268 | \ |
| 269 | cdf_print("RSSI Chain 2 (0x%02x 0x%02x 0x%02x 0x%02x)\n",\ |
| 270 | ((_rx_phy_info->rssi_chain2 >> 24) & 0xff), \ |
| 271 | ((_rx_phy_info->rssi_chain2 >> 16) & 0xff), \ |
| 272 | ((_rx_phy_info->rssi_chain2 >> 8) & 0xff), \ |
| 273 | ((_rx_phy_info->rssi_chain2 >> 0) & 0xff)); \ |
| 274 | } |
| 275 | |
| 276 | static void htt_t2h_stats_rx_rate_stats_print(wlan_dbg_rx_rate_info_t * |
| 277 | rx_phy_info, int concise) |
| 278 | { |
| 279 | rx_rate_stats_print_cmn(rx_phy_info, concise); |
| 280 | } |
| 281 | |
| 282 | static void htt_t2h_stats_rx_rate_stats_print_v2(wlan_dbg_rx_rate_info_v2_t * |
| 283 | rx_phy_info, int concise) |
| 284 | { |
| 285 | rx_rate_stats_print_cmn(rx_phy_info, concise); |
| 286 | } |
| 287 | |
| 288 | static void |
| 289 | htt_t2h_stats_pdev_stats_print(struct wlan_dbg_stats *wlan_pdev_stats, |
| 290 | int concise) |
| 291 | { |
| 292 | struct wlan_dbg_tx_stats *tx = &wlan_pdev_stats->tx; |
| 293 | struct wlan_dbg_rx_stats *rx = &wlan_pdev_stats->rx; |
| 294 | |
| 295 | cdf_print("WAL Pdev stats:\n"); |
| 296 | cdf_print("\n### Tx ###\n"); |
| 297 | |
| 298 | /* Num HTT cookies queued to dispatch list */ |
| 299 | cdf_print("comp_queued :\t%d\n", tx->comp_queued); |
| 300 | /* Num HTT cookies dispatched */ |
| 301 | cdf_print("comp_delivered :\t%d\n", tx->comp_delivered); |
| 302 | /* Num MSDU queued to WAL */ |
| 303 | cdf_print("msdu_enqued :\t%d\n", tx->msdu_enqued); |
| 304 | /* Num MPDU queued to WAL */ |
| 305 | cdf_print("mpdu_enqued :\t%d\n", tx->mpdu_enqued); |
| 306 | /* Num MSDUs dropped by WMM limit */ |
| 307 | cdf_print("wmm_drop :\t%d\n", tx->wmm_drop); |
| 308 | /* Num Local frames queued */ |
| 309 | cdf_print("local_enqued :\t%d\n", tx->local_enqued); |
| 310 | /* Num Local frames done */ |
| 311 | cdf_print("local_freed :\t%d\n", tx->local_freed); |
| 312 | /* Num queued to HW */ |
| 313 | cdf_print("hw_queued :\t%d\n", tx->hw_queued); |
| 314 | /* Num PPDU reaped from HW */ |
| 315 | cdf_print("hw_reaped :\t%d\n", tx->hw_reaped); |
| 316 | /* Num underruns */ |
| 317 | cdf_print("mac underrun :\t%d\n", tx->underrun); |
| 318 | /* Num underruns */ |
| 319 | cdf_print("phy underrun :\t%d\n", tx->phy_underrun); |
| 320 | /* Num PPDUs cleaned up in TX abort */ |
| 321 | cdf_print("tx_abort :\t%d\n", tx->tx_abort); |
| 322 | /* Num MPDUs requed by SW */ |
| 323 | cdf_print("mpdus_requed :\t%d\n", tx->mpdus_requed); |
| 324 | /* Excessive retries */ |
| 325 | cdf_print("excess retries :\t%d\n", tx->tx_ko); |
| 326 | /* last data rate */ |
| 327 | cdf_print("last rc :\t%d\n", tx->data_rc); |
| 328 | /* scheduler self triggers */ |
| 329 | cdf_print("sched self trig :\t%d\n", tx->self_triggers); |
| 330 | /* SW retry failures */ |
| 331 | cdf_print("ampdu retry failed:\t%d\n", tx->sw_retry_failure); |
| 332 | /* ilegal phy rate errirs */ |
| 333 | cdf_print("illegal rate errs :\t%d\n", tx->illgl_rate_phy_err); |
| 334 | /* pdev continous excessive retries */ |
| 335 | cdf_print("pdev cont xretry :\t%d\n", tx->pdev_cont_xretry); |
| 336 | /* pdev continous excessive retries */ |
| 337 | cdf_print("pdev tx timeout :\t%d\n", tx->pdev_tx_timeout); |
| 338 | /* pdev resets */ |
| 339 | cdf_print("pdev resets :\t%d\n", tx->pdev_resets); |
| 340 | /* PPDU > txop duration */ |
| 341 | cdf_print("ppdu txop ovf :\t%d\n", tx->txop_ovf); |
| 342 | |
| 343 | cdf_print("\n### Rx ###\n"); |
| 344 | /* Cnts any change in ring routing mid-ppdu */ |
| 345 | cdf_print("ppdu_route_change :\t%d\n", rx->mid_ppdu_route_change); |
| 346 | /* Total number of statuses processed */ |
| 347 | cdf_print("status_rcvd :\t%d\n", rx->status_rcvd); |
| 348 | /* Extra frags on rings 0-3 */ |
| 349 | cdf_print("r0_frags :\t%d\n", rx->r0_frags); |
| 350 | cdf_print("r1_frags :\t%d\n", rx->r1_frags); |
| 351 | cdf_print("r2_frags :\t%d\n", rx->r2_frags); |
| 352 | cdf_print("r3_frags :\t%d\n", rx->r3_frags); |
| 353 | /* MSDUs / MPDUs delivered to HTT */ |
| 354 | cdf_print("htt_msdus :\t%d\n", rx->htt_msdus); |
| 355 | cdf_print("htt_mpdus :\t%d\n", rx->htt_mpdus); |
| 356 | /* MSDUs / MPDUs delivered to local stack */ |
| 357 | cdf_print("loc_msdus :\t%d\n", rx->loc_msdus); |
| 358 | cdf_print("loc_mpdus :\t%d\n", rx->loc_mpdus); |
| 359 | /* AMSDUs that have more MSDUs than the status ring size */ |
| 360 | cdf_print("oversize_amsdu :\t%d\n", rx->oversize_amsdu); |
| 361 | /* Number of PHY errors */ |
| 362 | cdf_print("phy_errs :\t%d\n", rx->phy_errs); |
| 363 | /* Number of PHY errors dropped */ |
| 364 | cdf_print("phy_errs dropped :\t%d\n", rx->phy_err_drop); |
| 365 | /* Number of mpdu errors - FCS, MIC, ENC etc. */ |
| 366 | cdf_print("mpdu_errs :\t%d\n", rx->mpdu_errs); |
| 367 | |
| 368 | } |
| 369 | |
| 370 | static void |
| 371 | htt_t2h_stats_rx_reorder_stats_print(struct rx_reorder_stats *stats_ptr, |
| 372 | int concise) |
| 373 | { |
| 374 | cdf_print("Rx reorder statistics:\n"); |
| 375 | cdf_print(" %u non-QoS frames received\n", stats_ptr->deliver_non_qos); |
| 376 | cdf_print(" %u frames received in-order\n", |
| 377 | stats_ptr->deliver_in_order); |
| 378 | cdf_print(" %u frames flushed due to timeout\n", |
| 379 | stats_ptr->deliver_flush_timeout); |
| 380 | cdf_print(" %u frames flushed due to moving out of window\n", |
| 381 | stats_ptr->deliver_flush_oow); |
| 382 | cdf_print(" %u frames flushed due to receiving DELBA\n", |
| 383 | stats_ptr->deliver_flush_delba); |
| 384 | cdf_print(" %u frames discarded due to FCS error\n", |
| 385 | stats_ptr->fcs_error); |
| 386 | cdf_print(" %u frames discarded due to invalid peer\n", |
| 387 | stats_ptr->invalid_peer); |
| 388 | cdf_print |
| 389 | (" %u frames discarded due to duplication (non aggregation)\n", |
| 390 | stats_ptr->dup_non_aggr); |
| 391 | cdf_print(" %u frames discarded due to duplication in reorder queue\n", |
| 392 | stats_ptr->dup_in_reorder); |
| 393 | cdf_print(" %u frames discarded due to processed before\n", |
| 394 | stats_ptr->dup_past); |
| 395 | cdf_print(" %u times reorder timeout happened\n", |
| 396 | stats_ptr->reorder_timeout); |
| 397 | cdf_print(" %u times incorrect bar received\n", |
| 398 | stats_ptr->invalid_bar_ssn); |
| 399 | cdf_print(" %u times bar ssn reset happened\n", |
| 400 | stats_ptr->ssn_reset); |
| 401 | cdf_print(" %u times flushed due to peer delete\n", |
| 402 | stats_ptr->deliver_flush_delpeer); |
| 403 | cdf_print(" %u times flushed due to offload\n", |
| 404 | stats_ptr->deliver_flush_offload); |
| 405 | cdf_print(" %u times flushed due to ouf of buffer\n", |
| 406 | stats_ptr->deliver_flush_oob); |
| 407 | cdf_print(" %u MPDU's dropped due to PN check fail\n", |
| 408 | stats_ptr->pn_fail); |
| 409 | cdf_print(" %u MPDU's dropped due to lack of memory\n", |
| 410 | stats_ptr->store_fail); |
| 411 | cdf_print(" %u times tid pool alloc succeeded\n", |
| 412 | stats_ptr->tid_pool_alloc_succ); |
| 413 | cdf_print(" %u times MPDU pool alloc succeeded\n", |
| 414 | stats_ptr->mpdu_pool_alloc_succ); |
| 415 | cdf_print(" %u times MSDU pool alloc succeeded\n", |
| 416 | stats_ptr->msdu_pool_alloc_succ); |
| 417 | cdf_print(" %u times tid pool alloc failed\n", |
| 418 | stats_ptr->tid_pool_alloc_fail); |
| 419 | cdf_print(" %u times MPDU pool alloc failed\n", |
| 420 | stats_ptr->mpdu_pool_alloc_fail); |
| 421 | cdf_print(" %u times MSDU pool alloc failed\n", |
| 422 | stats_ptr->msdu_pool_alloc_fail); |
| 423 | cdf_print(" %u times tid pool freed\n", |
| 424 | stats_ptr->tid_pool_free); |
| 425 | cdf_print(" %u times MPDU pool freed\n", |
| 426 | stats_ptr->mpdu_pool_free); |
| 427 | cdf_print(" %u times MSDU pool freed\n", |
| 428 | stats_ptr->msdu_pool_free); |
| 429 | cdf_print(" %u MSDUs undelivered to HTT, queued to Rx MSDU free list\n", |
| 430 | stats_ptr->msdu_queued); |
| 431 | cdf_print(" %u MSDUs released from Rx MSDU list to MAC ring\n", |
| 432 | stats_ptr->msdu_recycled); |
| 433 | cdf_print(" %u MPDUs with invalid peer but A2 found in AST\n", |
| 434 | stats_ptr->invalid_peer_a2_in_ast); |
| 435 | cdf_print(" %u MPDUs with invalid peer but A3 found in AST\n", |
| 436 | stats_ptr->invalid_peer_a3_in_ast); |
| 437 | cdf_print(" %u MPDUs with invalid peer, Broadcast or Mulitcast frame\n", |
| 438 | stats_ptr->invalid_peer_bmc_mpdus); |
| 439 | cdf_print(" %u MSDUs with err attention word\n", |
| 440 | stats_ptr->rxdesc_err_att); |
| 441 | cdf_print(" %u MSDUs with flag of peer_idx_invalid\n", |
| 442 | stats_ptr->rxdesc_err_peer_idx_inv); |
| 443 | cdf_print(" %u MSDUs with flag of peer_idx_timeout\n", |
| 444 | stats_ptr->rxdesc_err_peer_idx_to); |
| 445 | cdf_print(" %u MSDUs with flag of overflow\n", |
| 446 | stats_ptr->rxdesc_err_ov); |
| 447 | cdf_print(" %u MSDUs with flag of msdu_length_err\n", |
| 448 | stats_ptr->rxdesc_err_msdu_len); |
| 449 | cdf_print(" %u MSDUs with flag of mpdu_length_err\n", |
| 450 | stats_ptr->rxdesc_err_mpdu_len); |
| 451 | cdf_print(" %u MSDUs with flag of tkip_mic_err\n", |
| 452 | stats_ptr->rxdesc_err_tkip_mic); |
| 453 | cdf_print(" %u MSDUs with flag of decrypt_err\n", |
| 454 | stats_ptr->rxdesc_err_decrypt); |
| 455 | cdf_print(" %u MSDUs with flag of fcs_err\n", |
| 456 | stats_ptr->rxdesc_err_fcs); |
| 457 | cdf_print(" %u Unicast frames with invalid peer handler\n", |
| 458 | stats_ptr->rxdesc_uc_msdus_inv_peer); |
| 459 | cdf_print(" %u unicast frame directly to DUT with invalid peer handler\n", |
| 460 | stats_ptr->rxdesc_direct_msdus_inv_peer); |
| 461 | cdf_print(" %u Broadcast/Multicast frames with invalid peer handler\n", |
| 462 | stats_ptr->rxdesc_bmc_msdus_inv_peer); |
| 463 | cdf_print(" %u MSDUs dropped due to no first MSDU flag\n", |
| 464 | stats_ptr->rxdesc_no_1st_msdu); |
| 465 | cdf_print(" %u MSDUs dropped due to ring overflow\n", |
| 466 | stats_ptr->msdu_drop_ring_ov); |
| 467 | cdf_print(" %u MSDUs dropped due to FC mismatch\n", |
| 468 | stats_ptr->msdu_drop_fc_mismatch); |
| 469 | cdf_print(" %u MSDUs dropped due to mgt frame in Remote ring\n", |
| 470 | stats_ptr->msdu_drop_mgmt_remote_ring); |
| 471 | cdf_print(" %u MSDUs dropped due to misc non error\n", |
| 472 | stats_ptr->msdu_drop_misc); |
| 473 | cdf_print(" %u MSDUs go to offload before reorder\n", |
| 474 | stats_ptr->offload_msdu_wal); |
| 475 | cdf_print(" %u data frame dropped by offload after reorder\n", |
| 476 | stats_ptr->offload_msdu_reorder); |
| 477 | cdf_print(" %u MPDUs with SN in the past & within BA window\n", |
| 478 | stats_ptr->dup_past_within_window); |
| 479 | cdf_print(" %u MPDUs with SN in the past & outside BA window\n", |
| 480 | stats_ptr->dup_past_outside_window); |
| 481 | } |
| 482 | |
| 483 | static void |
| 484 | htt_t2h_stats_rx_rem_buf_stats_print( |
| 485 | struct rx_remote_buffer_mgmt_stats *stats_ptr, int concise) |
| 486 | { |
| 487 | cdf_print("Rx Remote Buffer Statistics:\n"); |
| 488 | cdf_print(" %u MSDU's reaped for Rx processing\n", |
| 489 | stats_ptr->remote_reaped); |
| 490 | cdf_print(" %u MSDU's recycled within firmware\n", |
| 491 | stats_ptr->remote_recycled); |
| 492 | cdf_print(" %u MSDU's stored by Data Rx\n", |
| 493 | stats_ptr->data_rx_msdus_stored); |
| 494 | cdf_print(" %u HTT indications from WAL Rx MSDU\n", |
| 495 | stats_ptr->wal_rx_ind); |
| 496 | cdf_print(" %u HTT indications unconsumed from WAL Rx MSDU\n", |
| 497 | stats_ptr->wal_rx_ind_unconsumed); |
| 498 | cdf_print(" %u HTT indications from Data Rx MSDU\n", |
| 499 | stats_ptr->data_rx_ind); |
| 500 | cdf_print(" %u HTT indications unconsumed from Data Rx MSDU\n", |
| 501 | stats_ptr->data_rx_ind_unconsumed); |
| 502 | cdf_print(" %u HTT indications from ATHBUF\n", |
| 503 | stats_ptr->athbuf_rx_ind); |
| 504 | cdf_print(" %u Remote buffers requested for refill\n", |
| 505 | stats_ptr->refill_buf_req); |
| 506 | cdf_print(" %u Remote buffers filled by host\n", |
| 507 | stats_ptr->refill_buf_rsp); |
| 508 | cdf_print(" %u times MAC has no buffers\n", |
| 509 | stats_ptr->mac_no_bufs); |
| 510 | cdf_print(" %u times f/w write & read indices on MAC ring are equal\n", |
| 511 | stats_ptr->fw_indices_equal); |
| 512 | cdf_print(" %u times f/w has no remote buffers to post to MAC\n", |
| 513 | stats_ptr->host_no_bufs); |
| 514 | } |
| 515 | |
| 516 | static void |
| 517 | htt_t2h_stats_txbf_info_buf_stats_print( |
| 518 | struct wlan_dbg_txbf_data_stats *stats_ptr) |
| 519 | { |
| 520 | cdf_print("TXBF data Statistics:\n"); |
| 521 | cdf_print("tx_txbf_vht (0..9): "); |
| 522 | cdf_print("%u, %u, %u, %u, %u, %u, %u, %u, %u, %d\n", |
| 523 | stats_ptr->tx_txbf_vht[0], |
| 524 | stats_ptr->tx_txbf_vht[1], |
| 525 | stats_ptr->tx_txbf_vht[2], |
| 526 | stats_ptr->tx_txbf_vht[3], |
| 527 | stats_ptr->tx_txbf_vht[4], |
| 528 | stats_ptr->tx_txbf_vht[5], |
| 529 | stats_ptr->tx_txbf_vht[6], |
| 530 | stats_ptr->tx_txbf_vht[7], |
| 531 | stats_ptr->tx_txbf_vht[8], |
| 532 | stats_ptr->tx_txbf_vht[9]); |
| 533 | cdf_print("rx_txbf_vht (0..9): "); |
| 534 | cdf_print("%u, %u, %u, %u, %u, %u, %u, %u, %u, %u\n", |
| 535 | stats_ptr->rx_txbf_vht[0], |
| 536 | stats_ptr->rx_txbf_vht[1], |
| 537 | stats_ptr->rx_txbf_vht[2], |
| 538 | stats_ptr->rx_txbf_vht[3], |
| 539 | stats_ptr->rx_txbf_vht[4], |
| 540 | stats_ptr->rx_txbf_vht[5], |
| 541 | stats_ptr->rx_txbf_vht[6], |
| 542 | stats_ptr->rx_txbf_vht[7], |
| 543 | stats_ptr->rx_txbf_vht[8], |
| 544 | stats_ptr->rx_txbf_vht[9]); |
| 545 | cdf_print("tx_txbf_ht (0..7): "); |
| 546 | cdf_print("%u, %u, %u, %u, %u, %u, %u, %u\n", |
| 547 | stats_ptr->tx_txbf_ht[0], |
| 548 | stats_ptr->tx_txbf_ht[1], |
| 549 | stats_ptr->tx_txbf_ht[2], |
| 550 | stats_ptr->tx_txbf_ht[3], |
| 551 | stats_ptr->tx_txbf_ht[4], |
| 552 | stats_ptr->tx_txbf_ht[5], |
| 553 | stats_ptr->tx_txbf_ht[6], |
| 554 | stats_ptr->tx_txbf_ht[7]); |
| 555 | cdf_print("tx_txbf_ofdm (0..7): "); |
| 556 | cdf_print("%u, %u, %u, %u, %u, %u, %u, %u\n", |
| 557 | stats_ptr->tx_txbf_ofdm[0], |
| 558 | stats_ptr->tx_txbf_ofdm[1], |
| 559 | stats_ptr->tx_txbf_ofdm[2], |
| 560 | stats_ptr->tx_txbf_ofdm[3], |
| 561 | stats_ptr->tx_txbf_ofdm[4], |
| 562 | stats_ptr->tx_txbf_ofdm[5], |
| 563 | stats_ptr->tx_txbf_ofdm[6], |
| 564 | stats_ptr->tx_txbf_ofdm[7]); |
| 565 | cdf_print("tx_txbf_cck (0..6): "); |
| 566 | cdf_print("%u, %u, %u, %u, %u, %u, %u\n", |
| 567 | stats_ptr->tx_txbf_cck[0], |
| 568 | stats_ptr->tx_txbf_cck[1], |
| 569 | stats_ptr->tx_txbf_cck[2], |
| 570 | stats_ptr->tx_txbf_cck[3], |
| 571 | stats_ptr->tx_txbf_cck[4], |
| 572 | stats_ptr->tx_txbf_cck[5], |
| 573 | stats_ptr->tx_txbf_cck[6]); |
| 574 | } |
| 575 | |
| 576 | static void |
| 577 | htt_t2h_stats_txbf_snd_buf_stats_print( |
| 578 | struct wlan_dbg_txbf_snd_stats *stats_ptr) |
| 579 | { |
| 580 | cdf_print("TXBF snd Buffer Statistics:\n"); |
| 581 | cdf_print("cbf_20: "); |
| 582 | cdf_print("%u, %u, %u, %u\n", |
| 583 | stats_ptr->cbf_20[0], |
| 584 | stats_ptr->cbf_20[1], |
| 585 | stats_ptr->cbf_20[2], |
| 586 | stats_ptr->cbf_20[3]); |
| 587 | cdf_print("cbf_40: "); |
| 588 | cdf_print("%u, %u, %u, %u\n", |
| 589 | stats_ptr->cbf_40[0], |
| 590 | stats_ptr->cbf_40[1], |
| 591 | stats_ptr->cbf_40[2], |
| 592 | stats_ptr->cbf_40[3]); |
| 593 | cdf_print("cbf_80: "); |
| 594 | cdf_print("%u, %u, %u, %u\n", |
| 595 | stats_ptr->cbf_80[0], |
| 596 | stats_ptr->cbf_80[1], |
| 597 | stats_ptr->cbf_80[2], |
| 598 | stats_ptr->cbf_80[3]); |
| 599 | cdf_print("sounding: "); |
| 600 | cdf_print("%u, %u, %u, %u, %u, %u, %u, %u, %u\n", |
| 601 | stats_ptr->sounding[0], |
| 602 | stats_ptr->sounding[1], |
| 603 | stats_ptr->sounding[2], |
| 604 | stats_ptr->sounding[3], |
| 605 | stats_ptr->sounding[4], |
| 606 | stats_ptr->sounding[5], |
| 607 | stats_ptr->sounding[6], |
| 608 | stats_ptr->sounding[7], |
| 609 | stats_ptr->sounding[8]); |
| 610 | } |
| 611 | |
| 612 | static void |
| 613 | htt_t2h_stats_tx_selfgen_buf_stats_print( |
| 614 | struct wlan_dbg_tx_selfgen_stats *stats_ptr) |
| 615 | { |
| 616 | cdf_print("Tx selfgen Buffer Statistics:\n"); |
| 617 | cdf_print(" %u su_ndpa\n", |
| 618 | stats_ptr->su_ndpa); |
| 619 | cdf_print(" %u mu_ndp\n", |
| 620 | stats_ptr->mu_ndp); |
| 621 | cdf_print(" %u mu_ndpa\n", |
| 622 | stats_ptr->mu_ndpa); |
| 623 | cdf_print(" %u mu_ndp\n", |
| 624 | stats_ptr->mu_ndp); |
| 625 | cdf_print(" %u mu_brpoll_1\n", |
| 626 | stats_ptr->mu_brpoll_1); |
| 627 | cdf_print(" %u mu_brpoll_2\n", |
| 628 | stats_ptr->mu_brpoll_2); |
| 629 | cdf_print(" %u mu_bar_1\n", |
| 630 | stats_ptr->mu_bar_1); |
| 631 | cdf_print(" %u mu_bar_2\n", |
| 632 | stats_ptr->mu_bar_2); |
| 633 | cdf_print(" %u cts_burst\n", |
| 634 | stats_ptr->cts_burst); |
| 635 | cdf_print(" %u su_ndp_err\n", |
| 636 | stats_ptr->su_ndp_err); |
| 637 | cdf_print(" %u su_ndpa_err\n", |
| 638 | stats_ptr->su_ndpa_err); |
| 639 | cdf_print(" %u mu_ndp_err\n", |
| 640 | stats_ptr->mu_ndp_err); |
| 641 | cdf_print(" %u mu_brp1_err\n", |
| 642 | stats_ptr->mu_brp1_err); |
| 643 | cdf_print(" %u mu_brp2_err\n", |
| 644 | stats_ptr->mu_brp2_err); |
| 645 | } |
| 646 | |
| 647 | static void |
| 648 | htt_t2h_stats_wifi2_error_stats_print( |
| 649 | struct wlan_dbg_wifi2_error_stats *stats_ptr) |
| 650 | { |
| 651 | int i; |
| 652 | |
| 653 | cdf_print("Scheduler error Statistics:\n"); |
| 654 | cdf_print("urrn_stats: "); |
| 655 | cdf_print("%d, %d, %d\n", |
| 656 | stats_ptr->urrn_stats[0], |
| 657 | stats_ptr->urrn_stats[1], |
| 658 | stats_ptr->urrn_stats[2]); |
| 659 | cdf_print("flush_errs (0..%d): ", |
| 660 | WHAL_DBG_FLUSH_REASON_MAXCNT); |
| 661 | for (i = 0; i < WHAL_DBG_FLUSH_REASON_MAXCNT; i++) |
| 662 | cdf_print(" %u", stats_ptr->flush_errs[i]); |
| 663 | cdf_print("\n"); |
| 664 | cdf_print("schd_stall_errs (0..3): "); |
| 665 | cdf_print("%d, %d, %d, %d\n", |
| 666 | stats_ptr->schd_stall_errs[0], |
| 667 | stats_ptr->schd_stall_errs[1], |
| 668 | stats_ptr->schd_stall_errs[2], |
| 669 | stats_ptr->schd_stall_errs[3]); |
| 670 | cdf_print("schd_cmd_result (0..%d): ", |
| 671 | WHAL_DBG_CMD_RESULT_MAXCNT); |
| 672 | for (i = 0; i < WHAL_DBG_CMD_RESULT_MAXCNT; i++) |
| 673 | cdf_print(" %u", stats_ptr->schd_cmd_result[i]); |
| 674 | cdf_print("\n"); |
| 675 | cdf_print("sifs_status (0..%d): ", |
| 676 | WHAL_DBG_SIFS_STATUS_MAXCNT); |
| 677 | for (i = 0; i < WHAL_DBG_SIFS_STATUS_MAXCNT; i++) |
| 678 | cdf_print(" %u", stats_ptr->sifs_status[i]); |
| 679 | cdf_print("\n"); |
| 680 | cdf_print("phy_errs (0..%d): ", |
| 681 | WHAL_DBG_PHY_ERR_MAXCNT); |
| 682 | for (i = 0; i < WHAL_DBG_PHY_ERR_MAXCNT; i++) |
| 683 | cdf_print(" %u", stats_ptr->phy_errs[i]); |
| 684 | cdf_print("\n"); |
| 685 | cdf_print(" %u rx_rate_inval\n", |
| 686 | stats_ptr->rx_rate_inval); |
| 687 | } |
| 688 | |
| 689 | static void |
| 690 | htt_t2h_rx_musu_ndpa_pkts_stats_print( |
| 691 | struct rx_txbf_musu_ndpa_pkts_stats *stats_ptr) |
| 692 | { |
| 693 | cdf_print("Rx TXBF MU/SU Packets and NDPA Statistics:\n"); |
| 694 | cdf_print(" %u Number of TXBF MU packets received\n", |
| 695 | stats_ptr->number_mu_pkts); |
| 696 | cdf_print(" %u Number of TXBF SU packets received\n", |
| 697 | stats_ptr->number_su_pkts); |
| 698 | cdf_print(" %u Number of TXBF directed NDPA\n", |
| 699 | stats_ptr->txbf_directed_ndpa_count); |
| 700 | cdf_print(" %u Number of TXBF retried NDPA\n", |
| 701 | stats_ptr->txbf_ndpa_retry_count); |
| 702 | cdf_print(" %u Total number of TXBF NDPA\n", |
| 703 | stats_ptr->txbf_total_ndpa_count); |
| 704 | } |
| 705 | |
| 706 | #define HTT_TICK_TO_USEC(ticks, microsec_per_tick) (ticks * microsec_per_tick) |
| 707 | static inline int htt_rate_flags_to_mhz(uint8_t rate_flags) |
| 708 | { |
| 709 | if (rate_flags & 0x20) |
| 710 | return 40; /* WHAL_RC_FLAG_40MHZ */ |
| 711 | if (rate_flags & 0x40) |
| 712 | return 80; /* WHAL_RC_FLAG_80MHZ */ |
| 713 | if (rate_flags & 0x80) |
| 714 | return 160; /* WHAL_RC_FLAG_160MHZ */ |
| 715 | return 20; |
| 716 | } |
| 717 | |
| 718 | #define HTT_FW_STATS_MAX_BLOCK_ACK_WINDOW 64 |
| 719 | |
| 720 | static void |
| 721 | htt_t2h_tx_ppdu_bitmaps_pr(uint32_t *queued_ptr, uint32_t *acked_ptr) |
| 722 | { |
| 723 | char queued_str[HTT_FW_STATS_MAX_BLOCK_ACK_WINDOW + 1]; |
| 724 | char acked_str[HTT_FW_STATS_MAX_BLOCK_ACK_WINDOW + 1]; |
| 725 | int i, j, word; |
| 726 | |
| 727 | cdf_mem_set(queued_str, HTT_FW_STATS_MAX_BLOCK_ACK_WINDOW, '0'); |
| 728 | cdf_mem_set(acked_str, HTT_FW_STATS_MAX_BLOCK_ACK_WINDOW, '-'); |
| 729 | i = 0; |
| 730 | for (word = 0; word < 2; word++) { |
| 731 | uint32_t queued = *(queued_ptr + word); |
| 732 | uint32_t acked = *(acked_ptr + word); |
| 733 | for (j = 0; j < 32; j++, i++) { |
| 734 | if (queued & (1 << j)) { |
| 735 | queued_str[i] = '1'; |
| 736 | acked_str[i] = (acked & (1 << j)) ? 'y' : 'N'; |
| 737 | } |
| 738 | } |
| 739 | } |
| 740 | queued_str[HTT_FW_STATS_MAX_BLOCK_ACK_WINDOW] = '\0'; |
| 741 | acked_str[HTT_FW_STATS_MAX_BLOCK_ACK_WINDOW] = '\0'; |
| 742 | cdf_print("%s\n", queued_str); |
| 743 | cdf_print("%s\n", acked_str); |
| 744 | } |
| 745 | |
| 746 | static inline uint16_t htt_msg_read16(uint16_t *p16) |
| 747 | { |
| 748 | #ifdef BIG_ENDIAN_HOST |
| 749 | /* |
| 750 | * During upload, the bytes within each uint32_t word were |
| 751 | * swapped by the HIF HW. This results in the lower and upper bytes |
| 752 | * of each uint16_t to be in the correct big-endian order with |
| 753 | * respect to each other, but for each even-index uint16_t to |
| 754 | * have its position switched with its successor neighbor uint16_t. |
| 755 | * Undo this uint16_t position swapping. |
| 756 | */ |
| 757 | return (((size_t) p16) & 0x2) ? *(p16 - 1) : *(p16 + 1); |
| 758 | #else |
| 759 | return *p16; |
| 760 | #endif |
| 761 | } |
| 762 | |
| 763 | static inline uint8_t htt_msg_read8(uint8_t *p8) |
| 764 | { |
| 765 | #ifdef BIG_ENDIAN_HOST |
| 766 | /* |
| 767 | * During upload, the bytes within each uint32_t word were |
| 768 | * swapped by the HIF HW. |
| 769 | * Undo this byte swapping. |
| 770 | */ |
| 771 | switch (((size_t) p8) & 0x3) { |
| 772 | case 0: |
| 773 | return *(p8 + 3); |
| 774 | case 1: |
| 775 | return *(p8 + 1); |
| 776 | case 2: |
| 777 | return *(p8 - 1); |
| 778 | default /* 3 */: |
| 779 | return *(p8 - 3); |
| 780 | } |
| 781 | #else |
| 782 | return *p8; |
| 783 | #endif |
| 784 | } |
| 785 | |
| 786 | void htt_make_u8_list_str(uint32_t *aligned_data, |
| 787 | char *buffer, int space, int max_elems) |
| 788 | { |
| 789 | uint8_t *p8 = (uint8_t *) aligned_data; |
| 790 | char *buf_p = buffer; |
| 791 | while (max_elems-- > 0) { |
| 792 | int bytes; |
| 793 | uint8_t val; |
| 794 | |
| 795 | val = htt_msg_read8(p8); |
| 796 | if (val == 0) |
| 797 | /* not enough data to fill the reserved msg buffer*/ |
| 798 | break; |
| 799 | |
| 800 | bytes = cdf_snprint(buf_p, space, "%d,", val); |
| 801 | space -= bytes; |
| 802 | if (space > 0) |
| 803 | buf_p += bytes; |
| 804 | else /* not enough print buffer space for all the data */ |
| 805 | break; |
| 806 | p8++; |
| 807 | } |
| 808 | if (buf_p == buffer) |
| 809 | *buf_p = '\0'; /* nothing was written */ |
| 810 | else |
| 811 | *(buf_p - 1) = '\0'; /* erase the final comma */ |
| 812 | |
| 813 | } |
| 814 | |
| 815 | void htt_make_u16_list_str(uint32_t *aligned_data, |
| 816 | char *buffer, int space, int max_elems) |
| 817 | { |
| 818 | uint16_t *p16 = (uint16_t *) aligned_data; |
| 819 | char *buf_p = buffer; |
| 820 | while (max_elems-- > 0) { |
| 821 | int bytes; |
| 822 | uint16_t val; |
| 823 | |
| 824 | val = htt_msg_read16(p16); |
| 825 | if (val == 0) |
| 826 | /* not enough data to fill the reserved msg buffer */ |
| 827 | break; |
| 828 | bytes = cdf_snprint(buf_p, space, "%d,", val); |
| 829 | space -= bytes; |
| 830 | if (space > 0) |
| 831 | buf_p += bytes; |
| 832 | else /* not enough print buffer space for all the data */ |
| 833 | break; |
| 834 | |
| 835 | p16++; |
| 836 | } |
| 837 | if (buf_p == buffer) |
| 838 | *buf_p = '\0'; /* nothing was written */ |
| 839 | else |
| 840 | *(buf_p - 1) = '\0'; /* erase the final comma */ |
| 841 | } |
| 842 | |
| 843 | void |
| 844 | htt_t2h_tx_ppdu_log_print(struct ol_fw_tx_dbg_ppdu_msg_hdr *hdr, |
| 845 | struct ol_fw_tx_dbg_ppdu_base *record, |
| 846 | int length, int concise) |
| 847 | { |
| 848 | int i; |
| 849 | int record_size; |
| 850 | int num_records; |
| 851 | |
| 852 | record_size = |
| 853 | sizeof(*record) + |
| 854 | hdr->mpdu_bytes_array_len * sizeof(uint16_t) + |
| 855 | hdr->mpdu_msdus_array_len * sizeof(uint8_t) + |
| 856 | hdr->msdu_bytes_array_len * sizeof(uint16_t); |
| 857 | num_records = (length - sizeof(*hdr)) / record_size; |
| 858 | cdf_print("Tx PPDU log elements:\n"); |
| 859 | |
| 860 | for (i = 0; i < num_records; i++) { |
| 861 | uint16_t start_seq_num; |
| 862 | uint16_t start_pn_lsbs; |
| 863 | uint8_t num_mpdus; |
| 864 | uint16_t peer_id; |
| 865 | uint8_t ext_tid; |
| 866 | uint8_t rate_code; |
| 867 | uint8_t rate_flags; |
| 868 | uint8_t tries; |
| 869 | uint8_t complete; |
| 870 | uint32_t time_enqueue_us; |
| 871 | uint32_t time_completion_us; |
| 872 | uint32_t *msg_word = (uint32_t *) record; |
| 873 | |
| 874 | /* fields used for both concise and complete printouts */ |
| 875 | start_seq_num = |
| 876 | ((*(msg_word + OL_FW_TX_DBG_PPDU_START_SEQ_NUM_16)) & |
| 877 | OL_FW_TX_DBG_PPDU_START_SEQ_NUM_M) >> |
| 878 | OL_FW_TX_DBG_PPDU_START_SEQ_NUM_S; |
| 879 | complete = |
| 880 | ((*(msg_word + OL_FW_TX_DBG_PPDU_COMPLETE_16)) & |
| 881 | OL_FW_TX_DBG_PPDU_COMPLETE_M) >> |
| 882 | OL_FW_TX_DBG_PPDU_COMPLETE_S; |
| 883 | |
| 884 | /* fields used only for complete printouts */ |
| 885 | if (!concise) { |
| 886 | #define BUF_SIZE 80 |
| 887 | char buf[BUF_SIZE]; |
| 888 | uint8_t *p8; |
| 889 | time_enqueue_us = |
| 890 | HTT_TICK_TO_USEC(record->timestamp_enqueue, |
| 891 | hdr->microsec_per_tick); |
| 892 | time_completion_us = |
| 893 | HTT_TICK_TO_USEC(record->timestamp_completion, |
| 894 | hdr->microsec_per_tick); |
| 895 | |
| 896 | start_pn_lsbs = |
| 897 | ((* |
| 898 | (msg_word + |
| 899 | OL_FW_TX_DBG_PPDU_START_PN_LSBS_16)) & |
| 900 | OL_FW_TX_DBG_PPDU_START_PN_LSBS_M) >> |
| 901 | OL_FW_TX_DBG_PPDU_START_PN_LSBS_S; |
| 902 | num_mpdus = |
| 903 | ((*(msg_word + OL_FW_TX_DBG_PPDU_NUM_MPDUS_16))& |
| 904 | OL_FW_TX_DBG_PPDU_NUM_MPDUS_M) >> |
| 905 | OL_FW_TX_DBG_PPDU_NUM_MPDUS_S; |
| 906 | peer_id = |
| 907 | ((*(msg_word + OL_FW_TX_DBG_PPDU_PEER_ID_16)) & |
| 908 | OL_FW_TX_DBG_PPDU_PEER_ID_M) >> |
| 909 | OL_FW_TX_DBG_PPDU_PEER_ID_S; |
| 910 | ext_tid = |
| 911 | ((*(msg_word + OL_FW_TX_DBG_PPDU_EXT_TID_16)) & |
| 912 | OL_FW_TX_DBG_PPDU_EXT_TID_M) >> |
| 913 | OL_FW_TX_DBG_PPDU_EXT_TID_S; |
| 914 | rate_code = |
| 915 | ((*(msg_word + OL_FW_TX_DBG_PPDU_RATE_CODE_16))& |
| 916 | OL_FW_TX_DBG_PPDU_RATE_CODE_M) >> |
| 917 | OL_FW_TX_DBG_PPDU_RATE_CODE_S; |
| 918 | rate_flags = |
| 919 | ((*(msg_word + OL_FW_TX_DBG_PPDU_RATEFLAGS_16))& |
| 920 | OL_FW_TX_DBG_PPDU_RATE_FLAGS_M) >> |
| 921 | OL_FW_TX_DBG_PPDU_RATE_FLAGS_S; |
| 922 | tries = |
| 923 | ((*(msg_word + OL_FW_TX_DBG_PPDU_TRIES_16)) & |
| 924 | OL_FW_TX_DBG_PPDU_TRIES_M) >> |
| 925 | OL_FW_TX_DBG_PPDU_TRIES_S; |
| 926 | |
| 927 | cdf_print(" - PPDU tx to peer %d, TID %d\n", peer_id, |
| 928 | ext_tid); |
| 929 | cdf_print |
| 930 | (" start seq num= %u, start PN LSBs= %#04x\n", |
| 931 | start_seq_num, start_pn_lsbs); |
| 932 | cdf_print |
| 933 | (" PPDU: %d MPDUs, (?) MSDUs, %d bytes\n", |
| 934 | num_mpdus, |
| 935 | /* num_msdus - not yet computed in target */ |
| 936 | record->num_bytes); |
| 937 | if (complete) { |
| 938 | cdf_print |
| 939 | (" enqueued: %u, completed: %u usec)\n", |
| 940 | time_enqueue_us, time_completion_us); |
| 941 | cdf_print |
| 942 | (" %d tries, last tx used rate %d ", |
| 943 | tries, rate_code); |
| 944 | cdf_print("on %d MHz chan (flags = %#x)\n", |
| 945 | htt_rate_flags_to_mhz |
| 946 | (rate_flags), rate_flags); |
| 947 | cdf_print |
| 948 | (" enqueued and acked MPDU bitmaps:\n"); |
| 949 | htt_t2h_tx_ppdu_bitmaps_pr(msg_word + |
| 950 | OL_FW_TX_DBG_PPDU_ENQUEUED_LSBS_16, |
| 951 | msg_word + |
| 952 | OL_FW_TX_DBG_PPDU_BLOCK_ACK_LSBS_16); |
| 953 | } else { |
| 954 | cdf_print |
| 955 | (" enqueued: %d us, not yet completed\n", |
| 956 | time_enqueue_us); |
| 957 | } |
| 958 | /* skip the regular msg fields to reach the tail area */ |
| 959 | p8 = (uint8_t *) record; |
| 960 | p8 += sizeof(struct ol_fw_tx_dbg_ppdu_base); |
| 961 | if (hdr->mpdu_bytes_array_len) { |
| 962 | htt_make_u16_list_str((uint32_t *) p8, buf, |
| 963 | BUF_SIZE, |
| 964 | hdr-> |
| 965 | mpdu_bytes_array_len); |
| 966 | cdf_print(" MPDU bytes: %s\n", buf); |
| 967 | } |
| 968 | p8 += hdr->mpdu_bytes_array_len * sizeof(uint16_t); |
| 969 | if (hdr->mpdu_msdus_array_len) { |
| 970 | htt_make_u8_list_str((uint32_t *) p8, buf, |
| 971 | BUF_SIZE, |
| 972 | hdr->mpdu_msdus_array_len); |
| 973 | cdf_print(" MPDU MSDUs: %s\n", buf); |
| 974 | } |
| 975 | p8 += hdr->mpdu_msdus_array_len * sizeof(uint8_t); |
| 976 | if (hdr->msdu_bytes_array_len) { |
| 977 | htt_make_u16_list_str((uint32_t *) p8, buf, |
| 978 | BUF_SIZE, |
| 979 | hdr-> |
| 980 | msdu_bytes_array_len); |
| 981 | cdf_print(" MSDU bytes: %s\n", buf); |
| 982 | } |
| 983 | } else { |
| 984 | /* concise */ |
| 985 | cdf_print("start seq num = %u ", start_seq_num); |
| 986 | cdf_print("enqueued and acked MPDU bitmaps:\n"); |
| 987 | if (complete) { |
| 988 | htt_t2h_tx_ppdu_bitmaps_pr(msg_word + |
| 989 | OL_FW_TX_DBG_PPDU_ENQUEUED_LSBS_16, |
| 990 | msg_word + |
| 991 | OL_FW_TX_DBG_PPDU_BLOCK_ACK_LSBS_16); |
| 992 | } else { |
| 993 | cdf_print("(not completed)\n"); |
| 994 | } |
| 995 | } |
| 996 | record = (struct ol_fw_tx_dbg_ppdu_base *) |
| 997 | (((uint8_t *) record) + record_size); |
| 998 | } |
| 999 | } |
| 1000 | |
| 1001 | void htt_t2h_stats_print(uint8_t *stats_data, int concise) |
| 1002 | { |
| 1003 | uint32_t *msg_word = (uint32_t *) stats_data; |
| 1004 | enum htt_dbg_stats_type type; |
| 1005 | enum htt_dbg_stats_status status; |
| 1006 | int length; |
| 1007 | |
| 1008 | type = HTT_T2H_STATS_CONF_TLV_TYPE_GET(*msg_word); |
| 1009 | status = HTT_T2H_STATS_CONF_TLV_STATUS_GET(*msg_word); |
| 1010 | length = HTT_T2H_STATS_CONF_TLV_LENGTH_GET(*msg_word); |
| 1011 | |
| 1012 | /* check that we've been given a valid stats type */ |
| 1013 | if (status == HTT_DBG_STATS_STATUS_SERIES_DONE) { |
| 1014 | return; |
| 1015 | } else if (status == HTT_DBG_STATS_STATUS_INVALID) { |
| 1016 | cdf_print("Target doesn't support stats type %d\n", type); |
| 1017 | return; |
| 1018 | } else if (status == HTT_DBG_STATS_STATUS_ERROR) { |
| 1019 | cdf_print("Target couldn't upload stats type %d (no mem?)\n", |
| 1020 | type); |
| 1021 | return; |
| 1022 | } |
| 1023 | /* got valid (though perhaps partial) stats - process them */ |
| 1024 | switch (type) { |
| 1025 | case HTT_DBG_STATS_WAL_PDEV_TXRX: |
| 1026 | { |
| 1027 | struct wlan_dbg_stats *wlan_dbg_stats_ptr; |
| 1028 | |
| 1029 | wlan_dbg_stats_ptr = |
| 1030 | (struct wlan_dbg_stats *)(msg_word + 1); |
| 1031 | htt_t2h_stats_pdev_stats_print(wlan_dbg_stats_ptr, |
| 1032 | concise); |
| 1033 | break; |
| 1034 | } |
| 1035 | case HTT_DBG_STATS_RX_REORDER: |
| 1036 | { |
| 1037 | struct rx_reorder_stats *rx_reorder_stats_ptr; |
| 1038 | |
| 1039 | rx_reorder_stats_ptr = |
| 1040 | (struct rx_reorder_stats *)(msg_word + 1); |
| 1041 | htt_t2h_stats_rx_reorder_stats_print |
| 1042 | (rx_reorder_stats_ptr, concise); |
| 1043 | break; |
| 1044 | } |
| 1045 | |
| 1046 | case HTT_DBG_STATS_RX_RATE_INFO: |
| 1047 | { |
| 1048 | wlan_dbg_rx_rate_info_t *rx_phy_info; |
| 1049 | rx_phy_info = |
| 1050 | (wlan_dbg_rx_rate_info_t *) (msg_word + 1); |
| 1051 | |
| 1052 | htt_t2h_stats_rx_rate_stats_print(rx_phy_info, concise); |
| 1053 | |
| 1054 | break; |
| 1055 | } |
| 1056 | case HTT_DBG_STATS_RX_RATE_INFO_V2: |
| 1057 | { |
| 1058 | wlan_dbg_rx_rate_info_v2_t *rx_phy_info; |
| 1059 | rx_phy_info = |
| 1060 | (wlan_dbg_rx_rate_info_v2_t *) (msg_word + 1); |
| 1061 | htt_t2h_stats_rx_rate_stats_print_v2(rx_phy_info, concise); |
| 1062 | break; |
| 1063 | } |
| 1064 | case HTT_DBG_STATS_TX_PPDU_LOG: |
| 1065 | { |
| 1066 | struct ol_fw_tx_dbg_ppdu_msg_hdr *hdr; |
| 1067 | struct ol_fw_tx_dbg_ppdu_base *record; |
| 1068 | |
| 1069 | if (status == HTT_DBG_STATS_STATUS_PARTIAL |
| 1070 | && length == 0) { |
| 1071 | cdf_print |
| 1072 | ("HTT_DBG_STATS_TX_PPDU_LOG -- length = 0!\n"); |
| 1073 | break; |
| 1074 | } |
| 1075 | hdr = |
| 1076 | (struct ol_fw_tx_dbg_ppdu_msg_hdr *)(msg_word + 1); |
| 1077 | record = (struct ol_fw_tx_dbg_ppdu_base *)(hdr + 1); |
| 1078 | htt_t2h_tx_ppdu_log_print(hdr, record, length, concise); |
| 1079 | } |
| 1080 | break; |
| 1081 | case HTT_DBG_STATS_TX_RATE_INFO: |
| 1082 | { |
| 1083 | wlan_dbg_tx_rate_info_t *tx_rate_info; |
| 1084 | tx_rate_info = |
| 1085 | (wlan_dbg_tx_rate_info_t *) (msg_word + 1); |
| 1086 | |
| 1087 | htt_t2h_stats_tx_rate_stats_print(tx_rate_info, concise); |
| 1088 | |
| 1089 | break; |
| 1090 | } |
| 1091 | case HTT_DBG_STATS_TX_RATE_INFO_V2: |
| 1092 | { |
| 1093 | wlan_dbg_tx_rate_info_v2_t *tx_rate_info; |
| 1094 | tx_rate_info = |
| 1095 | (wlan_dbg_tx_rate_info_v2_t *) (msg_word + 1); |
| 1096 | htt_t2h_stats_tx_rate_stats_print_v2(tx_rate_info, concise); |
| 1097 | break; |
| 1098 | } |
| 1099 | case HTT_DBG_STATS_RX_REMOTE_RING_BUFFER_INFO: |
| 1100 | { |
| 1101 | struct rx_remote_buffer_mgmt_stats *rx_rem_buf; |
| 1102 | |
| 1103 | rx_rem_buf = (struct rx_remote_buffer_mgmt_stats *)(msg_word + 1); |
| 1104 | htt_t2h_stats_rx_rem_buf_stats_print(rx_rem_buf, concise); |
| 1105 | break; |
| 1106 | } |
| 1107 | case HTT_DBG_STATS_TXBF_INFO: |
| 1108 | { |
| 1109 | struct wlan_dbg_txbf_data_stats *txbf_info_buf; |
| 1110 | |
| 1111 | txbf_info_buf = |
| 1112 | (struct wlan_dbg_txbf_data_stats *)(msg_word + 1); |
| 1113 | htt_t2h_stats_txbf_info_buf_stats_print(txbf_info_buf); |
| 1114 | break; |
| 1115 | } |
| 1116 | case HTT_DBG_STATS_SND_INFO: |
| 1117 | { |
| 1118 | struct wlan_dbg_txbf_snd_stats *txbf_snd_buf; |
| 1119 | |
| 1120 | txbf_snd_buf = |
| 1121 | (struct wlan_dbg_txbf_snd_stats *)(msg_word + 1); |
| 1122 | htt_t2h_stats_txbf_snd_buf_stats_print(txbf_snd_buf); |
| 1123 | break; |
| 1124 | } |
| 1125 | case HTT_DBG_STATS_TX_SELFGEN_INFO: |
| 1126 | { |
| 1127 | struct wlan_dbg_tx_selfgen_stats *tx_selfgen_buf; |
| 1128 | |
| 1129 | tx_selfgen_buf = |
| 1130 | (struct wlan_dbg_tx_selfgen_stats *)(msg_word + 1); |
| 1131 | htt_t2h_stats_tx_selfgen_buf_stats_print(tx_selfgen_buf); |
| 1132 | break; |
| 1133 | } |
| 1134 | case HTT_DBG_STATS_ERROR_INFO: |
| 1135 | { |
| 1136 | struct wlan_dbg_wifi2_error_stats *wifi2_error_buf; |
| 1137 | |
| 1138 | wifi2_error_buf = |
| 1139 | (struct wlan_dbg_wifi2_error_stats *)(msg_word + 1); |
| 1140 | htt_t2h_stats_wifi2_error_stats_print(wifi2_error_buf); |
| 1141 | break; |
| 1142 | } |
| 1143 | case HTT_DBG_STATS_TXBF_MUSU_NDPA_PKT: |
| 1144 | { |
| 1145 | struct rx_txbf_musu_ndpa_pkts_stats *rx_musu_ndpa_stats; |
| 1146 | |
| 1147 | rx_musu_ndpa_stats = (struct rx_txbf_musu_ndpa_pkts_stats *) |
| 1148 | (msg_word + 1); |
| 1149 | htt_t2h_rx_musu_ndpa_pkts_stats_print(rx_musu_ndpa_stats); |
| 1150 | break; |
| 1151 | } |
| 1152 | default: |
| 1153 | break; |
| 1154 | } |
| 1155 | } |