PERFORCE change 69317 for review
Sam Leffler
sam at FreeBSD.org
Wed Jan 19 12:01:31 PST 2005
http://perforce.freebsd.org/chv.cgi?CH=69317
Change 69317 by sam at sam_ebb on 2005/01/19 20:01:16
radiotap fixups:
o mark FCS presence on rx in the radiotap flags
o mark DATAPAD use instead of copying headers with padding
(and remove drek done to implement the copying)
Affected files ...
.. //depot/projects/wifi/sys/dev/ath/if_ath.c#71 edit
.. //depot/projects/wifi/sys/dev/ath/if_athvar.h#29 edit
Differences ...
==== //depot/projects/wifi/sys/dev/ath/if_ath.c#71 (text+ko) ====
@@ -3003,8 +3003,6 @@
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;
/*
@@ -3019,39 +3017,14 @@
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);
}
/*
@@ -3619,7 +3592,7 @@
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;
@@ -4609,9 +4582,13 @@
}
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)
@@ -5057,8 +5034,8 @@
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);
}
==== //depot/projects/wifi/sys/dev/ath/if_athvar.h#29 (text+ko) ====
@@ -216,7 +216,8 @@
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 */
@@ -246,13 +247,10 @@
} 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 */
@@ -295,9 +293,7 @@
};
#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), \
More information about the p4-projects
mailing list