static int read_file_misc(struct seq_file *file, void *data) { struct ieee80211_hw *hw = dev_get_drvdata(file->private); struct ath_softc *sc = hw->priv; struct ath_common *common = ath9k_hw_common(sc->sc_ah); struct ath9k_vif_iter_data iter_data; struct ath_chanctx *ctx; unsigned int reg; u32 rxfilter, i; seq_printf(file, "BSSID: %pM\n", common->curbssid); seq_printf(file, "BSSID-MASK: %pM\n", common->bssidmask); seq_printf(file, "OPMODE: %s\n", ath_opmode_to_string(sc->sc_ah->opmode)); ath9k_ps_wakeup(sc); rxfilter = ath9k_hw_getrxfilter(sc->sc_ah); ath9k_ps_restore(sc); seq_printf(file, "RXFILTER: 0x%x", rxfilter); if (rxfilter & ATH9K_RX_FILTER_UCAST) seq_puts(file, " UCAST"); if (rxfilter & ATH9K_RX_FILTER_MCAST) seq_puts(file, " MCAST"); if (rxfilter & ATH9K_RX_FILTER_BCAST) seq_puts(file, " BCAST"); if (rxfilter & ATH9K_RX_FILTER_CONTROL) seq_puts(file, " CONTROL"); if (rxfilter & ATH9K_RX_FILTER_BEACON) seq_puts(file, " BEACON"); if (rxfilter & ATH9K_RX_FILTER_PROM) seq_puts(file, " PROM"); if (rxfilter & ATH9K_RX_FILTER_PROBEREQ) seq_puts(file, " PROBEREQ"); if (rxfilter & ATH9K_RX_FILTER_PHYERR) seq_puts(file, " PHYERR"); if (rxfilter & ATH9K_RX_FILTER_MYBEACON) seq_puts(file, " MYBEACON"); if (rxfilter & ATH9K_RX_FILTER_COMP_BAR) seq_puts(file, " COMP_BAR"); if (rxfilter & ATH9K_RX_FILTER_PSPOLL) seq_puts(file, " PSPOLL"); if (rxfilter & ATH9K_RX_FILTER_PHYRADAR) seq_puts(file, " PHYRADAR"); if (rxfilter & ATH9K_RX_FILTER_MCAST_BCAST_ALL) seq_puts(file, " MCAST_BCAST_ALL"); if (rxfilter & ATH9K_RX_FILTER_CONTROL_WRAPPER) seq_puts(file, " CONTROL_WRAPPER"); seq_puts(file, "\n"); reg = sc->sc_ah->imask; seq_printf(file, "INTERRUPT-MASK: 0x%x", reg); if (reg & ATH9K_INT_SWBA) seq_puts(file, " SWBA"); if (reg & ATH9K_INT_BMISS) seq_puts(file, " BMISS"); if (reg & ATH9K_INT_CST) seq_puts(file, " CST"); if (reg & ATH9K_INT_RX) seq_puts(file, " RX"); if (reg & ATH9K_INT_RXHP) seq_puts(file, " RXHP"); if (reg & ATH9K_INT_RXLP) seq_puts(file, " RXLP"); if (reg & ATH9K_INT_BB_WATCHDOG) seq_puts(file, " BB_WATCHDOG"); seq_puts(file, "\n"); i = 0; ath_for_each_chanctx(sc, ctx) { if (list_empty(&ctx->vifs)) continue; ath9k_calculate_iter_data(sc, ctx, &iter_data); seq_printf(file, "VIFS: CTX %i(%i) AP: %i STA: %i MESH: %i WDS: %i", i++, (int)(ctx->assigned), iter_data.naps, iter_data.nstations, iter_data.nmeshes, iter_data.nwds); seq_printf(file, " ADHOC: %i OCB: %i TOTAL: %hi BEACON-VIF: %hi\n", iter_data.nadhocs, iter_data.nocbs, sc->cur_chan->nvifs, sc->nbcnvifs); } return 0; }
static ssize_t read_file_misc(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { struct ath_softc *sc = file->private_data; struct ath_common *common = ath9k_hw_common(sc->sc_ah); struct ath9k_vif_iter_data iter_data; struct ath_chanctx *ctx; char buf[512]; unsigned int len = 0; ssize_t retval = 0; unsigned int reg; u32 rxfilter, i; len += scnprintf(buf + len, sizeof(buf) - len, "BSSID: %pM\n", common->curbssid); len += scnprintf(buf + len, sizeof(buf) - len, "BSSID-MASK: %pM\n", common->bssidmask); len += scnprintf(buf + len, sizeof(buf) - len, "OPMODE: %s\n", ath_opmode_to_string(sc->sc_ah->opmode)); ath9k_ps_wakeup(sc); rxfilter = ath9k_hw_getrxfilter(sc->sc_ah); ath9k_ps_restore(sc); len += scnprintf(buf + len, sizeof(buf) - len, "RXFILTER: 0x%x", rxfilter); if (rxfilter & ATH9K_RX_FILTER_UCAST) len += scnprintf(buf + len, sizeof(buf) - len, " UCAST"); if (rxfilter & ATH9K_RX_FILTER_MCAST) len += scnprintf(buf + len, sizeof(buf) - len, " MCAST"); if (rxfilter & ATH9K_RX_FILTER_BCAST) len += scnprintf(buf + len, sizeof(buf) - len, " BCAST"); if (rxfilter & ATH9K_RX_FILTER_CONTROL) len += scnprintf(buf + len, sizeof(buf) - len, " CONTROL"); if (rxfilter & ATH9K_RX_FILTER_BEACON) len += scnprintf(buf + len, sizeof(buf) - len, " BEACON"); if (rxfilter & ATH9K_RX_FILTER_PROM) len += scnprintf(buf + len, sizeof(buf) - len, " PROM"); if (rxfilter & ATH9K_RX_FILTER_PROBEREQ) len += scnprintf(buf + len, sizeof(buf) - len, " PROBEREQ"); if (rxfilter & ATH9K_RX_FILTER_PHYERR) len += scnprintf(buf + len, sizeof(buf) - len, " PHYERR"); if (rxfilter & ATH9K_RX_FILTER_MYBEACON) len += scnprintf(buf + len, sizeof(buf) - len, " MYBEACON"); if (rxfilter & ATH9K_RX_FILTER_COMP_BAR) len += scnprintf(buf + len, sizeof(buf) - len, " COMP_BAR"); if (rxfilter & ATH9K_RX_FILTER_PSPOLL) len += scnprintf(buf + len, sizeof(buf) - len, " PSPOLL"); if (rxfilter & ATH9K_RX_FILTER_PHYRADAR) len += scnprintf(buf + len, sizeof(buf) - len, " PHYRADAR"); if (rxfilter & ATH9K_RX_FILTER_MCAST_BCAST_ALL) len += scnprintf(buf + len, sizeof(buf) - len, " MCAST_BCAST_ALL"); if (rxfilter & ATH9K_RX_FILTER_CONTROL_WRAPPER) len += scnprintf(buf + len, sizeof(buf) - len, " CONTROL_WRAPPER"); len += scnprintf(buf + len, sizeof(buf) - len, "\n"); reg = sc->sc_ah->imask; len += scnprintf(buf + len, sizeof(buf) - len, "INTERRUPT-MASK: 0x%x", reg); if (reg & ATH9K_INT_SWBA) len += scnprintf(buf + len, sizeof(buf) - len, " SWBA"); if (reg & ATH9K_INT_BMISS) len += scnprintf(buf + len, sizeof(buf) - len, " BMISS"); if (reg & ATH9K_INT_CST) len += scnprintf(buf + len, sizeof(buf) - len, " CST"); if (reg & ATH9K_INT_RX) len += scnprintf(buf + len, sizeof(buf) - len, " RX"); if (reg & ATH9K_INT_RXHP) len += scnprintf(buf + len, sizeof(buf) - len, " RXHP"); if (reg & ATH9K_INT_RXLP) len += scnprintf(buf + len, sizeof(buf) - len, " RXLP"); if (reg & ATH9K_INT_BB_WATCHDOG) len += scnprintf(buf + len, sizeof(buf) - len, " BB_WATCHDOG"); len += scnprintf(buf + len, sizeof(buf) - len, "\n"); i = 0; ath_for_each_chanctx(sc, ctx) { if (list_empty(&ctx->vifs)) continue; ath9k_calculate_iter_data(sc, ctx, &iter_data); len += scnprintf(buf + len, sizeof(buf) - len, "VIFS: CTX %i(%i) AP: %i STA: %i MESH: %i WDS: %i", i++, (int)(ctx->assigned), iter_data.naps, iter_data.nstations, iter_data.nmeshes, iter_data.nwds); len += scnprintf(buf + len, sizeof(buf) - len, " ADHOC: %i TOTAL: %hi BEACON-VIF: %hi\n", iter_data.nadhocs, sc->cur_chan->nvifs, sc->nbcnvifs); } if (len > sizeof(buf)) len = sizeof(buf); retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); return retval; }