diff options
author | Jeff Hansen <x@jeffhansen.com> | 2009-05-27 08:48:28 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-06-03 14:05:11 -0400 |
commit | bedf087af96a24861d09586ac25c26691300ff4c (patch) | |
tree | 91f9a8991dfbf56837a80c4ff8b01574359deb0e /drivers/net/wireless/ath/ath9k/debug.c | |
parent | b74444f8a9039603715973a56df588a5d800c4ef (diff) |
ath9k: Combine legacy and 11n rc statistics
This patch combines the legacy and 11n rcstats into one, using the normal
rate table indices instead of two separate indices for each mode. Legacy
rates also get all of the PER and retry information, now, too.
Signed-off-by: Jeff Hansen <x@jeffhansen.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/debug.c')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/debug.c | 111 |
1 files changed, 33 insertions, 78 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 | ||
227 | static void ath_debug_stat_11n_rc(struct ath_softc *sc, struct sk_buff *skb) | 227 | void 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 | |||
241 | static 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 | ||
255 | void 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 .. */ | ||
264 | void ath_debug_stat_retries(struct ath_softc *sc, int rix, | 242 | void 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 | ||
276 | static ssize_t ath_read_file_stat_11n_rc(struct file *file, | 252 | static 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 | ||
300 | static 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; | |
320 | static 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 | ||
334 | static const struct file_operations fops_rcstat = { | 289 | static const struct file_operations fops_rcstat = { |