diff options
Diffstat (limited to 'drivers/net/wireless/wl12xx/debugfs.c')
-rw-r--r-- | drivers/net/wireless/wl12xx/debugfs.c | 508 |
1 files changed, 508 insertions, 0 deletions
diff --git a/drivers/net/wireless/wl12xx/debugfs.c b/drivers/net/wireless/wl12xx/debugfs.c new file mode 100644 index 000000000000..cdb368ce4dae --- /dev/null +++ b/drivers/net/wireless/wl12xx/debugfs.c | |||
@@ -0,0 +1,508 @@ | |||
1 | /* | ||
2 | * This file is part of wl12xx | ||
3 | * | ||
4 | * Copyright (C) 2009 Nokia Corporation | ||
5 | * | ||
6 | * Contact: Kalle Valo <kalle.valo@nokia.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License | ||
10 | * version 2 as published by the Free Software Foundation. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, but | ||
13 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
15 | * General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
20 | * 02110-1301 USA | ||
21 | * | ||
22 | */ | ||
23 | |||
24 | #include "debugfs.h" | ||
25 | |||
26 | #include <linux/skbuff.h> | ||
27 | |||
28 | #include "wl12xx.h" | ||
29 | #include "acx.h" | ||
30 | |||
31 | /* ms */ | ||
32 | #define WL12XX_DEBUGFS_STATS_LIFETIME 1000 | ||
33 | |||
34 | /* debugfs macros idea from mac80211 */ | ||
35 | |||
36 | #define DEBUGFS_READONLY_FILE(name, buflen, fmt, value...) \ | ||
37 | static ssize_t name## _read(struct file *file, char __user *userbuf, \ | ||
38 | size_t count, loff_t *ppos) \ | ||
39 | { \ | ||
40 | struct wl12xx *wl = file->private_data; \ | ||
41 | char buf[buflen]; \ | ||
42 | int res; \ | ||
43 | \ | ||
44 | res = scnprintf(buf, buflen, fmt "\n", ##value); \ | ||
45 | return simple_read_from_buffer(userbuf, count, ppos, buf, res); \ | ||
46 | } \ | ||
47 | \ | ||
48 | static const struct file_operations name## _ops = { \ | ||
49 | .read = name## _read, \ | ||
50 | .open = wl12xx_open_file_generic, \ | ||
51 | }; | ||
52 | |||
53 | #define DEBUGFS_ADD(name, parent) \ | ||
54 | wl->debugfs.name = debugfs_create_file(#name, 0400, parent, \ | ||
55 | wl, &name## _ops); \ | ||
56 | if (IS_ERR(wl->debugfs.name)) { \ | ||
57 | ret = PTR_ERR(wl->debugfs.name); \ | ||
58 | wl->debugfs.name = NULL; \ | ||
59 | goto out; \ | ||
60 | } | ||
61 | |||
62 | #define DEBUGFS_DEL(name) \ | ||
63 | do { \ | ||
64 | debugfs_remove(wl->debugfs.name); \ | ||
65 | wl->debugfs.name = NULL; \ | ||
66 | } while (0) | ||
67 | |||
68 | #define DEBUGFS_FWSTATS_FILE(sub, name, buflen, fmt) \ | ||
69 | static ssize_t sub## _ ##name## _read(struct file *file, \ | ||
70 | char __user *userbuf, \ | ||
71 | size_t count, loff_t *ppos) \ | ||
72 | { \ | ||
73 | struct wl12xx *wl = file->private_data; \ | ||
74 | char buf[buflen]; \ | ||
75 | int res; \ | ||
76 | \ | ||
77 | wl12xx_debugfs_update_stats(wl); \ | ||
78 | \ | ||
79 | res = scnprintf(buf, buflen, fmt "\n", \ | ||
80 | wl->stats.fw_stats->sub.name); \ | ||
81 | return simple_read_from_buffer(userbuf, count, ppos, buf, res); \ | ||
82 | } \ | ||
83 | \ | ||
84 | static const struct file_operations sub## _ ##name## _ops = { \ | ||
85 | .read = sub## _ ##name## _read, \ | ||
86 | .open = wl12xx_open_file_generic, \ | ||
87 | }; | ||
88 | |||
89 | #define DEBUGFS_FWSTATS_ADD(sub, name) \ | ||
90 | DEBUGFS_ADD(sub## _ ##name, wl->debugfs.fw_statistics) | ||
91 | |||
92 | #define DEBUGFS_FWSTATS_DEL(sub, name) \ | ||
93 | DEBUGFS_DEL(sub## _ ##name) | ||
94 | |||
95 | static void wl12xx_debugfs_update_stats(struct wl12xx *wl) | ||
96 | { | ||
97 | mutex_lock(&wl->mutex); | ||
98 | |||
99 | if (wl->state == WL12XX_STATE_ON && | ||
100 | time_after(jiffies, wl->stats.fw_stats_update + | ||
101 | msecs_to_jiffies(WL12XX_DEBUGFS_STATS_LIFETIME))) { | ||
102 | wl12xx_acx_statistics(wl, wl->stats.fw_stats); | ||
103 | wl->stats.fw_stats_update = jiffies; | ||
104 | } | ||
105 | |||
106 | mutex_unlock(&wl->mutex); | ||
107 | } | ||
108 | |||
109 | static int wl12xx_open_file_generic(struct inode *inode, struct file *file) | ||
110 | { | ||
111 | file->private_data = inode->i_private; | ||
112 | return 0; | ||
113 | } | ||
114 | |||
115 | DEBUGFS_FWSTATS_FILE(tx, internal_desc_overflow, 20, "%u"); | ||
116 | |||
117 | DEBUGFS_FWSTATS_FILE(rx, out_of_mem, 20, "%u"); | ||
118 | DEBUGFS_FWSTATS_FILE(rx, hdr_overflow, 20, "%u"); | ||
119 | DEBUGFS_FWSTATS_FILE(rx, hw_stuck, 20, "%u"); | ||
120 | DEBUGFS_FWSTATS_FILE(rx, dropped, 20, "%u"); | ||
121 | DEBUGFS_FWSTATS_FILE(rx, fcs_err, 20, "%u"); | ||
122 | DEBUGFS_FWSTATS_FILE(rx, xfr_hint_trig, 20, "%u"); | ||
123 | DEBUGFS_FWSTATS_FILE(rx, path_reset, 20, "%u"); | ||
124 | DEBUGFS_FWSTATS_FILE(rx, reset_counter, 20, "%u"); | ||
125 | |||
126 | DEBUGFS_FWSTATS_FILE(dma, rx_requested, 20, "%u"); | ||
127 | DEBUGFS_FWSTATS_FILE(dma, rx_errors, 20, "%u"); | ||
128 | DEBUGFS_FWSTATS_FILE(dma, tx_requested, 20, "%u"); | ||
129 | DEBUGFS_FWSTATS_FILE(dma, tx_errors, 20, "%u"); | ||
130 | |||
131 | DEBUGFS_FWSTATS_FILE(isr, cmd_cmplt, 20, "%u"); | ||
132 | DEBUGFS_FWSTATS_FILE(isr, fiqs, 20, "%u"); | ||
133 | DEBUGFS_FWSTATS_FILE(isr, rx_headers, 20, "%u"); | ||
134 | DEBUGFS_FWSTATS_FILE(isr, rx_mem_overflow, 20, "%u"); | ||
135 | DEBUGFS_FWSTATS_FILE(isr, rx_rdys, 20, "%u"); | ||
136 | DEBUGFS_FWSTATS_FILE(isr, irqs, 20, "%u"); | ||
137 | DEBUGFS_FWSTATS_FILE(isr, tx_procs, 20, "%u"); | ||
138 | DEBUGFS_FWSTATS_FILE(isr, decrypt_done, 20, "%u"); | ||
139 | DEBUGFS_FWSTATS_FILE(isr, dma0_done, 20, "%u"); | ||
140 | DEBUGFS_FWSTATS_FILE(isr, dma1_done, 20, "%u"); | ||
141 | DEBUGFS_FWSTATS_FILE(isr, tx_exch_complete, 20, "%u"); | ||
142 | DEBUGFS_FWSTATS_FILE(isr, commands, 20, "%u"); | ||
143 | DEBUGFS_FWSTATS_FILE(isr, rx_procs, 20, "%u"); | ||
144 | DEBUGFS_FWSTATS_FILE(isr, hw_pm_mode_changes, 20, "%u"); | ||
145 | DEBUGFS_FWSTATS_FILE(isr, host_acknowledges, 20, "%u"); | ||
146 | DEBUGFS_FWSTATS_FILE(isr, pci_pm, 20, "%u"); | ||
147 | DEBUGFS_FWSTATS_FILE(isr, wakeups, 20, "%u"); | ||
148 | DEBUGFS_FWSTATS_FILE(isr, low_rssi, 20, "%u"); | ||
149 | |||
150 | DEBUGFS_FWSTATS_FILE(wep, addr_key_count, 20, "%u"); | ||
151 | DEBUGFS_FWSTATS_FILE(wep, default_key_count, 20, "%u"); | ||
152 | /* skipping wep.reserved */ | ||
153 | DEBUGFS_FWSTATS_FILE(wep, key_not_found, 20, "%u"); | ||
154 | DEBUGFS_FWSTATS_FILE(wep, decrypt_fail, 20, "%u"); | ||
155 | DEBUGFS_FWSTATS_FILE(wep, packets, 20, "%u"); | ||
156 | DEBUGFS_FWSTATS_FILE(wep, interrupt, 20, "%u"); | ||
157 | |||
158 | DEBUGFS_FWSTATS_FILE(pwr, ps_enter, 20, "%u"); | ||
159 | DEBUGFS_FWSTATS_FILE(pwr, elp_enter, 20, "%u"); | ||
160 | DEBUGFS_FWSTATS_FILE(pwr, missing_bcns, 20, "%u"); | ||
161 | DEBUGFS_FWSTATS_FILE(pwr, wake_on_host, 20, "%u"); | ||
162 | DEBUGFS_FWSTATS_FILE(pwr, wake_on_timer_exp, 20, "%u"); | ||
163 | DEBUGFS_FWSTATS_FILE(pwr, tx_with_ps, 20, "%u"); | ||
164 | DEBUGFS_FWSTATS_FILE(pwr, tx_without_ps, 20, "%u"); | ||
165 | DEBUGFS_FWSTATS_FILE(pwr, rcvd_beacons, 20, "%u"); | ||
166 | DEBUGFS_FWSTATS_FILE(pwr, power_save_off, 20, "%u"); | ||
167 | DEBUGFS_FWSTATS_FILE(pwr, enable_ps, 20, "%u"); | ||
168 | DEBUGFS_FWSTATS_FILE(pwr, disable_ps, 20, "%u"); | ||
169 | DEBUGFS_FWSTATS_FILE(pwr, fix_tsf_ps, 20, "%u"); | ||
170 | /* skipping cont_miss_bcns_spread for now */ | ||
171 | DEBUGFS_FWSTATS_FILE(pwr, rcvd_awake_beacons, 20, "%u"); | ||
172 | |||
173 | DEBUGFS_FWSTATS_FILE(mic, rx_pkts, 20, "%u"); | ||
174 | DEBUGFS_FWSTATS_FILE(mic, calc_failure, 20, "%u"); | ||
175 | |||
176 | DEBUGFS_FWSTATS_FILE(aes, encrypt_fail, 20, "%u"); | ||
177 | DEBUGFS_FWSTATS_FILE(aes, decrypt_fail, 20, "%u"); | ||
178 | DEBUGFS_FWSTATS_FILE(aes, encrypt_packets, 20, "%u"); | ||
179 | DEBUGFS_FWSTATS_FILE(aes, decrypt_packets, 20, "%u"); | ||
180 | DEBUGFS_FWSTATS_FILE(aes, encrypt_interrupt, 20, "%u"); | ||
181 | DEBUGFS_FWSTATS_FILE(aes, decrypt_interrupt, 20, "%u"); | ||
182 | |||
183 | DEBUGFS_FWSTATS_FILE(event, heart_beat, 20, "%u"); | ||
184 | DEBUGFS_FWSTATS_FILE(event, calibration, 20, "%u"); | ||
185 | DEBUGFS_FWSTATS_FILE(event, rx_mismatch, 20, "%u"); | ||
186 | DEBUGFS_FWSTATS_FILE(event, rx_mem_empty, 20, "%u"); | ||
187 | DEBUGFS_FWSTATS_FILE(event, rx_pool, 20, "%u"); | ||
188 | DEBUGFS_FWSTATS_FILE(event, oom_late, 20, "%u"); | ||
189 | DEBUGFS_FWSTATS_FILE(event, phy_transmit_error, 20, "%u"); | ||
190 | DEBUGFS_FWSTATS_FILE(event, tx_stuck, 20, "%u"); | ||
191 | |||
192 | DEBUGFS_FWSTATS_FILE(ps, pspoll_timeouts, 20, "%u"); | ||
193 | DEBUGFS_FWSTATS_FILE(ps, upsd_timeouts, 20, "%u"); | ||
194 | DEBUGFS_FWSTATS_FILE(ps, upsd_max_sptime, 20, "%u"); | ||
195 | DEBUGFS_FWSTATS_FILE(ps, upsd_max_apturn, 20, "%u"); | ||
196 | DEBUGFS_FWSTATS_FILE(ps, pspoll_max_apturn, 20, "%u"); | ||
197 | DEBUGFS_FWSTATS_FILE(ps, pspoll_utilization, 20, "%u"); | ||
198 | DEBUGFS_FWSTATS_FILE(ps, upsd_utilization, 20, "%u"); | ||
199 | |||
200 | DEBUGFS_FWSTATS_FILE(rxpipe, rx_prep_beacon_drop, 20, "%u"); | ||
201 | DEBUGFS_FWSTATS_FILE(rxpipe, descr_host_int_trig_rx_data, 20, "%u"); | ||
202 | DEBUGFS_FWSTATS_FILE(rxpipe, beacon_buffer_thres_host_int_trig_rx_data, | ||
203 | 20, "%u"); | ||
204 | DEBUGFS_FWSTATS_FILE(rxpipe, missed_beacon_host_int_trig_rx_data, 20, "%u"); | ||
205 | DEBUGFS_FWSTATS_FILE(rxpipe, tx_xfr_host_int_trig_rx_data, 20, "%u"); | ||
206 | |||
207 | DEBUGFS_READONLY_FILE(retry_count, 20, "%u", wl->stats.retry_count); | ||
208 | DEBUGFS_READONLY_FILE(excessive_retries, 20, "%u", | ||
209 | wl->stats.excessive_retries); | ||
210 | |||
211 | static ssize_t tx_queue_len_read(struct file *file, char __user *userbuf, | ||
212 | size_t count, loff_t *ppos) | ||
213 | { | ||
214 | struct wl12xx *wl = file->private_data; | ||
215 | u32 queue_len; | ||
216 | char buf[20]; | ||
217 | int res; | ||
218 | |||
219 | queue_len = skb_queue_len(&wl->tx_queue); | ||
220 | |||
221 | res = scnprintf(buf, sizeof(buf), "%u\n", queue_len); | ||
222 | return simple_read_from_buffer(userbuf, count, ppos, buf, res); | ||
223 | } | ||
224 | |||
225 | static const struct file_operations tx_queue_len_ops = { | ||
226 | .read = tx_queue_len_read, | ||
227 | .open = wl12xx_open_file_generic, | ||
228 | }; | ||
229 | |||
230 | static void wl12xx_debugfs_delete_files(struct wl12xx *wl) | ||
231 | { | ||
232 | DEBUGFS_FWSTATS_DEL(tx, internal_desc_overflow); | ||
233 | |||
234 | DEBUGFS_FWSTATS_DEL(rx, out_of_mem); | ||
235 | DEBUGFS_FWSTATS_DEL(rx, hdr_overflow); | ||
236 | DEBUGFS_FWSTATS_DEL(rx, hw_stuck); | ||
237 | DEBUGFS_FWSTATS_DEL(rx, dropped); | ||
238 | DEBUGFS_FWSTATS_DEL(rx, fcs_err); | ||
239 | DEBUGFS_FWSTATS_DEL(rx, xfr_hint_trig); | ||
240 | DEBUGFS_FWSTATS_DEL(rx, path_reset); | ||
241 | DEBUGFS_FWSTATS_DEL(rx, reset_counter); | ||
242 | |||
243 | DEBUGFS_FWSTATS_DEL(dma, rx_requested); | ||
244 | DEBUGFS_FWSTATS_DEL(dma, rx_errors); | ||
245 | DEBUGFS_FWSTATS_DEL(dma, tx_requested); | ||
246 | DEBUGFS_FWSTATS_DEL(dma, tx_errors); | ||
247 | |||
248 | DEBUGFS_FWSTATS_DEL(isr, cmd_cmplt); | ||
249 | DEBUGFS_FWSTATS_DEL(isr, fiqs); | ||
250 | DEBUGFS_FWSTATS_DEL(isr, rx_headers); | ||
251 | DEBUGFS_FWSTATS_DEL(isr, rx_mem_overflow); | ||
252 | DEBUGFS_FWSTATS_DEL(isr, rx_rdys); | ||
253 | DEBUGFS_FWSTATS_DEL(isr, irqs); | ||
254 | DEBUGFS_FWSTATS_DEL(isr, tx_procs); | ||
255 | DEBUGFS_FWSTATS_DEL(isr, decrypt_done); | ||
256 | DEBUGFS_FWSTATS_DEL(isr, dma0_done); | ||
257 | DEBUGFS_FWSTATS_DEL(isr, dma1_done); | ||
258 | DEBUGFS_FWSTATS_DEL(isr, tx_exch_complete); | ||
259 | DEBUGFS_FWSTATS_DEL(isr, commands); | ||
260 | DEBUGFS_FWSTATS_DEL(isr, rx_procs); | ||
261 | DEBUGFS_FWSTATS_DEL(isr, hw_pm_mode_changes); | ||
262 | DEBUGFS_FWSTATS_DEL(isr, host_acknowledges); | ||
263 | DEBUGFS_FWSTATS_DEL(isr, pci_pm); | ||
264 | DEBUGFS_FWSTATS_DEL(isr, wakeups); | ||
265 | DEBUGFS_FWSTATS_DEL(isr, low_rssi); | ||
266 | |||
267 | DEBUGFS_FWSTATS_DEL(wep, addr_key_count); | ||
268 | DEBUGFS_FWSTATS_DEL(wep, default_key_count); | ||
269 | /* skipping wep.reserved */ | ||
270 | DEBUGFS_FWSTATS_DEL(wep, key_not_found); | ||
271 | DEBUGFS_FWSTATS_DEL(wep, decrypt_fail); | ||
272 | DEBUGFS_FWSTATS_DEL(wep, packets); | ||
273 | DEBUGFS_FWSTATS_DEL(wep, interrupt); | ||
274 | |||
275 | DEBUGFS_FWSTATS_DEL(pwr, ps_enter); | ||
276 | DEBUGFS_FWSTATS_DEL(pwr, elp_enter); | ||
277 | DEBUGFS_FWSTATS_DEL(pwr, missing_bcns); | ||
278 | DEBUGFS_FWSTATS_DEL(pwr, wake_on_host); | ||
279 | DEBUGFS_FWSTATS_DEL(pwr, wake_on_timer_exp); | ||
280 | DEBUGFS_FWSTATS_DEL(pwr, tx_with_ps); | ||
281 | DEBUGFS_FWSTATS_DEL(pwr, tx_without_ps); | ||
282 | DEBUGFS_FWSTATS_DEL(pwr, rcvd_beacons); | ||
283 | DEBUGFS_FWSTATS_DEL(pwr, power_save_off); | ||
284 | DEBUGFS_FWSTATS_DEL(pwr, enable_ps); | ||
285 | DEBUGFS_FWSTATS_DEL(pwr, disable_ps); | ||
286 | DEBUGFS_FWSTATS_DEL(pwr, fix_tsf_ps); | ||
287 | /* skipping cont_miss_bcns_spread for now */ | ||
288 | DEBUGFS_FWSTATS_DEL(pwr, rcvd_awake_beacons); | ||
289 | |||
290 | DEBUGFS_FWSTATS_DEL(mic, rx_pkts); | ||
291 | DEBUGFS_FWSTATS_DEL(mic, calc_failure); | ||
292 | |||
293 | DEBUGFS_FWSTATS_DEL(aes, encrypt_fail); | ||
294 | DEBUGFS_FWSTATS_DEL(aes, decrypt_fail); | ||
295 | DEBUGFS_FWSTATS_DEL(aes, encrypt_packets); | ||
296 | DEBUGFS_FWSTATS_DEL(aes, decrypt_packets); | ||
297 | DEBUGFS_FWSTATS_DEL(aes, encrypt_interrupt); | ||
298 | DEBUGFS_FWSTATS_DEL(aes, decrypt_interrupt); | ||
299 | |||
300 | DEBUGFS_FWSTATS_DEL(event, heart_beat); | ||
301 | DEBUGFS_FWSTATS_DEL(event, calibration); | ||
302 | DEBUGFS_FWSTATS_DEL(event, rx_mismatch); | ||
303 | DEBUGFS_FWSTATS_DEL(event, rx_mem_empty); | ||
304 | DEBUGFS_FWSTATS_DEL(event, rx_pool); | ||
305 | DEBUGFS_FWSTATS_DEL(event, oom_late); | ||
306 | DEBUGFS_FWSTATS_DEL(event, phy_transmit_error); | ||
307 | DEBUGFS_FWSTATS_DEL(event, tx_stuck); | ||
308 | |||
309 | DEBUGFS_FWSTATS_DEL(ps, pspoll_timeouts); | ||
310 | DEBUGFS_FWSTATS_DEL(ps, upsd_timeouts); | ||
311 | DEBUGFS_FWSTATS_DEL(ps, upsd_max_sptime); | ||
312 | DEBUGFS_FWSTATS_DEL(ps, upsd_max_apturn); | ||
313 | DEBUGFS_FWSTATS_DEL(ps, pspoll_max_apturn); | ||
314 | DEBUGFS_FWSTATS_DEL(ps, pspoll_utilization); | ||
315 | DEBUGFS_FWSTATS_DEL(ps, upsd_utilization); | ||
316 | |||
317 | DEBUGFS_FWSTATS_DEL(rxpipe, rx_prep_beacon_drop); | ||
318 | DEBUGFS_FWSTATS_DEL(rxpipe, descr_host_int_trig_rx_data); | ||
319 | DEBUGFS_FWSTATS_DEL(rxpipe, beacon_buffer_thres_host_int_trig_rx_data); | ||
320 | DEBUGFS_FWSTATS_DEL(rxpipe, missed_beacon_host_int_trig_rx_data); | ||
321 | DEBUGFS_FWSTATS_DEL(rxpipe, tx_xfr_host_int_trig_rx_data); | ||
322 | |||
323 | DEBUGFS_DEL(tx_queue_len); | ||
324 | DEBUGFS_DEL(retry_count); | ||
325 | DEBUGFS_DEL(excessive_retries); | ||
326 | } | ||
327 | |||
328 | static int wl12xx_debugfs_add_files(struct wl12xx *wl) | ||
329 | { | ||
330 | int ret = 0; | ||
331 | |||
332 | DEBUGFS_FWSTATS_ADD(tx, internal_desc_overflow); | ||
333 | |||
334 | DEBUGFS_FWSTATS_ADD(rx, out_of_mem); | ||
335 | DEBUGFS_FWSTATS_ADD(rx, hdr_overflow); | ||
336 | DEBUGFS_FWSTATS_ADD(rx, hw_stuck); | ||
337 | DEBUGFS_FWSTATS_ADD(rx, dropped); | ||
338 | DEBUGFS_FWSTATS_ADD(rx, fcs_err); | ||
339 | DEBUGFS_FWSTATS_ADD(rx, xfr_hint_trig); | ||
340 | DEBUGFS_FWSTATS_ADD(rx, path_reset); | ||
341 | DEBUGFS_FWSTATS_ADD(rx, reset_counter); | ||
342 | |||
343 | DEBUGFS_FWSTATS_ADD(dma, rx_requested); | ||
344 | DEBUGFS_FWSTATS_ADD(dma, rx_errors); | ||
345 | DEBUGFS_FWSTATS_ADD(dma, tx_requested); | ||
346 | DEBUGFS_FWSTATS_ADD(dma, tx_errors); | ||
347 | |||
348 | DEBUGFS_FWSTATS_ADD(isr, cmd_cmplt); | ||
349 | DEBUGFS_FWSTATS_ADD(isr, fiqs); | ||
350 | DEBUGFS_FWSTATS_ADD(isr, rx_headers); | ||
351 | DEBUGFS_FWSTATS_ADD(isr, rx_mem_overflow); | ||
352 | DEBUGFS_FWSTATS_ADD(isr, rx_rdys); | ||
353 | DEBUGFS_FWSTATS_ADD(isr, irqs); | ||
354 | DEBUGFS_FWSTATS_ADD(isr, tx_procs); | ||
355 | DEBUGFS_FWSTATS_ADD(isr, decrypt_done); | ||
356 | DEBUGFS_FWSTATS_ADD(isr, dma0_done); | ||
357 | DEBUGFS_FWSTATS_ADD(isr, dma1_done); | ||
358 | DEBUGFS_FWSTATS_ADD(isr, tx_exch_complete); | ||
359 | DEBUGFS_FWSTATS_ADD(isr, commands); | ||
360 | DEBUGFS_FWSTATS_ADD(isr, rx_procs); | ||
361 | DEBUGFS_FWSTATS_ADD(isr, hw_pm_mode_changes); | ||
362 | DEBUGFS_FWSTATS_ADD(isr, host_acknowledges); | ||
363 | DEBUGFS_FWSTATS_ADD(isr, pci_pm); | ||
364 | DEBUGFS_FWSTATS_ADD(isr, wakeups); | ||
365 | DEBUGFS_FWSTATS_ADD(isr, low_rssi); | ||
366 | |||
367 | DEBUGFS_FWSTATS_ADD(wep, addr_key_count); | ||
368 | DEBUGFS_FWSTATS_ADD(wep, default_key_count); | ||
369 | /* skipping wep.reserved */ | ||
370 | DEBUGFS_FWSTATS_ADD(wep, key_not_found); | ||
371 | DEBUGFS_FWSTATS_ADD(wep, decrypt_fail); | ||
372 | DEBUGFS_FWSTATS_ADD(wep, packets); | ||
373 | DEBUGFS_FWSTATS_ADD(wep, interrupt); | ||
374 | |||
375 | DEBUGFS_FWSTATS_ADD(pwr, ps_enter); | ||
376 | DEBUGFS_FWSTATS_ADD(pwr, elp_enter); | ||
377 | DEBUGFS_FWSTATS_ADD(pwr, missing_bcns); | ||
378 | DEBUGFS_FWSTATS_ADD(pwr, wake_on_host); | ||
379 | DEBUGFS_FWSTATS_ADD(pwr, wake_on_timer_exp); | ||
380 | DEBUGFS_FWSTATS_ADD(pwr, tx_with_ps); | ||
381 | DEBUGFS_FWSTATS_ADD(pwr, tx_without_ps); | ||
382 | DEBUGFS_FWSTATS_ADD(pwr, rcvd_beacons); | ||
383 | DEBUGFS_FWSTATS_ADD(pwr, power_save_off); | ||
384 | DEBUGFS_FWSTATS_ADD(pwr, enable_ps); | ||
385 | DEBUGFS_FWSTATS_ADD(pwr, disable_ps); | ||
386 | DEBUGFS_FWSTATS_ADD(pwr, fix_tsf_ps); | ||
387 | /* skipping cont_miss_bcns_spread for now */ | ||
388 | DEBUGFS_FWSTATS_ADD(pwr, rcvd_awake_beacons); | ||
389 | |||
390 | DEBUGFS_FWSTATS_ADD(mic, rx_pkts); | ||
391 | DEBUGFS_FWSTATS_ADD(mic, calc_failure); | ||
392 | |||
393 | DEBUGFS_FWSTATS_ADD(aes, encrypt_fail); | ||
394 | DEBUGFS_FWSTATS_ADD(aes, decrypt_fail); | ||
395 | DEBUGFS_FWSTATS_ADD(aes, encrypt_packets); | ||
396 | DEBUGFS_FWSTATS_ADD(aes, decrypt_packets); | ||
397 | DEBUGFS_FWSTATS_ADD(aes, encrypt_interrupt); | ||
398 | DEBUGFS_FWSTATS_ADD(aes, decrypt_interrupt); | ||
399 | |||
400 | DEBUGFS_FWSTATS_ADD(event, heart_beat); | ||
401 | DEBUGFS_FWSTATS_ADD(event, calibration); | ||
402 | DEBUGFS_FWSTATS_ADD(event, rx_mismatch); | ||
403 | DEBUGFS_FWSTATS_ADD(event, rx_mem_empty); | ||
404 | DEBUGFS_FWSTATS_ADD(event, rx_pool); | ||
405 | DEBUGFS_FWSTATS_ADD(event, oom_late); | ||
406 | DEBUGFS_FWSTATS_ADD(event, phy_transmit_error); | ||
407 | DEBUGFS_FWSTATS_ADD(event, tx_stuck); | ||
408 | |||
409 | DEBUGFS_FWSTATS_ADD(ps, pspoll_timeouts); | ||
410 | DEBUGFS_FWSTATS_ADD(ps, upsd_timeouts); | ||
411 | DEBUGFS_FWSTATS_ADD(ps, upsd_max_sptime); | ||
412 | DEBUGFS_FWSTATS_ADD(ps, upsd_max_apturn); | ||
413 | DEBUGFS_FWSTATS_ADD(ps, pspoll_max_apturn); | ||
414 | DEBUGFS_FWSTATS_ADD(ps, pspoll_utilization); | ||
415 | DEBUGFS_FWSTATS_ADD(ps, upsd_utilization); | ||
416 | |||
417 | DEBUGFS_FWSTATS_ADD(rxpipe, rx_prep_beacon_drop); | ||
418 | DEBUGFS_FWSTATS_ADD(rxpipe, descr_host_int_trig_rx_data); | ||
419 | DEBUGFS_FWSTATS_ADD(rxpipe, beacon_buffer_thres_host_int_trig_rx_data); | ||
420 | DEBUGFS_FWSTATS_ADD(rxpipe, missed_beacon_host_int_trig_rx_data); | ||
421 | DEBUGFS_FWSTATS_ADD(rxpipe, tx_xfr_host_int_trig_rx_data); | ||
422 | |||
423 | DEBUGFS_ADD(tx_queue_len, wl->debugfs.rootdir); | ||
424 | DEBUGFS_ADD(retry_count, wl->debugfs.rootdir); | ||
425 | DEBUGFS_ADD(excessive_retries, wl->debugfs.rootdir); | ||
426 | |||
427 | out: | ||
428 | if (ret < 0) | ||
429 | wl12xx_debugfs_delete_files(wl); | ||
430 | |||
431 | return ret; | ||
432 | } | ||
433 | |||
434 | void wl12xx_debugfs_reset(struct wl12xx *wl) | ||
435 | { | ||
436 | memset(wl->stats.fw_stats, 0, sizeof(*wl->stats.fw_stats)); | ||
437 | wl->stats.retry_count = 0; | ||
438 | wl->stats.excessive_retries = 0; | ||
439 | } | ||
440 | |||
441 | int wl12xx_debugfs_init(struct wl12xx *wl) | ||
442 | { | ||
443 | int ret; | ||
444 | |||
445 | wl->debugfs.rootdir = debugfs_create_dir(KBUILD_MODNAME, NULL); | ||
446 | |||
447 | if (IS_ERR(wl->debugfs.rootdir)) { | ||
448 | ret = PTR_ERR(wl->debugfs.rootdir); | ||
449 | wl->debugfs.rootdir = NULL; | ||
450 | goto err; | ||
451 | } | ||
452 | |||
453 | wl->debugfs.fw_statistics = debugfs_create_dir("fw-statistics", | ||
454 | wl->debugfs.rootdir); | ||
455 | |||
456 | if (IS_ERR(wl->debugfs.fw_statistics)) { | ||
457 | ret = PTR_ERR(wl->debugfs.fw_statistics); | ||
458 | wl->debugfs.fw_statistics = NULL; | ||
459 | goto err_root; | ||
460 | } | ||
461 | |||
462 | wl->stats.fw_stats = kzalloc(sizeof(*wl->stats.fw_stats), | ||
463 | GFP_KERNEL); | ||
464 | |||
465 | if (!wl->stats.fw_stats) { | ||
466 | ret = -ENOMEM; | ||
467 | goto err_fw; | ||
468 | } | ||
469 | |||
470 | wl->stats.fw_stats_update = jiffies; | ||
471 | |||
472 | ret = wl12xx_debugfs_add_files(wl); | ||
473 | |||
474 | if (ret < 0) | ||
475 | goto err_file; | ||
476 | |||
477 | return 0; | ||
478 | |||
479 | err_file: | ||
480 | kfree(wl->stats.fw_stats); | ||
481 | wl->stats.fw_stats = NULL; | ||
482 | |||
483 | err_fw: | ||
484 | debugfs_remove(wl->debugfs.fw_statistics); | ||
485 | wl->debugfs.fw_statistics = NULL; | ||
486 | |||
487 | err_root: | ||
488 | debugfs_remove(wl->debugfs.rootdir); | ||
489 | wl->debugfs.rootdir = NULL; | ||
490 | |||
491 | err: | ||
492 | return ret; | ||
493 | } | ||
494 | |||
495 | void wl12xx_debugfs_exit(struct wl12xx *wl) | ||
496 | { | ||
497 | wl12xx_debugfs_delete_files(wl); | ||
498 | |||
499 | kfree(wl->stats.fw_stats); | ||
500 | wl->stats.fw_stats = NULL; | ||
501 | |||
502 | debugfs_remove(wl->debugfs.fw_statistics); | ||
503 | wl->debugfs.fw_statistics = NULL; | ||
504 | |||
505 | debugfs_remove(wl->debugfs.rootdir); | ||
506 | wl->debugfs.rootdir = NULL; | ||
507 | |||
508 | } | ||