222
222
.owner = THIS_MODULE
225
static void ath_debug_stat_11n_rc(struct ath_softc *sc, struct sk_buff *skb)
227
struct ath_tx_info_priv *tx_info_priv = NULL;
228
struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
229
struct ieee80211_tx_rate *rates = tx_info->status.rates;
230
int final_ts_idx, idx;
232
tx_info_priv = ATH_TX_INFO_PRIV(tx_info);
233
final_ts_idx = tx_info_priv->tx.ts_rateindex;
234
idx = sc->cur_rate_table->info[rates[final_ts_idx].idx].dot11rate;
236
sc->sc_debug.stats.n_rcstats[idx].success++;
239
static void ath_debug_stat_legacy_rc(struct ath_softc *sc, struct sk_buff *skb)
241
struct ath_tx_info_priv *tx_info_priv = NULL;
242
struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
243
struct ieee80211_tx_rate *rates = tx_info->status.rates;
244
int final_ts_idx, idx;
246
tx_info_priv = ATH_TX_INFO_PRIV(tx_info);
247
final_ts_idx = tx_info_priv->tx.ts_rateindex;
248
idx = rates[final_ts_idx].idx;
250
sc->sc_debug.stats.legacy_rcstats[idx].success++;
253
void ath_debug_stat_rc(struct ath_softc *sc, struct sk_buff *skb)
255
if (conf_is_ht(&sc->hw->conf))
256
ath_debug_stat_11n_rc(sc, skb);
258
ath_debug_stat_legacy_rc(sc, skb);
261
/* FIXME: legacy rates, later on .. */
262
void ath_debug_stat_retries(struct ath_softc *sc, int rix,
263
int xretries, int retries)
265
if (conf_is_ht(&sc->hw->conf)) {
266
int idx = sc->cur_rate_table->info[rix].dot11rate;
268
sc->sc_debug.stats.n_rcstats[idx].xretries += xretries;
269
sc->sc_debug.stats.n_rcstats[idx].retries += retries;
273
static ssize_t ath_read_file_stat_11n_rc(struct file *file,
274
char __user *user_buf,
275
size_t count, loff_t *ppos)
277
struct ath_softc *sc = file->private_data;
279
unsigned int len = 0;
282
len += sprintf(buf, "%7s %13s %8s %8s\n\n", "Rate", "Success",
283
"Retries", "XRetries");
285
for (i = 0; i <= 15; i++) {
286
len += snprintf(buf + len, sizeof(buf) - len,
287
"%5s%3d: %8u %8u %8u\n", "MCS", i,
288
sc->sc_debug.stats.n_rcstats[i].success,
289
sc->sc_debug.stats.n_rcstats[i].retries,
290
sc->sc_debug.stats.n_rcstats[i].xretries);
293
return simple_read_from_buffer(user_buf, count, ppos, buf, len);
296
static ssize_t ath_read_file_stat_legacy_rc(struct file *file,
297
char __user *user_buf,
298
size_t count, loff_t *ppos)
300
struct ath_softc *sc = file->private_data;
302
unsigned int len = 0;
305
len += sprintf(buf, "%7s %13s\n\n", "Rate", "Success");
307
for (i = 0; i < sc->cur_rate_table->rate_cnt; i++) {
308
len += snprintf(buf + len, sizeof(buf) - len, "%5u: %12u\n",
309
sc->cur_rate_table->info[i].ratekbps / 1000,
310
sc->sc_debug.stats.legacy_rcstats[i].success);
313
return simple_read_from_buffer(user_buf, count, ppos, buf, len);
316
static ssize_t read_file_rcstat(struct file *file, char __user *user_buf,
317
size_t count, loff_t *ppos)
319
struct ath_softc *sc = file->private_data;
321
if (conf_is_ht(&sc->hw->conf))
322
return ath_read_file_stat_11n_rc(file, user_buf, count, ppos);
324
return ath_read_file_stat_legacy_rc(file, user_buf, count ,ppos);
327
static const struct file_operations fops_rcstat = {
328
.read = read_file_rcstat,
329
.open = ath9k_debugfs_open,
225
333
int ath9k_init_debug(struct ath_softc *sc)
227
335
sc->sc_debug.debug_mask = ath9k_debug;