mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-25 11:37:56 +00:00
Tidy up the ANI API in preparation for looking to expose some more
of the ANI statistics and committing some tools which use these. * Change HAL_ANI_* commands _back_ to be numerical, rather than a bitmap; * modify access to the ANI control bitmap to convert a command to a bitmap; * Fix the ANI noise immunity fiddling for CCK errors - it wasn't checking whether noise immunity was disabled or not.
This commit is contained in:
parent
6d5ee6cd7f
commit
241d9a3400
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=222276
@ -418,16 +418,21 @@ extern HAL_BOOL ath_hal_setTxQProps(struct ath_hal *ah,
|
||||
extern HAL_BOOL ath_hal_getTxQProps(struct ath_hal *ah,
|
||||
HAL_TXQ_INFO *qInfo, const HAL_TX_QUEUE_INFO *qi);
|
||||
|
||||
/*
|
||||
* Internal HAL ANI commands.
|
||||
*
|
||||
* These values represent the ANI commands passed to the ANI Control method
|
||||
* for AR5212, AR5416 and later chipsets.
|
||||
*/
|
||||
typedef enum {
|
||||
HAL_ANI_PRESENT = 0x1, /* is ANI support present */
|
||||
HAL_ANI_NOISE_IMMUNITY_LEVEL = 0x2, /* set level */
|
||||
HAL_ANI_OFDM_WEAK_SIGNAL_DETECTION = 0x4, /* enable/disable */
|
||||
HAL_ANI_CCK_WEAK_SIGNAL_THR = 0x8, /* enable/disable */
|
||||
HAL_ANI_FIRSTEP_LEVEL = 0x10, /* set level */
|
||||
HAL_ANI_SPUR_IMMUNITY_LEVEL = 0x20, /* set level */
|
||||
HAL_ANI_MODE = 0x40, /* 0 => manual, 1 => auto (XXX do not change) */
|
||||
HAL_ANI_PHYERR_RESET =0x80, /* reset phy error stats */
|
||||
HAL_ANI_ALL = 0xff
|
||||
HAL_ANI_PRESENT = 0, /* is ANI support present */
|
||||
HAL_ANI_NOISE_IMMUNITY_LEVEL = 1, /* set level */
|
||||
HAL_ANI_OFDM_WEAK_SIGNAL_DETECTION = 2, /* enable/disable */
|
||||
HAL_ANI_CCK_WEAK_SIGNAL_THR = 3, /* enable/disable */
|
||||
HAL_ANI_FIRSTEP_LEVEL = 4, /* set level */
|
||||
HAL_ANI_SPUR_IMMUNITY_LEVEL = 5, /* set level */
|
||||
HAL_ANI_MODE = 6, /* 0 => manual, 1 => auto (XXX do not change) */
|
||||
HAL_ANI_PHYERR_RESET = 7, /* reset phy error stats */
|
||||
} HAL_ANI_CMD;
|
||||
|
||||
#define HAL_SPUR_VAL_MASK 0x3FFF
|
||||
|
@ -175,9 +175,17 @@ ar5416AniControl(struct ath_hal *ah, HAL_ANI_CMD cmd, int param)
|
||||
struct ar5212AniState *aniState = ahp->ah_curani;
|
||||
const struct ar5212AniParams *params = aniState->params;
|
||||
|
||||
/* Check whether the particular function is enabled */
|
||||
if (((1 << cmd) & AH5416(ah)->ah_ani_function) == 0) {
|
||||
HALDEBUG(ah, HAL_DEBUG_ANI, "%s: command %d disabled\n",
|
||||
__func__, cmd);
|
||||
HALDEBUG(ah, HAL_DEBUG_ANI, "%s: cmd %d; mask %x\n", __func__, cmd, AH5416(ah)->ah_ani_function);
|
||||
return AH_FALSE;
|
||||
}
|
||||
|
||||
OS_MARK(ah, AH_MARK_ANI_CONTROL, cmd);
|
||||
|
||||
switch (cmd & AH5416(ah)->ah_ani_function) {
|
||||
switch (cmd) {
|
||||
case HAL_ANI_NOISE_IMMUNITY_LEVEL: {
|
||||
u_int level = param;
|
||||
|
||||
@ -356,14 +364,14 @@ ar5416AniOfdmErrTrigger(struct ath_hal *ah)
|
||||
aniState = ahp->ah_curani;
|
||||
params = aniState->params;
|
||||
/* First, raise noise immunity level, up to max */
|
||||
if ((AH5416(ah)->ah_ani_function & HAL_ANI_NOISE_IMMUNITY_LEVEL) &&
|
||||
if ((AH5416(ah)->ah_ani_function & (1 << HAL_ANI_NOISE_IMMUNITY_LEVEL)) &&
|
||||
(aniState->noiseImmunityLevel+1 < params->maxNoiseImmunityLevel)) {
|
||||
ar5416AniControl(ah, HAL_ANI_NOISE_IMMUNITY_LEVEL,
|
||||
aniState->noiseImmunityLevel + 1);
|
||||
return;
|
||||
}
|
||||
/* then, raise spur immunity level, up to max */
|
||||
if ((AH5416(ah)->ah_ani_function & HAL_ANI_SPUR_IMMUNITY_LEVEL) &&
|
||||
if ((AH5416(ah)->ah_ani_function & (1 << HAL_ANI_SPUR_IMMUNITY_LEVEL)) &&
|
||||
(aniState->spurImmunityLevel+1 < params->maxSpurImmunityLevel)) {
|
||||
ar5416AniControl(ah, HAL_ANI_SPUR_IMMUNITY_LEVEL,
|
||||
aniState->spurImmunityLevel + 1);
|
||||
@ -443,7 +451,8 @@ ar5416AniCckErrTrigger(struct ath_hal *ah)
|
||||
/* first, raise noise immunity level, up to max */
|
||||
aniState = ahp->ah_curani;
|
||||
params = aniState->params;
|
||||
if (aniState->noiseImmunityLevel+1 < params->maxNoiseImmunityLevel) {
|
||||
if ((AH5416(ah)->ah_ani_function & (1 << HAL_ANI_NOISE_IMMUNITY_LEVEL) &&
|
||||
aniState->noiseImmunityLevel+1 < params->maxNoiseImmunityLevel)) {
|
||||
ar5416AniControl(ah, HAL_ANI_NOISE_IMMUNITY_LEVEL,
|
||||
aniState->noiseImmunityLevel + 1);
|
||||
return;
|
||||
|
@ -58,7 +58,7 @@ ar5416AniSetup(struct ath_hal *ah)
|
||||
.period = 100,
|
||||
};
|
||||
/* NB: disable ANI noise immmunity for reliable RIFS rx */
|
||||
AH5416(ah)->ah_ani_function &= ~ HAL_ANI_NOISE_IMMUNITY_LEVEL;
|
||||
AH5416(ah)->ah_ani_function &= ~(1 << HAL_ANI_NOISE_IMMUNITY_LEVEL);
|
||||
ar5416AniAttach(ah, &aniparams, &aniparams, AH_TRUE);
|
||||
}
|
||||
|
||||
@ -199,7 +199,7 @@ ar5416InitState(struct ath_hal_5416 *ahp5416, uint16_t devid, HAL_SOFTC sc,
|
||||
AH5416(ah)->ah_tx_chainmask = AR5416_DEFAULT_TXCHAINMASK;
|
||||
|
||||
/* Enable all ANI functions to begin with */
|
||||
AH5416(ah)->ah_ani_function = HAL_ANI_ALL;
|
||||
AH5416(ah)->ah_ani_function = 0xffffffff;
|
||||
|
||||
/* Set overridable ANI methods */
|
||||
AH5212(ah)->ah_aniControl = ar5416AniControl;
|
||||
|
@ -82,7 +82,7 @@ ar9160AniSetup(struct ath_hal *ah)
|
||||
};
|
||||
|
||||
/* NB: disable ANI noise immmunity for reliable RIFS rx */
|
||||
AH5416(ah)->ah_ani_function &= ~ HAL_ANI_NOISE_IMMUNITY_LEVEL;
|
||||
AH5416(ah)->ah_ani_function &= ~(1 << HAL_ANI_NOISE_IMMUNITY_LEVEL);
|
||||
ar5416AniAttach(ah, &aniparams, &aniparams, AH_TRUE);
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ ar9280AniSetup(struct ath_hal *ah)
|
||||
.period = 100,
|
||||
};
|
||||
/* NB: disable ANI noise immmunity for reliable RIFS rx */
|
||||
AH5416(ah)->ah_ani_function &= ~ HAL_ANI_NOISE_IMMUNITY_LEVEL;
|
||||
AH5416(ah)->ah_ani_function &= ~(1 << HAL_ANI_NOISE_IMMUNITY_LEVEL);
|
||||
|
||||
/* NB: ANI is not enabled yet */
|
||||
ar5416AniAttach(ah, &aniparams, &aniparams, AH_TRUE);
|
||||
|
@ -98,7 +98,7 @@ ar9285AniSetup(struct ath_hal *ah)
|
||||
.period = 100,
|
||||
};
|
||||
/* NB: disable ANI noise immmunity for reliable RIFS rx */
|
||||
AH5416(ah)->ah_ani_function &= ~ HAL_ANI_NOISE_IMMUNITY_LEVEL;
|
||||
AH5416(ah)->ah_ani_function &= ~(1 << HAL_ANI_NOISE_IMMUNITY_LEVEL);
|
||||
|
||||
ar5416AniAttach(ah, &aniparams, &aniparams, AH_TRUE);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user