diff options
Diffstat (limited to 'drivers/net/wireless/ath5k/debug.c')
-rw-r--r-- | drivers/net/wireless/ath5k/debug.c | 92 |
1 files changed, 60 insertions, 32 deletions
diff --git a/drivers/net/wireless/ath5k/debug.c b/drivers/net/wireless/ath5k/debug.c index bb581ef6d1ef..41d5fa34b544 100644 --- a/drivers/net/wireless/ath5k/debug.c +++ b/drivers/net/wireless/ath5k/debug.c | |||
@@ -65,7 +65,7 @@ static unsigned int ath5k_debug; | |||
65 | module_param_named(debug, ath5k_debug, uint, 0); | 65 | module_param_named(debug, ath5k_debug, uint, 0); |
66 | 66 | ||
67 | 67 | ||
68 | #if ATH5K_DEBUG | 68 | #ifdef CONFIG_ATH5K_DEBUG |
69 | 69 | ||
70 | #include <linux/seq_file.h> | 70 | #include <linux/seq_file.h> |
71 | #include "reg.h" | 71 | #include "reg.h" |
@@ -200,7 +200,8 @@ static ssize_t read_file_tsf(struct file *file, char __user *user_buf, | |||
200 | { | 200 | { |
201 | struct ath5k_softc *sc = file->private_data; | 201 | struct ath5k_softc *sc = file->private_data; |
202 | char buf[100]; | 202 | char buf[100]; |
203 | snprintf(buf, sizeof(buf), "0x%016llx\n", ath5k_hw_get_tsf64(sc->ah)); | 203 | snprintf(buf, sizeof(buf), "0x%016llx\n", |
204 | (unsigned long long)ath5k_hw_get_tsf64(sc->ah)); | ||
204 | return simple_read_from_buffer(user_buf, count, ppos, buf, 19); | 205 | return simple_read_from_buffer(user_buf, count, ppos, buf, 19); |
205 | } | 206 | } |
206 | 207 | ||
@@ -271,7 +272,8 @@ static ssize_t read_file_beacon(struct file *file, char __user *user_buf, | |||
271 | 272 | ||
272 | tsf = ath5k_hw_get_tsf64(sc->ah); | 273 | tsf = ath5k_hw_get_tsf64(sc->ah); |
273 | len += snprintf(buf+len, sizeof(buf)-len, | 274 | len += snprintf(buf+len, sizeof(buf)-len, |
274 | "TSF\t\t0x%016llx\tTU: %08x\n", tsf, TSF_TO_TU(tsf)); | 275 | "TSF\t\t0x%016llx\tTU: %08x\n", |
276 | (unsigned long long)tsf, TSF_TO_TU(tsf)); | ||
275 | 277 | ||
276 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); | 278 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); |
277 | } | 279 | } |
@@ -340,7 +342,7 @@ static struct { | |||
340 | { ATH5K_DEBUG_LED, "led", "LED mamagement" }, | 342 | { ATH5K_DEBUG_LED, "led", "LED mamagement" }, |
341 | { ATH5K_DEBUG_DUMP_RX, "dumprx", "print received skb content" }, | 343 | { ATH5K_DEBUG_DUMP_RX, "dumprx", "print received skb content" }, |
342 | { ATH5K_DEBUG_DUMP_TX, "dumptx", "print transmit skb content" }, | 344 | { ATH5K_DEBUG_DUMP_TX, "dumptx", "print transmit skb content" }, |
343 | { ATH5K_DEBUG_DUMPMODES, "dumpmodes", "dump modes" }, | 345 | { ATH5K_DEBUG_DUMPBANDS, "dumpbands", "dump bands" }, |
344 | { ATH5K_DEBUG_TRACE, "trace", "trace function calls" }, | 346 | { ATH5K_DEBUG_TRACE, "trace", "trace function calls" }, |
345 | { ATH5K_DEBUG_ANY, "all", "show all debug levels" }, | 347 | { ATH5K_DEBUG_ANY, "all", "show all debug levels" }, |
346 | }; | 348 | }; |
@@ -452,43 +454,63 @@ ath5k_debug_finish_device(struct ath5k_softc *sc) | |||
452 | /* functions used in other places */ | 454 | /* functions used in other places */ |
453 | 455 | ||
454 | void | 456 | void |
455 | ath5k_debug_dump_modes(struct ath5k_softc *sc, struct ieee80211_hw_mode *modes) | 457 | ath5k_debug_dump_bands(struct ath5k_softc *sc) |
456 | { | 458 | { |
457 | unsigned int m, i; | 459 | unsigned int b, i; |
458 | 460 | ||
459 | if (likely(!(sc->debug.level & ATH5K_DEBUG_DUMPMODES))) | 461 | if (likely(!(sc->debug.level & ATH5K_DEBUG_DUMPBANDS))) |
460 | return; | 462 | return; |
461 | 463 | ||
462 | for (m = 0; m < NUM_DRIVER_MODES; m++) { | 464 | BUG_ON(!sc->sbands); |
463 | printk(KERN_DEBUG "Mode %u: channels %d, rates %d\n", m, | 465 | |
464 | modes[m].num_channels, modes[m].num_rates); | 466 | for (b = 0; b < IEEE80211_NUM_BANDS; b++) { |
467 | struct ieee80211_supported_band *band = &sc->sbands[b]; | ||
468 | char bname[5]; | ||
469 | switch (band->band) { | ||
470 | case IEEE80211_BAND_2GHZ: | ||
471 | strcpy(bname, "2 GHz"); | ||
472 | break; | ||
473 | case IEEE80211_BAND_5GHZ: | ||
474 | strcpy(bname, "5 GHz"); | ||
475 | break; | ||
476 | default: | ||
477 | printk(KERN_DEBUG "Band not supported: %d\n", | ||
478 | band->band); | ||
479 | return; | ||
480 | } | ||
481 | printk(KERN_DEBUG "Band %s: channels %d, rates %d\n", bname, | ||
482 | band->n_channels, band->n_bitrates); | ||
465 | printk(KERN_DEBUG " channels:\n"); | 483 | printk(KERN_DEBUG " channels:\n"); |
466 | for (i = 0; i < modes[m].num_channels; i++) | 484 | for (i = 0; i < band->n_channels; i++) |
467 | printk(KERN_DEBUG " %3d %d %.4x %.4x\n", | 485 | printk(KERN_DEBUG " %3d %d %.4x %.4x\n", |
468 | modes[m].channels[i].chan, | 486 | ieee80211_frequency_to_channel( |
469 | modes[m].channels[i].freq, | 487 | band->channels[i].center_freq), |
470 | modes[m].channels[i].val, | 488 | band->channels[i].center_freq, |
471 | modes[m].channels[i].flag); | 489 | band->channels[i].hw_value, |
490 | band->channels[i].flags); | ||
472 | printk(KERN_DEBUG " rates:\n"); | 491 | printk(KERN_DEBUG " rates:\n"); |
473 | for (i = 0; i < modes[m].num_rates; i++) | 492 | for (i = 0; i < band->n_bitrates; i++) |
474 | printk(KERN_DEBUG " %4d %.4x %.4x %.4x\n", | 493 | printk(KERN_DEBUG " %4d %.4x %.4x %.4x\n", |
475 | modes[m].rates[i].rate, | 494 | band->bitrates[i].bitrate, |
476 | modes[m].rates[i].val, | 495 | band->bitrates[i].hw_value, |
477 | modes[m].rates[i].flags, | 496 | band->bitrates[i].flags, |
478 | modes[m].rates[i].val2); | 497 | band->bitrates[i].hw_value_short); |
479 | } | 498 | } |
480 | } | 499 | } |
481 | 500 | ||
482 | static inline void | 501 | static inline void |
483 | ath5k_debug_printrxbuf(struct ath5k_buf *bf, int done) | 502 | ath5k_debug_printrxbuf(struct ath5k_buf *bf, int done, |
503 | struct ath5k_rx_status *rs) | ||
484 | { | 504 | { |
485 | struct ath5k_desc *ds = bf->desc; | 505 | struct ath5k_desc *ds = bf->desc; |
506 | struct ath5k_hw_all_rx_desc *rd = &ds->ud.ds_rx; | ||
486 | 507 | ||
487 | printk(KERN_DEBUG "R (%p %llx) %08x %08x %08x %08x %08x %08x %c\n", | 508 | printk(KERN_DEBUG "R (%p %llx) %08x %08x %08x %08x %08x %08x %c\n", |
488 | ds, (unsigned long long)bf->daddr, | 509 | ds, (unsigned long long)bf->daddr, |
489 | ds->ds_link, ds->ds_data, ds->ds_ctl0, ds->ds_ctl1, | 510 | ds->ds_link, ds->ds_data, |
490 | ds->ds_hw[0], ds->ds_hw[1], | 511 | rd->rx_ctl.rx_control_0, rd->rx_ctl.rx_control_1, |
491 | !done ? ' ' : (ds->ds_rxstat.rs_status == 0) ? '*' : '!'); | 512 | rd->u.rx_stat.rx_status_0, rd->u.rx_stat.rx_status_0, |
513 | !done ? ' ' : (rs->rs_status == 0) ? '*' : '!'); | ||
492 | } | 514 | } |
493 | 515 | ||
494 | void | 516 | void |
@@ -496,6 +518,7 @@ ath5k_debug_printrxbuffs(struct ath5k_softc *sc, struct ath5k_hw *ah) | |||
496 | { | 518 | { |
497 | struct ath5k_desc *ds; | 519 | struct ath5k_desc *ds; |
498 | struct ath5k_buf *bf; | 520 | struct ath5k_buf *bf; |
521 | struct ath5k_rx_status rs = {}; | ||
499 | int status; | 522 | int status; |
500 | 523 | ||
501 | if (likely(!(sc->debug.level & ATH5K_DEBUG_RESET))) | 524 | if (likely(!(sc->debug.level & ATH5K_DEBUG_RESET))) |
@@ -507,9 +530,9 @@ ath5k_debug_printrxbuffs(struct ath5k_softc *sc, struct ath5k_hw *ah) | |||
507 | spin_lock_bh(&sc->rxbuflock); | 530 | spin_lock_bh(&sc->rxbuflock); |
508 | list_for_each_entry(bf, &sc->rxbuf, list) { | 531 | list_for_each_entry(bf, &sc->rxbuf, list) { |
509 | ds = bf->desc; | 532 | ds = bf->desc; |
510 | status = ah->ah_proc_rx_desc(ah, ds); | 533 | status = ah->ah_proc_rx_desc(ah, ds, &rs); |
511 | if (!status) | 534 | if (!status) |
512 | ath5k_debug_printrxbuf(bf, status == 0); | 535 | ath5k_debug_printrxbuf(bf, status == 0, &rs); |
513 | } | 536 | } |
514 | spin_unlock_bh(&sc->rxbuflock); | 537 | spin_unlock_bh(&sc->rxbuflock); |
515 | } | 538 | } |
@@ -533,19 +556,24 @@ ath5k_debug_dump_skb(struct ath5k_softc *sc, | |||
533 | } | 556 | } |
534 | 557 | ||
535 | void | 558 | void |
536 | ath5k_debug_printtxbuf(struct ath5k_softc *sc, | 559 | ath5k_debug_printtxbuf(struct ath5k_softc *sc, struct ath5k_buf *bf) |
537 | struct ath5k_buf *bf, int done) | ||
538 | { | 560 | { |
539 | struct ath5k_desc *ds = bf->desc; | 561 | struct ath5k_desc *ds = bf->desc; |
562 | struct ath5k_hw_5212_tx_desc *td = &ds->ud.ds_tx5212; | ||
563 | struct ath5k_tx_status ts = {}; | ||
564 | int done; | ||
540 | 565 | ||
541 | if (likely(!(sc->debug.level & ATH5K_DEBUG_RESET))) | 566 | if (likely(!(sc->debug.level & ATH5K_DEBUG_RESET))) |
542 | return; | 567 | return; |
543 | 568 | ||
569 | done = sc->ah->ah_proc_tx_desc(sc->ah, bf->desc, &ts); | ||
570 | |||
544 | printk(KERN_DEBUG "T (%p %llx) %08x %08x %08x %08x %08x %08x %08x " | 571 | printk(KERN_DEBUG "T (%p %llx) %08x %08x %08x %08x %08x %08x %08x " |
545 | "%08x %c\n", ds, (unsigned long long)bf->daddr, ds->ds_link, | 572 | "%08x %c\n", ds, (unsigned long long)bf->daddr, ds->ds_link, |
546 | ds->ds_data, ds->ds_ctl0, ds->ds_ctl1, | 573 | ds->ds_data, td->tx_ctl.tx_control_0, td->tx_ctl.tx_control_1, |
547 | ds->ds_hw[0], ds->ds_hw[1], ds->ds_hw[2], ds->ds_hw[3], | 574 | td->tx_ctl.tx_control_2, td->tx_ctl.tx_control_3, |
548 | !done ? ' ' : (ds->ds_txstat.ts_status == 0) ? '*' : '!'); | 575 | td->tx_stat.tx_status_0, td->tx_stat.tx_status_1, |
576 | done ? ' ' : (ts.ts_status == 0) ? '*' : '!'); | ||
549 | } | 577 | } |
550 | 578 | ||
551 | #endif /* if ATH5K_DEBUG */ | 579 | #endif /* ifdef CONFIG_ATH5K_DEBUG */ |