ath9k: disable MAC sample debugging, it is almost never used and wastes precious CPU cycles

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@30764 3c298f89-4303-0410-b956-a3cf2f4a3e73
master
Felix Fietkau 2012-03-01 15:13:33 +00:00
parent 38cf7e3dd0
commit 0d692e26bc
7 changed files with 162 additions and 17 deletions

View File

@ -995,3 +995,148 @@
} }
static int cmp_bss(struct cfg80211_bss *a, static int cmp_bss(struct cfg80211_bss *a,
--- a/drivers/net/wireless/ath/ath9k/Kconfig
+++ b/drivers/net/wireless/ath/ath9k/Kconfig
@@ -81,6 +81,14 @@ config ATH9K_DFS_CERTIFIED
developed. At this point enabling this option won't do anything
except increase code size.
+config ATH9K_MAC_DEBUG
+ bool "Atheros MAC statistics"
+ depends on ATH9K_DEBUGFS
+ default y
+ ---help---
+ This option enables collection of statistics for Rx/Tx status
+ data and some other MAC related statistics
+
config ATH9K_RATE_CONTROL
bool "Atheros ath9k rate control"
depends on ATH9K
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -818,6 +818,7 @@ void ath_debug_stat_tx(struct ath_softc
if (ts->ts_flags & ATH9K_TX_DELIM_UNDERRUN)
TX_STAT_INC(qnum, delim_underrun);
+#ifdef CONFIG_ATH9K_MAC_DEBUG
spin_lock(&sc->debug.samp_lock);
TX_SAMP_DBG(jiffies) = jiffies;
TX_SAMP_DBG(rssi_ctl0) = ts->ts_rssi_ctl0;
@@ -844,6 +845,7 @@ void ath_debug_stat_tx(struct ath_softc
sc->debug.tsidx = (sc->debug.tsidx + 1) % ATH_DBG_MAX_SAMPLES;
spin_unlock(&sc->debug.samp_lock);
+#endif
#undef TX_SAMP_DBG
}
@@ -1019,6 +1021,7 @@ void ath_debug_stat_rx(struct ath_softc
sc->debug.stats.rxstats.rs_antenna = rs->rs_antenna;
+#ifdef CONFIG_ATH9K_MAC_DEBUG
spin_lock(&sc->debug.samp_lock);
RX_SAMP_DBG(jiffies) = jiffies;
RX_SAMP_DBG(rssi_ctl0) = rs->rs_rssi_ctl0;
@@ -1035,6 +1038,8 @@ void ath_debug_stat_rx(struct ath_softc
sc->debug.rsidx = (sc->debug.rsidx + 1) % ATH_DBG_MAX_SAMPLES;
spin_unlock(&sc->debug.samp_lock);
+#endif
+
#undef RX_STAT_INC
#undef RX_PHY_ERR_INC
#undef RX_SAMP_DBG
@@ -1278,6 +1283,8 @@ static const struct file_operations fops
.llseek = default_llseek,
};
+#ifdef CONFIG_ATH9K_MAC_DEBUG
+
void ath9k_debug_samp_bb_mac(struct ath_softc *sc)
{
#define ATH_SAMP_DBG(c) (sc->debug.bb_mac_samp[sc->debug.sampidx].c)
@@ -1551,6 +1558,7 @@ static const struct file_operations fops
.llseek = default_llseek,
};
+#endif
int ath9k_init_debug(struct ath_hw *ah)
{
@@ -1604,8 +1612,10 @@ int ath9k_init_debug(struct ath_hw *ah)
&fops_base_eeprom);
debugfs_create_file("modal_eeprom", S_IRUSR, sc->debug.debugfs_phy, sc,
&fops_modal_eeprom);
+#ifdef CONFIG_ATH9K_MAC_DEBUG
debugfs_create_file("samples", S_IRUSR, sc->debug.debugfs_phy, sc,
&fops_samps);
+#endif
debugfs_create_u32("gpio_mask", S_IRUSR | S_IWUSR,
sc->debug.debugfs_phy, &sc->sc_ah->gpio_mask);
--- a/drivers/net/wireless/ath/ath9k/debug.h
+++ b/drivers/net/wireless/ath/ath9k/debug.h
@@ -235,16 +235,17 @@ struct ath9k_debug {
struct dentry *debugfs_phy;
u32 regidx;
struct ath_stats stats;
+#ifdef CONFIG_ATH9K_MAC_DEBUG
spinlock_t samp_lock;
struct ath_dbg_bb_mac_samp bb_mac_samp[ATH_DBG_MAX_SAMPLES];
u8 sampidx;
u8 tsidx;
u8 rsidx;
+#endif
};
int ath9k_init_debug(struct ath_hw *ah);
-void ath9k_debug_samp_bb_mac(struct ath_softc *sc);
void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status);
void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf,
struct ath_tx_status *ts, struct ath_txq *txq,
@@ -258,10 +259,6 @@ static inline int ath9k_init_debug(struc
return 0;
}
-static inline void ath9k_debug_samp_bb_mac(struct ath_softc *sc)
-{
-}
-
static inline void ath_debug_stat_interrupt(struct ath_softc *sc,
enum ath9k_int status)
{
@@ -282,4 +279,17 @@ static inline void ath_debug_stat_rx(str
#endif /* CONFIG_ATH9K_DEBUGFS */
+#ifdef CONFIG_ATH9K_MAC_DEBUG
+
+void ath9k_debug_samp_bb_mac(struct ath_softc *sc);
+
+#else
+
+static inline void ath9k_debug_samp_bb_mac(struct ath_softc *sc)
+{
+}
+
+#endif
+
+
#endif /* DEBUG_H */
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -555,9 +555,11 @@ static int ath9k_init_softc(u16 devid, s
mutex_init(&sc->mutex);
#ifdef CONFIG_ATH9K_DEBUGFS
spin_lock_init(&sc->nodes_lock);
- spin_lock_init(&sc->debug.samp_lock);
INIT_LIST_HEAD(&sc->nodes);
#endif
+#ifdef CONFIG_ATH9K_MAC_DEBUG
+ spin_lock_init(&sc->debug.samp_lock);
+#endif
tasklet_init(&sc->intr_tq, ath9k_tasklet, (unsigned long)sc);
tasklet_init(&sc->bcon_tasklet, ath_beacon_tasklet,
(unsigned long)sc);

View File

@ -1,8 +1,8 @@
--- a/drivers/net/wireless/ath/ath9k/debug.c --- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -1552,6 +1552,53 @@ static const struct file_operations fops @@ -1560,6 +1560,53 @@ static const struct file_operations fops
};
#endif
+static ssize_t read_file_eeprom(struct file *file, char __user *user_buf, +static ssize_t read_file_eeprom(struct file *file, char __user *user_buf,
+ size_t count, loff_t *ppos) + size_t count, loff_t *ppos)
@ -54,7 +54,7 @@
int ath9k_init_debug(struct ath_hw *ah) int ath9k_init_debug(struct ath_hw *ah)
{ {
struct ath_common *common = ath9k_hw_common(ah); struct ath_common *common = ath9k_hw_common(ah);
@@ -1613,5 +1660,8 @@ int ath9k_init_debug(struct ath_hw *ah) @@ -1623,5 +1670,8 @@ int ath9k_init_debug(struct ath_hw *ah)
debugfs_create_u32("gpio_val", S_IRUSR | S_IWUSR, debugfs_create_u32("gpio_val", S_IRUSR | S_IWUSR,
sc->debug.debugfs_phy, &sc->sc_ah->gpio_val); sc->debug.debugfs_phy, &sc->sc_ah->gpio_val);

View File

@ -18,7 +18,7 @@
--- a/drivers/net/wireless/ath/ath9k/debug.c --- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -1599,6 +1599,50 @@ static const struct file_operations fops @@ -1607,6 +1607,50 @@ static const struct file_operations fops
.owner = THIS_MODULE .owner = THIS_MODULE
}; };
@ -69,7 +69,7 @@
int ath9k_init_debug(struct ath_hw *ah) int ath9k_init_debug(struct ath_hw *ah)
{ {
struct ath_common *common = ath9k_hw_common(ah); struct ath_common *common = ath9k_hw_common(ah);
@@ -1663,5 +1707,8 @@ int ath9k_init_debug(struct ath_hw *ah) @@ -1673,5 +1717,8 @@ int ath9k_init_debug(struct ath_hw *ah)
debugfs_create_file("eeprom", S_IRUSR, sc->debug.debugfs_phy, sc, debugfs_create_file("eeprom", S_IRUSR, sc->debug.debugfs_phy, sc,
&fops_eeprom); &fops_eeprom);

View File

@ -20,7 +20,7 @@
spinlock_t txbuflock; spinlock_t txbuflock;
--- a/drivers/net/wireless/ath/ath9k/debug.c --- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -1666,6 +1666,10 @@ int ath9k_init_debug(struct ath_hw *ah) @@ -1674,6 +1674,10 @@ int ath9k_init_debug(struct ath_hw *ah)
&fops_interrupt); &fops_interrupt);
debugfs_create_file("xmit", S_IRUSR, sc->debug.debugfs_phy, sc, debugfs_create_file("xmit", S_IRUSR, sc->debug.debugfs_phy, sc,
&fops_xmit); &fops_xmit);

View File

@ -1,6 +1,6 @@
--- a/drivers/net/wireless/ath/ath9k/debug.c --- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -942,27 +942,6 @@ static ssize_t read_file_recv(struct fil @@ -944,27 +944,6 @@ static ssize_t read_file_recv(struct fil
PHY_ERR("HT-RATE ERR", ATH9K_PHYERR_HT_RATE_ILLEGAL); PHY_ERR("HT-RATE ERR", ATH9K_PHYERR_HT_RATE_ILLEGAL);
len += snprintf(buf + len, size - len, len += snprintf(buf + len, size - len,
@ -28,7 +28,7 @@
"%22s : %10u\n", "RX-Pkts-All", "%22s : %10u\n", "RX-Pkts-All",
sc->debug.stats.rxstats.rx_pkts_all); sc->debug.stats.rxstats.rx_pkts_all);
len += snprintf(buf + len, size - len, len += snprintf(buf + len, size - len,
@@ -1009,16 +988,6 @@ void ath_debug_stat_rx(struct ath_softc @@ -1011,16 +990,6 @@ void ath_debug_stat_rx(struct ath_softc
RX_PHY_ERR_INC(rs->rs_phyerr); RX_PHY_ERR_INC(rs->rs_phyerr);
} }
@ -42,9 +42,9 @@
- -
- sc->debug.stats.rxstats.rs_antenna = rs->rs_antenna; - sc->debug.stats.rxstats.rs_antenna = rs->rs_antenna;
- -
#ifdef CONFIG_ATH9K_MAC_DEBUG
spin_lock(&sc->debug.samp_lock); spin_lock(&sc->debug.samp_lock);
RX_SAMP_DBG(jiffies) = jiffies; RX_SAMP_DBG(jiffies) = jiffies;
RX_SAMP_DBG(rssi_ctl0) = rs->rs_rssi_ctl0;
--- a/drivers/net/wireless/ath/ath9k/debug.h --- a/drivers/net/wireless/ath/ath9k/debug.h
+++ b/drivers/net/wireless/ath/ath9k/debug.h +++ b/drivers/net/wireless/ath/ath9k/debug.h
@@ -165,13 +165,6 @@ struct ath_rx_stats { @@ -165,13 +165,6 @@ struct ath_rx_stats {

View File

@ -250,8 +250,8 @@
if (ads.ds_rxstatus8 & AR_RxKeyIdxValid) if (ads.ds_rxstatus8 & AR_RxKeyIdxValid)
--- a/drivers/net/wireless/ath/ath9k/debug.c --- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -990,12 +990,12 @@ void ath_debug_stat_rx(struct ath_softc @@ -993,12 +993,12 @@ void ath_debug_stat_rx(struct ath_softc
#ifdef CONFIG_ATH9K_MAC_DEBUG
spin_lock(&sc->debug.samp_lock); spin_lock(&sc->debug.samp_lock);
RX_SAMP_DBG(jiffies) = jiffies; RX_SAMP_DBG(jiffies) = jiffies;
- RX_SAMP_DBG(rssi_ctl0) = rs->rs_rssi_ctl0; - RX_SAMP_DBG(rssi_ctl0) = rs->rs_rssi_ctl0;

View File

@ -171,7 +171,7 @@
--- a/drivers/net/wireless/ath/ath9k/init.c --- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -757,7 +757,7 @@ int ath9k_init_device(u16 devid, struct @@ -759,7 +759,7 @@ int ath9k_init_device(u16 devid, struct
#ifdef CONFIG_MAC80211_LEDS #ifdef CONFIG_MAC80211_LEDS
/* must be initialized before ieee80211_register_hw */ /* must be initialized before ieee80211_register_hw */
@ -182,9 +182,9 @@
#endif #endif
--- a/drivers/net/wireless/ath/ath9k/debug.c --- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -1247,6 +1247,61 @@ static const struct file_operations fops @@ -1254,6 +1254,61 @@ static const struct file_operations fops
.llseek = default_llseek,
}; #ifdef CONFIG_ATH9K_MAC_DEBUG
+#ifdef CONFIG_MAC80211_LEDS +#ifdef CONFIG_MAC80211_LEDS
+ +
@ -244,9 +244,9 @@
void ath9k_debug_samp_bb_mac(struct ath_softc *sc) void ath9k_debug_samp_bb_mac(struct ath_softc *sc)
{ {
#define ATH_SAMP_DBG(c) (sc->debug.bb_mac_samp[sc->debug.sampidx].c) #define ATH_SAMP_DBG(c) (sc->debug.bb_mac_samp[sc->debug.sampidx].c)
@@ -1671,6 +1726,11 @@ int ath9k_init_debug(struct ath_hw *ah) @@ -1681,6 +1736,11 @@ int ath9k_init_debug(struct ath_hw *ah)
debugfs_create_file("samples", S_IRUSR, sc->debug.debugfs_phy, sc,
&fops_samps); &fops_samps);
#endif
+#ifdef CONFIG_MAC80211_LEDS +#ifdef CONFIG_MAC80211_LEDS
+ debugfs_create_file("gpio_led", S_IWUSR, + debugfs_create_file("gpio_led", S_IWUSR,