svn commit: r190532 - in head/sys: dev/ral dev/usb/wlan net80211

Sam Leffler sam at FreeBSD.org
Sun Mar 29 14:17:10 PDT 2009


Author: sam
Date: Sun Mar 29 21:17:08 2009
New Revision: 190532
URL: http://svn.freebsd.org/changeset/base/190532

Log:
  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

Modified:
  head/sys/dev/ral/rt2560.c
  head/sys/dev/ral/rt2560var.h
  head/sys/dev/ral/rt2661.c
  head/sys/dev/ral/rt2661var.h
  head/sys/dev/usb/wlan/if_rum.c
  head/sys/dev/usb/wlan/if_rumvar.h
  head/sys/dev/usb/wlan/if_ural.c
  head/sys/dev/usb/wlan/if_uralvar.h
  head/sys/dev/usb/wlan/usb_wlan.h
  head/sys/net80211/ieee80211.c
  head/sys/net80211/ieee80211_ioctl.c
  head/sys/net80211/ieee80211_node.c
  head/sys/net80211/ieee80211_scan.c
  head/sys/net80211/ieee80211_superg.c
  head/sys/net80211/ieee80211_var.h

Modified: head/sys/dev/ral/rt2560.c
==============================================================================
--- head/sys/dev/ral/rt2560.c	Sun Mar 29 21:08:48 2009	(r190531)
+++ head/sys/dev/ral/rt2560.c	Sun Mar 29 21:17:08 2009	(r190532)
@@ -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
 	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, s
 	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, 
 		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, 
 	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,
 	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

Modified: head/sys/dev/ral/rt2560var.h
==============================================================================
--- head/sys/dev/ral/rt2560var.h	Sun Mar 29 21:08:48 2009	(r190531)
+++ head/sys/dev/ral/rt2560var.h	Sun Mar 29 21:17:08 2009	(r190532)
@@ -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
  * ------------------------------------------------

Modified: head/sys/dev/ral/rt2661.c
==============================================================================
--- head/sys/dev/ral/rt2661.c	Sun Mar 29 21:08:48 2009	(r190531)
+++ head/sys/dev/ral/rt2661.c	Sun Mar 29 21:17:08 2009	(r190532)
@@ -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
 	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, s
 	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,
 	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, 
 		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, 
 	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,
 	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;
 

Modified: head/sys/dev/ral/rt2661var.h
==============================================================================
--- head/sys/dev/ral/rt2661var.h	Sun Mar 29 21:08:48 2009	(r190531)
+++ head/sys/dev/ral/rt2661var.h	Sun Mar 29 21:17:08 2009	(r190532)
@@ -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
  * ------------------------------------------------

Modified: head/sys/dev/usb/wlan/if_rum.c
==============================================================================
--- head/sys/dev/usb/wlan/if_rum.c	Sun Mar 29 21:08:48 2009	(r190531)
+++ head/sys/dev/usb/wlan/if_rum.c	Sun Mar 29 21:17:08 2009	(r190532)
@@ -527,8 +527,6 @@ rum_attach_post(struct usb2_proc_msg *pm
 	ic->ic_vap_create = rum_vap_create;
 	ic->ic_vap_delete = rum_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));
 
@@ -1067,7 +1065,7 @@ rum_setup_tx_desc(struct rum_softc *sc, 
 	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(RT2573_TX_OFDM);
 
 		plcp_length = len & 0xfff;
@@ -1106,16 +1104,16 @@ rum_sendprot(struct rum_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 = RT2573_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 |= RT2573_TX_NEED_ACK;
 		mprot = ieee80211_alloc_rts(ic, wh->i_addr1, wh->i_addr2, dur);
 	} else {
@@ -1174,7 +1172,7 @@ rum_tx_mgt(struct rum_softc *sc, struct 
 	if (!IEEE80211_IS_MULTICAST(wh->i_addr1)) {
 		flags |= RT2573_TX_NEED_ACK;
 
-		dur = ieee80211_ack_duration(sc->sc_rates, tp->mgmtrate, 
+		dur = ieee80211_ack_duration(ic->ic_rt, tp->mgmtrate, 
 		    ic->ic_flags & IEEE80211_F_SHPREAMBLE);
 		*(uint16_t *)wh->i_dur = htole16(dur);
 
@@ -1294,7 +1292,7 @@ rum_tx_data(struct rum_softc *sc, struct
 		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 = rum_sendprot(sc, m0, ni, prot, rate);
@@ -1318,7 +1316,7 @@ rum_tx_data(struct rum_softc *sc, struct
 		flags |= RT2573_TX_NEED_ACK;
 		flags |= RT2573_TX_MORE_FRAG;
 
-		dur = ieee80211_ack_duration(sc->sc_rates, rate, 
+		dur = ieee80211_ack_duration(ic->ic_rt, rate, 
 		    ic->ic_flags & IEEE80211_F_SHPREAMBLE);
 		*(uint16_t *)wh->i_dur = htole16(dur);
 	}
@@ -2367,7 +2365,6 @@ rum_set_channel(struct ieee80211com *ic)
 	RUM_LOCK(sc);
 	/* do it in a process context */
 	sc->sc_scan_action = RUM_SET_CHANNEL;
-	sc->sc_rates = ieee80211_get_ratetable(ic->ic_curchan);
 	rum_queue_command(sc, rum_scantask,
 	    &sc->sc_scantask[0].hdr, &sc->sc_scantask[1].hdr);
 	RUM_UNLOCK(sc);

Modified: head/sys/dev/usb/wlan/if_rumvar.h
==============================================================================
--- head/sys/dev/usb/wlan/if_rumvar.h	Sun Mar 29 21:08:48 2009	(r190531)
+++ head/sys/dev/usb/wlan/if_rumvar.h	Sun Mar 29 21:17:08 2009	(r190532)
@@ -101,7 +101,6 @@ struct rum_softc {
 	struct usb2_device		*sc_udev;
 	struct usb2_process		sc_tq;
 
-	const struct ieee80211_rate_table *sc_rates;
 	struct usb2_xfer		*sc_xfer[RUM_N_TRANSFER];
 	struct rum_task			*sc_last_task;
 

Modified: head/sys/dev/usb/wlan/if_ural.c
==============================================================================
--- head/sys/dev/usb/wlan/if_ural.c	Sun Mar 29 21:08:48 2009	(r190531)
+++ head/sys/dev/usb/wlan/if_ural.c	Sun Mar 29 21:17:08 2009	(r190532)
@@ -518,8 +518,6 @@ ural_attach_post(struct usb2_proc_msg *p
 	ic->ic_vap_create = ural_vap_create;
 	ic->ic_vap_delete = ural_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));
 
@@ -1108,7 +1106,7 @@ ural_setup_tx_desc(struct ural_softc *sc
 	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(RAL_TX_OFDM);
 
 		plcp_length = len & 0xfff;
@@ -1209,7 +1207,7 @@ ural_tx_mgt(struct ural_softc *sc, struc
 	if (!IEEE80211_IS_MULTICAST(wh->i_addr1)) {
 		flags |= RAL_TX_ACK;
 
-		dur = ieee80211_ack_duration(sc->sc_rates, tp->mgmtrate, 
+		dur = ieee80211_ack_duration(ic->ic_rt, tp->mgmtrate, 
 		    ic->ic_flags & IEEE80211_F_SHPREAMBLE);
 		*(uint16_t *)wh->i_dur = htole16(dur);
 
@@ -1249,16 +1247,16 @@ ural_sendprot(struct ural_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 = RAL_TX_RETRY(7);
 	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 |= RAL_TX_ACK;
 		mprot = ieee80211_alloc_rts(ic, wh->i_addr1, wh->i_addr2, dur);
 	} else {
@@ -1376,7 +1374,7 @@ ural_tx_data(struct ural_softc *sc, stru
 		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 = ural_sendprot(sc, m0, ni, prot, rate);
@@ -1400,7 +1398,7 @@ ural_tx_data(struct ural_softc *sc, stru
 		flags |= RAL_TX_ACK;
 		flags |= RAL_TX_RETRY(7);
 
-		dur = ieee80211_ack_duration(sc->sc_rates, rate, 
+		dur = ieee80211_ack_duration(ic->ic_rt, rate, 
 		    ic->ic_flags & IEEE80211_F_SHPREAMBLE);
 		*(uint16_t *)wh->i_dur = htole16(dur);
 	}
@@ -1742,8 +1740,6 @@ ural_set_channel(struct ieee80211com *ic
 	sc->sc_scan_action = URAL_SET_CHANNEL;
 	ural_queue_command(sc, ural_scantask,
 	    &sc->sc_scantask[0].hdr, &sc->sc_scantask[1].hdr);
-
-	sc->sc_rates = ieee80211_get_ratetable(ic->ic_curchan);
 	RAL_UNLOCK(sc);
 }
 

Modified: head/sys/dev/usb/wlan/if_uralvar.h
==============================================================================
--- head/sys/dev/usb/wlan/if_uralvar.h	Sun Mar 29 21:08:48 2009	(r190531)
+++ head/sys/dev/usb/wlan/if_uralvar.h	Sun Mar 29 21:17:08 2009	(r190532)
@@ -106,8 +106,6 @@ struct ural_softc {
 	struct usb2_device		*sc_udev;
 	struct usb2_process		sc_tq;
 
-	const struct ieee80211_rate_table *sc_rates;
-
 	uint32_t			asic_rev;
 	uint8_t				rf_rev;
 

Modified: head/sys/dev/usb/wlan/usb_wlan.h
==============================================================================
--- head/sys/dev/usb/wlan/usb_wlan.h	Sun Mar 29 21:08:48 2009	(r190531)
+++ head/sys/dev/usb/wlan/usb_wlan.h	Sun Mar 29 21:17:08 2009	(r190532)
@@ -46,7 +46,6 @@
 #include <net80211/ieee80211_radiotap.h>
 #include <net80211/ieee80211_amrr.h>
 #include <net80211/ieee80211_regdomain.h>
-#include <net80211/ieee80211_phy.h>
 
 #include <netinet/in.h>
 #include <netinet/in_systm.h>

Modified: head/sys/net80211/ieee80211.c
==============================================================================
--- head/sys/net80211/ieee80211.c	Sun Mar 29 21:08:48 2009	(r190531)
+++ head/sys/net80211/ieee80211.c	Sun Mar 29 21:17:08 2009	(r190532)
@@ -186,6 +186,7 @@ ieee80211_chan_init(struct ieee80211com 
 	ic->ic_csa_newchan = NULL;
 	/* arbitrarily pick the first channel */
 	ic->ic_curchan = &ic->ic_channels[0];
+	ic->ic_rt = ieee80211_get_ratetable(ic->ic_curchan);
 
 	/* fillin well-known rate sets if driver has not specified */
 	DEFAULTRATES(IEEE80211_MODE_11B,	 ieee80211_rateset_11b);

Modified: head/sys/net80211/ieee80211_ioctl.c
==============================================================================
--- head/sys/net80211/ieee80211_ioctl.c	Sun Mar 29 21:08:48 2009	(r190531)
+++ head/sys/net80211/ieee80211_ioctl.c	Sun Mar 29 21:17:08 2009	(r190532)
@@ -1871,6 +1871,7 @@ setcurchan(struct ieee80211vap *vap, str
 			vap->iv_bss->ni_chan = ic->ic_curchan;
 		} else
 			ic->ic_curchan = vap->iv_des_chan;
+			ic->ic_rt = ieee80211_get_ratetable(ic->ic_curchan);
 	} else {
 		/*
 		 * Need to go through the state machine in case we
@@ -1886,6 +1887,7 @@ setcurchan(struct ieee80211vap *vap, str
 			 * there is immediate feedback; e.g. via ifconfig.
 			 */
 			ic->ic_curchan = vap->iv_des_chan;
+			ic->ic_rt = ieee80211_get_ratetable(ic->ic_curchan);
 		}
 	}
 	return error;

Modified: head/sys/net80211/ieee80211_node.c
==============================================================================
--- head/sys/net80211/ieee80211_node.c	Sun Mar 29 21:08:48 2009	(r190531)
+++ head/sys/net80211/ieee80211_node.c	Sun Mar 29 21:17:08 2009	(r190532)
@@ -627,6 +627,7 @@ ieee80211_sync_curchan(struct ieee80211c
 	if (c != ic->ic_curchan) {
 		ic->ic_curchan = c;
 		ic->ic_curmode = ieee80211_chan2mode(ic->ic_curchan);
+		ic->ic_rt = ieee80211_get_ratetable(ic->ic_curchan);
 		ic->ic_set_channel(ic);
 	}
 }
@@ -651,6 +652,7 @@ ieee80211_setcurchan(struct ieee80211com
 	}
 	ic->ic_bsschan = ic->ic_curchan = c;
 	ic->ic_curmode = ieee80211_chan2mode(ic->ic_curchan);
+	ic->ic_rt = ieee80211_get_ratetable(ic->ic_curchan);
 	ic->ic_set_channel(ic);
 }
 

Modified: head/sys/net80211/ieee80211_scan.c
==============================================================================
--- head/sys/net80211/ieee80211_scan.c	Sun Mar 29 21:08:48 2009	(r190531)
+++ head/sys/net80211/ieee80211_scan.c	Sun Mar 29 21:17:08 2009	(r190532)
@@ -298,6 +298,7 @@ change_channel(struct ieee80211com *ic,
 	struct ieee80211_channel *chan)
 {
 	ic->ic_curchan = chan;
+	ic->ic_rt = ieee80211_get_ratetable(chan);
 	ic->ic_set_channel(ic);
 }
 

Modified: head/sys/net80211/ieee80211_superg.c
==============================================================================
--- head/sys/net80211/ieee80211_superg.c	Sun Mar 29 21:08:48 2009	(r190531)
+++ head/sys/net80211/ieee80211_superg.c	Sun Mar 29 21:17:08 2009	(r190532)
@@ -490,6 +490,7 @@ ieee80211_dturbo_switch(struct ieee80211
 	ic->ic_bsschan = chan;
 	ic->ic_prevchan = ic->ic_curchan;
 	ic->ic_curchan = chan;
+	ic->ic_rt = ieee80211_get_ratetable(chan);
 	ic->ic_set_channel(ic);
 	/* NB: do not need to reset ERP state 'cuz we're in sta mode */
 }

Modified: head/sys/net80211/ieee80211_var.h
==============================================================================
--- head/sys/net80211/ieee80211_var.h	Sun Mar 29 21:08:48 2009	(r190531)
+++ head/sys/net80211/ieee80211_var.h	Sun Mar 29 21:17:08 2009	(r190532)
@@ -47,6 +47,7 @@
 #include <net80211/ieee80211_crypto.h>
 #include <net80211/ieee80211_dfs.h>
 #include <net80211/ieee80211_ioctl.h>		/* for ieee80211_stats */
+#include <net80211/ieee80211_phy.h>
 #include <net80211/ieee80211_power.h>
 #include <net80211/ieee80211_node.h>
 #include <net80211/ieee80211_proto.h>
@@ -161,6 +162,7 @@ struct ieee80211com {
 	uint8_t			ic_chan_active[IEEE80211_CHAN_BYTES];
 	uint8_t			ic_chan_scan[IEEE80211_CHAN_BYTES];
 	struct ieee80211_channel *ic_curchan;	/* current channel */
+	const struct ieee80211_rate_table *ic_rt; /* table for ic_curchan */
 	struct ieee80211_channel *ic_bsschan;	/* bss channel */
 	struct ieee80211_channel *ic_prevchan;	/* previous channel */
 	struct ieee80211_regdomain ic_regdomain;/* regulatory data */


More information about the svn-src-head mailing list