From 3c898db70a6a3a27c629bd52e57fe810ffa01dee Mon Sep 17 00:00:00 2001 From: Sam Leffler Date: Sun, 28 Dec 2003 06:58:52 +0000 Subject: [PATCH] update radiotap support to reflect recent changes: o add xmit rate o drop rx time o add rx flags --- sys/dev/wi/if_wi.c | 12 +++++++----- sys/dev/wi/if_wireg.h | 15 +++++++-------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/sys/dev/wi/if_wi.c b/sys/dev/wi/if_wi.c index a99f96f6e6f..679213641d5 100644 --- a/sys/dev/wi/if_wi.c +++ b/sys/dev/wi/if_wi.c @@ -491,8 +491,7 @@ wi_attach(device_t dev) sc->sc_tx_th.wt_ihdr.it_present = WI_TX_RADIOTAP_PRESENT; sc->sc_rx_th.wr_ihdr.it_len = sizeof(sc->sc_rx_th); - sc->sc_rx_th.wr_ihdr.it_present = WI_RX_RADIOTAP_PRESENT0; - sc->sc_rx_th.wr_present1 = WI_RX_RADIOTAP_PRESENT1; + sc->sc_rx_th.wr_ihdr.it_present = WI_RX_RADIOTAP_PRESENT; #endif return (0); } @@ -947,6 +946,8 @@ wi_start(struct ifnet *ifp) frmhdr.wi_dat_len = htole16(m0->m_pkthdr.len); #if NBPFILTER > 0 if (sc->sc_drvbpf) { + sc->sc_tx_th.wt_rate = + ni->ni_rates.rs_rates[ni->ni_txrate]; bpf_mtap2(sc->sc_drvbpf, &sc->sc_tx_th, sizeof(sc->sc_tx_th), m0); } @@ -1487,14 +1488,15 @@ wi_rx_intr(struct wi_softc *sc) #if NBPFILTER > 0 if (sc->sc_drvbpf) { + /* XXX replace divide by table */ sc->sc_rx_th.wr_rate = frmhdr.wi_rx_rate / 5; sc->sc_rx_th.wr_antsignal = WI_RSSI_TO_DBM(sc, frmhdr.wi_rx_signal); sc->sc_rx_th.wr_antnoise = WI_RSSI_TO_DBM(sc, frmhdr.wi_rx_silence); - sc->sc_rx_th.wr_time = - htole32((frmhdr.wi_rx_tstamp1 << 16) | - frmhdr.wi_rx_tstamp0); + sc->sc_rx_th.wr_flags = 0; + if (frmhdr.wi_status & WI_STAT_PCF) + sc->sc_rx_th.wr_flags |= IEEE80211_RADIOTAP_F_CFP; bpf_mtap2(sc->sc_drvbpf, &sc->sc_rx_th, sizeof(sc->sc_rx_th), m); } diff --git a/sys/dev/wi/if_wireg.h b/sys/dev/wi/if_wireg.h index 5d17211391d..03c6e22de15 100644 --- a/sys/dev/wi/if_wireg.h +++ b/sys/dev/wi/if_wireg.h @@ -684,33 +684,32 @@ struct wi_frame { /* * Radio capture format for Prism. */ -#define WI_RX_RADIOTAP_PRESENT0 \ +#define WI_RX_RADIOTAP_PRESENT \ ((1 << IEEE80211_RADIOTAP_FLAGS) | \ (1 << IEEE80211_RADIOTAP_RATE) | \ (1 << IEEE80211_RADIOTAP_CHANNEL) | \ (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL) | \ - (1 << IEEE80211_RADIOTAP_DB_ANTNOISE) | \ - (1 << IEEE80211_RADIOTAP_EXT)) - -#define WI_RX_RADIOTAP_PRESENT1 (1 << (IEEE80211_RADIOTAP_TIME - 32)) + (1 << IEEE80211_RADIOTAP_DB_ANTNOISE)) struct wi_rx_radiotap_header { struct ieee80211_radiotap_header wr_ihdr; - u_int32_t wr_present1; u_int8_t wr_flags; 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_int32_t wr_time; }; #define WI_TX_RADIOTAP_PRESENT \ - ((1 << IEEE80211_RADIOTAP_CHANNEL)) + ((1 << IEEE80211_RADIOTAP_FLAGS) | \ + (1 << IEEE80211_RADIOTAP_RATE) | \ + (1 << IEEE80211_RADIOTAP_CHANNEL)) struct wi_tx_radiotap_header { struct ieee80211_radiotap_header wt_ihdr; + u_int8_t wt_flags; + u_int8_t wt_rate; u_int16_t wt_chan_freq; u_int16_t wt_chan_flags; };