summaryrefslogtreecommitdiffstats
path: root/sys/dev/ath
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2005-01-24 20:31:24 +0000
committersam <sam@FreeBSD.org>2005-01-24 20:31:24 +0000
commitfb92987525aed19726f9107ad33b16afe892cbaa (patch)
treeb65bbe97e3774fd1461d9174203e5b9f0a4cf90b /sys/dev/ath
parentebd0a44c323749f78a77da3cf374e9a9940de7c6 (diff)
downloadFreeBSD-src-fb92987525aed19726f9107ad33b16afe892cbaa.zip
FreeBSD-src-fb92987525aed19726f9107ad33b16afe892cbaa.tar.gz
Fixup radiotap handling of FCS and QoS frames per discussion with David Young:
o mark rx frames including FCS in the payload with the IEEE80211_RADIOTAP_F_FCS flag o remove hack to copy 802.11 headers with padding out of line; instead mark the frames with IEEE80211_RADIOTAP_F_DATAPAD and require applications to do the work o split precalculated radiotap flags into tx+rx now that they can be different Note the full usefulness of these changes depends on updates to applications that process radiotap data.
Diffstat (limited to 'sys/dev/ath')
-rw-r--r--sys/dev/ath/if_ath.c45
-rw-r--r--sys/dev/ath/if_athvar.h14
2 files changed, 16 insertions, 43 deletions
diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c
index 8c1c3b2..53febaf 100644
--- a/sys/dev/ath/if_ath.c
+++ b/sys/dev/ath/if_ath.c
@@ -2626,8 +2626,6 @@ rx_accept:
sc->sc_stats.ast_ant_rx[ds->ds_rxstat.rs_antenna]++;
if (sc->sc_drvbpf) {
- const void *data;
- int hdrsize, hdrspace;
u_int8_t rix;
/*
@@ -2642,39 +2640,14 @@ rx_accept:
goto rx_next;
}
rix = ds->ds_rxstat.rs_rate;
- sc->sc_rx_th.wr_flags = sc->sc_hwmap[rix].flags;
+ sc->sc_rx_th.wr_flags = sc->sc_hwmap[rix].rxflags;
sc->sc_rx_th.wr_rate = sc->sc_hwmap[rix].ieeerate;
sc->sc_rx_th.wr_antsignal = ds->ds_rxstat.rs_rssi;
sc->sc_rx_th.wr_antenna = ds->ds_rxstat.rs_antenna;
/* XXX TSF */
- /*
- * Gag, deal with hardware padding of headers. This
- * only happens for QoS frames. We copy the 802.11
- * header out-of-line and supply it separately, then
- * adjust the mbuf chain. It would be better if we
- * could just flag the packet in the radiotap header
- * and have applications DTRT.
- */
- if (len > sizeof(struct ieee80211_qosframe)) {
- data = mtod(m, const void *);
- hdrsize = ieee80211_anyhdrsize(data);
- if (hdrsize & 3) {
- bcopy(data, &sc->sc_rx_wh, hdrsize);
- hdrspace = roundup(hdrsize,
- sizeof(u_int32_t));
- m->m_data += hdrspace;
- m->m_len -= hdrspace;
- bpf_mtap2(sc->sc_drvbpf, &sc->sc_rx,
- sc->sc_rx_rt_len + hdrsize, m);
- m->m_data -= hdrspace;
- m->m_len += hdrspace;
- } else
- bpf_mtap2(sc->sc_drvbpf,
- &sc->sc_rx, sc->sc_rx_rt_len, m);
- } else
- bpf_mtap2(sc->sc_drvbpf,
- &sc->sc_rx, sc->sc_rx_rt_len, m);
+ bpf_mtap2(sc->sc_drvbpf,
+ &sc->sc_rx_th, sc->sc_rx_th_len, m);
}
/*
@@ -3241,7 +3214,7 @@ ath_tx_start(struct ath_softc *sc, struct ieee80211_node *ni, struct ath_buf *bf
if (ic->ic_rawbpf)
bpf_mtap(ic->ic_rawbpf, m0);
if (sc->sc_drvbpf) {
- sc->sc_tx_th.wt_flags = sc->sc_hwmap[txrate].flags;
+ sc->sc_tx_th.wt_flags = sc->sc_hwmap[txrate].txflags;
if (iswep)
sc->sc_tx_th.wt_flags |= IEEE80211_RADIOTAP_F_WEP;
sc->sc_tx_th.wt_rate = sc->sc_hwmap[txrate].ieeerate;
@@ -4205,9 +4178,13 @@ ath_setcurmode(struct ath_softc *sc, enum ieee80211_phymode mode)
}
sc->sc_hwmap[i].ieeerate =
rt->info[ix].dot11Rate & IEEE80211_RATE_VAL;
+ sc->sc_hwmap[i].txflags = IEEE80211_RADIOTAP_F_DATAPAD;
if (rt->info[ix].shortPreamble ||
rt->info[ix].phy == IEEE80211_T_OFDM)
- sc->sc_hwmap[i].flags |= IEEE80211_RADIOTAP_F_SHORTPRE;
+ sc->sc_hwmap[i].txflags |= IEEE80211_RADIOTAP_F_SHORTPRE;
+ /* NB: receive frames include FCS */
+ sc->sc_hwmap[i].rxflags = sc->sc_hwmap[i].txflags |
+ IEEE80211_RADIOTAP_F_FCS;
/* setup blink rate table to avoid per-packet lookup */
for (j = 0; j < N(blinkrates)-1; j++)
if (blinkrates[j].rate == sc->sc_hwmap[i].ieeerate)
@@ -4643,8 +4620,8 @@ ath_bpfattach(struct ath_softc *sc)
sc->sc_tx_th.wt_ihdr.it_len = htole16(sc->sc_tx_th_len);
sc->sc_tx_th.wt_ihdr.it_present = htole32(ATH_TX_RADIOTAP_PRESENT);
- sc->sc_rx_rt_len = roundup(sizeof(sc->sc_rx_th), sizeof(u_int32_t));
- sc->sc_rx_th.wr_ihdr.it_len = htole16(sc->sc_rx_rt_len);
+ sc->sc_rx_th_len = roundup(sizeof(sc->sc_rx_th), sizeof(u_int32_t));
+ sc->sc_rx_th.wr_ihdr.it_len = htole16(sc->sc_rx_th_len);
sc->sc_rx_th.wr_ihdr.it_present = htole32(ATH_RX_RADIOTAP_PRESENT);
}
diff --git a/sys/dev/ath/if_athvar.h b/sys/dev/ath/if_athvar.h
index f3ee87b..28c6ee6 100644
--- a/sys/dev/ath/if_athvar.h
+++ b/sys/dev/ath/if_athvar.h
@@ -185,7 +185,8 @@ struct ath_softc {
u_int8_t sc_rixmap[256]; /* IEEE to h/w rate table ix */
struct {
u_int8_t ieeerate; /* IEEE rate */
- u_int8_t flags; /* radiotap flags */
+ u_int8_t rxflags; /* radiotap rx flags */
+ u_int8_t txflags; /* radiotap tx flags */
u_int16_t ledon; /* softled on time */
u_int16_t ledoff; /* softled off time */
} sc_hwmap[32]; /* h/w rate ix mappings */
@@ -212,13 +213,10 @@ struct ath_softc {
} u_tx_rt;
int sc_tx_th_len;
union {
- struct {
- struct ath_rx_radiotap_header th;
- struct ieee80211_qosframe wh;
- } u;
+ struct ath_rx_radiotap_header th;
u_int8_t pad[64];
} u_rx_rt;
- int sc_rx_rt_len;
+ int sc_rx_th_len;
struct task sc_fataltask; /* fatal int processing */
@@ -260,9 +258,7 @@ struct ath_softc {
};
#define sc_if sc_arp.ac_if
#define sc_tx_th u_tx_rt.th
-#define sc_rx u_rx_rt.u
-#define sc_rx_th sc_rx.th
-#define sc_rx_wh sc_rx.wh
+#define sc_rx_th u_rx_rt.th
#define ATH_LOCK_INIT(_sc) \
mtx_init(&(_sc)->sc_mtx, device_get_nameunit((_sc)->sc_dev), \
OpenPOWER on IntegriCloud