From owner-p4-projects@FreeBSD.ORG Wed Nov 23 00:53:04 2005 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 0C4BC16A421; Wed, 23 Nov 2005 00:53:04 +0000 (GMT) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D24EC16A420 for ; Wed, 23 Nov 2005 00:53:03 +0000 (GMT) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id E7DB743D5F for ; Wed, 23 Nov 2005 00:52:52 +0000 (GMT) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id jAN0qoO9002274 for ; Wed, 23 Nov 2005 00:52:50 GMT (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id jAN0qoG7002271 for perforce@freebsd.org; Wed, 23 Nov 2005 00:52:50 GMT (envelope-from sam@freebsd.org) Date: Wed, 23 Nov 2005 00:52:50 GMT Message-Id: <200511230052.jAN0qoG7002271@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to sam@freebsd.org using -f From: Sam Leffler To: Perforce Change Reviews Cc: Subject: PERFORCE change 87099 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Nov 2005 00:53:05 -0000 http://perforce.freebsd.org/chv.cgi?CH=87099 Change 87099 by sam@sam_ebb on 2005/11/23 00:52:14 o noise floor changes o ibss mode fix o turbo mode fixups Affected files ... .. //depot/projects/wifi/sbin/ifconfig/ifieee80211.c#50 edit .. //depot/projects/wifi/sys/dev/ath/if_ath.c#111 edit .. //depot/projects/wifi/sys/dev/ath/if_athioctl.h#11 edit .. //depot/projects/wifi/sys/dev/ath/if_athvar.h#46 edit .. //depot/projects/wifi/sys/dev/ipw/if_ipw.c#8 edit .. //depot/projects/wifi/sys/dev/iwi/if_iwi.c#10 edit .. //depot/projects/wifi/sys/net80211/_ieee80211.h#9 edit .. //depot/projects/wifi/sys/net80211/ieee80211.c#30 edit .. //depot/projects/wifi/sys/net80211/ieee80211_input.c#64 edit .. //depot/projects/wifi/sys/net80211/ieee80211_ioctl.c#49 edit .. //depot/projects/wifi/sys/net80211/ieee80211_ioctl.h#31 edit .. //depot/projects/wifi/sys/net80211/ieee80211_node.c#66 edit .. //depot/projects/wifi/sys/net80211/ieee80211_node.h#34 edit .. //depot/projects/wifi/sys/net80211/ieee80211_proto.h#24 edit .. //depot/projects/wifi/sys/net80211/ieee80211_scan.c#5 edit .. //depot/projects/wifi/sys/net80211/ieee80211_scan.h#3 edit .. //depot/projects/wifi/sys/net80211/ieee80211_scan_ap.c#3 edit .. //depot/projects/wifi/sys/net80211/ieee80211_scan_sta.c#4 edit .. //depot/projects/wifi/sys/net80211/ieee80211_var.h#37 edit Differences ... ==== //depot/projects/wifi/sbin/ifconfig/ifieee80211.c#50 (text+ko) ==== @@ -927,12 +927,12 @@ if (len < sizeof(struct ieee80211req_scan_result)) return; - printf("%-14.14s %-17.17s %4s %4s %-5s %3s %4s\n" + printf("%-14.14s %-17.17s %4s %4s %-8s %3s %4s\n" , "SSID" , "BSSID" , "CHAN" , "RATE" - , "S:N" + , " S:N" , "INT" , "CAPS" ); @@ -943,13 +943,13 @@ sr = (struct ieee80211req_scan_result *) cp; vp = (u_int8_t *)(sr+1); - printf("%-14.*s %s %3d %3dM %2d:%-2d %3d %-4.4s" + printf("%-14.*s %s %3d %3dM %3d:%-3d %3d %-4.4s" , copy_essid(ssid, sizeof(ssid), vp, sr->isr_ssid_len) , ssid , ether_ntoa((const struct ether_addr *) sr->isr_bssid) , ieee80211_mhz2ieee(sr->isr_freq) , getmaxrate(sr->isr_rates, sr->isr_nrates) - , sr->isr_rssi, sr->isr_noise + , sr->isr_rssi+sr->isr_noise, sr->isr_noise , sr->isr_intval , getcaps(sr->isr_capinfo) ); ==== //depot/projects/wifi/sys/dev/ath/if_ath.c#111 (text+ko) ==== @@ -87,6 +87,10 @@ #include #include /* XXX for softled */ +#ifdef ATH_TX99_DIAG +#include +#endif + /* unaligned little endian access */ #define LE_READ_2(p) \ ((u_int16_t) \ @@ -138,11 +142,13 @@ static void ath_desc_free(struct ath_softc *); static struct ieee80211_node *ath_node_alloc(struct ieee80211_node_table *); static void ath_node_free(struct ieee80211_node *); -static u_int8_t ath_node_getrssi(const struct ieee80211_node *); +static int8_t ath_node_getrssi(const struct ieee80211_node *); +static void ath_node_getsignal(const struct ieee80211_node *, + int8_t *, int8_t *); static int ath_rxbuf_init(struct ath_softc *, struct ath_buf *); static void ath_recv_mgmt(struct ieee80211com *ic, struct mbuf *m, struct ieee80211_node *ni, - int subtype, int rssi, u_int32_t rstamp); + int subtype, int rssi, int noise, u_int32_t rstamp); static void ath_setdefantenna(struct ath_softc *, u_int); static void ath_rx_proc(void *, int); static struct ath_txq *ath_txq_setup(struct ath_softc*, int qtype, int subtype); @@ -356,6 +362,7 @@ ath_rate_setup(sc, IEEE80211_MODE_11G); ath_rate_setup(sc, IEEE80211_MODE_TURBO_A); ath_rate_setup(sc, IEEE80211_MODE_TURBO_G); + ath_rate_setup(sc, IEEE80211_MODE_STURBO_A); ath_setup_subrates(sc); /* half/quarter rates */ /* NB: setup here so ath_rate_update is happy */ ath_setcurmode(sc, IEEE80211_MODE_11A); @@ -579,6 +586,7 @@ sc->sc_node_free = ic->ic_node_free; ic->ic_node_free = ath_node_free; ic->ic_node_getrssi = ath_node_getrssi; + ic->ic_node_getsignal = ath_node_getsignal; sc->sc_recv_mgmt = ic->ic_recv_mgmt; ic->ic_recv_mgmt = ath_recv_mgmt; sc->sc_newstate = ic->ic_newstate; @@ -641,6 +649,10 @@ * Other than that, it's straightforward... */ ieee80211_ifdetach(&sc->sc_ic); +#ifdef ATH_TX99_DIAG + if (sc->sc_tx99 != NULL) + sc->sc_tx99->detach(sc->sc_tx99); +#endif taskqueue_free(sc->sc_tq); ath_rate_detach(sc->sc_rc); ath_desc_free(sc); @@ -849,7 +861,8 @@ CHANNEL_PUREG, /* IEEE80211_MODE_11G */ 0, /* IEEE80211_MODE_FH */ CHANNEL_108A, /* IEEE80211_MODE_TURBO_A */ - CHANNEL_108G /* IEEE80211_MODE_TURBO_G */ + CHANNEL_108G, /* IEEE80211_MODE_TURBO_G */ + CHANNEL_ST /* IEEE80211_MODE_STURBO_A */ }; enum ieee80211_phymode mode = ieee80211_chan2mode(chan); int flags; @@ -947,6 +960,11 @@ * immediately call back to us to send mgmt frames. */ ath_chan_change(sc, ic->ic_curchan); +#ifdef ATH_TX99_DIAG + if (sc->sc_tx99 != NULL) + sc->sc_tx99->start(sc->sc_tx99); + else +#endif if (ic->ic_opmode != IEEE80211_M_MONITOR) { if (ic->ic_roaming != IEEE80211_ROAMING_MANUAL) ieee80211_new_state(ic, IEEE80211_S_SCAN, -1); @@ -2931,27 +2949,41 @@ sc->sc_node_free(ni); } -static u_int8_t +static int8_t ath_node_getrssi(const struct ieee80211_node *ni) { #define HAL_EP_RND(x, mul) \ ((((x)%(mul)) >= ((mul)/2)) ? ((x) + ((mul) - 1)) / (mul) : (x)/(mul)) u_int32_t avgrssi = ATH_NODE_CONST(ni)->an_avgrssi; - int32_t rssi; /* * When only one frame is received there will be no state in * avgrssi so fallback on the value recorded by the 802.11 layer. */ if (avgrssi != ATH_RSSI_DUMMY_MARKER) - rssi = HAL_EP_RND(avgrssi, HAL_RSSI_EP_MULTIPLIER); + return HAL_EP_RND(avgrssi, HAL_RSSI_EP_MULTIPLIER); else - rssi = ni->ni_rssi; - /* NB: theoretically we shouldn't need this, but be paranoid */ - return rssi < 0 ? 0 : rssi > 127 ? 127 : rssi; + return ni->ni_rssi; #undef HAL_EP_RND } +static void +ath_node_getsignal(const struct ieee80211_node *ni, int8_t *rssi, int8_t *noise) +{ + struct ieee80211com *ic = ni->ni_ic; + struct ath_softc *sc = ic->ic_ifp->if_softc; + struct ath_hal *ah = sc->sc_ah; + HAL_CHANNEL hchan; + + *rssi = ath_node_getrssi(ni); + if (ni->ni_chan != IEEE80211_CHAN_ANYC) { + hchan.channel = ni->ni_chan->ic_freq; + hchan.channelFlags = ath_chan2flags(ni->ni_chan); + *noise = ath_hal_getchannoise(ah, &hchan); + } else + *noise = -95; /* nominally correct */ +} + static int ath_rxbuf_init(struct ath_softc *sc, struct ath_buf *bf) { @@ -3013,7 +3045,7 @@ ds = bf->bf_desc; ds->ds_link = bf->bf_daddr; /* link to self */ ds->ds_data = bf->bf_segs[0].ds_addr; - ds->ds_vdata = mtod(m, void *);/*XXX*/ + ds->ds_vdata = mtod(m, void *); /* for radar */ ath_hal_setuprxdesc(ah, ds , m->m_len /* buffer size */ , 0 @@ -3047,7 +3079,7 @@ static void ath_recv_mgmt(struct ieee80211com *ic, struct mbuf *m, struct ieee80211_node *ni, - int subtype, int rssi, u_int32_t rstamp) + int subtype, int rssi, int noise, u_int32_t rstamp) { struct ath_softc *sc = ic->ic_ifp->if_softc; @@ -3055,7 +3087,7 @@ * Call up first so subsequent work can use information * potentially stored in the node (e.g. for ibss merge). */ - sc->sc_recv_mgmt(ic, m, ni, subtype, rssi, rstamp); + sc->sc_recv_mgmt(ic, m, ni, subtype, rssi, noise, rstamp); switch (subtype) { case IEEE80211_FC0_SUBTYPE_BEACON: /* update rssi statistics for use by the hal */ @@ -3126,7 +3158,7 @@ struct mbuf *m; struct ieee80211_node *ni; struct ath_node *an; - int len, type, ngood; + int len, type, ngood, noise; u_int phyerr; HAL_STATUS status; @@ -3134,6 +3166,7 @@ DPRINTF(sc, ATH_DEBUG_RX_PROC, "%s: pending %u\n", __func__, npending); ngood = 0; + noise = ath_hal_getchannoise(ah, &sc->sc_curchan); do { bf = STAILQ_FIRST(&sc->sc_rxbuf); if (bf == NULL) { /* NB: shouldn't happen */ @@ -3290,6 +3323,7 @@ if (sc->sc_drvbpf) { u_int8_t rix; + int16_t nf; /* * Discard anything shorter than an ack or cts. @@ -3305,8 +3339,10 @@ rix = ds->ds_rxstat.rs_rate; sc->sc_rx_th.wr_flags = sc->sc_hwmap[rix].rxflags; sc->sc_rx_th.wr_rate = sc->sc_hwmap[rix].ieeerate; - sc->sc_rx_th.wr_antsignal = ds->ds_rxstat.rs_rssi; sc->sc_rx_th.wr_antenna = ds->ds_rxstat.rs_antenna; + nf = ath_hal_getchannoise(ah, &sc->sc_curchan); + sc->sc_rx_th.wr_antsignal = ds->ds_rxstat.rs_rssi + nf; + sc->sc_rx_th.wr_antnoise = nf; /* XXX TSF */ bpf_mtap2(sc->sc_drvbpf, @@ -3352,7 +3388,7 @@ * Send frame up for processing. */ type = ieee80211_input(ic, m, ni, - ds->ds_rxstat.rs_rssi, ds->ds_rxstat.rs_tstamp); + ds->ds_rxstat.rs_rssi, noise, ds->ds_rxstat.rs_tstamp); ieee80211_free_node(ni); if (sc->sc_diversity) { /* @@ -4624,9 +4660,10 @@ ath_draintxq(sc); /* clear pending tx frames */ ath_stoprecv(sc); /* turn off frame recv */ if (!ath_hal_reset(ah, ic->ic_opmode, &hchan, AH_TRUE, &status)) { - if_printf(ic->ic_ifp, "ath_chan_set: unable to reset " - "channel %u (%u Mhz)\n", - ieee80211_chan2ieee(ic, chan), chan->ic_freq); + if_printf(ic->ic_ifp, "%s: unable to reset " + "channel %u (%u Mhz, flags 0x%x hal flags 0x%x)\n", + __func__, ieee80211_chan2ieee(ic, chan), + chan->ic_freq, chan->ic_flags, hchan.channelFlags); return EIO; } sc->sc_curchan = hchan; @@ -4687,6 +4724,7 @@ __func__, sc->sc_curchan.channel); sc->sc_stats.ast_per_calfail++; } + ath_hal_process_noisefloor(ah); /* * Poll more frequently when the IQ calibration is in * progress to speedup loading the final settings. @@ -4746,6 +4784,8 @@ ath_hal_setrxfilter(ah, rfilt); ath_hal_setassocid(ah, sc->sc_curbssid, sc->sc_curaid); + ath_hal_process_noisefloor(ah); + DPRINTF(sc, ATH_DEBUG_STATE, "%s: RX filter 0x%x bssid %s aid 0x%x\n", __func__, rfilt, ether_sprintf(sc->sc_curbssid), sc->sc_curaid); @@ -5126,11 +5166,14 @@ rt = ath_hal_getratetable(ah, HAL_MODE_11G); break; case IEEE80211_MODE_TURBO_A: - rt = ath_hal_getratetable(ah, HAL_MODE_TURBO); + rt = ath_hal_getratetable(ah, HAL_MODE_108A); break; case IEEE80211_MODE_TURBO_G: rt = ath_hal_getratetable(ah, HAL_MODE_108G); break; + case IEEE80211_MODE_STURBO_A: + rt = ath_hal_getratetable(ah, HAL_MODE_TURBO); + break; default: DPRINTF(sc, ATH_DEBUG_ANY, "%s: invalid mode %u\n", __func__, mode); @@ -5398,7 +5441,8 @@ /* NB: embed these numbers to get a consistent view */ sc->sc_stats.ast_tx_packets = ifp->if_opackets; sc->sc_stats.ast_rx_packets = ifp->if_ipackets; - sc->sc_stats.ast_rx_rssi = ieee80211_getrssi(ic); + ieee80211_getsignal(ic, &sc->sc_stats.ast_rx_rssi, + &sc->sc_stats.ast_rx_noise); ATH_UNLOCK(sc); /* * NB: Drop the softc lock in case of a page fault; @@ -5589,6 +5633,49 @@ return !ath_hal_setrfsilent(sc->sc_ah, rfsilent) ? EINVAL : 0; } +static int +ath_sysctl_regdomain(SYSCTL_HANDLER_ARGS) +{ + struct ath_softc *sc = arg1; + u_int32_t rd; + int error; + + if (!ath_hal_getregdomain(sc->sc_ah, &rd)) + return EINVAL; + error = sysctl_handle_int(oidp, &rd, 0, req); + if (error || !req->newptr) + return error; + return !ath_hal_setregdomain(sc->sc_ah, rd) ? EINVAL : 0; +} + +static int +ath_sysctl_tpack(SYSCTL_HANDLER_ARGS) +{ + struct ath_softc *sc = arg1; + u_int32_t tpack; + int error; + + ath_hal_gettpack(sc->sc_ah, &tpack); + error = sysctl_handle_int(oidp, &tpack, 0, req); + if (error || !req->newptr) + return error; + return !ath_hal_settpack(sc->sc_ah, tpack) ? EINVAL : 0; +} + +static int +ath_sysctl_tpcts(SYSCTL_HANDLER_ARGS) +{ + struct ath_softc *sc = arg1; + u_int32_t tpcts; + int error; + + ath_hal_gettpcts(sc->sc_ah, &tpcts); + error = sysctl_handle_int(oidp, &tpcts, 0, req); + if (error || !req->newptr) + return error; + return !ath_hal_settpcts(sc->sc_ah, tpcts) ? EINVAL : 0; +} + static void ath_sysctlattach(struct ath_softc *sc) { @@ -5600,10 +5687,9 @@ SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "countrycode", CTLFLAG_RD, &sc->sc_countrycode, 0, "EEPROM country code"); - ath_hal_getregdomain(sc->sc_ah, &sc->sc_regdomain); - SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, - "regdomain", CTLFLAG_RD, &sc->sc_regdomain, 0, - "EEPROM regdomain code"); + SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, + "regdomain", CTLTYPE_INT | CTLFLAG_RW, sc, 0, + ath_sysctl_regdomain, "I", "EEPROM regdomain code"); sc->sc_debug = ath_debug; SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "debug", CTLFLAG_RW, &sc->sc_debug, 0, @@ -5650,10 +5736,17 @@ SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "tpscale", CTLTYPE_INT | CTLFLAG_RW, sc, 0, ath_sysctl_tpscale, "I", "tx power scaling"); - if (ath_hal_hastpc(ah)) + if (ath_hal_hastpc(ah)) { SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "tpc", CTLTYPE_INT | CTLFLAG_RW, sc, 0, ath_sysctl_tpc, "I", "enable/disable per-packet TPC"); + SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, + "tpack", CTLTYPE_INT | CTLFLAG_RW, sc, 0, + ath_sysctl_tpack, "I", "tx power for ack frames"); + SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, + "tpcts", CTLTYPE_INT | CTLFLAG_RW, sc, 0, + ath_sysctl_tpcts, "I", "tx power for cts frames"); + } if (ath_hal_hasfastframes(sc->sc_ah)) { sc->sc_fftxqmin = ATH_FF_TXQMIN; SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, ==== //depot/projects/wifi/sys/dev/ath/if_athioctl.h#11 (text+ko) ==== @@ -33,7 +33,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGES. * - * $FreeBSD: src/sys/dev/ath/if_athioctl.h,v 1.11 2005/11/15 05:49:02 sam Exp $ + * $FreeBSD: src/sys/dev/ath/if_athioctl.h,v 1.10 2005/03/30 20:13:08 sam Exp $ */ /* @@ -76,8 +76,8 @@ u_int32_t ast_tx_shortpre;/* tx frames with short preamble */ u_int32_t ast_tx_altrate; /* tx frames with alternate rate */ u_int32_t ast_tx_protect; /* tx frames with protection */ - u_int32_t ast_unused1; - u_int32_t ast_unused2; + u_int32_t ast_tx_ctsburst;/* tx frames with cts and bursting */ + u_int32_t ast_tx_ctsext; /* tx frames with cts extension */ u_int32_t ast_rx_nombuf; /* rx setup failed 'cuz no mbuf */ u_int32_t ast_rx_busdma; /* rx setup failed for dma resrcs */ u_int32_t ast_rx_orn; /* rx failed 'cuz of desc overrun */ @@ -111,7 +111,8 @@ u_int32_t ast_ff_rx; /* fast frames rx'd */ u_int32_t ast_ff_flush; /* fast frames flushed from staging q */ u_int32_t ast_tx_qfull; /* tx dropped 'cuz of queue limit */ - u_int32_t ast_pad[32]; + int8_t ast_rx_noise; /* rx noise floor */ + u_int32_t ast_pad[31]; }; #define SIOCGATHSTATS _IOWR('i', 137, struct ifreq) @@ -139,7 +140,8 @@ (1 << IEEE80211_RADIOTAP_RATE) | \ (1 << IEEE80211_RADIOTAP_CHANNEL) | \ (1 << IEEE80211_RADIOTAP_ANTENNA) | \ - (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL) | \ + (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) | \ + (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE) | \ 0) struct ath_rx_radiotap_header { @@ -148,8 +150,9 @@ u_int8_t wr_rate; u_int16_t wr_chan_freq; u_int16_t wr_chan_flags; + u_int8_t wr_antsignal; + u_int8_t wr_antnoise; u_int8_t wr_antenna; - u_int8_t wr_antsignal; }; #define ATH_TX_RADIOTAP_PRESENT ( \ ==== //depot/projects/wifi/sys/dev/ath/if_athvar.h#46 (text+ko) ==== @@ -33,7 +33,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGES. * - * $FreeBSD: src/sys/dev/ath/if_athvar.h,v 1.30 2005/11/15 05:49:02 sam Exp $ + * $FreeBSD: src/sys/dev/ath/if_athvar.h,v 1.28 2005/07/24 05:11:39 sam Exp $ */ /* @@ -50,7 +50,7 @@ #define ATH_TIMEOUT 1000 #define ATH_RXBUF 40 /* number of RX buffers */ -#define ATH_TXBUF 100 /* number of TX buffers */ +#define ATH_TXBUF 200 /* number of TX buffers */ #define ATH_TXDESC 10 /* number of descriptors per buffer */ #define ATH_TXMAXTRY 11 /* max number of transmit attempts */ #define ATH_TXMGTTRY 4 /* xmit attempts for mgt/ctl frames */ @@ -180,13 +180,12 @@ struct ifnet *sc_ifp; /* interface common */ struct ath_stats sc_stats; /* interface statistics */ struct ieee80211com sc_ic; /* IEEE 802.11 common */ - int sc_regdomain; int sc_countrycode; int sc_debug; void (*sc_recv_mgmt)(struct ieee80211com *, struct mbuf *, struct ieee80211_node *, - int, int, u_int32_t); + int, int, int, u_int32_t); int (*sc_newstate)(struct ieee80211com *, enum ieee80211_state, int); void (*sc_node_free)(struct ieee80211_node *); @@ -199,6 +198,7 @@ struct proc *sc_tqproc; /* thread handling sc_tq */ struct ath_hal *sc_ah; /* Atheros HAL */ struct ath_ratectrl *sc_rc; /* tx rate control support */ + struct ath_tx99 *sc_tx99; /* tx99 adjunct state */ void (*sc_setdefantenna)(struct ath_softc *, u_int); unsigned int sc_invalid : 1, /* disable hardware accesses */ sc_mrretry : 1, /* multi-rate retry support */ @@ -466,7 +466,9 @@ #define ath_hal_ciphersupported(_ah, _cipher) \ (ath_hal_getcapability(_ah, HAL_CAP_CIPHER, _cipher, NULL) == HAL_OK) #define ath_hal_getregdomain(_ah, _prd) \ - ath_hal_getcapability(_ah, HAL_CAP_REG_DMN, 0, (_prd)) + (ath_hal_getcapability(_ah, HAL_CAP_REG_DMN, 0, (_prd)) == HAL_OK) +#define ath_hal_setregdomain(_ah, _rd) \ + ((*(_ah)->ah_setRegulatoryDomain)((_ah), (_rd), NULL)) #define ath_hal_getcountrycode(_ah, _pcc) \ (*(_pcc) = (_ah)->ah_countryCode) #define ath_hal_tkipsplit(_ah) \ @@ -527,6 +529,16 @@ (ath_hal_getcapability(_ah, HAL_CAP_RFSILENT, 2, _prfsilent) == HAL_OK) #define ath_hal_setrfsilent(_ah, _rfsilent) \ ath_hal_setcapability(_ah, HAL_CAP_RFSILENT, 2, _rfsilent, NULL) +#define ath_hal_gettpack(_ah, _ptpack) \ + (ath_hal_getcapability(_ah, HAL_CAP_TPC_ACK, 0, _ptpack) == HAL_OK) +#define ath_hal_settpack(_ah, _tpack) \ + ath_hal_setcapability(_ah, HAL_CAP_TPC_ACK, 0, _tpack, NULL) +#define ath_hal_gettpcts(_ah, _ptpcts) \ + (ath_hal_getcapability(_ah, HAL_CAP_TPC_CTS, 0, _ptpcts) == HAL_OK) +#define ath_hal_settpcts(_ah, _tpcts) \ + ath_hal_setcapability(_ah, HAL_CAP_TPC_CTS, 0, _tpcts, NULL) +#define ath_hal_getchannoise(_ah, _c) \ + ((*(_ah)->ah_getChanNoise)((_ah), (_c))) #define ath_hal_setuprxdesc(_ah, _ds, _size, _intreq) \ ((*(_ah)->ah_setupRxDesc)((_ah), (_ds), (_size), (_intreq))) ==== //depot/projects/wifi/sys/dev/ipw/if_ipw.c#8 (text+ko) ==== @@ -1052,7 +1052,7 @@ ni = ieee80211_find_rxnode(ic, (struct ieee80211_frame_min *)wh); /* send the frame to the 802.11 layer */ - ieee80211_input(ic, m, ni, status->rssi, 0); + ieee80211_input(ic, m, ni, status->rssi, -95/*XXX*/, 0); /* node is no longer needed */ ieee80211_free_node(ni); ==== //depot/projects/wifi/sys/dev/iwi/if_iwi.c#10 (text+ko) ==== @@ -1203,7 +1203,7 @@ ni = ieee80211_find_rxnode(ic, (struct ieee80211_frame_min *)wh); /* send the frame to the 802.11 layer */ - ieee80211_input(ic, m, ni, frame->rssi_dbm, 0); + ieee80211_input(ic, m, ni, frame->rssi_dbm, frame->noise, 0); /* node is no longer needed */ ieee80211_free_node(ni); @@ -2230,7 +2230,7 @@ return error; /* if we have a desired ESSID, set it now */ - if (ic->ic_des_esslen != 0) { + if (ic->ic_des_ssid[0].len != 0) { #ifdef IWI_DEBUG if (iwi_debug > 0) { printf("Setting desired ESSID to "); @@ -2239,8 +2239,8 @@ printf("\n"); } #endif - error = iwi_cmd(sc, IWI_CMD_SET_ESSID, ic->ic_des_essid, - ic->ic_des_esslen, 0); + error = iwi_cmd(sc, IWI_CMD_SET_ESSID, ic->ic_des_ssid[0].ssid, + ic->ic_des_ssid[0].len, 0); if (error != 0) return error; } @@ -2299,7 +2299,7 @@ memset(&scan, 0, sizeof scan); - if (ic->ic_des_esslen != 0) { + if (ic->ic_des_ssid[0].len != 0) { scan.bdirected = htole16(sc->dwelltime); memset(scan.type, IWI_SCAN_TYPE_BDIRECTED, sizeof scan.type); } else { ==== //depot/projects/wifi/sys/net80211/_ieee80211.h#9 (text+ko) ==== @@ -51,8 +51,9 @@ IEEE80211_MODE_FH = 4, /* 2GHz, GFSK */ IEEE80211_MODE_TURBO_A = 5, /* 5GHz, OFDM, 2x clock */ IEEE80211_MODE_TURBO_G = 6, /* 2GHz, OFDM, 2x clock */ + IEEE80211_MODE_STURBO_A = 7, /* 5GHz, OFDM, 2x clock, static */ }; -#define IEEE80211_MODE_MAX (IEEE80211_MODE_TURBO_G+1) +#define IEEE80211_MODE_MAX (IEEE80211_MODE_STURBO_A+1) enum ieee80211_opmode { IEEE80211_M_STA = 1, /* infrastructure station */ ==== //depot/projects/wifi/sys/net80211/ieee80211.c#30 (text+ko) ==== @@ -59,6 +59,7 @@ "FH", /* IEEE80211_MODE_FH */ "turboA", /* IEEE80211_MODE_TURBO_A */ "turboG", /* IEEE80211_MODE_TURBO_G */ + "sturboA", /* IEEE80211_MODE_STURBO_A */ }; /* list of all instances */ @@ -159,6 +160,8 @@ ic->ic_modecaps |= 1<ic_modecaps |= 1<ic_modecaps |= 1<ic_chan_active, ic->ic_chan_avail, @@ -623,9 +626,12 @@ * XXX does not apply to AUTO */ if (ime->ifm_media & IFM_IEEE80211_TURBO) { - if (newphymode == IEEE80211_MODE_11A) - newphymode = IEEE80211_MODE_TURBO_A; - else if (newphymode == IEEE80211_MODE_11G) + if (newphymode == IEEE80211_MODE_11A) { + if (ic->ic_flags & IEEE80211_F_TURBOP) + newphymode = IEEE80211_MODE_TURBO_A; + else + newphymode = IEEE80211_MODE_STURBO_A; + } else if (newphymode == IEEE80211_MODE_11G) newphymode = IEEE80211_MODE_TURBO_G; else return EINVAL; @@ -821,52 +827,7 @@ int ieee80211_setmode(struct ieee80211com *ic, enum ieee80211_phymode mode) { -#define N(a) (sizeof(a) / sizeof(a[0])) - static const u_int chanflags[] = { - 0, /* IEEE80211_MODE_AUTO */ - IEEE80211_CHAN_A, /* IEEE80211_MODE_11A */ - IEEE80211_CHAN_B, /* IEEE80211_MODE_11B */ - IEEE80211_CHAN_PUREG, /* IEEE80211_MODE_11G */ - IEEE80211_CHAN_FHSS, /* IEEE80211_MODE_FH */ - IEEE80211_CHAN_108A, /* IEEE80211_MODE_TURBO_A */ - IEEE80211_CHAN_108G, /* IEEE80211_MODE_TURBO_G */ - }; - struct ieee80211_channel *c; - u_int modeflags; - int i; - /* - * Calculate the active channel set. - */ - memset(ic->ic_chan_active, 0, sizeof(ic->ic_chan_active)); - KASSERT(mode < N(chanflags), ("Unexpected mode %u", mode)); - modeflags = chanflags[mode]; - for (i = 0; i < ic->ic_nchans; i++) { - c = &ic->ic_channels[i]; - if (mode == IEEE80211_MODE_AUTO) { - /* take anything but pure turbo channels */ - if ((c->ic_flags &~ IEEE80211_CHAN_TURBO) != 0) - setbit(ic->ic_chan_active, c->ic_ieee); - } else { - if ((c->ic_flags & modeflags) == modeflags) - setbit(ic->ic_chan_active, c->ic_ieee); - } - } -#if 0 - /* - * Potentially invalidate the bss channel. - */ - if (ic->ic_bsschan != IEEE80211_CHAN_ANYC && - mode != ieee80211_chan2mode(ic->ic_bsschan)) - ic->ic_bsschan = IEEE80211_CHAN_ANYC; /* invalidate */ - /* - * If the desired channel is set but no longer valid then reset it. - */ - if (ic->ic_des_chan != IEEE80211_CHAN_ANYC && - isclr(ic->ic_chan_active, ieee80211_chan2ieee(ic, ic->ic_des_chan))) - ic->ic_des_chan = IEEE80211_CHAN_ANYC; -#endif - /* * Do mode-specific rate setup. */ if (mode == IEEE80211_MODE_11G) { @@ -888,7 +849,6 @@ ieee80211_wme_initparams(ic); /* reset WME stat */ return 0; -#undef N } /* @@ -900,6 +860,8 @@ if (IEEE80211_IS_CHAN_108G(chan)) return IEEE80211_MODE_TURBO_G; + else if (IEEE80211_IS_CHAN_ST(chan)) + return IEEE80211_MODE_STURBO_A; else if (IEEE80211_IS_CHAN_TURBO(chan)) return IEEE80211_MODE_TURBO_A; else if (IEEE80211_IS_CHAN_A(chan)) @@ -964,6 +926,7 @@ switch (mode) { case IEEE80211_MODE_11A: case IEEE80211_MODE_TURBO_A: + case IEEE80211_MODE_STURBO_A: mask |= IFM_IEEE80211_11A; break; case IEEE80211_MODE_11B: ==== //depot/projects/wifi/sys/net80211/ieee80211_input.c#64 (text+ko) ==== @@ -131,7 +131,7 @@ */ int ieee80211_input(struct ieee80211com *ic, struct mbuf *m, - struct ieee80211_node *ni, int rssi, u_int32_t rstamp) + struct ieee80211_node *ni, int rssi, int noise, u_int32_t rstamp) { #define SEQ_LEQ(a,b) ((int)((a)-(b)) <= 0) #define HAS_SEQ(type) ((type & 0x4) == 0) @@ -234,7 +234,8 @@ * exist. This should probably done after an ACL check. */ if (ni == ic->ic_bss && - ic->ic_opmode != IEEE80211_M_HOSTAP) { + ic->ic_opmode != IEEE80211_M_HOSTAP && + IEEE80211_ADDR_EQ(wh->i_addr2, ni->ni_macaddr)) { /* * Fake up a node for this newly * discovered member of the IBSS. @@ -251,6 +252,7 @@ goto out; } ni->ni_rssi = rssi; + ni->ni_noise = noise; ni->ni_rstamp = rstamp; if (HAS_SEQ(type)) { u_int8_t tid; @@ -562,7 +564,7 @@ } if (ic->ic_rawbpf) bpf_mtap(ic->ic_rawbpf, m); - (*ic->ic_recv_mgmt)(ic, m, ni, subtype, rssi, rstamp); + (*ic->ic_recv_mgmt)(ic, m, ni, subtype, rssi, noise, rstamp); m_freem(m); return type; @@ -979,8 +981,8 @@ static void ieee80211_auth_open(struct ieee80211com *ic, struct ieee80211_frame *wh, - struct ieee80211_node *ni, int rssi, u_int32_t rstamp, u_int16_t seq, - u_int16_t status) + struct ieee80211_node *ni, int rssi, int noise, u_int32_t rstamp, + u_int16_t seq, u_int16_t status) { if (ni->ni_authmode == IEEE80211_AUTH_SHARED) { @@ -1108,8 +1110,8 @@ /* XXX TODO: add statistics */ static void ieee80211_auth_shared(struct ieee80211com *ic, struct ieee80211_frame *wh, - u_int8_t *frm, u_int8_t *efrm, struct ieee80211_node *ni, int rssi, - u_int32_t rstamp, u_int16_t seq, u_int16_t status) + u_int8_t *frm, u_int8_t *efrm, struct ieee80211_node *ni, + int rssi, int noise, u_int32_t rstamp, u_int16_t seq, u_int16_t status) { u_int8_t *challenge; int allocbs, estatus; @@ -1219,6 +1221,7 @@ */ ni->ni_flags |= IEEE80211_NODE_AREF; ni->ni_rssi = rssi; + ni->ni_noise = noise; ni->ni_rstamp = rstamp; if (!alloc_challenge(ic, ni)) { /* NB: don't return error so they rexmit */ @@ -1909,7 +1912,7 @@ void ieee80211_recv_mgmt(struct ieee80211com *ic, struct mbuf *m0, struct ieee80211_node *ni, - int subtype, int rssi, u_int32_t rstamp) + int subtype, int rssi, int noise, u_int32_t rstamp) { #define ISPROBE(_st) ((_st) == IEEE80211_FC0_SUBTYPE_PROBE_RESP) #define ISREASSOC(_st) ((_st) == IEEE80211_FC0_SUBTYPE_REASSOC_RESP) @@ -2161,7 +2164,7 @@ */ if (ic->ic_flags & IEEE80211_F_SCAN) ieee80211_add_scan(ic, &scan, wh, - subtype, rssi, rstamp); + subtype, rssi, noise, rstamp); else if (contbgscan(ic) || startbgscan(ic)) ieee80211_bg_scan(ic); return; @@ -2171,7 +2174,7 @@ */ if (ic->ic_flags & IEEE80211_F_SCAN) { ieee80211_add_scan(ic, &scan, wh, - subtype, rssi, rstamp); + subtype, rssi, noise, rstamp); return; } if (scan.capinfo & IEEE80211_CAPINFO_IBSS) { @@ -2180,6 +2183,12 @@ * Create a new entry in the neighbor table. */ ni = ieee80211_add_neighbor(ic, wh, &scan); + } else if (ni->ni_capinfo == 0) { + /* + * Update faked node created on transmit. + * Note this also updates the tsf. + */ + ieee80211_init_neighbor(ni, wh, &scan); } else { /* * Record tsf for potential resync. @@ -2189,6 +2198,7 @@ } if (ni != NULL) { ni->ni_rssi = rssi; + ni->ni_noise = noise; ni->ni_rstamp = rstamp; } } @@ -2245,8 +2255,12 @@ return; } + allocbs = 0; if (ni == ic->ic_bss) { - if (ic->ic_opmode == IEEE80211_M_IBSS) { + if (ic->ic_opmode != IEEE80211_M_IBSS) { + ni = ieee80211_tmp_node(ic, wh->i_addr2); + allocbs = 1; + } else if (!IEEE80211_ADDR_EQ(wh->i_addr2, ni->ni_macaddr)) { /* * XXX Cannot tell if the sender is operating * in ibss mode. But we need a new node to @@ -2255,13 +2269,10 @@ */ ni = ieee80211_fakeup_adhoc_node(&ic->ic_sta, wh->i_addr2); - } else - ni = ieee80211_tmp_node(ic, wh->i_addr2); + } if (ni == NULL) return; - allocbs = 1; - } else - allocbs = 0; + } IEEE80211_DPRINTF(ic, IEEE80211_MSG_ASSOC, "[%s] recv probe req\n", ether_sprintf(wh->i_addr2)); ni->ni_rssi = rssi; @@ -2278,8 +2289,11 @@ IEEE80211_SEND_MGMT(ic, ni, IEEE80211_FC0_SUBTYPE_PROBE_RESP, 0); } - if (allocbs && ic->ic_opmode != IEEE80211_M_IBSS) { - /* reclaim immediately */ + if (allocbs) { + /* + * Temporary node created just to send a + * response, reclaim immediately. + */ ieee80211_free_node(ni); } else if (ath != NULL) ieee80211_saveath(ni, ath); @@ -2330,10 +2344,10 @@ } if (algo == IEEE80211_AUTH_ALG_SHARED) ieee80211_auth_shared(ic, wh, frm + 6, efrm, ni, rssi, - rstamp, seq, status); + noise, rstamp, seq, status); else if (algo == IEEE80211_AUTH_ALG_OPEN) - ieee80211_auth_open(ic, wh, ni, rssi, rstamp, seq, - status); + ieee80211_auth_open(ic, wh, ni, rssi, noise, rstamp, + seq, status); else { IEEE80211_DISCARD(ic, IEEE80211_MSG_ANY, wh, "auth", "unsupported alg %d", algo); @@ -2517,6 +2531,7 @@ return; } ni->ni_rssi = rssi; + ni->ni_noise = noise; ni->ni_rstamp = rstamp; ni->ni_intval = lintval; ni->ni_capinfo = capinfo; ==== //depot/projects/wifi/sys/net80211/ieee80211_ioctl.c#49 (text+ko) ==== @@ -176,7 +176,7 @@ ieee80211_ioctl_getchanlist(struct ieee80211com *ic, struct ieee80211req *ireq) { - if (sizeof(ic->ic_chan_active) > ireq->i_len) + if (sizeof(ic->ic_chan_active) < ireq->i_len) ireq->i_len = sizeof(ic->ic_chan_active); return copyout(&ic->ic_chan_active, ireq->i_data, ireq->i_len); } @@ -312,6 +312,7 @@ sr->isr_freq = se->se_chan->ic_freq; sr->isr_flags = se->se_chan->ic_flags; sr->isr_rssi = se->se_rssi; + sr->isr_noise = se->se_noise; sr->isr_intval = se->se_intval; sr->isr_capinfo = se->se_capinfo; sr->isr_erp = se->se_erp; @@ -434,7 +435,7 @@ si->isi_flags = ni->ni_chan->ic_flags; si->isi_state = ni->ni_flags; si->isi_authmode = ni->ni_authmode; - si->isi_rssi = ic->ic_node_getrssi(ni); + ic->ic_node_getsignal(ni, &si->isi_rssi, &si->isi_noise); si->isi_capinfo = ni->ni_capinfo; si->isi_erp = ni->ni_erp; IEEE80211_ADDR_COPY(si->isi_macaddr, ni->ni_macaddr); ==== //depot/projects/wifi/sys/net80211/ieee80211_ioctl.h#31 (text+ko) ==== @@ -308,7 +308,8 @@ u_int16_t isi_flags; /* channel flags */ u_int16_t isi_state; /* state flags */ u_int8_t isi_authmode; /* authentication algorithm */ - u_int8_t isi_rssi; + int8_t isi_rssi; + int8_t isi_noise; u_int8_t isi_capinfo; /* capabilities */ u_int8_t isi_erp; /* ERP element */ u_int8_t isi_macaddr[IEEE80211_ADDR_LEN]; @@ -465,8 +466,8 @@ u_int16_t isr_len; /* length (mult of 4) */ u_int16_t isr_freq; /* MHz */ u_int16_t isr_flags; /* channel flags */ - u_int8_t isr_noise; - u_int8_t isr_rssi; + int8_t isr_noise; + int8_t isr_rssi; u_int8_t isr_intval; /* beacon interval */ u_int8_t isr_capinfo; /* capabilities */ u_int8_t isr_erp; /* ERP element */ ==== //depot/projects/wifi/sys/net80211/ieee80211_node.c#66 (text+ko) ==== @@ -64,7 +64,8 @@ static struct ieee80211_node *node_alloc(struct ieee80211_node_table *); static void node_cleanup(struct ieee80211_node *); static void node_free(struct ieee80211_node *); -static u_int8_t node_getrssi(const struct ieee80211_node *); +static int8_t node_getrssi(const struct ieee80211_node *); +static void node_getsignal(const struct ieee80211_node *, int8_t *, int8_t *); static void ieee80211_setup_node(struct ieee80211_node_table *, struct ieee80211_node *, const u_int8_t *); @@ -86,6 +87,7 @@ ic->ic_node_free = node_free; ic->ic_node_cleanup = node_cleanup; ic->ic_node_getrssi = node_getrssi; + ic->ic_node_getsignal = node_getsignal; /* default station inactivity timer setings */ ic->ic_inact_init = IEEE80211_INACT_INIT; @@ -586,6 +588,7 @@ ni->ni_fhindex = se->se_fhindex; ni->ni_erp = se->se_erp; ni->ni_rssi = se->se_rssi; + ni->ni_noise = se->se_noise; if (se->se_wpa_ie != NULL) ieee80211_saveie(&ni->ni_wpa_ie, se->se_wpa_ie); if (se->se_wme_ie != NULL) @@ -704,13 +707,20 @@ FREE(ni, M_80211_NODE); } -static u_int8_t +static int8_t node_getrssi(const struct ieee80211_node *ni) { return ni->ni_rssi; } static void +node_getsignal(const struct ieee80211_node *ni, int8_t *rssi, int8_t *noise) +{ + *rssi = ni->ni_rssi; + *noise = ni->ni_noise; +} + +static void ieee80211_setup_node(struct ieee80211_node_table *nt, struct ieee80211_node *ni, const u_int8_t *macaddr) { @@ -890,10 +900,32 @@ return ni; } >>> TRUNCATED FOR MAIL (1000 lines) <<<