Loading drivers/net/wireless/ath9k/ahb.c +2 −2 Original line number Diff line number Diff line Loading @@ -32,7 +32,7 @@ static void ath_ahb_cleanup(struct ath_softc *sc) iounmap(sc->mem); } static bool ath_ahb_eeprom_read(struct ath_hal *ah, u32 off, u16 *data) static bool ath_ahb_eeprom_read(struct ath_hw *ah, u32 off, u16 *data) { struct ath_softc *sc = ah->ah_sc; struct platform_device *pdev = to_platform_device(sc->dev); Loading Loading @@ -65,7 +65,7 @@ static int ath_ahb_probe(struct platform_device *pdev) struct resource *res; int irq; int ret = 0; struct ath_hal *ah; struct ath_hw *ah; if (!pdev->dev.platform_data) { dev_err(&pdev->dev, "no platform data specified\n"); Loading drivers/net/wireless/ath9k/ani.c +106 −126 Original line number Diff line number Diff line Loading @@ -16,18 +16,17 @@ #include "ath9k.h" static int ath9k_hw_get_ani_channel_idx(struct ath_hal *ah, static int ath9k_hw_get_ani_channel_idx(struct ath_hw *ah, struct ath9k_channel *chan) { struct ath_hal_5416 *ahp = AH5416(ah); int i; for (i = 0; i < ARRAY_SIZE(ahp->ah_ani); i++) { if (ahp->ah_ani[i].c && ahp->ah_ani[i].c->channel == chan->channel) for (i = 0; i < ARRAY_SIZE(ah->ah_ani); i++) { if (ah->ah_ani[i].c && ah->ah_ani[i].c->channel == chan->channel) return i; if (ahp->ah_ani[i].c == NULL) { ahp->ah_ani[i].c = chan; if (ah->ah_ani[i].c == NULL) { ah->ah_ani[i].c = chan; return i; } } Loading @@ -38,41 +37,40 @@ static int ath9k_hw_get_ani_channel_idx(struct ath_hal *ah, return 0; } static bool ath9k_hw_ani_control(struct ath_hal *ah, static bool ath9k_hw_ani_control(struct ath_hw *ah, enum ath9k_ani_cmd cmd, int param) { struct ath_hal_5416 *ahp = AH5416(ah); struct ar5416AniState *aniState = ahp->ah_curani; struct ar5416AniState *aniState = ah->ah_curani; switch (cmd & ahp->ah_ani_function) { switch (cmd & ah->ah_ani_function) { case ATH9K_ANI_NOISE_IMMUNITY_LEVEL:{ u32 level = param; if (level >= ARRAY_SIZE(ahp->ah_totalSizeDesired)) { if (level >= ARRAY_SIZE(ah->ah_totalSizeDesired)) { DPRINTF(ah->ah_sc, ATH_DBG_ANI, "level out of range (%u > %u)\n", level, (unsigned)ARRAY_SIZE(ahp->ah_totalSizeDesired)); (unsigned)ARRAY_SIZE(ah->ah_totalSizeDesired)); return false; } REG_RMW_FIELD(ah, AR_PHY_DESIRED_SZ, AR_PHY_DESIRED_SZ_TOT_DES, ahp->ah_totalSizeDesired[level]); ah->ah_totalSizeDesired[level]); REG_RMW_FIELD(ah, AR_PHY_AGC_CTL1, AR_PHY_AGC_CTL1_COARSE_LOW, ahp->ah_coarseLow[level]); ah->ah_coarseLow[level]); REG_RMW_FIELD(ah, AR_PHY_AGC_CTL1, AR_PHY_AGC_CTL1_COARSE_HIGH, ahp->ah_coarseHigh[level]); ah->ah_coarseHigh[level]); REG_RMW_FIELD(ah, AR_PHY_FIND_SIG, AR_PHY_FIND_SIG_FIRPWR, ahp->ah_firpwr[level]); ah->ah_firpwr[level]); if (level > aniState->noiseImmunityLevel) ahp->ah_stats.ast_ani_niup++; ah->ah_stats.ast_ani_niup++; else if (level < aniState->noiseImmunityLevel) ahp->ah_stats.ast_ani_nidown++; ah->ah_stats.ast_ani_nidown++; aniState->noiseImmunityLevel = level; break; } Loading Loading @@ -126,9 +124,9 @@ static bool ath9k_hw_ani_control(struct ath_hal *ah, if (!on != aniState->ofdmWeakSigDetectOff) { if (on) ahp->ah_stats.ast_ani_ofdmon++; ah->ah_stats.ast_ani_ofdmon++; else ahp->ah_stats.ast_ani_ofdmoff++; ah->ah_stats.ast_ani_ofdmoff++; aniState->ofdmWeakSigDetectOff = !on; } break; Loading @@ -142,9 +140,9 @@ static bool ath9k_hw_ani_control(struct ath_hal *ah, weakSigThrCck[high]); if (high != aniState->cckWeakSigThreshold) { if (high) ahp->ah_stats.ast_ani_cckhigh++; ah->ah_stats.ast_ani_cckhigh++; else ahp->ah_stats.ast_ani_ccklow++; ah->ah_stats.ast_ani_ccklow++; aniState->cckWeakSigThreshold = high; } break; Loading @@ -164,9 +162,9 @@ static bool ath9k_hw_ani_control(struct ath_hal *ah, AR_PHY_FIND_SIG_FIRSTEP, firstep[level]); if (level > aniState->firstepLevel) ahp->ah_stats.ast_ani_stepup++; ah->ah_stats.ast_ani_stepup++; else if (level < aniState->firstepLevel) ahp->ah_stats.ast_ani_stepdown++; ah->ah_stats.ast_ani_stepdown++; aniState->firstepLevel = level; break; } Loading @@ -187,9 +185,9 @@ static bool ath9k_hw_ani_control(struct ath_hal *ah, AR_PHY_TIMING5_CYCPWR_THR1, cycpwrThr1[level]); if (level > aniState->spurImmunityLevel) ahp->ah_stats.ast_ani_spurup++; ah->ah_stats.ast_ani_spurup++; else if (level < aniState->spurImmunityLevel) ahp->ah_stats.ast_ani_spurdown++; ah->ah_stats.ast_ani_spurdown++; aniState->spurImmunityLevel = level; break; } Loading Loading @@ -220,7 +218,7 @@ static bool ath9k_hw_ani_control(struct ath_hal *ah, return true; } static void ath9k_hw_update_mibstats(struct ath_hal *ah, static void ath9k_hw_update_mibstats(struct ath_hw *ah, struct ath9k_mib_stats *stats) { stats->ackrcv_bad += REG_READ(ah, AR_ACK_FAIL); Loading @@ -230,18 +228,17 @@ static void ath9k_hw_update_mibstats(struct ath_hal *ah, stats->beacons += REG_READ(ah, AR_BEACON_CNT); } static void ath9k_ani_restart(struct ath_hal *ah) static void ath9k_ani_restart(struct ath_hw *ah) { struct ath_hal_5416 *ahp = AH5416(ah); struct ar5416AniState *aniState; if (!DO_ANI(ah)) return; aniState = ahp->ah_curani; aniState = ah->ah_curani; aniState->listenTime = 0; if (ahp->ah_hasHwPhyCounters) { if (ah->ah_hasHwPhyCounters) { if (aniState->ofdmTrigHigh > AR_PHY_COUNTMAX) { aniState->ofdmPhyErrBase = 0; DPRINTF(ah->ah_sc, ATH_DBG_ANI, Loading @@ -267,15 +264,14 @@ static void ath9k_ani_restart(struct ath_hal *ah) REG_WRITE(ah, AR_PHY_ERR_MASK_1, AR_PHY_ERR_OFDM_TIMING); REG_WRITE(ah, AR_PHY_ERR_MASK_2, AR_PHY_ERR_CCK_TIMING); ath9k_hw_update_mibstats(ah, &ahp->ah_mibStats); ath9k_hw_update_mibstats(ah, &ah->ah_mibStats); } aniState->ofdmPhyErrCount = 0; aniState->cckPhyErrCount = 0; } static void ath9k_hw_ani_ofdm_err_trigger(struct ath_hal *ah) static void ath9k_hw_ani_ofdm_err_trigger(struct ath_hw *ah) { struct ath_hal_5416 *ahp = AH5416(ah); struct ieee80211_conf *conf = &ah->ah_sc->hw->conf; struct ar5416AniState *aniState; int32_t rssi; Loading @@ -283,7 +279,7 @@ static void ath9k_hw_ani_ofdm_err_trigger(struct ath_hal *ah) if (!DO_ANI(ah)) return; aniState = ahp->ah_curani; aniState = ah->ah_curani; if (aniState->noiseImmunityLevel < HAL_NOISE_IMMUNE_MAX) { if (ath9k_hw_ani_control(ah, ATH9K_ANI_NOISE_IMMUNITY_LEVEL, Loading @@ -306,7 +302,7 @@ static void ath9k_hw_ani_ofdm_err_trigger(struct ath_hal *ah) } return; } rssi = BEACON_RSSI(ahp); rssi = BEACON_RSSI(ah); if (rssi > aniState->rssiThrHigh) { if (!aniState->ofdmWeakSigDetectOff) { if (ath9k_hw_ani_control(ah, Loading Loading @@ -345,9 +341,8 @@ static void ath9k_hw_ani_ofdm_err_trigger(struct ath_hal *ah) } } static void ath9k_hw_ani_cck_err_trigger(struct ath_hal *ah) static void ath9k_hw_ani_cck_err_trigger(struct ath_hw *ah) { struct ath_hal_5416 *ahp = AH5416(ah); struct ieee80211_conf *conf = &ah->ah_sc->hw->conf; struct ar5416AniState *aniState; int32_t rssi; Loading @@ -355,7 +350,7 @@ static void ath9k_hw_ani_cck_err_trigger(struct ath_hal *ah) if (!DO_ANI(ah)) return; aniState = ahp->ah_curani; aniState = ah->ah_curani; if (aniState->noiseImmunityLevel < HAL_NOISE_IMMUNE_MAX) { if (ath9k_hw_ani_control(ah, ATH9K_ANI_NOISE_IMMUNITY_LEVEL, aniState->noiseImmunityLevel + 1)) { Loading @@ -369,7 +364,7 @@ static void ath9k_hw_ani_cck_err_trigger(struct ath_hal *ah) } return; } rssi = BEACON_RSSI(ahp); rssi = BEACON_RSSI(ah); if (rssi > aniState->rssiThrLow) { if (aniState->firstepLevel < HAL_FIRST_STEP_MAX) ath9k_hw_ani_control(ah, ATH9K_ANI_FIRSTEP_LEVEL, Loading @@ -383,13 +378,12 @@ static void ath9k_hw_ani_cck_err_trigger(struct ath_hal *ah) } } static void ath9k_hw_ani_lower_immunity(struct ath_hal *ah) static void ath9k_hw_ani_lower_immunity(struct ath_hw *ah) { struct ath_hal_5416 *ahp = AH5416(ah); struct ar5416AniState *aniState; int32_t rssi; aniState = ahp->ah_curani; aniState = ah->ah_curani; if (ah->ah_opmode == NL80211_IFTYPE_AP) { if (aniState->firstepLevel > 0) { Loading @@ -398,7 +392,7 @@ static void ath9k_hw_ani_lower_immunity(struct ath_hal *ah) return; } } else { rssi = BEACON_RSSI(ahp); rssi = BEACON_RSSI(ah); if (rssi > aniState->rssiThrHigh) { /* XXX: Handle me */ } else if (rssi > aniState->rssiThrLow) { Loading Loading @@ -437,9 +431,8 @@ static void ath9k_hw_ani_lower_immunity(struct ath_hal *ah) } } static int32_t ath9k_hw_ani_get_listen_time(struct ath_hal *ah) static int32_t ath9k_hw_ani_get_listen_time(struct ath_hw *ah) { struct ath_hal_5416 *ahp = AH5416(ah); struct ar5416AniState *aniState; u32 txFrameCount, rxFrameCount, cycleCount; int32_t listenTime; Loading @@ -448,11 +441,11 @@ static int32_t ath9k_hw_ani_get_listen_time(struct ath_hal *ah) rxFrameCount = REG_READ(ah, AR_RFCNT); cycleCount = REG_READ(ah, AR_CCCNT); aniState = ahp->ah_curani; aniState = ah->ah_curani; if (aniState->cycleCount == 0 || aniState->cycleCount > cycleCount) { listenTime = 0; ahp->ah_stats.ast_ani_lzero++; ah->ah_stats.ast_ani_lzero++; } else { int32_t ccdelta = cycleCount - aniState->cycleCount; int32_t rfdelta = rxFrameCount - aniState->rxFrameCount; Loading @@ -466,9 +459,8 @@ static int32_t ath9k_hw_ani_get_listen_time(struct ath_hal *ah) return listenTime; } void ath9k_ani_reset(struct ath_hal *ah) void ath9k_ani_reset(struct ath_hw *ah) { struct ath_hal_5416 *ahp = AH5416(ah); struct ar5416AniState *aniState; struct ath9k_channel *chan = ah->ah_curchan; int index; Loading @@ -477,14 +469,14 @@ void ath9k_ani_reset(struct ath_hal *ah) return; index = ath9k_hw_get_ani_channel_idx(ah, chan); aniState = &ahp->ah_ani[index]; ahp->ah_curani = aniState; aniState = &ah->ah_ani[index]; ah->ah_curani = aniState; if (DO_ANI(ah) && ah->ah_opmode != NL80211_IFTYPE_STATION && ah->ah_opmode != NL80211_IFTYPE_ADHOC) { DPRINTF(ah->ah_sc, ATH_DBG_ANI, "Reset ANI state opmode %u\n", ah->ah_opmode); ahp->ah_stats.ast_ani_reset++; ah->ah_stats.ast_ani_reset++; ath9k_hw_ani_control(ah, ATH9K_ANI_NOISE_IMMUNITY_LEVEL, 0); ath9k_hw_ani_control(ah, ATH9K_ANI_SPUR_IMMUNITY_LEVEL, 0); Loading @@ -498,13 +490,13 @@ void ath9k_ani_reset(struct ath_hal *ah) ATH9K_RX_FILTER_PHYERR); if (ah->ah_opmode == NL80211_IFTYPE_AP) { ahp->ah_curani->ofdmTrigHigh = ah->ah_curani->ofdmTrigHigh = ah->ah_config.ofdm_trig_high; ahp->ah_curani->ofdmTrigLow = ah->ah_curani->ofdmTrigLow = ah->ah_config.ofdm_trig_low; ahp->ah_curani->cckTrigHigh = ah->ah_curani->cckTrigHigh = ah->ah_config.cck_trig_high; ahp->ah_curani->cckTrigLow = ah->ah_curani->cckTrigLow = ah->ah_config.cck_trig_low; } ath9k_ani_restart(ah); Loading @@ -526,7 +518,7 @@ void ath9k_ani_reset(struct ath_hal *ah) if (aniState->firstepLevel != 0) ath9k_hw_ani_control(ah, ATH9K_ANI_FIRSTEP_LEVEL, aniState->firstepLevel); if (ahp->ah_hasHwPhyCounters) { if (ah->ah_hasHwPhyCounters) { ath9k_hw_setrxfilter(ah, ath9k_hw_getrxfilter(ah) & ~ATH9K_RX_FILTER_PHYERR); ath9k_ani_restart(ah); Loading @@ -540,34 +532,33 @@ void ath9k_ani_reset(struct ath_hal *ah) } } void ath9k_hw_ani_monitor(struct ath_hal *ah, void ath9k_hw_ani_monitor(struct ath_hw *ah, const struct ath9k_node_stats *stats, struct ath9k_channel *chan) { struct ath_hal_5416 *ahp = AH5416(ah); struct ar5416AniState *aniState; int32_t listenTime; if (!DO_ANI(ah)) return; aniState = ahp->ah_curani; ahp->ah_stats.ast_nodestats = *stats; aniState = ah->ah_curani; ah->ah_stats.ast_nodestats = *stats; listenTime = ath9k_hw_ani_get_listen_time(ah); if (listenTime < 0) { ahp->ah_stats.ast_ani_lneg++; ah->ah_stats.ast_ani_lneg++; ath9k_ani_restart(ah); return; } aniState->listenTime += listenTime; if (ahp->ah_hasHwPhyCounters) { if (ah->ah_hasHwPhyCounters) { u32 phyCnt1, phyCnt2; u32 ofdmPhyErrCnt, cckPhyErrCnt; ath9k_hw_update_mibstats(ah, &ahp->ah_mibStats); ath9k_hw_update_mibstats(ah, &ah->ah_mibStats); phyCnt1 = REG_READ(ah, AR_PHY_ERR_1); phyCnt2 = REG_READ(ah, AR_PHY_ERR_2); Loading Loading @@ -600,24 +591,24 @@ void ath9k_hw_ani_monitor(struct ath_hal *ah, } ofdmPhyErrCnt = phyCnt1 - aniState->ofdmPhyErrBase; ahp->ah_stats.ast_ani_ofdmerrs += ah->ah_stats.ast_ani_ofdmerrs += ofdmPhyErrCnt - aniState->ofdmPhyErrCount; aniState->ofdmPhyErrCount = ofdmPhyErrCnt; cckPhyErrCnt = phyCnt2 - aniState->cckPhyErrBase; ahp->ah_stats.ast_ani_cckerrs += ah->ah_stats.ast_ani_cckerrs += cckPhyErrCnt - aniState->cckPhyErrCount; aniState->cckPhyErrCount = cckPhyErrCnt; } if (aniState->listenTime > 5 * ahp->ah_aniPeriod) { if (aniState->listenTime > 5 * ah->ah_aniPeriod) { if (aniState->ofdmPhyErrCount <= aniState->listenTime * aniState->ofdmTrigLow / 1000 && aniState->cckPhyErrCount <= aniState->listenTime * aniState->cckTrigLow / 1000) ath9k_hw_ani_lower_immunity(ah); ath9k_ani_restart(ah); } else if (aniState->listenTime > ahp->ah_aniPeriod) { } else if (aniState->listenTime > ah->ah_aniPeriod) { if (aniState->ofdmPhyErrCount > aniState->listenTime * aniState->ofdmTrigHigh / 1000) { ath9k_hw_ani_ofdm_err_trigger(ah); Loading @@ -631,20 +622,16 @@ void ath9k_hw_ani_monitor(struct ath_hal *ah, } } bool ath9k_hw_phycounters(struct ath_hal *ah) bool ath9k_hw_phycounters(struct ath_hw *ah) { struct ath_hal_5416 *ahp = AH5416(ah); return ahp->ah_hasHwPhyCounters ? true : false; return ah->ah_hasHwPhyCounters ? true : false; } void ath9k_enable_mib_counters(struct ath_hal *ah) void ath9k_enable_mib_counters(struct ath_hw *ah) { struct ath_hal_5416 *ahp = AH5416(ah); DPRINTF(ah->ah_sc, ATH_DBG_ANI, "Enable MIB counters\n"); ath9k_hw_update_mibstats(ah, &ahp->ah_mibStats); ath9k_hw_update_mibstats(ah, &ah->ah_mibStats); REG_WRITE(ah, AR_FILT_OFDM, 0); REG_WRITE(ah, AR_FILT_CCK, 0); Loading @@ -655,21 +642,19 @@ void ath9k_enable_mib_counters(struct ath_hal *ah) REG_WRITE(ah, AR_PHY_ERR_MASK_2, AR_PHY_ERR_CCK_TIMING); } void ath9k_hw_disable_mib_counters(struct ath_hal *ah) void ath9k_hw_disable_mib_counters(struct ath_hw *ah) { struct ath_hal_5416 *ahp = AH5416(ah); DPRINTF(ah->ah_sc, ATH_DBG_ANI, "Disable MIB counters\n"); REG_WRITE(ah, AR_MIBC, AR_MIBC_FMC | AR_MIBC_CMC); ath9k_hw_update_mibstats(ah, &ahp->ah_mibStats); ath9k_hw_update_mibstats(ah, &ah->ah_mibStats); REG_WRITE(ah, AR_FILT_OFDM, 0); REG_WRITE(ah, AR_FILT_CCK, 0); } u32 ath9k_hw_GetMibCycleCountsPct(struct ath_hal *ah, u32 ath9k_hw_GetMibCycleCountsPct(struct ath_hw *ah, u32 *rxc_pcnt, u32 *rxf_pcnt, u32 *txf_pcnt) Loading Loading @@ -714,10 +699,9 @@ u32 ath9k_hw_GetMibCycleCountsPct(struct ath_hal *ah, * any of the MIB counters overflow/trigger so don't assume we're * here because a PHY error counter triggered. */ void ath9k_hw_procmibevent(struct ath_hal *ah, void ath9k_hw_procmibevent(struct ath_hw *ah, const struct ath9k_node_stats *stats) { struct ath_hal_5416 *ahp = AH5416(ah); u32 phyCnt1, phyCnt2; /* Reset these counters regardless */ Loading @@ -727,8 +711,8 @@ void ath9k_hw_procmibevent(struct ath_hal *ah, REG_WRITE(ah, AR_SLP_MIB_CTRL, AR_SLP_MIB_CLEAR); /* Clear the mib counters and save them in the stats */ ath9k_hw_update_mibstats(ah, &ahp->ah_mibStats); ahp->ah_stats.ast_nodestats = *stats; ath9k_hw_update_mibstats(ah, &ah->ah_mibStats); ah->ah_stats.ast_nodestats = *stats; if (!DO_ANI(ah)) return; Loading @@ -738,17 +722,17 @@ void ath9k_hw_procmibevent(struct ath_hal *ah, phyCnt2 = REG_READ(ah, AR_PHY_ERR_2); if (((phyCnt1 & AR_MIBCNT_INTRMASK) == AR_MIBCNT_INTRMASK) || ((phyCnt2 & AR_MIBCNT_INTRMASK) == AR_MIBCNT_INTRMASK)) { struct ar5416AniState *aniState = ahp->ah_curani; struct ar5416AniState *aniState = ah->ah_curani; u32 ofdmPhyErrCnt, cckPhyErrCnt; /* NB: only use ast_ani_*errs with AH_PRIVATE_DIAG */ ofdmPhyErrCnt = phyCnt1 - aniState->ofdmPhyErrBase; ahp->ah_stats.ast_ani_ofdmerrs += ah->ah_stats.ast_ani_ofdmerrs += ofdmPhyErrCnt - aniState->ofdmPhyErrCount; aniState->ofdmPhyErrCount = ofdmPhyErrCnt; cckPhyErrCnt = phyCnt2 - aniState->cckPhyErrBase; ahp->ah_stats.ast_ani_cckerrs += ah->ah_stats.ast_ani_cckerrs += cckPhyErrCnt - aniState->cckPhyErrCount; aniState->cckPhyErrCount = cckPhyErrCnt; Loading @@ -767,9 +751,8 @@ void ath9k_hw_procmibevent(struct ath_hal *ah, } } void ath9k_hw_ani_setup(struct ath_hal *ah) void ath9k_hw_ani_setup(struct ath_hw *ah) { struct ath_hal_5416 *ahp = AH5416(ah); int i; const int totalSizeDesired[] = { -55, -55, -55, -55, -62 }; Loading @@ -778,66 +761,63 @@ void ath9k_hw_ani_setup(struct ath_hal *ah) const int firpwr[] = { -78, -78, -78, -78, -80 }; for (i = 0; i < 5; i++) { ahp->ah_totalSizeDesired[i] = totalSizeDesired[i]; ahp->ah_coarseHigh[i] = coarseHigh[i]; ahp->ah_coarseLow[i] = coarseLow[i]; ahp->ah_firpwr[i] = firpwr[i]; ah->ah_totalSizeDesired[i] = totalSizeDesired[i]; ah->ah_coarseHigh[i] = coarseHigh[i]; ah->ah_coarseLow[i] = coarseLow[i]; ah->ah_firpwr[i] = firpwr[i]; } } void ath9k_hw_ani_attach(struct ath_hal *ah) void ath9k_hw_ani_attach(struct ath_hw *ah) { struct ath_hal_5416 *ahp = AH5416(ah); int i; DPRINTF(ah->ah_sc, ATH_DBG_ANI, "Attach ANI\n"); ahp->ah_hasHwPhyCounters = 1; memset(ahp->ah_ani, 0, sizeof(ahp->ah_ani)); for (i = 0; i < ARRAY_SIZE(ahp->ah_ani); i++) { ahp->ah_ani[i].ofdmTrigHigh = ATH9K_ANI_OFDM_TRIG_HIGH; ahp->ah_ani[i].ofdmTrigLow = ATH9K_ANI_OFDM_TRIG_LOW; ahp->ah_ani[i].cckTrigHigh = ATH9K_ANI_CCK_TRIG_HIGH; ahp->ah_ani[i].cckTrigLow = ATH9K_ANI_CCK_TRIG_LOW; ahp->ah_ani[i].rssiThrHigh = ATH9K_ANI_RSSI_THR_HIGH; ahp->ah_ani[i].rssiThrLow = ATH9K_ANI_RSSI_THR_LOW; ahp->ah_ani[i].ofdmWeakSigDetectOff = ah->ah_hasHwPhyCounters = 1; memset(ah->ah_ani, 0, sizeof(ah->ah_ani)); for (i = 0; i < ARRAY_SIZE(ah->ah_ani); i++) { ah->ah_ani[i].ofdmTrigHigh = ATH9K_ANI_OFDM_TRIG_HIGH; ah->ah_ani[i].ofdmTrigLow = ATH9K_ANI_OFDM_TRIG_LOW; ah->ah_ani[i].cckTrigHigh = ATH9K_ANI_CCK_TRIG_HIGH; ah->ah_ani[i].cckTrigLow = ATH9K_ANI_CCK_TRIG_LOW; ah->ah_ani[i].rssiThrHigh = ATH9K_ANI_RSSI_THR_HIGH; ah->ah_ani[i].rssiThrLow = ATH9K_ANI_RSSI_THR_LOW; ah->ah_ani[i].ofdmWeakSigDetectOff = !ATH9K_ANI_USE_OFDM_WEAK_SIG; ahp->ah_ani[i].cckWeakSigThreshold = ah->ah_ani[i].cckWeakSigThreshold = ATH9K_ANI_CCK_WEAK_SIG_THR; ahp->ah_ani[i].spurImmunityLevel = ATH9K_ANI_SPUR_IMMUNE_LVL; ahp->ah_ani[i].firstepLevel = ATH9K_ANI_FIRSTEP_LVL; if (ahp->ah_hasHwPhyCounters) { ahp->ah_ani[i].ofdmPhyErrBase = ah->ah_ani[i].spurImmunityLevel = ATH9K_ANI_SPUR_IMMUNE_LVL; ah->ah_ani[i].firstepLevel = ATH9K_ANI_FIRSTEP_LVL; if (ah->ah_hasHwPhyCounters) { ah->ah_ani[i].ofdmPhyErrBase = AR_PHY_COUNTMAX - ATH9K_ANI_OFDM_TRIG_HIGH; ahp->ah_ani[i].cckPhyErrBase = ah->ah_ani[i].cckPhyErrBase = AR_PHY_COUNTMAX - ATH9K_ANI_CCK_TRIG_HIGH; } } if (ahp->ah_hasHwPhyCounters) { if (ah->ah_hasHwPhyCounters) { DPRINTF(ah->ah_sc, ATH_DBG_ANI, "Setting OfdmErrBase = 0x%08x\n", ahp->ah_ani[0].ofdmPhyErrBase); ah->ah_ani[0].ofdmPhyErrBase); DPRINTF(ah->ah_sc, ATH_DBG_ANI, "Setting cckErrBase = 0x%08x\n", ahp->ah_ani[0].cckPhyErrBase); ah->ah_ani[0].cckPhyErrBase); REG_WRITE(ah, AR_PHY_ERR_1, ahp->ah_ani[0].ofdmPhyErrBase); REG_WRITE(ah, AR_PHY_ERR_2, ahp->ah_ani[0].cckPhyErrBase); REG_WRITE(ah, AR_PHY_ERR_1, ah->ah_ani[0].ofdmPhyErrBase); REG_WRITE(ah, AR_PHY_ERR_2, ah->ah_ani[0].cckPhyErrBase); ath9k_enable_mib_counters(ah); } ahp->ah_aniPeriod = ATH9K_ANI_PERIOD; ah->ah_aniPeriod = ATH9K_ANI_PERIOD; if (ah->ah_config.enable_ani) ahp->ah_procPhyErr |= HAL_PROCESS_ANI; ah->ah_procPhyErr |= HAL_PROCESS_ANI; } void ath9k_hw_ani_detach(struct ath_hal *ah) void ath9k_hw_ani_detach(struct ath_hw *ah) { struct ath_hal_5416 *ahp = AH5416(ah); DPRINTF(ah->ah_sc, ATH_DBG_ANI, "Detach ANI\n"); if (ahp->ah_hasHwPhyCounters) { if (ah->ah_hasHwPhyCounters) { ath9k_hw_disable_mib_counters(ah); REG_WRITE(ah, AR_PHY_ERR_1, 0); REG_WRITE(ah, AR_PHY_ERR_2, 0); Loading drivers/net/wireless/ath9k/ani.h +11 −11 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ #define HAL_PROCESS_ANI 0x00000001 #define ATH9K_RSSI_EP_MULTIPLIER (1<<7) #define DO_ANI(ah) ((AH5416(ah)->ah_procPhyErr & HAL_PROCESS_ANI)) #define DO_ANI(ah) (((ah)->ah_procPhyErr & HAL_PROCESS_ANI)) #define HAL_EP_RND(x, mul) \ ((((x)%(mul)) >= ((mul)/2)) ? ((x) + ((mul) - 1)) / (mul) : (x)/(mul)) Loading Loading @@ -120,19 +120,19 @@ struct ar5416Stats { }; #define ah_mibStats ah_stats.ast_mibstats void ath9k_ani_reset(struct ath_hal *ah); void ath9k_hw_ani_monitor(struct ath_hal *ah, void ath9k_ani_reset(struct ath_hw *ah); void ath9k_hw_ani_monitor(struct ath_hw *ah, const struct ath9k_node_stats *stats, struct ath9k_channel *chan); bool ath9k_hw_phycounters(struct ath_hal *ah); void ath9k_enable_mib_counters(struct ath_hal *ah); void ath9k_hw_disable_mib_counters(struct ath_hal *ah); u32 ath9k_hw_GetMibCycleCountsPct(struct ath_hal *ah, u32 *rxc_pcnt, bool ath9k_hw_phycounters(struct ath_hw *ah); void ath9k_enable_mib_counters(struct ath_hw *ah); void ath9k_hw_disable_mib_counters(struct ath_hw *ah); u32 ath9k_hw_GetMibCycleCountsPct(struct ath_hw *ah, u32 *rxc_pcnt, u32 *rxf_pcnt, u32 *txf_pcnt); void ath9k_hw_procmibevent(struct ath_hal *ah, void ath9k_hw_procmibevent(struct ath_hw *ah, const struct ath9k_node_stats *stats); void ath9k_hw_ani_setup(struct ath_hal *ah); void ath9k_hw_ani_attach(struct ath_hal *ah); void ath9k_hw_ani_detach(struct ath_hal *ah); void ath9k_hw_ani_setup(struct ath_hw *ah); void ath9k_hw_ani_attach(struct ath_hw *ah); void ath9k_hw_ani_detach(struct ath_hw *ah); #endif /* ANI_H */ drivers/net/wireless/ath9k/ath9k.h +3 −3 Original line number Diff line number Diff line Loading @@ -455,7 +455,7 @@ struct ath_beacon { void ath9k_beacon_tasklet(unsigned long data); void ath_beacon_config(struct ath_softc *sc, int if_id); int ath_beaconq_setup(struct ath_hal *ah); int ath_beaconq_setup(struct ath_hw *ah); int ath_beacon_alloc(struct ath_softc *sc, int if_id); void ath_beacon_return(struct ath_softc *sc, struct ath_vif *avp); void ath_beacon_sync(struct ath_softc *sc, int if_id); Loading Loading @@ -565,7 +565,7 @@ struct ath_rfkill { struct ath_bus_ops { void (*read_cachesize)(struct ath_softc *sc, int *csz); void (*cleanup)(struct ath_softc *sc); bool (*eeprom_read)(struct ath_hal *ah, u32 off, u16 *data); bool (*eeprom_read)(struct ath_hw *ah, u32 off, u16 *data); }; struct ath_softc { Loading @@ -573,7 +573,7 @@ struct ath_softc { struct device *dev; struct tasklet_struct intr_tq; struct tasklet_struct bcon_tasklet; struct ath_hal *sc_ah; struct ath_hw *sc_ah; void __iomem *mem; int irq; spinlock_t sc_resetlock; Loading drivers/net/wireless/ath9k/beacon.c +6 −6 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ */ static int ath_beaconq_config(struct ath_softc *sc) { struct ath_hal *ah = sc->sc_ah; struct ath_hw *ah = sc->sc_ah; struct ath9k_tx_queue_info qi; ath9k_hw_get_txq_props(ah, sc->beacon.beaconq, &qi); Loading Loading @@ -66,7 +66,7 @@ static void ath_beacon_setup(struct ath_softc *sc, struct ath_vif *avp, struct ath_buf *bf) { struct sk_buff *skb = (struct sk_buff *)bf->bf_mpdu; struct ath_hal *ah = sc->sc_ah; struct ath_hw *ah = sc->sc_ah; struct ath_desc *ds; struct ath9k_11n_rate_series series[4]; struct ath_rate_table *rt; Loading Loading @@ -248,7 +248,7 @@ static struct ath_buf *ath_beacon_generate(struct ath_softc *sc, int if_id) static void ath_beacon_start_adhoc(struct ath_softc *sc, int if_id) { struct ieee80211_vif *vif; struct ath_hal *ah = sc->sc_ah; struct ath_hw *ah = sc->sc_ah; struct ath_buf *bf; struct ath_vif *avp; struct sk_buff *skb; Loading Loading @@ -276,7 +276,7 @@ static void ath_beacon_start_adhoc(struct ath_softc *sc, int if_id) sc->beacon.beaconq, ito64(bf->bf_daddr), bf->bf_desc); } int ath_beaconq_setup(struct ath_hal *ah) int ath_beaconq_setup(struct ath_hw *ah) { struct ath9k_tx_queue_info qi; Loading Loading @@ -444,7 +444,7 @@ void ath_beacon_return(struct ath_softc *sc, struct ath_vif *avp) void ath9k_beacon_tasklet(unsigned long data) { struct ath_softc *sc = (struct ath_softc *)data; struct ath_hal *ah = sc->sc_ah; struct ath_hw *ah = sc->sc_ah; struct ath_buf *bf = NULL; int slot, if_id; u32 bfaddr; Loading Loading @@ -619,7 +619,7 @@ void ath9k_beacon_tasklet(unsigned long data) void ath_beacon_config(struct ath_softc *sc, int if_id) { struct ieee80211_vif *vif; struct ath_hal *ah = sc->sc_ah; struct ath_hw *ah = sc->sc_ah; struct ath_beacon_config conf; struct ath_vif *avp; enum nl80211_iftype opmode; Loading Loading
drivers/net/wireless/ath9k/ahb.c +2 −2 Original line number Diff line number Diff line Loading @@ -32,7 +32,7 @@ static void ath_ahb_cleanup(struct ath_softc *sc) iounmap(sc->mem); } static bool ath_ahb_eeprom_read(struct ath_hal *ah, u32 off, u16 *data) static bool ath_ahb_eeprom_read(struct ath_hw *ah, u32 off, u16 *data) { struct ath_softc *sc = ah->ah_sc; struct platform_device *pdev = to_platform_device(sc->dev); Loading Loading @@ -65,7 +65,7 @@ static int ath_ahb_probe(struct platform_device *pdev) struct resource *res; int irq; int ret = 0; struct ath_hal *ah; struct ath_hw *ah; if (!pdev->dev.platform_data) { dev_err(&pdev->dev, "no platform data specified\n"); Loading
drivers/net/wireless/ath9k/ani.c +106 −126 Original line number Diff line number Diff line Loading @@ -16,18 +16,17 @@ #include "ath9k.h" static int ath9k_hw_get_ani_channel_idx(struct ath_hal *ah, static int ath9k_hw_get_ani_channel_idx(struct ath_hw *ah, struct ath9k_channel *chan) { struct ath_hal_5416 *ahp = AH5416(ah); int i; for (i = 0; i < ARRAY_SIZE(ahp->ah_ani); i++) { if (ahp->ah_ani[i].c && ahp->ah_ani[i].c->channel == chan->channel) for (i = 0; i < ARRAY_SIZE(ah->ah_ani); i++) { if (ah->ah_ani[i].c && ah->ah_ani[i].c->channel == chan->channel) return i; if (ahp->ah_ani[i].c == NULL) { ahp->ah_ani[i].c = chan; if (ah->ah_ani[i].c == NULL) { ah->ah_ani[i].c = chan; return i; } } Loading @@ -38,41 +37,40 @@ static int ath9k_hw_get_ani_channel_idx(struct ath_hal *ah, return 0; } static bool ath9k_hw_ani_control(struct ath_hal *ah, static bool ath9k_hw_ani_control(struct ath_hw *ah, enum ath9k_ani_cmd cmd, int param) { struct ath_hal_5416 *ahp = AH5416(ah); struct ar5416AniState *aniState = ahp->ah_curani; struct ar5416AniState *aniState = ah->ah_curani; switch (cmd & ahp->ah_ani_function) { switch (cmd & ah->ah_ani_function) { case ATH9K_ANI_NOISE_IMMUNITY_LEVEL:{ u32 level = param; if (level >= ARRAY_SIZE(ahp->ah_totalSizeDesired)) { if (level >= ARRAY_SIZE(ah->ah_totalSizeDesired)) { DPRINTF(ah->ah_sc, ATH_DBG_ANI, "level out of range (%u > %u)\n", level, (unsigned)ARRAY_SIZE(ahp->ah_totalSizeDesired)); (unsigned)ARRAY_SIZE(ah->ah_totalSizeDesired)); return false; } REG_RMW_FIELD(ah, AR_PHY_DESIRED_SZ, AR_PHY_DESIRED_SZ_TOT_DES, ahp->ah_totalSizeDesired[level]); ah->ah_totalSizeDesired[level]); REG_RMW_FIELD(ah, AR_PHY_AGC_CTL1, AR_PHY_AGC_CTL1_COARSE_LOW, ahp->ah_coarseLow[level]); ah->ah_coarseLow[level]); REG_RMW_FIELD(ah, AR_PHY_AGC_CTL1, AR_PHY_AGC_CTL1_COARSE_HIGH, ahp->ah_coarseHigh[level]); ah->ah_coarseHigh[level]); REG_RMW_FIELD(ah, AR_PHY_FIND_SIG, AR_PHY_FIND_SIG_FIRPWR, ahp->ah_firpwr[level]); ah->ah_firpwr[level]); if (level > aniState->noiseImmunityLevel) ahp->ah_stats.ast_ani_niup++; ah->ah_stats.ast_ani_niup++; else if (level < aniState->noiseImmunityLevel) ahp->ah_stats.ast_ani_nidown++; ah->ah_stats.ast_ani_nidown++; aniState->noiseImmunityLevel = level; break; } Loading Loading @@ -126,9 +124,9 @@ static bool ath9k_hw_ani_control(struct ath_hal *ah, if (!on != aniState->ofdmWeakSigDetectOff) { if (on) ahp->ah_stats.ast_ani_ofdmon++; ah->ah_stats.ast_ani_ofdmon++; else ahp->ah_stats.ast_ani_ofdmoff++; ah->ah_stats.ast_ani_ofdmoff++; aniState->ofdmWeakSigDetectOff = !on; } break; Loading @@ -142,9 +140,9 @@ static bool ath9k_hw_ani_control(struct ath_hal *ah, weakSigThrCck[high]); if (high != aniState->cckWeakSigThreshold) { if (high) ahp->ah_stats.ast_ani_cckhigh++; ah->ah_stats.ast_ani_cckhigh++; else ahp->ah_stats.ast_ani_ccklow++; ah->ah_stats.ast_ani_ccklow++; aniState->cckWeakSigThreshold = high; } break; Loading @@ -164,9 +162,9 @@ static bool ath9k_hw_ani_control(struct ath_hal *ah, AR_PHY_FIND_SIG_FIRSTEP, firstep[level]); if (level > aniState->firstepLevel) ahp->ah_stats.ast_ani_stepup++; ah->ah_stats.ast_ani_stepup++; else if (level < aniState->firstepLevel) ahp->ah_stats.ast_ani_stepdown++; ah->ah_stats.ast_ani_stepdown++; aniState->firstepLevel = level; break; } Loading @@ -187,9 +185,9 @@ static bool ath9k_hw_ani_control(struct ath_hal *ah, AR_PHY_TIMING5_CYCPWR_THR1, cycpwrThr1[level]); if (level > aniState->spurImmunityLevel) ahp->ah_stats.ast_ani_spurup++; ah->ah_stats.ast_ani_spurup++; else if (level < aniState->spurImmunityLevel) ahp->ah_stats.ast_ani_spurdown++; ah->ah_stats.ast_ani_spurdown++; aniState->spurImmunityLevel = level; break; } Loading Loading @@ -220,7 +218,7 @@ static bool ath9k_hw_ani_control(struct ath_hal *ah, return true; } static void ath9k_hw_update_mibstats(struct ath_hal *ah, static void ath9k_hw_update_mibstats(struct ath_hw *ah, struct ath9k_mib_stats *stats) { stats->ackrcv_bad += REG_READ(ah, AR_ACK_FAIL); Loading @@ -230,18 +228,17 @@ static void ath9k_hw_update_mibstats(struct ath_hal *ah, stats->beacons += REG_READ(ah, AR_BEACON_CNT); } static void ath9k_ani_restart(struct ath_hal *ah) static void ath9k_ani_restart(struct ath_hw *ah) { struct ath_hal_5416 *ahp = AH5416(ah); struct ar5416AniState *aniState; if (!DO_ANI(ah)) return; aniState = ahp->ah_curani; aniState = ah->ah_curani; aniState->listenTime = 0; if (ahp->ah_hasHwPhyCounters) { if (ah->ah_hasHwPhyCounters) { if (aniState->ofdmTrigHigh > AR_PHY_COUNTMAX) { aniState->ofdmPhyErrBase = 0; DPRINTF(ah->ah_sc, ATH_DBG_ANI, Loading @@ -267,15 +264,14 @@ static void ath9k_ani_restart(struct ath_hal *ah) REG_WRITE(ah, AR_PHY_ERR_MASK_1, AR_PHY_ERR_OFDM_TIMING); REG_WRITE(ah, AR_PHY_ERR_MASK_2, AR_PHY_ERR_CCK_TIMING); ath9k_hw_update_mibstats(ah, &ahp->ah_mibStats); ath9k_hw_update_mibstats(ah, &ah->ah_mibStats); } aniState->ofdmPhyErrCount = 0; aniState->cckPhyErrCount = 0; } static void ath9k_hw_ani_ofdm_err_trigger(struct ath_hal *ah) static void ath9k_hw_ani_ofdm_err_trigger(struct ath_hw *ah) { struct ath_hal_5416 *ahp = AH5416(ah); struct ieee80211_conf *conf = &ah->ah_sc->hw->conf; struct ar5416AniState *aniState; int32_t rssi; Loading @@ -283,7 +279,7 @@ static void ath9k_hw_ani_ofdm_err_trigger(struct ath_hal *ah) if (!DO_ANI(ah)) return; aniState = ahp->ah_curani; aniState = ah->ah_curani; if (aniState->noiseImmunityLevel < HAL_NOISE_IMMUNE_MAX) { if (ath9k_hw_ani_control(ah, ATH9K_ANI_NOISE_IMMUNITY_LEVEL, Loading @@ -306,7 +302,7 @@ static void ath9k_hw_ani_ofdm_err_trigger(struct ath_hal *ah) } return; } rssi = BEACON_RSSI(ahp); rssi = BEACON_RSSI(ah); if (rssi > aniState->rssiThrHigh) { if (!aniState->ofdmWeakSigDetectOff) { if (ath9k_hw_ani_control(ah, Loading Loading @@ -345,9 +341,8 @@ static void ath9k_hw_ani_ofdm_err_trigger(struct ath_hal *ah) } } static void ath9k_hw_ani_cck_err_trigger(struct ath_hal *ah) static void ath9k_hw_ani_cck_err_trigger(struct ath_hw *ah) { struct ath_hal_5416 *ahp = AH5416(ah); struct ieee80211_conf *conf = &ah->ah_sc->hw->conf; struct ar5416AniState *aniState; int32_t rssi; Loading @@ -355,7 +350,7 @@ static void ath9k_hw_ani_cck_err_trigger(struct ath_hal *ah) if (!DO_ANI(ah)) return; aniState = ahp->ah_curani; aniState = ah->ah_curani; if (aniState->noiseImmunityLevel < HAL_NOISE_IMMUNE_MAX) { if (ath9k_hw_ani_control(ah, ATH9K_ANI_NOISE_IMMUNITY_LEVEL, aniState->noiseImmunityLevel + 1)) { Loading @@ -369,7 +364,7 @@ static void ath9k_hw_ani_cck_err_trigger(struct ath_hal *ah) } return; } rssi = BEACON_RSSI(ahp); rssi = BEACON_RSSI(ah); if (rssi > aniState->rssiThrLow) { if (aniState->firstepLevel < HAL_FIRST_STEP_MAX) ath9k_hw_ani_control(ah, ATH9K_ANI_FIRSTEP_LEVEL, Loading @@ -383,13 +378,12 @@ static void ath9k_hw_ani_cck_err_trigger(struct ath_hal *ah) } } static void ath9k_hw_ani_lower_immunity(struct ath_hal *ah) static void ath9k_hw_ani_lower_immunity(struct ath_hw *ah) { struct ath_hal_5416 *ahp = AH5416(ah); struct ar5416AniState *aniState; int32_t rssi; aniState = ahp->ah_curani; aniState = ah->ah_curani; if (ah->ah_opmode == NL80211_IFTYPE_AP) { if (aniState->firstepLevel > 0) { Loading @@ -398,7 +392,7 @@ static void ath9k_hw_ani_lower_immunity(struct ath_hal *ah) return; } } else { rssi = BEACON_RSSI(ahp); rssi = BEACON_RSSI(ah); if (rssi > aniState->rssiThrHigh) { /* XXX: Handle me */ } else if (rssi > aniState->rssiThrLow) { Loading Loading @@ -437,9 +431,8 @@ static void ath9k_hw_ani_lower_immunity(struct ath_hal *ah) } } static int32_t ath9k_hw_ani_get_listen_time(struct ath_hal *ah) static int32_t ath9k_hw_ani_get_listen_time(struct ath_hw *ah) { struct ath_hal_5416 *ahp = AH5416(ah); struct ar5416AniState *aniState; u32 txFrameCount, rxFrameCount, cycleCount; int32_t listenTime; Loading @@ -448,11 +441,11 @@ static int32_t ath9k_hw_ani_get_listen_time(struct ath_hal *ah) rxFrameCount = REG_READ(ah, AR_RFCNT); cycleCount = REG_READ(ah, AR_CCCNT); aniState = ahp->ah_curani; aniState = ah->ah_curani; if (aniState->cycleCount == 0 || aniState->cycleCount > cycleCount) { listenTime = 0; ahp->ah_stats.ast_ani_lzero++; ah->ah_stats.ast_ani_lzero++; } else { int32_t ccdelta = cycleCount - aniState->cycleCount; int32_t rfdelta = rxFrameCount - aniState->rxFrameCount; Loading @@ -466,9 +459,8 @@ static int32_t ath9k_hw_ani_get_listen_time(struct ath_hal *ah) return listenTime; } void ath9k_ani_reset(struct ath_hal *ah) void ath9k_ani_reset(struct ath_hw *ah) { struct ath_hal_5416 *ahp = AH5416(ah); struct ar5416AniState *aniState; struct ath9k_channel *chan = ah->ah_curchan; int index; Loading @@ -477,14 +469,14 @@ void ath9k_ani_reset(struct ath_hal *ah) return; index = ath9k_hw_get_ani_channel_idx(ah, chan); aniState = &ahp->ah_ani[index]; ahp->ah_curani = aniState; aniState = &ah->ah_ani[index]; ah->ah_curani = aniState; if (DO_ANI(ah) && ah->ah_opmode != NL80211_IFTYPE_STATION && ah->ah_opmode != NL80211_IFTYPE_ADHOC) { DPRINTF(ah->ah_sc, ATH_DBG_ANI, "Reset ANI state opmode %u\n", ah->ah_opmode); ahp->ah_stats.ast_ani_reset++; ah->ah_stats.ast_ani_reset++; ath9k_hw_ani_control(ah, ATH9K_ANI_NOISE_IMMUNITY_LEVEL, 0); ath9k_hw_ani_control(ah, ATH9K_ANI_SPUR_IMMUNITY_LEVEL, 0); Loading @@ -498,13 +490,13 @@ void ath9k_ani_reset(struct ath_hal *ah) ATH9K_RX_FILTER_PHYERR); if (ah->ah_opmode == NL80211_IFTYPE_AP) { ahp->ah_curani->ofdmTrigHigh = ah->ah_curani->ofdmTrigHigh = ah->ah_config.ofdm_trig_high; ahp->ah_curani->ofdmTrigLow = ah->ah_curani->ofdmTrigLow = ah->ah_config.ofdm_trig_low; ahp->ah_curani->cckTrigHigh = ah->ah_curani->cckTrigHigh = ah->ah_config.cck_trig_high; ahp->ah_curani->cckTrigLow = ah->ah_curani->cckTrigLow = ah->ah_config.cck_trig_low; } ath9k_ani_restart(ah); Loading @@ -526,7 +518,7 @@ void ath9k_ani_reset(struct ath_hal *ah) if (aniState->firstepLevel != 0) ath9k_hw_ani_control(ah, ATH9K_ANI_FIRSTEP_LEVEL, aniState->firstepLevel); if (ahp->ah_hasHwPhyCounters) { if (ah->ah_hasHwPhyCounters) { ath9k_hw_setrxfilter(ah, ath9k_hw_getrxfilter(ah) & ~ATH9K_RX_FILTER_PHYERR); ath9k_ani_restart(ah); Loading @@ -540,34 +532,33 @@ void ath9k_ani_reset(struct ath_hal *ah) } } void ath9k_hw_ani_monitor(struct ath_hal *ah, void ath9k_hw_ani_monitor(struct ath_hw *ah, const struct ath9k_node_stats *stats, struct ath9k_channel *chan) { struct ath_hal_5416 *ahp = AH5416(ah); struct ar5416AniState *aniState; int32_t listenTime; if (!DO_ANI(ah)) return; aniState = ahp->ah_curani; ahp->ah_stats.ast_nodestats = *stats; aniState = ah->ah_curani; ah->ah_stats.ast_nodestats = *stats; listenTime = ath9k_hw_ani_get_listen_time(ah); if (listenTime < 0) { ahp->ah_stats.ast_ani_lneg++; ah->ah_stats.ast_ani_lneg++; ath9k_ani_restart(ah); return; } aniState->listenTime += listenTime; if (ahp->ah_hasHwPhyCounters) { if (ah->ah_hasHwPhyCounters) { u32 phyCnt1, phyCnt2; u32 ofdmPhyErrCnt, cckPhyErrCnt; ath9k_hw_update_mibstats(ah, &ahp->ah_mibStats); ath9k_hw_update_mibstats(ah, &ah->ah_mibStats); phyCnt1 = REG_READ(ah, AR_PHY_ERR_1); phyCnt2 = REG_READ(ah, AR_PHY_ERR_2); Loading Loading @@ -600,24 +591,24 @@ void ath9k_hw_ani_monitor(struct ath_hal *ah, } ofdmPhyErrCnt = phyCnt1 - aniState->ofdmPhyErrBase; ahp->ah_stats.ast_ani_ofdmerrs += ah->ah_stats.ast_ani_ofdmerrs += ofdmPhyErrCnt - aniState->ofdmPhyErrCount; aniState->ofdmPhyErrCount = ofdmPhyErrCnt; cckPhyErrCnt = phyCnt2 - aniState->cckPhyErrBase; ahp->ah_stats.ast_ani_cckerrs += ah->ah_stats.ast_ani_cckerrs += cckPhyErrCnt - aniState->cckPhyErrCount; aniState->cckPhyErrCount = cckPhyErrCnt; } if (aniState->listenTime > 5 * ahp->ah_aniPeriod) { if (aniState->listenTime > 5 * ah->ah_aniPeriod) { if (aniState->ofdmPhyErrCount <= aniState->listenTime * aniState->ofdmTrigLow / 1000 && aniState->cckPhyErrCount <= aniState->listenTime * aniState->cckTrigLow / 1000) ath9k_hw_ani_lower_immunity(ah); ath9k_ani_restart(ah); } else if (aniState->listenTime > ahp->ah_aniPeriod) { } else if (aniState->listenTime > ah->ah_aniPeriod) { if (aniState->ofdmPhyErrCount > aniState->listenTime * aniState->ofdmTrigHigh / 1000) { ath9k_hw_ani_ofdm_err_trigger(ah); Loading @@ -631,20 +622,16 @@ void ath9k_hw_ani_monitor(struct ath_hal *ah, } } bool ath9k_hw_phycounters(struct ath_hal *ah) bool ath9k_hw_phycounters(struct ath_hw *ah) { struct ath_hal_5416 *ahp = AH5416(ah); return ahp->ah_hasHwPhyCounters ? true : false; return ah->ah_hasHwPhyCounters ? true : false; } void ath9k_enable_mib_counters(struct ath_hal *ah) void ath9k_enable_mib_counters(struct ath_hw *ah) { struct ath_hal_5416 *ahp = AH5416(ah); DPRINTF(ah->ah_sc, ATH_DBG_ANI, "Enable MIB counters\n"); ath9k_hw_update_mibstats(ah, &ahp->ah_mibStats); ath9k_hw_update_mibstats(ah, &ah->ah_mibStats); REG_WRITE(ah, AR_FILT_OFDM, 0); REG_WRITE(ah, AR_FILT_CCK, 0); Loading @@ -655,21 +642,19 @@ void ath9k_enable_mib_counters(struct ath_hal *ah) REG_WRITE(ah, AR_PHY_ERR_MASK_2, AR_PHY_ERR_CCK_TIMING); } void ath9k_hw_disable_mib_counters(struct ath_hal *ah) void ath9k_hw_disable_mib_counters(struct ath_hw *ah) { struct ath_hal_5416 *ahp = AH5416(ah); DPRINTF(ah->ah_sc, ATH_DBG_ANI, "Disable MIB counters\n"); REG_WRITE(ah, AR_MIBC, AR_MIBC_FMC | AR_MIBC_CMC); ath9k_hw_update_mibstats(ah, &ahp->ah_mibStats); ath9k_hw_update_mibstats(ah, &ah->ah_mibStats); REG_WRITE(ah, AR_FILT_OFDM, 0); REG_WRITE(ah, AR_FILT_CCK, 0); } u32 ath9k_hw_GetMibCycleCountsPct(struct ath_hal *ah, u32 ath9k_hw_GetMibCycleCountsPct(struct ath_hw *ah, u32 *rxc_pcnt, u32 *rxf_pcnt, u32 *txf_pcnt) Loading Loading @@ -714,10 +699,9 @@ u32 ath9k_hw_GetMibCycleCountsPct(struct ath_hal *ah, * any of the MIB counters overflow/trigger so don't assume we're * here because a PHY error counter triggered. */ void ath9k_hw_procmibevent(struct ath_hal *ah, void ath9k_hw_procmibevent(struct ath_hw *ah, const struct ath9k_node_stats *stats) { struct ath_hal_5416 *ahp = AH5416(ah); u32 phyCnt1, phyCnt2; /* Reset these counters regardless */ Loading @@ -727,8 +711,8 @@ void ath9k_hw_procmibevent(struct ath_hal *ah, REG_WRITE(ah, AR_SLP_MIB_CTRL, AR_SLP_MIB_CLEAR); /* Clear the mib counters and save them in the stats */ ath9k_hw_update_mibstats(ah, &ahp->ah_mibStats); ahp->ah_stats.ast_nodestats = *stats; ath9k_hw_update_mibstats(ah, &ah->ah_mibStats); ah->ah_stats.ast_nodestats = *stats; if (!DO_ANI(ah)) return; Loading @@ -738,17 +722,17 @@ void ath9k_hw_procmibevent(struct ath_hal *ah, phyCnt2 = REG_READ(ah, AR_PHY_ERR_2); if (((phyCnt1 & AR_MIBCNT_INTRMASK) == AR_MIBCNT_INTRMASK) || ((phyCnt2 & AR_MIBCNT_INTRMASK) == AR_MIBCNT_INTRMASK)) { struct ar5416AniState *aniState = ahp->ah_curani; struct ar5416AniState *aniState = ah->ah_curani; u32 ofdmPhyErrCnt, cckPhyErrCnt; /* NB: only use ast_ani_*errs with AH_PRIVATE_DIAG */ ofdmPhyErrCnt = phyCnt1 - aniState->ofdmPhyErrBase; ahp->ah_stats.ast_ani_ofdmerrs += ah->ah_stats.ast_ani_ofdmerrs += ofdmPhyErrCnt - aniState->ofdmPhyErrCount; aniState->ofdmPhyErrCount = ofdmPhyErrCnt; cckPhyErrCnt = phyCnt2 - aniState->cckPhyErrBase; ahp->ah_stats.ast_ani_cckerrs += ah->ah_stats.ast_ani_cckerrs += cckPhyErrCnt - aniState->cckPhyErrCount; aniState->cckPhyErrCount = cckPhyErrCnt; Loading @@ -767,9 +751,8 @@ void ath9k_hw_procmibevent(struct ath_hal *ah, } } void ath9k_hw_ani_setup(struct ath_hal *ah) void ath9k_hw_ani_setup(struct ath_hw *ah) { struct ath_hal_5416 *ahp = AH5416(ah); int i; const int totalSizeDesired[] = { -55, -55, -55, -55, -62 }; Loading @@ -778,66 +761,63 @@ void ath9k_hw_ani_setup(struct ath_hal *ah) const int firpwr[] = { -78, -78, -78, -78, -80 }; for (i = 0; i < 5; i++) { ahp->ah_totalSizeDesired[i] = totalSizeDesired[i]; ahp->ah_coarseHigh[i] = coarseHigh[i]; ahp->ah_coarseLow[i] = coarseLow[i]; ahp->ah_firpwr[i] = firpwr[i]; ah->ah_totalSizeDesired[i] = totalSizeDesired[i]; ah->ah_coarseHigh[i] = coarseHigh[i]; ah->ah_coarseLow[i] = coarseLow[i]; ah->ah_firpwr[i] = firpwr[i]; } } void ath9k_hw_ani_attach(struct ath_hal *ah) void ath9k_hw_ani_attach(struct ath_hw *ah) { struct ath_hal_5416 *ahp = AH5416(ah); int i; DPRINTF(ah->ah_sc, ATH_DBG_ANI, "Attach ANI\n"); ahp->ah_hasHwPhyCounters = 1; memset(ahp->ah_ani, 0, sizeof(ahp->ah_ani)); for (i = 0; i < ARRAY_SIZE(ahp->ah_ani); i++) { ahp->ah_ani[i].ofdmTrigHigh = ATH9K_ANI_OFDM_TRIG_HIGH; ahp->ah_ani[i].ofdmTrigLow = ATH9K_ANI_OFDM_TRIG_LOW; ahp->ah_ani[i].cckTrigHigh = ATH9K_ANI_CCK_TRIG_HIGH; ahp->ah_ani[i].cckTrigLow = ATH9K_ANI_CCK_TRIG_LOW; ahp->ah_ani[i].rssiThrHigh = ATH9K_ANI_RSSI_THR_HIGH; ahp->ah_ani[i].rssiThrLow = ATH9K_ANI_RSSI_THR_LOW; ahp->ah_ani[i].ofdmWeakSigDetectOff = ah->ah_hasHwPhyCounters = 1; memset(ah->ah_ani, 0, sizeof(ah->ah_ani)); for (i = 0; i < ARRAY_SIZE(ah->ah_ani); i++) { ah->ah_ani[i].ofdmTrigHigh = ATH9K_ANI_OFDM_TRIG_HIGH; ah->ah_ani[i].ofdmTrigLow = ATH9K_ANI_OFDM_TRIG_LOW; ah->ah_ani[i].cckTrigHigh = ATH9K_ANI_CCK_TRIG_HIGH; ah->ah_ani[i].cckTrigLow = ATH9K_ANI_CCK_TRIG_LOW; ah->ah_ani[i].rssiThrHigh = ATH9K_ANI_RSSI_THR_HIGH; ah->ah_ani[i].rssiThrLow = ATH9K_ANI_RSSI_THR_LOW; ah->ah_ani[i].ofdmWeakSigDetectOff = !ATH9K_ANI_USE_OFDM_WEAK_SIG; ahp->ah_ani[i].cckWeakSigThreshold = ah->ah_ani[i].cckWeakSigThreshold = ATH9K_ANI_CCK_WEAK_SIG_THR; ahp->ah_ani[i].spurImmunityLevel = ATH9K_ANI_SPUR_IMMUNE_LVL; ahp->ah_ani[i].firstepLevel = ATH9K_ANI_FIRSTEP_LVL; if (ahp->ah_hasHwPhyCounters) { ahp->ah_ani[i].ofdmPhyErrBase = ah->ah_ani[i].spurImmunityLevel = ATH9K_ANI_SPUR_IMMUNE_LVL; ah->ah_ani[i].firstepLevel = ATH9K_ANI_FIRSTEP_LVL; if (ah->ah_hasHwPhyCounters) { ah->ah_ani[i].ofdmPhyErrBase = AR_PHY_COUNTMAX - ATH9K_ANI_OFDM_TRIG_HIGH; ahp->ah_ani[i].cckPhyErrBase = ah->ah_ani[i].cckPhyErrBase = AR_PHY_COUNTMAX - ATH9K_ANI_CCK_TRIG_HIGH; } } if (ahp->ah_hasHwPhyCounters) { if (ah->ah_hasHwPhyCounters) { DPRINTF(ah->ah_sc, ATH_DBG_ANI, "Setting OfdmErrBase = 0x%08x\n", ahp->ah_ani[0].ofdmPhyErrBase); ah->ah_ani[0].ofdmPhyErrBase); DPRINTF(ah->ah_sc, ATH_DBG_ANI, "Setting cckErrBase = 0x%08x\n", ahp->ah_ani[0].cckPhyErrBase); ah->ah_ani[0].cckPhyErrBase); REG_WRITE(ah, AR_PHY_ERR_1, ahp->ah_ani[0].ofdmPhyErrBase); REG_WRITE(ah, AR_PHY_ERR_2, ahp->ah_ani[0].cckPhyErrBase); REG_WRITE(ah, AR_PHY_ERR_1, ah->ah_ani[0].ofdmPhyErrBase); REG_WRITE(ah, AR_PHY_ERR_2, ah->ah_ani[0].cckPhyErrBase); ath9k_enable_mib_counters(ah); } ahp->ah_aniPeriod = ATH9K_ANI_PERIOD; ah->ah_aniPeriod = ATH9K_ANI_PERIOD; if (ah->ah_config.enable_ani) ahp->ah_procPhyErr |= HAL_PROCESS_ANI; ah->ah_procPhyErr |= HAL_PROCESS_ANI; } void ath9k_hw_ani_detach(struct ath_hal *ah) void ath9k_hw_ani_detach(struct ath_hw *ah) { struct ath_hal_5416 *ahp = AH5416(ah); DPRINTF(ah->ah_sc, ATH_DBG_ANI, "Detach ANI\n"); if (ahp->ah_hasHwPhyCounters) { if (ah->ah_hasHwPhyCounters) { ath9k_hw_disable_mib_counters(ah); REG_WRITE(ah, AR_PHY_ERR_1, 0); REG_WRITE(ah, AR_PHY_ERR_2, 0); Loading
drivers/net/wireless/ath9k/ani.h +11 −11 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ #define HAL_PROCESS_ANI 0x00000001 #define ATH9K_RSSI_EP_MULTIPLIER (1<<7) #define DO_ANI(ah) ((AH5416(ah)->ah_procPhyErr & HAL_PROCESS_ANI)) #define DO_ANI(ah) (((ah)->ah_procPhyErr & HAL_PROCESS_ANI)) #define HAL_EP_RND(x, mul) \ ((((x)%(mul)) >= ((mul)/2)) ? ((x) + ((mul) - 1)) / (mul) : (x)/(mul)) Loading Loading @@ -120,19 +120,19 @@ struct ar5416Stats { }; #define ah_mibStats ah_stats.ast_mibstats void ath9k_ani_reset(struct ath_hal *ah); void ath9k_hw_ani_monitor(struct ath_hal *ah, void ath9k_ani_reset(struct ath_hw *ah); void ath9k_hw_ani_monitor(struct ath_hw *ah, const struct ath9k_node_stats *stats, struct ath9k_channel *chan); bool ath9k_hw_phycounters(struct ath_hal *ah); void ath9k_enable_mib_counters(struct ath_hal *ah); void ath9k_hw_disable_mib_counters(struct ath_hal *ah); u32 ath9k_hw_GetMibCycleCountsPct(struct ath_hal *ah, u32 *rxc_pcnt, bool ath9k_hw_phycounters(struct ath_hw *ah); void ath9k_enable_mib_counters(struct ath_hw *ah); void ath9k_hw_disable_mib_counters(struct ath_hw *ah); u32 ath9k_hw_GetMibCycleCountsPct(struct ath_hw *ah, u32 *rxc_pcnt, u32 *rxf_pcnt, u32 *txf_pcnt); void ath9k_hw_procmibevent(struct ath_hal *ah, void ath9k_hw_procmibevent(struct ath_hw *ah, const struct ath9k_node_stats *stats); void ath9k_hw_ani_setup(struct ath_hal *ah); void ath9k_hw_ani_attach(struct ath_hal *ah); void ath9k_hw_ani_detach(struct ath_hal *ah); void ath9k_hw_ani_setup(struct ath_hw *ah); void ath9k_hw_ani_attach(struct ath_hw *ah); void ath9k_hw_ani_detach(struct ath_hw *ah); #endif /* ANI_H */
drivers/net/wireless/ath9k/ath9k.h +3 −3 Original line number Diff line number Diff line Loading @@ -455,7 +455,7 @@ struct ath_beacon { void ath9k_beacon_tasklet(unsigned long data); void ath_beacon_config(struct ath_softc *sc, int if_id); int ath_beaconq_setup(struct ath_hal *ah); int ath_beaconq_setup(struct ath_hw *ah); int ath_beacon_alloc(struct ath_softc *sc, int if_id); void ath_beacon_return(struct ath_softc *sc, struct ath_vif *avp); void ath_beacon_sync(struct ath_softc *sc, int if_id); Loading Loading @@ -565,7 +565,7 @@ struct ath_rfkill { struct ath_bus_ops { void (*read_cachesize)(struct ath_softc *sc, int *csz); void (*cleanup)(struct ath_softc *sc); bool (*eeprom_read)(struct ath_hal *ah, u32 off, u16 *data); bool (*eeprom_read)(struct ath_hw *ah, u32 off, u16 *data); }; struct ath_softc { Loading @@ -573,7 +573,7 @@ struct ath_softc { struct device *dev; struct tasklet_struct intr_tq; struct tasklet_struct bcon_tasklet; struct ath_hal *sc_ah; struct ath_hw *sc_ah; void __iomem *mem; int irq; spinlock_t sc_resetlock; Loading
drivers/net/wireless/ath9k/beacon.c +6 −6 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ */ static int ath_beaconq_config(struct ath_softc *sc) { struct ath_hal *ah = sc->sc_ah; struct ath_hw *ah = sc->sc_ah; struct ath9k_tx_queue_info qi; ath9k_hw_get_txq_props(ah, sc->beacon.beaconq, &qi); Loading Loading @@ -66,7 +66,7 @@ static void ath_beacon_setup(struct ath_softc *sc, struct ath_vif *avp, struct ath_buf *bf) { struct sk_buff *skb = (struct sk_buff *)bf->bf_mpdu; struct ath_hal *ah = sc->sc_ah; struct ath_hw *ah = sc->sc_ah; struct ath_desc *ds; struct ath9k_11n_rate_series series[4]; struct ath_rate_table *rt; Loading Loading @@ -248,7 +248,7 @@ static struct ath_buf *ath_beacon_generate(struct ath_softc *sc, int if_id) static void ath_beacon_start_adhoc(struct ath_softc *sc, int if_id) { struct ieee80211_vif *vif; struct ath_hal *ah = sc->sc_ah; struct ath_hw *ah = sc->sc_ah; struct ath_buf *bf; struct ath_vif *avp; struct sk_buff *skb; Loading Loading @@ -276,7 +276,7 @@ static void ath_beacon_start_adhoc(struct ath_softc *sc, int if_id) sc->beacon.beaconq, ito64(bf->bf_daddr), bf->bf_desc); } int ath_beaconq_setup(struct ath_hal *ah) int ath_beaconq_setup(struct ath_hw *ah) { struct ath9k_tx_queue_info qi; Loading Loading @@ -444,7 +444,7 @@ void ath_beacon_return(struct ath_softc *sc, struct ath_vif *avp) void ath9k_beacon_tasklet(unsigned long data) { struct ath_softc *sc = (struct ath_softc *)data; struct ath_hal *ah = sc->sc_ah; struct ath_hw *ah = sc->sc_ah; struct ath_buf *bf = NULL; int slot, if_id; u32 bfaddr; Loading Loading @@ -619,7 +619,7 @@ void ath9k_beacon_tasklet(unsigned long data) void ath_beacon_config(struct ath_softc *sc, int if_id) { struct ieee80211_vif *vif; struct ath_hal *ah = sc->sc_ah; struct ath_hw *ah = sc->sc_ah; struct ath_beacon_config conf; struct ath_vif *avp; enum nl80211_iftype opmode; Loading