Release 4.7 drivers/net/wireless/ath/ath9k/ani.c
  
  
/*
 * Copyright (c) 2008-2011 Atheros Communications Inc.
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */
#include <linux/kernel.h>
#include <linux/export.h>
#include "hw.h"
#include "hw-ops.h"
struct ani_ofdm_level_entry {
	
int spur_immunity_level;
	
int fir_step_level;
	
int ofdm_weak_signal_on;
};
/* values here are relative to the INI */
/*
 * Legend:
 *
 * SI: Spur immunity
 * FS: FIR Step
 * WS: OFDM / CCK Weak Signal detection
 * MRC-CCK: Maximal Ratio Combining for CCK
 */
static const struct ani_ofdm_level_entry ofdm_level_table[] = {
	/* SI  FS  WS */
	{  0,  0,  1  }, /* lvl 0 */
	{  1,  1,  1  }, /* lvl 1 */
	{  2,  2,  1  }, /* lvl 2 */
	{  3,  2,  1  }, /* lvl 3  (default) */
	{  4,  3,  1  }, /* lvl 4 */
	{  5,  4,  1  }, /* lvl 5 */
	{  6,  5,  1  }, /* lvl 6 */
	{  7,  6,  1  }, /* lvl 7 */
	{  7,  7,  1  }, /* lvl 8 */
	{  7,  8,  0  }  /* lvl 9 */
};
#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 */
/*
 * MRC (Maximal Ratio Combining) has always been used with multi-antenna ofdm.
 * With OFDM for single stream you just add up all antenna inputs, you're
 * only interested in what you get after FFT. Signal aligment is also not
 * required for OFDM because any phase difference adds up in the frequency
 * domain.
 *
 * MRC requires extra work for use with CCK. You need to align the antenna
 * signals from the different antenna before you can add the signals together.
 * You need aligment of signals as CCK is in time domain, so addition can cancel
 * your signal completely if phase is 180 degrees (think of adding sine waves).
 * You also need to remove noise before the addition and this is where ANI
 * MRC CCK comes into play. One of the antenna inputs may be stronger but
 * lower SNR, so just adding after alignment can be dangerous.
 *
 * Regardless of alignment in time, the antenna signals add constructively after
 * FFT and improve your reception. For more information:
 *
 * http://en.wikipedia.org/wiki/Maximal-ratio_combining
 */
struct ani_cck_level_entry {
	
int fir_step_level;
	
int mrc_cck_on;
};
static const struct ani_cck_level_entry cck_level_table[] = {
	/* FS  MRC-CCK  */
	{  0,  1  }, /* lvl 0 */
	{  1,  1  }, /* lvl 1 */
	{  2,  1  }, /* lvl 2  (default) */
	{  3,  1  }, /* lvl 3 */
	{  4,  0  }, /* lvl 4 */
	{  5,  0  }, /* lvl 5 */
	{  6,  0  }, /* lvl 6 */
	{  7,  0  }, /* lvl 7 (only for high rssi) */
	{  8,  0  }  /* lvl 8 (only for high rssi) */
};
#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 */
static void ath9k_hw_update_mibstats(struct ath_hw *ah,
				     struct ath9k_mib_stats *stats)
{
	u32 addr[5] = {AR_RTS_OK, AR_RTS_FAIL, AR_ACK_FAIL,
		       AR_FCS_FAIL, AR_BEACON_CNT};
	u32 data[5];
	REG_READ_MULTI(ah, &addr[0], &data[0], 5);
	/* AR_RTS_OK */
	stats->rts_good += data[0];
	/* AR_RTS_FAIL */
	stats->rts_bad += data[1];
	/* AR_ACK_FAIL */
	stats->ackrcv_bad += data[2];
	/* AR_FCS_FAIL */
	stats->fcs_bad += data[3];
	/* AR_BEACON_CNT */
	stats->beacons += data[4];
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| oleksij rempel | oleksij rempel | 70 | 64.22% | 1 | 33.33% | 
| sujith manoharan | sujith manoharan | 39 | 35.78% | 2 | 66.67% | 
 | Total | 109 | 100.00% | 3 | 100.00% | 
static void ath9k_ani_restart(struct ath_hw *ah)
{
	struct ar5416AniState *aniState = &ah->ani;
	aniState->listenTime = 0;
	ENABLE_REGWRITE_BUFFER(ah);
	REG_WRITE(ah, AR_PHY_ERR_1, 0);
	REG_WRITE(ah, AR_PHY_ERR_2, 0);
	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);
	ath9k_hw_update_mibstats(ah, &ah->ah_mibStats);
	aniState->ofdmPhyErrCount = 0;
	aniState->cckPhyErrCount = 0;
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| sujith manoharan | sujith manoharan | 88 | 92.63% | 3 | 50.00% | 
| felix fietkau | felix fietkau | 5 | 5.26% | 2 | 33.33% | 
| miaoqing pan | miaoqing pan | 2 | 2.11% | 1 | 16.67% | 
 | Total | 95 | 100.00% | 6 | 100.00% | 
/* Adjust the OFDM Noise Immunity Level */
static void ath9k_hw_set_ofdm_nil(struct ath_hw *ah, u8 immunityLevel,
				  bool scan)
{
	struct ar5416AniState *aniState = &ah->ani;
	struct ath_common *common = ath9k_hw_common(ah);
	const struct ani_ofdm_level_entry *entry_ofdm;
	const struct ani_cck_level_entry *entry_cck;
	bool weak_sig;
	ath_dbg(common, ANI, "**** ofdmlevel %d=>%d, rssi=%d[lo=%d hi=%d]\n",
		aniState->ofdmNoiseImmunityLevel,
		immunityLevel, BEACON_RSSI(ah),
		ATH9K_ANI_RSSI_THR_LOW,
		ATH9K_ANI_RSSI_THR_HIGH);
	if (AR_SREV_9100(ah) && immunityLevel < ATH9K_ANI_OFDM_DEF_LEVEL)
		immunityLevel = ATH9K_ANI_OFDM_DEF_LEVEL;
	if (!scan)
		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);
	weak_sig = entry_ofdm->ofdm_weak_signal_on;
	if (ah->opmode == NL80211_IFTYPE_STATION &&
	    BEACON_RSSI(ah) <= ATH9K_ANI_RSSI_THR_HIGH)
		weak_sig = true;
	/*
         * Newer chipsets are better at dealing with high PHY error counts -
         * keep weak signal detection enabled when no RSSI threshold is
         * available to determine if it is needed (mode != STA)
         */
	else if (AR_SREV_9300_20_OR_LATER(ah) &&
		 ah->opmode != NL80211_IFTYPE_STATION)
		weak_sig = true;
	/* Older chipsets are more sensitive to high PHY error counts */
	else if (!AR_SREV_9300_20_OR_LATER(ah) &&
		 aniState->ofdmNoiseImmunityLevel >= 8)
		weak_sig = false;
	if (aniState->ofdmWeakSigDetect != weak_sig)
		ath9k_hw_ani_control(ah, ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION,
				     weak_sig);
	if (!AR_SREV_9300_20_OR_LATER(ah))
		return;
	if (aniState->ofdmNoiseImmunityLevel >= ATH9K_ANI_OFDM_DEF_LEVEL) {
		ah->config.ofdm_trig_high = ATH9K_ANI_OFDM_TRIG_HIGH;
		ah->config.ofdm_trig_low = ATH9K_ANI_OFDM_TRIG_LOW_ABOVE_INI;
	} else {
		ah->config.ofdm_trig_high = ATH9K_ANI_OFDM_TRIG_HIGH_BELOW_INI;
		ah->config.ofdm_trig_low = ATH9K_ANI_OFDM_TRIG_LOW;
	}
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| felix fietkau | felix fietkau | 189 | 61.56% | 8 | 57.14% | 
| sujith manoharan | sujith manoharan | 102 | 33.22% | 4 | 28.57% | 
| luis r. rodriguez | luis r. rodriguez | 16 | 5.21% | 2 | 14.29% | 
 | Total | 307 | 100.00% | 14 | 100.00% | 
static void ath9k_hw_ani_ofdm_err_trigger(struct ath_hw *ah)
{
	struct ar5416AniState *aniState = &ah->ani;
	if (aniState->ofdmNoiseImmunityLevel < ATH9K_ANI_OFDM_MAX_LEVEL)
		ath9k_hw_set_ofdm_nil(ah, aniState->ofdmNoiseImmunityLevel + 1, false);
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| felix fietkau | felix fietkau | 23 | 54.76% | 2 | 50.00% | 
| sujith manoharan | sujith manoharan | 17 | 40.48% | 1 | 25.00% | 
| miaoqing pan | miaoqing pan | 2 | 4.76% | 1 | 25.00% | 
 | Total | 42 | 100.00% | 4 | 100.00% | 
/*
 * Set the ANI settings to match an CCK level.
 */
static void ath9k_hw_set_cck_nil(struct ath_hw *ah, u_int8_t immunityLevel,
				 bool scan)
{
	struct ar5416AniState *aniState = &ah->ani;
	struct ath_common *common = ath9k_hw_common(ah);
	const struct ani_ofdm_level_entry *entry_ofdm;
	const struct ani_cck_level_entry *entry_cck;
	ath_dbg(common, ANI, "**** ccklevel %d=>%d, rssi=%d[lo=%d hi=%d]\n",
		aniState->cckNoiseImmunityLevel, immunityLevel,
		BEACON_RSSI(ah), ATH9K_ANI_RSSI_THR_LOW,
		ATH9K_ANI_RSSI_THR_HIGH);
	if (AR_SREV_9100(ah) && immunityLevel < ATH9K_ANI_CCK_DEF_LEVEL)
		immunityLevel = ATH9K_ANI_CCK_DEF_LEVEL;
	if (ah->opmode == NL80211_IFTYPE_STATION &&
	    BEACON_RSSI(ah) <= ATH9K_ANI_RSSI_THR_LOW &&
	    immunityLevel > ATH9K_ANI_CCK_MAX_LEVEL_LOW_RSSI)
		immunityLevel = ATH9K_ANI_CCK_MAX_LEVEL_LOW_RSSI;
	if (!scan)
		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) ||
	    AR_SREV_9565(ah) || AR_SREV_9561(ah))
		return;
	if (aniState->mrcCCK != entry_cck->mrc_cck_on)
		ath9k_hw_ani_control(ah,
				     ATH9K_ANI_MRC_CCK,
				     entry_cck->mrc_cck_on);
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| felix fietkau | felix fietkau | 99 | 45.62% | 7 | 38.89% | 
| sujith manoharan | sujith manoharan | 70 | 32.26% | 4 | 22.22% | 
| luis r. rodriguez | luis r. rodriguez | 39 | 17.97% | 3 | 16.67% | 
| miaoqing pan | miaoqing pan | 5 | 2.30% | 1 | 5.56% | 
| rajkumar manoharan | rajkumar manoharan | 4 | 1.84% | 3 | 16.67% | 
 | Total | 217 | 100.00% | 18 | 100.00% | 
static void ath9k_hw_ani_cck_err_trigger(struct ath_hw *ah)
{
	struct ar5416AniState *aniState = &ah->ani;
	if (aniState->cckNoiseImmunityLevel < ATH9K_ANI_CCK_MAX_LEVEL)
		ath9k_hw_set_cck_nil(ah, aniState->cckNoiseImmunityLevel + 1,
				     false);
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| sujith manoharan | sujith manoharan | 18 | 42.86% | 1 | 16.67% | 
| luis r. rodriguez | luis r. rodriguez | 13 | 30.95% | 1 | 16.67% | 
| felix fietkau | felix fietkau | 9 | 21.43% | 3 | 50.00% | 
| miaoqing pan | miaoqing pan | 2 | 4.76% | 1 | 16.67% | 
 | Total | 42 | 100.00% | 6 | 100.00% | 
/*
 * only lower either OFDM or CCK errors per turn
 * we lower the other one next time
 */
static void ath9k_hw_ani_lower_immunity(struct ath_hw *ah)
{
	struct ar5416AniState *aniState = &ah->ani;
	/* lower OFDM noise immunity */
	if (aniState->ofdmNoiseImmunityLevel > 0 &&
	    (aniState->ofdmsTurn || aniState->cckNoiseImmunityLevel == 0)) {
		ath9k_hw_set_ofdm_nil(ah, aniState->ofdmNoiseImmunityLevel - 1,
				      false);
		return;
	}
	/* lower CCK noise immunity */
	if (aniState->cckNoiseImmunityLevel > 0)
		ath9k_hw_set_cck_nil(ah, aniState->cckNoiseImmunityLevel - 1,
				     false);
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| luis r. rodriguez | luis r. rodriguez | 39 | 48.75% | 2 | 20.00% | 
| felix fietkau | felix fietkau | 36 | 45.00% | 4 | 40.00% | 
| miaoqing pan | miaoqing pan | 2 | 2.50% | 1 | 10.00% | 
| rajkumar manoharan | rajkumar manoharan | 1 | 1.25% | 1 | 10.00% | 
| sujith manoharan | sujith manoharan | 1 | 1.25% | 1 | 10.00% | 
| vasanthakumar thiagarajan | vasanthakumar thiagarajan | 1 | 1.25% | 1 | 10.00% | 
 | Total | 80 | 100.00% | 10 | 100.00% | 
/*
 * Restore the ANI parameters in the HAL and reset the statistics.
 * This routine should be called for every hardware reset and for
 * every channel change.
 */
void ath9k_ani_reset(struct ath_hw *ah, bool is_scanning)
{
	struct ar5416AniState *aniState = &ah->ani;
	struct ath9k_channel *chan = ah->curchan;
	struct ath_common *common = ath9k_hw_common(ah);
	int ofdm_nil, cck_nil;
	if (!chan)
		return;
	BUG_ON(aniState == NULL);
	ah->stats.ast_ani_reset++;
	ofdm_nil = max_t(int, ATH9K_ANI_OFDM_DEF_LEVEL,
			 aniState->ofdmNoiseImmunityLevel);
	cck_nil = max_t(int, ATH9K_ANI_CCK_DEF_LEVEL,
			 aniState->cckNoiseImmunityLevel);
	if (is_scanning ||
	    (ah->opmode != NL80211_IFTYPE_STATION &&
	     ah->opmode != NL80211_IFTYPE_ADHOC)) {
		/*
                 * 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) {
			ath_dbg(common, ANI,
				"Restore defaults: opmode %u chan %d Mhz is_scanning=%d ofdm:%d cck:%d\n",
				ah->opmode,
				chan->channel,
				is_scanning,
				aniState->ofdmNoiseImmunityLevel,
				aniState->cckNoiseImmunityLevel);
			ofdm_nil = ATH9K_ANI_OFDM_DEF_LEVEL;
			cck_nil = ATH9K_ANI_CCK_DEF_LEVEL;
		}
	} else {
		/*
                 * restore historical levels for this channel
                 */
		ath_dbg(common, ANI,
			"Restore history: opmode %u chan %d Mhz is_scanning=%d ofdm:%d cck:%d\n",
			ah->opmode,
			chan->channel,
			is_scanning,
			aniState->ofdmNoiseImmunityLevel,
			aniState->cckNoiseImmunityLevel);
	}
	ath9k_hw_set_ofdm_nil(ah, ofdm_nil, is_scanning);
	ath9k_hw_set_cck_nil(ah, cck_nil, is_scanning);
	ath9k_ani_restart(ah);
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| luis r. rodriguez | luis r. rodriguez | 153 | 69.86% | 2 | 16.67% | 
| felix fietkau | felix fietkau | 48 | 21.92% | 5 | 41.67% | 
| sujith manoharan | sujith manoharan | 13 | 5.94% | 2 | 16.67% | 
| joe perches | joe perches | 4 | 1.83% | 2 | 16.67% | 
| miaoqing pan | miaoqing pan | 1 | 0.46% | 1 | 8.33% | 
 | Total | 219 | 100.00% | 12 | 100.00% | 
static bool ath9k_hw_ani_read_counters(struct ath_hw *ah)
{
	struct ath_common *common = ath9k_hw_common(ah);
	struct ar5416AniState *aniState = &ah->ani;
	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_or_lzero++;
		ath9k_ani_restart(ah);
		return false;
	}
	aniState->listenTime += listenTime;
	ath9k_hw_update_mibstats(ah, &ah->ah_mibStats);
	phyCnt1 = REG_READ(ah, AR_PHY_ERR_1);
	phyCnt2 = REG_READ(ah, AR_PHY_ERR_2);
	ah->stats.ast_ani_ofdmerrs += phyCnt1 - aniState->ofdmPhyErrCount;
	aniState->ofdmPhyErrCount = phyCnt1;
	ah->stats.ast_ani_cckerrs += phyCnt2 - aniState->cckPhyErrCount;
	aniState->cckPhyErrCount = phyCnt2;
	return true;
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| luis r. rodriguez | luis r. rodriguez | 66 | 44.90% | 4 | 30.77% | 
| sujith manoharan | sujith manoharan | 42 | 28.57% | 3 | 23.08% | 
| felix fietkau | felix fietkau | 38 | 25.85% | 5 | 38.46% | 
| mohammed shafi shajakhan | mohammed shafi shajakhan | 1 | 0.68% | 1 | 7.69% | 
 | Total | 147 | 100.00% | 13 | 100.00% | 
void ath9k_hw_ani_monitor(struct ath_hw *ah, struct ath9k_channel *chan)
{
	struct ar5416AniState *aniState = &ah->ani;
	struct ath_common *common = ath9k_hw_common(ah);
	u32 ofdmPhyErrRate, cckPhyErrRate;
	if (!ath9k_hw_ani_read_counters(ah))
		return;
	ofdmPhyErrRate = aniState->ofdmPhyErrCount * 1000 /
			 aniState->listenTime;
	cckPhyErrRate =  aniState->cckPhyErrCount * 1000 /
			 aniState->listenTime;
	ath_dbg(common, ANI,
		"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 > ah->aniperiod) {
		if (cckPhyErrRate < ah->config.cck_trig_low &&
		    ofdmPhyErrRate < ah->config.ofdm_trig_low) {
			ath9k_hw_ani_lower_immunity(ah);
			aniState->ofdmsTurn = !aniState->ofdmsTurn;
		} else if (ofdmPhyErrRate > ah->config.ofdm_trig_high) {
			ath9k_hw_ani_ofdm_err_trigger(ah);
			aniState->ofdmsTurn = false;
		} else if (cckPhyErrRate > ah->config.cck_trig_high) {
			ath9k_hw_ani_cck_err_trigger(ah);
			aniState->ofdmsTurn = true;
		} else
			return;
			
		ath9k_ani_restart(ah);
	}
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| luis r. rodriguez | luis r. rodriguez | 89 | 43.84% | 2 | 11.76% | 
| sujith manoharan | sujith manoharan | 74 | 36.45% | 4 | 23.53% | 
| felix fietkau | felix fietkau | 22 | 10.84% | 5 | 29.41% | 
| miaoqing pan | miaoqing pan | 7 | 3.45% | 2 | 11.76% | 
| rajkumar manoharan | rajkumar manoharan | 5 | 2.46% | 1 | 5.88% | 
| joe perches | joe perches | 3 | 1.48% | 2 | 11.76% | 
| gabor juhos | gabor juhos | 3 | 1.48% | 1 | 5.88% | 
 | Total | 203 | 100.00% | 17 | 100.00% | 
EXPORT_SYMBOL(ath9k_hw_ani_monitor);
void ath9k_enable_mib_counters(struct ath_hw *ah)
{
	struct ath_common *common = ath9k_hw_common(ah);
	ath_dbg(common, ANI, "Enable MIB counters\n");
	ath9k_hw_update_mibstats(ah, &ah->ah_mibStats);
	ENABLE_REGWRITE_BUFFER(ah);
	REG_WRITE(ah, AR_FILT_OFDM, 0);
	REG_WRITE(ah, AR_FILT_CCK, 0);
	REG_WRITE(ah, AR_MIBC,
		  ~(AR_MIBC_COW | AR_MIBC_FMC | AR_MIBC_CMC | AR_MIBC_MCS)
		  & 0x0f);
	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);
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| sujith manoharan | sujith manoharan | 93 | 88.57% | 3 | 50.00% | 
| luis r. rodriguez | luis r. rodriguez | 10 | 9.52% | 1 | 16.67% | 
| joe perches | joe perches | 2 | 1.90% | 2 | 33.33% | 
 | Total | 105 | 100.00% | 6 | 100.00% | 
/* Freeze the MIB counters, get the stats and then clear them */
void ath9k_hw_disable_mib_counters(struct ath_hw *ah)
{
	struct ath_common *common = ath9k_hw_common(ah);
	ath_dbg(common, ANI, "Disable MIB counters\n");
	REG_WRITE(ah, AR_MIBC, AR_MIBC_FMC);
	ath9k_hw_update_mibstats(ah, &ah->ah_mibStats);
	REG_WRITE(ah, AR_MIBC, AR_MIBC_CMC);
	REG_WRITE(ah, AR_FILT_OFDM, 0);
	REG_WRITE(ah, AR_FILT_CCK, 0);
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| sujith manoharan | sujith manoharan | 63 | 84.00% | 3 | 50.00% | 
| luis r. rodriguez | luis r. rodriguez | 10 | 13.33% | 1 | 16.67% | 
| joe perches | joe perches | 2 | 2.67% | 2 | 33.33% | 
 | Total | 75 | 100.00% | 6 | 100.00% | 
EXPORT_SYMBOL(ath9k_hw_disable_mib_counters);
void ath9k_hw_ani_init(struct ath_hw *ah)
{
	struct ath_common *common = ath9k_hw_common(ah);
	struct ar5416AniState *ani = &ah->ani;
	ath_dbg(common, ANI, "Initialize ANI\n");
	if (AR_SREV_9300_20_OR_LATER(ah)) {
		ah->config.ofdm_trig_high = ATH9K_ANI_OFDM_TRIG_HIGH;
		ah->config.ofdm_trig_low = ATH9K_ANI_OFDM_TRIG_LOW;
		ah->config.cck_trig_high = ATH9K_ANI_CCK_TRIG_HIGH;
		ah->config.cck_trig_low = ATH9K_ANI_CCK_TRIG_LOW;
	} 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;
	}
	ani->spurImmunityLevel = ATH9K_ANI_SPUR_IMMUNE_LVL;
	ani->firstepLevel = ATH9K_ANI_FIRSTEP_LVL;
	ani->mrcCCK = AR_SREV_9300_20_OR_LATER(ah) ? true : false;
	ani->ofdmsTurn = true;
	ani->ofdmWeakSigDetect = true;
	ani->cckNoiseImmunityLevel = ATH9K_ANI_CCK_DEF_LEVEL;
	ani->ofdmNoiseImmunityLevel = ATH9K_ANI_OFDM_DEF_LEVEL;
	/*
         * since we expect some ongoing maintenance on the tables, let's sanity
         * check here default level should not modify INI setting.
         */
	ah->aniperiod = ATH9K_ANI_PERIOD;
	ah->config.ani_poll_interval = ATH9K_ANI_POLLINTERVAL;
	ath9k_ani_restart(ah);
	ath9k_enable_mib_counters(ah);
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| felix fietkau | felix fietkau | 73 | 38.62% | 4 | 26.67% | 
| luis r. rodriguez | luis r. rodriguez | 73 | 38.62% | 2 | 13.33% | 
| sujith manoharan | sujith manoharan | 28 | 14.81% | 5 | 33.33% | 
| rajkumar manoharan | rajkumar manoharan | 13 | 6.88% | 2 | 13.33% | 
| joe perches | joe perches | 2 | 1.06% | 2 | 13.33% | 
 | Total | 189 | 100.00% | 15 | 100.00% | 
Overall Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| luis r. rodriguez | luis r. rodriguez | 743 | 35.45% | 9 | 15.79% | 
| sujith manoharan | sujith manoharan | 662 | 31.58% | 13 | 22.81% | 
| felix fietkau | felix fietkau | 551 | 26.29% | 20 | 35.09% | 
| oleksij rempel | oleksij rempel | 70 | 3.34% | 1 | 1.75% | 
| rajkumar manoharan | rajkumar manoharan | 23 | 1.10% | 4 | 7.02% | 
| miaoqing pan | miaoqing pan | 21 | 1.00% | 3 | 5.26% | 
| joe perches | joe perches | 13 | 0.62% | 2 | 3.51% | 
| nikitas angelinas | nikitas angelinas | 5 | 0.24% | 1 | 1.75% | 
| gabor juhos | gabor juhos | 3 | 0.14% | 1 | 1.75% | 
| paul gortmaker | paul gortmaker | 3 | 0.14% | 1 | 1.75% | 
| mohammed shafi shajakhan | mohammed shafi shajakhan | 1 | 0.05% | 1 | 1.75% | 
| vasanthakumar thiagarajan | vasanthakumar thiagarajan | 1 | 0.05% | 1 | 1.75% | 
 | Total | 2096 | 100.00% | 57 | 100.00% | 
  
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.