aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_debugfs.c215
1 files changed, 111 insertions, 104 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1271_debugfs.c b/drivers/net/wireless/wl12xx/wl1271_debugfs.c
index 66c2b90ddfd4..3468b849852e 100644
--- a/drivers/net/wireless/wl12xx/wl1271_debugfs.c
+++ b/drivers/net/wireless/wl12xx/wl1271_debugfs.c
@@ -35,17 +35,28 @@
35#define WL1271_DEBUGFS_STATS_LIFETIME 1000 35#define WL1271_DEBUGFS_STATS_LIFETIME 1000
36 36
37/* debugfs macros idea from mac80211 */ 37/* debugfs macros idea from mac80211 */
38#define DEBUGFS_FORMAT_BUFFER_SIZE 100
39static int wl1271_format_buffer(char __user *userbuf, size_t count,
40 loff_t *ppos, char *fmt, ...)
41{
42 va_list args;
43 char buf[DEBUGFS_FORMAT_BUFFER_SIZE];
44 int res;
38 45
39#define DEBUGFS_READONLY_FILE(name, buflen, fmt, value...) \ 46 va_start(args, fmt);
47 res = vscnprintf(buf, sizeof(buf), fmt, args);
48 va_end(args);
49
50 return simple_read_from_buffer(userbuf, count, ppos, buf, res);
51}
52
53#define DEBUGFS_READONLY_FILE(name, fmt, value...) \
40static ssize_t name## _read(struct file *file, char __user *userbuf, \ 54static ssize_t name## _read(struct file *file, char __user *userbuf, \
41 size_t count, loff_t *ppos) \ 55 size_t count, loff_t *ppos) \
42{ \ 56{ \
43 struct wl1271 *wl = file->private_data; \ 57 struct wl1271 *wl = file->private_data; \
44 char buf[buflen]; \ 58 return wl1271_format_buffer(userbuf, count, ppos, \
45 int res; \ 59 fmt "\n", ##value); \
46 \
47 res = scnprintf(buf, buflen, fmt "\n", ##value); \
48 return simple_read_from_buffer(userbuf, count, ppos, buf, res); \
49} \ 60} \
50 \ 61 \
51static const struct file_operations name## _ops = { \ 62static const struct file_operations name## _ops = { \
@@ -69,20 +80,17 @@ static const struct file_operations name## _ops = { \
69 wl->debugfs.name = NULL; \ 80 wl->debugfs.name = NULL; \
70 } while (0) 81 } while (0)
71 82
72#define DEBUGFS_FWSTATS_FILE(sub, name, buflen, fmt) \ 83#define DEBUGFS_FWSTATS_FILE(sub, name, fmt) \
73static ssize_t sub## _ ##name## _read(struct file *file, \ 84static ssize_t sub## _ ##name## _read(struct file *file, \
74 char __user *userbuf, \ 85 char __user *userbuf, \
75 size_t count, loff_t *ppos) \ 86 size_t count, loff_t *ppos) \
76{ \ 87{ \
77 struct wl1271 *wl = file->private_data; \ 88 struct wl1271 *wl = file->private_data; \
78 char buf[buflen]; \
79 int res; \
80 \ 89 \
81 wl1271_debugfs_update_stats(wl); \ 90 wl1271_debugfs_update_stats(wl); \
82 \ 91 \
83 res = scnprintf(buf, buflen, fmt "\n", \ 92 return wl1271_format_buffer(userbuf, count, ppos, fmt "\n", \
84 wl->stats.fw_stats->sub.name); \ 93 wl->stats.fw_stats->sub.name); \
85 return simple_read_from_buffer(userbuf, count, ppos, buf, res); \
86} \ 94} \
87 \ 95 \
88static const struct file_operations sub## _ ##name## _ops = { \ 96static const struct file_operations sub## _ ##name## _ops = { \
@@ -126,100 +134,99 @@ static int wl1271_open_file_generic(struct inode *inode, struct file *file)
126 return 0; 134 return 0;
127} 135}
128 136
129DEBUGFS_FWSTATS_FILE(tx, internal_desc_overflow, 20, "%u"); 137DEBUGFS_FWSTATS_FILE(tx, internal_desc_overflow, "%u");
130 138
131DEBUGFS_FWSTATS_FILE(rx, out_of_mem, 20, "%u"); 139DEBUGFS_FWSTATS_FILE(rx, out_of_mem, "%u");
132DEBUGFS_FWSTATS_FILE(rx, hdr_overflow, 20, "%u"); 140DEBUGFS_FWSTATS_FILE(rx, hdr_overflow, "%u");
133DEBUGFS_FWSTATS_FILE(rx, hw_stuck, 20, "%u"); 141DEBUGFS_FWSTATS_FILE(rx, hw_stuck, "%u");
134DEBUGFS_FWSTATS_FILE(rx, dropped, 20, "%u"); 142DEBUGFS_FWSTATS_FILE(rx, dropped, "%u");
135DEBUGFS_FWSTATS_FILE(rx, fcs_err, 20, "%u"); 143DEBUGFS_FWSTATS_FILE(rx, fcs_err, "%u");
136DEBUGFS_FWSTATS_FILE(rx, xfr_hint_trig, 20, "%u"); 144DEBUGFS_FWSTATS_FILE(rx, xfr_hint_trig, "%u");
137DEBUGFS_FWSTATS_FILE(rx, path_reset, 20, "%u"); 145DEBUGFS_FWSTATS_FILE(rx, path_reset, "%u");
138DEBUGFS_FWSTATS_FILE(rx, reset_counter, 20, "%u"); 146DEBUGFS_FWSTATS_FILE(rx, reset_counter, "%u");
139 147
140DEBUGFS_FWSTATS_FILE(dma, rx_requested, 20, "%u"); 148DEBUGFS_FWSTATS_FILE(dma, rx_requested, "%u");
141DEBUGFS_FWSTATS_FILE(dma, rx_errors, 20, "%u"); 149DEBUGFS_FWSTATS_FILE(dma, rx_errors, "%u");
142DEBUGFS_FWSTATS_FILE(dma, tx_requested, 20, "%u"); 150DEBUGFS_FWSTATS_FILE(dma, tx_requested, "%u");
143DEBUGFS_FWSTATS_FILE(dma, tx_errors, 20, "%u"); 151DEBUGFS_FWSTATS_FILE(dma, tx_errors, "%u");
144 152
145DEBUGFS_FWSTATS_FILE(isr, cmd_cmplt, 20, "%u"); 153DEBUGFS_FWSTATS_FILE(isr, cmd_cmplt, "%u");
146DEBUGFS_FWSTATS_FILE(isr, fiqs, 20, "%u"); 154DEBUGFS_FWSTATS_FILE(isr, fiqs, "%u");
147DEBUGFS_FWSTATS_FILE(isr, rx_headers, 20, "%u"); 155DEBUGFS_FWSTATS_FILE(isr, rx_headers, "%u");
148DEBUGFS_FWSTATS_FILE(isr, rx_mem_overflow, 20, "%u"); 156DEBUGFS_FWSTATS_FILE(isr, rx_mem_overflow, "%u");
149DEBUGFS_FWSTATS_FILE(isr, rx_rdys, 20, "%u"); 157DEBUGFS_FWSTATS_FILE(isr, rx_rdys, "%u");
150DEBUGFS_FWSTATS_FILE(isr, irqs, 20, "%u"); 158DEBUGFS_FWSTATS_FILE(isr, irqs, "%u");
151DEBUGFS_FWSTATS_FILE(isr, tx_procs, 20, "%u"); 159DEBUGFS_FWSTATS_FILE(isr, tx_procs, "%u");
152DEBUGFS_FWSTATS_FILE(isr, decrypt_done, 20, "%u"); 160DEBUGFS_FWSTATS_FILE(isr, decrypt_done, "%u");
153DEBUGFS_FWSTATS_FILE(isr, dma0_done, 20, "%u"); 161DEBUGFS_FWSTATS_FILE(isr, dma0_done, "%u");
154DEBUGFS_FWSTATS_FILE(isr, dma1_done, 20, "%u"); 162DEBUGFS_FWSTATS_FILE(isr, dma1_done, "%u");
155DEBUGFS_FWSTATS_FILE(isr, tx_exch_complete, 20, "%u"); 163DEBUGFS_FWSTATS_FILE(isr, tx_exch_complete, "%u");
156DEBUGFS_FWSTATS_FILE(isr, commands, 20, "%u"); 164DEBUGFS_FWSTATS_FILE(isr, commands, "%u");
157DEBUGFS_FWSTATS_FILE(isr, rx_procs, 20, "%u"); 165DEBUGFS_FWSTATS_FILE(isr, rx_procs, "%u");
158DEBUGFS_FWSTATS_FILE(isr, hw_pm_mode_changes, 20, "%u"); 166DEBUGFS_FWSTATS_FILE(isr, hw_pm_mode_changes, "%u");
159DEBUGFS_FWSTATS_FILE(isr, host_acknowledges, 20, "%u"); 167DEBUGFS_FWSTATS_FILE(isr, host_acknowledges, "%u");
160DEBUGFS_FWSTATS_FILE(isr, pci_pm, 20, "%u"); 168DEBUGFS_FWSTATS_FILE(isr, pci_pm, "%u");
161DEBUGFS_FWSTATS_FILE(isr, wakeups, 20, "%u"); 169DEBUGFS_FWSTATS_FILE(isr, wakeups, "%u");
162DEBUGFS_FWSTATS_FILE(isr, low_rssi, 20, "%u"); 170DEBUGFS_FWSTATS_FILE(isr, low_rssi, "%u");
163 171
164DEBUGFS_FWSTATS_FILE(wep, addr_key_count, 20, "%u"); 172DEBUGFS_FWSTATS_FILE(wep, addr_key_count, "%u");
165DEBUGFS_FWSTATS_FILE(wep, default_key_count, 20, "%u"); 173DEBUGFS_FWSTATS_FILE(wep, default_key_count, "%u");
166/* skipping wep.reserved */ 174/* skipping wep.reserved */
167DEBUGFS_FWSTATS_FILE(wep, key_not_found, 20, "%u"); 175DEBUGFS_FWSTATS_FILE(wep, key_not_found, "%u");
168DEBUGFS_FWSTATS_FILE(wep, decrypt_fail, 20, "%u"); 176DEBUGFS_FWSTATS_FILE(wep, decrypt_fail, "%u");
169DEBUGFS_FWSTATS_FILE(wep, packets, 20, "%u"); 177DEBUGFS_FWSTATS_FILE(wep, packets, "%u");
170DEBUGFS_FWSTATS_FILE(wep, interrupt, 20, "%u"); 178DEBUGFS_FWSTATS_FILE(wep, interrupt, "%u");
171 179
172DEBUGFS_FWSTATS_FILE(pwr, ps_enter, 20, "%u"); 180DEBUGFS_FWSTATS_FILE(pwr, ps_enter, "%u");
173DEBUGFS_FWSTATS_FILE(pwr, elp_enter, 20, "%u"); 181DEBUGFS_FWSTATS_FILE(pwr, elp_enter, "%u");
174DEBUGFS_FWSTATS_FILE(pwr, missing_bcns, 20, "%u"); 182DEBUGFS_FWSTATS_FILE(pwr, missing_bcns, "%u");
175DEBUGFS_FWSTATS_FILE(pwr, wake_on_host, 20, "%u"); 183DEBUGFS_FWSTATS_FILE(pwr, wake_on_host, "%u");
176DEBUGFS_FWSTATS_FILE(pwr, wake_on_timer_exp, 20, "%u"); 184DEBUGFS_FWSTATS_FILE(pwr, wake_on_timer_exp, "%u");
177DEBUGFS_FWSTATS_FILE(pwr, tx_with_ps, 20, "%u"); 185DEBUGFS_FWSTATS_FILE(pwr, tx_with_ps, "%u");
178DEBUGFS_FWSTATS_FILE(pwr, tx_without_ps, 20, "%u"); 186DEBUGFS_FWSTATS_FILE(pwr, tx_without_ps, "%u");
179DEBUGFS_FWSTATS_FILE(pwr, rcvd_beacons, 20, "%u"); 187DEBUGFS_FWSTATS_FILE(pwr, rcvd_beacons, "%u");
180DEBUGFS_FWSTATS_FILE(pwr, power_save_off, 20, "%u"); 188DEBUGFS_FWSTATS_FILE(pwr, power_save_off, "%u");
181DEBUGFS_FWSTATS_FILE(pwr, enable_ps, 20, "%u"); 189DEBUGFS_FWSTATS_FILE(pwr, enable_ps, "%u");
182DEBUGFS_FWSTATS_FILE(pwr, disable_ps, 20, "%u"); 190DEBUGFS_FWSTATS_FILE(pwr, disable_ps, "%u");
183DEBUGFS_FWSTATS_FILE(pwr, fix_tsf_ps, 20, "%u"); 191DEBUGFS_FWSTATS_FILE(pwr, fix_tsf_ps, "%u");
184/* skipping cont_miss_bcns_spread for now */ 192/* skipping cont_miss_bcns_spread for now */
185DEBUGFS_FWSTATS_FILE(pwr, rcvd_awake_beacons, 20, "%u"); 193DEBUGFS_FWSTATS_FILE(pwr, rcvd_awake_beacons, "%u");
186 194
187DEBUGFS_FWSTATS_FILE(mic, rx_pkts, 20, "%u"); 195DEBUGFS_FWSTATS_FILE(mic, rx_pkts, "%u");
188DEBUGFS_FWSTATS_FILE(mic, calc_failure, 20, "%u"); 196DEBUGFS_FWSTATS_FILE(mic, calc_failure, "%u");
189 197
190DEBUGFS_FWSTATS_FILE(aes, encrypt_fail, 20, "%u"); 198DEBUGFS_FWSTATS_FILE(aes, encrypt_fail, "%u");
191DEBUGFS_FWSTATS_FILE(aes, decrypt_fail, 20, "%u"); 199DEBUGFS_FWSTATS_FILE(aes, decrypt_fail, "%u");
192DEBUGFS_FWSTATS_FILE(aes, encrypt_packets, 20, "%u"); 200DEBUGFS_FWSTATS_FILE(aes, encrypt_packets, "%u");
193DEBUGFS_FWSTATS_FILE(aes, decrypt_packets, 20, "%u"); 201DEBUGFS_FWSTATS_FILE(aes, decrypt_packets, "%u");
194DEBUGFS_FWSTATS_FILE(aes, encrypt_interrupt, 20, "%u"); 202DEBUGFS_FWSTATS_FILE(aes, encrypt_interrupt, "%u");
195DEBUGFS_FWSTATS_FILE(aes, decrypt_interrupt, 20, "%u"); 203DEBUGFS_FWSTATS_FILE(aes, decrypt_interrupt, "%u");
196 204
197DEBUGFS_FWSTATS_FILE(event, heart_beat, 20, "%u"); 205DEBUGFS_FWSTATS_FILE(event, heart_beat, "%u");
198DEBUGFS_FWSTATS_FILE(event, calibration, 20, "%u"); 206DEBUGFS_FWSTATS_FILE(event, calibration, "%u");
199DEBUGFS_FWSTATS_FILE(event, rx_mismatch, 20, "%u"); 207DEBUGFS_FWSTATS_FILE(event, rx_mismatch, "%u");
200DEBUGFS_FWSTATS_FILE(event, rx_mem_empty, 20, "%u"); 208DEBUGFS_FWSTATS_FILE(event, rx_mem_empty, "%u");
201DEBUGFS_FWSTATS_FILE(event, rx_pool, 20, "%u"); 209DEBUGFS_FWSTATS_FILE(event, rx_pool, "%u");
202DEBUGFS_FWSTATS_FILE(event, oom_late, 20, "%u"); 210DEBUGFS_FWSTATS_FILE(event, oom_late, "%u");
203DEBUGFS_FWSTATS_FILE(event, phy_transmit_error, 20, "%u"); 211DEBUGFS_FWSTATS_FILE(event, phy_transmit_error, "%u");
204DEBUGFS_FWSTATS_FILE(event, tx_stuck, 20, "%u"); 212DEBUGFS_FWSTATS_FILE(event, tx_stuck, "%u");
205 213
206DEBUGFS_FWSTATS_FILE(ps, pspoll_timeouts, 20, "%u"); 214DEBUGFS_FWSTATS_FILE(ps, pspoll_timeouts, "%u");
207DEBUGFS_FWSTATS_FILE(ps, upsd_timeouts, 20, "%u"); 215DEBUGFS_FWSTATS_FILE(ps, upsd_timeouts, "%u");
208DEBUGFS_FWSTATS_FILE(ps, upsd_max_sptime, 20, "%u"); 216DEBUGFS_FWSTATS_FILE(ps, upsd_max_sptime, "%u");
209DEBUGFS_FWSTATS_FILE(ps, upsd_max_apturn, 20, "%u"); 217DEBUGFS_FWSTATS_FILE(ps, upsd_max_apturn, "%u");
210DEBUGFS_FWSTATS_FILE(ps, pspoll_max_apturn, 20, "%u"); 218DEBUGFS_FWSTATS_FILE(ps, pspoll_max_apturn, "%u");
211DEBUGFS_FWSTATS_FILE(ps, pspoll_utilization, 20, "%u"); 219DEBUGFS_FWSTATS_FILE(ps, pspoll_utilization, "%u");
212DEBUGFS_FWSTATS_FILE(ps, upsd_utilization, 20, "%u"); 220DEBUGFS_FWSTATS_FILE(ps, upsd_utilization, "%u");
213 221
214DEBUGFS_FWSTATS_FILE(rxpipe, rx_prep_beacon_drop, 20, "%u"); 222DEBUGFS_FWSTATS_FILE(rxpipe, rx_prep_beacon_drop, "%u");
215DEBUGFS_FWSTATS_FILE(rxpipe, descr_host_int_trig_rx_data, 20, "%u"); 223DEBUGFS_FWSTATS_FILE(rxpipe, descr_host_int_trig_rx_data, "%u");
216DEBUGFS_FWSTATS_FILE(rxpipe, beacon_buffer_thres_host_int_trig_rx_data, 224DEBUGFS_FWSTATS_FILE(rxpipe, beacon_buffer_thres_host_int_trig_rx_data, "%u");
217 20, "%u"); 225DEBUGFS_FWSTATS_FILE(rxpipe, missed_beacon_host_int_trig_rx_data, "%u");
218DEBUGFS_FWSTATS_FILE(rxpipe, missed_beacon_host_int_trig_rx_data, 20, "%u"); 226DEBUGFS_FWSTATS_FILE(rxpipe, tx_xfr_host_int_trig_rx_data, "%u");
219DEBUGFS_FWSTATS_FILE(rxpipe, tx_xfr_host_int_trig_rx_data, 20, "%u"); 227
220 228DEBUGFS_READONLY_FILE(retry_count, "%u", wl->stats.retry_count);
221DEBUGFS_READONLY_FILE(retry_count, 20, "%u", wl->stats.retry_count); 229DEBUGFS_READONLY_FILE(excessive_retries, "%u",
222DEBUGFS_READONLY_FILE(excessive_retries, 20, "%u",
223 wl->stats.excessive_retries); 230 wl->stats.excessive_retries);
224 231
225static ssize_t tx_queue_len_read(struct file *file, char __user *userbuf, 232static ssize_t tx_queue_len_read(struct file *file, char __user *userbuf,