ath9k: Add debugfs files for printing TX rate details
Signed-off-by: Sujith <Sujith.Manoharan@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
@@ -131,8 +131,18 @@ struct ath_interrupt_stats {
|
|||||||
u32 dtim;
|
u32 dtim;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct ath_legacy_rc_stats {
|
||||||
|
u32 success;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ath_11n_rc_stats {
|
||||||
|
u32 success;
|
||||||
|
};
|
||||||
|
|
||||||
struct ath_stats {
|
struct ath_stats {
|
||||||
struct ath_interrupt_stats istats;
|
struct ath_interrupt_stats istats;
|
||||||
|
struct ath_legacy_rc_stats legacy_rcstats[12]; /* max(11a,11b,11g) */
|
||||||
|
struct ath_11n_rc_stats n_rcstats[16]; /* 0..15 MCS rates */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ath9k_debug {
|
struct ath9k_debug {
|
||||||
@@ -141,6 +151,7 @@ struct ath9k_debug {
|
|||||||
struct dentry *debugfs_phy;
|
struct dentry *debugfs_phy;
|
||||||
struct dentry *debugfs_dma;
|
struct dentry *debugfs_dma;
|
||||||
struct dentry *debugfs_interrupt;
|
struct dentry *debugfs_interrupt;
|
||||||
|
struct dentry *debugfs_rcstat;
|
||||||
struct ath_stats stats;
|
struct ath_stats stats;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -148,6 +159,7 @@ void DPRINTF(struct ath_softc *sc, int dbg_mask, const char *fmt, ...);
|
|||||||
int ath9k_init_debug(struct ath_softc *sc);
|
int ath9k_init_debug(struct ath_softc *sc);
|
||||||
void ath9k_exit_debug(struct ath_softc *sc);
|
void ath9k_exit_debug(struct ath_softc *sc);
|
||||||
void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status);
|
void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status);
|
||||||
|
void ath_debug_stat_rc(struct ath_softc *sc, struct sk_buff *skb);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
@@ -170,6 +182,11 @@ static inline void ath_debug_stat_interrupt(struct ath_softc *sc,
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void ath_debug_stat_rc(struct ath_softc *sc,
|
||||||
|
struct sk_buff *skb)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_ATH9K_DEBUG */
|
#endif /* CONFIG_ATH9K_DEBUG */
|
||||||
|
|
||||||
struct ath_config {
|
struct ath_config {
|
||||||
|
@@ -222,6 +222,98 @@ static const struct file_operations fops_interrupt = {
|
|||||||
.owner = THIS_MODULE
|
.owner = THIS_MODULE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void ath_debug_stat_11n_rc(struct ath_softc *sc, struct sk_buff *skb)
|
||||||
|
{
|
||||||
|
struct ath_tx_info_priv *tx_info_priv = NULL;
|
||||||
|
struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
|
||||||
|
struct ieee80211_tx_rate *rates = tx_info->status.rates;
|
||||||
|
int final_ts_idx, idx;
|
||||||
|
|
||||||
|
tx_info_priv = ATH_TX_INFO_PRIV(tx_info);
|
||||||
|
final_ts_idx = tx_info_priv->tx.ts_rateindex;
|
||||||
|
idx = sc->cur_rate_table->info[rates[final_ts_idx].idx].dot11rate;
|
||||||
|
|
||||||
|
sc->sc_debug.stats.n_rcstats[idx].success++;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ath_debug_stat_legacy_rc(struct ath_softc *sc, struct sk_buff *skb)
|
||||||
|
{
|
||||||
|
struct ath_tx_info_priv *tx_info_priv = NULL;
|
||||||
|
struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
|
||||||
|
struct ieee80211_tx_rate *rates = tx_info->status.rates;
|
||||||
|
int final_ts_idx, idx;
|
||||||
|
|
||||||
|
tx_info_priv = ATH_TX_INFO_PRIV(tx_info);
|
||||||
|
final_ts_idx = tx_info_priv->tx.ts_rateindex;
|
||||||
|
idx = rates[final_ts_idx].idx;
|
||||||
|
|
||||||
|
sc->sc_debug.stats.legacy_rcstats[idx].success++;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ath_debug_stat_rc(struct ath_softc *sc, struct sk_buff *skb)
|
||||||
|
{
|
||||||
|
if (conf_is_ht(&sc->hw->conf))
|
||||||
|
ath_debug_stat_11n_rc(sc, skb);
|
||||||
|
else
|
||||||
|
ath_debug_stat_legacy_rc(sc, skb);
|
||||||
|
}
|
||||||
|
|
||||||
|
static ssize_t ath_read_file_stat_11n_rc(struct file *file,
|
||||||
|
char __user *user_buf,
|
||||||
|
size_t count, loff_t *ppos)
|
||||||
|
{
|
||||||
|
struct ath_softc *sc = file->private_data;
|
||||||
|
char buf[512];
|
||||||
|
unsigned int len = 0;
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
len += sprintf(buf, "%7s %13s\n\n", "Rate", "Success");
|
||||||
|
|
||||||
|
for (i = 0; i <= 15; i++) {
|
||||||
|
len += snprintf(buf + len, sizeof(buf) - len,
|
||||||
|
"%5s%3d: %8u\n", "MCS", i,
|
||||||
|
sc->sc_debug.stats.n_rcstats[i].success);
|
||||||
|
}
|
||||||
|
|
||||||
|
return simple_read_from_buffer(user_buf, count, ppos, buf, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
static ssize_t ath_read_file_stat_legacy_rc(struct file *file,
|
||||||
|
char __user *user_buf,
|
||||||
|
size_t count, loff_t *ppos)
|
||||||
|
{
|
||||||
|
struct ath_softc *sc = file->private_data;
|
||||||
|
char buf[512];
|
||||||
|
unsigned int len = 0;
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
len += sprintf(buf, "%7s %13s\n\n", "Rate", "Success");
|
||||||
|
|
||||||
|
for (i = 0; i < sc->cur_rate_table->rate_cnt; i++) {
|
||||||
|
len += snprintf(buf + len, sizeof(buf) - len, "%5u: %12u\n",
|
||||||
|
sc->cur_rate_table->info[i].ratekbps / 1000,
|
||||||
|
sc->sc_debug.stats.legacy_rcstats[i].success);
|
||||||
|
}
|
||||||
|
|
||||||
|
return simple_read_from_buffer(user_buf, count, ppos, buf, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
static ssize_t read_file_rcstat(struct file *file, char __user *user_buf,
|
||||||
|
size_t count, loff_t *ppos)
|
||||||
|
{
|
||||||
|
struct ath_softc *sc = file->private_data;
|
||||||
|
|
||||||
|
if (conf_is_ht(&sc->hw->conf))
|
||||||
|
return ath_read_file_stat_11n_rc(file, user_buf, count, ppos);
|
||||||
|
else
|
||||||
|
return ath_read_file_stat_legacy_rc(file, user_buf, count ,ppos);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct file_operations fops_rcstat = {
|
||||||
|
.read = read_file_rcstat,
|
||||||
|
.open = ath9k_debugfs_open,
|
||||||
|
.owner = THIS_MODULE
|
||||||
|
};
|
||||||
|
|
||||||
int ath9k_init_debug(struct ath_softc *sc)
|
int ath9k_init_debug(struct ath_softc *sc)
|
||||||
{
|
{
|
||||||
@@ -248,6 +340,13 @@ int ath9k_init_debug(struct ath_softc *sc)
|
|||||||
if (!sc->sc_debug.debugfs_interrupt)
|
if (!sc->sc_debug.debugfs_interrupt)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
|
sc->sc_debug.debugfs_rcstat = debugfs_create_file("rcstat",
|
||||||
|
S_IRUGO,
|
||||||
|
sc->sc_debug.debugfs_phy,
|
||||||
|
sc, &fops_rcstat);
|
||||||
|
if (!sc->sc_debug.debugfs_rcstat)
|
||||||
|
goto err;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
err:
|
err:
|
||||||
ath9k_exit_debug(sc);
|
ath9k_exit_debug(sc);
|
||||||
@@ -256,6 +355,7 @@ err:
|
|||||||
|
|
||||||
void ath9k_exit_debug(struct ath_softc *sc)
|
void ath9k_exit_debug(struct ath_softc *sc)
|
||||||
{
|
{
|
||||||
|
debugfs_remove(sc->sc_debug.debugfs_rcstat);
|
||||||
debugfs_remove(sc->sc_debug.debugfs_interrupt);
|
debugfs_remove(sc->sc_debug.debugfs_interrupt);
|
||||||
debugfs_remove(sc->sc_debug.debugfs_dma);
|
debugfs_remove(sc->sc_debug.debugfs_dma);
|
||||||
debugfs_remove(sc->sc_debug.debugfs_phy);
|
debugfs_remove(sc->sc_debug.debugfs_phy);
|
||||||
|
@@ -1544,6 +1544,8 @@ static void ath_tx_status(void *priv, struct ieee80211_supported_band *sband,
|
|||||||
ieee80211_start_tx_ba_session(sc->hw, hdr->addr1, tid);
|
ieee80211_start_tx_ba_session(sc->hw, hdr->addr1, tid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ath_debug_stat_rc(sc, skb);
|
||||||
exit:
|
exit:
|
||||||
kfree(tx_info_priv);
|
kfree(tx_info_priv);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user