From eb2cdcb127fb3bbb913cdc002f4b4e1d09aebec9 Mon Sep 17 00:00:00 2001 From: Sam Leffler Date: Sun, 28 Dec 2003 07:00:32 +0000 Subject: [PATCH] update radiotap support to reflect recent changes: o move tx taps from ath_start to ath_tx_start so lots more state is available to tap o add tx flags o add tx rate o add tx power (constant for the moment) o add tx antenna state --- sys/dev/ath/if_ath.c | 25 ++++++++++++++++--------- sys/dev/ath/if_athioctl.h | 8 ++++++-- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c index 3a7313d6cdb..ac940bcbc1b 100644 --- a/sys/dev/ath/if_ath.c +++ b/sys/dev/ath/if_ath.c @@ -773,15 +773,6 @@ ath_start(struct ifnet *ifp) } sc->sc_stats.ast_tx_mgmt++; } - if (ic->ic_rawbpf) - bpf_mtap(ic->ic_rawbpf, m); - - 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), m); - } if (ath_tx_start(sc, ni, bf, m)) { bad: @@ -2039,6 +2030,22 @@ ath_tx_start(struct ath_softc *sc, struct ieee80211_node *ni, struct ath_buf *bf else antenna = an->an_rx_hist[an->an_rx_hist_next].arh_antenna; + 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; + 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_txpower = 60/2; /* XXX */ + sc->sc_tx_th.wt_antenna = antenna; + + bpf_mtap2(sc->sc_drvbpf, + &sc->sc_tx_th, sizeof(sc->sc_tx_th), m0); + } + /* * Formulate first tx descriptor with tx controls. */ diff --git a/sys/dev/ath/if_athioctl.h b/sys/dev/ath/if_athioctl.h index 0476f7f0476..9912bd6368f 100644 --- a/sys/dev/ath/if_athioctl.h +++ b/sys/dev/ath/if_athioctl.h @@ -107,8 +107,8 @@ struct ath_diag { (1 << IEEE80211_RADIOTAP_FLAGS) | \ (1 << IEEE80211_RADIOTAP_RATE) | \ (1 << IEEE80211_RADIOTAP_CHANNEL) | \ - (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL) | \ (1 << IEEE80211_RADIOTAP_ANTENNA) | \ + (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL) | \ 0) struct ath_rx_radiotap_header { @@ -117,14 +117,16 @@ struct ath_rx_radiotap_header { 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_antenna; + u_int8_t wr_antsignal; }; #define ATH_TX_RADIOTAP_PRESENT ( \ (1 << IEEE80211_RADIOTAP_FLAGS) | \ (1 << IEEE80211_RADIOTAP_RATE) | \ (1 << IEEE80211_RADIOTAP_CHANNEL) | \ + (1 << IEEE80211_RADIOTAP_DBM_TX_POWER) | \ + (1 << IEEE80211_RADIOTAP_ANTENNA) | \ 0) struct ath_tx_radiotap_header { @@ -133,6 +135,8 @@ struct ath_tx_radiotap_header { u_int8_t wt_rate; u_int16_t wt_chan_freq; u_int16_t wt_chan_flags; + u_int8_t wt_txpower; + u_int8_t wt_antenna; }; #endif /* _DEV_ATH_ATHIOCTL_H */