xref: /linux/drivers/net/wireless/ti/wl18xx/debugfs.c (revision 2ba9268dd603d23e17643437b2246acb6844953b)
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(debug, debug1, "%u");
40 WL18XX_DEBUGFS_FWSTATS_FILE(debug, debug2, "%u");
41 WL18XX_DEBUGFS_FWSTATS_FILE(debug, debug3, "%u");
42 WL18XX_DEBUGFS_FWSTATS_FILE(debug, debug4, "%u");
43 WL18XX_DEBUGFS_FWSTATS_FILE(debug, debug5, "%u");
44 WL18XX_DEBUGFS_FWSTATS_FILE(debug, debug6, "%u");
45 
46 WL18XX_DEBUGFS_FWSTATS_FILE(error, error_frame, "%u");
47 WL18XX_DEBUGFS_FWSTATS_FILE(error, error_null_Frame_tx_start, "%u");
48 WL18XX_DEBUGFS_FWSTATS_FILE(error, error_numll_frame_cts_start, "%u");
49 WL18XX_DEBUGFS_FWSTATS_FILE(error, error_bar_retry, "%u");
50 WL18XX_DEBUGFS_FWSTATS_FILE(error, error_frame_cts_nul_flid, "%u");
51 
52 WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_prepared_descs, "%u");
53 WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_cmplt, "%u");
54 WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_template_prepared, "%u");
55 WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_data_prepared, "%u");
56 WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_template_programmed, "%u");
57 WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_data_programmed, "%u");
58 WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_burst_programmed, "%u");
59 WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_starts, "%u");
60 WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_imm_resp, "%u");
61 WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_start_templates, "%u");
62 WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_start_int_templates, "%u");
63 WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_start_fw_gen, "%u");
64 WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_start_data, "%u");
65 WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_start_null_frame, "%u");
66 WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_exch, "%u");
67 WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_retry_template, "%u");
68 WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_retry_data, "%u");
69 WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_exch_pending, "%u");
70 WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_exch_expiry, "%u");
71 WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_done_template, "%u");
72 WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_done_data, "%u");
73 WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_done_int_template, "%u");
74 WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_frame_checksum, "%u");
75 WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_checksum_result, "%u");
76 WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_called, "%u");
77 WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_mpdu_alloc_failed, "%u");
78 WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_init_called, "%u");
79 WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_in_process_called, "%u");
80 WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_tkip_called, "%u");
81 WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_key_not_found, "%u");
82 WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_need_fragmentation, "%u");
83 WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_bad_mblk_num, "%u");
84 WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_failed, "%u");
85 WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_cache_hit, "%u");
86 WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_cache_miss, "%u");
87 
88 WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_beacon_early_term, "%u");
89 WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_out_of_mpdu_nodes, "%u");
90 WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_hdr_overflow, "%u");
91 WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_dropped_frame, "%u");
92 WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_done, "%u");
93 WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_defrag, "%u");
94 WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_defrag_end, "%u");
95 WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_cmplt, "%u");
96 WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_pre_complt, "%u");
97 WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_cmplt_task, "%u");
98 WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_phy_hdr, "%u");
99 WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_timeout, "%u");
100 WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_timeout_wa, "%u");
101 WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_wa_density_dropped_frame, "%u");
102 WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_wa_ba_not_expected, "%u");
103 WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_frame_checksum, "%u");
104 WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_checksum_result, "%u");
105 WL18XX_DEBUGFS_FWSTATS_FILE(rx, defrag_called, "%u");
106 WL18XX_DEBUGFS_FWSTATS_FILE(rx, defrag_init_called, "%u");
107 WL18XX_DEBUGFS_FWSTATS_FILE(rx, defrag_in_process_called, "%u");
108 WL18XX_DEBUGFS_FWSTATS_FILE(rx, defrag_tkip_called, "%u");
109 WL18XX_DEBUGFS_FWSTATS_FILE(rx, defrag_need_defrag, "%u");
110 WL18XX_DEBUGFS_FWSTATS_FILE(rx, defrag_decrypt_failed, "%u");
111 WL18XX_DEBUGFS_FWSTATS_FILE(rx, decrypt_key_not_found, "%u");
112 WL18XX_DEBUGFS_FWSTATS_FILE(rx, defrag_need_decrypt, "%u");
113 WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_tkip_replays, "%u");
114 
115 WL18XX_DEBUGFS_FWSTATS_FILE(isr, irqs, "%u");
116 
117 WL18XX_DEBUGFS_FWSTATS_FILE(pwr, missing_bcns_cnt, "%u");
118 WL18XX_DEBUGFS_FWSTATS_FILE(pwr, rcvd_bcns_cnt, "%u");
119 WL18XX_DEBUGFS_FWSTATS_FILE(pwr, connection_out_of_sync, "%u");
120 WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(pwr, cont_miss_bcns_spread,
121 				  PWR_STAT_MAX_CONT_MISSED_BCNS_SPREAD);
122 WL18XX_DEBUGFS_FWSTATS_FILE(pwr, rcvd_awake_bcns_cnt, "%u");
123 
124 
125 WL18XX_DEBUGFS_FWSTATS_FILE(ps_poll, ps_poll_timeouts, "%u");
126 WL18XX_DEBUGFS_FWSTATS_FILE(ps_poll, upsd_timeouts, "%u");
127 WL18XX_DEBUGFS_FWSTATS_FILE(ps_poll, upsd_max_ap_turn, "%u");
128 WL18XX_DEBUGFS_FWSTATS_FILE(ps_poll, ps_poll_max_ap_turn, "%u");
129 WL18XX_DEBUGFS_FWSTATS_FILE(ps_poll, ps_poll_utilization, "%u");
130 WL18XX_DEBUGFS_FWSTATS_FILE(ps_poll, upsd_utilization, "%u");
131 
132 WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, beacon_filter, "%u");
133 WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, arp_filter, "%u");
134 WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, mc_filter, "%u");
135 WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, dup_filter, "%u");
136 WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, data_filter, "%u");
137 WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, ibss_filter, "%u");
138 WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, protection_filter, "%u");
139 WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, accum_arp_pend_requests, "%u");
140 WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, max_arp_queue_dep, "%u");
141 
142 WL18XX_DEBUGFS_FWSTATS_FILE(rx_rate, rx_frames_per_rates, "%u");
143 
144 WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(aggr_size, tx_agg_vs_rate,
145 				  AGGR_STATS_TX_AGG*AGGR_STATS_TX_RATE);
146 WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(aggr_size, rx_size,
147 				  AGGR_STATS_RX_SIZE_LEN);
148 
149 WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, hs_tx_stat_fifo_int, "%u");
150 WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, tcp_tx_stat_fifo_int, "%u");
151 WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, tcp_rx_stat_fifo_int, "%u");
152 WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, enc_tx_stat_fifo_int, "%u");
153 WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, enc_rx_stat_fifo_int, "%u");
154 WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, rx_complete_stat_fifo_int, "%u");
155 WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, pre_proc_swi, "%u");
156 WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, post_proc_swi, "%u");
157 WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, sec_frag_swi, "%u");
158 WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, pre_to_defrag_swi, "%u");
159 WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, defrag_to_csum_swi, "%u");
160 WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, csum_to_rx_xfer_swi, "%u");
161 WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, dec_packet_in, "%u");
162 WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, dec_packet_in_fifo_full, "%u");
163 WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, dec_packet_out, "%u");
164 WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, cs_rx_packet_in, "%u");
165 WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, cs_rx_packet_out, "%u");
166 
167 WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(pipeline, pipeline_fifo_full,
168 				  PIPE_STATS_HW_FIFO);
169 
170 WL18XX_DEBUGFS_FWSTATS_FILE(mem, rx_free_mem_blks, "%u");
171 WL18XX_DEBUGFS_FWSTATS_FILE(mem, tx_free_mem_blks, "%u");
172 WL18XX_DEBUGFS_FWSTATS_FILE(mem, fwlog_free_mem_blks, "%u");
173 WL18XX_DEBUGFS_FWSTATS_FILE(mem, fw_gen_free_mem_blks, "%u");
174 
175 static ssize_t conf_read(struct file *file, char __user *user_buf,
176 			 size_t count, loff_t *ppos)
177 {
178 	struct wl1271 *wl = file->private_data;
179 	struct wl18xx_priv *priv = wl->priv;
180 	struct wlcore_conf_header header;
181 	char *buf, *pos;
182 	size_t len;
183 	int ret;
184 
185 	len = WL18XX_CONF_SIZE;
186 	buf = kmalloc(len, GFP_KERNEL);
187 	if (!buf)
188 		return -ENOMEM;
189 
190 	header.magic	= cpu_to_le32(WL18XX_CONF_MAGIC);
191 	header.version	= cpu_to_le32(WL18XX_CONF_VERSION);
192 	header.checksum	= 0;
193 
194 	mutex_lock(&wl->mutex);
195 
196 	pos = buf;
197 	memcpy(pos, &header, sizeof(header));
198 	pos += sizeof(header);
199 	memcpy(pos, &wl->conf, sizeof(wl->conf));
200 	pos += sizeof(wl->conf);
201 	memcpy(pos, &priv->conf, sizeof(priv->conf));
202 
203 	mutex_unlock(&wl->mutex);
204 
205 	ret = simple_read_from_buffer(user_buf, count, ppos, buf, len);
206 
207 	kfree(buf);
208 	return ret;
209 }
210 
211 static const struct file_operations conf_ops = {
212 	.read = conf_read,
213 	.open = simple_open,
214 	.llseek = default_llseek,
215 };
216 
217 static ssize_t clear_fw_stats_write(struct file *file,
218 			      const char __user *user_buf,
219 			      size_t count, loff_t *ppos)
220 {
221 	struct wl1271 *wl = file->private_data;
222 	int ret;
223 
224 	mutex_lock(&wl->mutex);
225 
226 	if (unlikely(wl->state != WLCORE_STATE_ON))
227 		goto out;
228 
229 	ret = wl18xx_acx_clear_statistics(wl);
230 	if (ret < 0) {
231 		count = ret;
232 		goto out;
233 	}
234 out:
235 	mutex_unlock(&wl->mutex);
236 	return count;
237 }
238 
239 static const struct file_operations clear_fw_stats_ops = {
240 	.write = clear_fw_stats_write,
241 	.open = simple_open,
242 	.llseek = default_llseek,
243 };
244 
245 static ssize_t radar_detection_write(struct file *file,
246 				     const char __user *user_buf,
247 				     size_t count, loff_t *ppos)
248 {
249 	struct wl1271 *wl = file->private_data;
250 	int ret;
251 	u8 channel;
252 
253 	ret = kstrtou8_from_user(user_buf, count, 10, &channel);
254 	if (ret < 0) {
255 		wl1271_warning("illegal channel");
256 		return -EINVAL;
257 	}
258 
259 	mutex_lock(&wl->mutex);
260 
261 	if (unlikely(wl->state != WLCORE_STATE_ON))
262 		goto out;
263 
264 	ret = wl1271_ps_elp_wakeup(wl);
265 	if (ret < 0)
266 		goto out;
267 
268 	ret = wl18xx_cmd_radar_detection_debug(wl, channel);
269 	if (ret < 0)
270 		count = ret;
271 
272 	wl1271_ps_elp_sleep(wl);
273 out:
274 	mutex_unlock(&wl->mutex);
275 	return count;
276 }
277 
278 static const struct file_operations radar_detection_ops = {
279 	.write = radar_detection_write,
280 	.open = simple_open,
281 	.llseek = default_llseek,
282 };
283 
284 int wl18xx_debugfs_add_files(struct wl1271 *wl,
285 			     struct dentry *rootdir)
286 {
287 	int ret = 0;
288 	struct dentry *entry, *stats, *moddir;
289 
290 	moddir = debugfs_create_dir(KBUILD_MODNAME, rootdir);
291 	if (!moddir || IS_ERR(moddir)) {
292 		entry = moddir;
293 		goto err;
294 	}
295 
296 	stats = debugfs_create_dir("fw_stats", moddir);
297 	if (!stats || IS_ERR(stats)) {
298 		entry = stats;
299 		goto err;
300 	}
301 
302 	DEBUGFS_ADD(clear_fw_stats, stats);
303 
304 	DEBUGFS_FWSTATS_ADD(debug, debug1);
305 	DEBUGFS_FWSTATS_ADD(debug, debug2);
306 	DEBUGFS_FWSTATS_ADD(debug, debug3);
307 	DEBUGFS_FWSTATS_ADD(debug, debug4);
308 	DEBUGFS_FWSTATS_ADD(debug, debug5);
309 	DEBUGFS_FWSTATS_ADD(debug, debug6);
310 
311 	DEBUGFS_FWSTATS_ADD(error, error_frame);
312 	DEBUGFS_FWSTATS_ADD(error, error_null_Frame_tx_start);
313 	DEBUGFS_FWSTATS_ADD(error, error_numll_frame_cts_start);
314 	DEBUGFS_FWSTATS_ADD(error, error_bar_retry);
315 	DEBUGFS_FWSTATS_ADD(error, error_frame_cts_nul_flid);
316 
317 	DEBUGFS_FWSTATS_ADD(tx, tx_prepared_descs);
318 	DEBUGFS_FWSTATS_ADD(tx, tx_cmplt);
319 	DEBUGFS_FWSTATS_ADD(tx, tx_template_prepared);
320 	DEBUGFS_FWSTATS_ADD(tx, tx_data_prepared);
321 	DEBUGFS_FWSTATS_ADD(tx, tx_template_programmed);
322 	DEBUGFS_FWSTATS_ADD(tx, tx_data_programmed);
323 	DEBUGFS_FWSTATS_ADD(tx, tx_burst_programmed);
324 	DEBUGFS_FWSTATS_ADD(tx, tx_starts);
325 	DEBUGFS_FWSTATS_ADD(tx, tx_imm_resp);
326 	DEBUGFS_FWSTATS_ADD(tx, tx_start_templates);
327 	DEBUGFS_FWSTATS_ADD(tx, tx_start_int_templates);
328 	DEBUGFS_FWSTATS_ADD(tx, tx_start_fw_gen);
329 	DEBUGFS_FWSTATS_ADD(tx, tx_start_data);
330 	DEBUGFS_FWSTATS_ADD(tx, tx_start_null_frame);
331 	DEBUGFS_FWSTATS_ADD(tx, tx_exch);
332 	DEBUGFS_FWSTATS_ADD(tx, tx_retry_template);
333 	DEBUGFS_FWSTATS_ADD(tx, tx_retry_data);
334 	DEBUGFS_FWSTATS_ADD(tx, tx_exch_pending);
335 	DEBUGFS_FWSTATS_ADD(tx, tx_exch_expiry);
336 	DEBUGFS_FWSTATS_ADD(tx, tx_done_template);
337 	DEBUGFS_FWSTATS_ADD(tx, tx_done_data);
338 	DEBUGFS_FWSTATS_ADD(tx, tx_done_int_template);
339 	DEBUGFS_FWSTATS_ADD(tx, tx_frame_checksum);
340 	DEBUGFS_FWSTATS_ADD(tx, tx_checksum_result);
341 	DEBUGFS_FWSTATS_ADD(tx, frag_called);
342 	DEBUGFS_FWSTATS_ADD(tx, frag_mpdu_alloc_failed);
343 	DEBUGFS_FWSTATS_ADD(tx, frag_init_called);
344 	DEBUGFS_FWSTATS_ADD(tx, frag_in_process_called);
345 	DEBUGFS_FWSTATS_ADD(tx, frag_tkip_called);
346 	DEBUGFS_FWSTATS_ADD(tx, frag_key_not_found);
347 	DEBUGFS_FWSTATS_ADD(tx, frag_need_fragmentation);
348 	DEBUGFS_FWSTATS_ADD(tx, frag_bad_mblk_num);
349 	DEBUGFS_FWSTATS_ADD(tx, frag_failed);
350 	DEBUGFS_FWSTATS_ADD(tx, frag_cache_hit);
351 	DEBUGFS_FWSTATS_ADD(tx, frag_cache_miss);
352 
353 	DEBUGFS_FWSTATS_ADD(rx, rx_beacon_early_term);
354 	DEBUGFS_FWSTATS_ADD(rx, rx_out_of_mpdu_nodes);
355 	DEBUGFS_FWSTATS_ADD(rx, rx_hdr_overflow);
356 	DEBUGFS_FWSTATS_ADD(rx, rx_dropped_frame);
357 	DEBUGFS_FWSTATS_ADD(rx, rx_done);
358 	DEBUGFS_FWSTATS_ADD(rx, rx_defrag);
359 	DEBUGFS_FWSTATS_ADD(rx, rx_defrag_end);
360 	DEBUGFS_FWSTATS_ADD(rx, rx_cmplt);
361 	DEBUGFS_FWSTATS_ADD(rx, rx_pre_complt);
362 	DEBUGFS_FWSTATS_ADD(rx, rx_cmplt_task);
363 	DEBUGFS_FWSTATS_ADD(rx, rx_phy_hdr);
364 	DEBUGFS_FWSTATS_ADD(rx, rx_timeout);
365 	DEBUGFS_FWSTATS_ADD(rx, rx_timeout_wa);
366 	DEBUGFS_FWSTATS_ADD(rx, rx_wa_density_dropped_frame);
367 	DEBUGFS_FWSTATS_ADD(rx, rx_wa_ba_not_expected);
368 	DEBUGFS_FWSTATS_ADD(rx, rx_frame_checksum);
369 	DEBUGFS_FWSTATS_ADD(rx, rx_checksum_result);
370 	DEBUGFS_FWSTATS_ADD(rx, defrag_called);
371 	DEBUGFS_FWSTATS_ADD(rx, defrag_init_called);
372 	DEBUGFS_FWSTATS_ADD(rx, defrag_in_process_called);
373 	DEBUGFS_FWSTATS_ADD(rx, defrag_tkip_called);
374 	DEBUGFS_FWSTATS_ADD(rx, defrag_need_defrag);
375 	DEBUGFS_FWSTATS_ADD(rx, defrag_decrypt_failed);
376 	DEBUGFS_FWSTATS_ADD(rx, decrypt_key_not_found);
377 	DEBUGFS_FWSTATS_ADD(rx, defrag_need_decrypt);
378 	DEBUGFS_FWSTATS_ADD(rx, rx_tkip_replays);
379 
380 	DEBUGFS_FWSTATS_ADD(isr, irqs);
381 
382 	DEBUGFS_FWSTATS_ADD(pwr, missing_bcns_cnt);
383 	DEBUGFS_FWSTATS_ADD(pwr, rcvd_bcns_cnt);
384 	DEBUGFS_FWSTATS_ADD(pwr, connection_out_of_sync);
385 	DEBUGFS_FWSTATS_ADD(pwr, cont_miss_bcns_spread);
386 	DEBUGFS_FWSTATS_ADD(pwr, rcvd_awake_bcns_cnt);
387 
388 	DEBUGFS_FWSTATS_ADD(ps_poll, ps_poll_timeouts);
389 	DEBUGFS_FWSTATS_ADD(ps_poll, upsd_timeouts);
390 	DEBUGFS_FWSTATS_ADD(ps_poll, upsd_max_ap_turn);
391 	DEBUGFS_FWSTATS_ADD(ps_poll, ps_poll_max_ap_turn);
392 	DEBUGFS_FWSTATS_ADD(ps_poll, ps_poll_utilization);
393 	DEBUGFS_FWSTATS_ADD(ps_poll, upsd_utilization);
394 
395 	DEBUGFS_FWSTATS_ADD(rx_filter, beacon_filter);
396 	DEBUGFS_FWSTATS_ADD(rx_filter, arp_filter);
397 	DEBUGFS_FWSTATS_ADD(rx_filter, mc_filter);
398 	DEBUGFS_FWSTATS_ADD(rx_filter, dup_filter);
399 	DEBUGFS_FWSTATS_ADD(rx_filter, data_filter);
400 	DEBUGFS_FWSTATS_ADD(rx_filter, ibss_filter);
401 	DEBUGFS_FWSTATS_ADD(rx_filter, protection_filter);
402 	DEBUGFS_FWSTATS_ADD(rx_filter, accum_arp_pend_requests);
403 	DEBUGFS_FWSTATS_ADD(rx_filter, max_arp_queue_dep);
404 
405 	DEBUGFS_FWSTATS_ADD(rx_rate, rx_frames_per_rates);
406 
407 	DEBUGFS_FWSTATS_ADD(aggr_size, tx_agg_vs_rate);
408 	DEBUGFS_FWSTATS_ADD(aggr_size, rx_size);
409 
410 	DEBUGFS_FWSTATS_ADD(pipeline, hs_tx_stat_fifo_int);
411 	DEBUGFS_FWSTATS_ADD(pipeline, tcp_tx_stat_fifo_int);
412 	DEBUGFS_FWSTATS_ADD(pipeline, tcp_rx_stat_fifo_int);
413 	DEBUGFS_FWSTATS_ADD(pipeline, enc_tx_stat_fifo_int);
414 	DEBUGFS_FWSTATS_ADD(pipeline, enc_rx_stat_fifo_int);
415 	DEBUGFS_FWSTATS_ADD(pipeline, rx_complete_stat_fifo_int);
416 	DEBUGFS_FWSTATS_ADD(pipeline, pre_proc_swi);
417 	DEBUGFS_FWSTATS_ADD(pipeline, post_proc_swi);
418 	DEBUGFS_FWSTATS_ADD(pipeline, sec_frag_swi);
419 	DEBUGFS_FWSTATS_ADD(pipeline, pre_to_defrag_swi);
420 	DEBUGFS_FWSTATS_ADD(pipeline, defrag_to_csum_swi);
421 	DEBUGFS_FWSTATS_ADD(pipeline, csum_to_rx_xfer_swi);
422 	DEBUGFS_FWSTATS_ADD(pipeline, dec_packet_in);
423 	DEBUGFS_FWSTATS_ADD(pipeline, dec_packet_in_fifo_full);
424 	DEBUGFS_FWSTATS_ADD(pipeline, dec_packet_out);
425 	DEBUGFS_FWSTATS_ADD(pipeline, cs_rx_packet_in);
426 	DEBUGFS_FWSTATS_ADD(pipeline, cs_rx_packet_out);
427 	DEBUGFS_FWSTATS_ADD(pipeline, pipeline_fifo_full);
428 
429 	DEBUGFS_FWSTATS_ADD(mem, rx_free_mem_blks);
430 	DEBUGFS_FWSTATS_ADD(mem, tx_free_mem_blks);
431 	DEBUGFS_FWSTATS_ADD(mem, fwlog_free_mem_blks);
432 	DEBUGFS_FWSTATS_ADD(mem, fw_gen_free_mem_blks);
433 
434 	DEBUGFS_ADD(conf, moddir);
435 	DEBUGFS_ADD(radar_detection, moddir);
436 
437 	return 0;
438 
439 err:
440 	if (IS_ERR(entry))
441 		ret = PTR_ERR(entry);
442 	else
443 		ret = -ENOMEM;
444 
445 	return ret;
446 }
447