summaryrefslogtreecommitdiffstats
path: root/sys/dev/ral/rt2661.c
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2009-03-29 21:17:08 +0000
committersam <sam@FreeBSD.org>2009-03-29 21:17:08 +0000
commitf7c50ce1e4a47dd26c6dc6d42d8a07343e9d020b (patch)
tree3adee507d18d3410de7636b1c9fdf73932df5b00 /sys/dev/ral/rt2661.c
parent616f4bd2e5f839f51b2cfd6f131a31b7d81e837c (diff)
downloadFreeBSD-src-f7c50ce1e4a47dd26c6dc6d42d8a07343e9d020b.zip
FreeBSD-src-f7c50ce1e4a47dd26c6dc6d42d8a07343e9d020b.tar.gz
o add ic_rt to track the rate table for the current channel; this enables
calculation of packet transmit times to do things like check txop limits o remove equivalent driver code and convert to use net80211 state
Diffstat (limited to 'sys/dev/ral/rt2661.c')
-rw-r--r--sys/dev/ral/rt2661.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/sys/dev/ral/rt2661.c b/sys/dev/ral/rt2661.c
index 3ceeb46..dac8a23 100644
--- a/sys/dev/ral/rt2661.c
+++ b/sys/dev/ral/rt2661.c
@@ -53,7 +53,6 @@ __FBSDID("$FreeBSD$");
#include <net/if_types.h>
#include <net80211/ieee80211_var.h>
-#include <net80211/ieee80211_phy.h>
#include <net80211/ieee80211_radiotap.h>
#include <net80211/ieee80211_regdomain.h>
#include <net80211/ieee80211_amrr.h>
@@ -320,8 +319,6 @@ rt2661_attach(device_t dev, int id)
ic->ic_vap_create = rt2661_vap_create;
ic->ic_vap_delete = rt2661_vap_delete;
- sc->sc_rates = ieee80211_get_ratetable(ic->ic_curchan);
-
bpfattach(ifp, DLT_IEEE802_11_RADIO,
sizeof (struct ieee80211_frame) + sizeof (sc->sc_txtap));
@@ -1302,7 +1299,7 @@ rt2661_setup_tx_desc(struct rt2661_softc *sc, struct rt2661_tx_desc *desc,
desc->plcp_service = 4;
len += IEEE80211_CRC_LEN;
- if (ieee80211_rate2phytype(sc->sc_rates, rate) == IEEE80211_T_OFDM) {
+ if (ieee80211_rate2phytype(ic->ic_rt, rate) == IEEE80211_T_OFDM) {
desc->flags |= htole32(RT2661_TX_OFDM);
plcp_length = len & 0xfff;
@@ -1388,7 +1385,7 @@ rt2661_tx_mgt(struct rt2661_softc *sc, struct mbuf *m0,
if (!IEEE80211_IS_MULTICAST(wh->i_addr1)) {
flags |= RT2661_TX_NEED_ACK;
- dur = ieee80211_ack_duration(sc->sc_rates,
+ dur = ieee80211_ack_duration(ic->ic_rt,
rate, ic->ic_flags & IEEE80211_F_SHPREAMBLE);
*(uint16_t *)wh->i_dur = htole16(dur);
@@ -1438,16 +1435,16 @@ rt2661_sendprot(struct rt2661_softc *sc, int ac,
wh = mtod(m, const struct ieee80211_frame *);
pktlen = m->m_pkthdr.len + IEEE80211_CRC_LEN;
- protrate = ieee80211_ctl_rate(sc->sc_rates, rate);
- ackrate = ieee80211_ack_rate(sc->sc_rates, rate);
+ protrate = ieee80211_ctl_rate(ic->ic_rt, rate);
+ ackrate = ieee80211_ack_rate(ic->ic_rt, rate);
isshort = (ic->ic_flags & IEEE80211_F_SHPREAMBLE) != 0;
- dur = ieee80211_compute_duration(sc->sc_rates, pktlen, rate, isshort)
- + ieee80211_ack_duration(sc->sc_rates, rate, isshort);
+ dur = ieee80211_compute_duration(ic->ic_rt, pktlen, rate, isshort)
+ + ieee80211_ack_duration(ic->ic_rt, rate, isshort);
flags = RT2661_TX_MORE_FRAG;
if (prot == IEEE80211_PROT_RTSCTS) {
/* NB: CTS is the same size as an ACK */
- dur += ieee80211_ack_duration(sc->sc_rates, rate, isshort);
+ dur += ieee80211_ack_duration(ic->ic_rt, rate, isshort);
flags |= RT2661_TX_NEED_ACK;
mprot = ieee80211_alloc_rts(ic, wh->i_addr1, wh->i_addr2, dur);
} else {
@@ -1544,7 +1541,7 @@ rt2661_tx_data(struct rt2661_softc *sc, struct mbuf *m0,
if (m0->m_pkthdr.len + IEEE80211_CRC_LEN > vap->iv_rtsthreshold)
prot = IEEE80211_PROT_RTSCTS;
else if ((ic->ic_flags & IEEE80211_F_USEPROT) &&
- ieee80211_rate2phytype(sc->sc_rates, rate) == IEEE80211_T_OFDM)
+ ieee80211_rate2phytype(ic->ic_rt, rate) == IEEE80211_T_OFDM)
prot = ic->ic_protmode;
if (prot != IEEE80211_PROT_NONE) {
error = rt2661_sendprot(sc, ac, m0, ni, prot, rate);
@@ -1615,7 +1612,7 @@ rt2661_tx_data(struct rt2661_softc *sc, struct mbuf *m0,
if (!noack && !IEEE80211_IS_MULTICAST(wh->i_addr1)) {
flags |= RT2661_TX_NEED_ACK;
- dur = ieee80211_ack_duration(sc->sc_rates,
+ dur = ieee80211_ack_duration(ic->ic_rt,
rate, ic->ic_flags & IEEE80211_F_SHPREAMBLE);
*(uint16_t *)wh->i_dur = htole16(dur);
}
@@ -2041,8 +2038,6 @@ rt2661_set_chan(struct rt2661_softc *sc, struct ieee80211_channel *c)
chan = ieee80211_chan2ieee(ic, c);
KASSERT(chan != 0 && chan != IEEE80211_CHAN_ANY, ("chan 0x%x", chan));
- sc->sc_rates = ieee80211_get_ratetable(c);
-
/* select the appropriate RF settings based on what EEPROM says */
rfprog = (sc->rfprog == 0) ? rt2661_rf5225_1 : rt2661_rf5225_2;
OpenPOWER on IntegriCloud