diff options
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/debug.c')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/debug.c | 156 |
1 files changed, 150 insertions, 6 deletions
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c index b66f72dbf7b9..9489b6b25b5f 100644 --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c | |||
@@ -289,23 +289,49 @@ static ssize_t read_file_rcstat(struct file *file, char __user *user_buf, | |||
289 | if (sc->cur_rate_table == NULL) | 289 | if (sc->cur_rate_table == NULL) |
290 | return 0; | 290 | return 0; |
291 | 291 | ||
292 | max = 80 + sc->cur_rate_table->rate_cnt * 64; | 292 | max = 80 + sc->cur_rate_table->rate_cnt * 1024; |
293 | buf = kmalloc(max + 1, GFP_KERNEL); | 293 | buf = kmalloc(max + 1, GFP_KERNEL); |
294 | if (buf == NULL) | 294 | if (buf == NULL) |
295 | return 0; | 295 | return 0; |
296 | buf[max] = 0; | 296 | buf[max] = 0; |
297 | 297 | ||
298 | len += sprintf(buf, "%5s %15s %8s %9s %3s\n\n", "Rate", "Success", | 298 | len += sprintf(buf, "%6s %6s %6s " |
299 | "Retries", "XRetries", "PER"); | 299 | "%10s %10s %10s %10s\n", |
300 | "HT", "MCS", "Rate", | ||
301 | "Success", "Retries", "XRetries", "PER"); | ||
300 | 302 | ||
301 | for (i = 0; i < sc->cur_rate_table->rate_cnt; i++) { | 303 | for (i = 0; i < sc->cur_rate_table->rate_cnt; i++) { |
302 | u32 ratekbps = sc->cur_rate_table->info[i].ratekbps; | 304 | u32 ratekbps = sc->cur_rate_table->info[i].ratekbps; |
303 | struct ath_rc_stats *stats = &sc->debug.stats.rcstats[i]; | 305 | struct ath_rc_stats *stats = &sc->debug.stats.rcstats[i]; |
306 | char mcs[5]; | ||
307 | char htmode[5]; | ||
308 | int used_mcs = 0, used_htmode = 0; | ||
309 | |||
310 | if (WLAN_RC_PHY_HT(sc->cur_rate_table->info[i].phy)) { | ||
311 | used_mcs = snprintf(mcs, 5, "%d", | ||
312 | sc->cur_rate_table->info[i].ratecode); | ||
313 | |||
314 | if (WLAN_RC_PHY_40(sc->cur_rate_table->info[i].phy)) | ||
315 | used_htmode = snprintf(htmode, 5, "HT40"); | ||
316 | else if (WLAN_RC_PHY_20(sc->cur_rate_table->info[i].phy)) | ||
317 | used_htmode = snprintf(htmode, 5, "HT20"); | ||
318 | else | ||
319 | used_htmode = snprintf(htmode, 5, "????"); | ||
320 | } | ||
321 | |||
322 | mcs[used_mcs] = '\0'; | ||
323 | htmode[used_htmode] = '\0'; | ||
304 | 324 | ||
305 | len += snprintf(buf + len, max - len, | 325 | len += snprintf(buf + len, max - len, |
306 | "%3u.%d: %8u %8u %8u %8u\n", ratekbps / 1000, | 326 | "%6s %6s %3u.%d: " |
307 | (ratekbps % 1000) / 100, stats->success, | 327 | "%10u %10u %10u %10u\n", |
308 | stats->retries, stats->xretries, | 328 | htmode, |
329 | mcs, | ||
330 | ratekbps / 1000, | ||
331 | (ratekbps % 1000) / 100, | ||
332 | stats->success, | ||
333 | stats->retries, | ||
334 | stats->xretries, | ||
309 | stats->per); | 335 | stats->per); |
310 | } | 336 | } |
311 | 337 | ||
@@ -554,6 +580,116 @@ static const struct file_operations fops_xmit = { | |||
554 | .owner = THIS_MODULE | 580 | .owner = THIS_MODULE |
555 | }; | 581 | }; |
556 | 582 | ||
583 | static ssize_t read_file_recv(struct file *file, char __user *user_buf, | ||
584 | size_t count, loff_t *ppos) | ||
585 | { | ||
586 | #define PHY_ERR(s, p) \ | ||
587 | len += snprintf(buf + len, size - len, "%18s : %10u\n", s, \ | ||
588 | sc->debug.stats.rxstats.phy_err_stats[p]); | ||
589 | |||
590 | struct ath_softc *sc = file->private_data; | ||
591 | char *buf; | ||
592 | unsigned int len = 0, size = 1152; | ||
593 | ssize_t retval = 0; | ||
594 | |||
595 | buf = kzalloc(size, GFP_KERNEL); | ||
596 | if (buf == NULL) | ||
597 | return 0; | ||
598 | |||
599 | len += snprintf(buf + len, size - len, | ||
600 | "%18s : %10u\n", "CRC ERR", | ||
601 | sc->debug.stats.rxstats.crc_err); | ||
602 | len += snprintf(buf + len, size - len, | ||
603 | "%18s : %10u\n", "DECRYPT CRC ERR", | ||
604 | sc->debug.stats.rxstats.decrypt_crc_err); | ||
605 | len += snprintf(buf + len, size - len, | ||
606 | "%18s : %10u\n", "PHY ERR", | ||
607 | sc->debug.stats.rxstats.phy_err); | ||
608 | len += snprintf(buf + len, size - len, | ||
609 | "%18s : %10u\n", "MIC ERR", | ||
610 | sc->debug.stats.rxstats.mic_err); | ||
611 | len += snprintf(buf + len, size - len, | ||
612 | "%18s : %10u\n", "PRE-DELIM CRC ERR", | ||
613 | sc->debug.stats.rxstats.pre_delim_crc_err); | ||
614 | len += snprintf(buf + len, size - len, | ||
615 | "%18s : %10u\n", "POST-DELIM CRC ERR", | ||
616 | sc->debug.stats.rxstats.post_delim_crc_err); | ||
617 | len += snprintf(buf + len, size - len, | ||
618 | "%18s : %10u\n", "DECRYPT BUSY ERR", | ||
619 | sc->debug.stats.rxstats.decrypt_busy_err); | ||
620 | |||
621 | PHY_ERR("UNDERRUN", ATH9K_PHYERR_UNDERRUN); | ||
622 | PHY_ERR("TIMING", ATH9K_PHYERR_TIMING); | ||
623 | PHY_ERR("PARITY", ATH9K_PHYERR_PARITY); | ||
624 | PHY_ERR("RATE", ATH9K_PHYERR_RATE); | ||
625 | PHY_ERR("LENGTH", ATH9K_PHYERR_LENGTH); | ||
626 | PHY_ERR("RADAR", ATH9K_PHYERR_RADAR); | ||
627 | PHY_ERR("SERVICE", ATH9K_PHYERR_SERVICE); | ||
628 | PHY_ERR("TOR", ATH9K_PHYERR_TOR); | ||
629 | PHY_ERR("OFDM-TIMING", ATH9K_PHYERR_OFDM_TIMING); | ||
630 | PHY_ERR("OFDM-SIGNAL-PARITY", ATH9K_PHYERR_OFDM_SIGNAL_PARITY); | ||
631 | PHY_ERR("OFDM-RATE", ATH9K_PHYERR_OFDM_RATE_ILLEGAL); | ||
632 | PHY_ERR("OFDM-LENGTH", ATH9K_PHYERR_OFDM_LENGTH_ILLEGAL); | ||
633 | PHY_ERR("OFDM-POWER-DROP", ATH9K_PHYERR_OFDM_POWER_DROP); | ||
634 | PHY_ERR("OFDM-SERVICE", ATH9K_PHYERR_OFDM_SERVICE); | ||
635 | PHY_ERR("OFDM-RESTART", ATH9K_PHYERR_OFDM_RESTART); | ||
636 | PHY_ERR("FALSE-RADAR-EXT", ATH9K_PHYERR_FALSE_RADAR_EXT); | ||
637 | PHY_ERR("CCK-TIMING", ATH9K_PHYERR_CCK_TIMING); | ||
638 | PHY_ERR("CCK-HEADER-CRC", ATH9K_PHYERR_CCK_HEADER_CRC); | ||
639 | PHY_ERR("CCK-RATE", ATH9K_PHYERR_CCK_RATE_ILLEGAL); | ||
640 | PHY_ERR("CCK-SERVICE", ATH9K_PHYERR_CCK_SERVICE); | ||
641 | PHY_ERR("CCK-RESTART", ATH9K_PHYERR_CCK_RESTART); | ||
642 | PHY_ERR("CCK-LENGTH", ATH9K_PHYERR_CCK_LENGTH_ILLEGAL); | ||
643 | PHY_ERR("CCK-POWER-DROP", ATH9K_PHYERR_CCK_POWER_DROP); | ||
644 | PHY_ERR("HT-CRC", ATH9K_PHYERR_HT_CRC_ERROR); | ||
645 | PHY_ERR("HT-LENGTH", ATH9K_PHYERR_HT_LENGTH_ILLEGAL); | ||
646 | PHY_ERR("HT-RATE", ATH9K_PHYERR_HT_RATE_ILLEGAL); | ||
647 | |||
648 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
649 | kfree(buf); | ||
650 | |||
651 | return retval; | ||
652 | |||
653 | #undef PHY_ERR | ||
654 | } | ||
655 | |||
656 | void ath_debug_stat_rx(struct ath_softc *sc, struct ath_buf *bf) | ||
657 | { | ||
658 | #define RX_STAT_INC(c) sc->debug.stats.rxstats.c++ | ||
659 | #define RX_PHY_ERR_INC(c) sc->debug.stats.rxstats.phy_err_stats[c]++ | ||
660 | |||
661 | struct ath_desc *ds = bf->bf_desc; | ||
662 | u32 phyerr; | ||
663 | |||
664 | if (ds->ds_rxstat.rs_status & ATH9K_RXERR_CRC) | ||
665 | RX_STAT_INC(crc_err); | ||
666 | if (ds->ds_rxstat.rs_status & ATH9K_RXERR_DECRYPT) | ||
667 | RX_STAT_INC(decrypt_crc_err); | ||
668 | if (ds->ds_rxstat.rs_status & ATH9K_RXERR_MIC) | ||
669 | RX_STAT_INC(mic_err); | ||
670 | if (ds->ds_rxstat.rs_status & ATH9K_RX_DELIM_CRC_PRE) | ||
671 | RX_STAT_INC(pre_delim_crc_err); | ||
672 | if (ds->ds_rxstat.rs_status & ATH9K_RX_DELIM_CRC_POST) | ||
673 | RX_STAT_INC(post_delim_crc_err); | ||
674 | if (ds->ds_rxstat.rs_status & ATH9K_RX_DECRYPT_BUSY) | ||
675 | RX_STAT_INC(decrypt_busy_err); | ||
676 | |||
677 | if (ds->ds_rxstat.rs_status & ATH9K_RXERR_PHY) { | ||
678 | RX_STAT_INC(phy_err); | ||
679 | phyerr = ds->ds_rxstat.rs_phyerr & 0x24; | ||
680 | RX_PHY_ERR_INC(phyerr); | ||
681 | } | ||
682 | |||
683 | #undef RX_STAT_INC | ||
684 | #undef RX_PHY_ERR_INC | ||
685 | } | ||
686 | |||
687 | static const struct file_operations fops_recv = { | ||
688 | .read = read_file_recv, | ||
689 | .open = ath9k_debugfs_open, | ||
690 | .owner = THIS_MODULE | ||
691 | }; | ||
692 | |||
557 | int ath9k_init_debug(struct ath_hw *ah) | 693 | int ath9k_init_debug(struct ath_hw *ah) |
558 | { | 694 | { |
559 | struct ath_common *common = ath9k_hw_common(ah); | 695 | struct ath_common *common = ath9k_hw_common(ah); |
@@ -606,6 +742,13 @@ int ath9k_init_debug(struct ath_hw *ah) | |||
606 | if (!sc->debug.debugfs_xmit) | 742 | if (!sc->debug.debugfs_xmit) |
607 | goto err; | 743 | goto err; |
608 | 744 | ||
745 | sc->debug.debugfs_recv = debugfs_create_file("recv", | ||
746 | S_IRUSR, | ||
747 | sc->debug.debugfs_phy, | ||
748 | sc, &fops_recv); | ||
749 | if (!sc->debug.debugfs_recv) | ||
750 | goto err; | ||
751 | |||
609 | return 0; | 752 | return 0; |
610 | err: | 753 | err: |
611 | ath9k_exit_debug(ah); | 754 | ath9k_exit_debug(ah); |
@@ -617,6 +760,7 @@ void ath9k_exit_debug(struct ath_hw *ah) | |||
617 | struct ath_common *common = ath9k_hw_common(ah); | 760 | struct ath_common *common = ath9k_hw_common(ah); |
618 | struct ath_softc *sc = (struct ath_softc *) common->priv; | 761 | struct ath_softc *sc = (struct ath_softc *) common->priv; |
619 | 762 | ||
763 | debugfs_remove(sc->debug.debugfs_recv); | ||
620 | debugfs_remove(sc->debug.debugfs_xmit); | 764 | debugfs_remove(sc->debug.debugfs_xmit); |
621 | debugfs_remove(sc->debug.debugfs_wiphy); | 765 | debugfs_remove(sc->debug.debugfs_wiphy); |
622 | debugfs_remove(sc->debug.debugfs_rcstat); | 766 | debugfs_remove(sc->debug.debugfs_rcstat); |