aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath5k/debug.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-10-23 14:47:02 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-10-23 14:47:02 -0400
commit5f05647dd81c11a6a165ccc8f0c1370b16f3bcb0 (patch)
tree7851ef1c93aa1aba7ef327ca4b75fd35e6d10f29 /drivers/net/wireless/ath/ath5k/debug.c
parent02f36038c568111ad4fc433f6fa760ff5e38fab4 (diff)
parentec37a48d1d16c30b655ac5280209edf52a6775d4 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6: (1699 commits) bnx2/bnx2x: Unsupported Ethtool operations should return -EINVAL. vlan: Calling vlan_hwaccel_do_receive() is always valid. tproxy: use the interface primary IP address as a default value for --on-ip tproxy: added IPv6 support to the socket match cxgb3: function namespace cleanup tproxy: added IPv6 support to the TPROXY target tproxy: added IPv6 socket lookup function to nf_tproxy_core be2net: Changes to use only priority codes allowed by f/w tproxy: allow non-local binds of IPv6 sockets if IP_TRANSPARENT is enabled tproxy: added tproxy sockopt interface in the IPV6 layer tproxy: added udp6_lib_lookup function tproxy: added const specifiers to udp lookup functions tproxy: split off ipv6 defragmentation to a separate module l2tp: small cleanup nf_nat: restrict ICMP translation for embedded header can: mcp251x: fix generation of error frames can: mcp251x: fix endless loop in interrupt handler if CANINTF_MERRF is set can-raw: add msg_flags to distinguish local traffic 9p: client code cleanup rds: make local functions/variables static ... Fix up conflicts in net/core/dev.c, drivers/net/pcmcia/smc91c92_cs.c and drivers/net/wireless/ath/ath9k/debug.c as per David
Diffstat (limited to 'drivers/net/wireless/ath/ath5k/debug.c')
-rw-r--r--drivers/net/wireless/ath/ath5k/debug.c121
1 files changed, 89 insertions, 32 deletions
diff --git a/drivers/net/wireless/ath/ath5k/debug.c b/drivers/net/wireless/ath/ath5k/debug.c
index fb339c3852ee..acda56ee521b 100644
--- a/drivers/net/wireless/ath/ath5k/debug.c
+++ b/drivers/net/wireless/ath/ath5k/debug.c
@@ -60,6 +60,7 @@
60 60
61#include "base.h" 61#include "base.h"
62#include "debug.h" 62#include "debug.h"
63#include "../debug.h"
63 64
64static unsigned int ath5k_debug; 65static unsigned int ath5k_debug;
65module_param_named(debug, ath5k_debug, uint, 0); 66module_param_named(debug, ath5k_debug, uint, 0);
@@ -71,8 +72,6 @@ module_param_named(debug, ath5k_debug, uint, 0);
71#include "reg.h" 72#include "reg.h"
72#include "ani.h" 73#include "ani.h"
73 74
74static struct dentry *ath5k_global_debugfs;
75
76static int ath5k_debugfs_open(struct inode *inode, struct file *file) 75static int ath5k_debugfs_open(struct inode *inode, struct file *file)
77{ 76{
78 file->private_data = inode->i_private; 77 file->private_data = inode->i_private;
@@ -314,6 +313,7 @@ static const struct {
314 { ATH5K_DEBUG_DUMP_TX, "dumptx", "print transmit skb content" }, 313 { ATH5K_DEBUG_DUMP_TX, "dumptx", "print transmit skb content" },
315 { ATH5K_DEBUG_DUMPBANDS, "dumpbands", "dump bands" }, 314 { ATH5K_DEBUG_DUMPBANDS, "dumpbands", "dump bands" },
316 { ATH5K_DEBUG_ANI, "ani", "adaptive noise immunity" }, 315 { ATH5K_DEBUG_ANI, "ani", "adaptive noise immunity" },
316 { ATH5K_DEBUG_DESC, "desc", "descriptor chains" },
317 { ATH5K_DEBUG_ANY, "all", "show all debug levels" }, 317 { ATH5K_DEBUG_ANY, "all", "show all debug levels" },
318}; 318};
319 319
@@ -486,6 +486,60 @@ static const struct file_operations fops_antenna = {
486 .llseek = default_llseek, 486 .llseek = default_llseek,
487}; 487};
488 488
489/* debugfs: misc */
490
491static ssize_t read_file_misc(struct file *file, char __user *user_buf,
492 size_t count, loff_t *ppos)
493{
494 struct ath5k_softc *sc = file->private_data;
495 char buf[700];
496 unsigned int len = 0;
497 u32 filt = ath5k_hw_get_rx_filter(sc->ah);
498
499 len += snprintf(buf+len, sizeof(buf)-len, "bssid-mask: %pM\n",
500 sc->bssidmask);
501 len += snprintf(buf+len, sizeof(buf)-len, "filter-flags: 0x%x ",
502 filt);
503 if (filt & AR5K_RX_FILTER_UCAST)
504 len += snprintf(buf+len, sizeof(buf)-len, " UCAST");
505 if (filt & AR5K_RX_FILTER_MCAST)
506 len += snprintf(buf+len, sizeof(buf)-len, " MCAST");
507 if (filt & AR5K_RX_FILTER_BCAST)
508 len += snprintf(buf+len, sizeof(buf)-len, " BCAST");
509 if (filt & AR5K_RX_FILTER_CONTROL)
510 len += snprintf(buf+len, sizeof(buf)-len, " CONTROL");
511 if (filt & AR5K_RX_FILTER_BEACON)
512 len += snprintf(buf+len, sizeof(buf)-len, " BEACON");
513 if (filt & AR5K_RX_FILTER_PROM)
514 len += snprintf(buf+len, sizeof(buf)-len, " PROM");
515 if (filt & AR5K_RX_FILTER_XRPOLL)
516 len += snprintf(buf+len, sizeof(buf)-len, " XRPOLL");
517 if (filt & AR5K_RX_FILTER_PROBEREQ)
518 len += snprintf(buf+len, sizeof(buf)-len, " PROBEREQ");
519 if (filt & AR5K_RX_FILTER_PHYERR_5212)
520 len += snprintf(buf+len, sizeof(buf)-len, " PHYERR-5212");
521 if (filt & AR5K_RX_FILTER_RADARERR_5212)
522 len += snprintf(buf+len, sizeof(buf)-len, " RADARERR-5212");
523 if (filt & AR5K_RX_FILTER_PHYERR_5211)
524 snprintf(buf+len, sizeof(buf)-len, " PHYERR-5211");
525 if (filt & AR5K_RX_FILTER_RADARERR_5211)
526 len += snprintf(buf+len, sizeof(buf)-len, " RADARERR-5211");
527
528 len += snprintf(buf+len, sizeof(buf)-len, "\nopmode: %s (%d)\n",
529 ath_opmode_to_string(sc->opmode), sc->opmode);
530
531 if (len > sizeof(buf))
532 len = sizeof(buf);
533
534 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
535}
536
537static const struct file_operations fops_misc = {
538 .read = read_file_misc,
539 .open = ath5k_debugfs_open,
540 .owner = THIS_MODULE,
541};
542
489 543
490/* debugfs: frameerrors */ 544/* debugfs: frameerrors */
491 545
@@ -537,6 +591,8 @@ static ssize_t read_file_frameerrors(struct file *file, char __user *user_buf,
537 st->rxerr_jumbo*100/st->rx_all_count : 0); 591 st->rxerr_jumbo*100/st->rx_all_count : 0);
538 len += snprintf(buf+len, sizeof(buf)-len, "[RX all\t%d]\n", 592 len += snprintf(buf+len, sizeof(buf)-len, "[RX all\t%d]\n",
539 st->rx_all_count); 593 st->rx_all_count);
594 len += snprintf(buf+len, sizeof(buf)-len, "RX-all-bytes\t%d\n",
595 st->rx_bytes_count);
540 596
541 len += snprintf(buf+len, sizeof(buf)-len, 597 len += snprintf(buf+len, sizeof(buf)-len,
542 "\nTX\n---------------------\n"); 598 "\nTX\n---------------------\n");
@@ -554,6 +610,8 @@ static ssize_t read_file_frameerrors(struct file *file, char __user *user_buf,
554 st->txerr_filt*100/st->tx_all_count : 0); 610 st->txerr_filt*100/st->tx_all_count : 0);
555 len += snprintf(buf+len, sizeof(buf)-len, "[TX all\t%d]\n", 611 len += snprintf(buf+len, sizeof(buf)-len, "[TX all\t%d]\n",
556 st->tx_all_count); 612 st->tx_all_count);
613 len += snprintf(buf+len, sizeof(buf)-len, "TX-all-bytes\t%d\n",
614 st->tx_bytes_count);
557 615
558 if (len > sizeof(buf)) 616 if (len > sizeof(buf))
559 len = sizeof(buf); 617 len = sizeof(buf);
@@ -662,20 +720,21 @@ static ssize_t read_file_ani(struct file *file, char __user *user_buf,
662 len += snprintf(buf+len, sizeof(buf)-len, 720 len += snprintf(buf+len, sizeof(buf)-len,
663 "beacon RSSI average:\t%d\n", 721 "beacon RSSI average:\t%d\n",
664 sc->ah->ah_beacon_rssi_avg.avg); 722 sc->ah->ah_beacon_rssi_avg.avg);
723
724#define CC_PRINT(_struct, _field) \
725 _struct._field, \
726 _struct.cycles > 0 ? \
727 _struct._field*100/_struct.cycles : 0
728
665 len += snprintf(buf+len, sizeof(buf)-len, "profcnt tx\t\t%u\t(%d%%)\n", 729 len += snprintf(buf+len, sizeof(buf)-len, "profcnt tx\t\t%u\t(%d%%)\n",
666 as->pfc_tx, 730 CC_PRINT(as->last_cc, tx_frame));
667 as->pfc_cycles > 0 ?
668 as->pfc_tx*100/as->pfc_cycles : 0);
669 len += snprintf(buf+len, sizeof(buf)-len, "profcnt rx\t\t%u\t(%d%%)\n", 731 len += snprintf(buf+len, sizeof(buf)-len, "profcnt rx\t\t%u\t(%d%%)\n",
670 as->pfc_rx, 732 CC_PRINT(as->last_cc, rx_frame));
671 as->pfc_cycles > 0 ?
672 as->pfc_rx*100/as->pfc_cycles : 0);
673 len += snprintf(buf+len, sizeof(buf)-len, "profcnt busy\t\t%u\t(%d%%)\n", 733 len += snprintf(buf+len, sizeof(buf)-len, "profcnt busy\t\t%u\t(%d%%)\n",
674 as->pfc_busy, 734 CC_PRINT(as->last_cc, rx_busy));
675 as->pfc_cycles > 0 ? 735#undef CC_PRINT
676 as->pfc_busy*100/as->pfc_cycles : 0);
677 len += snprintf(buf+len, sizeof(buf)-len, "profcnt cycles\t\t%u\n", 736 len += snprintf(buf+len, sizeof(buf)-len, "profcnt cycles\t\t%u\n",
678 as->pfc_cycles); 737 as->last_cc.cycles);
679 len += snprintf(buf+len, sizeof(buf)-len, 738 len += snprintf(buf+len, sizeof(buf)-len,
680 "listen time\t\t%d\tlast: %d\n", 739 "listen time\t\t%d\tlast: %d\n",
681 as->listen_time, as->last_listen); 740 as->listen_time, as->last_listen);
@@ -768,7 +827,7 @@ static ssize_t read_file_queue(struct file *file, char __user *user_buf,
768 827
769 struct ath5k_txq *txq; 828 struct ath5k_txq *txq;
770 struct ath5k_buf *bf, *bf0; 829 struct ath5k_buf *bf, *bf0;
771 int i, n = 0; 830 int i, n;
772 831
773 len += snprintf(buf+len, sizeof(buf)-len, 832 len += snprintf(buf+len, sizeof(buf)-len,
774 "available txbuffers: %d\n", sc->txbuf_len); 833 "available txbuffers: %d\n", sc->txbuf_len);
@@ -782,9 +841,16 @@ static ssize_t read_file_queue(struct file *file, char __user *user_buf,
782 if (!txq->setup) 841 if (!txq->setup)
783 continue; 842 continue;
784 843
844 n = 0;
845 spin_lock_bh(&txq->lock);
785 list_for_each_entry_safe(bf, bf0, &txq->q, list) 846 list_for_each_entry_safe(bf, bf0, &txq->q, list)
786 n++; 847 n++;
787 len += snprintf(buf+len, sizeof(buf)-len, " len: %d\n", n); 848 spin_unlock_bh(&txq->lock);
849
850 len += snprintf(buf+len, sizeof(buf)-len,
851 " len: %d bufs: %d\n", txq->txq_len, n);
852 len += snprintf(buf+len, sizeof(buf)-len,
853 " stuck: %d\n", txq->txq_stuck);
788 } 854 }
789 855
790 if (len > sizeof(buf)) 856 if (len > sizeof(buf))
@@ -821,21 +887,13 @@ static const struct file_operations fops_queue = {
821}; 887};
822 888
823 889
824/* init */
825
826void
827ath5k_debug_init(void)
828{
829 ath5k_global_debugfs = debugfs_create_dir("ath5k", NULL);
830}
831
832void 890void
833ath5k_debug_init_device(struct ath5k_softc *sc) 891ath5k_debug_init_device(struct ath5k_softc *sc)
834{ 892{
835 sc->debug.level = ath5k_debug; 893 sc->debug.level = ath5k_debug;
836 894
837 sc->debug.debugfs_phydir = debugfs_create_dir(wiphy_name(sc->hw->wiphy), 895 sc->debug.debugfs_phydir = debugfs_create_dir("ath5k",
838 ath5k_global_debugfs); 896 sc->hw->wiphy->debugfsdir);
839 897
840 sc->debug.debugfs_debug = debugfs_create_file("debug", 898 sc->debug.debugfs_debug = debugfs_create_file("debug",
841 S_IWUSR | S_IRUSR, 899 S_IWUSR | S_IRUSR,
@@ -855,6 +913,10 @@ ath5k_debug_init_device(struct ath5k_softc *sc)
855 S_IWUSR | S_IRUSR, 913 S_IWUSR | S_IRUSR,
856 sc->debug.debugfs_phydir, sc, &fops_antenna); 914 sc->debug.debugfs_phydir, sc, &fops_antenna);
857 915
916 sc->debug.debugfs_misc = debugfs_create_file("misc",
917 S_IRUSR,
918 sc->debug.debugfs_phydir, sc, &fops_misc);
919
858 sc->debug.debugfs_frameerrors = debugfs_create_file("frameerrors", 920 sc->debug.debugfs_frameerrors = debugfs_create_file("frameerrors",
859 S_IWUSR | S_IRUSR, 921 S_IWUSR | S_IRUSR,
860 sc->debug.debugfs_phydir, sc, 922 sc->debug.debugfs_phydir, sc,
@@ -872,12 +934,6 @@ ath5k_debug_init_device(struct ath5k_softc *sc)
872} 934}
873 935
874void 936void
875ath5k_debug_finish(void)
876{
877 debugfs_remove(ath5k_global_debugfs);
878}
879
880void
881ath5k_debug_finish_device(struct ath5k_softc *sc) 937ath5k_debug_finish_device(struct ath5k_softc *sc)
882{ 938{
883 debugfs_remove(sc->debug.debugfs_debug); 939 debugfs_remove(sc->debug.debugfs_debug);
@@ -885,6 +941,7 @@ ath5k_debug_finish_device(struct ath5k_softc *sc)
885 debugfs_remove(sc->debug.debugfs_beacon); 941 debugfs_remove(sc->debug.debugfs_beacon);
886 debugfs_remove(sc->debug.debugfs_reset); 942 debugfs_remove(sc->debug.debugfs_reset);
887 debugfs_remove(sc->debug.debugfs_antenna); 943 debugfs_remove(sc->debug.debugfs_antenna);
944 debugfs_remove(sc->debug.debugfs_misc);
888 debugfs_remove(sc->debug.debugfs_frameerrors); 945 debugfs_remove(sc->debug.debugfs_frameerrors);
889 debugfs_remove(sc->debug.debugfs_ani); 946 debugfs_remove(sc->debug.debugfs_ani);
890 debugfs_remove(sc->debug.debugfs_queue); 947 debugfs_remove(sc->debug.debugfs_queue);
@@ -962,7 +1019,7 @@ ath5k_debug_printrxbuffs(struct ath5k_softc *sc, struct ath5k_hw *ah)
962 struct ath5k_rx_status rs = {}; 1019 struct ath5k_rx_status rs = {};
963 int status; 1020 int status;
964 1021
965 if (likely(!(sc->debug.level & ATH5K_DEBUG_RESET))) 1022 if (likely(!(sc->debug.level & ATH5K_DEBUG_DESC)))
966 return; 1023 return;
967 1024
968 printk(KERN_DEBUG "rxdp %x, rxlink %p\n", 1025 printk(KERN_DEBUG "rxdp %x, rxlink %p\n",
@@ -1004,7 +1061,7 @@ ath5k_debug_printtxbuf(struct ath5k_softc *sc, struct ath5k_buf *bf)
1004 struct ath5k_tx_status ts = {}; 1061 struct ath5k_tx_status ts = {};
1005 int done; 1062 int done;
1006 1063
1007 if (likely(!(sc->debug.level & ATH5K_DEBUG_RESET))) 1064 if (likely(!(sc->debug.level & ATH5K_DEBUG_DESC)))
1008 return; 1065 return;
1009 1066
1010 done = sc->ah->ah_proc_tx_desc(sc->ah, bf->desc, &ts); 1067 done = sc->ah->ah_proc_tx_desc(sc->ah, bf->desc, &ts);