Don't use a private copy of the ANI definitions - use the HAL definitions.

Whilst I'm at it:

* fix the NI+ to be correct, rather than NI-;
* use the diag api codes, now that the HAL is public.

Tested:

* AR9380, STA mode
This commit is contained in:
adrian 2015-04-01 04:57:27 +00:00
parent 649f319146
commit 58943901b7

View File

@ -51,6 +51,7 @@
#include "ah.h"
#include "ah_desc.h"
#include "ah_diagcodes.h"
#include "net80211/ieee80211_ioctl.h"
#include "net80211/ieee80211_radiotap.h"
#include "if_athioctl.h"
@ -336,7 +337,7 @@ static const struct fmt athstats[] = {
#define S_ANI_LISTEN AFTER(S_ANI_MAXSPUR)
{ 6, "listen","LISTEN", "listen time" },
#define S_ANI_NIUP AFTER(S_ANI_LISTEN)
{ 4, "ni+", "NI-", "ANI increased noise immunity" },
{ 4, "ni+", "NI+", "ANI increased noise immunity" },
#define S_ANI_NIDOWN AFTER(S_ANI_NIUP)
{ 4, "ni-", "NI-", "ANI decrease noise immunity" },
#define S_ANI_SIUP AFTER(S_ANI_NIDOWN)
@ -428,39 +429,11 @@ static const struct fmt athstats[] = {
#define S_LAST S_ANT_TX0
#define S_MAX S_BMISSCOUNT+1
/*
* XXX fold this into the external HAL definitions! -adrian
*/
struct _athstats {
struct ath_stats ath;
#ifdef ATH_SUPPORT_ANI
struct {
uint32_t ast_ani_niup; /* increased noise immunity */
uint32_t ast_ani_nidown; /* decreased noise immunity */
uint32_t ast_ani_spurup; /* increased spur immunity */
uint32_t ast_ani_spurdown; /* descreased spur immunity */
uint32_t ast_ani_ofdmon; /* OFDM weak signal detect on */
uint32_t ast_ani_ofdmoff; /* OFDM weak signal detect off*/
uint32_t ast_ani_cckhigh; /* CCK weak signal thr high */
uint32_t ast_ani_ccklow; /* CCK weak signal thr low */
uint32_t ast_ani_stepup; /* increased first step level */
uint32_t ast_ani_stepdown; /* decreased first step level */
uint32_t ast_ani_ofdmerrs; /* cumulative ofdm phy err cnt*/
uint32_t ast_ani_cckerrs; /* cumulative cck phy err cnt */
uint32_t ast_ani_reset; /* params zero'd for non-STA */
uint32_t ast_ani_lzero; /* listen time forced to zero */
uint32_t ast_ani_lneg; /* listen time calculated < 0 */
HAL_MIB_STATS ast_mibstats; /* MIB counter stats */
HAL_NODE_STATS ast_nodestats; /* latest rssi stats */
} ani_stats;
struct {
uint8_t noiseImmunityLevel;
uint8_t spurImmunityLevel;
uint8_t firstepLevel;
uint8_t ofdmWeakSigDetectOff;
uint8_t cckWeakSigThreshold;
uint32_t listenTime;
} ani_state;
HAL_ANI_STATS ani_stats;
HAL_ANI_STATE ani_state;
#endif
};
@ -504,14 +477,14 @@ ath_collect(struct athstatfoo_p *wf, struct _athstats *stats)
err(1, "ioctl: %s", wf->ifr.ifr_name);
#ifdef ATH_SUPPORT_ANI
if (wf->optstats & ATHSTATS_ANI) {
wf->atd.ad_id = 5;
wf->atd.ad_id = HAL_DIAG_ANI_CURRENT; /* HAL_DIAG_ANI_CURRENT */
wf->atd.ad_out_data = (caddr_t) &stats->ani_state;
wf->atd.ad_out_size = sizeof(stats->ani_state);
if (ioctl(wf->s, SIOCGATHDIAG, &wf->atd) < 0) {
warn("ioctl: %s", wf->atd.ad_name);
wf->optstats &= ~ATHSTATS_ANI;
}
wf->atd.ad_id = 8;
wf->atd.ad_id = HAL_DIAG_ANI_STATS; /* HAL_DIAG_ANI_STATS */
wf->atd.ad_out_data = (caddr_t) &stats->ani_stats;
wf->atd.ad_out_size = sizeof(stats->ani_stats);
if (ioctl(wf->s, SIOCGATHDIAG, &wf->atd) < 0)