Date: Wed, 29 Dec 2004 23:14:10 GMT From: Sam Leffler <sam@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 67867 for review Message-ID: <200412292314.iBTNEAOo056797@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=67867 Change 67867 by sam@sam_ebb on 2004/12/29 23:13:12 Radiotap fixups: o catch one place where we were not using ath_chan_change to switch channels; this corrects a problem where the channel settings were not being reported in captured packets o return unique channel identification in the channel flags; ethereal gets confused if you return merged flags (e.g. ofdm, cck, and 2Ghz) (this is workaround and should be removed if we can ever cleanup radiotap consumers) o correct short/long preamble flag state for rx and treat tx the same--use a new hwflags array that gives us the data based on the h/w rate index/cookie Affected files ... .. //depot/projects/wifi/sys/dev/ath/if_ath.c#50 edit .. //depot/projects/wifi/sys/dev/ath/if_athvar.h#19 edit Differences ... ==== //depot/projects/wifi/sys/dev/ath/if_ath.c#50 (text+ko) ==== @@ -821,7 +821,6 @@ struct ieee80211com *ic = &sc->sc_ic; struct ifnet *ifp = &sc->sc_if; struct ieee80211_node *ni; - enum ieee80211_phymode mode; struct ath_hal *ah = sc->sc_ah; HAL_STATUS status; @@ -893,9 +892,7 @@ */ ni = ic->ic_bss; ni->ni_chan = ic->ic_ibss_chan; - mode = ieee80211_chan2mode(ic, ni->ni_chan); - if (mode != sc->sc_curmode) - ath_setcurmode(sc, mode); + ath_chan_change(sc, ni->ni_chan); if (ic->ic_opmode != IEEE80211_M_MONITOR) { if (ic->ic_roaming != IEEE80211_ROAMING_MANUAL) ieee80211_new_state(ic, IEEE80211_S_SCAN, -1); @@ -2616,6 +2613,7 @@ if (sc->sc_drvbpf) { const void *data; int hdrsize, hdrspace; + u_int8_t rix; /* * Discard anything shorter than an ack or cts. @@ -2628,8 +2626,9 @@ m_freem(m); goto rx_next; } - sc->sc_rx_th.wr_rate = - sc->sc_hwmap[ds->ds_rxstat.rs_rate]; + rix = ds->ds_rxstat.rs_rate; + sc->sc_rx_th.wr_flags = sc->sc_hwflags[rix]; + sc->sc_rx_th.wr_rate = sc->sc_hwmap[rix]; sc->sc_rx_th.wr_antsignal = ds->ds_rxstat.rs_rssi; sc->sc_rx_th.wr_antenna = ds->ds_rxstat.rs_antenna; /* XXX TSF */ @@ -3222,12 +3221,10 @@ if (ic->ic_rawbpf) bpf_mtap(ic->ic_rawbpf, m0); if (sc->sc_drvbpf) { - sc->sc_tx_th.wt_flags = 0; - if (shortPreamble) - sc->sc_tx_th.wt_flags |= IEEE80211_RADIOTAP_F_SHORTPRE; + sc->sc_tx_th.wt_flags = sc->sc_hwflags[txrate]; if (iswep) sc->sc_tx_th.wt_flags |= IEEE80211_RADIOTAP_F_WEP; - sc->sc_tx_th.wt_rate = ni->ni_rates.rs_rates[ni->ni_txrate]; + sc->sc_tx_th.wt_rate = sc->sc_hwmap[txrate]; sc->sc_tx_th.wt_txpower = ni->ni_txpower; sc->sc_tx_th.wt_antenna = sc->sc_txantenna; @@ -3677,6 +3674,7 @@ { struct ieee80211com *ic = &sc->sc_ic; enum ieee80211_phymode mode; + u_int16_t flags; /* * Change channels and update the h/w rate map @@ -3686,12 +3684,25 @@ if (mode != sc->sc_curmode) ath_setcurmode(sc, mode); /* - * Update BPF state. + * Update BPF state. NB: ethereal et. al. don't handle + * merged flags well, so pick a mode for their use. */ + if (IEEE80211_IS_CHAN_A(chan)) + flags = IEEE80211_CHAN_A; + /* XXX 11g schizophrenia */ + else if (IEEE80211_IS_CHAN_G(chan) || + IEEE80211_IS_CHAN_PUREG(chan)) + flags = IEEE80211_CHAN_G; + else if (IEEE80211_IS_CHAN_B(chan)) + flags = IEEE80211_CHAN_B; + else + flags = 0; + if (IEEE80211_IS_CHAN_T(chan)) + flags |= IEEE80211_CHAN_TURBO; sc->sc_tx_th.wt_chan_freq = sc->sc_rx_th.wr_chan_freq = htole16(chan->ic_freq); sc->sc_tx_th.wt_chan_flags = sc->sc_rx_th.wr_chan_flags = - htole16(chan->ic_flags); + htole16(flags); } /* @@ -4094,10 +4105,15 @@ for (i = 0; i < rt->rateCount; i++) sc->sc_rixmap[rt->info[i].dot11Rate & IEEE80211_RATE_VAL] = i; memset(sc->sc_hwmap, 0, sizeof(sc->sc_hwmap)); + memset(sc->sc_hwflags, 0, sizeof(sc->sc_hwflags)); for (i = 0; i < 32; i++) { u_int8_t ix = rt->rateCodeToIndex[i]; - if (ix != 0xff) - sc->sc_hwmap[i] = rt->info[ix].dot11Rate & IEEE80211_RATE_VAL; + if (ix == 0xff) + continue; + sc->sc_hwmap[i] = rt->info[ix].dot11Rate & IEEE80211_RATE_VAL; + if (rt->info[ix].shortPreamble || + rt->info[ix].phy == IEEE80211_T_OFDM) + sc->sc_hwflags[i] |= IEEE80211_RADIOTAP_F_SHORTPRE; } sc->sc_currates = rt; sc->sc_curmode = mode; ==== //depot/projects/wifi/sys/dev/ath/if_athvar.h#19 (text+ko) ==== @@ -182,6 +182,7 @@ HAL_CHANNEL sc_curchan; /* current h/w channel */ u_int8_t sc_rixmap[256]; /* IEEE to h/w rate table ix */ u_int8_t sc_hwmap[32]; /* h/w rate ix to IEEE table */ + u_int8_t sc_hwflags[32]; /* " " " to radiotap flags */ u_int8_t sc_protrix; /* protection rate index */ u_int sc_txantenna; /* tx antenna (fixed or auto) */ HAL_INT sc_imask; /* interrupt mask copy */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200412292314.iBTNEAOo056797>