iPXE
Data Structures | Defines | Functions | Variables
ath9k_ani.c File Reference
#include "hw.h"
#include "hw-ops.h"

Go to the source code of this file.

Data Structures

struct  ani_ofdm_level_entry
struct  ani_cck_level_entry

Defines

#define ATH9K_ANI_OFDM_NUM_LEVEL   ARRAY_SIZE(ofdm_level_table)
#define ATH9K_ANI_OFDM_MAX_LEVEL   (ATH9K_ANI_OFDM_NUM_LEVEL-1)
#define ATH9K_ANI_OFDM_DEF_LEVEL   3 /* default level - matches the INI settings */
#define ATH9K_ANI_CCK_NUM_LEVEL   ARRAY_SIZE(cck_level_table)
#define ATH9K_ANI_CCK_MAX_LEVEL   (ATH9K_ANI_CCK_NUM_LEVEL-1)
#define ATH9K_ANI_CCK_MAX_LEVEL_LOW_RSSI   (ATH9K_ANI_CCK_NUM_LEVEL-3)
#define ATH9K_ANI_CCK_DEF_LEVEL   2 /* default level - matches the INI settings */

Functions

static int use_new_ani (struct ath_hw *ah)
static void ath9k_hw_update_mibstats (struct ath_hw *ah, struct ath9k_mib_stats *stats)
static void ath9k_ani_restart (struct ath_hw *ah)
static void ath9k_hw_ani_ofdm_err_trigger_old (struct ath_hw *ah)
static void ath9k_hw_ani_cck_err_trigger_old (struct ath_hw *ah)
static void ath9k_hw_set_ofdm_nil (struct ath_hw *ah, u8 immunityLevel)
static void ath9k_hw_ani_ofdm_err_trigger (struct ath_hw *ah)
static void ath9k_hw_set_cck_nil (struct ath_hw *ah, uint8_t immunityLevel)
static void ath9k_hw_ani_cck_err_trigger (struct ath_hw *ah)
static void ath9k_hw_ani_lower_immunity_old (struct ath_hw *ah)
static void ath9k_hw_ani_lower_immunity (struct ath_hw *ah)
static void ath9k_ani_reset_old (struct ath_hw *ah)
void ath9k_ani_reset (struct ath_hw *ah, int is_scanning)
static int ath9k_hw_ani_read_counters (struct ath_hw *ah)
void ath9k_hw_ani_monitor (struct ath_hw *ah, struct ath9k_channel *chan __unused)
void ath9k_hw_ani_setup (struct ath_hw *ah)
void ath9k_hw_ani_init (struct ath_hw *ah)

Variables

static struct ani_ofdm_level_entry ofdm_level_table []
static struct ani_cck_level_entry cck_level_table []

Define Documentation

Definition at line 53 of file ath9k_ani.c.

Definition at line 55 of file ath9k_ani.c.

Referenced by ath9k_hw_ani_ofdm_err_trigger().

#define ATH9K_ANI_OFDM_DEF_LEVEL   3 /* default level - matches the INI settings */

Definition at line 57 of file ath9k_ani.c.

Referenced by ath9k_ani_reset().

Definition at line 99 of file ath9k_ani.c.

Definition at line 101 of file ath9k_ani.c.

Referenced by ath9k_hw_ani_cck_err_trigger().

Definition at line 103 of file ath9k_ani.c.

Referenced by ath9k_hw_set_cck_nil().

#define ATH9K_ANI_CCK_DEF_LEVEL   2 /* default level - matches the INI settings */

Definition at line 105 of file ath9k_ani.c.

Referenced by ath9k_ani_reset(), and ath9k_hw_ani_init().


Function Documentation

static int use_new_ani ( struct ath_hw ah) [static]
static void ath9k_hw_update_mibstats ( struct ath_hw ah,
struct ath9k_mib_stats stats 
) [static]
static void ath9k_ani_restart ( struct ath_hw ah) [static]
static void ath9k_hw_ani_ofdm_err_trigger_old ( struct ath_hw ah) [static]

Definition at line 157 of file ath9k_ani.c.

References ath9k_channel::ani, ATH9K_ANI_FIRSTEP_LEVEL, ATH9K_ANI_NOISE_IMMUNITY_LEVEL, ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION, ATH9K_ANI_SPUR_IMMUNITY_LEVEL, ath9k_hw_ani_control(), BEACON_RSSI, net80211_device::channel, net80211_device::channels, ath_hw::curchan, ath_hw::dev, ar5416AniState::firstepLevel, HAL_FIRST_STEP_MAX, HAL_NOISE_IMMUNE_MAX, HAL_SPUR_IMMUNE_MAX, NET80211_BAND_2GHZ, ar5416AniState::noiseImmunityLevel, ar5416AniState::ofdmWeakSigDetect, ar5416AniState::rssiThrHigh, ar5416AniState::rssiThrLow, and ar5416AniState::spurImmunityLevel.

Referenced by ath9k_hw_ani_ofdm_err_trigger().

{
        struct ar5416AniState *aniState;
        int32_t rssi;

        aniState = &ah->curchan->ani;

        if (aniState->noiseImmunityLevel < HAL_NOISE_IMMUNE_MAX) {
                if (ath9k_hw_ani_control(ah, ATH9K_ANI_NOISE_IMMUNITY_LEVEL,
                                         aniState->noiseImmunityLevel + 1)) {
                        return;
                }
        }

        if (aniState->spurImmunityLevel < HAL_SPUR_IMMUNE_MAX) {
                if (ath9k_hw_ani_control(ah, ATH9K_ANI_SPUR_IMMUNITY_LEVEL,
                                         aniState->spurImmunityLevel + 1)) {
                        return;
                }
        }

        rssi = BEACON_RSSI(ah);
        if (rssi > aniState->rssiThrHigh) {
                if (aniState->ofdmWeakSigDetect) {
                        if (ath9k_hw_ani_control(ah,
                                         ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION,
                                         0)) {
                                ath9k_hw_ani_control(ah,
                                        ATH9K_ANI_SPUR_IMMUNITY_LEVEL, 0);
                                return;
                        }
                }
                if (aniState->firstepLevel < HAL_FIRST_STEP_MAX) {
                        ath9k_hw_ani_control(ah, ATH9K_ANI_FIRSTEP_LEVEL,
                                             aniState->firstepLevel + 1);
                        return;
                }
        } else if (rssi > aniState->rssiThrLow) {
                if (!aniState->ofdmWeakSigDetect)
                        ath9k_hw_ani_control(ah,
                                     ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION,
                                     1);
                if (aniState->firstepLevel < HAL_FIRST_STEP_MAX)
                        ath9k_hw_ani_control(ah, ATH9K_ANI_FIRSTEP_LEVEL,
                                             aniState->firstepLevel + 1);
                return;
        } else {
                if ((ah->dev->channels + ah->dev->channel)->band == NET80211_BAND_2GHZ) {
                        if (aniState->ofdmWeakSigDetect)
                                ath9k_hw_ani_control(ah,
                                     ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION,
                                     0);
                        if (aniState->firstepLevel > 0)
                                ath9k_hw_ani_control(ah,
                                             ATH9K_ANI_FIRSTEP_LEVEL, 0);
                        return;
                }
        }
}
static void ath9k_hw_ani_cck_err_trigger_old ( struct ath_hw ah) [static]
static void ath9k_hw_set_ofdm_nil ( struct ath_hw ah,
u8  immunityLevel 
) [static]

Definition at line 244 of file ath9k_ani.c.

References ath9k_channel::ani, ATH9K_ANI_FIRSTEP_LEVEL, ATH9K_ANI_SPUR_IMMUNITY_LEVEL, ath9k_hw_ani_control(), BEACON_RSSI, ar5416AniState::cckNoiseImmunityLevel, ath_hw::curchan, DBG2, ani_ofdm_level_entry::fir_step_level, ani_cck_level_entry::fir_step_level, ar5416AniState::firstepLevel, ar5416AniState::noiseFloor, ar5416AniState::ofdmNoiseImmunityLevel, ar5416AniState::rssiThrHigh, ar5416AniState::rssiThrLow, ani_ofdm_level_entry::spur_immunity_level, and ar5416AniState::spurImmunityLevel.

Referenced by ath9k_ani_reset(), ath9k_hw_ani_lower_immunity(), and ath9k_hw_ani_ofdm_err_trigger().

{
        struct ar5416AniState *aniState = &ah->curchan->ani;
        const struct ani_ofdm_level_entry *entry_ofdm;
        const struct ani_cck_level_entry *entry_cck;

        aniState->noiseFloor = BEACON_RSSI(ah);

        DBG2("ath9k: "
                "**** ofdmlevel %d=>%d, rssi=%d[lo=%d hi=%d]\n",
                aniState->ofdmNoiseImmunityLevel,
                immunityLevel, aniState->noiseFloor,
                aniState->rssiThrLow, aniState->rssiThrHigh);

        aniState->ofdmNoiseImmunityLevel = immunityLevel;

        entry_ofdm = &ofdm_level_table[aniState->ofdmNoiseImmunityLevel];
        entry_cck = &cck_level_table[aniState->cckNoiseImmunityLevel];

        if (aniState->spurImmunityLevel != entry_ofdm->spur_immunity_level)
                ath9k_hw_ani_control(ah,
                                     ATH9K_ANI_SPUR_IMMUNITY_LEVEL,
                                     entry_ofdm->spur_immunity_level);

        if (aniState->firstepLevel != entry_ofdm->fir_step_level &&
            entry_ofdm->fir_step_level >= entry_cck->fir_step_level)
                ath9k_hw_ani_control(ah,
                                     ATH9K_ANI_FIRSTEP_LEVEL,
                                     entry_ofdm->fir_step_level);
}
static void ath9k_hw_ani_ofdm_err_trigger ( struct ath_hw ah) [static]
static void ath9k_hw_set_cck_nil ( struct ath_hw ah,
uint8_t  immunityLevel 
) [static]

Definition at line 296 of file ath9k_ani.c.

References ath9k_channel::ani, AR_SREV_9300_20_OR_LATER, AR_SREV_9485, ATH9K_ANI_CCK_MAX_LEVEL_LOW_RSSI, ATH9K_ANI_FIRSTEP_LEVEL, ATH9K_ANI_MRC_CCK, ath9k_hw_ani_control(), BEACON_RSSI, ar5416AniState::cckNoiseImmunityLevel, ath_hw::curchan, DBG2, ani_ofdm_level_entry::fir_step_level, ani_cck_level_entry::fir_step_level, ar5416AniState::firstepLevel, ani_cck_level_entry::mrc_cck_on, ar5416AniState::mrcCCKOff, ar5416AniState::noiseFloor, ar5416AniState::ofdmNoiseImmunityLevel, ar5416AniState::rssiThrHigh, and ar5416AniState::rssiThrLow.

Referenced by ath9k_ani_reset(), ath9k_hw_ani_cck_err_trigger(), and ath9k_hw_ani_lower_immunity().

{
        struct ar5416AniState *aniState = &ah->curchan->ani;
        const struct ani_ofdm_level_entry *entry_ofdm;
        const struct ani_cck_level_entry *entry_cck;

        aniState->noiseFloor = BEACON_RSSI(ah);
        DBG2("ath9k: "
                "**** ccklevel %d=>%d, rssi=%d[lo=%d hi=%d]\n",
                aniState->cckNoiseImmunityLevel, immunityLevel,
                aniState->noiseFloor, aniState->rssiThrLow,
                aniState->rssiThrHigh);

        if (aniState->noiseFloor <= (unsigned int)aniState->rssiThrLow &&
            immunityLevel > ATH9K_ANI_CCK_MAX_LEVEL_LOW_RSSI)
                immunityLevel = ATH9K_ANI_CCK_MAX_LEVEL_LOW_RSSI;

        aniState->cckNoiseImmunityLevel = immunityLevel;

        entry_ofdm = &ofdm_level_table[aniState->ofdmNoiseImmunityLevel];
        entry_cck = &cck_level_table[aniState->cckNoiseImmunityLevel];

        if (aniState->firstepLevel != entry_cck->fir_step_level &&
            entry_cck->fir_step_level >= entry_ofdm->fir_step_level)
                ath9k_hw_ani_control(ah,
                                     ATH9K_ANI_FIRSTEP_LEVEL,
                                     entry_cck->fir_step_level);

        /* Skip MRC CCK for pre AR9003 families */
        if (!AR_SREV_9300_20_OR_LATER(ah) || AR_SREV_9485(ah))
                return;

        if (aniState->mrcCCKOff == entry_cck->mrc_cck_on)
                ath9k_hw_ani_control(ah,
                                     ATH9K_ANI_MRC_CCK,
                                     entry_cck->mrc_cck_on);
}
static void ath9k_hw_ani_cck_err_trigger ( struct ath_hw ah) [static]
static void ath9k_hw_ani_lower_immunity_old ( struct ath_hw ah) [static]
static void ath9k_hw_ani_lower_immunity ( struct ath_hw ah) [static]

Definition at line 401 of file ath9k_ani.c.

References ath9k_channel::ani, ath9k_hw_ani_lower_immunity_old(), ath9k_hw_set_cck_nil(), ath9k_hw_set_ofdm_nil(), ar5416AniState::cckNoiseImmunityLevel, ath_hw::curchan, ar5416AniState::ofdmNoiseImmunityLevel, ar5416AniState::ofdmsTurn, and use_new_ani().

Referenced by ath9k_hw_ani_monitor().

{
        struct ar5416AniState *aniState;

        aniState = &ah->curchan->ani;

        if (!use_new_ani(ah)) {
                ath9k_hw_ani_lower_immunity_old(ah);
                return;
        }

        /* lower OFDM noise immunity */
        if (aniState->ofdmNoiseImmunityLevel > 0 &&
            (aniState->ofdmsTurn || aniState->cckNoiseImmunityLevel == 0)) {
                ath9k_hw_set_ofdm_nil(ah, aniState->ofdmNoiseImmunityLevel - 1);
                return;
        }

        /* lower CCK noise immunity */
        if (aniState->cckNoiseImmunityLevel > 0)
                ath9k_hw_set_cck_nil(ah, aniState->cckNoiseImmunityLevel - 1);
}
static void ath9k_ani_reset_old ( struct ath_hw ah) [static]

Definition at line 424 of file ath9k_ani.c.

References ath9k_channel::ani, AR_PHY_ERR_CCK_TIMING, AR_PHY_ERR_MASK_1, AR_PHY_ERR_MASK_2, AR_PHY_ERR_OFDM_TIMING, ATH9K_ANI_CCK_WEAK_SIGNAL_THR, ATH9K_ANI_FIRSTEP_LEVEL, ATH9K_ANI_NOISE_IMMUNITY_LEVEL, ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION, ath9k_ani_restart(), ATH9K_ANI_SPUR_IMMUNITY_LEVEL, ath9k_hw_ani_control(), ath9k_hw_getrxfilter(), ath9k_hw_setrxfilter(), ATH9K_RX_FILTER_PHYERR, ar5416AniState::cckWeakSigThreshold, ath_hw::curchan, DO_ANI, ENABLE_REGWRITE_BUFFER, ar5416AniState::firstepLevel, ar5416AniState::noiseImmunityLevel, ar5416AniState::ofdmWeakSigDetect, REG_WRITE, REGWRITE_BUFFER_FLUSH, and ar5416AniState::spurImmunityLevel.

Referenced by ath9k_ani_reset().

void ath9k_ani_reset ( struct ath_hw ah,
int  is_scanning 
)

Definition at line 466 of file ath9k_ani.c.

References ath9k_channel::ani, ath_hw::ani_function, AR_PHY_ERR_CCK_TIMING, AR_PHY_ERR_MASK_1, AR_PHY_ERR_MASK_2, AR_PHY_ERR_OFDM_TIMING, ar5416Stats::ast_ani_reset, ATH9K_ANI_CCK_DEF_LEVEL, ATH9K_ANI_MODE, ATH9K_ANI_OFDM_DEF_LEVEL, ath9k_ani_reset_old(), ath9k_ani_restart(), ath9k_hw_set_cck_nil(), ath9k_hw_set_ofdm_nil(), ar5416AniState::cckNoiseImmunityLevel, ath9k_channel::chan, ath9k_channel::channel, ath9k_channel::channelFlags, ath_hw::curchan, DBG, DBG2, DO_ANI, ENABLE_REGWRITE_BUFFER, ar5416AniState::ofdmNoiseImmunityLevel, REG_WRITE, REGWRITE_BUFFER_FLUSH, ath_hw::stats, and use_new_ani().

Referenced by ath9k_hw_startpcureceive().

{
        struct ar5416AniState *aniState = &ah->curchan->ani;
        struct ath9k_channel *chan = ah->curchan;

        if (!DO_ANI(ah))
                return;

        if (!use_new_ani(ah))
                return ath9k_ani_reset_old(ah);

        ah->stats.ast_ani_reset++;

        /* always allow mode (on/off) to be controlled */
        ah->ani_function |= ATH9K_ANI_MODE;

        if (is_scanning) {
                /*
                 * If we're scanning or in AP mode, the defaults (ini)
                 * should be in place. For an AP we assume the historical
                 * levels for this channel are probably outdated so start
                 * from defaults instead.
                 */
                if (aniState->ofdmNoiseImmunityLevel !=
                    ATH9K_ANI_OFDM_DEF_LEVEL ||
                    aniState->cckNoiseImmunityLevel !=
                    ATH9K_ANI_CCK_DEF_LEVEL) {
                        DBG("ath9k: "
                                "Restore defaults: chan %d Mhz/0x%x is_scanning=%d ofdm:%d cck:%d\n",
                                chan->channel,
                                chan->channelFlags,
                                is_scanning,
                                aniState->ofdmNoiseImmunityLevel,
                                aniState->cckNoiseImmunityLevel);

                        ath9k_hw_set_ofdm_nil(ah, ATH9K_ANI_OFDM_DEF_LEVEL);
                        ath9k_hw_set_cck_nil(ah, ATH9K_ANI_CCK_DEF_LEVEL);
                }
        } else {
                /*
                 * restore historical levels for this channel
                 */
                DBG2("ath9k: "
                        "Restore history: chan %d Mhz/0x%x is_scanning=%d ofdm:%d cck:%d\n",
                        chan->channel,
                        chan->channelFlags,
                        is_scanning,
                        aniState->ofdmNoiseImmunityLevel,
                        aniState->cckNoiseImmunityLevel);

                        ath9k_hw_set_ofdm_nil(ah,
                                              aniState->ofdmNoiseImmunityLevel);
                        ath9k_hw_set_cck_nil(ah,
                                             aniState->cckNoiseImmunityLevel);
        }

        /*
         * enable phy counters if hw supports or if not, enable phy
         * interrupts (so we can count each one)
         */
        ath9k_ani_restart(ah);

        ENABLE_REGWRITE_BUFFER(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);

        REGWRITE_BUFFER_FLUSH(ah);
}
static int ath9k_hw_ani_read_counters ( struct ath_hw ah) [static]

Definition at line 536 of file ath9k_ani.c.

References ath9k_channel::ani, AR_PHY_COUNTMAX, AR_PHY_ERR_1, AR_PHY_ERR_2, AR_PHY_ERR_CCK_TIMING, AR_PHY_ERR_MASK_1, AR_PHY_ERR_MASK_2, AR_PHY_ERR_OFDM_TIMING, ar5416Stats::ast_ani_cckerrs, ar5416Stats::ast_ani_lneg, ar5416Stats::ast_ani_ofdmerrs, ath9k_ani_restart(), ath9k_hw_common(), ath_hw_cycle_counters_update(), ath_hw_get_listen_time(), ath9k_ops_config::cck_trig_high, ar5416AniState::cckPhyErrCount, common, ath_hw::config, ath_hw::curchan, DBG2, ar5416AniState::listenTime, ath9k_ops_config::ofdm_trig_high, ar5416AniState::ofdmPhyErrCount, REG_READ, REG_WRITE, ath_hw::stats, and use_new_ani().

Referenced by ath9k_hw_ani_monitor().

{
        struct ath_common *common = ath9k_hw_common(ah);
        struct ar5416AniState *aniState = &ah->curchan->ani;
        u32 ofdm_base = 0;
        u32 cck_base = 0;
        u32 ofdmPhyErrCnt, cckPhyErrCnt;
        u32 phyCnt1, phyCnt2;
        int32_t listenTime;

        ath_hw_cycle_counters_update(common);
        listenTime = ath_hw_get_listen_time(common);

        if (listenTime <= 0) {
                ah->stats.ast_ani_lneg++;
                ath9k_ani_restart(ah);
                return 0;
        }

        if (!use_new_ani(ah)) {
                ofdm_base = AR_PHY_COUNTMAX - ah->config.ofdm_trig_high;
                cck_base = AR_PHY_COUNTMAX - ah->config.cck_trig_high;
        }

        aniState->listenTime += listenTime;

        phyCnt1 = REG_READ(ah, AR_PHY_ERR_1);
        phyCnt2 = REG_READ(ah, AR_PHY_ERR_2);

        if (!use_new_ani(ah) && (phyCnt1 < ofdm_base || phyCnt2 < cck_base)) {
                if (phyCnt1 < ofdm_base) {
                        DBG2("ath9k: "
                                "phyCnt1 0x%x, resetting counter value to 0x%x\n",
                                phyCnt1, ofdm_base);
                        REG_WRITE(ah, AR_PHY_ERR_1, ofdm_base);
                        REG_WRITE(ah, AR_PHY_ERR_MASK_1,
                                  AR_PHY_ERR_OFDM_TIMING);
                }
                if (phyCnt2 < cck_base) {
                        DBG2("ath9k: "
                                "phyCnt2 0x%x, resetting counter value to 0x%x\n",
                                phyCnt2, cck_base);
                        REG_WRITE(ah, AR_PHY_ERR_2, cck_base);
                        REG_WRITE(ah, AR_PHY_ERR_MASK_2,
                                  AR_PHY_ERR_CCK_TIMING);
                }
                return 0;
        }

        ofdmPhyErrCnt = phyCnt1 - ofdm_base;
        ah->stats.ast_ani_ofdmerrs +=
                ofdmPhyErrCnt - aniState->ofdmPhyErrCount;
        aniState->ofdmPhyErrCount = ofdmPhyErrCnt;

        cckPhyErrCnt = phyCnt2 - cck_base;
        ah->stats.ast_ani_cckerrs +=
                cckPhyErrCnt - aniState->cckPhyErrCount;
        aniState->cckPhyErrCount = cckPhyErrCnt;
        return 1;
}
void ath9k_hw_ani_monitor ( struct ath_hw ah,
struct ath9k_channel *chan  __unused 
)

Definition at line 597 of file ath9k_ani.c.

References ath9k_channel::ani, ath_hw::aniperiod, ath9k_ani_restart(), ath9k_hw_ani_cck_err_trigger(), ath9k_hw_ani_lower_immunity(), ath9k_hw_ani_ofdm_err_trigger(), ath9k_hw_ani_read_counters(), ath9k_ops_config::cck_trig_high, ar5416AniState::cckNoiseImmunityLevel, ar5416AniState::cckPhyErrCount, ath_hw::config, ath_hw::curchan, DBG2, DO_ANI, ar5416AniState::listenTime, ath9k_ops_config::ofdm_trig_high, ar5416AniState::ofdmNoiseImmunityLevel, ar5416AniState::ofdmPhyErrCount, and ar5416AniState::ofdmsTurn.

Referenced by ath_ani_calibrate().

{
        struct ar5416AniState *aniState;
        u32 ofdmPhyErrRate, cckPhyErrRate;

        if (!DO_ANI(ah))
                return;

        aniState = &ah->curchan->ani;
        if (!aniState)
                return;

        if (!ath9k_hw_ani_read_counters(ah))
                return;

        ofdmPhyErrRate = aniState->ofdmPhyErrCount * 1000 /
                         aniState->listenTime;
        cckPhyErrRate =  aniState->cckPhyErrCount * 1000 /
                         aniState->listenTime;

        DBG2("ath9k: "
                "listenTime=%d OFDM:%d errs=%d/s CCK:%d errs=%d/s ofdm_turn=%d\n",
                aniState->listenTime,
                aniState->ofdmNoiseImmunityLevel,
                ofdmPhyErrRate, aniState->cckNoiseImmunityLevel,
                cckPhyErrRate, aniState->ofdmsTurn);

        if (aniState->listenTime > 5 * ah->aniperiod) {
                if (ofdmPhyErrRate <= ah->config.ofdm_trig_low &&
                    cckPhyErrRate <= ah->config.cck_trig_low) {
                        ath9k_hw_ani_lower_immunity(ah);
                        aniState->ofdmsTurn = !aniState->ofdmsTurn;
                }
                ath9k_ani_restart(ah);
        } else if (aniState->listenTime > ah->aniperiod) {
                /* check to see if need to raise immunity */
                if (ofdmPhyErrRate > ah->config.ofdm_trig_high &&
                    (cckPhyErrRate <= ah->config.cck_trig_high ||
                     aniState->ofdmsTurn)) {
                        ath9k_hw_ani_ofdm_err_trigger(ah);
                        ath9k_ani_restart(ah);
                        aniState->ofdmsTurn = 0;
                } else if (cckPhyErrRate > ah->config.cck_trig_high) {
                        ath9k_hw_ani_cck_err_trigger(ah);
                        ath9k_ani_restart(ah);
                        aniState->ofdmsTurn = 1;
                }
        }
}
void ath9k_hw_ani_setup ( struct ath_hw ah)

Definition at line 647 of file ath9k_ani.c.

References ath_hw::coarse_high, ath_hw::coarse_low, ath_hw::firpwr, and ath_hw::totalSizeDesired.

Referenced by ath9k_hw_post_init().

{
        int i;

        static const int totalSizeDesired[] = { -55, -55, -55, -55, -62 };
        static const int coarseHigh[] = { -14, -14, -14, -14, -12 };
        static const int coarseLow[] = { -64, -64, -64, -64, -70 };
        static const int firpwr[] = { -78, -78, -78, -78, -80 };

        for (i = 0; i < 5; i++) {
                ah->totalSizeDesired[i] = totalSizeDesired[i];
                ah->coarse_high[i] = coarseHigh[i];
                ah->coarse_low[i] = coarseLow[i];
                ah->firpwr[i] = firpwr[i];
        }
}
void ath9k_hw_ani_init ( struct ath_hw ah)

Definition at line 664 of file ath9k_ani.c.

References ath9k_channel::ani, ath9k_ops_config::ani_poll_interval, ath_hw::aniperiod, AR_SREV_9300_20_OR_LATER, ARRAY_SIZE, ATH9K_ANI_CCK_DEF_LEVEL, ATH9K_ANI_CCK_TRIG_HIGH_NEW, ATH9K_ANI_CCK_TRIG_HIGH_OLD, ATH9K_ANI_CCK_TRIG_LOW_NEW, ATH9K_ANI_CCK_TRIG_LOW_OLD, ATH9K_ANI_CCK_WEAK_SIG_THR, ATH9K_ANI_ENABLE_MRC_CCK, ATH9K_ANI_FIRSTEP_LVL_NEW, ATH9K_ANI_FIRSTEP_LVL_OLD, ATH9K_ANI_OFDM_TRIG_HIGH_NEW, ATH9K_ANI_OFDM_TRIG_HIGH_OLD, ATH9K_ANI_OFDM_TRIG_LOW_NEW, ATH9K_ANI_OFDM_TRIG_LOW_OLD, ATH9K_ANI_PERIOD_NEW, ATH9K_ANI_PERIOD_OLD, ATH9K_ANI_POLLINTERVAL_NEW, ATH9K_ANI_POLLINTERVAL_OLD, ath9k_ani_restart(), ATH9K_ANI_RSSI_THR_HIGH, ATH9K_ANI_RSSI_THR_LOW, ATH9K_ANI_SPUR_IMMUNE_LVL_NEW, ATH9K_ANI_SPUR_IMMUNE_LVL_OLD, ATH9K_ANI_USE_OFDM_WEAK_SIG, ath9k_ops_config::cck_trig_high, ath9k_ops_config::cck_trig_low, ar5416AniState::cckNoiseImmunityLevel, ar5416AniState::cckWeakSigThreshold, ath9k_channel::chan, ath_hw::channels, ath_hw::config, DBG2, ath9k_ops_config::enable_ani, ar5416AniState::firstepLevel, HAL_PROCESS_ANI, ar5416AniState::mrcCCKOff, ath9k_ops_config::ofdm_trig_high, ath9k_ops_config::ofdm_trig_low, ar5416AniState::ofdmsTurn, ar5416AniState::ofdmWeakSigDetect, ath_hw::proc_phyerr, ar5416AniState::rssiThrHigh, ar5416AniState::rssiThrLow, ar5416AniState::spurImmunityLevel, and use_new_ani().

Referenced by ath9k_hw_post_init().

{
        unsigned int i;

        DBG2("ath9k: Initialize ANI\n");

        if (use_new_ani(ah)) {
                ah->config.ofdm_trig_high = ATH9K_ANI_OFDM_TRIG_HIGH_NEW;
                ah->config.ofdm_trig_low = ATH9K_ANI_OFDM_TRIG_LOW_NEW;

                ah->config.cck_trig_high = ATH9K_ANI_CCK_TRIG_HIGH_NEW;
                ah->config.cck_trig_low = ATH9K_ANI_CCK_TRIG_LOW_NEW;
        } else {
                ah->config.ofdm_trig_high = ATH9K_ANI_OFDM_TRIG_HIGH_OLD;
                ah->config.ofdm_trig_low = ATH9K_ANI_OFDM_TRIG_LOW_OLD;

                ah->config.cck_trig_high = ATH9K_ANI_CCK_TRIG_HIGH_OLD;
                ah->config.cck_trig_low = ATH9K_ANI_CCK_TRIG_LOW_OLD;
        }

        for (i = 0; i < ARRAY_SIZE(ah->channels); i++) {
                struct ath9k_channel *chan = &ah->channels[i];
                struct ar5416AniState *ani = &chan->ani;

                if (use_new_ani(ah)) {
                        ani->spurImmunityLevel =
                                ATH9K_ANI_SPUR_IMMUNE_LVL_NEW;

                        ani->firstepLevel = ATH9K_ANI_FIRSTEP_LVL_NEW;

                        if (AR_SREV_9300_20_OR_LATER(ah))
                                ani->mrcCCKOff =
                                        !ATH9K_ANI_ENABLE_MRC_CCK;
                        else
                                ani->mrcCCKOff = 1;

                        ani->ofdmsTurn = 1;
                } else {
                        ani->spurImmunityLevel =
                                ATH9K_ANI_SPUR_IMMUNE_LVL_OLD;
                        ani->firstepLevel = ATH9K_ANI_FIRSTEP_LVL_OLD;

                        ani->cckWeakSigThreshold =
                                ATH9K_ANI_CCK_WEAK_SIG_THR;
                }

                ani->rssiThrHigh = ATH9K_ANI_RSSI_THR_HIGH;
                ani->rssiThrLow = ATH9K_ANI_RSSI_THR_LOW;
                ani->ofdmWeakSigDetect =
                        ATH9K_ANI_USE_OFDM_WEAK_SIG;
                ani->cckNoiseImmunityLevel = ATH9K_ANI_CCK_DEF_LEVEL;
        }

        /*
         * since we expect some ongoing maintenance on the tables, let's sanity
         * check here default level should not modify INI setting.
         */
        if (use_new_ani(ah)) {
                ah->aniperiod = ATH9K_ANI_PERIOD_NEW;
                ah->config.ani_poll_interval = ATH9K_ANI_POLLINTERVAL_NEW;
        } else {
                ah->aniperiod = ATH9K_ANI_PERIOD_OLD;
                ah->config.ani_poll_interval = ATH9K_ANI_POLLINTERVAL_OLD;
        }

        if (ah->config.enable_ani)
                ah->proc_phyerr |= HAL_PROCESS_ANI;

        ath9k_ani_restart(ah);
}

Variable Documentation

Initial value:
 {
        
        {  0,  0,  1  }, 
        {  1,  1,  1  }, 
        {  2,  2,  1  }, 
        {  3,  2,  1  }, 
        {  4,  3,  1  }, 
        {  5,  4,  1  }, 
        {  6,  5,  1  }, 
        {  7,  6,  1  }, 
        {  7,  7,  1  }, 
        {  7,  8,  0  }  
}

Definition at line 40 of file ath9k_ani.c.

Initial value:
 {
        
        {  0,  1  }, 
        {  1,  1  }, 
        {  2,  1  }, 
        {  3,  1  }, 
        {  4,  0  }, 
        {  5,  0  }, 
        {  6,  0  }, 
        {  7,  0  }, 
        {  8,  0  }  
}

Definition at line 86 of file ath9k_ani.c.