Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
debugfs.c
Go to the documentation of this file.
1 /*
2  * This file is part of wl12xx
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 
26 #include "wl12xx.h"
27 #include "acx.h"
28 #include "debugfs.h"
29 
30 #define WL12XX_DEBUGFS_FWSTATS_FILE(a, b, c) \
31  DEBUGFS_FWSTATS_FILE(a, b, c, wl12xx_acx_statistics)
32 
33 WL12XX_DEBUGFS_FWSTATS_FILE(tx, internal_desc_overflow, "%u");
34 
35 WL12XX_DEBUGFS_FWSTATS_FILE(rx, out_of_mem, "%u");
36 WL12XX_DEBUGFS_FWSTATS_FILE(rx, hdr_overflow, "%u");
37 WL12XX_DEBUGFS_FWSTATS_FILE(rx, hw_stuck, "%u");
38 WL12XX_DEBUGFS_FWSTATS_FILE(rx, dropped, "%u");
39 WL12XX_DEBUGFS_FWSTATS_FILE(rx, fcs_err, "%u");
40 WL12XX_DEBUGFS_FWSTATS_FILE(rx, xfr_hint_trig, "%u");
41 WL12XX_DEBUGFS_FWSTATS_FILE(rx, path_reset, "%u");
42 WL12XX_DEBUGFS_FWSTATS_FILE(rx, reset_counter, "%u");
43 
44 WL12XX_DEBUGFS_FWSTATS_FILE(dma, rx_requested, "%u");
46 WL12XX_DEBUGFS_FWSTATS_FILE(dma, tx_requested, "%u");
48 
49 WL12XX_DEBUGFS_FWSTATS_FILE(isr, cmd_cmplt, "%u");
50 WL12XX_DEBUGFS_FWSTATS_FILE(isr, fiqs, "%u");
51 WL12XX_DEBUGFS_FWSTATS_FILE(isr, rx_headers, "%u");
52 WL12XX_DEBUGFS_FWSTATS_FILE(isr, rx_mem_overflow, "%u");
53 WL12XX_DEBUGFS_FWSTATS_FILE(isr, rx_rdys, "%u");
54 WL12XX_DEBUGFS_FWSTATS_FILE(isr, irqs, "%u");
55 WL12XX_DEBUGFS_FWSTATS_FILE(isr, tx_procs, "%u");
56 WL12XX_DEBUGFS_FWSTATS_FILE(isr, decrypt_done, "%u");
57 WL12XX_DEBUGFS_FWSTATS_FILE(isr, dma0_done, "%u");
58 WL12XX_DEBUGFS_FWSTATS_FILE(isr, dma1_done, "%u");
59 WL12XX_DEBUGFS_FWSTATS_FILE(isr, tx_exch_complete, "%u");
61 WL12XX_DEBUGFS_FWSTATS_FILE(isr, rx_procs, "%u");
62 WL12XX_DEBUGFS_FWSTATS_FILE(isr, hw_pm_mode_changes, "%u");
63 WL12XX_DEBUGFS_FWSTATS_FILE(isr, host_acknowledges, "%u");
64 WL12XX_DEBUGFS_FWSTATS_FILE(isr, pci_pm, "%u");
65 WL12XX_DEBUGFS_FWSTATS_FILE(isr, wakeups, "%u");
66 WL12XX_DEBUGFS_FWSTATS_FILE(isr, low_rssi, "%u");
67 
68 WL12XX_DEBUGFS_FWSTATS_FILE(wep, addr_key_count, "%u");
69 WL12XX_DEBUGFS_FWSTATS_FILE(wep, default_key_count, "%u");
70 /* skipping wep.reserved */
71 WL12XX_DEBUGFS_FWSTATS_FILE(wep, key_not_found, "%u");
72 WL12XX_DEBUGFS_FWSTATS_FILE(wep, decrypt_fail, "%u");
75 
76 WL12XX_DEBUGFS_FWSTATS_FILE(pwr, ps_enter, "%u");
77 WL12XX_DEBUGFS_FWSTATS_FILE(pwr, elp_enter, "%u");
78 WL12XX_DEBUGFS_FWSTATS_FILE(pwr, missing_bcns, "%u");
79 WL12XX_DEBUGFS_FWSTATS_FILE(pwr, wake_on_host, "%u");
80 WL12XX_DEBUGFS_FWSTATS_FILE(pwr, wake_on_timer_exp, "%u");
81 WL12XX_DEBUGFS_FWSTATS_FILE(pwr, tx_with_ps, "%u");
82 WL12XX_DEBUGFS_FWSTATS_FILE(pwr, tx_without_ps, "%u");
83 WL12XX_DEBUGFS_FWSTATS_FILE(pwr, rcvd_beacons, "%u");
84 WL12XX_DEBUGFS_FWSTATS_FILE(pwr, power_save_off, "%u");
85 WL12XX_DEBUGFS_FWSTATS_FILE(pwr, enable_ps, "%u");
86 WL12XX_DEBUGFS_FWSTATS_FILE(pwr, disable_ps, "%u");
87 WL12XX_DEBUGFS_FWSTATS_FILE(pwr, fix_tsf_ps, "%u");
88 /* skipping cont_miss_bcns_spread for now */
89 WL12XX_DEBUGFS_FWSTATS_FILE(pwr, rcvd_awake_beacons, "%u");
90 
91 WL12XX_DEBUGFS_FWSTATS_FILE(mic, rx_pkts, "%u");
92 WL12XX_DEBUGFS_FWSTATS_FILE(mic, calc_failure, "%u");
93 
94 WL12XX_DEBUGFS_FWSTATS_FILE(aes, encrypt_fail, "%u");
95 WL12XX_DEBUGFS_FWSTATS_FILE(aes, decrypt_fail, "%u");
96 WL12XX_DEBUGFS_FWSTATS_FILE(aes, encrypt_packets, "%u");
97 WL12XX_DEBUGFS_FWSTATS_FILE(aes, decrypt_packets, "%u");
98 WL12XX_DEBUGFS_FWSTATS_FILE(aes, encrypt_interrupt, "%u");
99 WL12XX_DEBUGFS_FWSTATS_FILE(aes, decrypt_interrupt, "%u");
100 
101 WL12XX_DEBUGFS_FWSTATS_FILE(event, heart_beat, "%u");
102 WL12XX_DEBUGFS_FWSTATS_FILE(event, calibration, "%u");
103 WL12XX_DEBUGFS_FWSTATS_FILE(event, rx_mismatch, "%u");
104 WL12XX_DEBUGFS_FWSTATS_FILE(event, rx_mem_empty, "%u");
106 WL12XX_DEBUGFS_FWSTATS_FILE(event, oom_late, "%u");
107 WL12XX_DEBUGFS_FWSTATS_FILE(event, phy_transmit_error, "%u");
108 WL12XX_DEBUGFS_FWSTATS_FILE(event, tx_stuck, "%u");
109 
110 WL12XX_DEBUGFS_FWSTATS_FILE(ps, pspoll_timeouts, "%u");
111 WL12XX_DEBUGFS_FWSTATS_FILE(ps, upsd_timeouts, "%u");
112 WL12XX_DEBUGFS_FWSTATS_FILE(ps, upsd_max_sptime, "%u");
113 WL12XX_DEBUGFS_FWSTATS_FILE(ps, upsd_max_apturn, "%u");
114 WL12XX_DEBUGFS_FWSTATS_FILE(ps, pspoll_max_apturn, "%u");
115 WL12XX_DEBUGFS_FWSTATS_FILE(ps, pspoll_utilization, "%u");
116 WL12XX_DEBUGFS_FWSTATS_FILE(ps, upsd_utilization, "%u");
117 
118 WL12XX_DEBUGFS_FWSTATS_FILE(rxpipe, rx_prep_beacon_drop, "%u");
119 WL12XX_DEBUGFS_FWSTATS_FILE(rxpipe, descr_host_int_trig_rx_data, "%u");
120 WL12XX_DEBUGFS_FWSTATS_FILE(rxpipe, beacon_buffer_thres_host_int_trig_rx_data,
121  "%u");
122 WL12XX_DEBUGFS_FWSTATS_FILE(rxpipe, missed_beacon_host_int_trig_rx_data, "%u");
123 WL12XX_DEBUGFS_FWSTATS_FILE(rxpipe, tx_xfr_host_int_trig_rx_data, "%u");
124 
126  struct dentry *rootdir)
127 {
128  int ret = 0;
129  struct dentry *entry, *stats, *moddir;
130 
131  moddir = debugfs_create_dir(KBUILD_MODNAME, rootdir);
132  if (!moddir || IS_ERR(moddir)) {
133  entry = moddir;
134  goto err;
135  }
136 
137  stats = debugfs_create_dir("fw_stats", moddir);
138  if (!stats || IS_ERR(stats)) {
139  entry = stats;
140  goto err;
141  }
142 
143  DEBUGFS_FWSTATS_ADD(tx, internal_desc_overflow);
144 
145  DEBUGFS_FWSTATS_ADD(rx, out_of_mem);
146  DEBUGFS_FWSTATS_ADD(rx, hdr_overflow);
147  DEBUGFS_FWSTATS_ADD(rx, hw_stuck);
148  DEBUGFS_FWSTATS_ADD(rx, dropped);
149  DEBUGFS_FWSTATS_ADD(rx, fcs_err);
150  DEBUGFS_FWSTATS_ADD(rx, xfr_hint_trig);
151  DEBUGFS_FWSTATS_ADD(rx, path_reset);
152  DEBUGFS_FWSTATS_ADD(rx, reset_counter);
153 
154  DEBUGFS_FWSTATS_ADD(dma, rx_requested);
156  DEBUGFS_FWSTATS_ADD(dma, tx_requested);
158 
159  DEBUGFS_FWSTATS_ADD(isr, cmd_cmplt);
160  DEBUGFS_FWSTATS_ADD(isr, fiqs);
161  DEBUGFS_FWSTATS_ADD(isr, rx_headers);
162  DEBUGFS_FWSTATS_ADD(isr, rx_mem_overflow);
163  DEBUGFS_FWSTATS_ADD(isr, rx_rdys);
164  DEBUGFS_FWSTATS_ADD(isr, irqs);
165  DEBUGFS_FWSTATS_ADD(isr, tx_procs);
166  DEBUGFS_FWSTATS_ADD(isr, decrypt_done);
167  DEBUGFS_FWSTATS_ADD(isr, dma0_done);
168  DEBUGFS_FWSTATS_ADD(isr, dma1_done);
169  DEBUGFS_FWSTATS_ADD(isr, tx_exch_complete);
171  DEBUGFS_FWSTATS_ADD(isr, rx_procs);
172  DEBUGFS_FWSTATS_ADD(isr, hw_pm_mode_changes);
173  DEBUGFS_FWSTATS_ADD(isr, host_acknowledges);
174  DEBUGFS_FWSTATS_ADD(isr, pci_pm);
175  DEBUGFS_FWSTATS_ADD(isr, wakeups);
176  DEBUGFS_FWSTATS_ADD(isr, low_rssi);
177 
178  DEBUGFS_FWSTATS_ADD(wep, addr_key_count);
179  DEBUGFS_FWSTATS_ADD(wep, default_key_count);
180  /* skipping wep.reserved */
181  DEBUGFS_FWSTATS_ADD(wep, key_not_found);
182  DEBUGFS_FWSTATS_ADD(wep, decrypt_fail);
185 
186  DEBUGFS_FWSTATS_ADD(pwr, ps_enter);
187  DEBUGFS_FWSTATS_ADD(pwr, elp_enter);
188  DEBUGFS_FWSTATS_ADD(pwr, missing_bcns);
189  DEBUGFS_FWSTATS_ADD(pwr, wake_on_host);
190  DEBUGFS_FWSTATS_ADD(pwr, wake_on_timer_exp);
191  DEBUGFS_FWSTATS_ADD(pwr, tx_with_ps);
192  DEBUGFS_FWSTATS_ADD(pwr, tx_without_ps);
193  DEBUGFS_FWSTATS_ADD(pwr, rcvd_beacons);
194  DEBUGFS_FWSTATS_ADD(pwr, power_save_off);
195  DEBUGFS_FWSTATS_ADD(pwr, enable_ps);
196  DEBUGFS_FWSTATS_ADD(pwr, disable_ps);
197  DEBUGFS_FWSTATS_ADD(pwr, fix_tsf_ps);
198  /* skipping cont_miss_bcns_spread for now */
199  DEBUGFS_FWSTATS_ADD(pwr, rcvd_awake_beacons);
200 
201  DEBUGFS_FWSTATS_ADD(mic, rx_pkts);
202  DEBUGFS_FWSTATS_ADD(mic, calc_failure);
203 
204  DEBUGFS_FWSTATS_ADD(aes, encrypt_fail);
205  DEBUGFS_FWSTATS_ADD(aes, decrypt_fail);
206  DEBUGFS_FWSTATS_ADD(aes, encrypt_packets);
207  DEBUGFS_FWSTATS_ADD(aes, decrypt_packets);
208  DEBUGFS_FWSTATS_ADD(aes, encrypt_interrupt);
209  DEBUGFS_FWSTATS_ADD(aes, decrypt_interrupt);
210 
211  DEBUGFS_FWSTATS_ADD(event, heart_beat);
212  DEBUGFS_FWSTATS_ADD(event, calibration);
213  DEBUGFS_FWSTATS_ADD(event, rx_mismatch);
214  DEBUGFS_FWSTATS_ADD(event, rx_mem_empty);
216  DEBUGFS_FWSTATS_ADD(event, oom_late);
217  DEBUGFS_FWSTATS_ADD(event, phy_transmit_error);
218  DEBUGFS_FWSTATS_ADD(event, tx_stuck);
219 
220  DEBUGFS_FWSTATS_ADD(ps, pspoll_timeouts);
221  DEBUGFS_FWSTATS_ADD(ps, upsd_timeouts);
222  DEBUGFS_FWSTATS_ADD(ps, upsd_max_sptime);
223  DEBUGFS_FWSTATS_ADD(ps, upsd_max_apturn);
224  DEBUGFS_FWSTATS_ADD(ps, pspoll_max_apturn);
225  DEBUGFS_FWSTATS_ADD(ps, pspoll_utilization);
226  DEBUGFS_FWSTATS_ADD(ps, upsd_utilization);
227 
228  DEBUGFS_FWSTATS_ADD(rxpipe, rx_prep_beacon_drop);
229  DEBUGFS_FWSTATS_ADD(rxpipe, descr_host_int_trig_rx_data);
230  DEBUGFS_FWSTATS_ADD(rxpipe, beacon_buffer_thres_host_int_trig_rx_data);
231  DEBUGFS_FWSTATS_ADD(rxpipe, missed_beacon_host_int_trig_rx_data);
232  DEBUGFS_FWSTATS_ADD(rxpipe, tx_xfr_host_int_trig_rx_data);
233 
234  return 0;
235 
236 err:
237  if (IS_ERR(entry))
238  ret = PTR_ERR(entry);
239  else
240  ret = -ENOMEM;
241 
242  return ret;
243 }