diff options
author | Janusz Dziedzic <janusz.dziedzic@tieto.com> | 2013-11-20 02:59:41 -0500 |
---|---|---|
committer | Kalle Valo <kvalo@qca.qualcomm.com> | 2013-11-20 02:59:41 -0500 |
commit | 9702c686081240bff1f05150c78335152d37ac8d (patch) | |
tree | fec0e4e91baf4545aa7efb0de7455fc3d7a4f270 /drivers/net/wireless/ath/ath10k/debug.c | |
parent | 5d04e4120a6ef2eac3a3a80bda6a16bb90f2da2c (diff) |
ath10k: add phyerr/dfs handling
Handle phyerr, dfs event, radar_report and fft_report.
Add also debugfs dfs_simulate_radar and dfs_stats files.
Use ath dfs pattern detector.
Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath10k/debug.c')
-rw-r--r-- | drivers/net/wireless/ath/ath10k/debug.c | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c index 760ff2289e3c..13705d41795e 100644 --- a/drivers/net/wireless/ath/ath10k/debug.c +++ b/drivers/net/wireless/ath/ath10k/debug.c | |||
@@ -639,6 +639,86 @@ void ath10k_debug_stop(struct ath10k *ar) | |||
639 | cancel_delayed_work(&ar->debug.htt_stats_dwork); | 639 | cancel_delayed_work(&ar->debug.htt_stats_dwork); |
640 | } | 640 | } |
641 | 641 | ||
642 | static ssize_t ath10k_write_simulate_radar(struct file *file, | ||
643 | const char __user *user_buf, | ||
644 | size_t count, loff_t *ppos) | ||
645 | { | ||
646 | struct ath10k *ar = file->private_data; | ||
647 | |||
648 | ieee80211_radar_detected(ar->hw); | ||
649 | |||
650 | return count; | ||
651 | } | ||
652 | |||
653 | static const struct file_operations fops_simulate_radar = { | ||
654 | .write = ath10k_write_simulate_radar, | ||
655 | .open = simple_open, | ||
656 | .owner = THIS_MODULE, | ||
657 | .llseek = default_llseek, | ||
658 | }; | ||
659 | |||
660 | #define ATH10K_DFS_STAT(s, p) (\ | ||
661 | len += scnprintf(buf + len, size - len, "%-28s : %10u\n", s, \ | ||
662 | ar->debug.dfs_stats.p)) | ||
663 | |||
664 | #define ATH10K_DFS_POOL_STAT(s, p) (\ | ||
665 | len += scnprintf(buf + len, size - len, "%-28s : %10u\n", s, \ | ||
666 | ar->debug.dfs_pool_stats.p)) | ||
667 | |||
668 | static ssize_t ath10k_read_dfs_stats(struct file *file, char __user *user_buf, | ||
669 | size_t count, loff_t *ppos) | ||
670 | { | ||
671 | int retval = 0, len = 0; | ||
672 | const int size = 8000; | ||
673 | struct ath10k *ar = file->private_data; | ||
674 | char *buf; | ||
675 | |||
676 | buf = kzalloc(size, GFP_KERNEL); | ||
677 | if (buf == NULL) | ||
678 | return -ENOMEM; | ||
679 | |||
680 | if (!ar->dfs_detector) { | ||
681 | len += scnprintf(buf + len, size - len, "DFS not enabled\n"); | ||
682 | goto exit; | ||
683 | } | ||
684 | |||
685 | ar->debug.dfs_pool_stats = | ||
686 | ar->dfs_detector->get_stats(ar->dfs_detector); | ||
687 | |||
688 | len += scnprintf(buf + len, size - len, "Pulse detector statistics:\n"); | ||
689 | |||
690 | ATH10K_DFS_STAT("reported phy errors", phy_errors); | ||
691 | ATH10K_DFS_STAT("pulse events reported", pulses_total); | ||
692 | ATH10K_DFS_STAT("DFS pulses detected", pulses_detected); | ||
693 | ATH10K_DFS_STAT("DFS pulses discarded", pulses_discarded); | ||
694 | ATH10K_DFS_STAT("Radars detected", radar_detected); | ||
695 | |||
696 | len += scnprintf(buf + len, size - len, "Global Pool statistics:\n"); | ||
697 | ATH10K_DFS_POOL_STAT("Pool references", pool_reference); | ||
698 | ATH10K_DFS_POOL_STAT("Pulses allocated", pulse_allocated); | ||
699 | ATH10K_DFS_POOL_STAT("Pulses alloc error", pulse_alloc_error); | ||
700 | ATH10K_DFS_POOL_STAT("Pulses in use", pulse_used); | ||
701 | ATH10K_DFS_POOL_STAT("Seqs. allocated", pseq_allocated); | ||
702 | ATH10K_DFS_POOL_STAT("Seqs. alloc error", pseq_alloc_error); | ||
703 | ATH10K_DFS_POOL_STAT("Seqs. in use", pseq_used); | ||
704 | |||
705 | exit: | ||
706 | if (len > size) | ||
707 | len = size; | ||
708 | |||
709 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
710 | kfree(buf); | ||
711 | |||
712 | return retval; | ||
713 | } | ||
714 | |||
715 | static const struct file_operations fops_dfs_stats = { | ||
716 | .read = ath10k_read_dfs_stats, | ||
717 | .open = simple_open, | ||
718 | .owner = THIS_MODULE, | ||
719 | .llseek = default_llseek, | ||
720 | }; | ||
721 | |||
642 | int ath10k_debug_create(struct ath10k *ar) | 722 | int ath10k_debug_create(struct ath10k *ar) |
643 | { | 723 | { |
644 | ar->debug.debugfs_phy = debugfs_create_dir("ath10k", | 724 | ar->debug.debugfs_phy = debugfs_create_dir("ath10k", |
@@ -667,6 +747,16 @@ int ath10k_debug_create(struct ath10k *ar) | |||
667 | debugfs_create_file("htt_stats_mask", S_IRUSR, ar->debug.debugfs_phy, | 747 | debugfs_create_file("htt_stats_mask", S_IRUSR, ar->debug.debugfs_phy, |
668 | ar, &fops_htt_stats_mask); | 748 | ar, &fops_htt_stats_mask); |
669 | 749 | ||
750 | if (config_enabled(CONFIG_ATH10K_DFS_CERTIFIED)) { | ||
751 | debugfs_create_file("dfs_simulate_radar", S_IWUSR, | ||
752 | ar->debug.debugfs_phy, ar, | ||
753 | &fops_simulate_radar); | ||
754 | |||
755 | debugfs_create_file("dfs_stats", S_IRUSR, | ||
756 | ar->debug.debugfs_phy, ar, | ||
757 | &fops_dfs_stats); | ||
758 | } | ||
759 | |||
670 | return 0; | 760 | return 0; |
671 | } | 761 | } |
672 | 762 | ||