diff options
author | Eliad Peller <eliad@wizery.com> | 2011-10-31 06:24:49 -0400 |
---|---|---|
committer | Luciano Coelho <coelho@ti.com> | 2011-11-08 08:36:46 -0500 |
commit | fa5e13756ad5112842bd5e765d66b6c6074b74b7 (patch) | |
tree | 1d9939c11ed6ffaa961955f7e2026136cc6c4021 /drivers/net/wireless/wl12xx | |
parent | a693534b1a46ee934606cec52b12baeaebba0342 (diff) |
wl12xx: add vifs_state debugfs key
Add debugfs key to dump information regarding the
active vifs (similar to the driver_state debugfs key)
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
Diffstat (limited to 'drivers/net/wireless/wl12xx')
-rw-r--r-- | drivers/net/wireless/wl12xx/debugfs.c | 110 |
1 files changed, 110 insertions, 0 deletions
diff --git a/drivers/net/wireless/wl12xx/debugfs.c b/drivers/net/wireless/wl12xx/debugfs.c index a9e0b7383bb5..2e14b436101f 100644 --- a/drivers/net/wireless/wl12xx/debugfs.c +++ b/drivers/net/wireless/wl12xx/debugfs.c | |||
@@ -385,6 +385,115 @@ static const struct file_operations driver_state_ops = { | |||
385 | .llseek = default_llseek, | 385 | .llseek = default_llseek, |
386 | }; | 386 | }; |
387 | 387 | ||
388 | static ssize_t vifs_state_read(struct file *file, char __user *user_buf, | ||
389 | size_t count, loff_t *ppos) | ||
390 | { | ||
391 | struct wl1271 *wl = file->private_data; | ||
392 | struct wl12xx_vif *wlvif; | ||
393 | int ret, res = 0; | ||
394 | const int buf_size = 4096; | ||
395 | char *buf; | ||
396 | char tmp_buf[64]; | ||
397 | |||
398 | buf = kzalloc(buf_size, GFP_KERNEL); | ||
399 | if (!buf) | ||
400 | return -ENOMEM; | ||
401 | |||
402 | mutex_lock(&wl->mutex); | ||
403 | |||
404 | #define VIF_STATE_PRINT(x, fmt) \ | ||
405 | (res += scnprintf(buf + res, buf_size - res, \ | ||
406 | #x " = " fmt "\n", wlvif->x)) | ||
407 | |||
408 | #define VIF_STATE_PRINT_LONG(x) VIF_STATE_PRINT(x, "%ld") | ||
409 | #define VIF_STATE_PRINT_INT(x) VIF_STATE_PRINT(x, "%d") | ||
410 | #define VIF_STATE_PRINT_STR(x) VIF_STATE_PRINT(x, "%s") | ||
411 | #define VIF_STATE_PRINT_LHEX(x) VIF_STATE_PRINT(x, "0x%lx") | ||
412 | #define VIF_STATE_PRINT_LLHEX(x) VIF_STATE_PRINT(x, "0x%llx") | ||
413 | #define VIF_STATE_PRINT_HEX(x) VIF_STATE_PRINT(x, "0x%x") | ||
414 | |||
415 | #define VIF_STATE_PRINT_NSTR(x, len) \ | ||
416 | do { \ | ||
417 | memset(tmp_buf, 0, sizeof(tmp_buf)); \ | ||
418 | memcpy(tmp_buf, wlvif->x, \ | ||
419 | min_t(u8, len, sizeof(tmp_buf) - 1)); \ | ||
420 | res += scnprintf(buf + res, buf_size - res, \ | ||
421 | #x " = %s\n", tmp_buf); \ | ||
422 | } while (0) | ||
423 | |||
424 | wl12xx_for_each_wlvif(wl, wlvif) { | ||
425 | VIF_STATE_PRINT_INT(role_id); | ||
426 | VIF_STATE_PRINT_INT(bss_type); | ||
427 | VIF_STATE_PRINT_LHEX(flags); | ||
428 | VIF_STATE_PRINT_INT(p2p); | ||
429 | VIF_STATE_PRINT_INT(dev_role_id); | ||
430 | VIF_STATE_PRINT_INT(dev_hlid); | ||
431 | |||
432 | if (wlvif->bss_type == BSS_TYPE_STA_BSS || | ||
433 | wlvif->bss_type == BSS_TYPE_IBSS) { | ||
434 | VIF_STATE_PRINT_INT(sta.hlid); | ||
435 | VIF_STATE_PRINT_INT(sta.ba_rx_bitmap); | ||
436 | VIF_STATE_PRINT_INT(sta.basic_rate_idx); | ||
437 | VIF_STATE_PRINT_INT(sta.ap_rate_idx); | ||
438 | VIF_STATE_PRINT_INT(sta.p2p_rate_idx); | ||
439 | } else { | ||
440 | VIF_STATE_PRINT_INT(ap.global_hlid); | ||
441 | VIF_STATE_PRINT_INT(ap.bcast_hlid); | ||
442 | VIF_STATE_PRINT_LHEX(ap.sta_hlid_map[0]); | ||
443 | VIF_STATE_PRINT_INT(ap.mgmt_rate_idx); | ||
444 | VIF_STATE_PRINT_INT(ap.bcast_rate_idx); | ||
445 | VIF_STATE_PRINT_INT(ap.ucast_rate_idx[0]); | ||
446 | VIF_STATE_PRINT_INT(ap.ucast_rate_idx[1]); | ||
447 | VIF_STATE_PRINT_INT(ap.ucast_rate_idx[2]); | ||
448 | VIF_STATE_PRINT_INT(ap.ucast_rate_idx[3]); | ||
449 | } | ||
450 | VIF_STATE_PRINT_INT(last_tx_hlid); | ||
451 | VIF_STATE_PRINT_LHEX(links_map[0]); | ||
452 | VIF_STATE_PRINT_NSTR(ssid, wlvif->ssid_len); | ||
453 | VIF_STATE_PRINT_INT(band); | ||
454 | VIF_STATE_PRINT_INT(channel); | ||
455 | VIF_STATE_PRINT_HEX(bitrate_masks[0]); | ||
456 | VIF_STATE_PRINT_HEX(bitrate_masks[1]); | ||
457 | VIF_STATE_PRINT_HEX(basic_rate_set); | ||
458 | VIF_STATE_PRINT_HEX(basic_rate); | ||
459 | VIF_STATE_PRINT_HEX(rate_set); | ||
460 | VIF_STATE_PRINT_INT(beacon_int); | ||
461 | VIF_STATE_PRINT_INT(default_key); | ||
462 | VIF_STATE_PRINT_INT(aid); | ||
463 | VIF_STATE_PRINT_INT(session_counter); | ||
464 | VIF_STATE_PRINT_INT(ps_poll_failures); | ||
465 | VIF_STATE_PRINT_INT(psm_entry_retry); | ||
466 | VIF_STATE_PRINT_INT(power_level); | ||
467 | VIF_STATE_PRINT_INT(rssi_thold); | ||
468 | VIF_STATE_PRINT_INT(last_rssi_event); | ||
469 | VIF_STATE_PRINT_INT(ba_support); | ||
470 | VIF_STATE_PRINT_INT(ba_allowed); | ||
471 | VIF_STATE_PRINT_LLHEX(tx_security_seq); | ||
472 | VIF_STATE_PRINT_INT(tx_security_last_seq_lsb); | ||
473 | } | ||
474 | |||
475 | #undef VIF_STATE_PRINT_INT | ||
476 | #undef VIF_STATE_PRINT_LONG | ||
477 | #undef VIF_STATE_PRINT_HEX | ||
478 | #undef VIF_STATE_PRINT_LHEX | ||
479 | #undef VIF_STATE_PRINT_LLHEX | ||
480 | #undef VIF_STATE_PRINT_STR | ||
481 | #undef VIF_STATE_PRINT_NSTR | ||
482 | #undef VIF_STATE_PRINT | ||
483 | |||
484 | mutex_unlock(&wl->mutex); | ||
485 | |||
486 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, res); | ||
487 | kfree(buf); | ||
488 | return ret; | ||
489 | } | ||
490 | |||
491 | static const struct file_operations vifs_state_ops = { | ||
492 | .read = vifs_state_read, | ||
493 | .open = wl1271_open_file_generic, | ||
494 | .llseek = default_llseek, | ||
495 | }; | ||
496 | |||
388 | static ssize_t dtim_interval_read(struct file *file, char __user *user_buf, | 497 | static ssize_t dtim_interval_read(struct file *file, char __user *user_buf, |
389 | size_t count, loff_t *ppos) | 498 | size_t count, loff_t *ppos) |
390 | { | 499 | { |
@@ -765,6 +874,7 @@ static int wl1271_debugfs_add_files(struct wl1271 *wl, | |||
765 | DEBUGFS_ADD(gpio_power, rootdir); | 874 | DEBUGFS_ADD(gpio_power, rootdir); |
766 | DEBUGFS_ADD(start_recovery, rootdir); | 875 | DEBUGFS_ADD(start_recovery, rootdir); |
767 | DEBUGFS_ADD(driver_state, rootdir); | 876 | DEBUGFS_ADD(driver_state, rootdir); |
877 | DEBUGFS_ADD(vifs_state, rootdir); | ||
768 | DEBUGFS_ADD(dtim_interval, rootdir); | 878 | DEBUGFS_ADD(dtim_interval, rootdir); |
769 | DEBUGFS_ADD(beacon_interval, rootdir); | 879 | DEBUGFS_ADD(beacon_interval, rootdir); |
770 | DEBUGFS_ADD(beacon_filtering, rootdir); | 880 | DEBUGFS_ADD(beacon_filtering, rootdir); |