12b27bdccSThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only
28c0ea102SLuciano Coelho /*
38c0ea102SLuciano Coelho  * This file is part of wl18xx
48c0ea102SLuciano Coelho  *
58c0ea102SLuciano Coelho  * Copyright (C) 2009 Nokia Corporation
68c0ea102SLuciano Coelho  * Copyright (C) 2011-2012 Texas Instruments
78c0ea102SLuciano Coelho  */
88c0ea102SLuciano Coelho 
9fa2648a3STony Lindgren #include <linux/pm_runtime.h>
10fa2648a3STony Lindgren 
118c0ea102SLuciano Coelho #include "../wlcore/debugfs.h"
128c0ea102SLuciano Coelho #include "../wlcore/wlcore.h"
13e7d32324SEliad Peller #include "../wlcore/debug.h"
14e7d32324SEliad Peller #include "../wlcore/ps.h"
158c0ea102SLuciano Coelho 
168c0ea102SLuciano Coelho #include "wl18xx.h"
178c0ea102SLuciano Coelho #include "acx.h"
18e7d32324SEliad Peller #include "cmd.h"
198c0ea102SLuciano Coelho #include "debugfs.h"
208c0ea102SLuciano Coelho 
218c0ea102SLuciano Coelho #define WL18XX_DEBUGFS_FWSTATS_FILE(a, b, c) \
228c0ea102SLuciano Coelho 	DEBUGFS_FWSTATS_FILE(a, b, c, wl18xx_acx_statistics)
238c0ea102SLuciano Coelho #define WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(a, b, c) \
248c0ea102SLuciano Coelho 	DEBUGFS_FWSTATS_FILE_ARRAY(a, b, c, wl18xx_acx_statistics)
258c0ea102SLuciano Coelho 
26c5d94169SLuciano Coelho 
27c48276cbSEliad Peller WL18XX_DEBUGFS_FWSTATS_FILE(error, error_frame_non_ctrl, "%u");
28c48276cbSEliad Peller WL18XX_DEBUGFS_FWSTATS_FILE(error, error_frame_ctrl, "%u");
29c48276cbSEliad Peller WL18XX_DEBUGFS_FWSTATS_FILE(error, error_frame_during_protection, "%u");
30c48276cbSEliad Peller WL18XX_DEBUGFS_FWSTATS_FILE(error, null_frame_tx_start, "%u");
31c48276cbSEliad Peller WL18XX_DEBUGFS_FWSTATS_FILE(error, null_frame_cts_start, "%u");
32c48276cbSEliad Peller WL18XX_DEBUGFS_FWSTATS_FILE(error, bar_retry, "%u");
33c48276cbSEliad Peller WL18XX_DEBUGFS_FWSTATS_FILE(error, num_frame_cts_nul_flid, "%u");
34c48276cbSEliad Peller WL18XX_DEBUGFS_FWSTATS_FILE(error, tx_abort_failure, "%u");
35c48276cbSEliad Peller WL18XX_DEBUGFS_FWSTATS_FILE(error, tx_resume_failure, "%u");
36c48276cbSEliad Peller WL18XX_DEBUGFS_FWSTATS_FILE(error, rx_cmplt_db_overflow_cnt, "%u");
37c48276cbSEliad Peller WL18XX_DEBUGFS_FWSTATS_FILE(error, elp_while_rx_exch, "%u");
38c48276cbSEliad Peller WL18XX_DEBUGFS_FWSTATS_FILE(error, elp_while_tx_exch, "%u");
39c48276cbSEliad Peller WL18XX_DEBUGFS_FWSTATS_FILE(error, elp_while_tx, "%u");
40c48276cbSEliad Peller WL18XX_DEBUGFS_FWSTATS_FILE(error, elp_while_nvic_pending, "%u");
41c48276cbSEliad Peller WL18XX_DEBUGFS_FWSTATS_FILE(error, rx_excessive_frame_len, "%u");
42c48276cbSEliad Peller WL18XX_DEBUGFS_FWSTATS_FILE(error, burst_mismatch, "%u");
43c48276cbSEliad Peller WL18XX_DEBUGFS_FWSTATS_FILE(error, tbc_exch_mismatch, "%u");
448c0ea102SLuciano Coelho 
458dd8e53cSIdo Reis WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_prepared_descs, "%u");
468dd8e53cSIdo Reis WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_cmplt, "%u");
478c0ea102SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_template_prepared, "%u");
488c0ea102SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_data_prepared, "%u");
498c0ea102SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_template_programmed, "%u");
508c0ea102SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_data_programmed, "%u");
518c0ea102SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_burst_programmed, "%u");
528c0ea102SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_starts, "%u");
53c48276cbSEliad Peller WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_stop, "%u");
548c0ea102SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_start_templates, "%u");
558c0ea102SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_start_int_templates, "%u");
568c0ea102SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_start_fw_gen, "%u");
578c0ea102SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_start_data, "%u");
588c0ea102SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_start_null_frame, "%u");
598c0ea102SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_exch, "%u");
608c0ea102SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_retry_template, "%u");
618c0ea102SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_retry_data, "%u");
62c48276cbSEliad Peller WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(tx, tx_retry_per_rate,
63c48276cbSEliad Peller 				  NUM_OF_RATES_INDEXES);
648c0ea102SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_exch_pending, "%u");
658c0ea102SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_exch_expiry, "%u");
668c0ea102SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_done_template, "%u");
678c0ea102SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_done_data, "%u");
688c0ea102SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_done_int_template, "%u");
69c48276cbSEliad Peller WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_cfe1, "%u");
70c48276cbSEliad Peller WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_cfe2, "%u");
71c5d94169SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_called, "%u");
72c5d94169SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_mpdu_alloc_failed, "%u");
73c5d94169SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_init_called, "%u");
74c5d94169SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_in_process_called, "%u");
75c5d94169SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_tkip_called, "%u");
76c5d94169SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_key_not_found, "%u");
77c5d94169SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_need_fragmentation, "%u");
78c5d94169SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_bad_mblk_num, "%u");
79c5d94169SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_failed, "%u");
80c5d94169SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_cache_hit, "%u");
81c5d94169SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_cache_miss, "%u");
828c0ea102SLuciano Coelho 
838dd8e53cSIdo Reis WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_beacon_early_term, "%u");
848dd8e53cSIdo Reis WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_out_of_mpdu_nodes, "%u");
858c0ea102SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_hdr_overflow, "%u");
868c0ea102SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_dropped_frame, "%u");
878c0ea102SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_done, "%u");
888c0ea102SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_defrag, "%u");
898c0ea102SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_defrag_end, "%u");
908c0ea102SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_cmplt, "%u");
918c0ea102SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_pre_complt, "%u");
928c0ea102SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_cmplt_task, "%u");
938c0ea102SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_phy_hdr, "%u");
948c0ea102SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_timeout, "%u");
95c48276cbSEliad Peller WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_rts_timeout, "%u");
968dd8e53cSIdo Reis WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_timeout_wa, "%u");
97c5d94169SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(rx, defrag_called, "%u");
98c5d94169SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(rx, defrag_init_called, "%u");
99c5d94169SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(rx, defrag_in_process_called, "%u");
100c5d94169SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(rx, defrag_tkip_called, "%u");
101c5d94169SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(rx, defrag_need_defrag, "%u");
102c5d94169SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(rx, defrag_decrypt_failed, "%u");
103c5d94169SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(rx, decrypt_key_not_found, "%u");
104c5d94169SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(rx, defrag_need_decrypt, "%u");
1058dd8e53cSIdo Reis WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_tkip_replays, "%u");
106c48276cbSEliad Peller WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_xfr, "%u");
1078c0ea102SLuciano Coelho 
1088c0ea102SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(isr, irqs, "%u");
1098c0ea102SLuciano Coelho 
1108c0ea102SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(pwr, missing_bcns_cnt, "%u");
1118c0ea102SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(pwr, rcvd_bcns_cnt, "%u");
1128c0ea102SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(pwr, connection_out_of_sync, "%u");
1138c0ea102SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(pwr, cont_miss_bcns_spread,
1148c0ea102SLuciano Coelho 				  PWR_STAT_MAX_CONT_MISSED_BCNS_SPREAD);
1158c0ea102SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(pwr, rcvd_awake_bcns_cnt, "%u");
116c48276cbSEliad Peller WL18XX_DEBUGFS_FWSTATS_FILE(pwr, sleep_time_count, "%u");
117c48276cbSEliad Peller WL18XX_DEBUGFS_FWSTATS_FILE(pwr, sleep_time_avg, "%u");
118c48276cbSEliad Peller WL18XX_DEBUGFS_FWSTATS_FILE(pwr, sleep_cycle_avg, "%u");
119c48276cbSEliad Peller WL18XX_DEBUGFS_FWSTATS_FILE(pwr, sleep_percent, "%u");
120c48276cbSEliad Peller WL18XX_DEBUGFS_FWSTATS_FILE(pwr, ap_sleep_active_conf, "%u");
121c48276cbSEliad Peller WL18XX_DEBUGFS_FWSTATS_FILE(pwr, ap_sleep_user_conf, "%u");
122c48276cbSEliad Peller WL18XX_DEBUGFS_FWSTATS_FILE(pwr, ap_sleep_counter, "%u");
1238c0ea102SLuciano Coelho 
1248c0ea102SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, beacon_filter, "%u");
1258c0ea102SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, arp_filter, "%u");
1268c0ea102SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, mc_filter, "%u");
1278c0ea102SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, dup_filter, "%u");
1288c0ea102SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, data_filter, "%u");
1298c0ea102SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, ibss_filter, "%u");
1308c0ea102SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, protection_filter, "%u");
1318dd8e53cSIdo Reis WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, accum_arp_pend_requests, "%u");
1328dd8e53cSIdo Reis WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, max_arp_queue_dep, "%u");
1338c0ea102SLuciano Coelho 
134a3fa71c4SNicolas Iooss WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(rx_rate, rx_frames_per_rates, 50);
135c5d94169SLuciano Coelho 
136c48276cbSEliad Peller WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(aggr_size, tx_agg_rate,
137c48276cbSEliad Peller 				  AGGR_STATS_TX_AGG);
138c48276cbSEliad Peller WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(aggr_size, tx_agg_len,
139c48276cbSEliad Peller 				  AGGR_STATS_TX_AGG);
140c5d94169SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(aggr_size, rx_size,
141c5d94169SLuciano Coelho 				  AGGR_STATS_RX_SIZE_LEN);
142c5d94169SLuciano Coelho 
143c5d94169SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, hs_tx_stat_fifo_int, "%u");
144c5d94169SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, enc_tx_stat_fifo_int, "%u");
145c5d94169SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, enc_rx_stat_fifo_int, "%u");
146c5d94169SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, rx_complete_stat_fifo_int, "%u");
147c5d94169SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, pre_proc_swi, "%u");
148c5d94169SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, post_proc_swi, "%u");
149c5d94169SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, sec_frag_swi, "%u");
150c5d94169SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, pre_to_defrag_swi, "%u");
151fc645df0SGuy Mishol WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, defrag_to_rx_xfer_swi, "%u");
152c5d94169SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, dec_packet_in, "%u");
153c5d94169SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, dec_packet_in_fifo_full, "%u");
154c5d94169SLuciano Coelho WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, dec_packet_out, "%u");
155c5d94169SLuciano Coelho 
1568dd8e53cSIdo Reis WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(pipeline, pipeline_fifo_full,
1578dd8e53cSIdo Reis 				  PIPE_STATS_HW_FIFO);
1588dd8e53cSIdo Reis 
159fc645df0SGuy Mishol WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(diversity, num_of_packets_per_ant,
160fc645df0SGuy Mishol 				  DIVERSITY_STATS_NUM_OF_ANT);
161fc645df0SGuy Mishol WL18XX_DEBUGFS_FWSTATS_FILE(diversity, total_num_of_toggles, "%u");
162fc645df0SGuy Mishol 
163c48276cbSEliad Peller WL18XX_DEBUGFS_FWSTATS_FILE(thermal, irq_thr_low, "%u");
164c48276cbSEliad Peller WL18XX_DEBUGFS_FWSTATS_FILE(thermal, irq_thr_high, "%u");
165c48276cbSEliad Peller WL18XX_DEBUGFS_FWSTATS_FILE(thermal, tx_stop, "%u");
166c48276cbSEliad Peller WL18XX_DEBUGFS_FWSTATS_FILE(thermal, tx_resume, "%u");
167c48276cbSEliad Peller WL18XX_DEBUGFS_FWSTATS_FILE(thermal, false_irq, "%u");
168c48276cbSEliad Peller WL18XX_DEBUGFS_FWSTATS_FILE(thermal, adc_source_unexpected, "%u");
169c48276cbSEliad Peller 
170c48276cbSEliad Peller WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(calib, fail_count,
171c48276cbSEliad Peller 				  WL18XX_NUM_OF_CALIBRATIONS_ERRORS);
172c48276cbSEliad Peller WL18XX_DEBUGFS_FWSTATS_FILE(calib, calib_count, "%u");
173c48276cbSEliad Peller 
174c48276cbSEliad Peller WL18XX_DEBUGFS_FWSTATS_FILE(roaming, rssi_level, "%d");
175c48276cbSEliad Peller 
176c48276cbSEliad Peller WL18XX_DEBUGFS_FWSTATS_FILE(dfs, num_of_radar_detections, "%d");
1778c0ea102SLuciano Coelho 
conf_read(struct file * file,char __user * user_buf,size_t count,loff_t * ppos)17818b70ac9SLuciano Coelho static ssize_t conf_read(struct file *file, char __user *user_buf,
17918b70ac9SLuciano Coelho 			 size_t count, loff_t *ppos)
18018b70ac9SLuciano Coelho {
18118b70ac9SLuciano Coelho 	struct wl1271 *wl = file->private_data;
18218b70ac9SLuciano Coelho 	struct wl18xx_priv *priv = wl->priv;
18318b70ac9SLuciano Coelho 	struct wlcore_conf_header header;
18418b70ac9SLuciano Coelho 	char *buf, *pos;
18518b70ac9SLuciano Coelho 	size_t len;
18618b70ac9SLuciano Coelho 	int ret;
18718b70ac9SLuciano Coelho 
18818b70ac9SLuciano Coelho 	len = WL18XX_CONF_SIZE;
18918b70ac9SLuciano Coelho 	buf = kmalloc(len, GFP_KERNEL);
19018b70ac9SLuciano Coelho 	if (!buf)
19118b70ac9SLuciano Coelho 		return -ENOMEM;
19218b70ac9SLuciano Coelho 
19318b70ac9SLuciano Coelho 	header.magic	= cpu_to_le32(WL18XX_CONF_MAGIC);
19418b70ac9SLuciano Coelho 	header.version	= cpu_to_le32(WL18XX_CONF_VERSION);
19518b70ac9SLuciano Coelho 	header.checksum	= 0;
19618b70ac9SLuciano Coelho 
19718b70ac9SLuciano Coelho 	mutex_lock(&wl->mutex);
19818b70ac9SLuciano Coelho 
19918b70ac9SLuciano Coelho 	pos = buf;
20018b70ac9SLuciano Coelho 	memcpy(pos, &header, sizeof(header));
20118b70ac9SLuciano Coelho 	pos += sizeof(header);
20218b70ac9SLuciano Coelho 	memcpy(pos, &wl->conf, sizeof(wl->conf));
20318b70ac9SLuciano Coelho 	pos += sizeof(wl->conf);
20418b70ac9SLuciano Coelho 	memcpy(pos, &priv->conf, sizeof(priv->conf));
20518b70ac9SLuciano Coelho 
20618b70ac9SLuciano Coelho 	mutex_unlock(&wl->mutex);
20718b70ac9SLuciano Coelho 
20818b70ac9SLuciano Coelho 	ret = simple_read_from_buffer(user_buf, count, ppos, buf, len);
20918b70ac9SLuciano Coelho 
21018b70ac9SLuciano Coelho 	kfree(buf);
21118b70ac9SLuciano Coelho 	return ret;
21218b70ac9SLuciano Coelho }
21318b70ac9SLuciano Coelho 
21418b70ac9SLuciano Coelho static const struct file_operations conf_ops = {
21518b70ac9SLuciano Coelho 	.read = conf_read,
21618b70ac9SLuciano Coelho 	.open = simple_open,
21718b70ac9SLuciano Coelho 	.llseek = default_llseek,
21818b70ac9SLuciano Coelho };
21918b70ac9SLuciano Coelho 
clear_fw_stats_write(struct file * file,const char __user * user_buf,size_t count,loff_t * ppos)220f74ea74bSLuciano Coelho static ssize_t clear_fw_stats_write(struct file *file,
221f74ea74bSLuciano Coelho 			      const char __user *user_buf,
222f74ea74bSLuciano Coelho 			      size_t count, loff_t *ppos)
223f74ea74bSLuciano Coelho {
224f74ea74bSLuciano Coelho 	struct wl1271 *wl = file->private_data;
225f74ea74bSLuciano Coelho 	int ret;
226f74ea74bSLuciano Coelho 
227f74ea74bSLuciano Coelho 	mutex_lock(&wl->mutex);
228f74ea74bSLuciano Coelho 
2294cc53383SIdo Yariv 	if (unlikely(wl->state != WLCORE_STATE_ON))
230f74ea74bSLuciano Coelho 		goto out;
231f74ea74bSLuciano Coelho 
232f74ea74bSLuciano Coelho 	ret = wl18xx_acx_clear_statistics(wl);
233f74ea74bSLuciano Coelho 	if (ret < 0) {
234f74ea74bSLuciano Coelho 		count = ret;
235f74ea74bSLuciano Coelho 		goto out;
236f74ea74bSLuciano Coelho 	}
237f74ea74bSLuciano Coelho out:
238f74ea74bSLuciano Coelho 	mutex_unlock(&wl->mutex);
239f74ea74bSLuciano Coelho 	return count;
240f74ea74bSLuciano Coelho }
241f74ea74bSLuciano Coelho 
242f74ea74bSLuciano Coelho static const struct file_operations clear_fw_stats_ops = {
243f74ea74bSLuciano Coelho 	.write = clear_fw_stats_write,
244f74ea74bSLuciano Coelho 	.open = simple_open,
245f74ea74bSLuciano Coelho 	.llseek = default_llseek,
246f74ea74bSLuciano Coelho };
247f74ea74bSLuciano Coelho 
radar_detection_write(struct file * file,const char __user * user_buf,size_t count,loff_t * ppos)248e7d32324SEliad Peller static ssize_t radar_detection_write(struct file *file,
249e7d32324SEliad Peller 				     const char __user *user_buf,
250e7d32324SEliad Peller 				     size_t count, loff_t *ppos)
251e7d32324SEliad Peller {
252e7d32324SEliad Peller 	struct wl1271 *wl = file->private_data;
253e7d32324SEliad Peller 	int ret;
254e7d32324SEliad Peller 	u8 channel;
255e7d32324SEliad Peller 
256e7d32324SEliad Peller 	ret = kstrtou8_from_user(user_buf, count, 10, &channel);
257e7d32324SEliad Peller 	if (ret < 0) {
258e7d32324SEliad Peller 		wl1271_warning("illegal channel");
259e7d32324SEliad Peller 		return -EINVAL;
260e7d32324SEliad Peller 	}
261e7d32324SEliad Peller 
262e7d32324SEliad Peller 	mutex_lock(&wl->mutex);
263e7d32324SEliad Peller 
264e7d32324SEliad Peller 	if (unlikely(wl->state != WLCORE_STATE_ON))
265e7d32324SEliad Peller 		goto out;
266e7d32324SEliad Peller 
267*8e95061bSMinghao Chi 	ret = pm_runtime_resume_and_get(wl->dev);
268*8e95061bSMinghao Chi 	if (ret < 0)
269e7d32324SEliad Peller 		goto out;
270e7d32324SEliad Peller 
271e7d32324SEliad Peller 	ret = wl18xx_cmd_radar_detection_debug(wl, channel);
272e7d32324SEliad Peller 	if (ret < 0)
273e7d32324SEliad Peller 		count = ret;
274e7d32324SEliad Peller 
2759b71578dSTony Lindgren 	pm_runtime_mark_last_busy(wl->dev);
2769b71578dSTony Lindgren 	pm_runtime_put_autosuspend(wl->dev);
277e7d32324SEliad Peller out:
278e7d32324SEliad Peller 	mutex_unlock(&wl->mutex);
279e7d32324SEliad Peller 	return count;
280e7d32324SEliad Peller }
281e7d32324SEliad Peller 
282e7d32324SEliad Peller static const struct file_operations radar_detection_ops = {
283e7d32324SEliad Peller 	.write = radar_detection_write,
284e7d32324SEliad Peller 	.open = simple_open,
285e7d32324SEliad Peller 	.llseek = default_llseek,
286e7d32324SEliad Peller };
287e7d32324SEliad Peller 
dynamic_fw_traces_write(struct file * file,const char __user * user_buf,size_t count,loff_t * ppos)288d1c54096SGuy Mishol static ssize_t dynamic_fw_traces_write(struct file *file,
289d1c54096SGuy Mishol 					const char __user *user_buf,
290d1c54096SGuy Mishol 					size_t count, loff_t *ppos)
291d1c54096SGuy Mishol {
292d1c54096SGuy Mishol 	struct wl1271 *wl = file->private_data;
293d1c54096SGuy Mishol 	unsigned long value;
294d1c54096SGuy Mishol 	int ret;
295d1c54096SGuy Mishol 
296d1c54096SGuy Mishol 	ret = kstrtoul_from_user(user_buf, count, 0, &value);
297d1c54096SGuy Mishol 	if (ret < 0)
298d1c54096SGuy Mishol 		return ret;
299d1c54096SGuy Mishol 
300d1c54096SGuy Mishol 	mutex_lock(&wl->mutex);
301d1c54096SGuy Mishol 
302d1c54096SGuy Mishol 	wl->dynamic_fw_traces = value;
303d1c54096SGuy Mishol 
304d1c54096SGuy Mishol 	if (unlikely(wl->state != WLCORE_STATE_ON))
305d1c54096SGuy Mishol 		goto out;
306d1c54096SGuy Mishol 
307*8e95061bSMinghao Chi 	ret = pm_runtime_resume_and_get(wl->dev);
308*8e95061bSMinghao Chi 	if (ret < 0)
309d1c54096SGuy Mishol 		goto out;
310d1c54096SGuy Mishol 
311d1c54096SGuy Mishol 	ret = wl18xx_acx_dynamic_fw_traces(wl);
312d1c54096SGuy Mishol 	if (ret < 0)
313d1c54096SGuy Mishol 		count = ret;
314d1c54096SGuy Mishol 
3159b71578dSTony Lindgren 	pm_runtime_mark_last_busy(wl->dev);
3169b71578dSTony Lindgren 	pm_runtime_put_autosuspend(wl->dev);
317d1c54096SGuy Mishol out:
318d1c54096SGuy Mishol 	mutex_unlock(&wl->mutex);
319d1c54096SGuy Mishol 	return count;
320d1c54096SGuy Mishol }
321d1c54096SGuy Mishol 
dynamic_fw_traces_read(struct file * file,char __user * userbuf,size_t count,loff_t * ppos)322d1c54096SGuy Mishol static ssize_t dynamic_fw_traces_read(struct file *file,
323d1c54096SGuy Mishol 					char __user *userbuf,
324d1c54096SGuy Mishol 					size_t count, loff_t *ppos)
325d1c54096SGuy Mishol {
326d1c54096SGuy Mishol 	struct wl1271 *wl = file->private_data;
327d1c54096SGuy Mishol 	return wl1271_format_buffer(userbuf, count, ppos,
328d1c54096SGuy Mishol 				    "%d\n", wl->dynamic_fw_traces);
329d1c54096SGuy Mishol }
330d1c54096SGuy Mishol 
331d1c54096SGuy Mishol static const struct file_operations dynamic_fw_traces_ops = {
332d1c54096SGuy Mishol 	.read = dynamic_fw_traces_read,
333d1c54096SGuy Mishol 	.write = dynamic_fw_traces_write,
334d1c54096SGuy Mishol 	.open = simple_open,
335d1c54096SGuy Mishol 	.llseek = default_llseek,
336d1c54096SGuy Mishol };
337d1c54096SGuy Mishol 
3388cf77e17SEliad Peller #ifdef CONFIG_CFG80211_CERTIFICATION_ONUS
radar_debug_mode_write(struct file * file,const char __user * user_buf,size_t count,loff_t * ppos)3398cf77e17SEliad Peller static ssize_t radar_debug_mode_write(struct file *file,
3408cf77e17SEliad Peller 				      const char __user *user_buf,
3418cf77e17SEliad Peller 				      size_t count, loff_t *ppos)
3428cf77e17SEliad Peller {
3438cf77e17SEliad Peller 	struct wl1271 *wl = file->private_data;
3448cf77e17SEliad Peller 	struct wl12xx_vif *wlvif;
3458cf77e17SEliad Peller 	unsigned long value;
3468cf77e17SEliad Peller 	int ret;
3478cf77e17SEliad Peller 
3488cf77e17SEliad Peller 	ret = kstrtoul_from_user(user_buf, count, 10, &value);
3498cf77e17SEliad Peller 	if (ret < 0) {
3508cf77e17SEliad Peller 		wl1271_warning("illegal radar_debug_mode value!");
3518cf77e17SEliad Peller 		return -EINVAL;
3528cf77e17SEliad Peller 	}
3538cf77e17SEliad Peller 
3548cf77e17SEliad Peller 	/* valid values: 0/1 */
3558cf77e17SEliad Peller 	if (!(value == 0 || value == 1)) {
3568cf77e17SEliad Peller 		wl1271_warning("value is not in valid!");
3578cf77e17SEliad Peller 		return -EINVAL;
3588cf77e17SEliad Peller 	}
3598cf77e17SEliad Peller 
3608cf77e17SEliad Peller 	mutex_lock(&wl->mutex);
3618cf77e17SEliad Peller 
3628cf77e17SEliad Peller 	wl->radar_debug_mode = value;
3638cf77e17SEliad Peller 
3648cf77e17SEliad Peller 	if (unlikely(wl->state != WLCORE_STATE_ON))
3658cf77e17SEliad Peller 		goto out;
3668cf77e17SEliad Peller 
367*8e95061bSMinghao Chi 	ret = pm_runtime_resume_and_get(wl->dev);
368*8e95061bSMinghao Chi 	if (ret < 0)
3698cf77e17SEliad Peller 		goto out;
3708cf77e17SEliad Peller 
3718cf77e17SEliad Peller 	wl12xx_for_each_wlvif_ap(wl, wlvif) {
3728cf77e17SEliad Peller 		wlcore_cmd_generic_cfg(wl, wlvif,
3738cf77e17SEliad Peller 				       WLCORE_CFG_FEATURE_RADAR_DEBUG,
3748cf77e17SEliad Peller 				       wl->radar_debug_mode, 0);
3758cf77e17SEliad Peller 	}
3768cf77e17SEliad Peller 
3779b71578dSTony Lindgren 	pm_runtime_mark_last_busy(wl->dev);
3789b71578dSTony Lindgren 	pm_runtime_put_autosuspend(wl->dev);
3798cf77e17SEliad Peller out:
3808cf77e17SEliad Peller 	mutex_unlock(&wl->mutex);
3818cf77e17SEliad Peller 	return count;
3828cf77e17SEliad Peller }
3838cf77e17SEliad Peller 
radar_debug_mode_read(struct file * file,char __user * userbuf,size_t count,loff_t * ppos)3848cf77e17SEliad Peller static ssize_t radar_debug_mode_read(struct file *file,
3858cf77e17SEliad Peller 				     char __user *userbuf,
3868cf77e17SEliad Peller 				     size_t count, loff_t *ppos)
3878cf77e17SEliad Peller {
3888cf77e17SEliad Peller 	struct wl1271 *wl = file->private_data;
3898cf77e17SEliad Peller 
3908cf77e17SEliad Peller 	return wl1271_format_buffer(userbuf, count, ppos,
3918cf77e17SEliad Peller 				    "%d\n", wl->radar_debug_mode);
3928cf77e17SEliad Peller }
3938cf77e17SEliad Peller 
3948cf77e17SEliad Peller static const struct file_operations radar_debug_mode_ops = {
3958cf77e17SEliad Peller 	.write = radar_debug_mode_write,
3968cf77e17SEliad Peller 	.read = radar_debug_mode_read,
3978cf77e17SEliad Peller 	.open = simple_open,
3988cf77e17SEliad Peller 	.llseek = default_llseek,
3998cf77e17SEliad Peller };
4008cf77e17SEliad Peller #endif /* CFG80211_CERTIFICATION_ONUS */
4018cf77e17SEliad Peller 
wl18xx_debugfs_add_files(struct wl1271 * wl,struct dentry * rootdir)4028c0ea102SLuciano Coelho int wl18xx_debugfs_add_files(struct wl1271 *wl,
4038c0ea102SLuciano Coelho 			     struct dentry *rootdir)
4048c0ea102SLuciano Coelho {
405c922a3a0SGreg Kroah-Hartman 	struct dentry *stats, *moddir;
4068c0ea102SLuciano Coelho 
407ad62d81aSLuciano Coelho 	moddir = debugfs_create_dir(KBUILD_MODNAME, rootdir);
408ad62d81aSLuciano Coelho 	stats = debugfs_create_dir("fw_stats", moddir);
4098c0ea102SLuciano Coelho 
410f74ea74bSLuciano Coelho 	DEBUGFS_ADD(clear_fw_stats, stats);
411f74ea74bSLuciano Coelho 
412c48276cbSEliad Peller 	DEBUGFS_FWSTATS_ADD(error, error_frame_non_ctrl);
413c48276cbSEliad Peller 	DEBUGFS_FWSTATS_ADD(error, error_frame_ctrl);
414c48276cbSEliad Peller 	DEBUGFS_FWSTATS_ADD(error, error_frame_during_protection);
415c48276cbSEliad Peller 	DEBUGFS_FWSTATS_ADD(error, null_frame_tx_start);
416c48276cbSEliad Peller 	DEBUGFS_FWSTATS_ADD(error, null_frame_cts_start);
417c48276cbSEliad Peller 	DEBUGFS_FWSTATS_ADD(error, bar_retry);
418c48276cbSEliad Peller 	DEBUGFS_FWSTATS_ADD(error, num_frame_cts_nul_flid);
419c48276cbSEliad Peller 	DEBUGFS_FWSTATS_ADD(error, tx_abort_failure);
420c48276cbSEliad Peller 	DEBUGFS_FWSTATS_ADD(error, tx_resume_failure);
421c48276cbSEliad Peller 	DEBUGFS_FWSTATS_ADD(error, rx_cmplt_db_overflow_cnt);
422c48276cbSEliad Peller 	DEBUGFS_FWSTATS_ADD(error, elp_while_rx_exch);
423c48276cbSEliad Peller 	DEBUGFS_FWSTATS_ADD(error, elp_while_tx_exch);
424c48276cbSEliad Peller 	DEBUGFS_FWSTATS_ADD(error, elp_while_tx);
425c48276cbSEliad Peller 	DEBUGFS_FWSTATS_ADD(error, elp_while_nvic_pending);
426c48276cbSEliad Peller 	DEBUGFS_FWSTATS_ADD(error, rx_excessive_frame_len);
427c48276cbSEliad Peller 	DEBUGFS_FWSTATS_ADD(error, burst_mismatch);
428c48276cbSEliad Peller 	DEBUGFS_FWSTATS_ADD(error, tbc_exch_mismatch);
4298c0ea102SLuciano Coelho 
4308dd8e53cSIdo Reis 	DEBUGFS_FWSTATS_ADD(tx, tx_prepared_descs);
4318dd8e53cSIdo Reis 	DEBUGFS_FWSTATS_ADD(tx, tx_cmplt);
4328c0ea102SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(tx, tx_template_prepared);
4338c0ea102SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(tx, tx_data_prepared);
4348c0ea102SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(tx, tx_template_programmed);
4358c0ea102SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(tx, tx_data_programmed);
4368c0ea102SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(tx, tx_burst_programmed);
4378c0ea102SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(tx, tx_starts);
438c48276cbSEliad Peller 	DEBUGFS_FWSTATS_ADD(tx, tx_stop);
4398c0ea102SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(tx, tx_start_templates);
4408c0ea102SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(tx, tx_start_int_templates);
4418c0ea102SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(tx, tx_start_fw_gen);
4428c0ea102SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(tx, tx_start_data);
4438c0ea102SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(tx, tx_start_null_frame);
4448c0ea102SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(tx, tx_exch);
4458c0ea102SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(tx, tx_retry_template);
4468c0ea102SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(tx, tx_retry_data);
447c48276cbSEliad Peller 	DEBUGFS_FWSTATS_ADD(tx, tx_retry_per_rate);
4488c0ea102SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(tx, tx_exch_pending);
4498c0ea102SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(tx, tx_exch_expiry);
4508c0ea102SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(tx, tx_done_template);
4518c0ea102SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(tx, tx_done_data);
4528c0ea102SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(tx, tx_done_int_template);
453c48276cbSEliad Peller 	DEBUGFS_FWSTATS_ADD(tx, tx_cfe1);
454c48276cbSEliad Peller 	DEBUGFS_FWSTATS_ADD(tx, tx_cfe2);
455c5d94169SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(tx, frag_called);
456c5d94169SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(tx, frag_mpdu_alloc_failed);
457c5d94169SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(tx, frag_init_called);
458c5d94169SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(tx, frag_in_process_called);
459c5d94169SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(tx, frag_tkip_called);
460c5d94169SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(tx, frag_key_not_found);
461c5d94169SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(tx, frag_need_fragmentation);
462c5d94169SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(tx, frag_bad_mblk_num);
463c5d94169SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(tx, frag_failed);
464c5d94169SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(tx, frag_cache_hit);
465c5d94169SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(tx, frag_cache_miss);
4668c0ea102SLuciano Coelho 
4678dd8e53cSIdo Reis 	DEBUGFS_FWSTATS_ADD(rx, rx_beacon_early_term);
4688dd8e53cSIdo Reis 	DEBUGFS_FWSTATS_ADD(rx, rx_out_of_mpdu_nodes);
4698c0ea102SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(rx, rx_hdr_overflow);
4708c0ea102SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(rx, rx_dropped_frame);
4718c0ea102SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(rx, rx_done);
4728c0ea102SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(rx, rx_defrag);
4738c0ea102SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(rx, rx_defrag_end);
4748c0ea102SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(rx, rx_cmplt);
4758c0ea102SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(rx, rx_pre_complt);
4768c0ea102SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(rx, rx_cmplt_task);
4778c0ea102SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(rx, rx_phy_hdr);
4788c0ea102SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(rx, rx_timeout);
479c48276cbSEliad Peller 	DEBUGFS_FWSTATS_ADD(rx, rx_rts_timeout);
4808dd8e53cSIdo Reis 	DEBUGFS_FWSTATS_ADD(rx, rx_timeout_wa);
481c5d94169SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(rx, defrag_called);
482c5d94169SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(rx, defrag_init_called);
483c5d94169SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(rx, defrag_in_process_called);
484c5d94169SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(rx, defrag_tkip_called);
485c5d94169SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(rx, defrag_need_defrag);
486c5d94169SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(rx, defrag_decrypt_failed);
487c5d94169SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(rx, decrypt_key_not_found);
488c5d94169SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(rx, defrag_need_decrypt);
4898dd8e53cSIdo Reis 	DEBUGFS_FWSTATS_ADD(rx, rx_tkip_replays);
490c48276cbSEliad Peller 	DEBUGFS_FWSTATS_ADD(rx, rx_xfr);
4918c0ea102SLuciano Coelho 
4928c0ea102SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(isr, irqs);
4938c0ea102SLuciano Coelho 
4948c0ea102SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(pwr, missing_bcns_cnt);
4958c0ea102SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(pwr, rcvd_bcns_cnt);
4968c0ea102SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(pwr, connection_out_of_sync);
4978c0ea102SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(pwr, cont_miss_bcns_spread);
4988c0ea102SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(pwr, rcvd_awake_bcns_cnt);
499c48276cbSEliad Peller 	DEBUGFS_FWSTATS_ADD(pwr, sleep_time_count);
500c48276cbSEliad Peller 	DEBUGFS_FWSTATS_ADD(pwr, sleep_time_avg);
501c48276cbSEliad Peller 	DEBUGFS_FWSTATS_ADD(pwr, sleep_cycle_avg);
502c48276cbSEliad Peller 	DEBUGFS_FWSTATS_ADD(pwr, sleep_percent);
503c48276cbSEliad Peller 	DEBUGFS_FWSTATS_ADD(pwr, ap_sleep_active_conf);
504c48276cbSEliad Peller 	DEBUGFS_FWSTATS_ADD(pwr, ap_sleep_user_conf);
505c48276cbSEliad Peller 	DEBUGFS_FWSTATS_ADD(pwr, ap_sleep_counter);
5068c0ea102SLuciano Coelho 
5078c0ea102SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(rx_filter, beacon_filter);
5088c0ea102SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(rx_filter, arp_filter);
5098c0ea102SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(rx_filter, mc_filter);
5108c0ea102SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(rx_filter, dup_filter);
5118c0ea102SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(rx_filter, data_filter);
5128c0ea102SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(rx_filter, ibss_filter);
5138c0ea102SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(rx_filter, protection_filter);
5148dd8e53cSIdo Reis 	DEBUGFS_FWSTATS_ADD(rx_filter, accum_arp_pend_requests);
5158dd8e53cSIdo Reis 	DEBUGFS_FWSTATS_ADD(rx_filter, max_arp_queue_dep);
5168c0ea102SLuciano Coelho 
517c5d94169SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(rx_rate, rx_frames_per_rates);
518c5d94169SLuciano Coelho 
519c48276cbSEliad Peller 	DEBUGFS_FWSTATS_ADD(aggr_size, tx_agg_rate);
520c48276cbSEliad Peller 	DEBUGFS_FWSTATS_ADD(aggr_size, tx_agg_len);
521c5d94169SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(aggr_size, rx_size);
522c5d94169SLuciano Coelho 
523c5d94169SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(pipeline, hs_tx_stat_fifo_int);
524c5d94169SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(pipeline, enc_tx_stat_fifo_int);
525c5d94169SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(pipeline, enc_rx_stat_fifo_int);
526c5d94169SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(pipeline, rx_complete_stat_fifo_int);
527c5d94169SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(pipeline, pre_proc_swi);
528c5d94169SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(pipeline, post_proc_swi);
529c5d94169SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(pipeline, sec_frag_swi);
530c5d94169SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(pipeline, pre_to_defrag_swi);
531fc645df0SGuy Mishol 	DEBUGFS_FWSTATS_ADD(pipeline, defrag_to_rx_xfer_swi);
532c5d94169SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(pipeline, dec_packet_in);
533c5d94169SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(pipeline, dec_packet_in_fifo_full);
534c5d94169SLuciano Coelho 	DEBUGFS_FWSTATS_ADD(pipeline, dec_packet_out);
5358dd8e53cSIdo Reis 	DEBUGFS_FWSTATS_ADD(pipeline, pipeline_fifo_full);
536c5d94169SLuciano Coelho 
537fc645df0SGuy Mishol 	DEBUGFS_FWSTATS_ADD(diversity, num_of_packets_per_ant);
538fc645df0SGuy Mishol 	DEBUGFS_FWSTATS_ADD(diversity, total_num_of_toggles);
539fc645df0SGuy Mishol 
540c48276cbSEliad Peller 	DEBUGFS_FWSTATS_ADD(thermal, irq_thr_low);
541c48276cbSEliad Peller 	DEBUGFS_FWSTATS_ADD(thermal, irq_thr_high);
542c48276cbSEliad Peller 	DEBUGFS_FWSTATS_ADD(thermal, tx_stop);
543c48276cbSEliad Peller 	DEBUGFS_FWSTATS_ADD(thermal, tx_resume);
544c48276cbSEliad Peller 	DEBUGFS_FWSTATS_ADD(thermal, false_irq);
545c48276cbSEliad Peller 	DEBUGFS_FWSTATS_ADD(thermal, adc_source_unexpected);
546c48276cbSEliad Peller 
547c48276cbSEliad Peller 	DEBUGFS_FWSTATS_ADD(calib, fail_count);
548c48276cbSEliad Peller 
549c48276cbSEliad Peller 	DEBUGFS_FWSTATS_ADD(calib, calib_count);
550c48276cbSEliad Peller 
551c48276cbSEliad Peller 	DEBUGFS_FWSTATS_ADD(roaming, rssi_level);
552c48276cbSEliad Peller 
553c48276cbSEliad Peller 	DEBUGFS_FWSTATS_ADD(dfs, num_of_radar_detections);
5548c0ea102SLuciano Coelho 
55518b70ac9SLuciano Coelho 	DEBUGFS_ADD(conf, moddir);
556e7d32324SEliad Peller 	DEBUGFS_ADD(radar_detection, moddir);
5578cf77e17SEliad Peller #ifdef CONFIG_CFG80211_CERTIFICATION_ONUS
5588cf77e17SEliad Peller 	DEBUGFS_ADD(radar_debug_mode, moddir);
5598cf77e17SEliad Peller #endif
560d1c54096SGuy Mishol 	DEBUGFS_ADD(dynamic_fw_traces, moddir);
56118b70ac9SLuciano Coelho 
5628c0ea102SLuciano Coelho 	return 0;
5638c0ea102SLuciano Coelho }
564