From owner-p4-projects@FreeBSD.ORG Wed Dec 29 23:14:11 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 5711E16A4D1; Wed, 29 Dec 2004 23:14:11 +0000 (GMT) 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 0D81316A4CE for ; Wed, 29 Dec 2004 23:14:11 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id D910F43D39 for ; Wed, 29 Dec 2004 23:14:10 +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 iBTNEArm056800 for ; Wed, 29 Dec 2004 23:14:10 GMT (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id iBTNEAOo056797 for perforce@freebsd.org; Wed, 29 Dec 2004 23:14:10 GMT (envelope-from sam@freebsd.org) Date: Wed, 29 Dec 2004 23:14:10 GMT Message-Id: <200412292314.iBTNEAOo056797@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 Subject: PERFORCE change 67867 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Dec 2004 23:14:12 -0000 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 */