1 // SPDX-License-Identifier: BSD-3-Clause-Clear 2 /* 3 * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. 4 */ 5 6 #include <linux/vmalloc.h> 7 #include "core.h" 8 #include "dp_tx.h" 9 #include "dp_rx.h" 10 #include "debug.h" 11 #include "debugfs_htt_stats.h" 12 13 #define HTT_DBG_OUT(buf, len, fmt, ...) \ 14 scnprintf(buf, len, fmt "\n", ##__VA_ARGS__) 15 16 #define HTT_MAX_STRING_LEN 256 17 #define HTT_MAX_PRINT_CHAR_PER_ELEM 15 18 19 #define HTT_TLV_HDR_LEN 4 20 21 #define ARRAY_TO_STRING(out, arr, len) \ 22 do { \ 23 int index = 0; u8 i; \ 24 for (i = 0; i < len; i++) { \ 25 index += scnprintf(out + index, HTT_MAX_STRING_LEN - index, \ 26 " %u:%u,", i, arr[i]); \ 27 if (index < 0 || index >= HTT_MAX_STRING_LEN) \ 28 break; \ 29 } \ 30 } while (0) 31 32 static inline void htt_print_stats_string_tlv(const void *tag_buf, 33 u16 tag_len, 34 struct debug_htt_stats_req *stats_req) 35 { 36 const struct htt_stats_string_tlv *htt_stats_buf = tag_buf; 37 u8 *buf = stats_req->buf; 38 u32 len = stats_req->buf_len; 39 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 40 u8 i; 41 u16 index = 0; 42 char data[HTT_MAX_STRING_LEN] = {0}; 43 44 tag_len = tag_len >> 2; 45 46 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_STATS_STRING_TLV:"); 47 48 for (i = 0; i < tag_len; i++) { 49 index += scnprintf(&data[index], 50 HTT_MAX_STRING_LEN - index, 51 "%.*s", 4, (char *)&(htt_stats_buf->data[i])); 52 if (index >= HTT_MAX_STRING_LEN) 53 break; 54 } 55 56 len += HTT_DBG_OUT(buf + len, buf_len - len, "data = %s\n", data); 57 58 if (len >= buf_len) 59 buf[buf_len - 1] = 0; 60 else 61 buf[len] = 0; 62 63 stats_req->buf_len = len; 64 } 65 66 static inline void htt_print_tx_pdev_stats_cmn_tlv(const void *tag_buf, 67 struct debug_htt_stats_req *stats_req) 68 { 69 const struct htt_tx_pdev_stats_cmn_tlv *htt_stats_buf = tag_buf; 70 u8 *buf = stats_req->buf; 71 u32 len = stats_req->buf_len; 72 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 73 74 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_TX_PDEV_STATS_CMN_TLV:"); 75 len += HTT_DBG_OUT(buf + len, buf_len - len, "mac_id = %u", 76 htt_stats_buf->mac_id__word & 0xFF); 77 len += HTT_DBG_OUT(buf + len, buf_len - len, "hw_queued = %u", 78 htt_stats_buf->hw_queued); 79 len += HTT_DBG_OUT(buf + len, buf_len - len, "hw_reaped = %u", 80 htt_stats_buf->hw_reaped); 81 len += HTT_DBG_OUT(buf + len, buf_len - len, "underrun = %u", 82 htt_stats_buf->underrun); 83 len += HTT_DBG_OUT(buf + len, buf_len - len, "hw_paused = %u", 84 htt_stats_buf->hw_paused); 85 len += HTT_DBG_OUT(buf + len, buf_len - len, "hw_flush = %u", 86 htt_stats_buf->hw_flush); 87 len += HTT_DBG_OUT(buf + len, buf_len - len, "hw_filt = %u", 88 htt_stats_buf->hw_filt); 89 len += HTT_DBG_OUT(buf + len, buf_len - len, "tx_abort = %u", 90 htt_stats_buf->tx_abort); 91 len += HTT_DBG_OUT(buf + len, buf_len - len, "mpdu_requeued = %u", 92 htt_stats_buf->mpdu_requed); 93 len += HTT_DBG_OUT(buf + len, buf_len - len, "tx_xretry = %u", 94 htt_stats_buf->tx_xretry); 95 len += HTT_DBG_OUT(buf + len, buf_len - len, "data_rc = %u", 96 htt_stats_buf->data_rc); 97 len += HTT_DBG_OUT(buf + len, buf_len - len, "mpdu_dropped_xretry = %u", 98 htt_stats_buf->mpdu_dropped_xretry); 99 len += HTT_DBG_OUT(buf + len, buf_len - len, "illegal_rate_phy_err = %u", 100 htt_stats_buf->illgl_rate_phy_err); 101 len += HTT_DBG_OUT(buf + len, buf_len - len, "cont_xretry = %u", 102 htt_stats_buf->cont_xretry); 103 len += HTT_DBG_OUT(buf + len, buf_len - len, "tx_timeout = %u", 104 htt_stats_buf->tx_timeout); 105 len += HTT_DBG_OUT(buf + len, buf_len - len, "pdev_resets = %u", 106 htt_stats_buf->pdev_resets); 107 len += HTT_DBG_OUT(buf + len, buf_len - len, "phy_underrun = %u", 108 htt_stats_buf->phy_underrun); 109 len += HTT_DBG_OUT(buf + len, buf_len - len, "txop_ovf = %u", 110 htt_stats_buf->txop_ovf); 111 len += HTT_DBG_OUT(buf + len, buf_len - len, "seq_posted = %u", 112 htt_stats_buf->seq_posted); 113 len += HTT_DBG_OUT(buf + len, buf_len - len, "seq_failed_queueing = %u", 114 htt_stats_buf->seq_failed_queueing); 115 len += HTT_DBG_OUT(buf + len, buf_len - len, "seq_completed = %u", 116 htt_stats_buf->seq_completed); 117 len += HTT_DBG_OUT(buf + len, buf_len - len, "seq_restarted = %u", 118 htt_stats_buf->seq_restarted); 119 len += HTT_DBG_OUT(buf + len, buf_len - len, "mu_seq_posted = %u", 120 htt_stats_buf->mu_seq_posted); 121 len += HTT_DBG_OUT(buf + len, buf_len - len, "seq_switch_hw_paused = %u", 122 htt_stats_buf->seq_switch_hw_paused); 123 len += HTT_DBG_OUT(buf + len, buf_len - len, "next_seq_posted_dsr = %u", 124 htt_stats_buf->next_seq_posted_dsr); 125 len += HTT_DBG_OUT(buf + len, buf_len - len, "seq_posted_isr = %u", 126 htt_stats_buf->seq_posted_isr); 127 len += HTT_DBG_OUT(buf + len, buf_len - len, "seq_ctrl_cached = %u", 128 htt_stats_buf->seq_ctrl_cached); 129 len += HTT_DBG_OUT(buf + len, buf_len - len, "mpdu_count_tqm = %u", 130 htt_stats_buf->mpdu_count_tqm); 131 len += HTT_DBG_OUT(buf + len, buf_len - len, "msdu_count_tqm = %u", 132 htt_stats_buf->msdu_count_tqm); 133 len += HTT_DBG_OUT(buf + len, buf_len - len, "mpdu_removed_tqm = %u", 134 htt_stats_buf->mpdu_removed_tqm); 135 len += HTT_DBG_OUT(buf + len, buf_len - len, "msdu_removed_tqm = %u", 136 htt_stats_buf->msdu_removed_tqm); 137 len += HTT_DBG_OUT(buf + len, buf_len - len, "mpdus_sw_flush = %u", 138 htt_stats_buf->mpdus_sw_flush); 139 len += HTT_DBG_OUT(buf + len, buf_len - len, "mpdus_hw_filter = %u", 140 htt_stats_buf->mpdus_hw_filter); 141 len += HTT_DBG_OUT(buf + len, buf_len - len, "mpdus_truncated = %u", 142 htt_stats_buf->mpdus_truncated); 143 len += HTT_DBG_OUT(buf + len, buf_len - len, "mpdus_ack_failed = %u", 144 htt_stats_buf->mpdus_ack_failed); 145 len += HTT_DBG_OUT(buf + len, buf_len - len, "mpdus_expired = %u", 146 htt_stats_buf->mpdus_expired); 147 len += HTT_DBG_OUT(buf + len, buf_len - len, "mpdus_seq_hw_retry = %u", 148 htt_stats_buf->mpdus_seq_hw_retry); 149 len += HTT_DBG_OUT(buf + len, buf_len - len, "ack_tlv_proc = %u", 150 htt_stats_buf->ack_tlv_proc); 151 len += HTT_DBG_OUT(buf + len, buf_len - len, "coex_abort_mpdu_cnt_valid = %u", 152 htt_stats_buf->coex_abort_mpdu_cnt_valid); 153 len += HTT_DBG_OUT(buf + len, buf_len - len, "coex_abort_mpdu_cnt = %u", 154 htt_stats_buf->coex_abort_mpdu_cnt); 155 len += HTT_DBG_OUT(buf + len, buf_len - len, "num_total_ppdus_tried_ota = %u", 156 htt_stats_buf->num_total_ppdus_tried_ota); 157 len += HTT_DBG_OUT(buf + len, buf_len - len, "num_data_ppdus_tried_ota = %u", 158 htt_stats_buf->num_data_ppdus_tried_ota); 159 len += HTT_DBG_OUT(buf + len, buf_len - len, "local_ctrl_mgmt_enqued = %u", 160 htt_stats_buf->local_ctrl_mgmt_enqued); 161 len += HTT_DBG_OUT(buf + len, buf_len - len, "local_ctrl_mgmt_freed = %u", 162 htt_stats_buf->local_ctrl_mgmt_freed); 163 len += HTT_DBG_OUT(buf + len, buf_len - len, "local_data_enqued = %u", 164 htt_stats_buf->local_data_enqued); 165 len += HTT_DBG_OUT(buf + len, buf_len - len, "local_data_freed = %u", 166 htt_stats_buf->local_data_freed); 167 len += HTT_DBG_OUT(buf + len, buf_len - len, "mpdu_tried = %u", 168 htt_stats_buf->mpdu_tried); 169 len += HTT_DBG_OUT(buf + len, buf_len - len, "isr_wait_seq_posted = %u", 170 htt_stats_buf->isr_wait_seq_posted); 171 len += HTT_DBG_OUT(buf + len, buf_len - len, "tx_active_dur_us_low = %u", 172 htt_stats_buf->tx_active_dur_us_low); 173 len += HTT_DBG_OUT(buf + len, buf_len - len, "tx_active_dur_us_high = %u\n", 174 htt_stats_buf->tx_active_dur_us_high); 175 176 if (len >= buf_len) 177 buf[buf_len - 1] = 0; 178 else 179 buf[len] = 0; 180 181 stats_req->buf_len = len; 182 } 183 184 static inline void 185 htt_print_tx_pdev_stats_urrn_tlv_v(const void *tag_buf, 186 u16 tag_len, 187 struct debug_htt_stats_req *stats_req) 188 { 189 const struct htt_tx_pdev_stats_urrn_tlv_v *htt_stats_buf = tag_buf; 190 u8 *buf = stats_req->buf; 191 u32 len = stats_req->buf_len; 192 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 193 char urrn_stats[HTT_MAX_STRING_LEN] = {0}; 194 u16 num_elems = min_t(u16, (tag_len >> 2), HTT_TX_PDEV_MAX_URRN_STATS); 195 196 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_TX_PDEV_STATS_URRN_TLV_V:"); 197 198 ARRAY_TO_STRING(urrn_stats, htt_stats_buf->urrn_stats, num_elems); 199 len += HTT_DBG_OUT(buf + len, buf_len - len, "urrn_stats = %s\n", urrn_stats); 200 201 if (len >= buf_len) 202 buf[buf_len - 1] = 0; 203 else 204 buf[len] = 0; 205 206 stats_req->buf_len = len; 207 } 208 209 static inline void 210 htt_print_tx_pdev_stats_flush_tlv_v(const void *tag_buf, 211 u16 tag_len, 212 struct debug_htt_stats_req *stats_req) 213 { 214 const struct htt_tx_pdev_stats_flush_tlv_v *htt_stats_buf = tag_buf; 215 u8 *buf = stats_req->buf; 216 u32 len = stats_req->buf_len; 217 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 218 char flush_errs[HTT_MAX_STRING_LEN] = {0}; 219 u16 num_elems = min_t(u16, (tag_len >> 2), HTT_TX_PDEV_MAX_FLUSH_REASON_STATS); 220 221 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_TX_PDEV_STATS_FLUSH_TLV_V:"); 222 223 ARRAY_TO_STRING(flush_errs, htt_stats_buf->flush_errs, num_elems); 224 len += HTT_DBG_OUT(buf + len, buf_len - len, "flush_errs = %s\n", flush_errs); 225 226 if (len >= buf_len) 227 buf[buf_len - 1] = 0; 228 else 229 buf[len] = 0; 230 231 stats_req->buf_len = len; 232 } 233 234 static inline void 235 htt_print_tx_pdev_stats_sifs_tlv_v(const void *tag_buf, 236 u16 tag_len, 237 struct debug_htt_stats_req *stats_req) 238 { 239 const struct htt_tx_pdev_stats_sifs_tlv_v *htt_stats_buf = tag_buf; 240 u8 *buf = stats_req->buf; 241 u32 len = stats_req->buf_len; 242 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 243 char sifs_status[HTT_MAX_STRING_LEN] = {0}; 244 u16 num_elems = min_t(u16, (tag_len >> 2), HTT_TX_PDEV_MAX_SIFS_BURST_STATS); 245 246 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_TX_PDEV_STATS_SIFS_TLV_V:"); 247 248 ARRAY_TO_STRING(sifs_status, htt_stats_buf->sifs_status, num_elems); 249 len += HTT_DBG_OUT(buf + len, buf_len - len, "sifs_status = %s\n", 250 sifs_status); 251 252 if (len >= buf_len) 253 buf[buf_len - 1] = 0; 254 else 255 buf[len] = 0; 256 257 stats_req->buf_len = len; 258 } 259 260 static inline void 261 htt_print_tx_pdev_stats_phy_err_tlv_v(const void *tag_buf, 262 u16 tag_len, 263 struct debug_htt_stats_req *stats_req) 264 { 265 const struct htt_tx_pdev_stats_phy_err_tlv_v *htt_stats_buf = tag_buf; 266 u8 *buf = stats_req->buf; 267 u32 len = stats_req->buf_len; 268 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 269 char phy_errs[HTT_MAX_STRING_LEN] = {0}; 270 u16 num_elems = min_t(u16, (tag_len >> 2), HTT_TX_PDEV_MAX_PHY_ERR_STATS); 271 272 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_TX_PDEV_STATS_PHY_ERR_TLV_V:"); 273 274 ARRAY_TO_STRING(phy_errs, htt_stats_buf->phy_errs, num_elems); 275 len += HTT_DBG_OUT(buf + len, buf_len - len, "phy_errs = %s\n", phy_errs); 276 277 if (len >= buf_len) 278 buf[buf_len - 1] = 0; 279 else 280 buf[len] = 0; 281 282 stats_req->buf_len = len; 283 } 284 285 static inline void 286 htt_print_tx_pdev_stats_sifs_hist_tlv_v(const void *tag_buf, 287 u16 tag_len, 288 struct debug_htt_stats_req *stats_req) 289 { 290 const struct htt_tx_pdev_stats_sifs_hist_tlv_v *htt_stats_buf = tag_buf; 291 u8 *buf = stats_req->buf; 292 u32 len = stats_req->buf_len; 293 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 294 char sifs_hist_status[HTT_MAX_STRING_LEN] = {0}; 295 u16 num_elems = min_t(u16, (tag_len >> 2), HTT_TX_PDEV_MAX_SIFS_BURST_HIST_STATS); 296 297 len += HTT_DBG_OUT(buf + len, buf_len - len, 298 "HTT_TX_PDEV_STATS_SIFS_HIST_TLV_V:"); 299 300 ARRAY_TO_STRING(sifs_hist_status, htt_stats_buf->sifs_hist_status, num_elems); 301 len += HTT_DBG_OUT(buf + len, buf_len - len, "sifs_hist_status = %s\n", 302 sifs_hist_status); 303 304 if (len >= buf_len) 305 buf[buf_len - 1] = 0; 306 else 307 buf[len] = 0; 308 309 stats_req->buf_len = len; 310 } 311 312 static inline void 313 htt_print_tx_pdev_stats_tx_ppdu_stats_tlv_v(const void *tag_buf, 314 struct debug_htt_stats_req *stats_req) 315 { 316 const struct htt_tx_pdev_stats_tx_ppdu_stats_tlv_v *htt_stats_buf = tag_buf; 317 u8 *buf = stats_req->buf; 318 u32 len = stats_req->buf_len; 319 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 320 321 len += HTT_DBG_OUT(buf + len, buf_len - len, 322 "HTT_TX_PDEV_STATS_TX_PPDU_STATS_TLV_V:"); 323 324 len += HTT_DBG_OUT(buf + len, buf_len - len, "num_data_ppdus_legacy_su = %u", 325 htt_stats_buf->num_data_ppdus_legacy_su); 326 327 len += HTT_DBG_OUT(buf + len, buf_len - len, "num_data_ppdus_ac_su = %u", 328 htt_stats_buf->num_data_ppdus_ac_su); 329 330 len += HTT_DBG_OUT(buf + len, buf_len - len, "num_data_ppdus_ax_su = %u", 331 htt_stats_buf->num_data_ppdus_ax_su); 332 333 len += HTT_DBG_OUT(buf + len, buf_len - len, "num_data_ppdus_ac_su_txbf = %u", 334 htt_stats_buf->num_data_ppdus_ac_su_txbf); 335 336 len += HTT_DBG_OUT(buf + len, buf_len - len, "num_data_ppdus_ax_su_txbf = %u\n", 337 htt_stats_buf->num_data_ppdus_ax_su_txbf); 338 339 if (len >= buf_len) 340 buf[buf_len - 1] = 0; 341 else 342 buf[len] = 0; 343 344 stats_req->buf_len = len; 345 } 346 347 static inline void 348 htt_print_tx_pdev_stats_tried_mpdu_cnt_hist_tlv_v(const void *tag_buf, 349 u16 tag_len, 350 struct debug_htt_stats_req *stats_req) 351 { 352 const struct htt_tx_pdev_stats_tried_mpdu_cnt_hist_tlv_v *htt_stats_buf = tag_buf; 353 u8 *buf = stats_req->buf; 354 u32 len = stats_req->buf_len; 355 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 356 char tried_mpdu_cnt_hist[HTT_MAX_STRING_LEN] = {0}; 357 u32 num_elements = ((tag_len - sizeof(htt_stats_buf->hist_bin_size)) >> 2); 358 u32 required_buffer_size = HTT_MAX_PRINT_CHAR_PER_ELEM * num_elements; 359 360 len += HTT_DBG_OUT(buf + len, buf_len - len, 361 "HTT_TX_PDEV_STATS_TRIED_MPDU_CNT_HIST_TLV_V:"); 362 len += HTT_DBG_OUT(buf + len, buf_len - len, "TRIED_MPDU_CNT_HIST_BIN_SIZE : %u", 363 htt_stats_buf->hist_bin_size); 364 365 if (required_buffer_size < HTT_MAX_STRING_LEN) { 366 ARRAY_TO_STRING(tried_mpdu_cnt_hist, 367 htt_stats_buf->tried_mpdu_cnt_hist, 368 num_elements); 369 len += HTT_DBG_OUT(buf + len, buf_len - len, "tried_mpdu_cnt_hist = %s\n", 370 tried_mpdu_cnt_hist); 371 } else { 372 len += HTT_DBG_OUT(buf + len, buf_len - len, 373 "INSUFFICIENT PRINT BUFFER\n"); 374 } 375 376 if (len >= buf_len) 377 buf[buf_len - 1] = 0; 378 else 379 buf[len] = 0; 380 381 stats_req->buf_len = len; 382 } 383 384 static inline void htt_print_hw_stats_intr_misc_tlv(const void *tag_buf, 385 struct debug_htt_stats_req *stats_req) 386 { 387 const struct htt_hw_stats_intr_misc_tlv *htt_stats_buf = tag_buf; 388 u8 *buf = stats_req->buf; 389 u32 len = stats_req->buf_len; 390 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 391 char hw_intr_name[HTT_STATS_MAX_HW_INTR_NAME_LEN + 1] = {0}; 392 393 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_HW_STATS_INTR_MISC_TLV:"); 394 memcpy(hw_intr_name, &(htt_stats_buf->hw_intr_name[0]), 395 HTT_STATS_MAX_HW_INTR_NAME_LEN); 396 len += HTT_DBG_OUT(buf + len, buf_len - len, "hw_intr_name = %s ", hw_intr_name); 397 len += HTT_DBG_OUT(buf + len, buf_len - len, "mask = %u", 398 htt_stats_buf->mask); 399 len += HTT_DBG_OUT(buf + len, buf_len - len, "count = %u\n", 400 htt_stats_buf->count); 401 402 if (len >= buf_len) 403 buf[buf_len - 1] = 0; 404 else 405 buf[len] = 0; 406 407 stats_req->buf_len = len; 408 } 409 410 static inline void 411 htt_print_hw_stats_wd_timeout_tlv(const void *tag_buf, 412 struct debug_htt_stats_req *stats_req) 413 { 414 const struct htt_hw_stats_wd_timeout_tlv *htt_stats_buf = tag_buf; 415 u8 *buf = stats_req->buf; 416 u32 len = stats_req->buf_len; 417 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 418 char hw_module_name[HTT_STATS_MAX_HW_MODULE_NAME_LEN + 1] = {0}; 419 420 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_HW_STATS_WD_TIMEOUT_TLV:"); 421 memcpy(hw_module_name, &(htt_stats_buf->hw_module_name[0]), 422 HTT_STATS_MAX_HW_MODULE_NAME_LEN); 423 len += HTT_DBG_OUT(buf + len, buf_len - len, "hw_module_name = %s ", 424 hw_module_name); 425 len += HTT_DBG_OUT(buf + len, buf_len - len, "count = %u", 426 htt_stats_buf->count); 427 428 if (len >= buf_len) 429 buf[buf_len - 1] = 0; 430 else 431 buf[len] = 0; 432 433 stats_req->buf_len = len; 434 } 435 436 static inline void htt_print_hw_stats_pdev_errs_tlv(const void *tag_buf, 437 struct debug_htt_stats_req *stats_req) 438 { 439 const struct htt_hw_stats_pdev_errs_tlv *htt_stats_buf = tag_buf; 440 u8 *buf = stats_req->buf; 441 u32 len = stats_req->buf_len; 442 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 443 444 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_HW_STATS_PDEV_ERRS_TLV:"); 445 len += HTT_DBG_OUT(buf + len, buf_len - len, "mac_id = %u", 446 htt_stats_buf->mac_id__word & 0xFF); 447 len += HTT_DBG_OUT(buf + len, buf_len - len, "tx_abort = %u", 448 htt_stats_buf->tx_abort); 449 len += HTT_DBG_OUT(buf + len, buf_len - len, "tx_abort_fail_count = %u", 450 htt_stats_buf->tx_abort_fail_count); 451 len += HTT_DBG_OUT(buf + len, buf_len - len, "rx_abort = %u", 452 htt_stats_buf->rx_abort); 453 len += HTT_DBG_OUT(buf + len, buf_len - len, "rx_abort_fail_count = %u", 454 htt_stats_buf->rx_abort_fail_count); 455 len += HTT_DBG_OUT(buf + len, buf_len - len, "warm_reset = %u", 456 htt_stats_buf->warm_reset); 457 len += HTT_DBG_OUT(buf + len, buf_len - len, "cold_reset = %u", 458 htt_stats_buf->cold_reset); 459 len += HTT_DBG_OUT(buf + len, buf_len - len, "tx_flush = %u", 460 htt_stats_buf->tx_flush); 461 len += HTT_DBG_OUT(buf + len, buf_len - len, "tx_glb_reset = %u", 462 htt_stats_buf->tx_glb_reset); 463 len += HTT_DBG_OUT(buf + len, buf_len - len, "tx_txq_reset = %u", 464 htt_stats_buf->tx_txq_reset); 465 len += HTT_DBG_OUT(buf + len, buf_len - len, "rx_timeout_reset = %u\n", 466 htt_stats_buf->rx_timeout_reset); 467 468 if (len >= buf_len) 469 buf[buf_len - 1] = 0; 470 else 471 buf[len] = 0; 472 473 stats_req->buf_len = len; 474 } 475 476 static inline void htt_print_msdu_flow_stats_tlv(const void *tag_buf, 477 struct debug_htt_stats_req *stats_req) 478 { 479 const struct htt_msdu_flow_stats_tlv *htt_stats_buf = tag_buf; 480 u8 *buf = stats_req->buf; 481 u32 len = stats_req->buf_len; 482 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 483 484 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_MSDU_FLOW_STATS_TLV:"); 485 len += HTT_DBG_OUT(buf + len, buf_len - len, "last_update_timestamp = %u", 486 htt_stats_buf->last_update_timestamp); 487 len += HTT_DBG_OUT(buf + len, buf_len - len, "last_add_timestamp = %u", 488 htt_stats_buf->last_add_timestamp); 489 len += HTT_DBG_OUT(buf + len, buf_len - len, "last_remove_timestamp = %u", 490 htt_stats_buf->last_remove_timestamp); 491 len += HTT_DBG_OUT(buf + len, buf_len - len, "total_processed_msdu_count = %u", 492 htt_stats_buf->total_processed_msdu_count); 493 len += HTT_DBG_OUT(buf + len, buf_len - len, "cur_msdu_count_in_flowq = %u", 494 htt_stats_buf->cur_msdu_count_in_flowq); 495 len += HTT_DBG_OUT(buf + len, buf_len - len, "sw_peer_id = %u", 496 htt_stats_buf->sw_peer_id); 497 len += HTT_DBG_OUT(buf + len, buf_len - len, "tx_flow_no = %u", 498 htt_stats_buf->tx_flow_no__tid_num__drop_rule & 0xFFFF); 499 len += HTT_DBG_OUT(buf + len, buf_len - len, "tid_num = %u", 500 (htt_stats_buf->tx_flow_no__tid_num__drop_rule & 0xF0000) >> 501 16); 502 len += HTT_DBG_OUT(buf + len, buf_len - len, "drop_rule = %u", 503 (htt_stats_buf->tx_flow_no__tid_num__drop_rule & 0x100000) >> 504 20); 505 len += HTT_DBG_OUT(buf + len, buf_len - len, "last_cycle_enqueue_count = %u", 506 htt_stats_buf->last_cycle_enqueue_count); 507 len += HTT_DBG_OUT(buf + len, buf_len - len, "last_cycle_dequeue_count = %u", 508 htt_stats_buf->last_cycle_dequeue_count); 509 len += HTT_DBG_OUT(buf + len, buf_len - len, "last_cycle_drop_count = %u", 510 htt_stats_buf->last_cycle_drop_count); 511 len += HTT_DBG_OUT(buf + len, buf_len - len, "current_drop_th = %u\n", 512 htt_stats_buf->current_drop_th); 513 514 if (len >= buf_len) 515 buf[buf_len - 1] = 0; 516 else 517 buf[len] = 0; 518 519 stats_req->buf_len = len; 520 } 521 522 static inline void htt_print_tx_tid_stats_tlv(const void *tag_buf, 523 struct debug_htt_stats_req *stats_req) 524 { 525 const struct htt_tx_tid_stats_tlv *htt_stats_buf = tag_buf; 526 u8 *buf = stats_req->buf; 527 u32 len = stats_req->buf_len; 528 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 529 char tid_name[MAX_HTT_TID_NAME + 1] = {0}; 530 531 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_TX_TID_STATS_TLV:"); 532 memcpy(tid_name, &(htt_stats_buf->tid_name[0]), MAX_HTT_TID_NAME); 533 len += HTT_DBG_OUT(buf + len, buf_len - len, "tid_name = %s ", tid_name); 534 len += HTT_DBG_OUT(buf + len, buf_len - len, "sw_peer_id = %u", 535 htt_stats_buf->sw_peer_id__tid_num & 0xFFFF); 536 len += HTT_DBG_OUT(buf + len, buf_len - len, "tid_num = %u", 537 (htt_stats_buf->sw_peer_id__tid_num & 0xFFFF0000) >> 16); 538 len += HTT_DBG_OUT(buf + len, buf_len - len, "num_sched_pending = %u", 539 htt_stats_buf->num_sched_pending__num_ppdu_in_hwq & 0xFF); 540 len += HTT_DBG_OUT(buf + len, buf_len - len, "num_ppdu_in_hwq = %u", 541 (htt_stats_buf->num_sched_pending__num_ppdu_in_hwq & 542 0xFF00) >> 8); 543 len += HTT_DBG_OUT(buf + len, buf_len - len, "tid_flags = 0x%x", 544 htt_stats_buf->tid_flags); 545 len += HTT_DBG_OUT(buf + len, buf_len - len, "hw_queued = %u", 546 htt_stats_buf->hw_queued); 547 len += HTT_DBG_OUT(buf + len, buf_len - len, "hw_reaped = %u", 548 htt_stats_buf->hw_reaped); 549 len += HTT_DBG_OUT(buf + len, buf_len - len, "mpdus_hw_filter = %u", 550 htt_stats_buf->mpdus_hw_filter); 551 len += HTT_DBG_OUT(buf + len, buf_len - len, "qdepth_bytes = %u", 552 htt_stats_buf->qdepth_bytes); 553 len += HTT_DBG_OUT(buf + len, buf_len - len, "qdepth_num_msdu = %u", 554 htt_stats_buf->qdepth_num_msdu); 555 len += HTT_DBG_OUT(buf + len, buf_len - len, "qdepth_num_mpdu = %u", 556 htt_stats_buf->qdepth_num_mpdu); 557 len += HTT_DBG_OUT(buf + len, buf_len - len, "last_scheduled_tsmp = %u", 558 htt_stats_buf->last_scheduled_tsmp); 559 len += HTT_DBG_OUT(buf + len, buf_len - len, "pause_module_id = %u", 560 htt_stats_buf->pause_module_id); 561 len += HTT_DBG_OUT(buf + len, buf_len - len, "block_module_id = %u\n", 562 htt_stats_buf->block_module_id); 563 564 if (len >= buf_len) 565 buf[buf_len - 1] = 0; 566 else 567 buf[len] = 0; 568 569 stats_req->buf_len = len; 570 } 571 572 static inline void htt_print_tx_tid_stats_v1_tlv(const void *tag_buf, 573 struct debug_htt_stats_req *stats_req) 574 { 575 const struct htt_tx_tid_stats_v1_tlv *htt_stats_buf = tag_buf; 576 u8 *buf = stats_req->buf; 577 u32 len = stats_req->buf_len; 578 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 579 char tid_name[MAX_HTT_TID_NAME + 1] = {0}; 580 581 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_TX_TID_STATS_V1_TLV:"); 582 memcpy(tid_name, &(htt_stats_buf->tid_name[0]), MAX_HTT_TID_NAME); 583 len += HTT_DBG_OUT(buf + len, buf_len - len, "tid_name = %s ", tid_name); 584 len += HTT_DBG_OUT(buf + len, buf_len - len, "sw_peer_id = %u", 585 htt_stats_buf->sw_peer_id__tid_num & 0xFFFF); 586 len += HTT_DBG_OUT(buf + len, buf_len - len, "tid_num = %u", 587 (htt_stats_buf->sw_peer_id__tid_num & 0xFFFF0000) >> 16); 588 len += HTT_DBG_OUT(buf + len, buf_len - len, "num_sched_pending = %u", 589 htt_stats_buf->num_sched_pending__num_ppdu_in_hwq & 0xFF); 590 len += HTT_DBG_OUT(buf + len, buf_len - len, "num_ppdu_in_hwq = %u", 591 (htt_stats_buf->num_sched_pending__num_ppdu_in_hwq & 592 0xFF00) >> 8); 593 len += HTT_DBG_OUT(buf + len, buf_len - len, "tid_flags = 0x%x", 594 htt_stats_buf->tid_flags); 595 len += HTT_DBG_OUT(buf + len, buf_len - len, "max_qdepth_bytes = %u", 596 htt_stats_buf->max_qdepth_bytes); 597 len += HTT_DBG_OUT(buf + len, buf_len - len, "max_qdepth_n_msdus = %u", 598 htt_stats_buf->max_qdepth_n_msdus); 599 len += HTT_DBG_OUT(buf + len, buf_len - len, "rsvd = %u", 600 htt_stats_buf->rsvd); 601 len += HTT_DBG_OUT(buf + len, buf_len - len, "qdepth_bytes = %u", 602 htt_stats_buf->qdepth_bytes); 603 len += HTT_DBG_OUT(buf + len, buf_len - len, "qdepth_num_msdu = %u", 604 htt_stats_buf->qdepth_num_msdu); 605 len += HTT_DBG_OUT(buf + len, buf_len - len, "qdepth_num_mpdu = %u", 606 htt_stats_buf->qdepth_num_mpdu); 607 len += HTT_DBG_OUT(buf + len, buf_len - len, "last_scheduled_tsmp = %u", 608 htt_stats_buf->last_scheduled_tsmp); 609 len += HTT_DBG_OUT(buf + len, buf_len - len, "pause_module_id = %u", 610 htt_stats_buf->pause_module_id); 611 len += HTT_DBG_OUT(buf + len, buf_len - len, "block_module_id = %u", 612 htt_stats_buf->block_module_id); 613 len += HTT_DBG_OUT(buf + len, buf_len - len, "allow_n_flags = 0x%x", 614 htt_stats_buf->allow_n_flags); 615 len += HTT_DBG_OUT(buf + len, buf_len - len, "sendn_frms_allowed = %u\n", 616 htt_stats_buf->sendn_frms_allowed); 617 618 if (len >= buf_len) 619 buf[buf_len - 1] = 0; 620 else 621 buf[len] = 0; 622 623 stats_req->buf_len = len; 624 } 625 626 static inline void htt_print_rx_tid_stats_tlv(const void *tag_buf, 627 struct debug_htt_stats_req *stats_req) 628 { 629 const struct htt_rx_tid_stats_tlv *htt_stats_buf = tag_buf; 630 u8 *buf = stats_req->buf; 631 u32 len = stats_req->buf_len; 632 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 633 char tid_name[MAX_HTT_TID_NAME + 1] = {0}; 634 635 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_RX_TID_STATS_TLV:"); 636 len += HTT_DBG_OUT(buf + len, buf_len - len, "sw_peer_id = %u", 637 htt_stats_buf->sw_peer_id__tid_num & 0xFFFF); 638 len += HTT_DBG_OUT(buf + len, buf_len - len, "tid_num = %u", 639 (htt_stats_buf->sw_peer_id__tid_num & 0xFFFF0000) >> 16); 640 memcpy(tid_name, &(htt_stats_buf->tid_name[0]), MAX_HTT_TID_NAME); 641 len += HTT_DBG_OUT(buf + len, buf_len - len, "tid_name = %s ", tid_name); 642 len += HTT_DBG_OUT(buf + len, buf_len - len, "dup_in_reorder = %u", 643 htt_stats_buf->dup_in_reorder); 644 len += HTT_DBG_OUT(buf + len, buf_len - len, "dup_past_outside_window = %u", 645 htt_stats_buf->dup_past_outside_window); 646 len += HTT_DBG_OUT(buf + len, buf_len - len, "dup_past_within_window = %u", 647 htt_stats_buf->dup_past_within_window); 648 len += HTT_DBG_OUT(buf + len, buf_len - len, "rxdesc_err_decrypt = %u\n", 649 htt_stats_buf->rxdesc_err_decrypt); 650 651 if (len >= buf_len) 652 buf[buf_len - 1] = 0; 653 else 654 buf[len] = 0; 655 656 stats_req->buf_len = len; 657 } 658 659 static inline void htt_print_counter_tlv(const void *tag_buf, 660 struct debug_htt_stats_req *stats_req) 661 { 662 const struct htt_counter_tlv *htt_stats_buf = tag_buf; 663 u8 *buf = stats_req->buf; 664 u32 len = stats_req->buf_len; 665 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 666 char counter_name[HTT_MAX_STRING_LEN] = {0}; 667 668 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_COUNTER_TLV:"); 669 670 ARRAY_TO_STRING(counter_name, 671 htt_stats_buf->counter_name, 672 HTT_MAX_COUNTER_NAME); 673 len += HTT_DBG_OUT(buf + len, buf_len - len, "counter_name = %s ", counter_name); 674 len += HTT_DBG_OUT(buf + len, buf_len - len, "count = %u\n", 675 htt_stats_buf->count); 676 677 if (len >= buf_len) 678 buf[buf_len - 1] = 0; 679 else 680 buf[len] = 0; 681 682 stats_req->buf_len = len; 683 } 684 685 static inline void htt_print_peer_stats_cmn_tlv(const void *tag_buf, 686 struct debug_htt_stats_req *stats_req) 687 { 688 const struct htt_peer_stats_cmn_tlv *htt_stats_buf = tag_buf; 689 u8 *buf = stats_req->buf; 690 u32 len = stats_req->buf_len; 691 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 692 693 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_PEER_STATS_CMN_TLV:"); 694 len += HTT_DBG_OUT(buf + len, buf_len - len, "ppdu_cnt = %u", 695 htt_stats_buf->ppdu_cnt); 696 len += HTT_DBG_OUT(buf + len, buf_len - len, "mpdu_cnt = %u", 697 htt_stats_buf->mpdu_cnt); 698 len += HTT_DBG_OUT(buf + len, buf_len - len, "msdu_cnt = %u", 699 htt_stats_buf->msdu_cnt); 700 len += HTT_DBG_OUT(buf + len, buf_len - len, "pause_bitmap = %u", 701 htt_stats_buf->pause_bitmap); 702 len += HTT_DBG_OUT(buf + len, buf_len - len, "block_bitmap = %u", 703 htt_stats_buf->block_bitmap); 704 len += HTT_DBG_OUT(buf + len, buf_len - len, "last_rssi = %d", 705 htt_stats_buf->rssi); 706 len += HTT_DBG_OUT(buf + len, buf_len - len, "enqueued_count = %llu", 707 htt_stats_buf->peer_enqueued_count_low | 708 ((u64)htt_stats_buf->peer_enqueued_count_high << 32)); 709 len += HTT_DBG_OUT(buf + len, buf_len - len, "dequeued_count = %llu", 710 htt_stats_buf->peer_dequeued_count_low | 711 ((u64)htt_stats_buf->peer_dequeued_count_high << 32)); 712 len += HTT_DBG_OUT(buf + len, buf_len - len, "dropped_count = %llu", 713 htt_stats_buf->peer_dropped_count_low | 714 ((u64)htt_stats_buf->peer_dropped_count_high << 32)); 715 len += HTT_DBG_OUT(buf + len, buf_len - len, "transmitted_ppdu_bytes = %llu", 716 htt_stats_buf->ppdu_transmitted_bytes_low | 717 ((u64)htt_stats_buf->ppdu_transmitted_bytes_high << 32)); 718 len += HTT_DBG_OUT(buf + len, buf_len - len, "ttl_removed_count = %u", 719 htt_stats_buf->peer_ttl_removed_count); 720 len += HTT_DBG_OUT(buf + len, buf_len - len, "inactive_time = %u\n", 721 htt_stats_buf->inactive_time); 722 723 if (len >= buf_len) 724 buf[buf_len - 1] = 0; 725 else 726 buf[len] = 0; 727 728 stats_req->buf_len = len; 729 } 730 731 static inline void htt_print_peer_details_tlv(const void *tag_buf, 732 struct debug_htt_stats_req *stats_req) 733 { 734 const struct htt_peer_details_tlv *htt_stats_buf = tag_buf; 735 u8 *buf = stats_req->buf; 736 u32 len = stats_req->buf_len; 737 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 738 739 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_PEER_DETAILS_TLV:"); 740 len += HTT_DBG_OUT(buf + len, buf_len - len, "peer_type = %u", 741 htt_stats_buf->peer_type); 742 len += HTT_DBG_OUT(buf + len, buf_len - len, "sw_peer_id = %u", 743 htt_stats_buf->sw_peer_id); 744 len += HTT_DBG_OUT(buf + len, buf_len - len, "vdev_id = %u", 745 htt_stats_buf->vdev_pdev_ast_idx & 0xFF); 746 len += HTT_DBG_OUT(buf + len, buf_len - len, "pdev_id = %u", 747 (htt_stats_buf->vdev_pdev_ast_idx & 0xFF00) >> 8); 748 len += HTT_DBG_OUT(buf + len, buf_len - len, "ast_idx = %u", 749 (htt_stats_buf->vdev_pdev_ast_idx & 0xFFFF0000) >> 16); 750 len += HTT_DBG_OUT(buf + len, buf_len - len, 751 "mac_addr = %02x:%02x:%02x:%02x:%02x:%02x", 752 htt_stats_buf->mac_addr.mac_addr_l32 & 0xFF, 753 (htt_stats_buf->mac_addr.mac_addr_l32 & 0xFF00) >> 8, 754 (htt_stats_buf->mac_addr.mac_addr_l32 & 0xFF0000) >> 16, 755 (htt_stats_buf->mac_addr.mac_addr_l32 & 0xFF000000) >> 24, 756 (htt_stats_buf->mac_addr.mac_addr_h16 & 0xFF), 757 (htt_stats_buf->mac_addr.mac_addr_h16 & 0xFF00) >> 8); 758 len += HTT_DBG_OUT(buf + len, buf_len - len, "peer_flags = 0x%x", 759 htt_stats_buf->peer_flags); 760 len += HTT_DBG_OUT(buf + len, buf_len - len, "qpeer_flags = 0x%x\n", 761 htt_stats_buf->qpeer_flags); 762 763 if (len >= buf_len) 764 buf[buf_len - 1] = 0; 765 else 766 buf[len] = 0; 767 768 stats_req->buf_len = len; 769 } 770 771 static inline void htt_print_tx_peer_rate_stats_tlv(const void *tag_buf, 772 struct debug_htt_stats_req *stats_req) 773 { 774 const struct htt_tx_peer_rate_stats_tlv *htt_stats_buf = tag_buf; 775 u8 *buf = stats_req->buf; 776 u32 len = stats_req->buf_len; 777 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 778 char str_buf[HTT_MAX_STRING_LEN] = {0}; 779 char *tx_gi[HTT_TX_PEER_STATS_NUM_GI_COUNTERS] = {NULL}; 780 u8 j; 781 782 for (j = 0; j < HTT_TX_PEER_STATS_NUM_GI_COUNTERS; j++) { 783 tx_gi[j] = kmalloc(HTT_MAX_STRING_LEN, GFP_ATOMIC); 784 if (!tx_gi[j]) 785 goto fail; 786 } 787 788 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_TX_PEER_RATE_STATS_TLV:"); 789 len += HTT_DBG_OUT(buf + len, buf_len - len, "tx_ldpc = %u", 790 htt_stats_buf->tx_ldpc); 791 len += HTT_DBG_OUT(buf + len, buf_len - len, "rts_cnt = %u", 792 htt_stats_buf->rts_cnt); 793 len += HTT_DBG_OUT(buf + len, buf_len - len, "ack_rssi = %u", 794 htt_stats_buf->ack_rssi); 795 796 memset(str_buf, 0x0, HTT_MAX_STRING_LEN); 797 ARRAY_TO_STRING(str_buf, htt_stats_buf->tx_mcs, 798 HTT_TX_PDEV_STATS_NUM_MCS_COUNTERS); 799 len += HTT_DBG_OUT(buf + len, buf_len - len, "tx_mcs = %s ", str_buf); 800 801 memset(str_buf, 0x0, HTT_MAX_STRING_LEN); 802 ARRAY_TO_STRING(str_buf, htt_stats_buf->tx_su_mcs, 803 HTT_TX_PDEV_STATS_NUM_MCS_COUNTERS); 804 len += HTT_DBG_OUT(buf + len, buf_len - len, "tx_su_mcs = %s ", str_buf); 805 806 memset(str_buf, 0x0, HTT_MAX_STRING_LEN); 807 ARRAY_TO_STRING(str_buf, htt_stats_buf->tx_mu_mcs, 808 HTT_TX_PDEV_STATS_NUM_MCS_COUNTERS); 809 len += HTT_DBG_OUT(buf + len, buf_len - len, "tx_mu_mcs = %s ", str_buf); 810 811 memset(str_buf, 0x0, HTT_MAX_STRING_LEN); 812 ARRAY_TO_STRING(str_buf, 813 htt_stats_buf->tx_nss, 814 HTT_TX_PDEV_STATS_NUM_SPATIAL_STREAMS); 815 len += HTT_DBG_OUT(buf + len, buf_len - len, "tx_nss = %s ", str_buf); 816 817 memset(str_buf, 0x0, HTT_MAX_STRING_LEN); 818 ARRAY_TO_STRING(str_buf, 819 htt_stats_buf->tx_bw, 820 HTT_TX_PDEV_STATS_NUM_BW_COUNTERS); 821 len += HTT_DBG_OUT(buf + len, buf_len - len, "tx_bw = %s ", str_buf); 822 823 memset(str_buf, 0x0, HTT_MAX_STRING_LEN); 824 ARRAY_TO_STRING(str_buf, htt_stats_buf->tx_stbc, 825 HTT_TX_PDEV_STATS_NUM_MCS_COUNTERS); 826 len += HTT_DBG_OUT(buf + len, buf_len - len, "tx_stbc = %s ", str_buf); 827 828 memset(str_buf, 0x0, HTT_MAX_STRING_LEN); 829 ARRAY_TO_STRING(str_buf, htt_stats_buf->tx_pream, 830 HTT_TX_PDEV_STATS_NUM_PREAMBLE_TYPES); 831 len += HTT_DBG_OUT(buf + len, buf_len - len, "tx_pream = %s ", str_buf); 832 833 for (j = 0; j < HTT_TX_PEER_STATS_NUM_GI_COUNTERS; j++) { 834 ARRAY_TO_STRING(tx_gi[j], 835 htt_stats_buf->tx_gi[j], 836 HTT_TX_PEER_STATS_NUM_MCS_COUNTERS); 837 len += HTT_DBG_OUT(buf + len, buf_len - len, "tx_gi[%u] = %s ", 838 j, tx_gi[j]); 839 } 840 841 memset(str_buf, 0x0, HTT_MAX_STRING_LEN); 842 ARRAY_TO_STRING(str_buf, 843 htt_stats_buf->tx_dcm, 844 HTT_TX_PDEV_STATS_NUM_DCM_COUNTERS); 845 len += HTT_DBG_OUT(buf + len, buf_len - len, "tx_dcm = %s\n", str_buf); 846 847 if (len >= buf_len) 848 buf[buf_len - 1] = 0; 849 else 850 buf[len] = 0; 851 852 stats_req->buf_len = len; 853 854 fail: 855 for (j = 0; j < HTT_TX_PEER_STATS_NUM_GI_COUNTERS; j++) 856 kfree(tx_gi[j]); 857 } 858 859 static inline void htt_print_rx_peer_rate_stats_tlv(const void *tag_buf, 860 struct debug_htt_stats_req *stats_req) 861 { 862 const struct htt_rx_peer_rate_stats_tlv *htt_stats_buf = tag_buf; 863 u8 *buf = stats_req->buf; 864 u32 len = stats_req->buf_len; 865 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 866 u8 j; 867 char *rssi_chain[HTT_RX_PEER_STATS_NUM_SPATIAL_STREAMS] = {NULL}; 868 char *rx_gi[HTT_RX_PEER_STATS_NUM_GI_COUNTERS] = {NULL}; 869 char str_buf[HTT_MAX_STRING_LEN] = {0}; 870 871 for (j = 0; j < HTT_RX_PEER_STATS_NUM_SPATIAL_STREAMS; j++) { 872 rssi_chain[j] = kmalloc(HTT_MAX_STRING_LEN, GFP_ATOMIC); 873 if (!rssi_chain[j]) 874 goto fail; 875 } 876 877 for (j = 0; j < HTT_RX_PEER_STATS_NUM_GI_COUNTERS; j++) { 878 rx_gi[j] = kmalloc(HTT_MAX_STRING_LEN, GFP_ATOMIC); 879 if (!rx_gi[j]) 880 goto fail; 881 } 882 883 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_RX_PEER_RATE_STATS_TLV:"); 884 len += HTT_DBG_OUT(buf + len, buf_len - len, "nsts = %u", 885 htt_stats_buf->nsts); 886 len += HTT_DBG_OUT(buf + len, buf_len - len, "rx_ldpc = %u", 887 htt_stats_buf->rx_ldpc); 888 len += HTT_DBG_OUT(buf + len, buf_len - len, "rts_cnt = %u", 889 htt_stats_buf->rts_cnt); 890 len += HTT_DBG_OUT(buf + len, buf_len - len, "rssi_mgmt = %u", 891 htt_stats_buf->rssi_mgmt); 892 len += HTT_DBG_OUT(buf + len, buf_len - len, "rssi_data = %u", 893 htt_stats_buf->rssi_data); 894 len += HTT_DBG_OUT(buf + len, buf_len - len, "rssi_comb = %u", 895 htt_stats_buf->rssi_comb); 896 897 memset(str_buf, 0x0, HTT_MAX_STRING_LEN); 898 ARRAY_TO_STRING(str_buf, htt_stats_buf->rx_mcs, 899 HTT_RX_PDEV_STATS_NUM_MCS_COUNTERS); 900 len += HTT_DBG_OUT(buf + len, buf_len - len, "rx_mcs = %s ", str_buf); 901 902 memset(str_buf, 0x0, HTT_MAX_STRING_LEN); 903 ARRAY_TO_STRING(str_buf, htt_stats_buf->rx_nss, 904 HTT_RX_PDEV_STATS_NUM_SPATIAL_STREAMS); 905 len += HTT_DBG_OUT(buf + len, buf_len - len, "rx_nss = %s ", str_buf); 906 907 memset(str_buf, 0x0, HTT_MAX_STRING_LEN); 908 ARRAY_TO_STRING(str_buf, htt_stats_buf->rx_dcm, 909 HTT_RX_PDEV_STATS_NUM_DCM_COUNTERS); 910 len += HTT_DBG_OUT(buf + len, buf_len - len, "rx_dcm = %s ", str_buf); 911 912 memset(str_buf, 0x0, HTT_MAX_STRING_LEN); 913 ARRAY_TO_STRING(str_buf, htt_stats_buf->rx_stbc, 914 HTT_RX_PDEV_STATS_NUM_MCS_COUNTERS); 915 len += HTT_DBG_OUT(buf + len, buf_len - len, "rx_stbc = %s ", str_buf); 916 917 memset(str_buf, 0x0, HTT_MAX_STRING_LEN); 918 ARRAY_TO_STRING(str_buf, htt_stats_buf->rx_bw, 919 HTT_RX_PDEV_STATS_NUM_BW_COUNTERS); 920 len += HTT_DBG_OUT(buf + len, buf_len - len, "rx_bw = %s ", str_buf); 921 922 for (j = 0; j < HTT_RX_PEER_STATS_NUM_SPATIAL_STREAMS; j++) { 923 ARRAY_TO_STRING(rssi_chain[j], htt_stats_buf->rssi_chain[j], 924 HTT_RX_PEER_STATS_NUM_BW_COUNTERS); 925 len += HTT_DBG_OUT(buf + len, buf_len - len, "rssi_chain[%u] = %s ", 926 j, rssi_chain[j]); 927 } 928 929 for (j = 0; j < HTT_RX_PEER_STATS_NUM_GI_COUNTERS; j++) { 930 ARRAY_TO_STRING(rx_gi[j], htt_stats_buf->rx_gi[j], 931 HTT_RX_PDEV_STATS_NUM_MCS_COUNTERS); 932 len += HTT_DBG_OUT(buf + len, buf_len - len, "rx_gi[%u] = %s ", 933 j, rx_gi[j]); 934 } 935 936 memset(str_buf, 0x0, HTT_MAX_STRING_LEN); 937 ARRAY_TO_STRING(str_buf, htt_stats_buf->rx_pream, 938 HTT_RX_PDEV_STATS_NUM_PREAMBLE_TYPES); 939 len += HTT_DBG_OUT(buf + len, buf_len - len, "rx_pream = %s\n", str_buf); 940 941 if (len >= buf_len) 942 buf[buf_len - 1] = 0; 943 else 944 buf[len] = 0; 945 946 stats_req->buf_len = len; 947 948 fail: 949 for (j = 0; j < HTT_RX_PEER_STATS_NUM_SPATIAL_STREAMS; j++) 950 kfree(rssi_chain[j]); 951 952 for (j = 0; j < HTT_RX_PEER_STATS_NUM_GI_COUNTERS; j++) 953 kfree(rx_gi[j]); 954 } 955 956 static inline void 957 htt_print_tx_hwq_mu_mimo_sch_stats_tlv(const void *tag_buf, 958 struct debug_htt_stats_req *stats_req) 959 { 960 const struct htt_tx_hwq_mu_mimo_sch_stats_tlv *htt_stats_buf = tag_buf; 961 u8 *buf = stats_req->buf; 962 u32 len = stats_req->buf_len; 963 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 964 965 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_TX_HWQ_MU_MIMO_SCH_STATS_TLV:"); 966 len += HTT_DBG_OUT(buf + len, buf_len - len, "mu_mimo_sch_posted = %u", 967 htt_stats_buf->mu_mimo_sch_posted); 968 len += HTT_DBG_OUT(buf + len, buf_len - len, "mu_mimo_sch_failed = %u", 969 htt_stats_buf->mu_mimo_sch_failed); 970 len += HTT_DBG_OUT(buf + len, buf_len - len, "mu_mimo_ppdu_posted = %u\n", 971 htt_stats_buf->mu_mimo_ppdu_posted); 972 973 if (len >= buf_len) 974 buf[buf_len - 1] = 0; 975 else 976 buf[len] = 0; 977 978 stats_req->buf_len = len; 979 } 980 981 static inline void 982 htt_print_tx_hwq_mu_mimo_mpdu_stats_tlv(const void *tag_buf, 983 struct debug_htt_stats_req *stats_req) 984 { 985 const struct htt_tx_hwq_mu_mimo_mpdu_stats_tlv *htt_stats_buf = tag_buf; 986 u8 *buf = stats_req->buf; 987 u32 len = stats_req->buf_len; 988 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 989 990 len += HTT_DBG_OUT(buf + len, buf_len - len, 991 "HTT_TX_HWQ_MU_MIMO_MPDU_STATS_TLV:"); 992 len += HTT_DBG_OUT(buf + len, buf_len - len, "mu_mimo_mpdus_queued_usr = %u", 993 htt_stats_buf->mu_mimo_mpdus_queued_usr); 994 len += HTT_DBG_OUT(buf + len, buf_len - len, "mu_mimo_mpdus_tried_usr = %u", 995 htt_stats_buf->mu_mimo_mpdus_tried_usr); 996 len += HTT_DBG_OUT(buf + len, buf_len - len, "mu_mimo_mpdus_failed_usr = %u", 997 htt_stats_buf->mu_mimo_mpdus_failed_usr); 998 len += HTT_DBG_OUT(buf + len, buf_len - len, "mu_mimo_mpdus_requeued_usr = %u", 999 htt_stats_buf->mu_mimo_mpdus_requeued_usr); 1000 len += HTT_DBG_OUT(buf + len, buf_len - len, "mu_mimo_err_no_ba_usr = %u", 1001 htt_stats_buf->mu_mimo_err_no_ba_usr); 1002 len += HTT_DBG_OUT(buf + len, buf_len - len, "mu_mimo_mpdu_underrun_usr = %u", 1003 htt_stats_buf->mu_mimo_mpdu_underrun_usr); 1004 len += HTT_DBG_OUT(buf + len, buf_len - len, "mu_mimo_ampdu_underrun_usr = %u\n", 1005 htt_stats_buf->mu_mimo_ampdu_underrun_usr); 1006 1007 if (len >= buf_len) 1008 buf[buf_len - 1] = 0; 1009 else 1010 buf[len] = 0; 1011 1012 stats_req->buf_len = len; 1013 } 1014 1015 static inline void 1016 htt_print_tx_hwq_mu_mimo_cmn_stats_tlv(const void *tag_buf, 1017 struct debug_htt_stats_req *stats_req) 1018 { 1019 const struct htt_tx_hwq_mu_mimo_cmn_stats_tlv *htt_stats_buf = tag_buf; 1020 u8 *buf = stats_req->buf; 1021 u32 len = stats_req->buf_len; 1022 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 1023 1024 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_TX_HWQ_MU_MIMO_CMN_STATS_TLV:"); 1025 len += HTT_DBG_OUT(buf + len, buf_len - len, "mac_id = %u", 1026 htt_stats_buf->mac_id__hwq_id__word & 0xFF); 1027 len += HTT_DBG_OUT(buf + len, buf_len - len, "hwq_id = %u\n", 1028 (htt_stats_buf->mac_id__hwq_id__word & 0xFF00) >> 8); 1029 1030 if (len >= buf_len) 1031 buf[buf_len - 1] = 0; 1032 else 1033 buf[len] = 0; 1034 1035 stats_req->buf_len = len; 1036 } 1037 1038 static inline void 1039 htt_print_tx_hwq_stats_cmn_tlv(const void *tag_buf, struct debug_htt_stats_req *stats_req) 1040 { 1041 const struct htt_tx_hwq_stats_cmn_tlv *htt_stats_buf = tag_buf; 1042 u8 *buf = stats_req->buf; 1043 u32 len = stats_req->buf_len; 1044 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 1045 1046 /* TODO: HKDBG */ 1047 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_TX_HWQ_STATS_CMN_TLV:"); 1048 len += HTT_DBG_OUT(buf + len, buf_len - len, "mac_id = %u", 1049 htt_stats_buf->mac_id__hwq_id__word & 0xFF); 1050 len += HTT_DBG_OUT(buf + len, buf_len - len, "hwq_id = %u", 1051 (htt_stats_buf->mac_id__hwq_id__word & 0xFF00) >> 8); 1052 len += HTT_DBG_OUT(buf + len, buf_len - len, "xretry = %u", 1053 htt_stats_buf->xretry); 1054 len += HTT_DBG_OUT(buf + len, buf_len - len, "underrun_cnt = %u", 1055 htt_stats_buf->underrun_cnt); 1056 len += HTT_DBG_OUT(buf + len, buf_len - len, "flush_cnt = %u", 1057 htt_stats_buf->flush_cnt); 1058 len += HTT_DBG_OUT(buf + len, buf_len - len, "filt_cnt = %u", 1059 htt_stats_buf->filt_cnt); 1060 len += HTT_DBG_OUT(buf + len, buf_len - len, "null_mpdu_bmap = %u", 1061 htt_stats_buf->null_mpdu_bmap); 1062 len += HTT_DBG_OUT(buf + len, buf_len - len, "user_ack_failure = %u", 1063 htt_stats_buf->user_ack_failure); 1064 len += HTT_DBG_OUT(buf + len, buf_len - len, "ack_tlv_proc = %u", 1065 htt_stats_buf->ack_tlv_proc); 1066 len += HTT_DBG_OUT(buf + len, buf_len - len, "sched_id_proc = %u", 1067 htt_stats_buf->sched_id_proc); 1068 len += HTT_DBG_OUT(buf + len, buf_len - len, "null_mpdu_tx_count = %u", 1069 htt_stats_buf->null_mpdu_tx_count); 1070 len += HTT_DBG_OUT(buf + len, buf_len - len, "mpdu_bmap_not_recvd = %u", 1071 htt_stats_buf->mpdu_bmap_not_recvd); 1072 len += HTT_DBG_OUT(buf + len, buf_len - len, "num_bar = %u", 1073 htt_stats_buf->num_bar); 1074 len += HTT_DBG_OUT(buf + len, buf_len - len, "rts = %u", 1075 htt_stats_buf->rts); 1076 len += HTT_DBG_OUT(buf + len, buf_len - len, "cts2self = %u", 1077 htt_stats_buf->cts2self); 1078 len += HTT_DBG_OUT(buf + len, buf_len - len, "qos_null = %u", 1079 htt_stats_buf->qos_null); 1080 len += HTT_DBG_OUT(buf + len, buf_len - len, "mpdu_tried_cnt = %u", 1081 htt_stats_buf->mpdu_tried_cnt); 1082 len += HTT_DBG_OUT(buf + len, buf_len - len, "mpdu_queued_cnt = %u", 1083 htt_stats_buf->mpdu_queued_cnt); 1084 len += HTT_DBG_OUT(buf + len, buf_len - len, "mpdu_ack_fail_cnt = %u", 1085 htt_stats_buf->mpdu_ack_fail_cnt); 1086 len += HTT_DBG_OUT(buf + len, buf_len - len, "mpdu_filt_cnt = %u", 1087 htt_stats_buf->mpdu_filt_cnt); 1088 len += HTT_DBG_OUT(buf + len, buf_len - len, "false_mpdu_ack_count = %u", 1089 htt_stats_buf->false_mpdu_ack_count); 1090 len += HTT_DBG_OUT(buf + len, buf_len - len, "txq_timeout = %u\n", 1091 htt_stats_buf->txq_timeout); 1092 1093 if (len >= buf_len) 1094 buf[buf_len - 1] = 0; 1095 else 1096 buf[len] = 0; 1097 1098 stats_req->buf_len = len; 1099 } 1100 1101 static inline void 1102 htt_print_tx_hwq_difs_latency_stats_tlv_v(const void *tag_buf, 1103 u16 tag_len, 1104 struct debug_htt_stats_req *stats_req) 1105 { 1106 const struct htt_tx_hwq_difs_latency_stats_tlv_v *htt_stats_buf = tag_buf; 1107 u8 *buf = stats_req->buf; 1108 u32 len = stats_req->buf_len; 1109 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 1110 u16 data_len = min_t(u16, (tag_len >> 2), HTT_TX_HWQ_MAX_DIFS_LATENCY_BINS); 1111 char difs_latency_hist[HTT_MAX_STRING_LEN] = {0}; 1112 1113 len += HTT_DBG_OUT(buf + len, buf_len - len, 1114 "HTT_TX_HWQ_DIFS_LATENCY_STATS_TLV_V:"); 1115 len += HTT_DBG_OUT(buf + len, buf_len - len, "hist_intvl = %u", 1116 htt_stats_buf->hist_intvl); 1117 1118 ARRAY_TO_STRING(difs_latency_hist, htt_stats_buf->difs_latency_hist, 1119 data_len); 1120 len += HTT_DBG_OUT(buf + len, buf_len - len, "difs_latency_hist = %s\n", 1121 difs_latency_hist); 1122 1123 if (len >= buf_len) 1124 buf[buf_len - 1] = 0; 1125 else 1126 buf[len] = 0; 1127 1128 stats_req->buf_len = len; 1129 } 1130 1131 static inline void 1132 htt_print_tx_hwq_cmd_result_stats_tlv_v(const void *tag_buf, 1133 u16 tag_len, 1134 struct debug_htt_stats_req *stats_req) 1135 { 1136 const struct htt_tx_hwq_cmd_result_stats_tlv_v *htt_stats_buf = tag_buf; 1137 u8 *buf = stats_req->buf; 1138 u32 len = stats_req->buf_len; 1139 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 1140 u16 data_len; 1141 char cmd_result[HTT_MAX_STRING_LEN] = {0}; 1142 1143 data_len = min_t(u16, (tag_len >> 2), HTT_TX_HWQ_MAX_CMD_RESULT_STATS); 1144 1145 len += HTT_DBG_OUT(buf + len, buf_len - len, 1146 "HTT_TX_HWQ_CMD_RESULT_STATS_TLV_V:"); 1147 1148 ARRAY_TO_STRING(cmd_result, htt_stats_buf->cmd_result, data_len); 1149 1150 len += HTT_DBG_OUT(buf + len, buf_len - len, "cmd_result = %s\n", cmd_result); 1151 1152 if (len >= buf_len) 1153 buf[buf_len - 1] = 0; 1154 else 1155 buf[len] = 0; 1156 1157 stats_req->buf_len = len; 1158 } 1159 1160 static inline void 1161 htt_print_tx_hwq_cmd_stall_stats_tlv_v(const void *tag_buf, 1162 u16 tag_len, 1163 struct debug_htt_stats_req *stats_req) 1164 { 1165 const struct htt_tx_hwq_cmd_stall_stats_tlv_v *htt_stats_buf = tag_buf; 1166 u8 *buf = stats_req->buf; 1167 u32 len = stats_req->buf_len; 1168 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 1169 u16 num_elems; 1170 char cmd_stall_status[HTT_MAX_STRING_LEN] = {0}; 1171 1172 num_elems = min_t(u16, (tag_len >> 2), HTT_TX_HWQ_MAX_CMD_STALL_STATS); 1173 1174 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_TX_HWQ_CMD_STALL_STATS_TLV_V:"); 1175 1176 ARRAY_TO_STRING(cmd_stall_status, htt_stats_buf->cmd_stall_status, num_elems); 1177 len += HTT_DBG_OUT(buf + len, buf_len - len, "cmd_stall_status = %s\n", 1178 cmd_stall_status); 1179 1180 if (len >= buf_len) 1181 buf[buf_len - 1] = 0; 1182 else 1183 buf[len] = 0; 1184 1185 stats_req->buf_len = len; 1186 } 1187 1188 static inline void 1189 htt_print_tx_hwq_fes_result_stats_tlv_v(const void *tag_buf, 1190 u16 tag_len, 1191 struct debug_htt_stats_req *stats_req) 1192 { 1193 const struct htt_tx_hwq_fes_result_stats_tlv_v *htt_stats_buf = tag_buf; 1194 u8 *buf = stats_req->buf; 1195 u32 len = stats_req->buf_len; 1196 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 1197 u16 num_elems; 1198 char fes_result[HTT_MAX_STRING_LEN] = {0}; 1199 1200 num_elems = min_t(u16, (tag_len >> 2), HTT_TX_HWQ_MAX_FES_RESULT_STATS); 1201 1202 len += HTT_DBG_OUT(buf + len, buf_len - len, 1203 "HTT_TX_HWQ_FES_RESULT_STATS_TLV_V:"); 1204 1205 ARRAY_TO_STRING(fes_result, htt_stats_buf->fes_result, num_elems); 1206 len += HTT_DBG_OUT(buf + len, buf_len - len, "fes_result = %s\n", fes_result); 1207 1208 if (len >= buf_len) 1209 buf[buf_len - 1] = 0; 1210 else 1211 buf[len] = 0; 1212 1213 stats_req->buf_len = len; 1214 } 1215 1216 static inline void 1217 htt_print_tx_hwq_tried_mpdu_cnt_hist_tlv_v(const void *tag_buf, 1218 u16 tag_len, 1219 struct debug_htt_stats_req *stats_req) 1220 { 1221 const struct htt_tx_hwq_tried_mpdu_cnt_hist_tlv_v *htt_stats_buf = tag_buf; 1222 u8 *buf = stats_req->buf; 1223 u32 len = stats_req->buf_len; 1224 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 1225 char tried_mpdu_cnt_hist[HTT_MAX_STRING_LEN] = {0}; 1226 u32 num_elements = ((tag_len - 1227 sizeof(htt_stats_buf->hist_bin_size)) >> 2); 1228 u32 required_buffer_size = HTT_MAX_PRINT_CHAR_PER_ELEM * num_elements; 1229 1230 len += HTT_DBG_OUT(buf + len, buf_len - len, 1231 "HTT_TX_HWQ_TRIED_MPDU_CNT_HIST_TLV_V:"); 1232 len += HTT_DBG_OUT(buf + len, buf_len - len, "TRIED_MPDU_CNT_HIST_BIN_SIZE : %u", 1233 htt_stats_buf->hist_bin_size); 1234 1235 if (required_buffer_size < HTT_MAX_STRING_LEN) { 1236 ARRAY_TO_STRING(tried_mpdu_cnt_hist, 1237 htt_stats_buf->tried_mpdu_cnt_hist, 1238 num_elements); 1239 len += HTT_DBG_OUT(buf + len, buf_len - len, 1240 "tried_mpdu_cnt_hist = %s\n", 1241 tried_mpdu_cnt_hist); 1242 } else { 1243 len += HTT_DBG_OUT(buf + len, buf_len - len, 1244 "INSUFFICIENT PRINT BUFFER "); 1245 } 1246 1247 if (len >= buf_len) 1248 buf[buf_len - 1] = 0; 1249 else 1250 buf[len] = 0; 1251 1252 stats_req->buf_len = len; 1253 } 1254 1255 static inline void 1256 htt_print_tx_hwq_txop_used_cnt_hist_tlv_v(const void *tag_buf, 1257 u16 tag_len, 1258 struct debug_htt_stats_req *stats_req) 1259 { 1260 const struct htt_tx_hwq_txop_used_cnt_hist_tlv_v *htt_stats_buf = tag_buf; 1261 u8 *buf = stats_req->buf; 1262 u32 len = stats_req->buf_len; 1263 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 1264 char txop_used_cnt_hist[HTT_MAX_STRING_LEN] = {0}; 1265 u32 num_elements = tag_len >> 2; 1266 u32 required_buffer_size = HTT_MAX_PRINT_CHAR_PER_ELEM * num_elements; 1267 1268 len += HTT_DBG_OUT(buf + len, buf_len - len, 1269 "HTT_TX_HWQ_TXOP_USED_CNT_HIST_TLV_V:"); 1270 1271 if (required_buffer_size < HTT_MAX_STRING_LEN) { 1272 ARRAY_TO_STRING(txop_used_cnt_hist, 1273 htt_stats_buf->txop_used_cnt_hist, 1274 num_elements); 1275 len += HTT_DBG_OUT(buf + len, buf_len - len, "txop_used_cnt_hist = %s\n", 1276 txop_used_cnt_hist); 1277 } else { 1278 len += HTT_DBG_OUT(buf + len, buf_len - len, 1279 "INSUFFICIENT PRINT BUFFER "); 1280 } 1281 if (len >= buf_len) 1282 buf[buf_len - 1] = 0; 1283 else 1284 buf[len] = 0; 1285 1286 stats_req->buf_len = len; 1287 } 1288 1289 static inline void htt_print_tx_sounding_stats_tlv(const void *tag_buf, 1290 struct debug_htt_stats_req *stats_req) 1291 { 1292 s32 i; 1293 const struct htt_tx_sounding_stats_tlv *htt_stats_buf = tag_buf; 1294 u8 *buf = stats_req->buf; 1295 u32 len = stats_req->buf_len; 1296 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 1297 const u32 *cbf_20 = htt_stats_buf->cbf_20; 1298 const u32 *cbf_40 = htt_stats_buf->cbf_40; 1299 const u32 *cbf_80 = htt_stats_buf->cbf_80; 1300 const u32 *cbf_160 = htt_stats_buf->cbf_160; 1301 1302 if (htt_stats_buf->tx_sounding_mode == HTT_TX_AC_SOUNDING_MODE) { 1303 len += HTT_DBG_OUT(buf + len, buf_len - len, 1304 "\nHTT_TX_AC_SOUNDING_STATS_TLV:\n"); 1305 len += HTT_DBG_OUT(buf + len, buf_len - len, 1306 "ac_cbf_20 = IBF : %u, SU_SIFS : %u, SU_RBO : %u, MU_SIFS : %u, MU_RBO : %u ", 1307 cbf_20[HTT_IMPLICIT_TXBF_STEER_STATS], 1308 cbf_20[HTT_EXPLICIT_TXBF_SU_SIFS_STEER_STATS], 1309 cbf_20[HTT_EXPLICIT_TXBF_SU_RBO_STEER_STATS], 1310 cbf_20[HTT_EXPLICIT_TXBF_MU_SIFS_STEER_STATS], 1311 cbf_20[HTT_EXPLICIT_TXBF_MU_RBO_STEER_STATS]); 1312 len += HTT_DBG_OUT(buf + len, buf_len - len, 1313 "ac_cbf_40 = IBF : %u, SU_SIFS : %u, SU_RBO : %u, MU_SIFS : %u, MU_RBO : %u", 1314 cbf_40[HTT_IMPLICIT_TXBF_STEER_STATS], 1315 cbf_40[HTT_EXPLICIT_TXBF_SU_SIFS_STEER_STATS], 1316 cbf_40[HTT_EXPLICIT_TXBF_SU_RBO_STEER_STATS], 1317 cbf_40[HTT_EXPLICIT_TXBF_MU_SIFS_STEER_STATS], 1318 cbf_40[HTT_EXPLICIT_TXBF_MU_RBO_STEER_STATS]); 1319 len += HTT_DBG_OUT(buf + len, buf_len - len, 1320 "ac_cbf_80 = IBF : %u, SU_SIFS : %u, SU_RBO : %u, MU_SIFS : %u, MU_RBO : %u", 1321 cbf_80[HTT_IMPLICIT_TXBF_STEER_STATS], 1322 cbf_80[HTT_EXPLICIT_TXBF_SU_SIFS_STEER_STATS], 1323 cbf_80[HTT_EXPLICIT_TXBF_SU_RBO_STEER_STATS], 1324 cbf_80[HTT_EXPLICIT_TXBF_MU_SIFS_STEER_STATS], 1325 cbf_80[HTT_EXPLICIT_TXBF_MU_RBO_STEER_STATS]); 1326 len += HTT_DBG_OUT(buf + len, buf_len - len, 1327 "ac_cbf_160 = IBF : %u, SU_SIFS : %u, SU_RBO : %u, MU_SIFS : %u, MU_RBO : %u", 1328 cbf_160[HTT_IMPLICIT_TXBF_STEER_STATS], 1329 cbf_160[HTT_EXPLICIT_TXBF_SU_SIFS_STEER_STATS], 1330 cbf_160[HTT_EXPLICIT_TXBF_SU_RBO_STEER_STATS], 1331 cbf_160[HTT_EXPLICIT_TXBF_MU_SIFS_STEER_STATS], 1332 cbf_160[HTT_EXPLICIT_TXBF_MU_RBO_STEER_STATS]); 1333 1334 for (i = 0; i < HTT_TX_PDEV_STATS_NUM_AC_MUMIMO_USER_STATS; i++) { 1335 len += HTT_DBG_OUT(buf + len, buf_len - len, 1336 "Sounding User %u = 20MHz: %u, 40MHz : %u, 80MHz: %u, 160MHz: %u ", 1337 i, 1338 htt_stats_buf->sounding[0], 1339 htt_stats_buf->sounding[1], 1340 htt_stats_buf->sounding[2], 1341 htt_stats_buf->sounding[3]); 1342 } 1343 } else if (htt_stats_buf->tx_sounding_mode == HTT_TX_AX_SOUNDING_MODE) { 1344 len += HTT_DBG_OUT(buf + len, buf_len - len, 1345 "\nHTT_TX_AX_SOUNDING_STATS_TLV:\n"); 1346 len += HTT_DBG_OUT(buf + len, buf_len - len, 1347 "ax_cbf_20 = IBF : %u, SU_SIFS : %u, SU_RBO : %u, MU_SIFS : %u, MU_RBO : %u ", 1348 cbf_20[HTT_IMPLICIT_TXBF_STEER_STATS], 1349 cbf_20[HTT_EXPLICIT_TXBF_SU_SIFS_STEER_STATS], 1350 cbf_20[HTT_EXPLICIT_TXBF_SU_RBO_STEER_STATS], 1351 cbf_20[HTT_EXPLICIT_TXBF_MU_SIFS_STEER_STATS], 1352 cbf_20[HTT_EXPLICIT_TXBF_MU_RBO_STEER_STATS]); 1353 len += HTT_DBG_OUT(buf + len, buf_len - len, 1354 "ax_cbf_40 = IBF : %u, SU_SIFS : %u, SU_RBO : %u, MU_SIFS : %u, MU_RBO : %u", 1355 cbf_40[HTT_IMPLICIT_TXBF_STEER_STATS], 1356 cbf_40[HTT_EXPLICIT_TXBF_SU_SIFS_STEER_STATS], 1357 cbf_40[HTT_EXPLICIT_TXBF_SU_RBO_STEER_STATS], 1358 cbf_40[HTT_EXPLICIT_TXBF_MU_SIFS_STEER_STATS], 1359 cbf_40[HTT_EXPLICIT_TXBF_MU_RBO_STEER_STATS]); 1360 len += HTT_DBG_OUT(buf + len, buf_len - len, 1361 "ax_cbf_80 = IBF : %u, SU_SIFS : %u, SU_RBO : %u, MU_SIFS : %u, MU_RBO : %u", 1362 cbf_80[HTT_IMPLICIT_TXBF_STEER_STATS], 1363 cbf_80[HTT_EXPLICIT_TXBF_SU_SIFS_STEER_STATS], 1364 cbf_80[HTT_EXPLICIT_TXBF_SU_RBO_STEER_STATS], 1365 cbf_80[HTT_EXPLICIT_TXBF_MU_SIFS_STEER_STATS], 1366 cbf_80[HTT_EXPLICIT_TXBF_MU_RBO_STEER_STATS]); 1367 len += HTT_DBG_OUT(buf + len, buf_len - len, 1368 "ax_cbf_160 = IBF : %u, SU_SIFS : %u, SU_RBO : %u, MU_SIFS : %u, MU_RBO : %u", 1369 cbf_160[HTT_IMPLICIT_TXBF_STEER_STATS], 1370 cbf_160[HTT_EXPLICIT_TXBF_SU_SIFS_STEER_STATS], 1371 cbf_160[HTT_EXPLICIT_TXBF_SU_RBO_STEER_STATS], 1372 cbf_160[HTT_EXPLICIT_TXBF_MU_SIFS_STEER_STATS], 1373 cbf_160[HTT_EXPLICIT_TXBF_MU_RBO_STEER_STATS]); 1374 1375 for (i = 0; i < HTT_TX_PDEV_STATS_NUM_AX_MUMIMO_USER_STATS; i++) { 1376 len += HTT_DBG_OUT(buf + len, buf_len - len, 1377 "Sounding User %u = 20MHz: %u, 40MHz : %u, 80MHz: %u, 160MHz: %u ", 1378 i, 1379 htt_stats_buf->sounding[0], 1380 htt_stats_buf->sounding[1], 1381 htt_stats_buf->sounding[2], 1382 htt_stats_buf->sounding[3]); 1383 } 1384 } 1385 1386 if (len >= buf_len) 1387 buf[buf_len - 1] = 0; 1388 else 1389 buf[len] = 0; 1390 1391 stats_req->buf_len = len; 1392 } 1393 1394 static inline void 1395 htt_print_tx_selfgen_cmn_stats_tlv(const void *tag_buf, 1396 struct debug_htt_stats_req *stats_req) 1397 { 1398 const struct htt_tx_selfgen_cmn_stats_tlv *htt_stats_buf = tag_buf; 1399 u8 *buf = stats_req->buf; 1400 u32 len = stats_req->buf_len; 1401 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 1402 1403 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_TX_SELFGEN_CMN_STATS_TLV:"); 1404 len += HTT_DBG_OUT(buf + len, buf_len - len, "mac_id = %u", 1405 htt_stats_buf->mac_id__word & 0xFF); 1406 len += HTT_DBG_OUT(buf + len, buf_len - len, "su_bar = %u", 1407 htt_stats_buf->su_bar); 1408 len += HTT_DBG_OUT(buf + len, buf_len - len, "rts = %u", 1409 htt_stats_buf->rts); 1410 len += HTT_DBG_OUT(buf + len, buf_len - len, "cts2self = %u", 1411 htt_stats_buf->cts2self); 1412 len += HTT_DBG_OUT(buf + len, buf_len - len, "qos_null = %u", 1413 htt_stats_buf->qos_null); 1414 len += HTT_DBG_OUT(buf + len, buf_len - len, "delayed_bar_1 = %u", 1415 htt_stats_buf->delayed_bar_1); 1416 len += HTT_DBG_OUT(buf + len, buf_len - len, "delayed_bar_2 = %u", 1417 htt_stats_buf->delayed_bar_2); 1418 len += HTT_DBG_OUT(buf + len, buf_len - len, "delayed_bar_3 = %u", 1419 htt_stats_buf->delayed_bar_3); 1420 len += HTT_DBG_OUT(buf + len, buf_len - len, "delayed_bar_4 = %u", 1421 htt_stats_buf->delayed_bar_4); 1422 len += HTT_DBG_OUT(buf + len, buf_len - len, "delayed_bar_5 = %u", 1423 htt_stats_buf->delayed_bar_5); 1424 len += HTT_DBG_OUT(buf + len, buf_len - len, "delayed_bar_6 = %u", 1425 htt_stats_buf->delayed_bar_6); 1426 len += HTT_DBG_OUT(buf + len, buf_len - len, "delayed_bar_7 = %u\n", 1427 htt_stats_buf->delayed_bar_7); 1428 1429 if (len >= buf_len) 1430 buf[buf_len - 1] = 0; 1431 else 1432 buf[len] = 0; 1433 1434 stats_req->buf_len = len; 1435 } 1436 1437 static inline void 1438 htt_print_tx_selfgen_ac_stats_tlv(const void *tag_buf, 1439 struct debug_htt_stats_req *stats_req) 1440 { 1441 const struct htt_tx_selfgen_ac_stats_tlv *htt_stats_buf = tag_buf; 1442 u8 *buf = stats_req->buf; 1443 u32 len = stats_req->buf_len; 1444 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 1445 1446 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_TX_SELFGEN_AC_STATS_TLV:"); 1447 len += HTT_DBG_OUT(buf + len, buf_len - len, "ac_su_ndpa = %u", 1448 htt_stats_buf->ac_su_ndpa); 1449 len += HTT_DBG_OUT(buf + len, buf_len - len, "ac_su_ndp = %u", 1450 htt_stats_buf->ac_su_ndp); 1451 len += HTT_DBG_OUT(buf + len, buf_len - len, "ac_mu_mimo_ndpa = %u", 1452 htt_stats_buf->ac_mu_mimo_ndpa); 1453 len += HTT_DBG_OUT(buf + len, buf_len - len, "ac_mu_mimo_ndp = %u", 1454 htt_stats_buf->ac_mu_mimo_ndp); 1455 len += HTT_DBG_OUT(buf + len, buf_len - len, "ac_mu_mimo_brpoll_1 = %u", 1456 htt_stats_buf->ac_mu_mimo_brpoll_1); 1457 len += HTT_DBG_OUT(buf + len, buf_len - len, "ac_mu_mimo_brpoll_2 = %u", 1458 htt_stats_buf->ac_mu_mimo_brpoll_2); 1459 len += HTT_DBG_OUT(buf + len, buf_len - len, "ac_mu_mimo_brpoll_3 = %u\n", 1460 htt_stats_buf->ac_mu_mimo_brpoll_3); 1461 1462 if (len >= buf_len) 1463 buf[buf_len - 1] = 0; 1464 else 1465 buf[len] = 0; 1466 1467 stats_req->buf_len = len; 1468 } 1469 1470 static inline void 1471 htt_print_tx_selfgen_ax_stats_tlv(const void *tag_buf, 1472 struct debug_htt_stats_req *stats_req) 1473 { 1474 const struct htt_tx_selfgen_ax_stats_tlv *htt_stats_buf = tag_buf; 1475 u8 *buf = stats_req->buf; 1476 u32 len = stats_req->buf_len; 1477 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 1478 1479 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_TX_SELFGEN_AX_STATS_TLV:"); 1480 len += HTT_DBG_OUT(buf + len, buf_len - len, "ax_su_ndpa = %u", 1481 htt_stats_buf->ax_su_ndpa); 1482 len += HTT_DBG_OUT(buf + len, buf_len - len, "ax_su_ndp = %u", 1483 htt_stats_buf->ax_su_ndp); 1484 len += HTT_DBG_OUT(buf + len, buf_len - len, "ax_mu_mimo_ndpa = %u", 1485 htt_stats_buf->ax_mu_mimo_ndpa); 1486 len += HTT_DBG_OUT(buf + len, buf_len - len, "ax_mu_mimo_ndp = %u", 1487 htt_stats_buf->ax_mu_mimo_ndp); 1488 len += HTT_DBG_OUT(buf + len, buf_len - len, "ax_mu_mimo_brpoll_1 = %u", 1489 htt_stats_buf->ax_mu_mimo_brpoll_1); 1490 len += HTT_DBG_OUT(buf + len, buf_len - len, "ax_mu_mimo_brpoll_2 = %u", 1491 htt_stats_buf->ax_mu_mimo_brpoll_2); 1492 len += HTT_DBG_OUT(buf + len, buf_len - len, "ax_mu_mimo_brpoll_3 = %u", 1493 htt_stats_buf->ax_mu_mimo_brpoll_3); 1494 len += HTT_DBG_OUT(buf + len, buf_len - len, "ax_mu_mimo_brpoll_4 = %u", 1495 htt_stats_buf->ax_mu_mimo_brpoll_4); 1496 len += HTT_DBG_OUT(buf + len, buf_len - len, "ax_mu_mimo_brpoll_5 = %u", 1497 htt_stats_buf->ax_mu_mimo_brpoll_5); 1498 len += HTT_DBG_OUT(buf + len, buf_len - len, "ax_mu_mimo_brpoll_6 = %u", 1499 htt_stats_buf->ax_mu_mimo_brpoll_6); 1500 len += HTT_DBG_OUT(buf + len, buf_len - len, "ax_mu_mimo_brpoll_7 = %u", 1501 htt_stats_buf->ax_mu_mimo_brpoll_7); 1502 len += HTT_DBG_OUT(buf + len, buf_len - len, "ax_basic_trigger = %u", 1503 htt_stats_buf->ax_basic_trigger); 1504 len += HTT_DBG_OUT(buf + len, buf_len - len, "ax_bsr_trigger = %u", 1505 htt_stats_buf->ax_bsr_trigger); 1506 len += HTT_DBG_OUT(buf + len, buf_len - len, "ax_mu_bar_trigger = %u", 1507 htt_stats_buf->ax_mu_bar_trigger); 1508 len += HTT_DBG_OUT(buf + len, buf_len - len, "ax_mu_rts_trigger = %u\n", 1509 htt_stats_buf->ax_mu_rts_trigger); 1510 1511 if (len >= buf_len) 1512 buf[buf_len - 1] = 0; 1513 else 1514 buf[len] = 0; 1515 1516 stats_req->buf_len = len; 1517 } 1518 1519 static inline void 1520 htt_print_tx_selfgen_ac_err_stats_tlv(const void *tag_buf, 1521 struct debug_htt_stats_req *stats_req) 1522 { 1523 const struct htt_tx_selfgen_ac_err_stats_tlv *htt_stats_buf = tag_buf; 1524 u8 *buf = stats_req->buf; 1525 u32 len = stats_req->buf_len; 1526 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 1527 1528 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_TX_SELFGEN_AC_ERR_STATS_TLV:"); 1529 len += HTT_DBG_OUT(buf + len, buf_len - len, "ac_su_ndp_err = %u", 1530 htt_stats_buf->ac_su_ndp_err); 1531 len += HTT_DBG_OUT(buf + len, buf_len - len, "ac_su_ndpa_err = %u", 1532 htt_stats_buf->ac_su_ndpa_err); 1533 len += HTT_DBG_OUT(buf + len, buf_len - len, "ac_mu_mimo_ndpa_err = %u", 1534 htt_stats_buf->ac_mu_mimo_ndpa_err); 1535 len += HTT_DBG_OUT(buf + len, buf_len - len, "ac_mu_mimo_ndp_err = %u", 1536 htt_stats_buf->ac_mu_mimo_ndp_err); 1537 len += HTT_DBG_OUT(buf + len, buf_len - len, "ac_mu_mimo_brp1_err = %u", 1538 htt_stats_buf->ac_mu_mimo_brp1_err); 1539 len += HTT_DBG_OUT(buf + len, buf_len - len, "ac_mu_mimo_brp2_err = %u", 1540 htt_stats_buf->ac_mu_mimo_brp2_err); 1541 len += HTT_DBG_OUT(buf + len, buf_len - len, "ac_mu_mimo_brp3_err = %u\n", 1542 htt_stats_buf->ac_mu_mimo_brp3_err); 1543 1544 if (len >= buf_len) 1545 buf[buf_len - 1] = 0; 1546 else 1547 buf[len] = 0; 1548 1549 stats_req->buf_len = len; 1550 } 1551 1552 static inline void 1553 htt_print_tx_selfgen_ax_err_stats_tlv(const void *tag_buf, 1554 struct debug_htt_stats_req *stats_req) 1555 { 1556 const struct htt_tx_selfgen_ax_err_stats_tlv *htt_stats_buf = tag_buf; 1557 u8 *buf = stats_req->buf; 1558 u32 len = stats_req->buf_len; 1559 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 1560 1561 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_TX_SELFGEN_AX_ERR_STATS_TLV:"); 1562 len += HTT_DBG_OUT(buf + len, buf_len - len, "ax_su_ndp_err = %u", 1563 htt_stats_buf->ax_su_ndp_err); 1564 len += HTT_DBG_OUT(buf + len, buf_len - len, "ax_su_ndpa_err = %u", 1565 htt_stats_buf->ax_su_ndpa_err); 1566 len += HTT_DBG_OUT(buf + len, buf_len - len, "ax_mu_mimo_ndpa_err = %u", 1567 htt_stats_buf->ax_mu_mimo_ndpa_err); 1568 len += HTT_DBG_OUT(buf + len, buf_len - len, "ax_mu_mimo_ndp_err = %u", 1569 htt_stats_buf->ax_mu_mimo_ndp_err); 1570 len += HTT_DBG_OUT(buf + len, buf_len - len, "ax_mu_mimo_brp1_err = %u", 1571 htt_stats_buf->ax_mu_mimo_brp1_err); 1572 len += HTT_DBG_OUT(buf + len, buf_len - len, "ax_mu_mimo_brp2_err = %u", 1573 htt_stats_buf->ax_mu_mimo_brp2_err); 1574 len += HTT_DBG_OUT(buf + len, buf_len - len, "ax_mu_mimo_brp3_err = %u", 1575 htt_stats_buf->ax_mu_mimo_brp3_err); 1576 len += HTT_DBG_OUT(buf + len, buf_len - len, "ax_mu_mimo_brp4_err = %u", 1577 htt_stats_buf->ax_mu_mimo_brp4_err); 1578 len += HTT_DBG_OUT(buf + len, buf_len - len, "ax_mu_mimo_brp5_err = %u", 1579 htt_stats_buf->ax_mu_mimo_brp5_err); 1580 len += HTT_DBG_OUT(buf + len, buf_len - len, "ax_mu_mimo_brp6_err = %u", 1581 htt_stats_buf->ax_mu_mimo_brp6_err); 1582 len += HTT_DBG_OUT(buf + len, buf_len - len, "ax_mu_mimo_brp7_err = %u", 1583 htt_stats_buf->ax_mu_mimo_brp7_err); 1584 len += HTT_DBG_OUT(buf + len, buf_len - len, "ax_basic_trigger_err = %u", 1585 htt_stats_buf->ax_basic_trigger_err); 1586 len += HTT_DBG_OUT(buf + len, buf_len - len, "ax_bsr_trigger_err = %u", 1587 htt_stats_buf->ax_bsr_trigger_err); 1588 len += HTT_DBG_OUT(buf + len, buf_len - len, "ax_mu_bar_trigger_err = %u", 1589 htt_stats_buf->ax_mu_bar_trigger_err); 1590 len += HTT_DBG_OUT(buf + len, buf_len - len, "ax_mu_rts_trigger_err = %u\n", 1591 htt_stats_buf->ax_mu_rts_trigger_err); 1592 1593 if (len >= buf_len) 1594 buf[buf_len - 1] = 0; 1595 else 1596 buf[len] = 0; 1597 1598 stats_req->buf_len = len; 1599 } 1600 1601 static inline void 1602 htt_print_tx_pdev_mu_mimo_sch_stats_tlv(const void *tag_buf, 1603 struct debug_htt_stats_req *stats_req) 1604 { 1605 const struct htt_tx_pdev_mu_mimo_sch_stats_tlv *htt_stats_buf = tag_buf; 1606 u8 *buf = stats_req->buf; 1607 u32 len = stats_req->buf_len; 1608 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 1609 u8 i; 1610 1611 len += HTT_DBG_OUT(buf + len, buf_len - len, 1612 "HTT_TX_PDEV_MU_MIMO_SCH_STATS_TLV:"); 1613 len += HTT_DBG_OUT(buf + len, buf_len - len, "mu_mimo_sch_posted = %u", 1614 htt_stats_buf->mu_mimo_sch_posted); 1615 len += HTT_DBG_OUT(buf + len, buf_len - len, "mu_mimo_sch_failed = %u", 1616 htt_stats_buf->mu_mimo_sch_failed); 1617 len += HTT_DBG_OUT(buf + len, buf_len - len, "mu_mimo_ppdu_posted = %u\n", 1618 htt_stats_buf->mu_mimo_ppdu_posted); 1619 1620 len += HTT_DBG_OUT(buf + len, buf_len - len, "11ac MU_MIMO SCH STATS:"); 1621 1622 for (i = 0; i < HTT_TX_PDEV_STATS_NUM_AC_MUMIMO_USER_STATS; i++) 1623 len += HTT_DBG_OUT(buf + len, buf_len - len, 1624 "ac_mu_mimo_sch_nusers_%u = %u", 1625 i, htt_stats_buf->ac_mu_mimo_sch_nusers[i]); 1626 1627 len += HTT_DBG_OUT(buf + len, buf_len - len, "\n11ax MU_MIMO SCH STATS:"); 1628 1629 for (i = 0; i < HTT_TX_PDEV_STATS_NUM_AX_MUMIMO_USER_STATS; i++) 1630 len += HTT_DBG_OUT(buf + len, buf_len - len, 1631 "ax_mu_mimo_sch_nusers_%u = %u", 1632 i, htt_stats_buf->ax_mu_mimo_sch_nusers[i]); 1633 1634 len += HTT_DBG_OUT(buf + len, buf_len - len, "\n11ax OFDMA SCH STATS:"); 1635 1636 for (i = 0; i < HTT_TX_PDEV_STATS_NUM_OFDMA_USER_STATS; i++) 1637 len += HTT_DBG_OUT(buf + len, buf_len - len, 1638 "ax_ofdma_sch_nusers_%u = %u", 1639 i, htt_stats_buf->ax_ofdma_sch_nusers[i]); 1640 1641 if (len >= buf_len) 1642 buf[buf_len - 1] = 0; 1643 else 1644 buf[len] = 0; 1645 1646 stats_req->buf_len = len; 1647 } 1648 1649 static inline void 1650 htt_print_tx_pdev_mu_mimo_mpdu_stats_tlv(const void *tag_buf, 1651 struct debug_htt_stats_req *stats_req) 1652 { 1653 const struct htt_tx_pdev_mpdu_stats_tlv *htt_stats_buf = tag_buf; 1654 u8 *buf = stats_req->buf; 1655 u32 len = stats_req->buf_len; 1656 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 1657 1658 if (htt_stats_buf->tx_sched_mode == HTT_STATS_TX_SCHED_MODE_MU_MIMO_AC) { 1659 if (!htt_stats_buf->user_index) 1660 len += HTT_DBG_OUT(buf + len, buf_len - len, 1661 "HTT_TX_PDEV_MU_MIMO_AC_MPDU_STATS:\n"); 1662 1663 if (htt_stats_buf->user_index < 1664 HTT_TX_PDEV_STATS_NUM_AC_MUMIMO_USER_STATS) { 1665 len += HTT_DBG_OUT(buf + len, buf_len - len, 1666 "ac_mu_mimo_mpdus_queued_usr_%u = %u", 1667 htt_stats_buf->user_index, 1668 htt_stats_buf->mpdus_queued_usr); 1669 len += HTT_DBG_OUT(buf + len, buf_len - len, 1670 "ac_mu_mimo_mpdus_tried_usr_%u = %u", 1671 htt_stats_buf->user_index, 1672 htt_stats_buf->mpdus_tried_usr); 1673 len += HTT_DBG_OUT(buf + len, buf_len - len, 1674 "ac_mu_mimo_mpdus_failed_usr_%u = %u", 1675 htt_stats_buf->user_index, 1676 htt_stats_buf->mpdus_failed_usr); 1677 len += HTT_DBG_OUT(buf + len, buf_len - len, 1678 "ac_mu_mimo_mpdus_requeued_usr_%u = %u", 1679 htt_stats_buf->user_index, 1680 htt_stats_buf->mpdus_requeued_usr); 1681 len += HTT_DBG_OUT(buf + len, buf_len - len, 1682 "ac_mu_mimo_err_no_ba_usr_%u = %u", 1683 htt_stats_buf->user_index, 1684 htt_stats_buf->err_no_ba_usr); 1685 len += HTT_DBG_OUT(buf + len, buf_len - len, 1686 "ac_mu_mimo_mpdu_underrun_usr_%u = %u", 1687 htt_stats_buf->user_index, 1688 htt_stats_buf->mpdu_underrun_usr); 1689 len += HTT_DBG_OUT(buf + len, buf_len - len, 1690 "ac_mu_mimo_ampdu_underrun_usr_%u = %u\n", 1691 htt_stats_buf->user_index, 1692 htt_stats_buf->ampdu_underrun_usr); 1693 } 1694 } 1695 1696 if (htt_stats_buf->tx_sched_mode == HTT_STATS_TX_SCHED_MODE_MU_MIMO_AX) { 1697 if (!htt_stats_buf->user_index) 1698 len += HTT_DBG_OUT(buf + len, buf_len - len, 1699 "HTT_TX_PDEV_MU_MIMO_AX_MPDU_STATS:\n"); 1700 1701 if (htt_stats_buf->user_index < 1702 HTT_TX_PDEV_STATS_NUM_AX_MUMIMO_USER_STATS) { 1703 len += HTT_DBG_OUT(buf + len, buf_len - len, 1704 "ax_mu_mimo_mpdus_queued_usr_%u = %u", 1705 htt_stats_buf->user_index, 1706 htt_stats_buf->mpdus_queued_usr); 1707 len += HTT_DBG_OUT(buf + len, buf_len - len, 1708 "ax_mu_mimo_mpdus_tried_usr_%u = %u", 1709 htt_stats_buf->user_index, 1710 htt_stats_buf->mpdus_tried_usr); 1711 len += HTT_DBG_OUT(buf + len, buf_len - len, 1712 "ax_mu_mimo_mpdus_failed_usr_%u = %u", 1713 htt_stats_buf->user_index, 1714 htt_stats_buf->mpdus_failed_usr); 1715 len += HTT_DBG_OUT(buf + len, buf_len - len, 1716 "ax_mu_mimo_mpdus_requeued_usr_%u = %u", 1717 htt_stats_buf->user_index, 1718 htt_stats_buf->mpdus_requeued_usr); 1719 len += HTT_DBG_OUT(buf + len, buf_len - len, 1720 "ax_mu_mimo_err_no_ba_usr_%u = %u", 1721 htt_stats_buf->user_index, 1722 htt_stats_buf->err_no_ba_usr); 1723 len += HTT_DBG_OUT(buf + len, buf_len - len, 1724 "ax_mu_mimo_mpdu_underrun_usr_%u = %u", 1725 htt_stats_buf->user_index, 1726 htt_stats_buf->mpdu_underrun_usr); 1727 len += HTT_DBG_OUT(buf + len, buf_len - len, 1728 "ax_mu_mimo_ampdu_underrun_usr_%u = %u\n", 1729 htt_stats_buf->user_index, 1730 htt_stats_buf->ampdu_underrun_usr); 1731 } 1732 } 1733 1734 if (htt_stats_buf->tx_sched_mode == HTT_STATS_TX_SCHED_MODE_MU_OFDMA_AX) { 1735 if (!htt_stats_buf->user_index) 1736 len += HTT_DBG_OUT(buf + len, buf_len - len, 1737 "HTT_TX_PDEV_AX_MU_OFDMA_MPDU_STATS:\n"); 1738 1739 if (htt_stats_buf->user_index < HTT_TX_PDEV_STATS_NUM_OFDMA_USER_STATS) { 1740 len += HTT_DBG_OUT(buf + len, buf_len - len, 1741 "ax_mu_ofdma_mpdus_queued_usr_%u = %u", 1742 htt_stats_buf->user_index, 1743 htt_stats_buf->mpdus_queued_usr); 1744 len += HTT_DBG_OUT(buf + len, buf_len - len, 1745 "ax_mu_ofdma_mpdus_tried_usr_%u = %u", 1746 htt_stats_buf->user_index, 1747 htt_stats_buf->mpdus_tried_usr); 1748 len += HTT_DBG_OUT(buf + len, buf_len - len, 1749 "ax_mu_ofdma_mpdus_failed_usr_%u = %u", 1750 htt_stats_buf->user_index, 1751 htt_stats_buf->mpdus_failed_usr); 1752 len += HTT_DBG_OUT(buf + len, buf_len - len, 1753 "ax_mu_ofdma_mpdus_requeued_usr_%u = %u", 1754 htt_stats_buf->user_index, 1755 htt_stats_buf->mpdus_requeued_usr); 1756 len += HTT_DBG_OUT(buf + len, buf_len - len, 1757 "ax_mu_ofdma_err_no_ba_usr_%u = %u", 1758 htt_stats_buf->user_index, 1759 htt_stats_buf->err_no_ba_usr); 1760 len += HTT_DBG_OUT(buf + len, buf_len - len, 1761 "ax_mu_ofdma_mpdu_underrun_usr_%u = %u", 1762 htt_stats_buf->user_index, 1763 htt_stats_buf->mpdu_underrun_usr); 1764 len += HTT_DBG_OUT(buf + len, buf_len - len, 1765 "ax_mu_ofdma_ampdu_underrun_usr_%u = %u\n", 1766 htt_stats_buf->user_index, 1767 htt_stats_buf->ampdu_underrun_usr); 1768 } 1769 } 1770 1771 if (len >= buf_len) 1772 buf[buf_len - 1] = 0; 1773 else 1774 buf[len] = 0; 1775 1776 stats_req->buf_len = len; 1777 } 1778 1779 static inline void 1780 htt_print_sched_txq_cmd_posted_tlv_v(const void *tag_buf, 1781 u16 tag_len, 1782 struct debug_htt_stats_req *stats_req) 1783 { 1784 const struct htt_sched_txq_cmd_posted_tlv_v *htt_stats_buf = tag_buf; 1785 u8 *buf = stats_req->buf; 1786 u32 len = stats_req->buf_len; 1787 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 1788 char sched_cmd_posted[HTT_MAX_STRING_LEN] = {0}; 1789 u16 num_elements = min_t(u16, (tag_len >> 2), HTT_TX_PDEV_SCHED_TX_MODE_MAX); 1790 1791 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_SCHED_TXQ_CMD_POSTED_TLV_V:"); 1792 1793 ARRAY_TO_STRING(sched_cmd_posted, htt_stats_buf->sched_cmd_posted, 1794 num_elements); 1795 len += HTT_DBG_OUT(buf + len, buf_len - len, "sched_cmd_posted = %s\n", 1796 sched_cmd_posted); 1797 1798 if (len >= buf_len) 1799 buf[buf_len - 1] = 0; 1800 else 1801 buf[len] = 0; 1802 1803 stats_req->buf_len = len; 1804 } 1805 1806 static inline void 1807 htt_print_sched_txq_cmd_reaped_tlv_v(const void *tag_buf, 1808 u16 tag_len, 1809 struct debug_htt_stats_req *stats_req) 1810 { 1811 const struct htt_sched_txq_cmd_reaped_tlv_v *htt_stats_buf = tag_buf; 1812 u8 *buf = stats_req->buf; 1813 u32 len = stats_req->buf_len; 1814 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 1815 char sched_cmd_reaped[HTT_MAX_STRING_LEN] = {0}; 1816 u16 num_elements = min_t(u16, (tag_len >> 2), HTT_TX_PDEV_SCHED_TX_MODE_MAX); 1817 1818 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_SCHED_TXQ_CMD_REAPED_TLV_V:"); 1819 1820 ARRAY_TO_STRING(sched_cmd_reaped, htt_stats_buf->sched_cmd_reaped, 1821 num_elements); 1822 len += HTT_DBG_OUT(buf + len, buf_len - len, "sched_cmd_reaped = %s\n", 1823 sched_cmd_reaped); 1824 1825 if (len >= buf_len) 1826 buf[buf_len - 1] = 0; 1827 else 1828 buf[len] = 0; 1829 1830 stats_req->buf_len = len; 1831 } 1832 1833 static inline void 1834 htt_print_sched_txq_sched_order_su_tlv_v(const void *tag_buf, 1835 u16 tag_len, 1836 struct debug_htt_stats_req *stats_req) 1837 { 1838 const struct htt_sched_txq_sched_order_su_tlv_v *htt_stats_buf = tag_buf; 1839 u8 *buf = stats_req->buf; 1840 u32 len = stats_req->buf_len; 1841 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 1842 char sched_order_su[HTT_MAX_STRING_LEN] = {0}; 1843 /* each entry is u32, i.e. 4 bytes */ 1844 u32 sched_order_su_num_entries = 1845 min_t(u32, (tag_len >> 2), HTT_TX_PDEV_NUM_SCHED_ORDER_LOG); 1846 1847 len += HTT_DBG_OUT(buf + len, buf_len - len, 1848 "HTT_SCHED_TXQ_SCHED_ORDER_SU_TLV_V:"); 1849 1850 ARRAY_TO_STRING(sched_order_su, htt_stats_buf->sched_order_su, 1851 sched_order_su_num_entries); 1852 len += HTT_DBG_OUT(buf + len, buf_len - len, "sched_order_su = %s\n", 1853 sched_order_su); 1854 1855 if (len >= buf_len) 1856 buf[buf_len - 1] = 0; 1857 else 1858 buf[len] = 0; 1859 1860 stats_req->buf_len = len; 1861 } 1862 1863 static inline void 1864 htt_print_sched_txq_sched_ineligibility_tlv_v(const void *tag_buf, 1865 u16 tag_len, 1866 struct debug_htt_stats_req *stats_req) 1867 { 1868 const struct htt_sched_txq_sched_ineligibility_tlv_v *htt_stats_buf = tag_buf; 1869 u8 *buf = stats_req->buf; 1870 u32 len = stats_req->buf_len; 1871 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 1872 char sched_ineligibility[HTT_MAX_STRING_LEN] = {0}; 1873 /* each entry is u32, i.e. 4 bytes */ 1874 u32 sched_ineligibility_num_entries = tag_len >> 2; 1875 1876 len += HTT_DBG_OUT(buf + len, buf_len - len, 1877 "HTT_SCHED_TXQ_SCHED_INELIGIBILITY_V:"); 1878 1879 ARRAY_TO_STRING(sched_ineligibility, htt_stats_buf->sched_ineligibility, 1880 sched_ineligibility_num_entries); 1881 len += HTT_DBG_OUT(buf + len, buf_len - len, "sched_ineligibility = %s\n", 1882 sched_ineligibility); 1883 1884 if (len >= buf_len) 1885 buf[buf_len - 1] = 0; 1886 else 1887 buf[len] = 0; 1888 1889 stats_req->buf_len = len; 1890 } 1891 1892 static inline void 1893 htt_print_tx_pdev_stats_sched_per_txq_tlv(const void *tag_buf, 1894 struct debug_htt_stats_req *stats_req) 1895 { 1896 const struct htt_tx_pdev_stats_sched_per_txq_tlv *htt_stats_buf = tag_buf; 1897 u8 *buf = stats_req->buf; 1898 u32 len = stats_req->buf_len; 1899 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 1900 1901 len += HTT_DBG_OUT(buf + len, buf_len - len, 1902 "HTT_TX_PDEV_STATS_SCHED_PER_TXQ_TLV:"); 1903 len += HTT_DBG_OUT(buf + len, buf_len - len, "mac_id = %u", 1904 htt_stats_buf->mac_id__txq_id__word & 0xFF); 1905 len += HTT_DBG_OUT(buf + len, buf_len - len, "txq_id = %u", 1906 (htt_stats_buf->mac_id__txq_id__word & 0xFF00) >> 8); 1907 len += HTT_DBG_OUT(buf + len, buf_len - len, "sched_policy = %u", 1908 htt_stats_buf->sched_policy); 1909 len += HTT_DBG_OUT(buf + len, buf_len - len, 1910 "last_sched_cmd_posted_timestamp = %u", 1911 htt_stats_buf->last_sched_cmd_posted_timestamp); 1912 len += HTT_DBG_OUT(buf + len, buf_len - len, 1913 "last_sched_cmd_compl_timestamp = %u", 1914 htt_stats_buf->last_sched_cmd_compl_timestamp); 1915 len += HTT_DBG_OUT(buf + len, buf_len - len, "sched_2_tac_lwm_count = %u", 1916 htt_stats_buf->sched_2_tac_lwm_count); 1917 len += HTT_DBG_OUT(buf + len, buf_len - len, "sched_2_tac_ring_full = %u", 1918 htt_stats_buf->sched_2_tac_ring_full); 1919 len += HTT_DBG_OUT(buf + len, buf_len - len, "sched_cmd_post_failure = %u", 1920 htt_stats_buf->sched_cmd_post_failure); 1921 len += HTT_DBG_OUT(buf + len, buf_len - len, "num_active_tids = %u", 1922 htt_stats_buf->num_active_tids); 1923 len += HTT_DBG_OUT(buf + len, buf_len - len, "num_ps_schedules = %u", 1924 htt_stats_buf->num_ps_schedules); 1925 len += HTT_DBG_OUT(buf + len, buf_len - len, "sched_cmds_pending = %u", 1926 htt_stats_buf->sched_cmds_pending); 1927 len += HTT_DBG_OUT(buf + len, buf_len - len, "num_tid_register = %u", 1928 htt_stats_buf->num_tid_register); 1929 len += HTT_DBG_OUT(buf + len, buf_len - len, "num_tid_unregister = %u", 1930 htt_stats_buf->num_tid_unregister); 1931 len += HTT_DBG_OUT(buf + len, buf_len - len, "num_qstats_queried = %u", 1932 htt_stats_buf->num_qstats_queried); 1933 len += HTT_DBG_OUT(buf + len, buf_len - len, "qstats_update_pending = %u", 1934 htt_stats_buf->qstats_update_pending); 1935 len += HTT_DBG_OUT(buf + len, buf_len - len, "last_qstats_query_timestamp = %u", 1936 htt_stats_buf->last_qstats_query_timestamp); 1937 len += HTT_DBG_OUT(buf + len, buf_len - len, "num_tqm_cmdq_full = %u", 1938 htt_stats_buf->num_tqm_cmdq_full); 1939 len += HTT_DBG_OUT(buf + len, buf_len - len, "num_de_sched_algo_trigger = %u", 1940 htt_stats_buf->num_de_sched_algo_trigger); 1941 len += HTT_DBG_OUT(buf + len, buf_len - len, "num_rt_sched_algo_trigger = %u", 1942 htt_stats_buf->num_rt_sched_algo_trigger); 1943 len += HTT_DBG_OUT(buf + len, buf_len - len, "num_tqm_sched_algo_trigger = %u", 1944 htt_stats_buf->num_tqm_sched_algo_trigger); 1945 len += HTT_DBG_OUT(buf + len, buf_len - len, "notify_sched = %u\n", 1946 htt_stats_buf->notify_sched); 1947 len += HTT_DBG_OUT(buf + len, buf_len - len, "dur_based_sendn_term = %u\n", 1948 htt_stats_buf->dur_based_sendn_term); 1949 1950 if (len >= buf_len) 1951 buf[buf_len - 1] = 0; 1952 else 1953 buf[len] = 0; 1954 1955 stats_req->buf_len = len; 1956 } 1957 1958 static inline void htt_print_stats_tx_sched_cmn_tlv(const void *tag_buf, 1959 struct debug_htt_stats_req *stats_req) 1960 { 1961 const struct htt_stats_tx_sched_cmn_tlv *htt_stats_buf = tag_buf; 1962 u8 *buf = stats_req->buf; 1963 u32 len = stats_req->buf_len; 1964 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 1965 1966 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_STATS_TX_SCHED_CMN_TLV:"); 1967 len += HTT_DBG_OUT(buf + len, buf_len - len, "mac_id = %u", 1968 htt_stats_buf->mac_id__word & 0xFF); 1969 len += HTT_DBG_OUT(buf + len, buf_len - len, "current_timestamp = %u\n", 1970 htt_stats_buf->current_timestamp); 1971 1972 if (len >= buf_len) 1973 buf[buf_len - 1] = 0; 1974 else 1975 buf[len] = 0; 1976 1977 stats_req->buf_len = len; 1978 } 1979 1980 static inline void 1981 htt_print_tx_tqm_gen_mpdu_stats_tlv_v(const void *tag_buf, 1982 u16 tag_len, 1983 struct debug_htt_stats_req *stats_req) 1984 { 1985 const struct htt_tx_tqm_gen_mpdu_stats_tlv_v *htt_stats_buf = tag_buf; 1986 u8 *buf = stats_req->buf; 1987 u32 len = stats_req->buf_len; 1988 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 1989 char gen_mpdu_end_reason[HTT_MAX_STRING_LEN] = {0}; 1990 u16 num_elements = min_t(u16, (tag_len >> 2), 1991 HTT_TX_TQM_MAX_LIST_MPDU_END_REASON); 1992 1993 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_TX_TQM_GEN_MPDU_STATS_TLV_V:"); 1994 1995 ARRAY_TO_STRING(gen_mpdu_end_reason, htt_stats_buf->gen_mpdu_end_reason, 1996 num_elements); 1997 len += HTT_DBG_OUT(buf + len, buf_len - len, "gen_mpdu_end_reason = %s\n", 1998 gen_mpdu_end_reason); 1999 2000 if (len >= buf_len) 2001 buf[buf_len - 1] = 0; 2002 else 2003 buf[len] = 0; 2004 2005 stats_req->buf_len = len; 2006 } 2007 2008 static inline void 2009 htt_print_tx_tqm_list_mpdu_stats_tlv_v(const void *tag_buf, 2010 u16 tag_len, 2011 struct debug_htt_stats_req *stats_req) 2012 { 2013 const struct htt_tx_tqm_list_mpdu_stats_tlv_v *htt_stats_buf = tag_buf; 2014 u8 *buf = stats_req->buf; 2015 u32 len = stats_req->buf_len; 2016 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 2017 char list_mpdu_end_reason[HTT_MAX_STRING_LEN] = {0}; 2018 u16 num_elems = min_t(u16, (tag_len >> 2), HTT_TX_TQM_MAX_LIST_MPDU_END_REASON); 2019 2020 len += HTT_DBG_OUT(buf + len, buf_len - len, 2021 "HTT_TX_TQM_LIST_MPDU_STATS_TLV_V:"); 2022 2023 ARRAY_TO_STRING(list_mpdu_end_reason, htt_stats_buf->list_mpdu_end_reason, 2024 num_elems); 2025 len += HTT_DBG_OUT(buf + len, buf_len - len, "list_mpdu_end_reason = %s\n", 2026 list_mpdu_end_reason); 2027 if (len >= buf_len) 2028 buf[buf_len - 1] = 0; 2029 else 2030 buf[len] = 0; 2031 2032 stats_req->buf_len = len; 2033 } 2034 2035 static inline void 2036 htt_print_tx_tqm_list_mpdu_cnt_tlv_v(const void *tag_buf, 2037 u16 tag_len, 2038 struct debug_htt_stats_req *stats_req) 2039 { 2040 const struct htt_tx_tqm_list_mpdu_cnt_tlv_v *htt_stats_buf = tag_buf; 2041 u8 *buf = stats_req->buf; 2042 u32 len = stats_req->buf_len; 2043 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 2044 char list_mpdu_cnt_hist[HTT_MAX_STRING_LEN] = {0}; 2045 u16 num_elems = min_t(u16, (tag_len >> 2), 2046 HTT_TX_TQM_MAX_LIST_MPDU_CNT_HISTOGRAM_BINS); 2047 2048 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_TX_TQM_LIST_MPDU_CNT_TLV_V:"); 2049 2050 ARRAY_TO_STRING(list_mpdu_cnt_hist, htt_stats_buf->list_mpdu_cnt_hist, 2051 num_elems); 2052 len += HTT_DBG_OUT(buf + len, buf_len - len, "list_mpdu_cnt_hist = %s\n", 2053 list_mpdu_cnt_hist); 2054 2055 if (len >= buf_len) 2056 buf[buf_len - 1] = 0; 2057 else 2058 buf[len] = 0; 2059 2060 stats_req->buf_len = len; 2061 } 2062 2063 static inline void 2064 htt_print_tx_tqm_pdev_stats_tlv_v(const void *tag_buf, 2065 struct debug_htt_stats_req *stats_req) 2066 { 2067 const struct htt_tx_tqm_pdev_stats_tlv_v *htt_stats_buf = tag_buf; 2068 u8 *buf = stats_req->buf; 2069 u32 len = stats_req->buf_len; 2070 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 2071 2072 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_TX_TQM_PDEV_STATS_TLV_V:"); 2073 len += HTT_DBG_OUT(buf + len, buf_len - len, "msdu_count = %u", 2074 htt_stats_buf->msdu_count); 2075 len += HTT_DBG_OUT(buf + len, buf_len - len, "mpdu_count = %u", 2076 htt_stats_buf->mpdu_count); 2077 len += HTT_DBG_OUT(buf + len, buf_len - len, "remove_msdu = %u", 2078 htt_stats_buf->remove_msdu); 2079 len += HTT_DBG_OUT(buf + len, buf_len - len, "remove_mpdu = %u", 2080 htt_stats_buf->remove_mpdu); 2081 len += HTT_DBG_OUT(buf + len, buf_len - len, "remove_msdu_ttl = %u", 2082 htt_stats_buf->remove_msdu_ttl); 2083 len += HTT_DBG_OUT(buf + len, buf_len - len, "send_bar = %u", 2084 htt_stats_buf->send_bar); 2085 len += HTT_DBG_OUT(buf + len, buf_len - len, "bar_sync = %u", 2086 htt_stats_buf->bar_sync); 2087 len += HTT_DBG_OUT(buf + len, buf_len - len, "notify_mpdu = %u", 2088 htt_stats_buf->notify_mpdu); 2089 len += HTT_DBG_OUT(buf + len, buf_len - len, "sync_cmd = %u", 2090 htt_stats_buf->sync_cmd); 2091 len += HTT_DBG_OUT(buf + len, buf_len - len, "write_cmd = %u", 2092 htt_stats_buf->write_cmd); 2093 len += HTT_DBG_OUT(buf + len, buf_len - len, "hwsch_trigger = %u", 2094 htt_stats_buf->hwsch_trigger); 2095 len += HTT_DBG_OUT(buf + len, buf_len - len, "ack_tlv_proc = %u", 2096 htt_stats_buf->ack_tlv_proc); 2097 len += HTT_DBG_OUT(buf + len, buf_len - len, "gen_mpdu_cmd = %u", 2098 htt_stats_buf->gen_mpdu_cmd); 2099 len += HTT_DBG_OUT(buf + len, buf_len - len, "gen_list_cmd = %u", 2100 htt_stats_buf->gen_list_cmd); 2101 len += HTT_DBG_OUT(buf + len, buf_len - len, "remove_mpdu_cmd = %u", 2102 htt_stats_buf->remove_mpdu_cmd); 2103 len += HTT_DBG_OUT(buf + len, buf_len - len, "remove_mpdu_tried_cmd = %u", 2104 htt_stats_buf->remove_mpdu_tried_cmd); 2105 len += HTT_DBG_OUT(buf + len, buf_len - len, "mpdu_queue_stats_cmd = %u", 2106 htt_stats_buf->mpdu_queue_stats_cmd); 2107 len += HTT_DBG_OUT(buf + len, buf_len - len, "mpdu_head_info_cmd = %u", 2108 htt_stats_buf->mpdu_head_info_cmd); 2109 len += HTT_DBG_OUT(buf + len, buf_len - len, "msdu_flow_stats_cmd = %u", 2110 htt_stats_buf->msdu_flow_stats_cmd); 2111 len += HTT_DBG_OUT(buf + len, buf_len - len, "remove_msdu_cmd = %u", 2112 htt_stats_buf->remove_msdu_cmd); 2113 len += HTT_DBG_OUT(buf + len, buf_len - len, "remove_msdu_ttl_cmd = %u", 2114 htt_stats_buf->remove_msdu_ttl_cmd); 2115 len += HTT_DBG_OUT(buf + len, buf_len - len, "flush_cache_cmd = %u", 2116 htt_stats_buf->flush_cache_cmd); 2117 len += HTT_DBG_OUT(buf + len, buf_len - len, "update_mpduq_cmd = %u", 2118 htt_stats_buf->update_mpduq_cmd); 2119 len += HTT_DBG_OUT(buf + len, buf_len - len, "enqueue = %u", 2120 htt_stats_buf->enqueue); 2121 len += HTT_DBG_OUT(buf + len, buf_len - len, "enqueue_notify = %u", 2122 htt_stats_buf->enqueue_notify); 2123 len += HTT_DBG_OUT(buf + len, buf_len - len, "notify_mpdu_at_head = %u", 2124 htt_stats_buf->notify_mpdu_at_head); 2125 len += HTT_DBG_OUT(buf + len, buf_len - len, "notify_mpdu_state_valid = %u", 2126 htt_stats_buf->notify_mpdu_state_valid); 2127 len += HTT_DBG_OUT(buf + len, buf_len - len, "sched_udp_notify1 = %u", 2128 htt_stats_buf->sched_udp_notify1); 2129 len += HTT_DBG_OUT(buf + len, buf_len - len, "sched_udp_notify2 = %u", 2130 htt_stats_buf->sched_udp_notify2); 2131 len += HTT_DBG_OUT(buf + len, buf_len - len, "sched_nonudp_notify1 = %u", 2132 htt_stats_buf->sched_nonudp_notify1); 2133 len += HTT_DBG_OUT(buf + len, buf_len - len, "sched_nonudp_notify2 = %u\n", 2134 htt_stats_buf->sched_nonudp_notify2); 2135 2136 if (len >= buf_len) 2137 buf[buf_len - 1] = 0; 2138 else 2139 buf[len] = 0; 2140 2141 stats_req->buf_len = len; 2142 } 2143 2144 static inline void htt_print_tx_tqm_cmn_stats_tlv(const void *tag_buf, 2145 struct debug_htt_stats_req *stats_req) 2146 { 2147 const struct htt_tx_tqm_cmn_stats_tlv *htt_stats_buf = tag_buf; 2148 u8 *buf = stats_req->buf; 2149 u32 len = stats_req->buf_len; 2150 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 2151 2152 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_TX_TQM_CMN_STATS_TLV:"); 2153 len += HTT_DBG_OUT(buf + len, buf_len - len, "mac_id = %u", 2154 htt_stats_buf->mac_id__word & 0xFF); 2155 len += HTT_DBG_OUT(buf + len, buf_len - len, "max_cmdq_id = %u", 2156 htt_stats_buf->max_cmdq_id); 2157 len += HTT_DBG_OUT(buf + len, buf_len - len, "list_mpdu_cnt_hist_intvl = %u", 2158 htt_stats_buf->list_mpdu_cnt_hist_intvl); 2159 len += HTT_DBG_OUT(buf + len, buf_len - len, "add_msdu = %u", 2160 htt_stats_buf->add_msdu); 2161 len += HTT_DBG_OUT(buf + len, buf_len - len, "q_empty = %u", 2162 htt_stats_buf->q_empty); 2163 len += HTT_DBG_OUT(buf + len, buf_len - len, "q_not_empty = %u", 2164 htt_stats_buf->q_not_empty); 2165 len += HTT_DBG_OUT(buf + len, buf_len - len, "drop_notification = %u", 2166 htt_stats_buf->drop_notification); 2167 len += HTT_DBG_OUT(buf + len, buf_len - len, "desc_threshold = %u\n", 2168 htt_stats_buf->desc_threshold); 2169 2170 if (len >= buf_len) 2171 buf[buf_len - 1] = 0; 2172 else 2173 buf[len] = 0; 2174 2175 stats_req->buf_len = len; 2176 } 2177 2178 static inline void htt_print_tx_tqm_error_stats_tlv(const void *tag_buf, 2179 struct debug_htt_stats_req *stats_req) 2180 { 2181 const struct htt_tx_tqm_error_stats_tlv *htt_stats_buf = tag_buf; 2182 u8 *buf = stats_req->buf; 2183 u32 len = stats_req->buf_len; 2184 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 2185 2186 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_TX_TQM_ERROR_STATS_TLV:"); 2187 len += HTT_DBG_OUT(buf + len, buf_len - len, "q_empty_failure = %u", 2188 htt_stats_buf->q_empty_failure); 2189 len += HTT_DBG_OUT(buf + len, buf_len - len, "q_not_empty_failure = %u", 2190 htt_stats_buf->q_not_empty_failure); 2191 len += HTT_DBG_OUT(buf + len, buf_len - len, "add_msdu_failure = %u\n", 2192 htt_stats_buf->add_msdu_failure); 2193 2194 if (len >= buf_len) 2195 buf[buf_len - 1] = 0; 2196 else 2197 buf[len] = 0; 2198 2199 stats_req->buf_len = len; 2200 } 2201 2202 static inline void htt_print_tx_tqm_cmdq_status_tlv(const void *tag_buf, 2203 struct debug_htt_stats_req *stats_req) 2204 { 2205 const struct htt_tx_tqm_cmdq_status_tlv *htt_stats_buf = tag_buf; 2206 u8 *buf = stats_req->buf; 2207 u32 len = stats_req->buf_len; 2208 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 2209 2210 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_TX_TQM_CMDQ_STATUS_TLV:"); 2211 len += HTT_DBG_OUT(buf + len, buf_len - len, "mac_id = %u", 2212 htt_stats_buf->mac_id__cmdq_id__word & 0xFF); 2213 len += HTT_DBG_OUT(buf + len, buf_len - len, "cmdq_id = %u\n", 2214 (htt_stats_buf->mac_id__cmdq_id__word & 0xFF00) >> 8); 2215 len += HTT_DBG_OUT(buf + len, buf_len - len, "sync_cmd = %u", 2216 htt_stats_buf->sync_cmd); 2217 len += HTT_DBG_OUT(buf + len, buf_len - len, "write_cmd = %u", 2218 htt_stats_buf->write_cmd); 2219 len += HTT_DBG_OUT(buf + len, buf_len - len, "gen_mpdu_cmd = %u", 2220 htt_stats_buf->gen_mpdu_cmd); 2221 len += HTT_DBG_OUT(buf + len, buf_len - len, "mpdu_queue_stats_cmd = %u", 2222 htt_stats_buf->mpdu_queue_stats_cmd); 2223 len += HTT_DBG_OUT(buf + len, buf_len - len, "mpdu_head_info_cmd = %u", 2224 htt_stats_buf->mpdu_head_info_cmd); 2225 len += HTT_DBG_OUT(buf + len, buf_len - len, "msdu_flow_stats_cmd = %u", 2226 htt_stats_buf->msdu_flow_stats_cmd); 2227 len += HTT_DBG_OUT(buf + len, buf_len - len, "remove_mpdu_cmd = %u", 2228 htt_stats_buf->remove_mpdu_cmd); 2229 len += HTT_DBG_OUT(buf + len, buf_len - len, "remove_msdu_cmd = %u", 2230 htt_stats_buf->remove_msdu_cmd); 2231 len += HTT_DBG_OUT(buf + len, buf_len - len, "flush_cache_cmd = %u", 2232 htt_stats_buf->flush_cache_cmd); 2233 len += HTT_DBG_OUT(buf + len, buf_len - len, "update_mpduq_cmd = %u", 2234 htt_stats_buf->update_mpduq_cmd); 2235 len += HTT_DBG_OUT(buf + len, buf_len - len, "update_msduq_cmd = %u\n", 2236 htt_stats_buf->update_msduq_cmd); 2237 2238 if (len >= buf_len) 2239 buf[buf_len - 1] = 0; 2240 else 2241 buf[len] = 0; 2242 2243 stats_req->buf_len = len; 2244 } 2245 2246 static inline void 2247 htt_print_tx_de_eapol_packets_stats_tlv(const void *tag_buf, 2248 struct debug_htt_stats_req *stats_req) 2249 { 2250 const struct htt_tx_de_eapol_packets_stats_tlv *htt_stats_buf = tag_buf; 2251 u8 *buf = stats_req->buf; 2252 u32 len = stats_req->buf_len; 2253 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 2254 2255 len += HTT_DBG_OUT(buf + len, buf_len - len, 2256 "HTT_TX_DE_EAPOL_PACKETS_STATS_TLV:"); 2257 len += HTT_DBG_OUT(buf + len, buf_len - len, "m1_packets = %u", 2258 htt_stats_buf->m1_packets); 2259 len += HTT_DBG_OUT(buf + len, buf_len - len, "m2_packets = %u", 2260 htt_stats_buf->m2_packets); 2261 len += HTT_DBG_OUT(buf + len, buf_len - len, "m3_packets = %u", 2262 htt_stats_buf->m3_packets); 2263 len += HTT_DBG_OUT(buf + len, buf_len - len, "m4_packets = %u", 2264 htt_stats_buf->m4_packets); 2265 len += HTT_DBG_OUT(buf + len, buf_len - len, "g1_packets = %u", 2266 htt_stats_buf->g1_packets); 2267 len += HTT_DBG_OUT(buf + len, buf_len - len, "g2_packets = %u\n", 2268 htt_stats_buf->g2_packets); 2269 2270 if (len >= buf_len) 2271 buf[buf_len - 1] = 0; 2272 else 2273 buf[len] = 0; 2274 2275 stats_req->buf_len = len; 2276 } 2277 2278 static inline void 2279 htt_print_tx_de_classify_failed_stats_tlv(const void *tag_buf, 2280 struct debug_htt_stats_req *stats_req) 2281 { 2282 const struct htt_tx_de_classify_failed_stats_tlv *htt_stats_buf = tag_buf; 2283 u8 *buf = stats_req->buf; 2284 u32 len = stats_req->buf_len; 2285 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 2286 2287 len += HTT_DBG_OUT(buf + len, buf_len - len, 2288 "HTT_TX_DE_CLASSIFY_FAILED_STATS_TLV:"); 2289 len += HTT_DBG_OUT(buf + len, buf_len - len, "ap_bss_peer_not_found = %u", 2290 htt_stats_buf->ap_bss_peer_not_found); 2291 len += HTT_DBG_OUT(buf + len, buf_len - len, "ap_bcast_mcast_no_peer = %u", 2292 htt_stats_buf->ap_bcast_mcast_no_peer); 2293 len += HTT_DBG_OUT(buf + len, buf_len - len, "sta_delete_in_progress = %u", 2294 htt_stats_buf->sta_delete_in_progress); 2295 len += HTT_DBG_OUT(buf + len, buf_len - len, "ibss_no_bss_peer = %u", 2296 htt_stats_buf->ibss_no_bss_peer); 2297 len += HTT_DBG_OUT(buf + len, buf_len - len, "invalid_vdev_type = %u", 2298 htt_stats_buf->invalid_vdev_type); 2299 len += HTT_DBG_OUT(buf + len, buf_len - len, "invalid_ast_peer_entry = %u", 2300 htt_stats_buf->invalid_ast_peer_entry); 2301 len += HTT_DBG_OUT(buf + len, buf_len - len, "peer_entry_invalid = %u", 2302 htt_stats_buf->peer_entry_invalid); 2303 len += HTT_DBG_OUT(buf + len, buf_len - len, "ethertype_not_ip = %u", 2304 htt_stats_buf->ethertype_not_ip); 2305 len += HTT_DBG_OUT(buf + len, buf_len - len, "eapol_lookup_failed = %u", 2306 htt_stats_buf->eapol_lookup_failed); 2307 len += HTT_DBG_OUT(buf + len, buf_len - len, "qpeer_not_allow_data = %u", 2308 htt_stats_buf->qpeer_not_allow_data); 2309 len += HTT_DBG_OUT(buf + len, buf_len - len, "fse_tid_override = %u", 2310 htt_stats_buf->fse_tid_override); 2311 len += HTT_DBG_OUT(buf + len, buf_len - len, "ipv6_jumbogram_zero_length = %u", 2312 htt_stats_buf->ipv6_jumbogram_zero_length); 2313 len += HTT_DBG_OUT(buf + len, buf_len - len, "qos_to_non_qos_in_prog = %u\n", 2314 htt_stats_buf->qos_to_non_qos_in_prog); 2315 2316 if (len >= buf_len) 2317 buf[buf_len - 1] = 0; 2318 else 2319 buf[len] = 0; 2320 2321 stats_req->buf_len = len; 2322 } 2323 2324 static inline void 2325 htt_print_tx_de_classify_stats_tlv(const void *tag_buf, 2326 struct debug_htt_stats_req *stats_req) 2327 { 2328 const struct htt_tx_de_classify_stats_tlv *htt_stats_buf = tag_buf; 2329 u8 *buf = stats_req->buf; 2330 u32 len = stats_req->buf_len; 2331 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 2332 2333 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_TX_DE_CLASSIFY_STATS_TLV:"); 2334 len += HTT_DBG_OUT(buf + len, buf_len - len, "arp_packets = %u", 2335 htt_stats_buf->arp_packets); 2336 len += HTT_DBG_OUT(buf + len, buf_len - len, "igmp_packets = %u", 2337 htt_stats_buf->igmp_packets); 2338 len += HTT_DBG_OUT(buf + len, buf_len - len, "dhcp_packets = %u", 2339 htt_stats_buf->dhcp_packets); 2340 len += HTT_DBG_OUT(buf + len, buf_len - len, "host_inspected = %u", 2341 htt_stats_buf->host_inspected); 2342 len += HTT_DBG_OUT(buf + len, buf_len - len, "htt_included = %u", 2343 htt_stats_buf->htt_included); 2344 len += HTT_DBG_OUT(buf + len, buf_len - len, "htt_valid_mcs = %u", 2345 htt_stats_buf->htt_valid_mcs); 2346 len += HTT_DBG_OUT(buf + len, buf_len - len, "htt_valid_nss = %u", 2347 htt_stats_buf->htt_valid_nss); 2348 len += HTT_DBG_OUT(buf + len, buf_len - len, "htt_valid_preamble_type = %u", 2349 htt_stats_buf->htt_valid_preamble_type); 2350 len += HTT_DBG_OUT(buf + len, buf_len - len, "htt_valid_chainmask = %u", 2351 htt_stats_buf->htt_valid_chainmask); 2352 len += HTT_DBG_OUT(buf + len, buf_len - len, "htt_valid_guard_interval = %u", 2353 htt_stats_buf->htt_valid_guard_interval); 2354 len += HTT_DBG_OUT(buf + len, buf_len - len, "htt_valid_retries = %u", 2355 htt_stats_buf->htt_valid_retries); 2356 len += HTT_DBG_OUT(buf + len, buf_len - len, "htt_valid_bw_info = %u", 2357 htt_stats_buf->htt_valid_bw_info); 2358 len += HTT_DBG_OUT(buf + len, buf_len - len, "htt_valid_power = %u", 2359 htt_stats_buf->htt_valid_power); 2360 len += HTT_DBG_OUT(buf + len, buf_len - len, "htt_valid_key_flags = 0x%x", 2361 htt_stats_buf->htt_valid_key_flags); 2362 len += HTT_DBG_OUT(buf + len, buf_len - len, "htt_valid_no_encryption = %u", 2363 htt_stats_buf->htt_valid_no_encryption); 2364 len += HTT_DBG_OUT(buf + len, buf_len - len, "fse_entry_count = %u", 2365 htt_stats_buf->fse_entry_count); 2366 len += HTT_DBG_OUT(buf + len, buf_len - len, "fse_priority_be = %u", 2367 htt_stats_buf->fse_priority_be); 2368 len += HTT_DBG_OUT(buf + len, buf_len - len, "fse_priority_high = %u", 2369 htt_stats_buf->fse_priority_high); 2370 len += HTT_DBG_OUT(buf + len, buf_len - len, "fse_priority_low = %u", 2371 htt_stats_buf->fse_priority_low); 2372 len += HTT_DBG_OUT(buf + len, buf_len - len, "fse_traffic_ptrn_be = %u", 2373 htt_stats_buf->fse_traffic_ptrn_be); 2374 len += HTT_DBG_OUT(buf + len, buf_len - len, "fse_traffic_ptrn_over_sub = %u", 2375 htt_stats_buf->fse_traffic_ptrn_over_sub); 2376 len += HTT_DBG_OUT(buf + len, buf_len - len, "fse_traffic_ptrn_bursty = %u", 2377 htt_stats_buf->fse_traffic_ptrn_bursty); 2378 len += HTT_DBG_OUT(buf + len, buf_len - len, "fse_traffic_ptrn_interactive = %u", 2379 htt_stats_buf->fse_traffic_ptrn_interactive); 2380 len += HTT_DBG_OUT(buf + len, buf_len - len, "fse_traffic_ptrn_periodic = %u", 2381 htt_stats_buf->fse_traffic_ptrn_periodic); 2382 len += HTT_DBG_OUT(buf + len, buf_len - len, "fse_hwqueue_alloc = %u", 2383 htt_stats_buf->fse_hwqueue_alloc); 2384 len += HTT_DBG_OUT(buf + len, buf_len - len, "fse_hwqueue_created = %u", 2385 htt_stats_buf->fse_hwqueue_created); 2386 len += HTT_DBG_OUT(buf + len, buf_len - len, "fse_hwqueue_send_to_host = %u", 2387 htt_stats_buf->fse_hwqueue_send_to_host); 2388 len += HTT_DBG_OUT(buf + len, buf_len - len, "mcast_entry = %u", 2389 htt_stats_buf->mcast_entry); 2390 len += HTT_DBG_OUT(buf + len, buf_len - len, "bcast_entry = %u", 2391 htt_stats_buf->bcast_entry); 2392 len += HTT_DBG_OUT(buf + len, buf_len - len, "htt_update_peer_cache = %u", 2393 htt_stats_buf->htt_update_peer_cache); 2394 len += HTT_DBG_OUT(buf + len, buf_len - len, "htt_learning_frame = %u", 2395 htt_stats_buf->htt_learning_frame); 2396 len += HTT_DBG_OUT(buf + len, buf_len - len, "fse_invalid_peer = %u", 2397 htt_stats_buf->fse_invalid_peer); 2398 len += HTT_DBG_OUT(buf + len, buf_len - len, "mec_notify = %u\n", 2399 htt_stats_buf->mec_notify); 2400 2401 if (len >= buf_len) 2402 buf[buf_len - 1] = 0; 2403 else 2404 buf[len] = 0; 2405 2406 stats_req->buf_len = len; 2407 } 2408 2409 static inline void 2410 htt_print_tx_de_classify_status_stats_tlv(const void *tag_buf, 2411 struct debug_htt_stats_req *stats_req) 2412 { 2413 const struct htt_tx_de_classify_status_stats_tlv *htt_stats_buf = tag_buf; 2414 u8 *buf = stats_req->buf; 2415 u32 len = stats_req->buf_len; 2416 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 2417 2418 len += HTT_DBG_OUT(buf + len, buf_len - len, 2419 "HTT_TX_DE_CLASSIFY_STATUS_STATS_TLV:"); 2420 len += HTT_DBG_OUT(buf + len, buf_len - len, "eok = %u", 2421 htt_stats_buf->eok); 2422 len += HTT_DBG_OUT(buf + len, buf_len - len, "classify_done = %u", 2423 htt_stats_buf->classify_done); 2424 len += HTT_DBG_OUT(buf + len, buf_len - len, "lookup_failed = %u", 2425 htt_stats_buf->lookup_failed); 2426 len += HTT_DBG_OUT(buf + len, buf_len - len, "send_host_dhcp = %u", 2427 htt_stats_buf->send_host_dhcp); 2428 len += HTT_DBG_OUT(buf + len, buf_len - len, "send_host_mcast = %u", 2429 htt_stats_buf->send_host_mcast); 2430 len += HTT_DBG_OUT(buf + len, buf_len - len, "send_host_unknown_dest = %u", 2431 htt_stats_buf->send_host_unknown_dest); 2432 len += HTT_DBG_OUT(buf + len, buf_len - len, "send_host = %u", 2433 htt_stats_buf->send_host); 2434 len += HTT_DBG_OUT(buf + len, buf_len - len, "status_invalid = %u\n", 2435 htt_stats_buf->status_invalid); 2436 2437 if (len >= buf_len) 2438 buf[buf_len - 1] = 0; 2439 else 2440 buf[len] = 0; 2441 2442 stats_req->buf_len = len; 2443 } 2444 2445 static inline void 2446 htt_print_tx_de_enqueue_packets_stats_tlv(const void *tag_buf, 2447 struct debug_htt_stats_req *stats_req) 2448 { 2449 const struct htt_tx_de_enqueue_packets_stats_tlv *htt_stats_buf = tag_buf; 2450 u8 *buf = stats_req->buf; 2451 u32 len = stats_req->buf_len; 2452 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 2453 2454 len += HTT_DBG_OUT(buf + len, buf_len - len, 2455 "HTT_TX_DE_ENQUEUE_PACKETS_STATS_TLV:"); 2456 len += HTT_DBG_OUT(buf + len, buf_len - len, "enqueued_pkts = %u", 2457 htt_stats_buf->enqueued_pkts); 2458 len += HTT_DBG_OUT(buf + len, buf_len - len, "to_tqm = %u", 2459 htt_stats_buf->to_tqm); 2460 len += HTT_DBG_OUT(buf + len, buf_len - len, "to_tqm_bypass = %u\n", 2461 htt_stats_buf->to_tqm_bypass); 2462 2463 if (len >= buf_len) 2464 buf[buf_len - 1] = 0; 2465 else 2466 buf[len] = 0; 2467 2468 stats_req->buf_len = len; 2469 } 2470 2471 static inline void 2472 htt_print_tx_de_enqueue_discard_stats_tlv(const void *tag_buf, 2473 struct debug_htt_stats_req *stats_req) 2474 { 2475 const struct htt_tx_de_enqueue_discard_stats_tlv *htt_stats_buf = tag_buf; 2476 u8 *buf = stats_req->buf; 2477 u32 len = stats_req->buf_len; 2478 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 2479 2480 len += HTT_DBG_OUT(buf + len, buf_len - len, 2481 "HTT_TX_DE_ENQUEUE_DISCARD_STATS_TLV:"); 2482 len += HTT_DBG_OUT(buf + len, buf_len - len, "discarded_pkts = %u", 2483 htt_stats_buf->discarded_pkts); 2484 len += HTT_DBG_OUT(buf + len, buf_len - len, "local_frames = %u", 2485 htt_stats_buf->local_frames); 2486 len += HTT_DBG_OUT(buf + len, buf_len - len, "is_ext_msdu = %u\n", 2487 htt_stats_buf->is_ext_msdu); 2488 2489 if (len >= buf_len) 2490 buf[buf_len - 1] = 0; 2491 else 2492 buf[len] = 0; 2493 2494 stats_req->buf_len = len; 2495 } 2496 2497 static inline void htt_print_tx_de_compl_stats_tlv(const void *tag_buf, 2498 struct debug_htt_stats_req *stats_req) 2499 { 2500 const struct htt_tx_de_compl_stats_tlv *htt_stats_buf = tag_buf; 2501 u8 *buf = stats_req->buf; 2502 u32 len = stats_req->buf_len; 2503 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 2504 2505 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_TX_DE_COMPL_STATS_TLV:"); 2506 len += HTT_DBG_OUT(buf + len, buf_len - len, "tcl_dummy_frame = %u", 2507 htt_stats_buf->tcl_dummy_frame); 2508 len += HTT_DBG_OUT(buf + len, buf_len - len, "tqm_dummy_frame = %u", 2509 htt_stats_buf->tqm_dummy_frame); 2510 len += HTT_DBG_OUT(buf + len, buf_len - len, "tqm_notify_frame = %u", 2511 htt_stats_buf->tqm_notify_frame); 2512 len += HTT_DBG_OUT(buf + len, buf_len - len, "fw2wbm_enq = %u", 2513 htt_stats_buf->fw2wbm_enq); 2514 len += HTT_DBG_OUT(buf + len, buf_len - len, "tqm_bypass_frame = %u\n", 2515 htt_stats_buf->tqm_bypass_frame); 2516 2517 if (len >= buf_len) 2518 buf[buf_len - 1] = 0; 2519 else 2520 buf[len] = 0; 2521 2522 stats_req->buf_len = len; 2523 } 2524 2525 static inline void 2526 htt_print_tx_de_fw2wbm_ring_full_hist_tlv(const void *tag_buf, 2527 u16 tag_len, 2528 struct debug_htt_stats_req *stats_req) 2529 { 2530 const struct htt_tx_de_fw2wbm_ring_full_hist_tlv *htt_stats_buf = tag_buf; 2531 u8 *buf = stats_req->buf; 2532 u32 len = stats_req->buf_len; 2533 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 2534 char fw2wbm_ring_full_hist[HTT_MAX_STRING_LEN] = {0}; 2535 u16 num_elements = tag_len >> 2; 2536 u32 required_buffer_size = HTT_MAX_PRINT_CHAR_PER_ELEM * num_elements; 2537 2538 len += HTT_DBG_OUT(buf + len, buf_len - len, 2539 "HTT_TX_DE_FW2WBM_RING_FULL_HIST_TLV"); 2540 2541 if (required_buffer_size < HTT_MAX_STRING_LEN) { 2542 ARRAY_TO_STRING(fw2wbm_ring_full_hist, 2543 htt_stats_buf->fw2wbm_ring_full_hist, 2544 num_elements); 2545 len += HTT_DBG_OUT(buf + len, buf_len - len, 2546 "fw2wbm_ring_full_hist = %s\n", 2547 fw2wbm_ring_full_hist); 2548 } else { 2549 len += HTT_DBG_OUT(buf + len, buf_len - len, 2550 "INSUFFICIENT PRINT BUFFER "); 2551 } 2552 2553 if (len >= buf_len) 2554 buf[buf_len - 1] = 0; 2555 else 2556 buf[len] = 0; 2557 2558 stats_req->buf_len = len; 2559 } 2560 2561 static inline void 2562 htt_print_tx_de_cmn_stats_tlv(const void *tag_buf, struct debug_htt_stats_req *stats_req) 2563 { 2564 const struct htt_tx_de_cmn_stats_tlv *htt_stats_buf = tag_buf; 2565 u8 *buf = stats_req->buf; 2566 u32 len = stats_req->buf_len; 2567 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 2568 2569 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_TX_DE_CMN_STATS_TLV:"); 2570 len += HTT_DBG_OUT(buf + len, buf_len - len, "mac_id = %u", 2571 htt_stats_buf->mac_id__word & 0xFF); 2572 len += HTT_DBG_OUT(buf + len, buf_len - len, "tcl2fw_entry_count = %u", 2573 htt_stats_buf->tcl2fw_entry_count); 2574 len += HTT_DBG_OUT(buf + len, buf_len - len, "not_to_fw = %u", 2575 htt_stats_buf->not_to_fw); 2576 len += HTT_DBG_OUT(buf + len, buf_len - len, "invalid_pdev_vdev_peer = %u", 2577 htt_stats_buf->invalid_pdev_vdev_peer); 2578 len += HTT_DBG_OUT(buf + len, buf_len - len, "tcl_res_invalid_addrx = %u", 2579 htt_stats_buf->tcl_res_invalid_addrx); 2580 len += HTT_DBG_OUT(buf + len, buf_len - len, "wbm2fw_entry_count = %u", 2581 htt_stats_buf->wbm2fw_entry_count); 2582 len += HTT_DBG_OUT(buf + len, buf_len - len, "invalid_pdev = %u\n", 2583 htt_stats_buf->invalid_pdev); 2584 2585 if (len >= buf_len) 2586 buf[buf_len - 1] = 0; 2587 else 2588 buf[len] = 0; 2589 2590 stats_req->buf_len = len; 2591 } 2592 2593 static inline void htt_print_ring_if_stats_tlv(const void *tag_buf, 2594 struct debug_htt_stats_req *stats_req) 2595 { 2596 const struct htt_ring_if_stats_tlv *htt_stats_buf = tag_buf; 2597 u8 *buf = stats_req->buf; 2598 u32 len = stats_req->buf_len; 2599 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 2600 char low_wm_hit_count[HTT_MAX_STRING_LEN] = {0}; 2601 char high_wm_hit_count[HTT_MAX_STRING_LEN] = {0}; 2602 2603 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_RING_IF_STATS_TLV:"); 2604 len += HTT_DBG_OUT(buf + len, buf_len - len, "base_addr = %u", 2605 htt_stats_buf->base_addr); 2606 len += HTT_DBG_OUT(buf + len, buf_len - len, "elem_size = %u", 2607 htt_stats_buf->elem_size); 2608 len += HTT_DBG_OUT(buf + len, buf_len - len, "num_elems = %u", 2609 htt_stats_buf->num_elems__prefetch_tail_idx & 0xFFFF); 2610 len += HTT_DBG_OUT(buf + len, buf_len - len, "prefetch_tail_idx = %u", 2611 (htt_stats_buf->num_elems__prefetch_tail_idx & 2612 0xFFFF0000) >> 16); 2613 len += HTT_DBG_OUT(buf + len, buf_len - len, "head_idx = %u", 2614 htt_stats_buf->head_idx__tail_idx & 0xFFFF); 2615 len += HTT_DBG_OUT(buf + len, buf_len - len, "tail_idx = %u", 2616 (htt_stats_buf->head_idx__tail_idx & 0xFFFF0000) >> 16); 2617 len += HTT_DBG_OUT(buf + len, buf_len - len, "shadow_head_idx = %u", 2618 htt_stats_buf->shadow_head_idx__shadow_tail_idx & 0xFFFF); 2619 len += HTT_DBG_OUT(buf + len, buf_len - len, "shadow_tail_idx = %u", 2620 (htt_stats_buf->shadow_head_idx__shadow_tail_idx & 2621 0xFFFF0000) >> 16); 2622 len += HTT_DBG_OUT(buf + len, buf_len - len, "num_tail_incr = %u", 2623 htt_stats_buf->num_tail_incr); 2624 len += HTT_DBG_OUT(buf + len, buf_len - len, "lwm_thresh = %u", 2625 htt_stats_buf->lwm_thresh__hwm_thresh & 0xFFFF); 2626 len += HTT_DBG_OUT(buf + len, buf_len - len, "hwm_thresh = %u", 2627 (htt_stats_buf->lwm_thresh__hwm_thresh & 0xFFFF0000) >> 16); 2628 len += HTT_DBG_OUT(buf + len, buf_len - len, "overrun_hit_count = %u", 2629 htt_stats_buf->overrun_hit_count); 2630 len += HTT_DBG_OUT(buf + len, buf_len - len, "underrun_hit_count = %u", 2631 htt_stats_buf->underrun_hit_count); 2632 len += HTT_DBG_OUT(buf + len, buf_len - len, "prod_blockwait_count = %u", 2633 htt_stats_buf->prod_blockwait_count); 2634 len += HTT_DBG_OUT(buf + len, buf_len - len, "cons_blockwait_count = %u", 2635 htt_stats_buf->cons_blockwait_count); 2636 2637 ARRAY_TO_STRING(low_wm_hit_count, htt_stats_buf->low_wm_hit_count, 2638 HTT_STATS_LOW_WM_BINS); 2639 len += HTT_DBG_OUT(buf + len, buf_len - len, "low_wm_hit_count = %s ", 2640 low_wm_hit_count); 2641 2642 ARRAY_TO_STRING(high_wm_hit_count, htt_stats_buf->high_wm_hit_count, 2643 HTT_STATS_HIGH_WM_BINS); 2644 len += HTT_DBG_OUT(buf + len, buf_len - len, "high_wm_hit_count = %s\n", 2645 high_wm_hit_count); 2646 2647 if (len >= buf_len) 2648 buf[buf_len - 1] = 0; 2649 else 2650 buf[len] = 0; 2651 2652 stats_req->buf_len = len; 2653 } 2654 2655 static inline void htt_print_ring_if_cmn_tlv(const void *tag_buf, 2656 struct debug_htt_stats_req *stats_req) 2657 { 2658 const struct htt_ring_if_cmn_tlv *htt_stats_buf = tag_buf; 2659 u8 *buf = stats_req->buf; 2660 u32 len = stats_req->buf_len; 2661 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 2662 2663 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_RING_IF_CMN_TLV:"); 2664 len += HTT_DBG_OUT(buf + len, buf_len - len, "mac_id = %u", 2665 htt_stats_buf->mac_id__word & 0xFF); 2666 len += HTT_DBG_OUT(buf + len, buf_len - len, "num_records = %u\n", 2667 htt_stats_buf->num_records); 2668 2669 if (len >= buf_len) 2670 buf[buf_len - 1] = 0; 2671 else 2672 buf[len] = 0; 2673 2674 stats_req->buf_len = len; 2675 } 2676 2677 static inline void htt_print_sfm_client_user_tlv_v(const void *tag_buf, 2678 u16 tag_len, 2679 struct debug_htt_stats_req *stats_req) 2680 { 2681 const struct htt_sfm_client_user_tlv_v *htt_stats_buf = tag_buf; 2682 u8 *buf = stats_req->buf; 2683 u32 len = stats_req->buf_len; 2684 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 2685 char dwords_used_by_user_n[HTT_MAX_STRING_LEN] = {0}; 2686 u16 num_elems = tag_len >> 2; 2687 2688 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_SFM_CLIENT_USER_TLV_V:"); 2689 2690 ARRAY_TO_STRING(dwords_used_by_user_n, 2691 htt_stats_buf->dwords_used_by_user_n, 2692 num_elems); 2693 len += HTT_DBG_OUT(buf + len, buf_len - len, "dwords_used_by_user_n = %s\n", 2694 dwords_used_by_user_n); 2695 2696 if (len >= buf_len) 2697 buf[buf_len - 1] = 0; 2698 else 2699 buf[len] = 0; 2700 2701 stats_req->buf_len = len; 2702 } 2703 2704 static inline void htt_print_sfm_client_tlv(const void *tag_buf, 2705 struct debug_htt_stats_req *stats_req) 2706 { 2707 const struct htt_sfm_client_tlv *htt_stats_buf = tag_buf; 2708 u8 *buf = stats_req->buf; 2709 u32 len = stats_req->buf_len; 2710 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 2711 2712 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_SFM_CLIENT_TLV:"); 2713 len += HTT_DBG_OUT(buf + len, buf_len - len, "client_id = %u", 2714 htt_stats_buf->client_id); 2715 len += HTT_DBG_OUT(buf + len, buf_len - len, "buf_min = %u", 2716 htt_stats_buf->buf_min); 2717 len += HTT_DBG_OUT(buf + len, buf_len - len, "buf_max = %u", 2718 htt_stats_buf->buf_max); 2719 len += HTT_DBG_OUT(buf + len, buf_len - len, "buf_busy = %u", 2720 htt_stats_buf->buf_busy); 2721 len += HTT_DBG_OUT(buf + len, buf_len - len, "buf_alloc = %u", 2722 htt_stats_buf->buf_alloc); 2723 len += HTT_DBG_OUT(buf + len, buf_len - len, "buf_avail = %u", 2724 htt_stats_buf->buf_avail); 2725 len += HTT_DBG_OUT(buf + len, buf_len - len, "num_users = %u\n", 2726 htt_stats_buf->num_users); 2727 2728 if (len >= buf_len) 2729 buf[buf_len - 1] = 0; 2730 else 2731 buf[len] = 0; 2732 2733 stats_req->buf_len = len; 2734 } 2735 2736 static inline void htt_print_sfm_cmn_tlv(const void *tag_buf, 2737 struct debug_htt_stats_req *stats_req) 2738 { 2739 const struct htt_sfm_cmn_tlv *htt_stats_buf = tag_buf; 2740 u8 *buf = stats_req->buf; 2741 u32 len = stats_req->buf_len; 2742 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 2743 2744 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_SFM_CMN_TLV:"); 2745 len += HTT_DBG_OUT(buf + len, buf_len - len, "mac_id = %u", 2746 htt_stats_buf->mac_id__word & 0xFF); 2747 len += HTT_DBG_OUT(buf + len, buf_len - len, "buf_total = %u", 2748 htt_stats_buf->buf_total); 2749 len += HTT_DBG_OUT(buf + len, buf_len - len, "mem_empty = %u", 2750 htt_stats_buf->mem_empty); 2751 len += HTT_DBG_OUT(buf + len, buf_len - len, "deallocate_bufs = %u", 2752 htt_stats_buf->deallocate_bufs); 2753 len += HTT_DBG_OUT(buf + len, buf_len - len, "num_records = %u\n", 2754 htt_stats_buf->num_records); 2755 2756 if (len >= buf_len) 2757 buf[buf_len - 1] = 0; 2758 else 2759 buf[len] = 0; 2760 2761 stats_req->buf_len = len; 2762 } 2763 2764 static inline void htt_print_sring_stats_tlv(const void *tag_buf, 2765 struct debug_htt_stats_req *stats_req) 2766 { 2767 const struct htt_sring_stats_tlv *htt_stats_buf = tag_buf; 2768 u8 *buf = stats_req->buf; 2769 u32 len = stats_req->buf_len; 2770 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 2771 2772 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_SRING_STATS_TLV:"); 2773 len += HTT_DBG_OUT(buf + len, buf_len - len, "mac_id = %u", 2774 htt_stats_buf->mac_id__ring_id__arena__ep & 0xFF); 2775 len += HTT_DBG_OUT(buf + len, buf_len - len, "ring_id = %u", 2776 (htt_stats_buf->mac_id__ring_id__arena__ep & 0xFF00) >> 8); 2777 len += HTT_DBG_OUT(buf + len, buf_len - len, "arena = %u", 2778 (htt_stats_buf->mac_id__ring_id__arena__ep & 0xFF0000) >> 16); 2779 len += HTT_DBG_OUT(buf + len, buf_len - len, "ep = %u", 2780 (htt_stats_buf->mac_id__ring_id__arena__ep & 0x1000000) >> 24); 2781 len += HTT_DBG_OUT(buf + len, buf_len - len, "base_addr_lsb = 0x%x", 2782 htt_stats_buf->base_addr_lsb); 2783 len += HTT_DBG_OUT(buf + len, buf_len - len, "base_addr_msb = 0x%x", 2784 htt_stats_buf->base_addr_msb); 2785 len += HTT_DBG_OUT(buf + len, buf_len - len, "ring_size = %u", 2786 htt_stats_buf->ring_size); 2787 len += HTT_DBG_OUT(buf + len, buf_len - len, "elem_size = %u", 2788 htt_stats_buf->elem_size); 2789 len += HTT_DBG_OUT(buf + len, buf_len - len, "num_avail_words = %u", 2790 htt_stats_buf->num_avail_words__num_valid_words & 0xFFFF); 2791 len += HTT_DBG_OUT(buf + len, buf_len - len, "num_valid_words = %u", 2792 (htt_stats_buf->num_avail_words__num_valid_words & 2793 0xFFFF0000) >> 16); 2794 len += HTT_DBG_OUT(buf + len, buf_len - len, "head_ptr = %u", 2795 htt_stats_buf->head_ptr__tail_ptr & 0xFFFF); 2796 len += HTT_DBG_OUT(buf + len, buf_len - len, "tail_ptr = %u", 2797 (htt_stats_buf->head_ptr__tail_ptr & 0xFFFF0000) >> 16); 2798 len += HTT_DBG_OUT(buf + len, buf_len - len, "consumer_empty = %u", 2799 htt_stats_buf->consumer_empty__producer_full & 0xFFFF); 2800 len += HTT_DBG_OUT(buf + len, buf_len - len, "producer_full = %u", 2801 (htt_stats_buf->consumer_empty__producer_full & 2802 0xFFFF0000) >> 16); 2803 len += HTT_DBG_OUT(buf + len, buf_len - len, "prefetch_count = %u", 2804 htt_stats_buf->prefetch_count__internal_tail_ptr & 0xFFFF); 2805 len += HTT_DBG_OUT(buf + len, buf_len - len, "internal_tail_ptr = %u\n", 2806 (htt_stats_buf->prefetch_count__internal_tail_ptr & 2807 0xFFFF0000) >> 16); 2808 2809 if (len >= buf_len) 2810 buf[buf_len - 1] = 0; 2811 else 2812 buf[len] = 0; 2813 2814 stats_req->buf_len = len; 2815 } 2816 2817 static inline void htt_print_sring_cmn_tlv(const void *tag_buf, 2818 struct debug_htt_stats_req *stats_req) 2819 { 2820 const struct htt_sring_cmn_tlv *htt_stats_buf = tag_buf; 2821 u8 *buf = stats_req->buf; 2822 u32 len = stats_req->buf_len; 2823 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 2824 2825 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_SRING_CMN_TLV:"); 2826 len += HTT_DBG_OUT(buf + len, buf_len - len, "num_records = %u\n", 2827 htt_stats_buf->num_records); 2828 2829 if (len >= buf_len) 2830 buf[buf_len - 1] = 0; 2831 else 2832 buf[len] = 0; 2833 2834 stats_req->buf_len = len; 2835 } 2836 2837 static inline void htt_print_tx_pdev_rate_stats_tlv(const void *tag_buf, 2838 struct debug_htt_stats_req *stats_req) 2839 { 2840 const struct htt_tx_pdev_rate_stats_tlv *htt_stats_buf = tag_buf; 2841 u8 *buf = stats_req->buf; 2842 u32 len = stats_req->buf_len; 2843 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 2844 u8 j; 2845 char str_buf[HTT_MAX_STRING_LEN] = {0}; 2846 char *tx_gi[HTT_TX_PEER_STATS_NUM_GI_COUNTERS] = {NULL}; 2847 2848 for (j = 0; j < HTT_TX_PEER_STATS_NUM_GI_COUNTERS; j++) { 2849 tx_gi[j] = kmalloc(HTT_MAX_STRING_LEN, GFP_ATOMIC); 2850 if (!tx_gi[j]) 2851 goto fail; 2852 } 2853 2854 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_TX_PDEV_RATE_STATS_TLV:"); 2855 len += HTT_DBG_OUT(buf + len, buf_len - len, "mac_id = %u", 2856 htt_stats_buf->mac_id__word & 0xFF); 2857 len += HTT_DBG_OUT(buf + len, buf_len - len, "tx_ldpc = %u", 2858 htt_stats_buf->tx_ldpc); 2859 len += HTT_DBG_OUT(buf + len, buf_len - len, "ac_mu_mimo_tx_ldpc = %u", 2860 htt_stats_buf->ac_mu_mimo_tx_ldpc); 2861 len += HTT_DBG_OUT(buf + len, buf_len - len, "ax_mu_mimo_tx_ldpc = %u", 2862 htt_stats_buf->ax_mu_mimo_tx_ldpc); 2863 len += HTT_DBG_OUT(buf + len, buf_len - len, "ofdma_tx_ldpc = %u", 2864 htt_stats_buf->ofdma_tx_ldpc); 2865 len += HTT_DBG_OUT(buf + len, buf_len - len, "rts_cnt = %u", 2866 htt_stats_buf->rts_cnt); 2867 len += HTT_DBG_OUT(buf + len, buf_len - len, "rts_success = %u", 2868 htt_stats_buf->rts_success); 2869 len += HTT_DBG_OUT(buf + len, buf_len - len, "ack_rssi = %u", 2870 htt_stats_buf->ack_rssi); 2871 2872 len += HTT_DBG_OUT(buf + len, buf_len - len, 2873 "Legacy CCK Rates: 1 Mbps: %u, 2 Mbps: %u, 5.5 Mbps: %u, 11 Mbps: %u", 2874 htt_stats_buf->tx_legacy_cck_rate[0], 2875 htt_stats_buf->tx_legacy_cck_rate[1], 2876 htt_stats_buf->tx_legacy_cck_rate[2], 2877 htt_stats_buf->tx_legacy_cck_rate[3]); 2878 2879 len += HTT_DBG_OUT(buf + len, buf_len - len, 2880 "Legacy OFDM Rates: 6 Mbps: %u, 9 Mbps: %u, 12 Mbps: %u, 18 Mbps: %u\n" 2881 " 24 Mbps: %u, 36 Mbps: %u, 48 Mbps: %u, 54 Mbps: %u", 2882 htt_stats_buf->tx_legacy_ofdm_rate[0], 2883 htt_stats_buf->tx_legacy_ofdm_rate[1], 2884 htt_stats_buf->tx_legacy_ofdm_rate[2], 2885 htt_stats_buf->tx_legacy_ofdm_rate[3], 2886 htt_stats_buf->tx_legacy_ofdm_rate[4], 2887 htt_stats_buf->tx_legacy_ofdm_rate[5], 2888 htt_stats_buf->tx_legacy_ofdm_rate[6], 2889 htt_stats_buf->tx_legacy_ofdm_rate[7]); 2890 2891 memset(str_buf, 0x0, HTT_MAX_STRING_LEN); 2892 ARRAY_TO_STRING(str_buf, htt_stats_buf->tx_mcs, 2893 HTT_TX_PDEV_STATS_NUM_MCS_COUNTERS); 2894 len += HTT_DBG_OUT(buf + len, buf_len - len, "tx_mcs = %s ", str_buf); 2895 2896 memset(str_buf, 0x0, HTT_MAX_STRING_LEN); 2897 ARRAY_TO_STRING(str_buf, htt_stats_buf->ac_mu_mimo_tx_mcs, 2898 HTT_TX_PDEV_STATS_NUM_MCS_COUNTERS); 2899 len += HTT_DBG_OUT(buf + len, buf_len - len, "ac_mu_mimo_tx_mcs = %s ", str_buf); 2900 2901 memset(str_buf, 0x0, HTT_MAX_STRING_LEN); 2902 ARRAY_TO_STRING(str_buf, htt_stats_buf->ax_mu_mimo_tx_mcs, 2903 HTT_TX_PDEV_STATS_NUM_MCS_COUNTERS); 2904 len += HTT_DBG_OUT(buf + len, buf_len - len, "ax_mu_mimo_tx_mcs = %s ", str_buf); 2905 2906 memset(str_buf, 0x0, HTT_MAX_STRING_LEN); 2907 ARRAY_TO_STRING(str_buf, htt_stats_buf->ofdma_tx_mcs, 2908 HTT_TX_PDEV_STATS_NUM_MCS_COUNTERS); 2909 len += HTT_DBG_OUT(buf + len, buf_len - len, "ofdma_tx_mcs = %s ", str_buf); 2910 2911 memset(str_buf, 0x0, HTT_MAX_STRING_LEN); 2912 ARRAY_TO_STRING(str_buf, htt_stats_buf->tx_nss, 2913 HTT_TX_PDEV_STATS_NUM_SPATIAL_STREAMS); 2914 len += HTT_DBG_OUT(buf + len, buf_len - len, "tx_nss = %s ", str_buf); 2915 2916 memset(str_buf, 0x0, HTT_MAX_STRING_LEN); 2917 ARRAY_TO_STRING(str_buf, htt_stats_buf->ac_mu_mimo_tx_nss, 2918 HTT_TX_PDEV_STATS_NUM_SPATIAL_STREAMS); 2919 len += HTT_DBG_OUT(buf + len, buf_len - len, "ac_mu_mimo_tx_nss = %s ", str_buf); 2920 2921 memset(str_buf, 0x0, HTT_MAX_STRING_LEN); 2922 ARRAY_TO_STRING(str_buf, htt_stats_buf->ax_mu_mimo_tx_nss, 2923 HTT_TX_PDEV_STATS_NUM_SPATIAL_STREAMS); 2924 len += HTT_DBG_OUT(buf + len, buf_len - len, "ax_mu_mimo_tx_nss = %s ", str_buf); 2925 2926 memset(str_buf, 0x0, HTT_MAX_STRING_LEN); 2927 ARRAY_TO_STRING(str_buf, htt_stats_buf->ofdma_tx_nss, 2928 HTT_TX_PDEV_STATS_NUM_SPATIAL_STREAMS); 2929 len += HTT_DBG_OUT(buf + len, buf_len - len, "ofdma_tx_nss = %s ", str_buf); 2930 2931 memset(str_buf, 0x0, HTT_MAX_STRING_LEN); 2932 ARRAY_TO_STRING(str_buf, htt_stats_buf->tx_bw, 2933 HTT_TX_PDEV_STATS_NUM_BW_COUNTERS); 2934 len += HTT_DBG_OUT(buf + len, buf_len - len, "tx_bw = %s ", str_buf); 2935 2936 memset(str_buf, 0x0, HTT_MAX_STRING_LEN); 2937 ARRAY_TO_STRING(str_buf, htt_stats_buf->ac_mu_mimo_tx_bw, 2938 HTT_TX_PDEV_STATS_NUM_BW_COUNTERS); 2939 len += HTT_DBG_OUT(buf + len, buf_len - len, "ac_mu_mimo_tx_bw = %s ", str_buf); 2940 2941 memset(str_buf, 0x0, HTT_MAX_STRING_LEN); 2942 ARRAY_TO_STRING(str_buf, htt_stats_buf->ax_mu_mimo_tx_bw, 2943 HTT_TX_PDEV_STATS_NUM_BW_COUNTERS); 2944 len += HTT_DBG_OUT(buf + len, buf_len - len, "ax_mu_mimo_tx_bw = %s ", str_buf); 2945 2946 memset(str_buf, 0x0, HTT_MAX_STRING_LEN); 2947 ARRAY_TO_STRING(str_buf, htt_stats_buf->ofdma_tx_bw, 2948 HTT_TX_PDEV_STATS_NUM_BW_COUNTERS); 2949 len += HTT_DBG_OUT(buf + len, buf_len - len, "ofdma_tx_bw = %s ", str_buf); 2950 2951 memset(str_buf, 0x0, HTT_MAX_STRING_LEN); 2952 ARRAY_TO_STRING(str_buf, htt_stats_buf->tx_stbc, 2953 HTT_TX_PDEV_STATS_NUM_MCS_COUNTERS); 2954 len += HTT_DBG_OUT(buf + len, buf_len - len, "tx_stbc = %s ", str_buf); 2955 2956 memset(str_buf, 0x0, HTT_MAX_STRING_LEN); 2957 ARRAY_TO_STRING(str_buf, htt_stats_buf->tx_pream, 2958 HTT_TX_PDEV_STATS_NUM_PREAMBLE_TYPES); 2959 len += HTT_DBG_OUT(buf + len, buf_len - len, "tx_pream = %s ", str_buf); 2960 2961 len += HTT_DBG_OUT(buf + len, buf_len - len, "HE LTF: 1x: %u, 2x: %u, 4x: %u", 2962 htt_stats_buf->tx_he_ltf[1], 2963 htt_stats_buf->tx_he_ltf[2], 2964 htt_stats_buf->tx_he_ltf[3]); 2965 2966 /* SU GI Stats */ 2967 for (j = 0; j < HTT_TX_PDEV_STATS_NUM_GI_COUNTERS; j++) { 2968 ARRAY_TO_STRING(tx_gi[j], htt_stats_buf->tx_gi[j], 2969 HTT_TX_PDEV_STATS_NUM_MCS_COUNTERS); 2970 len += HTT_DBG_OUT(buf + len, buf_len - len, "tx_gi[%u] = %s ", 2971 j, tx_gi[j]); 2972 } 2973 2974 /* AC MU-MIMO GI Stats */ 2975 for (j = 0; j < HTT_TX_PDEV_STATS_NUM_GI_COUNTERS; j++) { 2976 ARRAY_TO_STRING(tx_gi[j], htt_stats_buf->ac_mu_mimo_tx_gi[j], 2977 HTT_TX_PDEV_STATS_NUM_MCS_COUNTERS); 2978 len += HTT_DBG_OUT(buf + len, buf_len - len, 2979 "ac_mu_mimo_tx_gi[%u] = %s ", 2980 j, tx_gi[j]); 2981 } 2982 2983 /* AX MU-MIMO GI Stats */ 2984 for (j = 0; j < HTT_TX_PDEV_STATS_NUM_GI_COUNTERS; j++) { 2985 ARRAY_TO_STRING(tx_gi[j], htt_stats_buf->ax_mu_mimo_tx_gi[j], 2986 HTT_TX_PDEV_STATS_NUM_MCS_COUNTERS); 2987 len += HTT_DBG_OUT(buf + len, buf_len - len, 2988 "ax_mu_mimo_tx_gi[%u] = %s ", 2989 j, tx_gi[j]); 2990 } 2991 2992 /* DL OFDMA GI Stats */ 2993 for (j = 0; j < HTT_TX_PDEV_STATS_NUM_GI_COUNTERS; j++) { 2994 ARRAY_TO_STRING(tx_gi[j], htt_stats_buf->ofdma_tx_gi[j], 2995 HTT_TX_PDEV_STATS_NUM_MCS_COUNTERS); 2996 len += HTT_DBG_OUT(buf + len, buf_len - len, "ofdma_tx_gi[%u] = %s ", 2997 j, tx_gi[j]); 2998 } 2999 3000 memset(str_buf, 0x0, HTT_MAX_STRING_LEN); 3001 ARRAY_TO_STRING(str_buf, htt_stats_buf->tx_dcm, 3002 HTT_TX_PDEV_STATS_NUM_DCM_COUNTERS); 3003 len += HTT_DBG_OUT(buf + len, buf_len - len, "tx_dcm = %s\n", str_buf); 3004 3005 if (len >= buf_len) 3006 buf[buf_len - 1] = 0; 3007 else 3008 buf[len] = 0; 3009 3010 stats_req->buf_len = len; 3011 fail: 3012 for (j = 0; j < HTT_TX_PEER_STATS_NUM_GI_COUNTERS; j++) 3013 kfree(tx_gi[j]); 3014 } 3015 3016 static inline void htt_print_rx_pdev_rate_stats_tlv(const void *tag_buf, 3017 struct debug_htt_stats_req *stats_req) 3018 { 3019 const struct htt_rx_pdev_rate_stats_tlv *htt_stats_buf = tag_buf; 3020 u8 *buf = stats_req->buf; 3021 u32 len = stats_req->buf_len; 3022 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 3023 u8 i, j; 3024 u16 index = 0; 3025 char *rssi_chain[HTT_RX_PDEV_STATS_NUM_SPATIAL_STREAMS] = {NULL}; 3026 char *rx_gi[HTT_RX_PDEV_STATS_NUM_GI_COUNTERS] = {NULL}; 3027 char str_buf[HTT_MAX_STRING_LEN] = {0}; 3028 char *rx_pilot_evm_db[HTT_RX_PDEV_STATS_NUM_SPATIAL_STREAMS] = {NULL}; 3029 3030 for (j = 0; j < HTT_RX_PDEV_STATS_NUM_SPATIAL_STREAMS; j++) { 3031 rssi_chain[j] = kmalloc(HTT_MAX_STRING_LEN, GFP_ATOMIC); 3032 if (!rssi_chain[j]) 3033 goto fail; 3034 } 3035 3036 for (j = 0; j < HTT_RX_PDEV_STATS_NUM_GI_COUNTERS; j++) { 3037 rx_gi[j] = kmalloc(HTT_MAX_STRING_LEN, GFP_ATOMIC); 3038 if (!rx_gi[j]) 3039 goto fail; 3040 } 3041 3042 for (j = 0; j < HTT_RX_PDEV_STATS_NUM_SPATIAL_STREAMS; j++) { 3043 rx_pilot_evm_db[j] = kmalloc(HTT_MAX_STRING_LEN, GFP_ATOMIC); 3044 if (!rx_pilot_evm_db[j]) 3045 goto fail; 3046 } 3047 3048 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_RX_PDEV_RATE_STATS_TLV:"); 3049 len += HTT_DBG_OUT(buf + len, buf_len - len, "mac_id = %u", 3050 htt_stats_buf->mac_id__word & 0xFF); 3051 len += HTT_DBG_OUT(buf + len, buf_len - len, "nsts = %u", 3052 htt_stats_buf->nsts); 3053 len += HTT_DBG_OUT(buf + len, buf_len - len, "rx_ldpc = %u", 3054 htt_stats_buf->rx_ldpc); 3055 len += HTT_DBG_OUT(buf + len, buf_len - len, "rts_cnt = %u", 3056 htt_stats_buf->rts_cnt); 3057 len += HTT_DBG_OUT(buf + len, buf_len - len, "rssi_mgmt = %u", 3058 htt_stats_buf->rssi_mgmt); 3059 len += HTT_DBG_OUT(buf + len, buf_len - len, "rssi_data = %u", 3060 htt_stats_buf->rssi_data); 3061 len += HTT_DBG_OUT(buf + len, buf_len - len, "rssi_comb = %u", 3062 htt_stats_buf->rssi_comb); 3063 len += HTT_DBG_OUT(buf + len, buf_len - len, "rssi_in_dbm = %d", 3064 htt_stats_buf->rssi_in_dbm); 3065 3066 memset(str_buf, 0x0, HTT_MAX_STRING_LEN); 3067 ARRAY_TO_STRING(str_buf, htt_stats_buf->rx_mcs, 3068 HTT_RX_PDEV_STATS_NUM_MCS_COUNTERS); 3069 len += HTT_DBG_OUT(buf + len, buf_len - len, "rx_mcs = %s ", str_buf); 3070 3071 memset(str_buf, 0x0, HTT_MAX_STRING_LEN); 3072 ARRAY_TO_STRING(str_buf, htt_stats_buf->rx_nss, 3073 HTT_RX_PDEV_STATS_NUM_SPATIAL_STREAMS); 3074 len += HTT_DBG_OUT(buf + len, buf_len - len, "rx_nss = %s ", str_buf); 3075 3076 memset(str_buf, 0x0, HTT_MAX_STRING_LEN); 3077 ARRAY_TO_STRING(str_buf, htt_stats_buf->rx_dcm, 3078 HTT_RX_PDEV_STATS_NUM_DCM_COUNTERS); 3079 len += HTT_DBG_OUT(buf + len, buf_len - len, "rx_dcm = %s ", str_buf); 3080 3081 memset(str_buf, 0x0, HTT_MAX_STRING_LEN); 3082 ARRAY_TO_STRING(str_buf, htt_stats_buf->rx_stbc, 3083 HTT_RX_PDEV_STATS_NUM_MCS_COUNTERS); 3084 len += HTT_DBG_OUT(buf + len, buf_len - len, "rx_stbc = %s ", str_buf); 3085 3086 memset(str_buf, 0x0, HTT_MAX_STRING_LEN); 3087 ARRAY_TO_STRING(str_buf, htt_stats_buf->rx_bw, 3088 HTT_RX_PDEV_STATS_NUM_BW_COUNTERS); 3089 len += HTT_DBG_OUT(buf + len, buf_len - len, "rx_bw = %s ", str_buf); 3090 len += HTT_DBG_OUT(buf + len, buf_len - len, "rx_evm_nss_count = %u", 3091 htt_stats_buf->nss_count); 3092 3093 len += HTT_DBG_OUT(buf + len, buf_len - len, "rx_evm_pilot_count = %u", 3094 htt_stats_buf->pilot_count); 3095 3096 for (j = 0; j < HTT_RX_PDEV_STATS_NUM_SPATIAL_STREAMS; j++) { 3097 index = 0; 3098 3099 for (i = 0; i < HTT_RX_PDEV_STATS_RXEVM_MAX_PILOTS_PER_NSS; i++) 3100 index += scnprintf(&rx_pilot_evm_db[j][index], 3101 HTT_MAX_STRING_LEN - index, 3102 " %u:%d,", 3103 i, 3104 htt_stats_buf->rx_pilot_evm_db[j][i]); 3105 len += HTT_DBG_OUT(buf + len, buf_len - len, "pilot_evm_dB[%u] = %s ", 3106 j, rx_pilot_evm_db[j]); 3107 } 3108 3109 index = 0; 3110 memset(str_buf, 0x0, HTT_MAX_STRING_LEN); 3111 for (i = 0; i < HTT_RX_PDEV_STATS_NUM_SPATIAL_STREAMS; i++) 3112 index += scnprintf(&str_buf[index], 3113 HTT_MAX_STRING_LEN - index, 3114 " %u:%d,", i, htt_stats_buf->rx_pilot_evm_db_mean[i]); 3115 len += HTT_DBG_OUT(buf + len, buf_len - len, "pilot_evm_dB_mean = %s ", str_buf); 3116 3117 for (j = 0; j < HTT_RX_PDEV_STATS_NUM_SPATIAL_STREAMS; j++) { 3118 ARRAY_TO_STRING(rssi_chain[j], htt_stats_buf->rssi_chain[j], 3119 HTT_RX_PDEV_STATS_NUM_BW_COUNTERS); 3120 len += HTT_DBG_OUT(buf + len, buf_len - len, "rssi_chain[%u] = %s ", 3121 j, rssi_chain[j]); 3122 } 3123 3124 for (j = 0; j < HTT_RX_PDEV_STATS_NUM_GI_COUNTERS; j++) { 3125 ARRAY_TO_STRING(rx_gi[j], htt_stats_buf->rx_gi[j], 3126 HTT_RX_PDEV_STATS_NUM_MCS_COUNTERS); 3127 len += HTT_DBG_OUT(buf + len, buf_len - len, "rx_gi[%u] = %s ", 3128 j, rx_gi[j]); 3129 } 3130 3131 memset(str_buf, 0x0, HTT_MAX_STRING_LEN); 3132 ARRAY_TO_STRING(str_buf, htt_stats_buf->rx_pream, 3133 HTT_RX_PDEV_STATS_NUM_PREAMBLE_TYPES); 3134 len += HTT_DBG_OUT(buf + len, buf_len - len, "rx_pream = %s", str_buf); 3135 3136 len += HTT_DBG_OUT(buf + len, buf_len - len, "rx_11ax_su_ext = %u", 3137 htt_stats_buf->rx_11ax_su_ext); 3138 len += HTT_DBG_OUT(buf + len, buf_len - len, "rx_11ac_mumimo = %u", 3139 htt_stats_buf->rx_11ac_mumimo); 3140 len += HTT_DBG_OUT(buf + len, buf_len - len, "rx_11ax_mumimo = %u", 3141 htt_stats_buf->rx_11ax_mumimo); 3142 len += HTT_DBG_OUT(buf + len, buf_len - len, "rx_11ax_ofdma = %u", 3143 htt_stats_buf->rx_11ax_ofdma); 3144 len += HTT_DBG_OUT(buf + len, buf_len - len, "txbf = %u", 3145 htt_stats_buf->txbf); 3146 3147 memset(str_buf, 0x0, HTT_MAX_STRING_LEN); 3148 ARRAY_TO_STRING(str_buf, htt_stats_buf->rx_legacy_cck_rate, 3149 HTT_RX_PDEV_STATS_NUM_LEGACY_CCK_STATS); 3150 len += HTT_DBG_OUT(buf + len, buf_len - len, "rx_legacy_cck_rate = %s ", 3151 str_buf); 3152 3153 memset(str_buf, 0x0, HTT_MAX_STRING_LEN); 3154 ARRAY_TO_STRING(str_buf, htt_stats_buf->rx_legacy_ofdm_rate, 3155 HTT_RX_PDEV_STATS_NUM_LEGACY_OFDM_STATS); 3156 len += HTT_DBG_OUT(buf + len, buf_len - len, "rx_legacy_ofdm_rate = %s ", 3157 str_buf); 3158 3159 len += HTT_DBG_OUT(buf + len, buf_len - len, "rx_active_dur_us_low = %u", 3160 htt_stats_buf->rx_active_dur_us_low); 3161 len += HTT_DBG_OUT(buf + len, buf_len - len, "rx_active_dur_us_high = %u", 3162 htt_stats_buf->rx_active_dur_us_high); 3163 len += HTT_DBG_OUT(buf + len, buf_len - len, "rx_11ax_ul_ofdma = %u", 3164 htt_stats_buf->rx_11ax_ul_ofdma); 3165 3166 memset(str_buf, 0x0, HTT_MAX_STRING_LEN); 3167 ARRAY_TO_STRING(str_buf, htt_stats_buf->ul_ofdma_rx_mcs, 3168 HTT_RX_PDEV_STATS_NUM_MCS_COUNTERS); 3169 len += HTT_DBG_OUT(buf + len, buf_len - len, "ul_ofdma_rx_mcs = %s ", str_buf); 3170 3171 for (j = 0; j < HTT_RX_PDEV_STATS_NUM_GI_COUNTERS; j++) { 3172 ARRAY_TO_STRING(rx_gi[j], htt_stats_buf->ul_ofdma_rx_gi[j], 3173 HTT_RX_PDEV_STATS_NUM_MCS_COUNTERS); 3174 len += HTT_DBG_OUT(buf + len, buf_len - len, "ul_ofdma_rx_gi[%u] = %s ", 3175 j, rx_gi[j]); 3176 } 3177 3178 memset(str_buf, 0x0, HTT_MAX_STRING_LEN); 3179 ARRAY_TO_STRING(str_buf, htt_stats_buf->ul_ofdma_rx_nss, 3180 HTT_RX_PDEV_STATS_NUM_SPATIAL_STREAMS); 3181 len += HTT_DBG_OUT(buf + len, buf_len - len, "ul_ofdma_rx_nss = %s ", str_buf); 3182 3183 memset(str_buf, 0x0, HTT_MAX_STRING_LEN); 3184 ARRAY_TO_STRING(str_buf, htt_stats_buf->ul_ofdma_rx_bw, 3185 HTT_RX_PDEV_STATS_NUM_BW_COUNTERS); 3186 len += HTT_DBG_OUT(buf + len, buf_len - len, "ul_ofdma_rx_bw = %s ", str_buf); 3187 3188 len += HTT_DBG_OUT(buf + len, buf_len - len, "ul_ofdma_rx_stbc = %u", 3189 htt_stats_buf->ul_ofdma_rx_stbc); 3190 len += HTT_DBG_OUT(buf + len, buf_len - len, "ul_ofdma_rx_ldpc = %u", 3191 htt_stats_buf->ul_ofdma_rx_ldpc); 3192 3193 memset(str_buf, 0x0, HTT_MAX_STRING_LEN); 3194 ARRAY_TO_STRING(str_buf, htt_stats_buf->rx_ulofdma_non_data_ppdu, 3195 HTT_RX_PDEV_MAX_OFDMA_NUM_USER); 3196 len += HTT_DBG_OUT(buf + len, buf_len - len, "rx_ulofdma_non_data_ppdu = %s ", 3197 str_buf); 3198 3199 memset(str_buf, 0x0, HTT_MAX_STRING_LEN); 3200 ARRAY_TO_STRING(str_buf, htt_stats_buf->rx_ulofdma_data_ppdu, 3201 HTT_RX_PDEV_MAX_OFDMA_NUM_USER); 3202 len += HTT_DBG_OUT(buf + len, buf_len - len, "rx_ulofdma_data_ppdu = %s ", 3203 str_buf); 3204 3205 memset(str_buf, 0x0, HTT_MAX_STRING_LEN); 3206 ARRAY_TO_STRING(str_buf, htt_stats_buf->rx_ulofdma_mpdu_ok, 3207 HTT_RX_PDEV_MAX_OFDMA_NUM_USER); 3208 len += HTT_DBG_OUT(buf + len, buf_len - len, "rx_ulofdma_mpdu_ok = %s ", str_buf); 3209 3210 memset(str_buf, 0x0, HTT_MAX_STRING_LEN); 3211 ARRAY_TO_STRING(str_buf, htt_stats_buf->rx_ulofdma_mpdu_fail, 3212 HTT_RX_PDEV_MAX_OFDMA_NUM_USER); 3213 len += HTT_DBG_OUT(buf + len, buf_len - len, "rx_ulofdma_mpdu_fail = %s", 3214 str_buf); 3215 3216 for (j = 0; j < HTT_RX_PDEV_STATS_NUM_SPATIAL_STREAMS; j++) { 3217 index = 0; 3218 memset(str_buf, 0x0, HTT_MAX_STRING_LEN); 3219 for (i = 0; i < HTT_RX_PDEV_MAX_OFDMA_NUM_USER; i++) 3220 index += scnprintf(&str_buf[index], 3221 HTT_MAX_STRING_LEN - index, 3222 " %u:%d,", 3223 i, htt_stats_buf->rx_ul_fd_rssi[j][i]); 3224 len += HTT_DBG_OUT(buf + len, buf_len - len, 3225 "rx_ul_fd_rssi: nss[%u] = %s", j, str_buf); 3226 } 3227 3228 len += HTT_DBG_OUT(buf + len, buf_len - len, "per_chain_rssi_pkt_type = %#x", 3229 htt_stats_buf->per_chain_rssi_pkt_type); 3230 3231 for (j = 0; j < HTT_RX_PDEV_STATS_NUM_SPATIAL_STREAMS; j++) { 3232 index = 0; 3233 memset(str_buf, 0x0, HTT_MAX_STRING_LEN); 3234 for (i = 0; i < HTT_RX_PDEV_STATS_NUM_BW_COUNTERS; i++) 3235 index += scnprintf(&str_buf[index], 3236 HTT_MAX_STRING_LEN - index, 3237 " %u:%d,", 3238 i, 3239 htt_stats_buf->rx_per_chain_rssi_in_dbm[j][i]); 3240 len += HTT_DBG_OUT(buf + len, buf_len - len, 3241 "rx_per_chain_rssi_in_dbm[%u] = %s ", j, str_buf); 3242 } 3243 len += HTT_DBG_OUT(buf + len, buf_len - len, "\n"); 3244 3245 if (len >= buf_len) 3246 buf[buf_len - 1] = 0; 3247 else 3248 buf[len] = 0; 3249 3250 stats_req->buf_len = len; 3251 3252 fail: 3253 for (j = 0; j < HTT_RX_PDEV_STATS_NUM_SPATIAL_STREAMS; j++) 3254 kfree(rssi_chain[j]); 3255 3256 for (j = 0; j < HTT_RX_PDEV_STATS_NUM_SPATIAL_STREAMS; j++) 3257 kfree(rx_pilot_evm_db[j]); 3258 3259 for (i = 0; i < HTT_RX_PDEV_STATS_NUM_GI_COUNTERS; i++) 3260 kfree(rx_gi[i]); 3261 } 3262 3263 static inline void htt_print_rx_soc_fw_stats_tlv(const void *tag_buf, 3264 struct debug_htt_stats_req *stats_req) 3265 { 3266 const struct htt_rx_soc_fw_stats_tlv *htt_stats_buf = tag_buf; 3267 u8 *buf = stats_req->buf; 3268 u32 len = stats_req->buf_len; 3269 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 3270 3271 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_RX_SOC_FW_STATS_TLV:"); 3272 len += HTT_DBG_OUT(buf + len, buf_len - len, "fw_reo_ring_data_msdu = %u", 3273 htt_stats_buf->fw_reo_ring_data_msdu); 3274 len += HTT_DBG_OUT(buf + len, buf_len - len, "fw_to_host_data_msdu_bcmc = %u", 3275 htt_stats_buf->fw_to_host_data_msdu_bcmc); 3276 len += HTT_DBG_OUT(buf + len, buf_len - len, "fw_to_host_data_msdu_uc = %u", 3277 htt_stats_buf->fw_to_host_data_msdu_uc); 3278 len += HTT_DBG_OUT(buf + len, buf_len - len, 3279 "ofld_remote_data_buf_recycle_cnt = %u", 3280 htt_stats_buf->ofld_remote_data_buf_recycle_cnt); 3281 len += HTT_DBG_OUT(buf + len, buf_len - len, 3282 "ofld_remote_free_buf_indication_cnt = %u", 3283 htt_stats_buf->ofld_remote_free_buf_indication_cnt); 3284 len += HTT_DBG_OUT(buf + len, buf_len - len, 3285 "ofld_buf_to_host_data_msdu_uc = %u", 3286 htt_stats_buf->ofld_buf_to_host_data_msdu_uc); 3287 len += HTT_DBG_OUT(buf + len, buf_len - len, 3288 "reo_fw_ring_to_host_data_msdu_uc = %u", 3289 htt_stats_buf->reo_fw_ring_to_host_data_msdu_uc); 3290 len += HTT_DBG_OUT(buf + len, buf_len - len, "wbm_sw_ring_reap = %u", 3291 htt_stats_buf->wbm_sw_ring_reap); 3292 len += HTT_DBG_OUT(buf + len, buf_len - len, "wbm_forward_to_host_cnt = %u", 3293 htt_stats_buf->wbm_forward_to_host_cnt); 3294 len += HTT_DBG_OUT(buf + len, buf_len - len, "wbm_target_recycle_cnt = %u", 3295 htt_stats_buf->wbm_target_recycle_cnt); 3296 len += HTT_DBG_OUT(buf + len, buf_len - len, 3297 "target_refill_ring_recycle_cnt = %u", 3298 htt_stats_buf->target_refill_ring_recycle_cnt); 3299 3300 if (len >= buf_len) 3301 buf[buf_len - 1] = 0; 3302 else 3303 buf[len] = 0; 3304 3305 stats_req->buf_len = len; 3306 } 3307 3308 static inline void 3309 htt_print_rx_soc_fw_refill_ring_empty_tlv_v(const void *tag_buf, 3310 u16 tag_len, 3311 struct debug_htt_stats_req *stats_req) 3312 { 3313 const struct htt_rx_soc_fw_refill_ring_empty_tlv_v *htt_stats_buf = tag_buf; 3314 u8 *buf = stats_req->buf; 3315 u32 len = stats_req->buf_len; 3316 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 3317 char refill_ring_empty_cnt[HTT_MAX_STRING_LEN] = {0}; 3318 u16 num_elems = min_t(u16, (tag_len >> 2), HTT_RX_STATS_REFILL_MAX_RING); 3319 3320 len += HTT_DBG_OUT(buf + len, buf_len - len, 3321 "HTT_RX_SOC_FW_REFILL_RING_EMPTY_TLV_V:"); 3322 3323 ARRAY_TO_STRING(refill_ring_empty_cnt, 3324 htt_stats_buf->refill_ring_empty_cnt, 3325 num_elems); 3326 len += HTT_DBG_OUT(buf + len, buf_len - len, "refill_ring_empty_cnt = %s\n", 3327 refill_ring_empty_cnt); 3328 3329 if (len >= buf_len) 3330 buf[buf_len - 1] = 0; 3331 else 3332 buf[len] = 0; 3333 3334 stats_req->buf_len = len; 3335 } 3336 3337 static inline void 3338 htt_print_rx_soc_fw_refill_ring_num_rxdma_err_tlv_v(const void *tag_buf, 3339 u16 tag_len, 3340 struct debug_htt_stats_req *stats_req) 3341 { 3342 const struct htt_rx_soc_fw_refill_ring_num_rxdma_err_tlv_v *htt_stats_buf = 3343 tag_buf; 3344 u8 *buf = stats_req->buf; 3345 u32 len = stats_req->buf_len; 3346 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 3347 char rxdma_err_cnt[HTT_MAX_STRING_LEN] = {0}; 3348 u16 num_elems = min_t(u16, (tag_len >> 2), HTT_RX_RXDMA_MAX_ERR_CODE); 3349 3350 len += HTT_DBG_OUT(buf + len, buf_len - len, 3351 "HTT_RX_SOC_FW_REFILL_RING_NUM_RXDMA_ERR_TLV_V:"); 3352 3353 ARRAY_TO_STRING(rxdma_err_cnt, 3354 htt_stats_buf->rxdma_err, 3355 num_elems); 3356 len += HTT_DBG_OUT(buf + len, buf_len - len, "rxdma_err = %s\n", 3357 rxdma_err_cnt); 3358 3359 if (len >= buf_len) 3360 buf[buf_len - 1] = 0; 3361 else 3362 buf[len] = 0; 3363 3364 stats_req->buf_len = len; 3365 } 3366 3367 static inline void 3368 htt_print_rx_soc_fw_refill_ring_num_reo_err_tlv_v(const void *tag_buf, 3369 u16 tag_len, 3370 struct debug_htt_stats_req *stats_req) 3371 { 3372 const struct htt_rx_soc_fw_refill_ring_num_reo_err_tlv_v *htt_stats_buf = tag_buf; 3373 u8 *buf = stats_req->buf; 3374 u32 len = stats_req->buf_len; 3375 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 3376 char reo_err_cnt[HTT_MAX_STRING_LEN] = {0}; 3377 u16 num_elems = min_t(u16, (tag_len >> 2), HTT_RX_REO_MAX_ERR_CODE); 3378 3379 len += HTT_DBG_OUT(buf + len, buf_len - len, 3380 "HTT_RX_SOC_FW_REFILL_RING_NUM_REO_ERR_TLV_V:"); 3381 3382 ARRAY_TO_STRING(reo_err_cnt, 3383 htt_stats_buf->reo_err, 3384 num_elems); 3385 len += HTT_DBG_OUT(buf + len, buf_len - len, "reo_err = %s\n", 3386 reo_err_cnt); 3387 3388 if (len >= buf_len) 3389 buf[buf_len - 1] = 0; 3390 else 3391 buf[len] = 0; 3392 3393 stats_req->buf_len = len; 3394 } 3395 3396 static inline void 3397 htt_print_rx_reo_debug_stats_tlv_v(const void *tag_buf, 3398 struct debug_htt_stats_req *stats_req) 3399 { 3400 const struct htt_rx_reo_resource_stats_tlv_v *htt_stats_buf = tag_buf; 3401 u8 *buf = stats_req->buf; 3402 u32 len = stats_req->buf_len; 3403 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 3404 3405 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_RX_REO_RESOURCE_STATS_TLV:"); 3406 len += HTT_DBG_OUT(buf + len, buf_len - len, "sample_id = %u", 3407 htt_stats_buf->sample_id); 3408 len += HTT_DBG_OUT(buf + len, buf_len - len, "total_max = %u", 3409 htt_stats_buf->total_max); 3410 len += HTT_DBG_OUT(buf + len, buf_len - len, "total_avg = %u", 3411 htt_stats_buf->total_avg); 3412 len += HTT_DBG_OUT(buf + len, buf_len - len, "total_sample = %u", 3413 htt_stats_buf->total_sample); 3414 len += HTT_DBG_OUT(buf + len, buf_len - len, "non_zeros_avg = %u", 3415 htt_stats_buf->non_zeros_avg); 3416 len += HTT_DBG_OUT(buf + len, buf_len - len, "non_zeros_sample = %u", 3417 htt_stats_buf->non_zeros_sample); 3418 len += HTT_DBG_OUT(buf + len, buf_len - len, "last_non_zeros_max = %u", 3419 htt_stats_buf->last_non_zeros_max); 3420 len += HTT_DBG_OUT(buf + len, buf_len - len, "last_non_zeros_min %u", 3421 htt_stats_buf->last_non_zeros_min); 3422 len += HTT_DBG_OUT(buf + len, buf_len - len, "last_non_zeros_avg %u", 3423 htt_stats_buf->last_non_zeros_avg); 3424 len += HTT_DBG_OUT(buf + len, buf_len - len, "last_non_zeros_sample %u\n", 3425 htt_stats_buf->last_non_zeros_sample); 3426 3427 if (len >= buf_len) 3428 buf[buf_len - 1] = 0; 3429 else 3430 buf[len] = 0; 3431 3432 stats_req->buf_len = len; 3433 } 3434 3435 static inline void 3436 htt_print_rx_soc_fw_refill_ring_num_refill_tlv_v(const void *tag_buf, 3437 u16 tag_len, 3438 struct debug_htt_stats_req *stats_req) 3439 { 3440 const struct htt_rx_soc_fw_refill_ring_num_refill_tlv_v *htt_stats_buf = tag_buf; 3441 u8 *buf = stats_req->buf; 3442 u32 len = stats_req->buf_len; 3443 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 3444 char refill_ring_num_refill[HTT_MAX_STRING_LEN] = {0}; 3445 u16 num_elems = min_t(u16, (tag_len >> 2), HTT_RX_STATS_REFILL_MAX_RING); 3446 3447 len += HTT_DBG_OUT(buf + len, buf_len - len, 3448 "HTT_RX_SOC_FW_REFILL_RING_NUM_REFILL_TLV_V:"); 3449 3450 ARRAY_TO_STRING(refill_ring_num_refill, 3451 htt_stats_buf->refill_ring_num_refill, 3452 num_elems); 3453 len += HTT_DBG_OUT(buf + len, buf_len - len, "refill_ring_num_refill = %s\n", 3454 refill_ring_num_refill); 3455 3456 if (len >= buf_len) 3457 buf[buf_len - 1] = 0; 3458 else 3459 buf[len] = 0; 3460 3461 stats_req->buf_len = len; 3462 } 3463 3464 static inline void htt_print_rx_pdev_fw_stats_tlv(const void *tag_buf, 3465 struct debug_htt_stats_req *stats_req) 3466 { 3467 const struct htt_rx_pdev_fw_stats_tlv *htt_stats_buf = tag_buf; 3468 u8 *buf = stats_req->buf; 3469 u32 len = stats_req->buf_len; 3470 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 3471 char fw_ring_mgmt_subtype[HTT_MAX_STRING_LEN] = {0}; 3472 char fw_ring_ctrl_subtype[HTT_MAX_STRING_LEN] = {0}; 3473 3474 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_RX_PDEV_FW_STATS_TLV:"); 3475 len += HTT_DBG_OUT(buf + len, buf_len - len, "mac_id = %u", 3476 htt_stats_buf->mac_id__word & 0xFF); 3477 len += HTT_DBG_OUT(buf + len, buf_len - len, "ppdu_recvd = %u", 3478 htt_stats_buf->ppdu_recvd); 3479 len += HTT_DBG_OUT(buf + len, buf_len - len, "mpdu_cnt_fcs_ok = %u", 3480 htt_stats_buf->mpdu_cnt_fcs_ok); 3481 len += HTT_DBG_OUT(buf + len, buf_len - len, "mpdu_cnt_fcs_err = %u", 3482 htt_stats_buf->mpdu_cnt_fcs_err); 3483 len += HTT_DBG_OUT(buf + len, buf_len - len, "tcp_msdu_cnt = %u", 3484 htt_stats_buf->tcp_msdu_cnt); 3485 len += HTT_DBG_OUT(buf + len, buf_len - len, "tcp_ack_msdu_cnt = %u", 3486 htt_stats_buf->tcp_ack_msdu_cnt); 3487 len += HTT_DBG_OUT(buf + len, buf_len - len, "udp_msdu_cnt = %u", 3488 htt_stats_buf->udp_msdu_cnt); 3489 len += HTT_DBG_OUT(buf + len, buf_len - len, "other_msdu_cnt = %u", 3490 htt_stats_buf->other_msdu_cnt); 3491 len += HTT_DBG_OUT(buf + len, buf_len - len, "fw_ring_mpdu_ind = %u", 3492 htt_stats_buf->fw_ring_mpdu_ind); 3493 3494 ARRAY_TO_STRING(fw_ring_mgmt_subtype, 3495 htt_stats_buf->fw_ring_mgmt_subtype, 3496 HTT_STATS_SUBTYPE_MAX); 3497 len += HTT_DBG_OUT(buf + len, buf_len - len, "fw_ring_mgmt_subtype = %s ", 3498 fw_ring_mgmt_subtype); 3499 3500 ARRAY_TO_STRING(fw_ring_ctrl_subtype, 3501 htt_stats_buf->fw_ring_ctrl_subtype, 3502 HTT_STATS_SUBTYPE_MAX); 3503 len += HTT_DBG_OUT(buf + len, buf_len - len, "fw_ring_ctrl_subtype = %s ", 3504 fw_ring_ctrl_subtype); 3505 len += HTT_DBG_OUT(buf + len, buf_len - len, "fw_ring_mcast_data_msdu = %u", 3506 htt_stats_buf->fw_ring_mcast_data_msdu); 3507 len += HTT_DBG_OUT(buf + len, buf_len - len, "fw_ring_bcast_data_msdu = %u", 3508 htt_stats_buf->fw_ring_bcast_data_msdu); 3509 len += HTT_DBG_OUT(buf + len, buf_len - len, "fw_ring_ucast_data_msdu = %u", 3510 htt_stats_buf->fw_ring_ucast_data_msdu); 3511 len += HTT_DBG_OUT(buf + len, buf_len - len, "fw_ring_null_data_msdu = %u", 3512 htt_stats_buf->fw_ring_null_data_msdu); 3513 len += HTT_DBG_OUT(buf + len, buf_len - len, "fw_ring_mpdu_drop = %u", 3514 htt_stats_buf->fw_ring_mpdu_drop); 3515 len += HTT_DBG_OUT(buf + len, buf_len - len, "ofld_local_data_ind_cnt = %u", 3516 htt_stats_buf->ofld_local_data_ind_cnt); 3517 len += HTT_DBG_OUT(buf + len, buf_len - len, 3518 "ofld_local_data_buf_recycle_cnt = %u", 3519 htt_stats_buf->ofld_local_data_buf_recycle_cnt); 3520 len += HTT_DBG_OUT(buf + len, buf_len - len, "drx_local_data_ind_cnt = %u", 3521 htt_stats_buf->drx_local_data_ind_cnt); 3522 len += HTT_DBG_OUT(buf + len, buf_len - len, 3523 "drx_local_data_buf_recycle_cnt = %u", 3524 htt_stats_buf->drx_local_data_buf_recycle_cnt); 3525 len += HTT_DBG_OUT(buf + len, buf_len - len, "local_nondata_ind_cnt = %u", 3526 htt_stats_buf->local_nondata_ind_cnt); 3527 len += HTT_DBG_OUT(buf + len, buf_len - len, "local_nondata_buf_recycle_cnt = %u", 3528 htt_stats_buf->local_nondata_buf_recycle_cnt); 3529 len += HTT_DBG_OUT(buf + len, buf_len - len, "fw_status_buf_ring_refill_cnt = %u", 3530 htt_stats_buf->fw_status_buf_ring_refill_cnt); 3531 len += HTT_DBG_OUT(buf + len, buf_len - len, "fw_status_buf_ring_empty_cnt = %u", 3532 htt_stats_buf->fw_status_buf_ring_empty_cnt); 3533 len += HTT_DBG_OUT(buf + len, buf_len - len, "fw_pkt_buf_ring_refill_cnt = %u", 3534 htt_stats_buf->fw_pkt_buf_ring_refill_cnt); 3535 len += HTT_DBG_OUT(buf + len, buf_len - len, "fw_pkt_buf_ring_empty_cnt = %u", 3536 htt_stats_buf->fw_pkt_buf_ring_empty_cnt); 3537 len += HTT_DBG_OUT(buf + len, buf_len - len, "fw_link_buf_ring_refill_cnt = %u", 3538 htt_stats_buf->fw_link_buf_ring_refill_cnt); 3539 len += HTT_DBG_OUT(buf + len, buf_len - len, "fw_link_buf_ring_empty_cnt = %u", 3540 htt_stats_buf->fw_link_buf_ring_empty_cnt); 3541 len += HTT_DBG_OUT(buf + len, buf_len - len, "host_pkt_buf_ring_refill_cnt = %u", 3542 htt_stats_buf->host_pkt_buf_ring_refill_cnt); 3543 len += HTT_DBG_OUT(buf + len, buf_len - len, "host_pkt_buf_ring_empty_cnt = %u", 3544 htt_stats_buf->host_pkt_buf_ring_empty_cnt); 3545 len += HTT_DBG_OUT(buf + len, buf_len - len, "mon_pkt_buf_ring_refill_cnt = %u", 3546 htt_stats_buf->mon_pkt_buf_ring_refill_cnt); 3547 len += HTT_DBG_OUT(buf + len, buf_len - len, "mon_pkt_buf_ring_empty_cnt = %u", 3548 htt_stats_buf->mon_pkt_buf_ring_empty_cnt); 3549 len += HTT_DBG_OUT(buf + len, buf_len - len, 3550 "mon_status_buf_ring_refill_cnt = %u", 3551 htt_stats_buf->mon_status_buf_ring_refill_cnt); 3552 len += HTT_DBG_OUT(buf + len, buf_len - len, "mon_status_buf_ring_empty_cnt = %u", 3553 htt_stats_buf->mon_status_buf_ring_empty_cnt); 3554 len += HTT_DBG_OUT(buf + len, buf_len - len, "mon_desc_buf_ring_refill_cnt = %u", 3555 htt_stats_buf->mon_desc_buf_ring_refill_cnt); 3556 len += HTT_DBG_OUT(buf + len, buf_len - len, "mon_desc_buf_ring_empty_cnt = %u", 3557 htt_stats_buf->mon_desc_buf_ring_empty_cnt); 3558 len += HTT_DBG_OUT(buf + len, buf_len - len, "mon_dest_ring_update_cnt = %u", 3559 htt_stats_buf->mon_dest_ring_update_cnt); 3560 len += HTT_DBG_OUT(buf + len, buf_len - len, "mon_dest_ring_full_cnt = %u", 3561 htt_stats_buf->mon_dest_ring_full_cnt); 3562 len += HTT_DBG_OUT(buf + len, buf_len - len, "rx_suspend_cnt = %u", 3563 htt_stats_buf->rx_suspend_cnt); 3564 len += HTT_DBG_OUT(buf + len, buf_len - len, "rx_suspend_fail_cnt = %u", 3565 htt_stats_buf->rx_suspend_fail_cnt); 3566 len += HTT_DBG_OUT(buf + len, buf_len - len, "rx_resume_cnt = %u", 3567 htt_stats_buf->rx_resume_cnt); 3568 len += HTT_DBG_OUT(buf + len, buf_len - len, "rx_resume_fail_cnt = %u", 3569 htt_stats_buf->rx_resume_fail_cnt); 3570 len += HTT_DBG_OUT(buf + len, buf_len - len, "rx_ring_switch_cnt = %u", 3571 htt_stats_buf->rx_ring_switch_cnt); 3572 len += HTT_DBG_OUT(buf + len, buf_len - len, "rx_ring_restore_cnt = %u", 3573 htt_stats_buf->rx_ring_restore_cnt); 3574 len += HTT_DBG_OUT(buf + len, buf_len - len, "rx_flush_cnt = %u", 3575 htt_stats_buf->rx_flush_cnt); 3576 len += HTT_DBG_OUT(buf + len, buf_len - len, "rx_recovery_reset_cnt = %u\n", 3577 htt_stats_buf->rx_recovery_reset_cnt); 3578 3579 if (len >= buf_len) 3580 buf[buf_len - 1] = 0; 3581 else 3582 buf[len] = 0; 3583 3584 stats_req->buf_len = len; 3585 } 3586 3587 static inline void 3588 htt_print_rx_pdev_fw_ring_mpdu_err_tlv_v(const void *tag_buf, 3589 struct debug_htt_stats_req *stats_req) 3590 { 3591 const struct htt_rx_pdev_fw_ring_mpdu_err_tlv_v *htt_stats_buf = tag_buf; 3592 u8 *buf = stats_req->buf; 3593 u32 len = stats_req->buf_len; 3594 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 3595 char fw_ring_mpdu_err[HTT_MAX_STRING_LEN] = {0}; 3596 3597 len += HTT_DBG_OUT(buf + len, buf_len - len, 3598 "HTT_RX_PDEV_FW_RING_MPDU_ERR_TLV_V:"); 3599 3600 ARRAY_TO_STRING(fw_ring_mpdu_err, 3601 htt_stats_buf->fw_ring_mpdu_err, 3602 HTT_RX_STATS_RXDMA_MAX_ERR); 3603 len += HTT_DBG_OUT(buf + len, buf_len - len, "fw_ring_mpdu_err = %s\n", 3604 fw_ring_mpdu_err); 3605 3606 if (len >= buf_len) 3607 buf[buf_len - 1] = 0; 3608 else 3609 buf[len] = 0; 3610 3611 stats_req->buf_len = len; 3612 } 3613 3614 static inline void 3615 htt_print_rx_pdev_fw_mpdu_drop_tlv_v(const void *tag_buf, 3616 u16 tag_len, 3617 struct debug_htt_stats_req *stats_req) 3618 { 3619 const struct htt_rx_pdev_fw_mpdu_drop_tlv_v *htt_stats_buf = tag_buf; 3620 u8 *buf = stats_req->buf; 3621 u32 len = stats_req->buf_len; 3622 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 3623 char fw_mpdu_drop[HTT_MAX_STRING_LEN] = {0}; 3624 u16 num_elems = min_t(u16, (tag_len >> 2), HTT_RX_STATS_FW_DROP_REASON_MAX); 3625 3626 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_RX_PDEV_FW_MPDU_DROP_TLV_V:"); 3627 3628 ARRAY_TO_STRING(fw_mpdu_drop, 3629 htt_stats_buf->fw_mpdu_drop, 3630 num_elems); 3631 len += HTT_DBG_OUT(buf + len, buf_len - len, "fw_mpdu_drop = %s\n", fw_mpdu_drop); 3632 3633 if (len >= buf_len) 3634 buf[buf_len - 1] = 0; 3635 else 3636 buf[len] = 0; 3637 3638 stats_req->buf_len = len; 3639 } 3640 3641 static inline void 3642 htt_print_rx_pdev_fw_stats_phy_err_tlv(const void *tag_buf, 3643 struct debug_htt_stats_req *stats_req) 3644 { 3645 const struct htt_rx_pdev_fw_stats_phy_err_tlv *htt_stats_buf = tag_buf; 3646 u8 *buf = stats_req->buf; 3647 u32 len = stats_req->buf_len; 3648 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 3649 char phy_errs[HTT_MAX_STRING_LEN] = {0}; 3650 3651 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_RX_PDEV_FW_STATS_PHY_ERR_TLV:"); 3652 len += HTT_DBG_OUT(buf + len, buf_len - len, "mac_id__word = %u", 3653 htt_stats_buf->mac_id__word); 3654 len += HTT_DBG_OUT(buf + len, buf_len - len, "total_phy_err_nct = %u", 3655 htt_stats_buf->total_phy_err_cnt); 3656 3657 ARRAY_TO_STRING(phy_errs, 3658 htt_stats_buf->phy_err, 3659 HTT_STATS_PHY_ERR_MAX); 3660 len += HTT_DBG_OUT(buf + len, buf_len - len, "phy_errs = %s\n", phy_errs); 3661 3662 if (len >= buf_len) 3663 buf[buf_len - 1] = 0; 3664 else 3665 buf[len] = 0; 3666 3667 stats_req->buf_len = len; 3668 } 3669 3670 static inline void 3671 htt_print_pdev_cca_stats_hist_tlv(const void *tag_buf, 3672 struct debug_htt_stats_req *stats_req) 3673 { 3674 const struct htt_pdev_cca_stats_hist_v1_tlv *htt_stats_buf = tag_buf; 3675 u8 *buf = stats_req->buf; 3676 u32 len = stats_req->buf_len; 3677 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 3678 3679 len += HTT_DBG_OUT(buf + len, buf_len - len, "\nHTT_PDEV_CCA_STATS_HIST_TLV:"); 3680 len += HTT_DBG_OUT(buf + len, buf_len - len, "chan_num = %u", 3681 htt_stats_buf->chan_num); 3682 len += HTT_DBG_OUT(buf + len, buf_len - len, "num_records = %u", 3683 htt_stats_buf->num_records); 3684 len += HTT_DBG_OUT(buf + len, buf_len - len, "valid_cca_counters_bitmap = 0x%x", 3685 htt_stats_buf->valid_cca_counters_bitmap); 3686 len += HTT_DBG_OUT(buf + len, buf_len - len, "collection_interval = %u\n", 3687 htt_stats_buf->collection_interval); 3688 3689 len += HTT_DBG_OUT(buf + len, buf_len - len, 3690 "HTT_PDEV_STATS_CCA_COUNTERS_TLV:(in usec)"); 3691 len += HTT_DBG_OUT(buf + len, buf_len - len, 3692 "| tx_frame| rx_frame| rx_clear| my_rx_frame| cnt| med_rx_idle| med_tx_idle_global| cca_obss|"); 3693 3694 if (len >= buf_len) 3695 buf[buf_len - 1] = 0; 3696 else 3697 buf[len] = 0; 3698 3699 stats_req->buf_len = len; 3700 } 3701 3702 static inline void 3703 htt_print_pdev_stats_cca_counters_tlv(const void *tag_buf, 3704 struct debug_htt_stats_req *stats_req) 3705 { 3706 const struct htt_pdev_stats_cca_counters_tlv *htt_stats_buf = tag_buf; 3707 u8 *buf = stats_req->buf; 3708 u32 len = stats_req->buf_len; 3709 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 3710 3711 len += HTT_DBG_OUT(buf + len, buf_len - len, 3712 "|%10u| %10u| %10u| %11u| %10u| %11u| %18u| %10u|", 3713 htt_stats_buf->tx_frame_usec, 3714 htt_stats_buf->rx_frame_usec, 3715 htt_stats_buf->rx_clear_usec, 3716 htt_stats_buf->my_rx_frame_usec, 3717 htt_stats_buf->usec_cnt, 3718 htt_stats_buf->med_rx_idle_usec, 3719 htt_stats_buf->med_tx_idle_global_usec, 3720 htt_stats_buf->cca_obss_usec); 3721 3722 if (len >= buf_len) 3723 buf[buf_len - 1] = 0; 3724 else 3725 buf[len] = 0; 3726 3727 stats_req->buf_len = len; 3728 } 3729 3730 static inline void htt_print_hw_stats_whal_tx_tlv(const void *tag_buf, 3731 struct debug_htt_stats_req *stats_req) 3732 { 3733 const struct htt_hw_stats_whal_tx_tlv *htt_stats_buf = tag_buf; 3734 u8 *buf = stats_req->buf; 3735 u32 len = stats_req->buf_len; 3736 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 3737 3738 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_HW_STATS_WHAL_TX_TLV:"); 3739 len += HTT_DBG_OUT(buf + len, buf_len - len, "mac_id = %u", 3740 htt_stats_buf->mac_id__word & 0xFF); 3741 len += HTT_DBG_OUT(buf + len, buf_len - len, "last_unpause_ppdu_id = %u", 3742 htt_stats_buf->last_unpause_ppdu_id); 3743 len += HTT_DBG_OUT(buf + len, buf_len - len, "hwsch_unpause_wait_tqm_write = %u", 3744 htt_stats_buf->hwsch_unpause_wait_tqm_write); 3745 len += HTT_DBG_OUT(buf + len, buf_len - len, "hwsch_dummy_tlv_skipped = %u", 3746 htt_stats_buf->hwsch_dummy_tlv_skipped); 3747 len += HTT_DBG_OUT(buf + len, buf_len - len, 3748 "hwsch_misaligned_offset_received = %u", 3749 htt_stats_buf->hwsch_misaligned_offset_received); 3750 len += HTT_DBG_OUT(buf + len, buf_len - len, "hwsch_reset_count = %u", 3751 htt_stats_buf->hwsch_reset_count); 3752 len += HTT_DBG_OUT(buf + len, buf_len - len, "hwsch_dev_reset_war = %u", 3753 htt_stats_buf->hwsch_dev_reset_war); 3754 len += HTT_DBG_OUT(buf + len, buf_len - len, "hwsch_delayed_pause = %u", 3755 htt_stats_buf->hwsch_delayed_pause); 3756 len += HTT_DBG_OUT(buf + len, buf_len - len, "hwsch_long_delayed_pause = %u", 3757 htt_stats_buf->hwsch_long_delayed_pause); 3758 len += HTT_DBG_OUT(buf + len, buf_len - len, "sch_rx_ppdu_no_response = %u", 3759 htt_stats_buf->sch_rx_ppdu_no_response); 3760 len += HTT_DBG_OUT(buf + len, buf_len - len, "sch_selfgen_response = %u", 3761 htt_stats_buf->sch_selfgen_response); 3762 len += HTT_DBG_OUT(buf + len, buf_len - len, "sch_rx_sifs_resp_trigger= %u\n", 3763 htt_stats_buf->sch_rx_sifs_resp_trigger); 3764 3765 if (len >= buf_len) 3766 buf[buf_len - 1] = 0; 3767 else 3768 buf[len] = 0; 3769 3770 stats_req->buf_len = len; 3771 } 3772 3773 static inline void 3774 htt_print_pdev_stats_twt_sessions_tlv(const void *tag_buf, 3775 struct debug_htt_stats_req *stats_req) 3776 { 3777 const struct htt_pdev_stats_twt_sessions_tlv *htt_stats_buf = tag_buf; 3778 u8 *buf = stats_req->buf; 3779 u32 len = stats_req->buf_len; 3780 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 3781 3782 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_PDEV_STATS_TWT_SESSIONS_TLV:"); 3783 len += HTT_DBG_OUT(buf + len, buf_len - len, "pdev_id = %u", 3784 htt_stats_buf->pdev_id); 3785 len += HTT_DBG_OUT(buf + len, buf_len - len, "num_sessions = %u\n", 3786 htt_stats_buf->num_sessions); 3787 3788 if (len >= buf_len) 3789 buf[buf_len - 1] = 0; 3790 else 3791 buf[len] = 0; 3792 3793 stats_req->buf_len = len; 3794 } 3795 3796 static inline void 3797 htt_print_pdev_stats_twt_session_tlv(const void *tag_buf, 3798 struct debug_htt_stats_req *stats_req) 3799 { 3800 const struct htt_pdev_stats_twt_session_tlv *htt_stats_buf = tag_buf; 3801 u8 *buf = stats_req->buf; 3802 u32 len = stats_req->buf_len; 3803 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 3804 3805 len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_PDEV_STATS_TWT_SESSION_TLV:"); 3806 len += HTT_DBG_OUT(buf + len, buf_len - len, "vdev_id = %u", 3807 htt_stats_buf->vdev_id); 3808 len += HTT_DBG_OUT(buf + len, buf_len - len, 3809 "peer_mac = %02x:%02x:%02x:%02x:%02x:%02x", 3810 htt_stats_buf->peer_mac.mac_addr_l32 & 0xFF, 3811 (htt_stats_buf->peer_mac.mac_addr_l32 & 0xFF00) >> 8, 3812 (htt_stats_buf->peer_mac.mac_addr_l32 & 0xFF0000) >> 16, 3813 (htt_stats_buf->peer_mac.mac_addr_l32 & 0xFF000000) >> 24, 3814 (htt_stats_buf->peer_mac.mac_addr_h16 & 0xFF), 3815 (htt_stats_buf->peer_mac.mac_addr_h16 & 0xFF00) >> 8); 3816 len += HTT_DBG_OUT(buf + len, buf_len - len, "flow_id_flags = %u", 3817 htt_stats_buf->flow_id_flags); 3818 len += HTT_DBG_OUT(buf + len, buf_len - len, "dialog_id = %u", 3819 htt_stats_buf->dialog_id); 3820 len += HTT_DBG_OUT(buf + len, buf_len - len, "wake_dura_us = %u", 3821 htt_stats_buf->wake_dura_us); 3822 len += HTT_DBG_OUT(buf + len, buf_len - len, "wake_intvl_us = %u", 3823 htt_stats_buf->wake_intvl_us); 3824 len += HTT_DBG_OUT(buf + len, buf_len - len, "sp_offset_us = %u\n", 3825 htt_stats_buf->sp_offset_us); 3826 3827 if (len >= buf_len) 3828 buf[buf_len - 1] = 0; 3829 else 3830 buf[len] = 0; 3831 3832 stats_req->buf_len = len; 3833 } 3834 3835 static inline void 3836 htt_print_pdev_obss_pd_stats_tlv_v(const void *tag_buf, 3837 struct debug_htt_stats_req *stats_req) 3838 { 3839 const struct htt_pdev_obss_pd_stats_tlv *htt_stats_buf = tag_buf; 3840 u8 *buf = stats_req->buf; 3841 u32 len = stats_req->buf_len; 3842 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 3843 3844 len += HTT_DBG_OUT(buf + len, buf_len - len, "OBSS Tx success PPDU = %u", 3845 htt_stats_buf->num_obss_tx_ppdu_success); 3846 len += HTT_DBG_OUT(buf + len, buf_len - len, "OBSS Tx failures PPDU = %u\n", 3847 htt_stats_buf->num_obss_tx_ppdu_failure); 3848 len += HTT_DBG_OUT(buf + len, buf_len - len, "Non-SRG Opportunities = %u\n", 3849 htt_stats_buf->num_non_srg_opportunities); 3850 len += HTT_DBG_OUT(buf + len, buf_len - len, "Non-SRG tried PPDU = %u\n", 3851 htt_stats_buf->num_non_srg_ppdu_tried); 3852 len += HTT_DBG_OUT(buf + len, buf_len - len, "Non-SRG success PPDU = %u\n", 3853 htt_stats_buf->num_non_srg_ppdu_success); 3854 len += HTT_DBG_OUT(buf + len, buf_len - len, "SRG Opportunities = %u\n", 3855 htt_stats_buf->num_srg_opportunities); 3856 len += HTT_DBG_OUT(buf + len, buf_len - len, "SRG tried PPDU = %u\n", 3857 htt_stats_buf->num_srg_ppdu_tried); 3858 len += HTT_DBG_OUT(buf + len, buf_len - len, "SRG success PPDU = %u\n", 3859 htt_stats_buf->num_srg_ppdu_success); 3860 3861 if (len >= buf_len) 3862 buf[buf_len - 1] = 0; 3863 else 3864 buf[len] = 0; 3865 3866 stats_req->buf_len = len; 3867 } 3868 3869 static inline void htt_print_backpressure_stats_tlv_v(const u32 *tag_buf, 3870 u8 *data) 3871 { 3872 struct debug_htt_stats_req *stats_req = 3873 (struct debug_htt_stats_req *)data; 3874 struct htt_ring_backpressure_stats_tlv *htt_stats_buf = 3875 (struct htt_ring_backpressure_stats_tlv *)tag_buf; 3876 int i; 3877 u8 *buf = stats_req->buf; 3878 u32 len = stats_req->buf_len; 3879 u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; 3880 3881 len += HTT_DBG_OUT(buf + len, buf_len - len, "pdev_id = %u", 3882 htt_stats_buf->pdev_id); 3883 len += HTT_DBG_OUT(buf + len, buf_len - len, "current_head_idx = %u", 3884 htt_stats_buf->current_head_idx); 3885 len += HTT_DBG_OUT(buf + len, buf_len - len, "current_tail_idx = %u", 3886 htt_stats_buf->current_tail_idx); 3887 len += HTT_DBG_OUT(buf + len, buf_len - len, "num_htt_msgs_sent = %u", 3888 htt_stats_buf->num_htt_msgs_sent); 3889 len += HTT_DBG_OUT(buf + len, buf_len - len, 3890 "backpressure_time_ms = %u", 3891 htt_stats_buf->backpressure_time_ms); 3892 3893 for (i = 0; i < 5; i++) 3894 len += HTT_DBG_OUT(buf + len, buf_len - len, 3895 "backpressure_hist_%u = %u", 3896 i + 1, htt_stats_buf->backpressure_hist[i]); 3897 3898 len += HTT_DBG_OUT(buf + len, buf_len - len, 3899 "============================"); 3900 3901 if (len >= buf_len) { 3902 buf[buf_len - 1] = 0; 3903 stats_req->buf_len = buf_len - 1; 3904 } else { 3905 buf[len] = 0; 3906 stats_req->buf_len = len; 3907 } 3908 } 3909 3910 static int ath11k_dbg_htt_ext_stats_parse(struct ath11k_base *ab, 3911 u16 tag, u16 len, const void *tag_buf, 3912 void *user_data) 3913 { 3914 struct debug_htt_stats_req *stats_req = user_data; 3915 3916 switch (tag) { 3917 case HTT_STATS_TX_PDEV_CMN_TAG: 3918 htt_print_tx_pdev_stats_cmn_tlv(tag_buf, stats_req); 3919 break; 3920 case HTT_STATS_TX_PDEV_UNDERRUN_TAG: 3921 htt_print_tx_pdev_stats_urrn_tlv_v(tag_buf, len, stats_req); 3922 break; 3923 case HTT_STATS_TX_PDEV_SIFS_TAG: 3924 htt_print_tx_pdev_stats_sifs_tlv_v(tag_buf, len, stats_req); 3925 break; 3926 case HTT_STATS_TX_PDEV_FLUSH_TAG: 3927 htt_print_tx_pdev_stats_flush_tlv_v(tag_buf, len, stats_req); 3928 break; 3929 case HTT_STATS_TX_PDEV_PHY_ERR_TAG: 3930 htt_print_tx_pdev_stats_phy_err_tlv_v(tag_buf, len, stats_req); 3931 break; 3932 case HTT_STATS_TX_PDEV_SIFS_HIST_TAG: 3933 htt_print_tx_pdev_stats_sifs_hist_tlv_v(tag_buf, len, stats_req); 3934 break; 3935 3936 case HTT_STATS_TX_PDEV_TX_PPDU_STATS_TAG: 3937 htt_print_tx_pdev_stats_tx_ppdu_stats_tlv_v(tag_buf, stats_req); 3938 break; 3939 3940 case HTT_STATS_TX_PDEV_TRIED_MPDU_CNT_HIST_TAG: 3941 htt_print_tx_pdev_stats_tried_mpdu_cnt_hist_tlv_v(tag_buf, len, 3942 stats_req); 3943 break; 3944 3945 case HTT_STATS_STRING_TAG: 3946 htt_print_stats_string_tlv(tag_buf, len, stats_req); 3947 break; 3948 3949 case HTT_STATS_TX_HWQ_CMN_TAG: 3950 htt_print_tx_hwq_stats_cmn_tlv(tag_buf, stats_req); 3951 break; 3952 3953 case HTT_STATS_TX_HWQ_DIFS_LATENCY_TAG: 3954 htt_print_tx_hwq_difs_latency_stats_tlv_v(tag_buf, len, stats_req); 3955 break; 3956 3957 case HTT_STATS_TX_HWQ_CMD_RESULT_TAG: 3958 htt_print_tx_hwq_cmd_result_stats_tlv_v(tag_buf, len, stats_req); 3959 break; 3960 3961 case HTT_STATS_TX_HWQ_CMD_STALL_TAG: 3962 htt_print_tx_hwq_cmd_stall_stats_tlv_v(tag_buf, len, stats_req); 3963 break; 3964 3965 case HTT_STATS_TX_HWQ_FES_STATUS_TAG: 3966 htt_print_tx_hwq_fes_result_stats_tlv_v(tag_buf, len, stats_req); 3967 break; 3968 3969 case HTT_STATS_TX_HWQ_TRIED_MPDU_CNT_HIST_TAG: 3970 htt_print_tx_hwq_tried_mpdu_cnt_hist_tlv_v(tag_buf, len, stats_req); 3971 break; 3972 3973 case HTT_STATS_TX_HWQ_TXOP_USED_CNT_HIST_TAG: 3974 htt_print_tx_hwq_txop_used_cnt_hist_tlv_v(tag_buf, len, stats_req); 3975 break; 3976 case HTT_STATS_TX_TQM_GEN_MPDU_TAG: 3977 htt_print_tx_tqm_gen_mpdu_stats_tlv_v(tag_buf, len, stats_req); 3978 break; 3979 3980 case HTT_STATS_TX_TQM_LIST_MPDU_TAG: 3981 htt_print_tx_tqm_list_mpdu_stats_tlv_v(tag_buf, len, stats_req); 3982 break; 3983 3984 case HTT_STATS_TX_TQM_LIST_MPDU_CNT_TAG: 3985 htt_print_tx_tqm_list_mpdu_cnt_tlv_v(tag_buf, len, stats_req); 3986 break; 3987 3988 case HTT_STATS_TX_TQM_CMN_TAG: 3989 htt_print_tx_tqm_cmn_stats_tlv(tag_buf, stats_req); 3990 break; 3991 3992 case HTT_STATS_TX_TQM_PDEV_TAG: 3993 htt_print_tx_tqm_pdev_stats_tlv_v(tag_buf, stats_req); 3994 break; 3995 3996 case HTT_STATS_TX_TQM_CMDQ_STATUS_TAG: 3997 htt_print_tx_tqm_cmdq_status_tlv(tag_buf, stats_req); 3998 break; 3999 4000 case HTT_STATS_TX_DE_EAPOL_PACKETS_TAG: 4001 htt_print_tx_de_eapol_packets_stats_tlv(tag_buf, stats_req); 4002 break; 4003 4004 case HTT_STATS_TX_DE_CLASSIFY_FAILED_TAG: 4005 htt_print_tx_de_classify_failed_stats_tlv(tag_buf, stats_req); 4006 break; 4007 4008 case HTT_STATS_TX_DE_CLASSIFY_STATS_TAG: 4009 htt_print_tx_de_classify_stats_tlv(tag_buf, stats_req); 4010 break; 4011 4012 case HTT_STATS_TX_DE_CLASSIFY_STATUS_TAG: 4013 htt_print_tx_de_classify_status_stats_tlv(tag_buf, stats_req); 4014 break; 4015 4016 case HTT_STATS_TX_DE_ENQUEUE_PACKETS_TAG: 4017 htt_print_tx_de_enqueue_packets_stats_tlv(tag_buf, stats_req); 4018 break; 4019 4020 case HTT_STATS_TX_DE_ENQUEUE_DISCARD_TAG: 4021 htt_print_tx_de_enqueue_discard_stats_tlv(tag_buf, stats_req); 4022 break; 4023 4024 case HTT_STATS_TX_DE_FW2WBM_RING_FULL_HIST_TAG: 4025 htt_print_tx_de_fw2wbm_ring_full_hist_tlv(tag_buf, len, stats_req); 4026 break; 4027 4028 case HTT_STATS_TX_DE_CMN_TAG: 4029 htt_print_tx_de_cmn_stats_tlv(tag_buf, stats_req); 4030 break; 4031 4032 case HTT_STATS_RING_IF_TAG: 4033 htt_print_ring_if_stats_tlv(tag_buf, stats_req); 4034 break; 4035 4036 case HTT_STATS_TX_PDEV_MU_MIMO_STATS_TAG: 4037 htt_print_tx_pdev_mu_mimo_sch_stats_tlv(tag_buf, stats_req); 4038 break; 4039 4040 case HTT_STATS_SFM_CMN_TAG: 4041 htt_print_sfm_cmn_tlv(tag_buf, stats_req); 4042 break; 4043 4044 case HTT_STATS_SRING_STATS_TAG: 4045 htt_print_sring_stats_tlv(tag_buf, stats_req); 4046 break; 4047 4048 case HTT_STATS_RX_PDEV_FW_STATS_TAG: 4049 htt_print_rx_pdev_fw_stats_tlv(tag_buf, stats_req); 4050 break; 4051 4052 case HTT_STATS_RX_PDEV_FW_RING_MPDU_ERR_TAG: 4053 htt_print_rx_pdev_fw_ring_mpdu_err_tlv_v(tag_buf, stats_req); 4054 break; 4055 4056 case HTT_STATS_RX_PDEV_FW_MPDU_DROP_TAG: 4057 htt_print_rx_pdev_fw_mpdu_drop_tlv_v(tag_buf, len, stats_req); 4058 break; 4059 4060 case HTT_STATS_RX_SOC_FW_STATS_TAG: 4061 htt_print_rx_soc_fw_stats_tlv(tag_buf, stats_req); 4062 break; 4063 4064 case HTT_STATS_RX_SOC_FW_REFILL_RING_EMPTY_TAG: 4065 htt_print_rx_soc_fw_refill_ring_empty_tlv_v(tag_buf, len, stats_req); 4066 break; 4067 4068 case HTT_STATS_RX_SOC_FW_REFILL_RING_NUM_REFILL_TAG: 4069 htt_print_rx_soc_fw_refill_ring_num_refill_tlv_v( 4070 tag_buf, len, stats_req); 4071 break; 4072 case HTT_STATS_RX_REFILL_RXDMA_ERR_TAG: 4073 htt_print_rx_soc_fw_refill_ring_num_rxdma_err_tlv_v( 4074 tag_buf, len, stats_req); 4075 break; 4076 4077 case HTT_STATS_RX_REFILL_REO_ERR_TAG: 4078 htt_print_rx_soc_fw_refill_ring_num_reo_err_tlv_v( 4079 tag_buf, len, stats_req); 4080 break; 4081 4082 case HTT_STATS_RX_REO_RESOURCE_STATS_TAG: 4083 htt_print_rx_reo_debug_stats_tlv_v( 4084 tag_buf, stats_req); 4085 break; 4086 case HTT_STATS_RX_PDEV_FW_STATS_PHY_ERR_TAG: 4087 htt_print_rx_pdev_fw_stats_phy_err_tlv(tag_buf, stats_req); 4088 break; 4089 4090 case HTT_STATS_TX_PDEV_RATE_STATS_TAG: 4091 htt_print_tx_pdev_rate_stats_tlv(tag_buf, stats_req); 4092 break; 4093 4094 case HTT_STATS_RX_PDEV_RATE_STATS_TAG: 4095 htt_print_rx_pdev_rate_stats_tlv(tag_buf, stats_req); 4096 break; 4097 4098 case HTT_STATS_TX_PDEV_SCHEDULER_TXQ_STATS_TAG: 4099 htt_print_tx_pdev_stats_sched_per_txq_tlv(tag_buf, stats_req); 4100 break; 4101 case HTT_STATS_TX_SCHED_CMN_TAG: 4102 htt_print_stats_tx_sched_cmn_tlv(tag_buf, stats_req); 4103 break; 4104 4105 case HTT_STATS_TX_PDEV_MPDU_STATS_TAG: 4106 htt_print_tx_pdev_mu_mimo_mpdu_stats_tlv(tag_buf, stats_req); 4107 break; 4108 4109 case HTT_STATS_SCHED_TXQ_CMD_POSTED_TAG: 4110 htt_print_sched_txq_cmd_posted_tlv_v(tag_buf, len, stats_req); 4111 break; 4112 4113 case HTT_STATS_RING_IF_CMN_TAG: 4114 htt_print_ring_if_cmn_tlv(tag_buf, stats_req); 4115 break; 4116 4117 case HTT_STATS_SFM_CLIENT_USER_TAG: 4118 htt_print_sfm_client_user_tlv_v(tag_buf, len, stats_req); 4119 break; 4120 4121 case HTT_STATS_SFM_CLIENT_TAG: 4122 htt_print_sfm_client_tlv(tag_buf, stats_req); 4123 break; 4124 4125 case HTT_STATS_TX_TQM_ERROR_STATS_TAG: 4126 htt_print_tx_tqm_error_stats_tlv(tag_buf, stats_req); 4127 break; 4128 4129 case HTT_STATS_SCHED_TXQ_CMD_REAPED_TAG: 4130 htt_print_sched_txq_cmd_reaped_tlv_v(tag_buf, len, stats_req); 4131 break; 4132 4133 case HTT_STATS_SRING_CMN_TAG: 4134 htt_print_sring_cmn_tlv(tag_buf, stats_req); 4135 break; 4136 4137 case HTT_STATS_TX_SOUNDING_STATS_TAG: 4138 htt_print_tx_sounding_stats_tlv(tag_buf, stats_req); 4139 break; 4140 4141 case HTT_STATS_TX_SELFGEN_AC_ERR_STATS_TAG: 4142 htt_print_tx_selfgen_ac_err_stats_tlv(tag_buf, stats_req); 4143 break; 4144 4145 case HTT_STATS_TX_SELFGEN_CMN_STATS_TAG: 4146 htt_print_tx_selfgen_cmn_stats_tlv(tag_buf, stats_req); 4147 break; 4148 4149 case HTT_STATS_TX_SELFGEN_AC_STATS_TAG: 4150 htt_print_tx_selfgen_ac_stats_tlv(tag_buf, stats_req); 4151 break; 4152 4153 case HTT_STATS_TX_SELFGEN_AX_STATS_TAG: 4154 htt_print_tx_selfgen_ax_stats_tlv(tag_buf, stats_req); 4155 break; 4156 4157 case HTT_STATS_TX_SELFGEN_AX_ERR_STATS_TAG: 4158 htt_print_tx_selfgen_ax_err_stats_tlv(tag_buf, stats_req); 4159 break; 4160 4161 case HTT_STATS_TX_HWQ_MUMIMO_SCH_STATS_TAG: 4162 htt_print_tx_hwq_mu_mimo_sch_stats_tlv(tag_buf, stats_req); 4163 break; 4164 4165 case HTT_STATS_TX_HWQ_MUMIMO_MPDU_STATS_TAG: 4166 htt_print_tx_hwq_mu_mimo_mpdu_stats_tlv(tag_buf, stats_req); 4167 break; 4168 4169 case HTT_STATS_TX_HWQ_MUMIMO_CMN_STATS_TAG: 4170 htt_print_tx_hwq_mu_mimo_cmn_stats_tlv(tag_buf, stats_req); 4171 break; 4172 4173 case HTT_STATS_HW_INTR_MISC_TAG: 4174 htt_print_hw_stats_intr_misc_tlv(tag_buf, stats_req); 4175 break; 4176 4177 case HTT_STATS_HW_WD_TIMEOUT_TAG: 4178 htt_print_hw_stats_wd_timeout_tlv(tag_buf, stats_req); 4179 break; 4180 4181 case HTT_STATS_HW_PDEV_ERRS_TAG: 4182 htt_print_hw_stats_pdev_errs_tlv(tag_buf, stats_req); 4183 break; 4184 4185 case HTT_STATS_COUNTER_NAME_TAG: 4186 htt_print_counter_tlv(tag_buf, stats_req); 4187 break; 4188 4189 case HTT_STATS_TX_TID_DETAILS_TAG: 4190 htt_print_tx_tid_stats_tlv(tag_buf, stats_req); 4191 break; 4192 4193 case HTT_STATS_TX_TID_DETAILS_V1_TAG: 4194 htt_print_tx_tid_stats_v1_tlv(tag_buf, stats_req); 4195 break; 4196 4197 case HTT_STATS_RX_TID_DETAILS_TAG: 4198 htt_print_rx_tid_stats_tlv(tag_buf, stats_req); 4199 break; 4200 4201 case HTT_STATS_PEER_STATS_CMN_TAG: 4202 htt_print_peer_stats_cmn_tlv(tag_buf, stats_req); 4203 break; 4204 4205 case HTT_STATS_PEER_DETAILS_TAG: 4206 htt_print_peer_details_tlv(tag_buf, stats_req); 4207 break; 4208 4209 case HTT_STATS_PEER_MSDU_FLOWQ_TAG: 4210 htt_print_msdu_flow_stats_tlv(tag_buf, stats_req); 4211 break; 4212 4213 case HTT_STATS_PEER_TX_RATE_STATS_TAG: 4214 htt_print_tx_peer_rate_stats_tlv(tag_buf, stats_req); 4215 break; 4216 4217 case HTT_STATS_PEER_RX_RATE_STATS_TAG: 4218 htt_print_rx_peer_rate_stats_tlv(tag_buf, stats_req); 4219 break; 4220 4221 case HTT_STATS_TX_DE_COMPL_STATS_TAG: 4222 htt_print_tx_de_compl_stats_tlv(tag_buf, stats_req); 4223 break; 4224 4225 case HTT_STATS_PDEV_CCA_1SEC_HIST_TAG: 4226 case HTT_STATS_PDEV_CCA_100MSEC_HIST_TAG: 4227 case HTT_STATS_PDEV_CCA_STAT_CUMULATIVE_TAG: 4228 htt_print_pdev_cca_stats_hist_tlv(tag_buf, stats_req); 4229 break; 4230 4231 case HTT_STATS_PDEV_CCA_COUNTERS_TAG: 4232 htt_print_pdev_stats_cca_counters_tlv(tag_buf, stats_req); 4233 break; 4234 4235 case HTT_STATS_WHAL_TX_TAG: 4236 htt_print_hw_stats_whal_tx_tlv(tag_buf, stats_req); 4237 break; 4238 4239 case HTT_STATS_PDEV_TWT_SESSIONS_TAG: 4240 htt_print_pdev_stats_twt_sessions_tlv(tag_buf, stats_req); 4241 break; 4242 4243 case HTT_STATS_PDEV_TWT_SESSION_TAG: 4244 htt_print_pdev_stats_twt_session_tlv(tag_buf, stats_req); 4245 break; 4246 4247 case HTT_STATS_SCHED_TXQ_SCHED_ORDER_SU_TAG: 4248 htt_print_sched_txq_sched_order_su_tlv_v(tag_buf, len, stats_req); 4249 break; 4250 4251 case HTT_STATS_SCHED_TXQ_SCHED_INELIGIBILITY_TAG: 4252 htt_print_sched_txq_sched_ineligibility_tlv_v(tag_buf, len, stats_req); 4253 break; 4254 4255 case HTT_STATS_PDEV_OBSS_PD_TAG: 4256 htt_print_pdev_obss_pd_stats_tlv_v(tag_buf, stats_req); 4257 break; 4258 case HTT_STATS_RING_BACKPRESSURE_STATS_TAG: 4259 htt_print_backpressure_stats_tlv_v(tag_buf, user_data); 4260 break; 4261 default: 4262 break; 4263 } 4264 4265 return 0; 4266 } 4267 4268 void ath11k_debugfs_htt_ext_stats_handler(struct ath11k_base *ab, 4269 struct sk_buff *skb) 4270 { 4271 struct ath11k_htt_extd_stats_msg *msg; 4272 struct debug_htt_stats_req *stats_req; 4273 struct ath11k *ar; 4274 u32 len; 4275 u64 cookie; 4276 int ret; 4277 bool send_completion = false; 4278 u8 pdev_id; 4279 4280 msg = (struct ath11k_htt_extd_stats_msg *)skb->data; 4281 cookie = msg->cookie; 4282 4283 if (FIELD_GET(HTT_STATS_COOKIE_MSB, cookie) != HTT_STATS_MAGIC_VALUE) { 4284 ath11k_warn(ab, "received invalid htt ext stats event\n"); 4285 return; 4286 } 4287 4288 pdev_id = FIELD_GET(HTT_STATS_COOKIE_LSB, cookie); 4289 rcu_read_lock(); 4290 ar = ath11k_mac_get_ar_by_pdev_id(ab, pdev_id); 4291 rcu_read_unlock(); 4292 if (!ar) { 4293 ath11k_warn(ab, "failed to get ar for pdev_id %d\n", pdev_id); 4294 return; 4295 } 4296 4297 stats_req = ar->debug.htt_stats.stats_req; 4298 if (!stats_req) 4299 return; 4300 4301 spin_lock_bh(&ar->debug.htt_stats.lock); 4302 4303 stats_req->done = FIELD_GET(HTT_T2H_EXT_STATS_INFO1_DONE, msg->info1); 4304 if (stats_req->done) 4305 send_completion = true; 4306 4307 spin_unlock_bh(&ar->debug.htt_stats.lock); 4308 4309 len = FIELD_GET(HTT_T2H_EXT_STATS_INFO1_LENGTH, msg->info1); 4310 ret = ath11k_dp_htt_tlv_iter(ab, msg->data, len, 4311 ath11k_dbg_htt_ext_stats_parse, 4312 stats_req); 4313 if (ret) 4314 ath11k_warn(ab, "Failed to parse tlv %d\n", ret); 4315 4316 if (send_completion) 4317 complete(&stats_req->cmpln); 4318 } 4319 4320 static ssize_t ath11k_read_htt_stats_type(struct file *file, 4321 char __user *user_buf, 4322 size_t count, loff_t *ppos) 4323 { 4324 struct ath11k *ar = file->private_data; 4325 char buf[32]; 4326 size_t len; 4327 4328 len = scnprintf(buf, sizeof(buf), "%u\n", ar->debug.htt_stats.type); 4329 4330 return simple_read_from_buffer(user_buf, count, ppos, buf, len); 4331 } 4332 4333 static ssize_t ath11k_write_htt_stats_type(struct file *file, 4334 const char __user *user_buf, 4335 size_t count, loff_t *ppos) 4336 { 4337 struct ath11k *ar = file->private_data; 4338 u8 type; 4339 int ret; 4340 4341 ret = kstrtou8_from_user(user_buf, count, 0, &type); 4342 if (ret) 4343 return ret; 4344 4345 if (type >= ATH11K_DBG_HTT_NUM_EXT_STATS) 4346 return -E2BIG; 4347 4348 if (type == ATH11K_DBG_HTT_EXT_STATS_RESET || 4349 type == ATH11K_DBG_HTT_EXT_STATS_PEER_INFO) 4350 return -EPERM; 4351 4352 ar->debug.htt_stats.type = type; 4353 4354 ret = count; 4355 4356 return ret; 4357 } 4358 4359 static const struct file_operations fops_htt_stats_type = { 4360 .read = ath11k_read_htt_stats_type, 4361 .write = ath11k_write_htt_stats_type, 4362 .open = simple_open, 4363 .owner = THIS_MODULE, 4364 .llseek = default_llseek, 4365 }; 4366 4367 static int ath11k_prep_htt_stats_cfg_params(struct ath11k *ar, u8 type, 4368 const u8 *mac_addr, 4369 struct htt_ext_stats_cfg_params *cfg_params) 4370 { 4371 if (!cfg_params) 4372 return -EINVAL; 4373 4374 switch (type) { 4375 case ATH11K_DBG_HTT_EXT_STATS_PDEV_TX_HWQ: 4376 case ATH11K_DBG_HTT_EXT_STATS_TX_MU_HWQ: 4377 cfg_params->cfg0 = HTT_STAT_DEFAULT_CFG0_ALL_HWQS; 4378 break; 4379 case ATH11K_DBG_HTT_EXT_STATS_PDEV_TX_SCHED: 4380 cfg_params->cfg0 = HTT_STAT_DEFAULT_CFG0_ALL_TXQS; 4381 break; 4382 case ATH11K_DBG_HTT_EXT_STATS_TQM_CMDQ: 4383 cfg_params->cfg0 = HTT_STAT_DEFAULT_CFG0_ALL_CMDQS; 4384 break; 4385 case ATH11K_DBG_HTT_EXT_STATS_PEER_INFO: 4386 cfg_params->cfg0 = HTT_STAT_PEER_INFO_MAC_ADDR; 4387 cfg_params->cfg0 |= FIELD_PREP(GENMASK(15, 1), 4388 HTT_PEER_STATS_REQ_MODE_FLUSH_TQM); 4389 cfg_params->cfg1 = HTT_STAT_DEFAULT_PEER_REQ_TYPE; 4390 cfg_params->cfg2 |= FIELD_PREP(GENMASK(7, 0), mac_addr[0]); 4391 cfg_params->cfg2 |= FIELD_PREP(GENMASK(15, 8), mac_addr[1]); 4392 cfg_params->cfg2 |= FIELD_PREP(GENMASK(23, 16), mac_addr[2]); 4393 cfg_params->cfg2 |= FIELD_PREP(GENMASK(31, 24), mac_addr[3]); 4394 cfg_params->cfg3 |= FIELD_PREP(GENMASK(7, 0), mac_addr[4]); 4395 cfg_params->cfg3 |= FIELD_PREP(GENMASK(15, 8), mac_addr[5]); 4396 break; 4397 case ATH11K_DBG_HTT_EXT_STATS_RING_IF_INFO: 4398 case ATH11K_DBG_HTT_EXT_STATS_SRNG_INFO: 4399 cfg_params->cfg0 = HTT_STAT_DEFAULT_CFG0_ALL_RINGS; 4400 break; 4401 case ATH11K_DBG_HTT_EXT_STATS_ACTIVE_PEERS_LIST: 4402 cfg_params->cfg0 = HTT_STAT_DEFAULT_CFG0_ACTIVE_PEERS; 4403 break; 4404 case ATH11K_DBG_HTT_EXT_STATS_PDEV_CCA_STATS: 4405 cfg_params->cfg0 = HTT_STAT_DEFAULT_CFG0_CCA_CUMULATIVE; 4406 break; 4407 case ATH11K_DBG_HTT_EXT_STATS_TX_SOUNDING_INFO: 4408 cfg_params->cfg0 = HTT_STAT_DEFAULT_CFG0_ACTIVE_VDEVS; 4409 break; 4410 default: 4411 break; 4412 } 4413 4414 return 0; 4415 } 4416 4417 int ath11k_debugfs_htt_stats_req(struct ath11k *ar) 4418 { 4419 struct debug_htt_stats_req *stats_req = ar->debug.htt_stats.stats_req; 4420 u8 type = stats_req->type; 4421 u64 cookie = 0; 4422 int ret, pdev_id = ar->pdev->pdev_id; 4423 struct htt_ext_stats_cfg_params cfg_params = { 0 }; 4424 4425 init_completion(&stats_req->cmpln); 4426 4427 stats_req->done = false; 4428 stats_req->pdev_id = pdev_id; 4429 4430 cookie = FIELD_PREP(HTT_STATS_COOKIE_MSB, HTT_STATS_MAGIC_VALUE) | 4431 FIELD_PREP(HTT_STATS_COOKIE_LSB, pdev_id); 4432 4433 ret = ath11k_prep_htt_stats_cfg_params(ar, type, stats_req->peer_addr, 4434 &cfg_params); 4435 if (ret) { 4436 ath11k_warn(ar->ab, "failed to set htt stats cfg params: %d\n", ret); 4437 return ret; 4438 } 4439 4440 ret = ath11k_dp_tx_htt_h2t_ext_stats_req(ar, type, &cfg_params, cookie); 4441 if (ret) { 4442 ath11k_warn(ar->ab, "failed to send htt stats request: %d\n", ret); 4443 return ret; 4444 } 4445 4446 while (!wait_for_completion_timeout(&stats_req->cmpln, 3 * HZ)) { 4447 spin_lock_bh(&ar->debug.htt_stats.lock); 4448 if (!stats_req->done) { 4449 stats_req->done = true; 4450 spin_unlock_bh(&ar->debug.htt_stats.lock); 4451 ath11k_warn(ar->ab, "stats request timed out\n"); 4452 return -ETIMEDOUT; 4453 } 4454 spin_unlock_bh(&ar->debug.htt_stats.lock); 4455 } 4456 4457 return 0; 4458 } 4459 4460 static int ath11k_open_htt_stats(struct inode *inode, struct file *file) 4461 { 4462 struct ath11k *ar = inode->i_private; 4463 struct debug_htt_stats_req *stats_req; 4464 u8 type = ar->debug.htt_stats.type; 4465 int ret; 4466 4467 if (type == ATH11K_DBG_HTT_EXT_STATS_RESET) 4468 return -EPERM; 4469 4470 mutex_lock(&ar->conf_mutex); 4471 4472 if (ar->state != ATH11K_STATE_ON) { 4473 ret = -ENETDOWN; 4474 goto err_unlock; 4475 } 4476 4477 if (ar->debug.htt_stats.stats_req) { 4478 ret = -EAGAIN; 4479 goto err_unlock; 4480 } 4481 4482 stats_req = vzalloc(sizeof(*stats_req) + ATH11K_HTT_STATS_BUF_SIZE); 4483 if (!stats_req) { 4484 ret = -ENOMEM; 4485 goto err_unlock; 4486 } 4487 4488 ar->debug.htt_stats.stats_req = stats_req; 4489 stats_req->type = type; 4490 4491 ret = ath11k_debugfs_htt_stats_req(ar); 4492 if (ret < 0) 4493 goto out; 4494 4495 file->private_data = stats_req; 4496 4497 mutex_unlock(&ar->conf_mutex); 4498 4499 return 0; 4500 out: 4501 vfree(stats_req); 4502 ar->debug.htt_stats.stats_req = NULL; 4503 err_unlock: 4504 mutex_unlock(&ar->conf_mutex); 4505 4506 return ret; 4507 } 4508 4509 static int ath11k_release_htt_stats(struct inode *inode, struct file *file) 4510 { 4511 struct ath11k *ar = inode->i_private; 4512 4513 mutex_lock(&ar->conf_mutex); 4514 vfree(file->private_data); 4515 ar->debug.htt_stats.stats_req = NULL; 4516 mutex_unlock(&ar->conf_mutex); 4517 4518 return 0; 4519 } 4520 4521 static ssize_t ath11k_read_htt_stats(struct file *file, 4522 char __user *user_buf, 4523 size_t count, loff_t *ppos) 4524 { 4525 struct debug_htt_stats_req *stats_req = file->private_data; 4526 char *buf; 4527 u32 length = 0; 4528 4529 buf = stats_req->buf; 4530 length = min_t(u32, stats_req->buf_len, ATH11K_HTT_STATS_BUF_SIZE); 4531 return simple_read_from_buffer(user_buf, count, ppos, buf, length); 4532 } 4533 4534 static const struct file_operations fops_dump_htt_stats = { 4535 .open = ath11k_open_htt_stats, 4536 .release = ath11k_release_htt_stats, 4537 .read = ath11k_read_htt_stats, 4538 .owner = THIS_MODULE, 4539 .llseek = default_llseek, 4540 }; 4541 4542 static ssize_t ath11k_read_htt_stats_reset(struct file *file, 4543 char __user *user_buf, 4544 size_t count, loff_t *ppos) 4545 { 4546 struct ath11k *ar = file->private_data; 4547 char buf[32]; 4548 size_t len; 4549 4550 len = scnprintf(buf, sizeof(buf), "%u\n", ar->debug.htt_stats.reset); 4551 4552 return simple_read_from_buffer(user_buf, count, ppos, buf, len); 4553 } 4554 4555 static ssize_t ath11k_write_htt_stats_reset(struct file *file, 4556 const char __user *user_buf, 4557 size_t count, loff_t *ppos) 4558 { 4559 struct ath11k *ar = file->private_data; 4560 u8 type; 4561 struct htt_ext_stats_cfg_params cfg_params = { 0 }; 4562 int ret; 4563 4564 ret = kstrtou8_from_user(user_buf, count, 0, &type); 4565 if (ret) 4566 return ret; 4567 4568 if (type >= ATH11K_DBG_HTT_NUM_EXT_STATS || 4569 type == ATH11K_DBG_HTT_EXT_STATS_RESET) 4570 return -E2BIG; 4571 4572 mutex_lock(&ar->conf_mutex); 4573 cfg_params.cfg0 = HTT_STAT_DEFAULT_RESET_START_OFFSET; 4574 cfg_params.cfg1 = 1 << (cfg_params.cfg0 + type); 4575 ret = ath11k_dp_tx_htt_h2t_ext_stats_req(ar, 4576 ATH11K_DBG_HTT_EXT_STATS_RESET, 4577 &cfg_params, 4578 0ULL); 4579 if (ret) { 4580 ath11k_warn(ar->ab, "failed to send htt stats request: %d\n", ret); 4581 mutex_unlock(&ar->conf_mutex); 4582 return ret; 4583 } 4584 4585 ar->debug.htt_stats.reset = type; 4586 mutex_unlock(&ar->conf_mutex); 4587 4588 ret = count; 4589 4590 return ret; 4591 } 4592 4593 static const struct file_operations fops_htt_stats_reset = { 4594 .read = ath11k_read_htt_stats_reset, 4595 .write = ath11k_write_htt_stats_reset, 4596 .open = simple_open, 4597 .owner = THIS_MODULE, 4598 .llseek = default_llseek, 4599 }; 4600 4601 void ath11k_debugfs_htt_stats_init(struct ath11k *ar) 4602 { 4603 spin_lock_init(&ar->debug.htt_stats.lock); 4604 debugfs_create_file("htt_stats_type", 0600, ar->debug.debugfs_pdev, 4605 ar, &fops_htt_stats_type); 4606 debugfs_create_file("htt_stats", 0400, ar->debug.debugfs_pdev, 4607 ar, &fops_dump_htt_stats); 4608 debugfs_create_file("htt_stats_reset", 0600, ar->debug.debugfs_pdev, 4609 ar, &fops_htt_stats_reset); 4610 } 4611