aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/wl12xx/debugfs.c181
-rw-r--r--drivers/net/wireless/wl12xx/wl12xx.h104
2 files changed, 32 insertions, 253 deletions
diff --git a/drivers/net/wireless/wl12xx/debugfs.c b/drivers/net/wireless/wl12xx/debugfs.c
index dd71b7d2105c..402df14e091b 100644
--- a/drivers/net/wireless/wl12xx/debugfs.c
+++ b/drivers/net/wireless/wl12xx/debugfs.c
@@ -66,19 +66,10 @@ static const struct file_operations name## _ops = { \
66}; 66};
67 67
68#define DEBUGFS_ADD(name, parent) \ 68#define DEBUGFS_ADD(name, parent) \
69 wl->debugfs.name = debugfs_create_file(#name, 0400, parent, \ 69 entry = debugfs_create_file(#name, 0400, parent, \
70 wl, &name## _ops); \ 70 wl, &name## _ops); \
71 if (IS_ERR(wl->debugfs.name)) { \ 71 if (!entry || IS_ERR(entry)) \
72 ret = PTR_ERR(wl->debugfs.name); \ 72 goto err; \
73 wl->debugfs.name = NULL; \
74 goto out; \
75 }
76
77#define DEBUGFS_DEL(name) \
78 do { \
79 debugfs_remove(wl->debugfs.name); \
80 wl->debugfs.name = NULL; \
81 } while (0)
82 73
83#define DEBUGFS_FWSTATS_FILE(sub, name, fmt) \ 74#define DEBUGFS_FWSTATS_FILE(sub, name, fmt) \
84static ssize_t sub## _ ##name## _read(struct file *file, \ 75static ssize_t sub## _ ##name## _read(struct file *file, \
@@ -100,10 +91,7 @@ static const struct file_operations sub## _ ##name## _ops = { \
100}; 91};
101 92
102#define DEBUGFS_FWSTATS_ADD(sub, name) \ 93#define DEBUGFS_FWSTATS_ADD(sub, name) \
103 DEBUGFS_ADD(sub## _ ##name, wl->debugfs.fw_statistics) 94 DEBUGFS_ADD(sub## _ ##name, stats)
104
105#define DEBUGFS_FWSTATS_DEL(sub, name) \
106 DEBUGFS_DEL(sub## _ ##name)
107 95
108static void wl1271_debugfs_update_stats(struct wl1271 *wl) 96static void wl1271_debugfs_update_stats(struct wl1271 *wl)
109{ 97{
@@ -305,109 +293,16 @@ static const struct file_operations gpio_power_ops = {
305 .llseek = default_llseek, 293 .llseek = default_llseek,
306}; 294};
307 295
308static void wl1271_debugfs_delete_files(struct wl1271 *wl)
309{
310 DEBUGFS_FWSTATS_DEL(tx, internal_desc_overflow);
311
312 DEBUGFS_FWSTATS_DEL(rx, out_of_mem);
313 DEBUGFS_FWSTATS_DEL(rx, hdr_overflow);
314 DEBUGFS_FWSTATS_DEL(rx, hw_stuck);
315 DEBUGFS_FWSTATS_DEL(rx, dropped);
316 DEBUGFS_FWSTATS_DEL(rx, fcs_err);
317 DEBUGFS_FWSTATS_DEL(rx, xfr_hint_trig);
318 DEBUGFS_FWSTATS_DEL(rx, path_reset);
319 DEBUGFS_FWSTATS_DEL(rx, reset_counter);
320
321 DEBUGFS_FWSTATS_DEL(dma, rx_requested);
322 DEBUGFS_FWSTATS_DEL(dma, rx_errors);
323 DEBUGFS_FWSTATS_DEL(dma, tx_requested);
324 DEBUGFS_FWSTATS_DEL(dma, tx_errors);
325
326 DEBUGFS_FWSTATS_DEL(isr, cmd_cmplt);
327 DEBUGFS_FWSTATS_DEL(isr, fiqs);
328 DEBUGFS_FWSTATS_DEL(isr, rx_headers);
329 DEBUGFS_FWSTATS_DEL(isr, rx_mem_overflow);
330 DEBUGFS_FWSTATS_DEL(isr, rx_rdys);
331 DEBUGFS_FWSTATS_DEL(isr, irqs);
332 DEBUGFS_FWSTATS_DEL(isr, tx_procs);
333 DEBUGFS_FWSTATS_DEL(isr, decrypt_done);
334 DEBUGFS_FWSTATS_DEL(isr, dma0_done);
335 DEBUGFS_FWSTATS_DEL(isr, dma1_done);
336 DEBUGFS_FWSTATS_DEL(isr, tx_exch_complete);
337 DEBUGFS_FWSTATS_DEL(isr, commands);
338 DEBUGFS_FWSTATS_DEL(isr, rx_procs);
339 DEBUGFS_FWSTATS_DEL(isr, hw_pm_mode_changes);
340 DEBUGFS_FWSTATS_DEL(isr, host_acknowledges);
341 DEBUGFS_FWSTATS_DEL(isr, pci_pm);
342 DEBUGFS_FWSTATS_DEL(isr, wakeups);
343 DEBUGFS_FWSTATS_DEL(isr, low_rssi);
344
345 DEBUGFS_FWSTATS_DEL(wep, addr_key_count);
346 DEBUGFS_FWSTATS_DEL(wep, default_key_count);
347 /* skipping wep.reserved */
348 DEBUGFS_FWSTATS_DEL(wep, key_not_found);
349 DEBUGFS_FWSTATS_DEL(wep, decrypt_fail);
350 DEBUGFS_FWSTATS_DEL(wep, packets);
351 DEBUGFS_FWSTATS_DEL(wep, interrupt);
352
353 DEBUGFS_FWSTATS_DEL(pwr, ps_enter);
354 DEBUGFS_FWSTATS_DEL(pwr, elp_enter);
355 DEBUGFS_FWSTATS_DEL(pwr, missing_bcns);
356 DEBUGFS_FWSTATS_DEL(pwr, wake_on_host);
357 DEBUGFS_FWSTATS_DEL(pwr, wake_on_timer_exp);
358 DEBUGFS_FWSTATS_DEL(pwr, tx_with_ps);
359 DEBUGFS_FWSTATS_DEL(pwr, tx_without_ps);
360 DEBUGFS_FWSTATS_DEL(pwr, rcvd_beacons);
361 DEBUGFS_FWSTATS_DEL(pwr, power_save_off);
362 DEBUGFS_FWSTATS_DEL(pwr, enable_ps);
363 DEBUGFS_FWSTATS_DEL(pwr, disable_ps);
364 DEBUGFS_FWSTATS_DEL(pwr, fix_tsf_ps);
365 /* skipping cont_miss_bcns_spread for now */
366 DEBUGFS_FWSTATS_DEL(pwr, rcvd_awake_beacons);
367
368 DEBUGFS_FWSTATS_DEL(mic, rx_pkts);
369 DEBUGFS_FWSTATS_DEL(mic, calc_failure);
370
371 DEBUGFS_FWSTATS_DEL(aes, encrypt_fail);
372 DEBUGFS_FWSTATS_DEL(aes, decrypt_fail);
373 DEBUGFS_FWSTATS_DEL(aes, encrypt_packets);
374 DEBUGFS_FWSTATS_DEL(aes, decrypt_packets);
375 DEBUGFS_FWSTATS_DEL(aes, encrypt_interrupt);
376 DEBUGFS_FWSTATS_DEL(aes, decrypt_interrupt);
377
378 DEBUGFS_FWSTATS_DEL(event, heart_beat);
379 DEBUGFS_FWSTATS_DEL(event, calibration);
380 DEBUGFS_FWSTATS_DEL(event, rx_mismatch);
381 DEBUGFS_FWSTATS_DEL(event, rx_mem_empty);
382 DEBUGFS_FWSTATS_DEL(event, rx_pool);
383 DEBUGFS_FWSTATS_DEL(event, oom_late);
384 DEBUGFS_FWSTATS_DEL(event, phy_transmit_error);
385 DEBUGFS_FWSTATS_DEL(event, tx_stuck);
386
387 DEBUGFS_FWSTATS_DEL(ps, pspoll_timeouts);
388 DEBUGFS_FWSTATS_DEL(ps, upsd_timeouts);
389 DEBUGFS_FWSTATS_DEL(ps, upsd_max_sptime);
390 DEBUGFS_FWSTATS_DEL(ps, upsd_max_apturn);
391 DEBUGFS_FWSTATS_DEL(ps, pspoll_max_apturn);
392 DEBUGFS_FWSTATS_DEL(ps, pspoll_utilization);
393 DEBUGFS_FWSTATS_DEL(ps, upsd_utilization);
394
395 DEBUGFS_FWSTATS_DEL(rxpipe, rx_prep_beacon_drop);
396 DEBUGFS_FWSTATS_DEL(rxpipe, descr_host_int_trig_rx_data);
397 DEBUGFS_FWSTATS_DEL(rxpipe, beacon_buffer_thres_host_int_trig_rx_data);
398 DEBUGFS_FWSTATS_DEL(rxpipe, missed_beacon_host_int_trig_rx_data);
399 DEBUGFS_FWSTATS_DEL(rxpipe, tx_xfr_host_int_trig_rx_data);
400
401 DEBUGFS_DEL(tx_queue_len);
402 DEBUGFS_DEL(retry_count);
403 DEBUGFS_DEL(excessive_retries);
404
405 DEBUGFS_DEL(gpio_power);
406}
407
408static int wl1271_debugfs_add_files(struct wl1271 *wl) 296static int wl1271_debugfs_add_files(struct wl1271 *wl)
409{ 297{
410 int ret = 0; 298 int ret = 0;
299 struct dentry *entry, *stats;
300
301 stats = debugfs_create_dir("fw-statistics", wl->rootdir);
302 if (!stats || IS_ERR(stats)) {
303 entry = stats;
304 goto err;
305 }
411 306
412 DEBUGFS_FWSTATS_ADD(tx, internal_desc_overflow); 307 DEBUGFS_FWSTATS_ADD(tx, internal_desc_overflow);
413 308
@@ -500,15 +395,19 @@ static int wl1271_debugfs_add_files(struct wl1271 *wl)
500 DEBUGFS_FWSTATS_ADD(rxpipe, missed_beacon_host_int_trig_rx_data); 395 DEBUGFS_FWSTATS_ADD(rxpipe, missed_beacon_host_int_trig_rx_data);
501 DEBUGFS_FWSTATS_ADD(rxpipe, tx_xfr_host_int_trig_rx_data); 396 DEBUGFS_FWSTATS_ADD(rxpipe, tx_xfr_host_int_trig_rx_data);
502 397
503 DEBUGFS_ADD(tx_queue_len, wl->debugfs.rootdir); 398 DEBUGFS_ADD(tx_queue_len, wl->rootdir);
504 DEBUGFS_ADD(retry_count, wl->debugfs.rootdir); 399 DEBUGFS_ADD(retry_count, wl->rootdir);
505 DEBUGFS_ADD(excessive_retries, wl->debugfs.rootdir); 400 DEBUGFS_ADD(excessive_retries, wl->rootdir);
506 401
507 DEBUGFS_ADD(gpio_power, wl->debugfs.rootdir); 402 DEBUGFS_ADD(gpio_power, wl->rootdir);
508 403
509out: 404 return 0;
510 if (ret < 0) 405
511 wl1271_debugfs_delete_files(wl); 406err:
407 if (IS_ERR(entry))
408 ret = PTR_ERR(entry);
409 else
410 ret = -ENOMEM;
512 411
513 return ret; 412 return ret;
514} 413}
@@ -524,23 +423,14 @@ int wl1271_debugfs_init(struct wl1271 *wl)
524{ 423{
525 int ret; 424 int ret;
526 425
527 wl->debugfs.rootdir = debugfs_create_dir(KBUILD_MODNAME, NULL); 426 wl->rootdir = debugfs_create_dir(KBUILD_MODNAME, NULL);
528 427
529 if (IS_ERR(wl->debugfs.rootdir)) { 428 if (IS_ERR(wl->rootdir)) {
530 ret = PTR_ERR(wl->debugfs.rootdir); 429 ret = PTR_ERR(wl->rootdir);
531 wl->debugfs.rootdir = NULL; 430 wl->rootdir = NULL;
532 goto err; 431 goto err;
533 } 432 }
534 433
535 wl->debugfs.fw_statistics = debugfs_create_dir("fw-statistics",
536 wl->debugfs.rootdir);
537
538 if (IS_ERR(wl->debugfs.fw_statistics)) {
539 ret = PTR_ERR(wl->debugfs.fw_statistics);
540 wl->debugfs.fw_statistics = NULL;
541 goto err_root;
542 }
543
544 wl->stats.fw_stats = kzalloc(sizeof(*wl->stats.fw_stats), 434 wl->stats.fw_stats = kzalloc(sizeof(*wl->stats.fw_stats),
545 GFP_KERNEL); 435 GFP_KERNEL);
546 436
@@ -563,12 +453,8 @@ err_file:
563 wl->stats.fw_stats = NULL; 453 wl->stats.fw_stats = NULL;
564 454
565err_fw: 455err_fw:
566 debugfs_remove(wl->debugfs.fw_statistics); 456 debugfs_remove_recursive(wl->rootdir);
567 wl->debugfs.fw_statistics = NULL; 457 wl->rootdir = NULL;
568
569err_root:
570 debugfs_remove(wl->debugfs.rootdir);
571 wl->debugfs.rootdir = NULL;
572 458
573err: 459err:
574 return ret; 460 return ret;
@@ -576,15 +462,10 @@ err:
576 462
577void wl1271_debugfs_exit(struct wl1271 *wl) 463void wl1271_debugfs_exit(struct wl1271 *wl)
578{ 464{
579 wl1271_debugfs_delete_files(wl);
580
581 kfree(wl->stats.fw_stats); 465 kfree(wl->stats.fw_stats);
582 wl->stats.fw_stats = NULL; 466 wl->stats.fw_stats = NULL;
583 467
584 debugfs_remove(wl->debugfs.fw_statistics); 468 debugfs_remove_recursive(wl->rootdir);
585 wl->debugfs.fw_statistics = NULL; 469 wl->rootdir = NULL;
586
587 debugfs_remove(wl->debugfs.rootdir);
588 wl->debugfs.rootdir = NULL;
589 470
590} 471}
diff --git a/drivers/net/wireless/wl12xx/wl12xx.h b/drivers/net/wireless/wl12xx/wl12xx.h
index 9f8aa695c3af..e904c72e8c8f 100644
--- a/drivers/net/wireless/wl12xx/wl12xx.h
+++ b/drivers/net/wireless/wl12xx/wl12xx.h
@@ -174,108 +174,6 @@ struct wl1271_stats {
174 unsigned int excessive_retries; 174 unsigned int excessive_retries;
175}; 175};
176 176
177struct wl1271_debugfs {
178 struct dentry *rootdir;
179 struct dentry *fw_statistics;
180
181 struct dentry *tx_internal_desc_overflow;
182
183 struct dentry *rx_out_of_mem;
184 struct dentry *rx_hdr_overflow;
185 struct dentry *rx_hw_stuck;
186 struct dentry *rx_dropped;
187 struct dentry *rx_fcs_err;
188 struct dentry *rx_xfr_hint_trig;
189 struct dentry *rx_path_reset;
190 struct dentry *rx_reset_counter;
191
192 struct dentry *dma_rx_requested;
193 struct dentry *dma_rx_errors;
194 struct dentry *dma_tx_requested;
195 struct dentry *dma_tx_errors;
196
197 struct dentry *isr_cmd_cmplt;
198 struct dentry *isr_fiqs;
199 struct dentry *isr_rx_headers;
200 struct dentry *isr_rx_mem_overflow;
201 struct dentry *isr_rx_rdys;
202 struct dentry *isr_irqs;
203 struct dentry *isr_tx_procs;
204 struct dentry *isr_decrypt_done;
205 struct dentry *isr_dma0_done;
206 struct dentry *isr_dma1_done;
207 struct dentry *isr_tx_exch_complete;
208 struct dentry *isr_commands;
209 struct dentry *isr_rx_procs;
210 struct dentry *isr_hw_pm_mode_changes;
211 struct dentry *isr_host_acknowledges;
212 struct dentry *isr_pci_pm;
213 struct dentry *isr_wakeups;
214 struct dentry *isr_low_rssi;
215
216 struct dentry *wep_addr_key_count;
217 struct dentry *wep_default_key_count;
218 /* skipping wep.reserved */
219 struct dentry *wep_key_not_found;
220 struct dentry *wep_decrypt_fail;
221 struct dentry *wep_packets;
222 struct dentry *wep_interrupt;
223
224 struct dentry *pwr_ps_enter;
225 struct dentry *pwr_elp_enter;
226 struct dentry *pwr_missing_bcns;
227 struct dentry *pwr_wake_on_host;
228 struct dentry *pwr_wake_on_timer_exp;
229 struct dentry *pwr_tx_with_ps;
230 struct dentry *pwr_tx_without_ps;
231 struct dentry *pwr_rcvd_beacons;
232 struct dentry *pwr_power_save_off;
233 struct dentry *pwr_enable_ps;
234 struct dentry *pwr_disable_ps;
235 struct dentry *pwr_fix_tsf_ps;
236 /* skipping cont_miss_bcns_spread for now */
237 struct dentry *pwr_rcvd_awake_beacons;
238
239 struct dentry *mic_rx_pkts;
240 struct dentry *mic_calc_failure;
241
242 struct dentry *aes_encrypt_fail;
243 struct dentry *aes_decrypt_fail;
244 struct dentry *aes_encrypt_packets;
245 struct dentry *aes_decrypt_packets;
246 struct dentry *aes_encrypt_interrupt;
247 struct dentry *aes_decrypt_interrupt;
248
249 struct dentry *event_heart_beat;
250 struct dentry *event_calibration;
251 struct dentry *event_rx_mismatch;
252 struct dentry *event_rx_mem_empty;
253 struct dentry *event_rx_pool;
254 struct dentry *event_oom_late;
255 struct dentry *event_phy_transmit_error;
256 struct dentry *event_tx_stuck;
257
258 struct dentry *ps_pspoll_timeouts;
259 struct dentry *ps_upsd_timeouts;
260 struct dentry *ps_upsd_max_sptime;
261 struct dentry *ps_upsd_max_apturn;
262 struct dentry *ps_pspoll_max_apturn;
263 struct dentry *ps_pspoll_utilization;
264 struct dentry *ps_upsd_utilization;
265
266 struct dentry *rxpipe_rx_prep_beacon_drop;
267 struct dentry *rxpipe_descr_host_int_trig_rx_data;
268 struct dentry *rxpipe_beacon_buffer_thres_host_int_trig_rx_data;
269 struct dentry *rxpipe_missed_beacon_host_int_trig_rx_data;
270 struct dentry *rxpipe_tx_xfr_host_int_trig_rx_data;
271
272 struct dentry *tx_queue_len;
273
274 struct dentry *retry_count;
275 struct dentry *excessive_retries;
276 struct dentry *gpio_power;
277};
278
279#define NUM_TX_QUEUES 4 177#define NUM_TX_QUEUES 4
280#define NUM_RX_PKT_DESC 8 178#define NUM_RX_PKT_DESC 8
281 179
@@ -478,7 +376,7 @@ struct wl1271 {
478 int last_rssi_event; 376 int last_rssi_event;
479 377
480 struct wl1271_stats stats; 378 struct wl1271_stats stats;
481 struct wl1271_debugfs debugfs; 379 struct dentry *rootdir;
482 380
483 __le32 buffer_32; 381 __le32 buffer_32;
484 u32 buffer_cmd; 382 u32 buffer_cmd;