diff options
author | sam <sam@FreeBSD.org> | 2009-03-29 21:17:08 +0000 |
---|---|---|
committer | sam <sam@FreeBSD.org> | 2009-03-29 21:17:08 +0000 |
commit | f7c50ce1e4a47dd26c6dc6d42d8a07343e9d020b (patch) | |
tree | 3adee507d18d3410de7636b1c9fdf73932df5b00 /sys/dev/ral | |
parent | 616f4bd2e5f839f51b2cfd6f131a31b7d81e837c (diff) | |
download | FreeBSD-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')
-rw-r--r-- | sys/dev/ral/rt2560.c | 21 | ||||
-rw-r--r-- | sys/dev/ral/rt2560var.h | 2 | ||||
-rw-r--r-- | sys/dev/ral/rt2661.c | 23 | ||||
-rw-r--r-- | sys/dev/ral/rt2661var.h | 2 |
4 files changed, 18 insertions, 30 deletions
diff --git a/sys/dev/ral/rt2560.c b/sys/dev/ral/rt2560.c index d9378fa3..238643c 100644 --- a/sys/dev/ral/rt2560.c +++ b/sys/dev/ral/rt2560.c @@ -52,7 +52,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> @@ -1477,7 +1476,7 @@ rt2560_setup_tx_desc(struct rt2560_softc *sc, struct rt2560_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(RT2560_TX_OFDM); plcp_length = len & 0xfff; @@ -1622,7 +1621,7 @@ rt2560_tx_mgt(struct rt2560_softc *sc, struct mbuf *m0, if (!IEEE80211_IS_MULTICAST(wh->i_addr1)) { flags |= RT2560_TX_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); @@ -1672,16 +1671,16 @@ rt2560_sendprot(struct rt2560_softc *sc, 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 = RT2560_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 |= RT2560_TX_ACK; mprot = ieee80211_alloc_rts(ic, wh->i_addr1, wh->i_addr2, dur); } else { @@ -1852,7 +1851,7 @@ rt2560_tx_data(struct rt2560_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 = rt2560_sendprot(sc, m0, ni, prot, rate); @@ -1922,7 +1921,7 @@ rt2560_tx_data(struct rt2560_softc *sc, struct mbuf *m0, if (!IEEE80211_IS_MULTICAST(wh->i_addr1)) { flags |= RT2560_TX_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); } @@ -2146,8 +2145,6 @@ rt2560_set_chan(struct rt2560_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); - if (IEEE80211_IS_CHAN_2GHZ(c)) power = min(sc->txpow[chan - 1], 31); else diff --git a/sys/dev/ral/rt2560var.h b/sys/dev/ral/rt2560var.h index 0841444..d53c0d1 100644 --- a/sys/dev/ral/rt2560var.h +++ b/sys/dev/ral/rt2560var.h @@ -122,8 +122,6 @@ struct rt2560_softc { int sc_tx_timer; int sc_invalid; int sc_debug; - - const struct ieee80211_rate_table *sc_rates; /* * The same in both up to here * ------------------------------------------------ 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; diff --git a/sys/dev/ral/rt2661var.h b/sys/dev/ral/rt2661var.h index 0c15840..6fc958a 100644 --- a/sys/dev/ral/rt2661var.h +++ b/sys/dev/ral/rt2661var.h @@ -114,8 +114,6 @@ struct rt2661_softc { int sc_tx_timer; int sc_invalid; int sc_debug; - - const struct ieee80211_rate_table *sc_rates; /* * The same in both up to here * ------------------------------------------------ |