update radiotap support to reflect recent changes:

o add xmit rate
o drop rx time
o add rx flags
This commit is contained in:
Sam Leffler 2003-12-28 06:58:52 +00:00
parent c6b688c403
commit 3c898db70a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=123927
2 changed files with 14 additions and 13 deletions

View file

@ -491,8 +491,7 @@ wi_attach(device_t dev)
sc->sc_tx_th.wt_ihdr.it_present = WI_TX_RADIOTAP_PRESENT; 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_len = sizeof(sc->sc_rx_th);
sc->sc_rx_th.wr_ihdr.it_present = WI_RX_RADIOTAP_PRESENT0; sc->sc_rx_th.wr_ihdr.it_present = WI_RX_RADIOTAP_PRESENT;
sc->sc_rx_th.wr_present1 = WI_RX_RADIOTAP_PRESENT1;
#endif #endif
return (0); return (0);
} }
@ -947,6 +946,8 @@ wi_start(struct ifnet *ifp)
frmhdr.wi_dat_len = htole16(m0->m_pkthdr.len); frmhdr.wi_dat_len = htole16(m0->m_pkthdr.len);
#if NBPFILTER > 0 #if NBPFILTER > 0
if (sc->sc_drvbpf) { if (sc->sc_drvbpf) {
sc->sc_tx_th.wt_rate =
ni->ni_rates.rs_rates[ni->ni_txrate];
bpf_mtap2(sc->sc_drvbpf, bpf_mtap2(sc->sc_drvbpf,
&sc->sc_tx_th, sizeof(sc->sc_tx_th), m0); &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 NBPFILTER > 0
if (sc->sc_drvbpf) { 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_rate = frmhdr.wi_rx_rate / 5;
sc->sc_rx_th.wr_antsignal = sc->sc_rx_th.wr_antsignal =
WI_RSSI_TO_DBM(sc, frmhdr.wi_rx_signal); WI_RSSI_TO_DBM(sc, frmhdr.wi_rx_signal);
sc->sc_rx_th.wr_antnoise = sc->sc_rx_th.wr_antnoise =
WI_RSSI_TO_DBM(sc, frmhdr.wi_rx_silence); WI_RSSI_TO_DBM(sc, frmhdr.wi_rx_silence);
sc->sc_rx_th.wr_time = sc->sc_rx_th.wr_flags = 0;
htole32((frmhdr.wi_rx_tstamp1 << 16) | if (frmhdr.wi_status & WI_STAT_PCF)
frmhdr.wi_rx_tstamp0); sc->sc_rx_th.wr_flags |= IEEE80211_RADIOTAP_F_CFP;
bpf_mtap2(sc->sc_drvbpf, bpf_mtap2(sc->sc_drvbpf,
&sc->sc_rx_th, sizeof(sc->sc_rx_th), m); &sc->sc_rx_th, sizeof(sc->sc_rx_th), m);
} }

View file

@ -684,33 +684,32 @@ struct wi_frame {
/* /*
* Radio capture format for Prism. * Radio capture format for Prism.
*/ */
#define WI_RX_RADIOTAP_PRESENT0 \ #define WI_RX_RADIOTAP_PRESENT \
((1 << IEEE80211_RADIOTAP_FLAGS) | \ ((1 << IEEE80211_RADIOTAP_FLAGS) | \
(1 << IEEE80211_RADIOTAP_RATE) | \ (1 << IEEE80211_RADIOTAP_RATE) | \
(1 << IEEE80211_RADIOTAP_CHANNEL) | \ (1 << IEEE80211_RADIOTAP_CHANNEL) | \
(1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL) | \ (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL) | \
(1 << IEEE80211_RADIOTAP_DB_ANTNOISE) | \ (1 << IEEE80211_RADIOTAP_DB_ANTNOISE))
(1 << IEEE80211_RADIOTAP_EXT))
#define WI_RX_RADIOTAP_PRESENT1 (1 << (IEEE80211_RADIOTAP_TIME - 32))
struct wi_rx_radiotap_header { struct wi_rx_radiotap_header {
struct ieee80211_radiotap_header wr_ihdr; struct ieee80211_radiotap_header wr_ihdr;
u_int32_t wr_present1;
u_int8_t wr_flags; u_int8_t wr_flags;
u_int8_t wr_rate; u_int8_t wr_rate;
u_int16_t wr_chan_freq; u_int16_t wr_chan_freq;
u_int16_t wr_chan_flags; u_int16_t wr_chan_flags;
u_int8_t wr_antsignal; u_int8_t wr_antsignal;
u_int8_t wr_antnoise; u_int8_t wr_antnoise;
u_int32_t wr_time;
}; };
#define WI_TX_RADIOTAP_PRESENT \ #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 wi_tx_radiotap_header {
struct ieee80211_radiotap_header wt_ihdr; 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_freq;
u_int16_t wt_chan_flags; u_int16_t wt_chan_flags;
}; };