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 39WL18XX_DEBUGFS_FWSTATS_FILE(error, error_frame_non_ctrl, "%u"); 40WL18XX_DEBUGFS_FWSTATS_FILE(error, error_frame_ctrl, "%u"); 41WL18XX_DEBUGFS_FWSTATS_FILE(error, error_frame_during_protection, "%u"); 42WL18XX_DEBUGFS_FWSTATS_FILE(error, null_frame_tx_start, "%u"); 43WL18XX_DEBUGFS_FWSTATS_FILE(error, null_frame_cts_start, "%u"); 44WL18XX_DEBUGFS_FWSTATS_FILE(error, bar_retry, "%u"); 45WL18XX_DEBUGFS_FWSTATS_FILE(error, num_frame_cts_nul_flid, "%u"); 46WL18XX_DEBUGFS_FWSTATS_FILE(error, tx_abort_failure, "%u"); 47WL18XX_DEBUGFS_FWSTATS_FILE(error, tx_resume_failure, "%u"); 48WL18XX_DEBUGFS_FWSTATS_FILE(error, rx_cmplt_db_overflow_cnt, "%u"); 49WL18XX_DEBUGFS_FWSTATS_FILE(error, elp_while_rx_exch, "%u"); 50WL18XX_DEBUGFS_FWSTATS_FILE(error, elp_while_tx_exch, "%u"); 51WL18XX_DEBUGFS_FWSTATS_FILE(error, elp_while_tx, "%u"); 52WL18XX_DEBUGFS_FWSTATS_FILE(error, elp_while_nvic_pending, "%u"); 53WL18XX_DEBUGFS_FWSTATS_FILE(error, rx_excessive_frame_len, "%u"); 54WL18XX_DEBUGFS_FWSTATS_FILE(error, burst_mismatch, "%u"); 55WL18XX_DEBUGFS_FWSTATS_FILE(error, tbc_exch_mismatch, "%u"); 56 57WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_prepared_descs, "%u"); 58WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_cmplt, "%u"); 59WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_template_prepared, "%u"); 60WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_data_prepared, "%u"); 61WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_template_programmed, "%u"); 62WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_data_programmed, "%u"); 63WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_burst_programmed, "%u"); 64WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_starts, "%u"); 65WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_stop, "%u"); 66WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_start_templates, "%u"); 67WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_start_int_templates, "%u"); 68WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_start_fw_gen, "%u"); 69WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_start_data, "%u"); 70WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_start_null_frame, "%u"); 71WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_exch, "%u"); 72WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_retry_template, "%u"); 73WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_retry_data, "%u"); 74WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(tx, tx_retry_per_rate, 75 NUM_OF_RATES_INDEXES); 76WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_exch_pending, "%u"); 77WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_exch_expiry, "%u"); 78WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_done_template, "%u"); 79WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_done_data, "%u"); 80WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_done_int_template, "%u"); 81WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_cfe1, "%u"); 82WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_cfe2, "%u"); 83WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_called, "%u"); 84WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_mpdu_alloc_failed, "%u"); 85WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_init_called, "%u"); 86WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_in_process_called, "%u"); 87WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_tkip_called, "%u"); 88WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_key_not_found, "%u"); 89WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_need_fragmentation, "%u"); 90WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_bad_mblk_num, "%u"); 91WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_failed, "%u"); 92WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_cache_hit, "%u"); 93WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_cache_miss, "%u"); 94 95WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_beacon_early_term, "%u"); 96WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_out_of_mpdu_nodes, "%u"); 97WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_hdr_overflow, "%u"); 98WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_dropped_frame, "%u"); 99WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_done, "%u"); 100WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_defrag, "%u"); 101WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_defrag_end, "%u"); 102WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_cmplt, "%u"); 103WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_pre_complt, "%u"); 104WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_cmplt_task, "%u"); 105WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_phy_hdr, "%u"); 106WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_timeout, "%u"); 107WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_rts_timeout, "%u"); 108WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_timeout_wa, "%u"); 109WL18XX_DEBUGFS_FWSTATS_FILE(rx, defrag_called, "%u"); 110WL18XX_DEBUGFS_FWSTATS_FILE(rx, defrag_init_called, "%u"); 111WL18XX_DEBUGFS_FWSTATS_FILE(rx, defrag_in_process_called, "%u"); 112WL18XX_DEBUGFS_FWSTATS_FILE(rx, defrag_tkip_called, "%u"); 113WL18XX_DEBUGFS_FWSTATS_FILE(rx, defrag_need_defrag, "%u"); 114WL18XX_DEBUGFS_FWSTATS_FILE(rx, defrag_decrypt_failed, "%u"); 115WL18XX_DEBUGFS_FWSTATS_FILE(rx, decrypt_key_not_found, "%u"); 116WL18XX_DEBUGFS_FWSTATS_FILE(rx, defrag_need_decrypt, "%u"); 117WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_tkip_replays, "%u"); 118WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_xfr, "%u"); 119 120WL18XX_DEBUGFS_FWSTATS_FILE(isr, irqs, "%u"); 121 122WL18XX_DEBUGFS_FWSTATS_FILE(pwr, missing_bcns_cnt, "%u"); 123WL18XX_DEBUGFS_FWSTATS_FILE(pwr, rcvd_bcns_cnt, "%u"); 124WL18XX_DEBUGFS_FWSTATS_FILE(pwr, connection_out_of_sync, "%u"); 125WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(pwr, cont_miss_bcns_spread, 126 PWR_STAT_MAX_CONT_MISSED_BCNS_SPREAD); 127WL18XX_DEBUGFS_FWSTATS_FILE(pwr, rcvd_awake_bcns_cnt, "%u"); 128WL18XX_DEBUGFS_FWSTATS_FILE(pwr, sleep_time_count, "%u"); 129WL18XX_DEBUGFS_FWSTATS_FILE(pwr, sleep_time_avg, "%u"); 130WL18XX_DEBUGFS_FWSTATS_FILE(pwr, sleep_cycle_avg, "%u"); 131WL18XX_DEBUGFS_FWSTATS_FILE(pwr, sleep_percent, "%u"); 132WL18XX_DEBUGFS_FWSTATS_FILE(pwr, ap_sleep_active_conf, "%u"); 133WL18XX_DEBUGFS_FWSTATS_FILE(pwr, ap_sleep_user_conf, "%u"); 134WL18XX_DEBUGFS_FWSTATS_FILE(pwr, ap_sleep_counter, "%u"); 135 136WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, beacon_filter, "%u"); 137WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, arp_filter, "%u"); 138WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, mc_filter, "%u"); 139WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, dup_filter, "%u"); 140WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, data_filter, "%u"); 141WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, ibss_filter, "%u"); 142WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, protection_filter, "%u"); 143WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, accum_arp_pend_requests, "%u"); 144WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, max_arp_queue_dep, "%u"); 145 146WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(rx_rate, rx_frames_per_rates, 50); 147 148WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(aggr_size, tx_agg_rate, 149 AGGR_STATS_TX_AGG); 150WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(aggr_size, tx_agg_len, 151 AGGR_STATS_TX_AGG); 152WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(aggr_size, rx_size, 153 AGGR_STATS_RX_SIZE_LEN); 154 155WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, hs_tx_stat_fifo_int, "%u"); 156WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, enc_tx_stat_fifo_int, "%u"); 157WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, enc_rx_stat_fifo_int, "%u"); 158WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, rx_complete_stat_fifo_int, "%u"); 159WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, pre_proc_swi, "%u"); 160WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, post_proc_swi, "%u"); 161WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, sec_frag_swi, "%u"); 162WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, pre_to_defrag_swi, "%u"); 163WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, defrag_to_rx_xfer_swi, "%u"); 164WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, dec_packet_in, "%u"); 165WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, dec_packet_in_fifo_full, "%u"); 166WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, dec_packet_out, "%u"); 167 168WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(pipeline, pipeline_fifo_full, 169 PIPE_STATS_HW_FIFO); 170 171WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(diversity, num_of_packets_per_ant, 172 DIVERSITY_STATS_NUM_OF_ANT); 173WL18XX_DEBUGFS_FWSTATS_FILE(diversity, total_num_of_toggles, "%u"); 174 175WL18XX_DEBUGFS_FWSTATS_FILE(thermal, irq_thr_low, "%u"); 176WL18XX_DEBUGFS_FWSTATS_FILE(thermal, irq_thr_high, "%u"); 177WL18XX_DEBUGFS_FWSTATS_FILE(thermal, tx_stop, "%u"); 178WL18XX_DEBUGFS_FWSTATS_FILE(thermal, tx_resume, "%u"); 179WL18XX_DEBUGFS_FWSTATS_FILE(thermal, false_irq, "%u"); 180WL18XX_DEBUGFS_FWSTATS_FILE(thermal, adc_source_unexpected, "%u"); 181 182WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(calib, fail_count, 183 WL18XX_NUM_OF_CALIBRATIONS_ERRORS); 184WL18XX_DEBUGFS_FWSTATS_FILE(calib, calib_count, "%u"); 185 186WL18XX_DEBUGFS_FWSTATS_FILE(roaming, rssi_level, "%d"); 187 188WL18XX_DEBUGFS_FWSTATS_FILE(dfs, num_of_radar_detections, "%d"); 189 190static 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 226static const struct file_operations conf_ops = { 227 .read = conf_read, 228 .open = simple_open, 229 .llseek = default_llseek, 230}; 231 232static 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 } 249out: 250 mutex_unlock(&wl->mutex); 251 return count; 252} 253 254static const struct file_operations clear_fw_stats_ops = { 255 .write = clear_fw_stats_write, 256 .open = simple_open, 257 .llseek = default_llseek, 258}; 259 260static 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); 288out: 289 mutex_unlock(&wl->mutex); 290 return count; 291} 292 293static const struct file_operations radar_detection_ops = { 294 .write = radar_detection_write, 295 .open = simple_open, 296 .llseek = default_llseek, 297}; 298 299static 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); 327out: 328 mutex_unlock(&wl->mutex); 329 return count; 330} 331 332static 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 341static 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 348int wl18xx_debugfs_add_files(struct wl1271 *wl, 349 struct dentry *rootdir) 350{ 351 int ret = 0; 352 struct dentry *entry, *stats, *moddir; 353 354 moddir = debugfs_create_dir(KBUILD_MODNAME, rootdir); 355 if (!moddir || IS_ERR(moddir)) { 356 entry = moddir; 357 goto err; 358 } 359 360 stats = debugfs_create_dir("fw_stats", moddir); 361 if (!stats || IS_ERR(stats)) { 362 entry = stats; 363 goto err; 364 } 365 366 DEBUGFS_ADD(clear_fw_stats, stats); 367 368 DEBUGFS_FWSTATS_ADD(error, error_frame_non_ctrl); 369 DEBUGFS_FWSTATS_ADD(error, error_frame_ctrl); 370 DEBUGFS_FWSTATS_ADD(error, error_frame_during_protection); 371 DEBUGFS_FWSTATS_ADD(error, null_frame_tx_start); 372 DEBUGFS_FWSTATS_ADD(error, null_frame_cts_start); 373 DEBUGFS_FWSTATS_ADD(error, bar_retry); 374 DEBUGFS_FWSTATS_ADD(error, num_frame_cts_nul_flid); 375 DEBUGFS_FWSTATS_ADD(error, tx_abort_failure); 376 DEBUGFS_FWSTATS_ADD(error, tx_resume_failure); 377 DEBUGFS_FWSTATS_ADD(error, rx_cmplt_db_overflow_cnt); 378 DEBUGFS_FWSTATS_ADD(error, elp_while_rx_exch); 379 DEBUGFS_FWSTATS_ADD(error, elp_while_tx_exch); 380 DEBUGFS_FWSTATS_ADD(error, elp_while_tx); 381 DEBUGFS_FWSTATS_ADD(error, elp_while_nvic_pending); 382 DEBUGFS_FWSTATS_ADD(error, rx_excessive_frame_len); 383 DEBUGFS_FWSTATS_ADD(error, burst_mismatch); 384 DEBUGFS_FWSTATS_ADD(error, tbc_exch_mismatch); 385 386 DEBUGFS_FWSTATS_ADD(tx, tx_prepared_descs); 387 DEBUGFS_FWSTATS_ADD(tx, tx_cmplt); 388 DEBUGFS_FWSTATS_ADD(tx, tx_template_prepared); 389 DEBUGFS_FWSTATS_ADD(tx, tx_data_prepared); 390 DEBUGFS_FWSTATS_ADD(tx, tx_template_programmed); 391 DEBUGFS_FWSTATS_ADD(tx, tx_data_programmed); 392 DEBUGFS_FWSTATS_ADD(tx, tx_burst_programmed); 393 DEBUGFS_FWSTATS_ADD(tx, tx_starts); 394 DEBUGFS_FWSTATS_ADD(tx, tx_stop); 395 DEBUGFS_FWSTATS_ADD(tx, tx_start_templates); 396 DEBUGFS_FWSTATS_ADD(tx, tx_start_int_templates); 397 DEBUGFS_FWSTATS_ADD(tx, tx_start_fw_gen); 398 DEBUGFS_FWSTATS_ADD(tx, tx_start_data); 399 DEBUGFS_FWSTATS_ADD(tx, tx_start_null_frame); 400 DEBUGFS_FWSTATS_ADD(tx, tx_exch); 401 DEBUGFS_FWSTATS_ADD(tx, tx_retry_template); 402 DEBUGFS_FWSTATS_ADD(tx, tx_retry_data); 403 DEBUGFS_FWSTATS_ADD(tx, tx_retry_per_rate); 404 DEBUGFS_FWSTATS_ADD(tx, tx_exch_pending); 405 DEBUGFS_FWSTATS_ADD(tx, tx_exch_expiry); 406 DEBUGFS_FWSTATS_ADD(tx, tx_done_template); 407 DEBUGFS_FWSTATS_ADD(tx, tx_done_data); 408 DEBUGFS_FWSTATS_ADD(tx, tx_done_int_template); 409 DEBUGFS_FWSTATS_ADD(tx, tx_cfe1); 410 DEBUGFS_FWSTATS_ADD(tx, tx_cfe2); 411 DEBUGFS_FWSTATS_ADD(tx, frag_called); 412 DEBUGFS_FWSTATS_ADD(tx, frag_mpdu_alloc_failed); 413 DEBUGFS_FWSTATS_ADD(tx, frag_init_called); 414 DEBUGFS_FWSTATS_ADD(tx, frag_in_process_called); 415 DEBUGFS_FWSTATS_ADD(tx, frag_tkip_called); 416 DEBUGFS_FWSTATS_ADD(tx, frag_key_not_found); 417 DEBUGFS_FWSTATS_ADD(tx, frag_need_fragmentation); 418 DEBUGFS_FWSTATS_ADD(tx, frag_bad_mblk_num); 419 DEBUGFS_FWSTATS_ADD(tx, frag_failed); 420 DEBUGFS_FWSTATS_ADD(tx, frag_cache_hit); 421 DEBUGFS_FWSTATS_ADD(tx, frag_cache_miss); 422 423 DEBUGFS_FWSTATS_ADD(rx, rx_beacon_early_term); 424 DEBUGFS_FWSTATS_ADD(rx, rx_out_of_mpdu_nodes); 425 DEBUGFS_FWSTATS_ADD(rx, rx_hdr_overflow); 426 DEBUGFS_FWSTATS_ADD(rx, rx_dropped_frame); 427 DEBUGFS_FWSTATS_ADD(rx, rx_done); 428 DEBUGFS_FWSTATS_ADD(rx, rx_defrag); 429 DEBUGFS_FWSTATS_ADD(rx, rx_defrag_end); 430 DEBUGFS_FWSTATS_ADD(rx, rx_cmplt); 431 DEBUGFS_FWSTATS_ADD(rx, rx_pre_complt); 432 DEBUGFS_FWSTATS_ADD(rx, rx_cmplt_task); 433 DEBUGFS_FWSTATS_ADD(rx, rx_phy_hdr); 434 DEBUGFS_FWSTATS_ADD(rx, rx_timeout); 435 DEBUGFS_FWSTATS_ADD(rx, rx_rts_timeout); 436 DEBUGFS_FWSTATS_ADD(rx, rx_timeout_wa); 437 DEBUGFS_FWSTATS_ADD(rx, defrag_called); 438 DEBUGFS_FWSTATS_ADD(rx, defrag_init_called); 439 DEBUGFS_FWSTATS_ADD(rx, defrag_in_process_called); 440 DEBUGFS_FWSTATS_ADD(rx, defrag_tkip_called); 441 DEBUGFS_FWSTATS_ADD(rx, defrag_need_defrag); 442 DEBUGFS_FWSTATS_ADD(rx, defrag_decrypt_failed); 443 DEBUGFS_FWSTATS_ADD(rx, decrypt_key_not_found); 444 DEBUGFS_FWSTATS_ADD(rx, defrag_need_decrypt); 445 DEBUGFS_FWSTATS_ADD(rx, rx_tkip_replays); 446 DEBUGFS_FWSTATS_ADD(rx, rx_xfr); 447 448 DEBUGFS_FWSTATS_ADD(isr, irqs); 449 450 DEBUGFS_FWSTATS_ADD(pwr, missing_bcns_cnt); 451 DEBUGFS_FWSTATS_ADD(pwr, rcvd_bcns_cnt); 452 DEBUGFS_FWSTATS_ADD(pwr, connection_out_of_sync); 453 DEBUGFS_FWSTATS_ADD(pwr, cont_miss_bcns_spread); 454 DEBUGFS_FWSTATS_ADD(pwr, rcvd_awake_bcns_cnt); 455 DEBUGFS_FWSTATS_ADD(pwr, sleep_time_count); 456 DEBUGFS_FWSTATS_ADD(pwr, sleep_time_avg); 457 DEBUGFS_FWSTATS_ADD(pwr, sleep_cycle_avg); 458 DEBUGFS_FWSTATS_ADD(pwr, sleep_percent); 459 DEBUGFS_FWSTATS_ADD(pwr, ap_sleep_active_conf); 460 DEBUGFS_FWSTATS_ADD(pwr, ap_sleep_user_conf); 461 DEBUGFS_FWSTATS_ADD(pwr, ap_sleep_counter); 462 463 DEBUGFS_FWSTATS_ADD(rx_filter, beacon_filter); 464 DEBUGFS_FWSTATS_ADD(rx_filter, arp_filter); 465 DEBUGFS_FWSTATS_ADD(rx_filter, mc_filter); 466 DEBUGFS_FWSTATS_ADD(rx_filter, dup_filter); 467 DEBUGFS_FWSTATS_ADD(rx_filter, data_filter); 468 DEBUGFS_FWSTATS_ADD(rx_filter, ibss_filter); 469 DEBUGFS_FWSTATS_ADD(rx_filter, protection_filter); 470 DEBUGFS_FWSTATS_ADD(rx_filter, accum_arp_pend_requests); 471 DEBUGFS_FWSTATS_ADD(rx_filter, max_arp_queue_dep); 472 473 DEBUGFS_FWSTATS_ADD(rx_rate, rx_frames_per_rates); 474 475 DEBUGFS_FWSTATS_ADD(aggr_size, tx_agg_rate); 476 DEBUGFS_FWSTATS_ADD(aggr_size, tx_agg_len); 477 DEBUGFS_FWSTATS_ADD(aggr_size, rx_size); 478 479 DEBUGFS_FWSTATS_ADD(pipeline, hs_tx_stat_fifo_int); 480 DEBUGFS_FWSTATS_ADD(pipeline, enc_tx_stat_fifo_int); 481 DEBUGFS_FWSTATS_ADD(pipeline, enc_rx_stat_fifo_int); 482 DEBUGFS_FWSTATS_ADD(pipeline, rx_complete_stat_fifo_int); 483 DEBUGFS_FWSTATS_ADD(pipeline, pre_proc_swi); 484 DEBUGFS_FWSTATS_ADD(pipeline, post_proc_swi); 485 DEBUGFS_FWSTATS_ADD(pipeline, sec_frag_swi); 486 DEBUGFS_FWSTATS_ADD(pipeline, pre_to_defrag_swi); 487 DEBUGFS_FWSTATS_ADD(pipeline, defrag_to_rx_xfer_swi); 488 DEBUGFS_FWSTATS_ADD(pipeline, dec_packet_in); 489 DEBUGFS_FWSTATS_ADD(pipeline, dec_packet_in_fifo_full); 490 DEBUGFS_FWSTATS_ADD(pipeline, dec_packet_out); 491 DEBUGFS_FWSTATS_ADD(pipeline, pipeline_fifo_full); 492 493 DEBUGFS_FWSTATS_ADD(diversity, num_of_packets_per_ant); 494 DEBUGFS_FWSTATS_ADD(diversity, total_num_of_toggles); 495 496 DEBUGFS_FWSTATS_ADD(thermal, irq_thr_low); 497 DEBUGFS_FWSTATS_ADD(thermal, irq_thr_high); 498 DEBUGFS_FWSTATS_ADD(thermal, tx_stop); 499 DEBUGFS_FWSTATS_ADD(thermal, tx_resume); 500 DEBUGFS_FWSTATS_ADD(thermal, false_irq); 501 DEBUGFS_FWSTATS_ADD(thermal, adc_source_unexpected); 502 503 DEBUGFS_FWSTATS_ADD(calib, fail_count); 504 505 DEBUGFS_FWSTATS_ADD(calib, calib_count); 506 507 DEBUGFS_FWSTATS_ADD(roaming, rssi_level); 508 509 DEBUGFS_FWSTATS_ADD(dfs, num_of_radar_detections); 510 511 DEBUGFS_ADD(conf, moddir); 512 DEBUGFS_ADD(radar_detection, moddir); 513 DEBUGFS_ADD(dynamic_fw_traces, moddir); 514 515 return 0; 516 517err: 518 if (IS_ERR(entry)) 519 ret = PTR_ERR(entry); 520 else 521 ret = -ENOMEM; 522 523 return ret; 524} 525