aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/ath/ath9k/debug.c111
-rw-r--r--drivers/net/wireless/ath/ath9k/debug.h9
2 files changed, 35 insertions, 85 deletions
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c
index 97df20cbf528..80115ea07c7d 100644
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -224,111 +224,66 @@ static const struct file_operations fops_interrupt = {
224 .owner = THIS_MODULE 224 .owner = THIS_MODULE
225}; 225};
226 226
227static void ath_debug_stat_11n_rc(struct ath_softc *sc, struct sk_buff *skb) 227void ath_debug_stat_rc(struct ath_softc *sc, struct sk_buff *skb)
228{
229 struct ath_tx_info_priv *tx_info_priv = NULL;
230 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
231 struct ieee80211_tx_rate *rates = tx_info->status.rates;
232 int final_ts_idx, idx;
233
234 tx_info_priv = ATH_TX_INFO_PRIV(tx_info);
235 final_ts_idx = tx_info_priv->tx.ts_rateindex;
236 idx = sc->cur_rate_table->info[rates[final_ts_idx].idx].dot11rate;
237
238 sc->debug.stats.n_rcstats[idx].success++;
239}
240
241static void ath_debug_stat_legacy_rc(struct ath_softc *sc, struct sk_buff *skb)
242{ 228{
243 struct ath_tx_info_priv *tx_info_priv = NULL; 229 struct ath_tx_info_priv *tx_info_priv = NULL;
244 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); 230 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
245 struct ieee80211_tx_rate *rates = tx_info->status.rates; 231 struct ieee80211_tx_rate *rates = tx_info->status.rates;
246 int final_ts_idx, idx; 232 int final_ts_idx, idx;
233 struct ath_rc_stats *stats;
247 234
248 tx_info_priv = ATH_TX_INFO_PRIV(tx_info); 235 tx_info_priv = ATH_TX_INFO_PRIV(tx_info);
249 final_ts_idx = tx_info_priv->tx.ts_rateindex; 236 final_ts_idx = tx_info_priv->tx.ts_rateindex;
250 idx = rates[final_ts_idx].idx; 237 idx = rates[final_ts_idx].idx;
251 238 stats = &sc->debug.stats.rcstats[idx];
252 sc->debug.stats.legacy_rcstats[idx].success++; 239 stats->success++;
253} 240}
254 241
255void ath_debug_stat_rc(struct ath_softc *sc, struct sk_buff *skb)
256{
257 if (conf_is_ht(&sc->hw->conf))
258 ath_debug_stat_11n_rc(sc, skb);
259 else
260 ath_debug_stat_legacy_rc(sc, skb);
261}
262
263/* FIXME: legacy rates, later on .. */
264void ath_debug_stat_retries(struct ath_softc *sc, int rix, 242void ath_debug_stat_retries(struct ath_softc *sc, int rix,
265 int xretries, int retries, u8 per) 243 int xretries, int retries, u8 per)
266{ 244{
267 if (conf_is_ht(&sc->hw->conf)) { 245 struct ath_rc_stats *stats = &sc->debug.stats.rcstats[rix];
268 int idx = sc->cur_rate_table->info[rix].dot11rate;
269 246
270 sc->debug.stats.n_rcstats[idx].xretries += xretries; 247 stats->xretries += xretries;
271 sc->debug.stats.n_rcstats[idx].retries += retries; 248 stats->retries += retries;
272 sc->debug.stats.n_rcstats[idx].per = per; 249 stats->per = per;
273 }
274} 250}
275 251
276static ssize_t ath_read_file_stat_11n_rc(struct file *file, 252static ssize_t read_file_rcstat(struct file *file, char __user *user_buf,
277 char __user *user_buf, 253 size_t count, loff_t *ppos)
278 size_t count, loff_t *ppos)
279{ 254{
280 struct ath_softc *sc = file->private_data; 255 struct ath_softc *sc = file->private_data;
281 char buf[1024]; 256 char *buf;
282 unsigned int len = 0; 257 unsigned int len = 0, max;
283 int i = 0; 258 int i = 0;
259 ssize_t retval;
284 260
285 len += sprintf(buf, "%7s %13s %8s %8s %6s\n\n", "Rate", "Success", 261 if (sc->cur_rate_table == NULL)
286 "Retries", "XRetries", "PER"); 262 return 0;
287
288 for (i = 0; i <= 15; i++) {
289 len += snprintf(buf + len, sizeof(buf) - len,
290 "%5s%3d: %8u %8u %8u %8u\n", "MCS", i,
291 sc->debug.stats.n_rcstats[i].success,
292 sc->debug.stats.n_rcstats[i].retries,
293 sc->debug.stats.n_rcstats[i].xretries,
294 sc->debug.stats.n_rcstats[i].per);
295 }
296
297 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
298}
299 263
300static ssize_t ath_read_file_stat_legacy_rc(struct file *file, 264 max = 80 + sc->cur_rate_table->rate_cnt * 64;
301 char __user *user_buf, 265 buf = kmalloc(max + 1, GFP_KERNEL);
302 size_t count, loff_t *ppos) 266 if (buf == NULL)
303{ 267 return 0;
304 struct ath_softc *sc = file->private_data; 268 buf[max] = 0;
305 char buf[512];
306 unsigned int len = 0;
307 int i = 0;
308 269
309 len += sprintf(buf, "%7s %13s\n\n", "Rate", "Success"); 270 len += sprintf(buf, "%5s %15s %8s %9s %3s\n\n", "Rate", "Success",
271 "Retries", "XRetries", "PER");
310 272
311 for (i = 0; i < sc->cur_rate_table->rate_cnt; i++) { 273 for (i = 0; i < sc->cur_rate_table->rate_cnt; i++) {
312 len += snprintf(buf + len, sizeof(buf) - len, "%5u: %12u\n", 274 u32 ratekbps = sc->cur_rate_table->info[i].ratekbps;
313 sc->cur_rate_table->info[i].ratekbps / 1000, 275 struct ath_rc_stats *stats = &sc->debug.stats.rcstats[i];
314 sc->debug.stats.legacy_rcstats[i].success); 276
277 len += snprintf(buf + len, max - len,
278 "%3u.%d: %8u %8u %8u %8u\n", ratekbps / 1000,
279 (ratekbps % 1000) / 100, stats->success,
280 stats->retries, stats->xretries,
281 stats->per);
315 } 282 }
316 283
317 return simple_read_from_buffer(user_buf, count, ppos, buf, len); 284 retval = simple_read_from_buffer(user_buf, count, ppos, buf, len);
318} 285 kfree(buf);
319 286 return retval;
320static ssize_t read_file_rcstat(struct file *file, char __user *user_buf,
321 size_t count, loff_t *ppos)
322{
323 struct ath_softc *sc = file->private_data;
324
325 if (sc->cur_rate_table == NULL)
326 return 0;
327
328 if (conf_is_ht(&sc->hw->conf))
329 return ath_read_file_stat_11n_rc(file, user_buf, count, ppos);
330 else
331 return ath_read_file_stat_legacy_rc(file, user_buf, count ,ppos);
332} 287}
333 288
334static const struct file_operations fops_rcstat = { 289static const struct file_operations fops_rcstat = {
diff --git a/drivers/net/wireless/ath/ath9k/debug.h b/drivers/net/wireless/ath/ath9k/debug.h
index db845cf960c9..cf9146a6aaaa 100644
--- a/drivers/net/wireless/ath/ath9k/debug.h
+++ b/drivers/net/wireless/ath/ath9k/debug.h
@@ -80,11 +80,7 @@ struct ath_interrupt_stats {
80 u32 dtim; 80 u32 dtim;
81}; 81};
82 82
83struct ath_legacy_rc_stats { 83struct ath_rc_stats {
84 u32 success;
85};
86
87struct ath_11n_rc_stats {
88 u32 success; 84 u32 success;
89 u32 retries; 85 u32 retries;
90 u32 xretries; 86 u32 xretries;
@@ -93,8 +89,7 @@ struct ath_11n_rc_stats {
93 89
94struct ath_stats { 90struct ath_stats {
95 struct ath_interrupt_stats istats; 91 struct ath_interrupt_stats istats;
96 struct ath_legacy_rc_stats legacy_rcstats[12]; /* max(11a,11b,11g) */ 92 struct ath_rc_stats rcstats[RATE_TABLE_SIZE];
97 struct ath_11n_rc_stats n_rcstats[16]; /* 0..15 MCS rates */
98}; 93};
99 94
100struct ath9k_debug { 95struct ath9k_debug {