1 /* 2 * This file is part of wl18xx 3 * 4 * Copyright (C) 2009 Nokia Corporation 5 * Copyright (C) 2011-2012 Texas Instruments 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * version 2 as published by the Free Software Foundation. 10 * 11 * This program is distributed in the hope that it will be useful, but 12 * WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 19 * 02110-1301 USA 20 * 21 */ 22 23 #include "../wlcore/debugfs.h" 24 #include "../wlcore/wlcore.h" 25 #include "../wlcore/debug.h" 26 #include "../wlcore/ps.h" 27 28 #include "wl18xx.h" 29 #include "acx.h" 30 #include "cmd.h" 31 #include "debugfs.h" 32 33 #define WL18XX_DEBUGFS_FWSTATS_FILE(a, b, c) \ 34 DEBUGFS_FWSTATS_FILE(a, b, c, wl18xx_acx_statistics) 35 #define WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(a, b, c) \ 36 DEBUGFS_FWSTATS_FILE_ARRAY(a, b, c, wl18xx_acx_statistics) 37 38 39 WL18XX_DEBUGFS_FWSTATS_FILE(error, error_frame_non_ctrl, "%u"); 40 WL18XX_DEBUGFS_FWSTATS_FILE(error, error_frame_ctrl, "%u"); 41 WL18XX_DEBUGFS_FWSTATS_FILE(error, error_frame_during_protection, "%u"); 42 WL18XX_DEBUGFS_FWSTATS_FILE(error, null_frame_tx_start, "%u"); 43 WL18XX_DEBUGFS_FWSTATS_FILE(error, null_frame_cts_start, "%u"); 44 WL18XX_DEBUGFS_FWSTATS_FILE(error, bar_retry, "%u"); 45 WL18XX_DEBUGFS_FWSTATS_FILE(error, num_frame_cts_nul_flid, "%u"); 46 WL18XX_DEBUGFS_FWSTATS_FILE(error, tx_abort_failure, "%u"); 47 WL18XX_DEBUGFS_FWSTATS_FILE(error, tx_resume_failure, "%u"); 48 WL18XX_DEBUGFS_FWSTATS_FILE(error, rx_cmplt_db_overflow_cnt, "%u"); 49 WL18XX_DEBUGFS_FWSTATS_FILE(error, elp_while_rx_exch, "%u"); 50 WL18XX_DEBUGFS_FWSTATS_FILE(error, elp_while_tx_exch, "%u"); 51 WL18XX_DEBUGFS_FWSTATS_FILE(error, elp_while_tx, "%u"); 52 WL18XX_DEBUGFS_FWSTATS_FILE(error, elp_while_nvic_pending, "%u"); 53 WL18XX_DEBUGFS_FWSTATS_FILE(error, rx_excessive_frame_len, "%u"); 54 WL18XX_DEBUGFS_FWSTATS_FILE(error, burst_mismatch, "%u"); 55 WL18XX_DEBUGFS_FWSTATS_FILE(error, tbc_exch_mismatch, "%u"); 56 57 WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_prepared_descs, "%u"); 58 WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_cmplt, "%u"); 59 WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_template_prepared, "%u"); 60 WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_data_prepared, "%u"); 61 WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_template_programmed, "%u"); 62 WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_data_programmed, "%u"); 63 WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_burst_programmed, "%u"); 64 WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_starts, "%u"); 65 WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_stop, "%u"); 66 WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_start_templates, "%u"); 67 WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_start_int_templates, "%u"); 68 WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_start_fw_gen, "%u"); 69 WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_start_data, "%u"); 70 WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_start_null_frame, "%u"); 71 WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_exch, "%u"); 72 WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_retry_template, "%u"); 73 WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_retry_data, "%u"); 74 WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(tx, tx_retry_per_rate, 75 NUM_OF_RATES_INDEXES); 76 WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_exch_pending, "%u"); 77 WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_exch_expiry, "%u"); 78 WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_done_template, "%u"); 79 WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_done_data, "%u"); 80 WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_done_int_template, "%u"); 81 WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_cfe1, "%u"); 82 WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_cfe2, "%u"); 83 WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_called, "%u"); 84 WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_mpdu_alloc_failed, "%u"); 85 WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_init_called, "%u"); 86 WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_in_process_called, "%u"); 87 WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_tkip_called, "%u"); 88 WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_key_not_found, "%u"); 89 WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_need_fragmentation, "%u"); 90 WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_bad_mblk_num, "%u"); 91 WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_failed, "%u"); 92 WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_cache_hit, "%u"); 93 WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_cache_miss, "%u"); 94 95 WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_beacon_early_term, "%u"); 96 WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_out_of_mpdu_nodes, "%u"); 97 WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_hdr_overflow, "%u"); 98 WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_dropped_frame, "%u"); 99 WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_done, "%u"); 100 WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_defrag, "%u"); 101 WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_defrag_end, "%u"); 102 WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_cmplt, "%u"); 103 WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_pre_complt, "%u"); 104 WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_cmplt_task, "%u"); 105 WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_phy_hdr, "%u"); 106 WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_timeout, "%u"); 107 WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_rts_timeout, "%u"); 108 WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_timeout_wa, "%u"); 109 WL18XX_DEBUGFS_FWSTATS_FILE(rx, defrag_called, "%u"); 110 WL18XX_DEBUGFS_FWSTATS_FILE(rx, defrag_init_called, "%u"); 111 WL18XX_DEBUGFS_FWSTATS_FILE(rx, defrag_in_process_called, "%u"); 112 WL18XX_DEBUGFS_FWSTATS_FILE(rx, defrag_tkip_called, "%u"); 113 WL18XX_DEBUGFS_FWSTATS_FILE(rx, defrag_need_defrag, "%u"); 114 WL18XX_DEBUGFS_FWSTATS_FILE(rx, defrag_decrypt_failed, "%u"); 115 WL18XX_DEBUGFS_FWSTATS_FILE(rx, decrypt_key_not_found, "%u"); 116 WL18XX_DEBUGFS_FWSTATS_FILE(rx, defrag_need_decrypt, "%u"); 117 WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_tkip_replays, "%u"); 118 WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_xfr, "%u"); 119 120 WL18XX_DEBUGFS_FWSTATS_FILE(isr, irqs, "%u"); 121 122 WL18XX_DEBUGFS_FWSTATS_FILE(pwr, missing_bcns_cnt, "%u"); 123 WL18XX_DEBUGFS_FWSTATS_FILE(pwr, rcvd_bcns_cnt, "%u"); 124 WL18XX_DEBUGFS_FWSTATS_FILE(pwr, connection_out_of_sync, "%u"); 125 WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(pwr, cont_miss_bcns_spread, 126 PWR_STAT_MAX_CONT_MISSED_BCNS_SPREAD); 127 WL18XX_DEBUGFS_FWSTATS_FILE(pwr, rcvd_awake_bcns_cnt, "%u"); 128 WL18XX_DEBUGFS_FWSTATS_FILE(pwr, sleep_time_count, "%u"); 129 WL18XX_DEBUGFS_FWSTATS_FILE(pwr, sleep_time_avg, "%u"); 130 WL18XX_DEBUGFS_FWSTATS_FILE(pwr, sleep_cycle_avg, "%u"); 131 WL18XX_DEBUGFS_FWSTATS_FILE(pwr, sleep_percent, "%u"); 132 WL18XX_DEBUGFS_FWSTATS_FILE(pwr, ap_sleep_active_conf, "%u"); 133 WL18XX_DEBUGFS_FWSTATS_FILE(pwr, ap_sleep_user_conf, "%u"); 134 WL18XX_DEBUGFS_FWSTATS_FILE(pwr, ap_sleep_counter, "%u"); 135 136 WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, beacon_filter, "%u"); 137 WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, arp_filter, "%u"); 138 WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, mc_filter, "%u"); 139 WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, dup_filter, "%u"); 140 WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, data_filter, "%u"); 141 WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, ibss_filter, "%u"); 142 WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, protection_filter, "%u"); 143 WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, accum_arp_pend_requests, "%u"); 144 WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, max_arp_queue_dep, "%u"); 145 146 WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(rx_rate, rx_frames_per_rates, 50); 147 148 WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(aggr_size, tx_agg_rate, 149 AGGR_STATS_TX_AGG); 150 WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(aggr_size, tx_agg_len, 151 AGGR_STATS_TX_AGG); 152 WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(aggr_size, rx_size, 153 AGGR_STATS_RX_SIZE_LEN); 154 155 WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, hs_tx_stat_fifo_int, "%u"); 156 WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, enc_tx_stat_fifo_int, "%u"); 157 WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, enc_rx_stat_fifo_int, "%u"); 158 WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, rx_complete_stat_fifo_int, "%u"); 159 WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, pre_proc_swi, "%u"); 160 WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, post_proc_swi, "%u"); 161 WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, sec_frag_swi, "%u"); 162 WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, pre_to_defrag_swi, "%u"); 163 WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, defrag_to_rx_xfer_swi, "%u"); 164 WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, dec_packet_in, "%u"); 165 WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, dec_packet_in_fifo_full, "%u"); 166 WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, dec_packet_out, "%u"); 167 168 WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(pipeline, pipeline_fifo_full, 169 PIPE_STATS_HW_FIFO); 170 171 WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(diversity, num_of_packets_per_ant, 172 DIVERSITY_STATS_NUM_OF_ANT); 173 WL18XX_DEBUGFS_FWSTATS_FILE(diversity, total_num_of_toggles, "%u"); 174 175 WL18XX_DEBUGFS_FWSTATS_FILE(thermal, irq_thr_low, "%u"); 176 WL18XX_DEBUGFS_FWSTATS_FILE(thermal, irq_thr_high, "%u"); 177 WL18XX_DEBUGFS_FWSTATS_FILE(thermal, tx_stop, "%u"); 178 WL18XX_DEBUGFS_FWSTATS_FILE(thermal, tx_resume, "%u"); 179 WL18XX_DEBUGFS_FWSTATS_FILE(thermal, false_irq, "%u"); 180 WL18XX_DEBUGFS_FWSTATS_FILE(thermal, adc_source_unexpected, "%u"); 181 182 WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(calib, fail_count, 183 WL18XX_NUM_OF_CALIBRATIONS_ERRORS); 184 WL18XX_DEBUGFS_FWSTATS_FILE(calib, calib_count, "%u"); 185 186 WL18XX_DEBUGFS_FWSTATS_FILE(roaming, rssi_level, "%d"); 187 188 WL18XX_DEBUGFS_FWSTATS_FILE(dfs, num_of_radar_detections, "%d"); 189 190 static ssize_t conf_read(struct file *file, char __user *user_buf, 191 size_t count, loff_t *ppos) 192 { 193 struct wl1271 *wl = file->private_data; 194 struct wl18xx_priv *priv = wl->priv; 195 struct wlcore_conf_header header; 196 char *buf, *pos; 197 size_t len; 198 int ret; 199 200 len = WL18XX_CONF_SIZE; 201 buf = kmalloc(len, GFP_KERNEL); 202 if (!buf) 203 return -ENOMEM; 204 205 header.magic = cpu_to_le32(WL18XX_CONF_MAGIC); 206 header.version = cpu_to_le32(WL18XX_CONF_VERSION); 207 header.checksum = 0; 208 209 mutex_lock(&wl->mutex); 210 211 pos = buf; 212 memcpy(pos, &header, sizeof(header)); 213 pos += sizeof(header); 214 memcpy(pos, &wl->conf, sizeof(wl->conf)); 215 pos += sizeof(wl->conf); 216 memcpy(pos, &priv->conf, sizeof(priv->conf)); 217 218 mutex_unlock(&wl->mutex); 219 220 ret = simple_read_from_buffer(user_buf, count, ppos, buf, len); 221 222 kfree(buf); 223 return ret; 224 } 225 226 static const struct file_operations conf_ops = { 227 .read = conf_read, 228 .open = simple_open, 229 .llseek = default_llseek, 230 }; 231 232 static ssize_t clear_fw_stats_write(struct file *file, 233 const char __user *user_buf, 234 size_t count, loff_t *ppos) 235 { 236 struct wl1271 *wl = file->private_data; 237 int ret; 238 239 mutex_lock(&wl->mutex); 240 241 if (unlikely(wl->state != WLCORE_STATE_ON)) 242 goto out; 243 244 ret = wl18xx_acx_clear_statistics(wl); 245 if (ret < 0) { 246 count = ret; 247 goto out; 248 } 249 out: 250 mutex_unlock(&wl->mutex); 251 return count; 252 } 253 254 static const struct file_operations clear_fw_stats_ops = { 255 .write = clear_fw_stats_write, 256 .open = simple_open, 257 .llseek = default_llseek, 258 }; 259 260 static ssize_t radar_detection_write(struct file *file, 261 const char __user *user_buf, 262 size_t count, loff_t *ppos) 263 { 264 struct wl1271 *wl = file->private_data; 265 int ret; 266 u8 channel; 267 268 ret = kstrtou8_from_user(user_buf, count, 10, &channel); 269 if (ret < 0) { 270 wl1271_warning("illegal channel"); 271 return -EINVAL; 272 } 273 274 mutex_lock(&wl->mutex); 275 276 if (unlikely(wl->state != WLCORE_STATE_ON)) 277 goto out; 278 279 ret = wl1271_ps_elp_wakeup(wl); 280 if (ret < 0) 281 goto out; 282 283 ret = wl18xx_cmd_radar_detection_debug(wl, channel); 284 if (ret < 0) 285 count = ret; 286 287 wl1271_ps_elp_sleep(wl); 288 out: 289 mutex_unlock(&wl->mutex); 290 return count; 291 } 292 293 static const struct file_operations radar_detection_ops = { 294 .write = radar_detection_write, 295 .open = simple_open, 296 .llseek = default_llseek, 297 }; 298 299 static ssize_t dynamic_fw_traces_write(struct file *file, 300 const char __user *user_buf, 301 size_t count, loff_t *ppos) 302 { 303 struct wl1271 *wl = file->private_data; 304 unsigned long value; 305 int ret; 306 307 ret = kstrtoul_from_user(user_buf, count, 0, &value); 308 if (ret < 0) 309 return ret; 310 311 mutex_lock(&wl->mutex); 312 313 wl->dynamic_fw_traces = value; 314 315 if (unlikely(wl->state != WLCORE_STATE_ON)) 316 goto out; 317 318 ret = wl1271_ps_elp_wakeup(wl); 319 if (ret < 0) 320 goto out; 321 322 ret = wl18xx_acx_dynamic_fw_traces(wl); 323 if (ret < 0) 324 count = ret; 325 326 wl1271_ps_elp_sleep(wl); 327 out: 328 mutex_unlock(&wl->mutex); 329 return count; 330 } 331 332 static ssize_t dynamic_fw_traces_read(struct file *file, 333 char __user *userbuf, 334 size_t count, loff_t *ppos) 335 { 336 struct wl1271 *wl = file->private_data; 337 return wl1271_format_buffer(userbuf, count, ppos, 338 "%d\n", wl->dynamic_fw_traces); 339 } 340 341 static const struct file_operations dynamic_fw_traces_ops = { 342 .read = dynamic_fw_traces_read, 343 .write = dynamic_fw_traces_write, 344 .open = simple_open, 345 .llseek = default_llseek, 346 }; 347 348 #ifdef CONFIG_CFG80211_CERTIFICATION_ONUS 349 static ssize_t radar_debug_mode_write(struct file *file, 350 const char __user *user_buf, 351 size_t count, loff_t *ppos) 352 { 353 struct wl1271 *wl = file->private_data; 354 struct wl12xx_vif *wlvif; 355 unsigned long value; 356 int ret; 357 358 ret = kstrtoul_from_user(user_buf, count, 10, &value); 359 if (ret < 0) { 360 wl1271_warning("illegal radar_debug_mode value!"); 361 return -EINVAL; 362 } 363 364 /* valid values: 0/1 */ 365 if (!(value == 0 || value == 1)) { 366 wl1271_warning("value is not in valid!"); 367 return -EINVAL; 368 } 369 370 mutex_lock(&wl->mutex); 371 372 wl->radar_debug_mode = value; 373 374 if (unlikely(wl->state != WLCORE_STATE_ON)) 375 goto out; 376 377 ret = wl1271_ps_elp_wakeup(wl); 378 if (ret < 0) 379 goto out; 380 381 wl12xx_for_each_wlvif_ap(wl, wlvif) { 382 wlcore_cmd_generic_cfg(wl, wlvif, 383 WLCORE_CFG_FEATURE_RADAR_DEBUG, 384 wl->radar_debug_mode, 0); 385 } 386 387 wl1271_ps_elp_sleep(wl); 388 out: 389 mutex_unlock(&wl->mutex); 390 return count; 391 } 392 393 static ssize_t radar_debug_mode_read(struct file *file, 394 char __user *userbuf, 395 size_t count, loff_t *ppos) 396 { 397 struct wl1271 *wl = file->private_data; 398 399 return wl1271_format_buffer(userbuf, count, ppos, 400 "%d\n", wl->radar_debug_mode); 401 } 402 403 static const struct file_operations radar_debug_mode_ops = { 404 .write = radar_debug_mode_write, 405 .read = radar_debug_mode_read, 406 .open = simple_open, 407 .llseek = default_llseek, 408 }; 409 #endif /* CFG80211_CERTIFICATION_ONUS */ 410 411 int wl18xx_debugfs_add_files(struct wl1271 *wl, 412 struct dentry *rootdir) 413 { 414 int ret = 0; 415 struct dentry *entry, *stats, *moddir; 416 417 moddir = debugfs_create_dir(KBUILD_MODNAME, rootdir); 418 if (!moddir || IS_ERR(moddir)) { 419 entry = moddir; 420 goto err; 421 } 422 423 stats = debugfs_create_dir("fw_stats", moddir); 424 if (!stats || IS_ERR(stats)) { 425 entry = stats; 426 goto err; 427 } 428 429 DEBUGFS_ADD(clear_fw_stats, stats); 430 431 DEBUGFS_FWSTATS_ADD(error, error_frame_non_ctrl); 432 DEBUGFS_FWSTATS_ADD(error, error_frame_ctrl); 433 DEBUGFS_FWSTATS_ADD(error, error_frame_during_protection); 434 DEBUGFS_FWSTATS_ADD(error, null_frame_tx_start); 435 DEBUGFS_FWSTATS_ADD(error, null_frame_cts_start); 436 DEBUGFS_FWSTATS_ADD(error, bar_retry); 437 DEBUGFS_FWSTATS_ADD(error, num_frame_cts_nul_flid); 438 DEBUGFS_FWSTATS_ADD(error, tx_abort_failure); 439 DEBUGFS_FWSTATS_ADD(error, tx_resume_failure); 440 DEBUGFS_FWSTATS_ADD(error, rx_cmplt_db_overflow_cnt); 441 DEBUGFS_FWSTATS_ADD(error, elp_while_rx_exch); 442 DEBUGFS_FWSTATS_ADD(error, elp_while_tx_exch); 443 DEBUGFS_FWSTATS_ADD(error, elp_while_tx); 444 DEBUGFS_FWSTATS_ADD(error, elp_while_nvic_pending); 445 DEBUGFS_FWSTATS_ADD(error, rx_excessive_frame_len); 446 DEBUGFS_FWSTATS_ADD(error, burst_mismatch); 447 DEBUGFS_FWSTATS_ADD(error, tbc_exch_mismatch); 448 449 DEBUGFS_FWSTATS_ADD(tx, tx_prepared_descs); 450 DEBUGFS_FWSTATS_ADD(tx, tx_cmplt); 451 DEBUGFS_FWSTATS_ADD(tx, tx_template_prepared); 452 DEBUGFS_FWSTATS_ADD(tx, tx_data_prepared); 453 DEBUGFS_FWSTATS_ADD(tx, tx_template_programmed); 454 DEBUGFS_FWSTATS_ADD(tx, tx_data_programmed); 455 DEBUGFS_FWSTATS_ADD(tx, tx_burst_programmed); 456 DEBUGFS_FWSTATS_ADD(tx, tx_starts); 457 DEBUGFS_FWSTATS_ADD(tx, tx_stop); 458 DEBUGFS_FWSTATS_ADD(tx, tx_start_templates); 459 DEBUGFS_FWSTATS_ADD(tx, tx_start_int_templates); 460 DEBUGFS_FWSTATS_ADD(tx, tx_start_fw_gen); 461 DEBUGFS_FWSTATS_ADD(tx, tx_start_data); 462 DEBUGFS_FWSTATS_ADD(tx, tx_start_null_frame); 463 DEBUGFS_FWSTATS_ADD(tx, tx_exch); 464 DEBUGFS_FWSTATS_ADD(tx, tx_retry_template); 465 DEBUGFS_FWSTATS_ADD(tx, tx_retry_data); 466 DEBUGFS_FWSTATS_ADD(tx, tx_retry_per_rate); 467 DEBUGFS_FWSTATS_ADD(tx, tx_exch_pending); 468 DEBUGFS_FWSTATS_ADD(tx, tx_exch_expiry); 469 DEBUGFS_FWSTATS_ADD(tx, tx_done_template); 470 DEBUGFS_FWSTATS_ADD(tx, tx_done_data); 471 DEBUGFS_FWSTATS_ADD(tx, tx_done_int_template); 472 DEBUGFS_FWSTATS_ADD(tx, tx_cfe1); 473 DEBUGFS_FWSTATS_ADD(tx, tx_cfe2); 474 DEBUGFS_FWSTATS_ADD(tx, frag_called); 475 DEBUGFS_FWSTATS_ADD(tx, frag_mpdu_alloc_failed); 476 DEBUGFS_FWSTATS_ADD(tx, frag_init_called); 477 DEBUGFS_FWSTATS_ADD(tx, frag_in_process_called); 478 DEBUGFS_FWSTATS_ADD(tx, frag_tkip_called); 479 DEBUGFS_FWSTATS_ADD(tx, frag_key_not_found); 480 DEBUGFS_FWSTATS_ADD(tx, frag_need_fragmentation); 481 DEBUGFS_FWSTATS_ADD(tx, frag_bad_mblk_num); 482 DEBUGFS_FWSTATS_ADD(tx, frag_failed); 483 DEBUGFS_FWSTATS_ADD(tx, frag_cache_hit); 484 DEBUGFS_FWSTATS_ADD(tx, frag_cache_miss); 485 486 DEBUGFS_FWSTATS_ADD(rx, rx_beacon_early_term); 487 DEBUGFS_FWSTATS_ADD(rx, rx_out_of_mpdu_nodes); 488 DEBUGFS_FWSTATS_ADD(rx, rx_hdr_overflow); 489 DEBUGFS_FWSTATS_ADD(rx, rx_dropped_frame); 490 DEBUGFS_FWSTATS_ADD(rx, rx_done); 491 DEBUGFS_FWSTATS_ADD(rx, rx_defrag); 492 DEBUGFS_FWSTATS_ADD(rx, rx_defrag_end); 493 DEBUGFS_FWSTATS_ADD(rx, rx_cmplt); 494 DEBUGFS_FWSTATS_ADD(rx, rx_pre_complt); 495 DEBUGFS_FWSTATS_ADD(rx, rx_cmplt_task); 496 DEBUGFS_FWSTATS_ADD(rx, rx_phy_hdr); 497 DEBUGFS_FWSTATS_ADD(rx, rx_timeout); 498 DEBUGFS_FWSTATS_ADD(rx, rx_rts_timeout); 499 DEBUGFS_FWSTATS_ADD(rx, rx_timeout_wa); 500 DEBUGFS_FWSTATS_ADD(rx, defrag_called); 501 DEBUGFS_FWSTATS_ADD(rx, defrag_init_called); 502 DEBUGFS_FWSTATS_ADD(rx, defrag_in_process_called); 503 DEBUGFS_FWSTATS_ADD(rx, defrag_tkip_called); 504 DEBUGFS_FWSTATS_ADD(rx, defrag_need_defrag); 505 DEBUGFS_FWSTATS_ADD(rx, defrag_decrypt_failed); 506 DEBUGFS_FWSTATS_ADD(rx, decrypt_key_not_found); 507 DEBUGFS_FWSTATS_ADD(rx, defrag_need_decrypt); 508 DEBUGFS_FWSTATS_ADD(rx, rx_tkip_replays); 509 DEBUGFS_FWSTATS_ADD(rx, rx_xfr); 510 511 DEBUGFS_FWSTATS_ADD(isr, irqs); 512 513 DEBUGFS_FWSTATS_ADD(pwr, missing_bcns_cnt); 514 DEBUGFS_FWSTATS_ADD(pwr, rcvd_bcns_cnt); 515 DEBUGFS_FWSTATS_ADD(pwr, connection_out_of_sync); 516 DEBUGFS_FWSTATS_ADD(pwr, cont_miss_bcns_spread); 517 DEBUGFS_FWSTATS_ADD(pwr, rcvd_awake_bcns_cnt); 518 DEBUGFS_FWSTATS_ADD(pwr, sleep_time_count); 519 DEBUGFS_FWSTATS_ADD(pwr, sleep_time_avg); 520 DEBUGFS_FWSTATS_ADD(pwr, sleep_cycle_avg); 521 DEBUGFS_FWSTATS_ADD(pwr, sleep_percent); 522 DEBUGFS_FWSTATS_ADD(pwr, ap_sleep_active_conf); 523 DEBUGFS_FWSTATS_ADD(pwr, ap_sleep_user_conf); 524 DEBUGFS_FWSTATS_ADD(pwr, ap_sleep_counter); 525 526 DEBUGFS_FWSTATS_ADD(rx_filter, beacon_filter); 527 DEBUGFS_FWSTATS_ADD(rx_filter, arp_filter); 528 DEBUGFS_FWSTATS_ADD(rx_filter, mc_filter); 529 DEBUGFS_FWSTATS_ADD(rx_filter, dup_filter); 530 DEBUGFS_FWSTATS_ADD(rx_filter, data_filter); 531 DEBUGFS_FWSTATS_ADD(rx_filter, ibss_filter); 532 DEBUGFS_FWSTATS_ADD(rx_filter, protection_filter); 533 DEBUGFS_FWSTATS_ADD(rx_filter, accum_arp_pend_requests); 534 DEBUGFS_FWSTATS_ADD(rx_filter, max_arp_queue_dep); 535 536 DEBUGFS_FWSTATS_ADD(rx_rate, rx_frames_per_rates); 537 538 DEBUGFS_FWSTATS_ADD(aggr_size, tx_agg_rate); 539 DEBUGFS_FWSTATS_ADD(aggr_size, tx_agg_len); 540 DEBUGFS_FWSTATS_ADD(aggr_size, rx_size); 541 542 DEBUGFS_FWSTATS_ADD(pipeline, hs_tx_stat_fifo_int); 543 DEBUGFS_FWSTATS_ADD(pipeline, enc_tx_stat_fifo_int); 544 DEBUGFS_FWSTATS_ADD(pipeline, enc_rx_stat_fifo_int); 545 DEBUGFS_FWSTATS_ADD(pipeline, rx_complete_stat_fifo_int); 546 DEBUGFS_FWSTATS_ADD(pipeline, pre_proc_swi); 547 DEBUGFS_FWSTATS_ADD(pipeline, post_proc_swi); 548 DEBUGFS_FWSTATS_ADD(pipeline, sec_frag_swi); 549 DEBUGFS_FWSTATS_ADD(pipeline, pre_to_defrag_swi); 550 DEBUGFS_FWSTATS_ADD(pipeline, defrag_to_rx_xfer_swi); 551 DEBUGFS_FWSTATS_ADD(pipeline, dec_packet_in); 552 DEBUGFS_FWSTATS_ADD(pipeline, dec_packet_in_fifo_full); 553 DEBUGFS_FWSTATS_ADD(pipeline, dec_packet_out); 554 DEBUGFS_FWSTATS_ADD(pipeline, pipeline_fifo_full); 555 556 DEBUGFS_FWSTATS_ADD(diversity, num_of_packets_per_ant); 557 DEBUGFS_FWSTATS_ADD(diversity, total_num_of_toggles); 558 559 DEBUGFS_FWSTATS_ADD(thermal, irq_thr_low); 560 DEBUGFS_FWSTATS_ADD(thermal, irq_thr_high); 561 DEBUGFS_FWSTATS_ADD(thermal, tx_stop); 562 DEBUGFS_FWSTATS_ADD(thermal, tx_resume); 563 DEBUGFS_FWSTATS_ADD(thermal, false_irq); 564 DEBUGFS_FWSTATS_ADD(thermal, adc_source_unexpected); 565 566 DEBUGFS_FWSTATS_ADD(calib, fail_count); 567 568 DEBUGFS_FWSTATS_ADD(calib, calib_count); 569 570 DEBUGFS_FWSTATS_ADD(roaming, rssi_level); 571 572 DEBUGFS_FWSTATS_ADD(dfs, num_of_radar_detections); 573 574 DEBUGFS_ADD(conf, moddir); 575 DEBUGFS_ADD(radar_detection, moddir); 576 #ifdef CONFIG_CFG80211_CERTIFICATION_ONUS 577 DEBUGFS_ADD(radar_debug_mode, moddir); 578 #endif 579 DEBUGFS_ADD(dynamic_fw_traces, moddir); 580 581 return 0; 582 583 err: 584 if (IS_ERR(entry)) 585 ret = PTR_ERR(entry); 586 else 587 ret = -ENOMEM; 588 589 return ret; 590 } 591