Skip to content

Commit

Permalink
ath9k: Fix rate control debugging
Browse files Browse the repository at this point in the history
Update the rate statistics only when debugfs has been enabled
in ath9k and mac80211 and move the stat() functions under proper
conditionals.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Sujith Manoharan authored and John W. Linville committed Nov 21, 2012
1 parent 1c11e10 commit 4d28f77
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 19 deletions.
36 changes: 18 additions & 18 deletions drivers/net/wireless/ath/ath9k/rc.c
Original file line number Diff line number Diff line change
Expand Up @@ -982,16 +982,6 @@ static void ath_rc_update_per(struct ath_softc *sc,
}
}

static void ath_debug_stat_retries(struct ath_rate_priv *rc, int rix,
int xretries, int retries, u8 per)
{
struct ath_rc_stats *stats = &rc->rcstats[rix];

stats->xretries += xretries;
stats->retries += retries;
stats->per = per;
}

static void ath_rc_update_ht(struct ath_softc *sc,
struct ath_rate_priv *ath_rc_priv,
struct ieee80211_tx_info *tx_info,
Expand Down Expand Up @@ -1065,14 +1055,6 @@ static void ath_rc_update_ht(struct ath_softc *sc,

}

static void ath_debug_stat_rc(struct ath_rate_priv *rc, int final_rate)
{
struct ath_rc_stats *stats;

stats = &rc->rcstats[final_rate];
stats->success++;
}

static void ath_rc_tx_status(struct ath_softc *sc,
struct ath_rate_priv *ath_rc_priv,
struct sk_buff *skb)
Expand Down Expand Up @@ -1352,6 +1334,24 @@ static void ath_rate_update(void *priv, struct ieee80211_supported_band *sband,

#if defined(CONFIG_MAC80211_DEBUGFS) && defined(CONFIG_ATH9K_DEBUGFS)

void ath_debug_stat_rc(struct ath_rate_priv *rc, int final_rate)
{
struct ath_rc_stats *stats;

stats = &rc->rcstats[final_rate];
stats->success++;
}

void ath_debug_stat_retries(struct ath_rate_priv *rc, int rix,
int xretries, int retries, u8 per)
{
struct ath_rc_stats *stats = &rc->rcstats[rix];

stats->xretries += xretries;
stats->retries += retries;
stats->per = per;
}

static ssize_t read_file_rcstat(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos)
{
Expand Down
16 changes: 15 additions & 1 deletion drivers/net/wireless/ath/ath9k/rc.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,24 @@ struct ath_rate_priv {

#if defined(CONFIG_MAC80211_DEBUGFS) && defined(CONFIG_ATH9K_DEBUGFS)
struct dentry *debugfs_rcstats;
#endif
struct ath_rc_stats rcstats[RATE_TABLE_SIZE];
#endif
};

#if defined(CONFIG_MAC80211_DEBUGFS) && defined(CONFIG_ATH9K_DEBUGFS)
void ath_debug_stat_rc(struct ath_rate_priv *rc, int final_rate);
void ath_debug_stat_retries(struct ath_rate_priv *rc, int rix,
int xretries, int retries, u8 per);
#else
static inline void ath_debug_stat_rc(struct ath_rate_priv *rc, int final_rate)
{
}
static inline void ath_debug_stat_retries(struct ath_rate_priv *rc, int rix,
int xretries, int retries, u8 per)
{
}
#endif

#ifdef CONFIG_ATH9K_RATE_CONTROL
int ath_rate_control_register(void);
void ath_rate_control_unregister(void);
Expand Down

0 comments on commit 4d28f77

Please sign in to comment.