Date: Sun, 19 Oct 2008 06:40:49 GMT From: Sam Leffler <sam@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 151544 for review Message-ID: <200810190640.m9J6enI6039262@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=151544 Change 151544 by sam@sam_ebb on 2008/10/19 06:40:26 add support to display ani state; this isn't useful without the new hal (that enables the ioctl support) Affected files ... .. //depot/projects/vap/tools/tools/ath/athstats/Makefile#4 edit .. //depot/projects/vap/tools/tools/ath/athstats/athstats.c#4 edit .. //depot/projects/vap/tools/tools/ath/athstats/main.c#5 edit Differences ... ==== //depot/projects/vap/tools/tools/ath/athstats/Makefile#4 (text+ko) ==== @@ -8,12 +8,16 @@ .include <bsd.prog.mk> -CFLAGS+= -I. +SRCDIR= ${.CURDIR}/../../../.. + CLEANFILES+= opt_ah.h ah_osdep.h -CFLAGS+=-I../../../../sys/contrib/dev/ath -CFLAGS+=-I../../../../sys/net80211 -CFLAGS+=-I../../../../sys/dev/ath +CFLAGS+=-DATH_SUPPORT_ANI + +CFLAGS+=-I${.CURDIR} +CFLAGS+=-I${SRCDIR}/sys/contrib/dev/ath +CFLAGS+=-I${SRCDIR}/sys/net80211 +CFLAGS+=-I${SRCDIR}/sys/dev/ath athstats.o: opt_ah.h ah_osdep.h ==== //depot/projects/vap/tools/tools/ath/athstats/athstats.c#4 (text+ko) ==== @@ -55,6 +55,12 @@ #include "athstats.h" +#ifdef ATH_SUPPORT_ANI +#define HAL_EP_RND(x,mul) \ + ((((x)%(mul)) >= ((mul)/2)) ? ((x) + ((mul) - 1)) / (mul) : (x)/(mul)) +#define HAL_RSSI(x) HAL_EP_RND(x, HAL_RSSI_EP_MULTIPLIER) +#endif + #define NOTPRESENT { 0, "", "" } #define AFTER(prev) ((prev)+1) @@ -258,7 +264,71 @@ { 5, "defsw", "defsw", "switched default/rx antenna" }, #define S_ANT_TXSWITCH AFTER(S_ANT_DEFSWITCH) { 5, "txsw", "txsw", "tx used alternate antenna" }, +#ifdef ATH_SUPPORT_ANI +#define S_ANI_NOISE AFTER(S_ANT_TXSWITCH) + { 2, "ni", "NI", "noise immunity level" }, +#define S_ANI_SPUR AFTER(S_ANI_NOISE) + { 2, "si", "SI", "spur immunity level" }, +#define S_ANI_STEP AFTER(S_ANI_SPUR) + { 2, "step", "ST", "first step level" }, +#define S_ANI_OFDM AFTER(S_ANI_STEP) + { 4, "owsd", "OWSD", "OFDM weak signal detect" }, +#define S_ANI_CCK AFTER(S_ANI_OFDM) + { 4, "cwst", "CWST", "CCK weak signal threshold" }, +#define S_ANI_MAXSPUR AFTER(S_ANI_CCK) + { 3, "maxsi","MSI", "max spur immunity level" }, +#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" }, +#define S_ANI_NIDOWN AFTER(S_ANI_NIUP) + { 4, "ni-", "NI-", "ANI decrease noise immunity" }, +#define S_ANI_SIUP AFTER(S_ANI_NIDOWN) + { 4, "si+", "SI+", "ANI increased spur immunity" }, +#define S_ANI_SIDOWN AFTER(S_ANI_SIUP) + { 4, "si-", "SI-", "ANI decrease spur immunity" }, +#define S_ANI_OFDMON AFTER(S_ANI_SIDOWN) + { 5, "ofdm+","OFDM+", "ANI enabled OFDM weak signal detect" }, +#define S_ANI_OFDMOFF AFTER(S_ANI_OFDMON) + { 5, "ofdm-","OFDM-", "ANI disabled OFDM weak signal detect" }, +#define S_ANI_CCKHI AFTER(S_ANI_OFDMOFF) + { 5, "cck+", "CCK+", "ANI enabled CCK weak signal threshold" }, +#define S_ANI_CCKLO AFTER(S_ANI_CCKHI) + { 5, "cck-", "CCK-", "ANI disabled CCK weak signal threshold" }, +#define S_ANI_STEPUP AFTER(S_ANI_CCKLO) + { 5, "step+","STEP+", "ANI increased first step level" }, +#define S_ANI_STEPDOWN AFTER(S_ANI_STEPUP) + { 5, "step-","STEP-", "ANI decreased first step level" }, +#define S_ANI_OFDMERRS AFTER(S_ANI_STEPDOWN) + { 8, "ofdm", "OFDM", "cumulative ofdm phy error count" }, +#define S_ANI_CCKERRS AFTER(S_ANI_OFDMERRS) + { 8, "cck", "CCK", "cumulative cck phy error count" }, +#define S_ANI_RESET AFTER(S_ANI_CCKERRS) + { 5, "reset","RESET", "ANI parameters zero'd for non-STA operation" }, +#define S_ANI_LZERO AFTER(S_ANI_RESET) + { 5, "lzero","LZERO", "ANI forced listen time to zero" }, +#define S_ANI_LNEG AFTER(S_ANI_LZERO) + { 5, "lneg", "LNEG", "ANI calculated listen time < 0" }, +#define S_MIB_ACKBAD AFTER(S_ANI_LNEG) + { 5, "ackbad","ACKBAD", "bad ACK's" }, +#define S_MIB_RTSBAD AFTER(S_MIB_ACKBAD) + { 5, "rtsbad","RTSBAD", "bad RTS" }, +#define S_MIB_RTSGOOD AFTER(S_MIB_RTSBAD) + { 5, "rtsgood","RTSGOOD", "good RTS" }, +#define S_MIB_FCSBAD AFTER(S_MIB_RTSGOOD) + { 5, "fcsbad","FCSBAD", "bad FCS" }, +#define S_MIB_BEACONS AFTER(S_MIB_FCSBAD) + { 5, "beacons","beacons", "beacons received" }, +#define S_NODE_AVGBRSSI AFTER(S_MIB_BEACONS) + { 3, "avgbrssi","BSI", "average rssi (beacons only)" }, +#define S_NODE_AVGRSSI AFTER(S_NODE_AVGBRSSI) + { 3, "avgrssi","DSI", "average rssi (all rx'd frames)" }, +#define S_NODE_AVGARSSI AFTER(S_NODE_AVGRSSI) + { 3, "avgtxrssi","TSI", "average rssi (ACKs only)" }, +#define S_ANT_TX0 AFTER(S_NODE_AVGARSSI) +#else #define S_ANT_TX0 AFTER(S_ANT_TXSWITCH) +#endif /* ATH_SUPPORT_ANI */ { 8, "tx0", "ant0(tx)", "frames tx on antenna 0" }, #define S_ANT_TX1 AFTER(S_ANT_TX0) { 8, "tx1", "ant1(tx)", "frames tx on antenna 1" }, @@ -302,12 +372,41 @@ 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; + uint32_t listenTime; + } ani_state; +#endif }; struct athstatfoo_p { struct athstatfoo base; int s; int optstats; +#define ATHSTATS_ANI 0x0001 struct ifreq ifr; struct ath_diag atd; struct _athstats cur; @@ -320,6 +419,10 @@ struct athstatfoo_p *wf = (struct athstatfoo_p *) wf0; strncpy(wf->ifr.ifr_name, ifname, sizeof (wf->ifr.ifr_name)); +#ifdef ATH_SUPPORT_ANI + strncpy(wf->atd.ad_name, ifname, sizeof (wf->atd.ad_name)); + wf->optstats |= ATHSTATS_ANI; +#endif } static void @@ -328,6 +431,22 @@ wf->ifr.ifr_data = (caddr_t) &stats->ath; if (ioctl(wf->s, SIOCGATHSTATS, &wf->ifr) < 0) err(1, wf->ifr.ifr_name); +#ifdef ATH_SUPPORT_ANI + if (wf->optstats & ATHSTATS_ANI) { + wf->atd.ad_id = 5; + 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(wf->atd.ad_name); + wf->optstats &= ~ATHSTATS_ANI; + } + wf->atd.ad_id = 8; + 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) + warn(wf->atd.ad_name); + } +#endif /* ATH_SUPPORT_ANI */ } static void @@ -362,6 +481,12 @@ snprintf(b, bs, "%u", wf->cur.ath.ast_##x - wf->total.ath.ast_##x); return 1 #define PHY(x) \ snprintf(b, bs, "%u", wf->cur.ath.ast_rx_phy[x] - wf->total.ath.ast_rx_phy[x]); return 1 +#define ANI(x) \ + snprintf(b, bs, "%u", wf->cur.ani_state.x); return 1 +#define ANISTAT(x) \ + snprintf(b, bs, "%u", wf->cur.ani_stats.ast_ani_##x - wf->total.ani_stats.ast_ani_##x); return 1 +#define MIBSTAT(x) \ + snprintf(b, bs, "%u", wf->cur.ani_stats.ast_mibstats.x - wf->total.ani_stats.ast_mibstats.x); return 1 #define TXANT(x) \ snprintf(b, bs, "%u", wf->cur.ath.ast_ant_tx[x] - wf->total.ath.ast_ant_tx[x]); return 1 #define RXANT(x) \ @@ -472,6 +597,45 @@ case S_RATE_DROP: STAT(rate_drop); case S_ANT_DEFSWITCH: STAT(ant_defswitch); case S_ANT_TXSWITCH: STAT(ant_txswitch); +#ifdef S_ANI_NOISE + case S_ANI_NOISE: ANI(noiseImmunityLevel); + case S_ANI_SPUR: ANI(spurImmunityLevel); + case S_ANI_STEP: ANI(firstepLevel); + case S_ANI_OFDM: ANI(ofdmWeakSigDetectOff); + case S_ANI_LISTEN: ANI(listenTime); + case S_ANI_NIUP: ANISTAT(niup); + case S_ANI_NIDOWN: ANISTAT(nidown); + case S_ANI_SIUP: ANISTAT(spurup); + case S_ANI_SIDOWN: ANISTAT(spurdown); + case S_ANI_OFDMON: ANISTAT(ofdmon); + case S_ANI_OFDMOFF: ANISTAT(ofdmoff); + case S_ANI_CCKHI: ANISTAT(cckhigh); + case S_ANI_CCKLO: ANISTAT(ccklow); + case S_ANI_STEPUP: ANISTAT(stepup); + case S_ANI_STEPDOWN: ANISTAT(stepdown); + case S_ANI_OFDMERRS: ANISTAT(ofdmerrs); + case S_ANI_CCKERRS: ANISTAT(cckerrs); + case S_ANI_RESET: ANISTAT(reset); + case S_ANI_LZERO: ANISTAT(lzero); + case S_ANI_LNEG: ANISTAT(lneg); + case S_MIB_ACKBAD: MIBSTAT(ackrcv_bad); + case S_MIB_RTSBAD: MIBSTAT(rts_bad); + case S_MIB_RTSGOOD: MIBSTAT(rts_good); + case S_MIB_FCSBAD: MIBSTAT(fcs_bad); + case S_MIB_BEACONS: MIBSTAT(beacons); + case S_NODE_AVGBRSSI: + snprintf(b, bs, "%u", + HAL_RSSI(wf->cur.ani_stats.ast_nodestats.ns_avgbrssi)); + return 1; + case S_NODE_AVGRSSI: + snprintf(b, bs, "%u", + HAL_RSSI(wf->cur.ani_stats.ast_nodestats.ns_avgrssi)); + return 1; + case S_NODE_AVGARSSI: + snprintf(b, bs, "%u", + HAL_RSSI(wf->cur.ani_stats.ast_nodestats.ns_avgtxrssi)); + return 1; +#endif case S_ANT_TX0: TXANT(0); case S_ANT_TX1: TXANT(1); case S_ANT_TX2: TXANT(2); @@ -513,6 +677,9 @@ return 0; #undef RXANT #undef TXANT +#undef ANI +#undef ANISTAT +#undef MIBSTAT #undef PHY #undef STAT } @@ -525,6 +692,12 @@ snprintf(b, bs, "%u", wf->total.ath.ast_##x); return 1 #define PHY(x) \ snprintf(b, bs, "%u", wf->total.ath.ast_rx_phy[x]); return 1 +#define ANI(x) \ + snprintf(b, bs, "%u", wf->total.ani_state.x); return 1 +#define ANISTAT(x) \ + snprintf(b, bs, "%u", wf->total.ani_stats.ast_ani_##x); return 1 +#define MIBSTAT(x) \ + snprintf(b, bs, "%u", wf->total.ani_stats.ast_mibstats.x); return 1 #define TXANT(x) \ snprintf(b, bs, "%u", wf->total.ath.ast_ant_tx[x]); return 1 #define RXANT(x) \ @@ -633,6 +806,44 @@ case S_RATE_DROP: STAT(rate_drop); case S_ANT_DEFSWITCH: STAT(ant_defswitch); case S_ANT_TXSWITCH: STAT(ant_txswitch); +#ifdef S_ANI_NOISE + case S_ANI_NOISE: ANI(noiseImmunityLevel); + case S_ANI_SPUR: ANI(spurImmunityLevel); + case S_ANI_STEP: ANI(firstepLevel); + case S_ANI_LISTEN: ANI(listenTime); + case S_ANI_NIUP: ANISTAT(niup); + case S_ANI_NIDOWN: ANISTAT(nidown); + case S_ANI_SIUP: ANISTAT(spurup); + case S_ANI_SIDOWN: ANISTAT(spurdown); + case S_ANI_OFDMON: ANISTAT(ofdmon); + case S_ANI_OFDMOFF: ANISTAT(ofdmoff); + case S_ANI_CCKHI: ANISTAT(cckhigh); + case S_ANI_CCKLO: ANISTAT(ccklow); + case S_ANI_STEPUP: ANISTAT(stepup); + case S_ANI_STEPDOWN: ANISTAT(stepdown); + case S_ANI_OFDMERRS: ANISTAT(ofdmerrs); + case S_ANI_CCKERRS: ANISTAT(cckerrs); + case S_ANI_RESET: ANISTAT(reset); + case S_ANI_LZERO: ANISTAT(lzero); + case S_ANI_LNEG: ANISTAT(lneg); + case S_MIB_ACKBAD: MIBSTAT(ackrcv_bad); + case S_MIB_RTSBAD: MIBSTAT(rts_bad); + case S_MIB_RTSGOOD: MIBSTAT(rts_good); + case S_MIB_FCSBAD: MIBSTAT(fcs_bad); + case S_MIB_BEACONS: MIBSTAT(beacons); + case S_NODE_AVGBRSSI: + snprintf(b, bs, "%u", + HAL_RSSI(wf->total.ani_stats.ast_nodestats.ns_avgbrssi)); + return 1; + case S_NODE_AVGRSSI: + snprintf(b, bs, "%u", + HAL_RSSI(wf->total.ani_stats.ast_nodestats.ns_avgrssi)); + return 1; + case S_NODE_AVGARSSI: + snprintf(b, bs, "%u", + HAL_RSSI(wf->total.ani_stats.ast_nodestats.ns_avgtxrssi)); + return 1; +#endif case S_ANT_TX0: TXANT(0); case S_ANT_TX1: TXANT(1); case S_ANT_TX2: TXANT(2); @@ -674,6 +885,9 @@ return 0; #undef RXANT #undef TXANT +#undef ANI +#undef ANISTAT +#undef MIBSTAT #undef PHY #undef STAT } ==== //depot/projects/vap/tools/tools/ath/athstats/main.c#5 (text+ko) ==== @@ -56,6 +56,9 @@ { "default", "input,output,altrate,short,long,xretry,crcerr,crypt,phyerr,rssi,rate" }, + { "ani", + "avgbrssi,avgrssi,avgtxrssi,NI,SI,step,owsd,cwst,NI+,NI-,SI+,SI-,OFDM,CCK,LISTEN" + }, }; static const char *
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200810190640.m9J6enI6039262>