~ubuntu-branches/ubuntu/jaunty/linux-backports-modules-2.6.28/jaunty-proposed

« back to all changes in this revision

Viewing changes to updates/compat-wireless-2.6/drivers/net/wireless/ath9k/debug.c

  • Committer: Bazaar Package Importer
  • Author(s): Tim Gardner, Tim Gardner
  • Date: 2009-02-09 17:48:22 UTC
  • Revision ID: james.westby@ubuntu.com-20090209174822-6chmiumgtavrmzgv
Tags: 2.6.28-7.5
[Tim Gardner]

* Update to master-2009-02-09
* Convert 'git-log' to 'git log'

Show diffs side-by-side

added added

removed removed

Lines of Context:
222
222
        .owner = THIS_MODULE
223
223
};
224
224
 
 
225
static void ath_debug_stat_11n_rc(struct ath_softc *sc, struct sk_buff *skb)
 
226
{
 
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;
 
231
 
 
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;
 
235
 
 
236
        sc->sc_debug.stats.n_rcstats[idx].success++;
 
237
}
 
238
 
 
239
static void ath_debug_stat_legacy_rc(struct ath_softc *sc, struct sk_buff *skb)
 
240
{
 
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;
 
245
 
 
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;
 
249
 
 
250
        sc->sc_debug.stats.legacy_rcstats[idx].success++;
 
251
}
 
252
 
 
253
void ath_debug_stat_rc(struct ath_softc *sc, struct sk_buff *skb)
 
254
{
 
255
        if (conf_is_ht(&sc->hw->conf))
 
256
                ath_debug_stat_11n_rc(sc, skb);
 
257
        else
 
258
                ath_debug_stat_legacy_rc(sc, skb);
 
259
}
 
260
 
 
261
/* FIXME: legacy rates, later on .. */
 
262
void ath_debug_stat_retries(struct ath_softc *sc, int rix,
 
263
                            int xretries, int retries)
 
264
{
 
265
        if (conf_is_ht(&sc->hw->conf)) {
 
266
                int idx = sc->cur_rate_table->info[rix].dot11rate;
 
267
 
 
268
                sc->sc_debug.stats.n_rcstats[idx].xretries += xretries;
 
269
                sc->sc_debug.stats.n_rcstats[idx].retries += retries;
 
270
        }
 
271
}
 
272
 
 
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)
 
276
{
 
277
        struct ath_softc *sc = file->private_data;
 
278
        char buf[1024];
 
279
        unsigned int len = 0;
 
280
        int i = 0;
 
281
 
 
282
        len += sprintf(buf, "%7s %13s %8s %8s\n\n", "Rate", "Success",
 
283
                       "Retries", "XRetries");
 
284
 
 
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);
 
291
        }
 
292
 
 
293
        return simple_read_from_buffer(user_buf, count, ppos, buf, len);
 
294
}
 
295
 
 
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)
 
299
{
 
300
        struct ath_softc *sc = file->private_data;
 
301
        char buf[512];
 
302
        unsigned int len = 0;
 
303
        int i = 0;
 
304
 
 
305
        len += sprintf(buf, "%7s %13s\n\n", "Rate", "Success");
 
306
 
 
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);
 
311
        }
 
312
 
 
313
        return simple_read_from_buffer(user_buf, count, ppos, buf, len);
 
314
}
 
315
 
 
316
static ssize_t read_file_rcstat(struct file *file, char __user *user_buf,
 
317
                                size_t count, loff_t *ppos)
 
318
{
 
319
        struct ath_softc *sc = file->private_data;
 
320
 
 
321
        if (conf_is_ht(&sc->hw->conf))
 
322
                return ath_read_file_stat_11n_rc(file, user_buf, count, ppos);
 
323
        else
 
324
                return ath_read_file_stat_legacy_rc(file, user_buf, count ,ppos);
 
325
}
 
326
 
 
327
static const struct file_operations fops_rcstat = {
 
328
        .read = read_file_rcstat,
 
329
        .open = ath9k_debugfs_open,
 
330
        .owner = THIS_MODULE
 
331
};
 
332
 
225
333
int ath9k_init_debug(struct ath_softc *sc)
226
334
{
227
335
        sc->sc_debug.debug_mask = ath9k_debug;
247
355
        if (!sc->sc_debug.debugfs_interrupt)
248
356
                goto err;
249
357
 
 
358
        sc->sc_debug.debugfs_rcstat = debugfs_create_file("rcstat",
 
359
                                                  S_IRUGO,
 
360
                                                  sc->sc_debug.debugfs_phy,
 
361
                                                  sc, &fops_rcstat);
 
362
        if (!sc->sc_debug.debugfs_rcstat)
 
363
                goto err;
 
364
 
250
365
        return 0;
251
366
err:
252
367
        ath9k_exit_debug(sc);
255
370
 
256
371
void ath9k_exit_debug(struct ath_softc *sc)
257
372
{
 
373
        debugfs_remove(sc->sc_debug.debugfs_rcstat);
258
374
        debugfs_remove(sc->sc_debug.debugfs_interrupt);
259
375
        debugfs_remove(sc->sc_debug.debugfs_dma);
260
376
        debugfs_remove(sc->sc_debug.debugfs_phy);