Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Jul 2005 21:42:54 GMT
From:      Sam Leffler <sam@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 80299 for review
Message-ID:  <200507152142.j6FLgsYf035067@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=80299

Change 80299 by sam@sam_ebb on 2005/07/15 21:42:34

	Bring in non-vap changes from vap work:
	o redo channel handling
	o change fixed rate from index to ieee rate code so it's
	  mode-independent
	Also prepare ath for new hal.

Affected files ...

.. //depot/projects/wifi/sys/dev/ath/ath_rate/amrr/amrr.c#13 edit
.. //depot/projects/wifi/sys/dev/ath/ath_rate/onoe/onoe.c#13 edit
.. //depot/projects/wifi/sys/dev/ath/ath_rate/sample/sample.c#5 edit
.. //depot/projects/wifi/sys/dev/ath/if_ath.c#86 edit
.. //depot/projects/wifi/sys/dev/ath/if_athvar.h#36 edit
.. //depot/projects/wifi/sys/dev/awi/awi.c#9 edit
.. //depot/projects/wifi/sys/dev/ipw/if_ipw.c#5 edit
.. //depot/projects/wifi/sys/dev/iwi/if_iwi.c#7 edit
.. //depot/projects/wifi/sys/dev/ral/if_ral.c#4 edit
.. //depot/projects/wifi/sys/dev/usb/if_ural.c#4 edit
.. //depot/projects/wifi/sys/dev/wi/if_wi.c#17 edit
.. //depot/projects/wifi/sys/net80211/_ieee80211.h#6 edit
.. //depot/projects/wifi/sys/net80211/ieee80211.c#23 edit
.. //depot/projects/wifi/sys/net80211/ieee80211_input.c#52 edit
.. //depot/projects/wifi/sys/net80211/ieee80211_ioctl.c#39 edit
.. //depot/projects/wifi/sys/net80211/ieee80211_node.c#53 edit
.. //depot/projects/wifi/sys/net80211/ieee80211_output.c#43 edit
.. //depot/projects/wifi/sys/net80211/ieee80211_proto.c#27 edit
.. //depot/projects/wifi/sys/net80211/ieee80211_var.h#27 edit

Differences ...

==== //depot/projects/wifi/sys/dev/ath/ath_rate/amrr/amrr.c#13 (text+ko) ====

@@ -284,7 +284,7 @@
 	int srate;
 
 	KASSERT(ni->ni_rates.rs_nrates > 0, ("no rates"));
-	if (ic->ic_fixed_rate == -1) {
+	if (ic->ic_fixed_rate == IEEE80211_FIXED_RATE_NONE) {
 		/*
 		 * No fixed rate is requested. For 11b start with
 		 * the highest negotiated rate; otherwise, for 11g
@@ -303,18 +303,15 @@
 		}
 	} else {
 		/*
-		 * A fixed rate is to be used; ic_fixed_rate is an
-		 * index into the supported rate set.  Convert this
+		 * A fixed rate is to be used; ic_fixed_rate is the
+		 * IEEE code for this rate (sans basic bit).  Convert this
 		 * to the index into the negotiated rate set for
 		 * the node.  We know the rate is there because the
 		 * rate set is checked when the station associates.
 		 */
-		const struct ieee80211_rateset *rs =
-			&ic->ic_sup_rates[ic->ic_curmode];
-		int r = rs->rs_rates[ic->ic_fixed_rate] & IEEE80211_RATE_VAL;
 		/* NB: the rate set is assumed sorted */
 		srate = ni->ni_rates.rs_nrates - 1;
-		for (; srate >= 0 && RATE(srate) != r; srate--)
+		for (; srate >= 0 && RATE(srate) != ic->ic_fixed_rate; srate--)
 			;
 		KASSERT(srate >= 0,
 			("fixed rate %d not in rate set", ic->ic_fixed_rate));
@@ -366,7 +363,8 @@
 		ieee80211_iterate_nodes(&ic->ic_sta, ath_rate_cb, sc);
 		ath_rate_update(sc, ic->ic_bss, 0);
 	}
-	if (ic->ic_fixed_rate == -1 && state == IEEE80211_S_RUN) {
+	if (ic->ic_fixed_rate == IEEE80211_FIXED_RATE_NONE &&
+	    state == IEEE80211_S_RUN) {
 		int interval;
 		/*
 		 * Start the background rate control thread if we

==== //depot/projects/wifi/sys/dev/ath/ath_rate/onoe/onoe.c#13 (text+ko) ====

@@ -268,7 +268,7 @@
 	int srate;
 
 	KASSERT(ni->ni_rates.rs_nrates > 0, ("no rates"));
-	if (ic->ic_fixed_rate == -1) {
+	if (ic->ic_fixed_rate == IEEE80211_FIXED_RATE_NONE) {
 		/*
 		 * No fixed rate is requested. For 11b start with
 		 * the highest negotiated rate; otherwise, for 11g
@@ -287,18 +287,15 @@
 		}
 	} else {
 		/*
-		 * A fixed rate is to be used; ic_fixed_rate is an
-		 * index into the supported rate set.  Convert this
+		 * A fixed rate is to be used; ic_fixed_rate is the
+		 * IEEE code for this rate (sans basic bit).  Convert this
 		 * to the index into the negotiated rate set for
 		 * the node.  We know the rate is there because the
 		 * rate set is checked when the station associates.
 		 */
-		const struct ieee80211_rateset *rs =
-			&ic->ic_sup_rates[ic->ic_curmode];
-		int r = rs->rs_rates[ic->ic_fixed_rate] & IEEE80211_RATE_VAL;
 		/* NB: the rate set is assumed sorted */
 		srate = ni->ni_rates.rs_nrates - 1;
-		for (; srate >= 0 && RATE(srate) != r; srate--)
+		for (; srate >= 0 && RATE(srate) != ic->ic_fixed_rate; srate--)
 			;
 		KASSERT(srate >= 0,
 			("fixed rate %d not in rate set", ic->ic_fixed_rate));
@@ -350,7 +347,8 @@
 		ieee80211_iterate_nodes(&ic->ic_sta, ath_rate_cb, sc);
 		ath_rate_update(sc, ic->ic_bss, 0);
 	}
-	if (ic->ic_fixed_rate == -1 && state == IEEE80211_S_RUN) {
+	if (ic->ic_fixed_rate == IEEE80211_FIXED_RATE_NONE &&
+	    state == IEEE80211_S_RUN) {
 		int interval;
 		/*
 		 * Start the background rate control thread if we

==== //depot/projects/wifi/sys/dev/ath/ath_rate/sample/sample.c#5 (text+ko) ====

@@ -685,20 +685,17 @@
 
 	KASSERT(rt != NULL, ("no rate table, mode %u", sc->sc_curmode));
         sn->static_rate_ndx = -1;
-	if (ic->ic_fixed_rate != -1) {
+	if (ic->ic_fixed_rate != IEEE80211_FIXED_RATE_NONE) {
 		/*
-		 * A fixed rate is to be used; ic_fixed_rate is an
-		 * index into the supported rate set.  Convert this
+		 * A fixed rate is to be used; ic_fixed_rate is the
+		 * IEEE code for this rate (sans basic bit).  Convert this
 		 * to the index into the negotiated rate set for
 		 * the node.  We know the rate is there because the
 		 * rate set is checked when the station associates.
 		 */
-		const struct ieee80211_rateset *rs =
-			&ic->ic_sup_rates[ic->ic_curmode];
-		int r = rs->rs_rates[ic->ic_fixed_rate] & IEEE80211_RATE_VAL;
 		/* NB: the rate set is assumed sorted */
 		srate = ni->ni_rates.rs_nrates - 1;
-		for (; srate >= 0 && RATE(srate) != r; srate--)
+		for (; srate >= 0 && RATE(srate) != ic->ic_fixed_rate; srate--)
 			;
 		KASSERT(srate >= 0,
 			("fixed rate %d not in rate set", ic->ic_fixed_rate));

==== //depot/projects/wifi/sys/dev/ath/if_ath.c#86 (text+ko) ====

@@ -785,8 +785,7 @@
 			 * Let the hal handle the event.  We assume it will
 			 * clear whatever condition caused the interrupt.
 			 */
-			ath_hal_mibevent(ah,
-				&ATH_NODE(sc->sc_ic.ic_bss)->an_halstats);
+			ath_hal_mibevent(ah, &sc->sc_halstats);
 			ath_hal_intrset(ah, sc->sc_imask);
 		}
 	}
@@ -835,7 +834,7 @@
 }
 
 static u_int
-ath_chan2flags(struct ieee80211com *ic, struct ieee80211_channel *chan)
+ath_chan2flags(struct ieee80211_channel *chan)
 {
 #define	N(a)	(sizeof(a) / sizeof(a[0]))
 	static const u_int modeflags[] = {
@@ -847,7 +846,7 @@
 		CHANNEL_T,		/* IEEE80211_MODE_TURBO_A */
 		CHANNEL_108G		/* IEEE80211_MODE_TURBO_G */
 	};
-	enum ieee80211_phymode mode = ieee80211_chan2mode(ic, chan);
+	enum ieee80211_phymode mode = ieee80211_chan2mode(chan);
 
 	KASSERT(mode < N(modeflags), ("unexpected phy mode %u", mode));
 	KASSERT(modeflags[mode] != 0, ("mode %u undefined", mode));
@@ -861,7 +860,6 @@
 	struct ath_softc *sc = (struct ath_softc *) arg;
 	struct ieee80211com *ic = &sc->sc_ic;
 	struct ifnet *ifp = sc->sc_ifp;
-	struct ieee80211_node *ni;
 	struct ath_hal *ah = sc->sc_ah;
 	HAL_STATUS status;
 
@@ -882,8 +880,8 @@
 	 * be followed by initialization of the appropriate bits
 	 * and then setup of the interrupt mask.
 	 */
-	sc->sc_curchan.channel = ic->ic_ibss_chan->ic_freq;
-	sc->sc_curchan.channelFlags = ath_chan2flags(ic, ic->ic_ibss_chan);
+	sc->sc_curchan.channel = ic->ic_curchan->ic_freq;
+	sc->sc_curchan.channelFlags = ath_chan2flags(ic->ic_curchan);
 	if (!ath_hal_reset(ah, ic->ic_opmode, &sc->sc_curchan, AH_FALSE, &status)) {
 		if_printf(ifp, "unable to reset hardware; hal status %u\n",
 			status);
@@ -930,9 +928,7 @@
 	 * to kick the 802.11 state machine as it's likely to
 	 * immediately call back to us to send mgmt frames.
 	 */
-	ni = ic->ic_bss;
-	ni->ni_chan = ic->ic_ibss_chan;
-	ath_chan_change(sc, ni->ni_chan);
+	ath_chan_change(sc, ic->ic_curchan);
 	if (ic->ic_opmode != IEEE80211_M_MONITOR) {
 		if (ic->ic_roaming != IEEE80211_ROAMING_MANUAL)
 			ieee80211_new_state(ic, IEEE80211_S_SCAN, -1);
@@ -1009,7 +1005,7 @@
 		 * (and system).  This varies by chip and is mostly an
 		 * issue with newer parts that go to sleep more quickly.
 		 */
-		ath_hal_setpower(sc->sc_ah, HAL_PM_FULL_SLEEP, 0);
+		ath_hal_setpower(sc->sc_ah, HAL_PM_FULL_SLEEP);
 	}
 	ATH_UNLOCK(sc);
 }
@@ -1034,9 +1030,9 @@
 	 * Convert to a HAL channel description with the flags
 	 * constrained to reflect the current operating mode.
 	 */
-	c = ic->ic_ibss_chan;
+	c = ic->ic_curchan;
 	sc->sc_curchan.channel = c->ic_freq;
-	sc->sc_curchan.channelFlags = ath_chan2flags(ic, c);
+	sc->sc_curchan.channelFlags = ath_chan2flags(c);
 
 	ath_hal_intrset(ah, 0);		/* disable interrupts */
 	ath_draintxq(sc);		/* stop xmit side */
@@ -3278,7 +3274,7 @@
 	} while (ath_rxbuf_init(sc, bf) == 0);
 
 	/* rx signal state monitoring */
-	ath_hal_rxmonitor(ah, &ATH_NODE(ic->ic_bss)->an_halstats);
+	ath_hal_rxmonitor(ah, &sc->sc_halstats, &sc->sc_curchan);
 
 	NET_UNLOCK_GIANT();		/* XXX */
 #undef PA2DESC
@@ -4394,7 +4390,6 @@
 static void
 ath_chan_change(struct ath_softc *sc, struct ieee80211_channel *chan)
 {
-	struct ieee80211com *ic = &sc->sc_ic;
 	enum ieee80211_phymode mode;
 	u_int16_t flags;
 
@@ -4402,7 +4397,7 @@
 	 * Change channels and update the h/w rate map
 	 * if we're switching; e.g. 11a to 11b/g.
 	 */
-	mode = ieee80211_chan2mode(ic, chan);
+	mode = ieee80211_chan2mode(chan);
 	if (mode != sc->sc_curmode)
 		ath_setcurmode(sc, mode);
 	/*
@@ -4411,13 +4406,11 @@
 	 */
 	if (IEEE80211_IS_CHAN_A(chan))
 		flags = IEEE80211_CHAN_A;
-	/* XXX 11g schizophrenia */
-	else if (IEEE80211_IS_CHAN_G(chan) ||
-	    IEEE80211_IS_CHAN_PUREG(chan))
+	else if (IEEE80211_IS_CHAN_ANYG(chan))
 		flags = IEEE80211_CHAN_G;
 	else
 		flags = IEEE80211_CHAN_B;
-	if (IEEE80211_IS_CHAN_T(chan))
+	if (IEEE80211_IS_CHAN_TURBO(chan))
 		flags |= IEEE80211_CHAN_TURBO;
 	sc->sc_tx_th.wt_chan_freq = sc->sc_rx_th.wr_chan_freq =
 		htole16(chan->ic_freq);
@@ -4444,14 +4437,15 @@
 	 * operating mode.
 	 */
 	hchan.channel = chan->ic_freq;
-	hchan.channelFlags = ath_chan2flags(ic, chan);
+	hchan.channelFlags = ath_chan2flags(chan);
 
 	DPRINTF(sc, ATH_DEBUG_RESET, "%s: %u (%u MHz) -> %u (%u MHz)\n",
 	    __func__,
-	    ath_hal_mhz2ieee(sc->sc_curchan.channel,
+	    ath_hal_mhz2ieee(ah, sc->sc_curchan.channel,
 		sc->sc_curchan.channelFlags),
 	    	sc->sc_curchan.channel,
-	    ath_hal_mhz2ieee(hchan.channel, hchan.channelFlags), hchan.channel);
+	    ath_hal_mhz2ieee(ah, hchan.channel, hchan.channelFlags),
+	        hchan.channel);
 	if (hchan.channel != sc->sc_curchan.channel ||
 	    hchan.channelFlags != sc->sc_curchan.channelFlags) {
 		HAL_STATUS status;
@@ -4487,7 +4481,6 @@
 		 * Change channels and update the h/w rate map
 		 * if we're switching; e.g. 11a to 11b/g.
 		 */
-		ic->ic_ibss_chan = chan;
 		ath_chan_change(sc, chan);
 
 		/*
@@ -4579,7 +4572,7 @@
 		goto done;
 	}
 	ni = ic->ic_bss;
-	error = ath_chan_set(sc, ni->ni_chan);
+	error = ath_chan_set(sc, ic->ic_curchan);
 	if (error != 0)
 		goto bad;
 	rfilt = ath_calcrxfilter(sc, nstate);
@@ -4618,7 +4611,7 @@
 			 , ni->ni_intval
 			 , ether_sprintf(ni->ni_bssid)
 			 , ni->ni_capinfo
-			 , ieee80211_chan2ieee(ic, ni->ni_chan));
+			 , ieee80211_chan2ieee(ic, ic->ic_curchan));
 
 		switch (ic->ic_opmode) {
 		case IEEE80211_M_HOSTAP:
@@ -4655,6 +4648,13 @@
 		 * Configure the beacon and sleep timers.
 		 */
 		ath_beacon_config(sc);
+
+		/*
+		 * Reset rssi stats; maybe not the best place...
+		 */
+		sc->sc_halstats.ns_avgbrssi = ATH_RSSI_DUMMY_MARKER;
+		sc->sc_halstats.ns_avgrssi = ATH_RSSI_DUMMY_MARKER;
+		sc->sc_halstats.ns_avgtxrssi = ATH_RSSI_DUMMY_MARKER;
 	} else {
 		ath_hal_intrset(ah,
 			sc->sc_imask &~ (HAL_INT_SWBA | HAL_INT_BMISS));
@@ -4739,7 +4739,7 @@
 	struct ifnet *ifp = sc->sc_ifp;
 	struct ath_hal *ah = sc->sc_ah;
 	HAL_CHANNEL *chans;
-	int i, ix, nchan;
+	int i, nchan;
 
 	chans = malloc(IEEE80211_CHAN_MAX * sizeof(HAL_CHANNEL),
 			M_TEMP, M_NOWAIT);
@@ -4748,6 +4748,7 @@
 		return ENOMEM;
 	}
 	if (!ath_hal_init_channels(ah, chans, IEEE80211_CHAN_MAX, &nchan,
+	    NULL, 0, NULL,
 	    cc, HAL_MODE_ALL, outdoor, xchanmode)) {
 		u_int32_t rd;
 
@@ -4759,26 +4760,20 @@
 	}
 
 	/*
-	 * Convert HAL channels to ieee80211 ones and insert
-	 * them in the table according to their channel number.
+	 * Convert HAL channels to ieee80211 ones.
 	 */
 	for (i = 0; i < nchan; i++) {
 		HAL_CHANNEL *c = &chans[i];
-		ix = ath_hal_mhz2ieee(c->channel, c->channelFlags);
-		if (ix > IEEE80211_CHAN_MAX) {
-			if_printf(ifp, "bad hal channel %u (%u/%x) ignored\n",
-				ix, c->channel, c->channelFlags);
-			continue;
-		}
-		/* NB: flags are known to be compatible */
-		if (ic->ic_channels[ix].ic_freq == 0) {
-			ic->ic_channels[ix].ic_freq = c->channel;
-			ic->ic_channels[ix].ic_flags = c->channelFlags;
-		} else {
-			/* channels overlap; e.g. 11g and 11b */
-			ic->ic_channels[ix].ic_flags |= c->channelFlags;
-		}
+		struct ieee80211_channel *ichan = &ic->ic_channels[i];
+
+		ichan->ic_ieee = ath_hal_mhz2ieee(ah, c->channel, c->channelFlags);
+		ichan->ic_freq = c->channel;
+		ichan->ic_flags = c->channelFlags;
+		ichan->ic_maxregpower = c->maxRegTxPower;	/* dBm */
+		ichan->ic_maxpower = c->maxTxPower / 4;		/* 1/4 dBm */
+		ichan->ic_minpower = c->minTxPower / 4;		/* 1/4 dBm */
 	}
+	ic->ic_nchans = nchan;
 	free(chans, M_TEMP);
 	return 0;
 }

==== //depot/projects/wifi/sys/dev/ath/if_athvar.h#36 (text+ko) ====

@@ -310,6 +310,7 @@
 
 	struct callout		sc_cal_ch;	/* callout handle for cals */
 	struct callout		sc_scan_ch;	/* callout handle for scan */
+	HAL_NODE_STATS		sc_halstats;	/* station-mode rssi stats */
 };
 #define	sc_tx_th		u_tx_rt.th
 #define	sc_rx_th		u_rx_rt.th
@@ -363,8 +364,8 @@
 	((*(_ah)->ah_getPendingInterrupts)((_ah), (_pmask)))
 #define	ath_hal_updatetxtriglevel(_ah, _inc) \
 	((*(_ah)->ah_updateTxTrigLevel)((_ah), (_inc)))
-#define	ath_hal_setpower(_ah, _mode, _sleepduration) \
-	((*(_ah)->ah_setPowerMode)((_ah), (_mode), AH_TRUE, (_sleepduration)))
+#define	ath_hal_setpower(_ah, _mode) \
+	((*(_ah)->ah_setPowerMode)((_ah), (_mode), AH_TRUE))
 #define	ath_hal_keycachesize(_ah) \
 	((*(_ah)->ah_getKeyCacheSize)((_ah)))
 #define	ath_hal_keyreset(_ah, _ix) \
@@ -448,8 +449,8 @@
 	((*(_ah)->ah_getDefAntenna)((_ah)))
 #define	ath_hal_setdefantenna(_ah, _ant) \
 	((*(_ah)->ah_setDefAntenna)((_ah), (_ant)))
-#define	ath_hal_rxmonitor(_ah, _arg) \
-	((*(_ah)->ah_rxMonitor)((_ah), (_arg)))
+#define	ath_hal_rxmonitor(_ah, _arg, _chan) \
+	((*(_ah)->ah_rxMonitor)((_ah), (_arg), (_chan)))
 #define	ath_hal_mibevent(_ah, _stats) \
 	((*(_ah)->ah_procMibEvent)((_ah), (_stats)))
 #define	ath_hal_setslottime(_ah, _us) \
@@ -532,7 +533,7 @@
 		_rtsrate, _rtsdura) \
 	((*(_ah)->ah_setupTxDesc)((_ah), (_ds), (_plen), (_hlen), (_atype), \
 		(_txpow), (_txr0), (_txtr0), (_keyix), (_ant), \
-		(_flags), (_rtsrate), (_rtsdura)))
+		(_flags), (_rtsrate), (_rtsdura), 0, 0, 0))
 #define	ath_hal_setupxtxdesc(_ah, _ds, \
 		_txr1, _txtr1, _txr2, _txtr2, _txr3, _txtr3) \
 	((*(_ah)->ah_setupXTxDesc)((_ah), (_ds), \

==== //depot/projects/wifi/sys/dev/awi/awi.c#9 (text+ko) ====

@@ -605,8 +605,8 @@
 		rs = &ic->ic_sup_rates[IEEE80211_MODE_FH];
 	else
 		rs = &ic->ic_sup_rates[IEEE80211_MODE_11B];
-	if (ic->ic_fixed_rate != -1) {
-		rate = rs->rs_rates[ic->ic_fixed_rate] & IEEE80211_RATE_VAL;
+	if (ic->ic_fixed_rate != IEEE80211_FIXED_RATE_NONE) {
+		rate = ic->ic_fixed_rate;
 	} else {
 		rate = 0;
 		for (i = 0; i < rs->rs_nrates; i++) {
@@ -1016,6 +1016,7 @@
 	ime = ic->ic_media.ifm_cur;
 	if (IFM_SUBTYPE(ime->ifm_media) == IFM_AUTO) {
 		i = -1;
+		rate = ic->ic_fixed_rate;
 	} else {
 		struct ieee80211_rateset *rs =
 		    &ic->ic_sup_rates[(ic->ic_phytype == IEEE80211_T_FH)
@@ -1030,8 +1031,8 @@
 		if (i == rs->rs_nrates)
 			return EINVAL;
 	}
-	if (ic->ic_fixed_rate != i) {
-		ic->ic_fixed_rate = i;
+	if (ic->ic_fixed_rate != rate) {
+		ic->ic_fixed_rate = rate;
 		error = ENETRESET;
 	}
 
@@ -1095,11 +1096,10 @@
 		rate = ic->ic_bss->ni_rates.rs_rates[ic->ic_bss->ni_txrate] &
 		    IEEE80211_RATE_VAL;
 	} else {
-		if (ic->ic_fixed_rate == -1)
+		if (ic->ic_fixed_rate == IEEE80211_FIXED_RATE_NONE)
 			rate = 0;
 		else
-			rate = ic->ic_sup_rates[mode].
-			    rs_rates[ic->ic_fixed_rate] & IEEE80211_RATE_VAL;
+			rate = ic->ic_fixed_rate;
 	}
 	imr->ifm_active |= ieee80211_rate2media(ic, rate, mode);
 	switch (ic->ic_opmode) {

==== //depot/projects/wifi/sys/dev/ipw/if_ipw.c#5 (text+ko) ====

@@ -216,6 +216,7 @@
 	struct ipw_softc *sc = device_get_softc(dev);
 	struct ifnet *ifp;
 	struct ieee80211com *ic = &sc->sc_ic;
+	struct ieee80211_channel *c;
 	uint16_t val;
 	int error, i;
 
@@ -311,9 +312,10 @@
 	val <<= 1;
 	for (i = 1; i < 16; i++) {
 		if (val & (1 << i)) {
-			ic->ic_channels[i].ic_freq =
-			    ieee80211_ieee2mhz(i, IEEE80211_CHAN_B);
-			ic->ic_channels[i].ic_flags = IEEE80211_CHAN_B;
+			c = &ic->ic_channels[ic->ic_nchans++];
+			c->ic_freq = ieee80211_ieee2mhz(i, IEEE80211_CHAN_2GHZ);
+			c->ic_flags = IEEE80211_CHAN_B;
+			c->ic_ieee = i;
 		}
 	}
 
@@ -1003,7 +1005,9 @@
 #if IEEE80211_CHAN_MAX < 255
 		if (frm[2] <= IEEE80211_CHAN_MAX)
 #endif
-			ic->ic_bss->ni_chan = &ic->ic_channels[frm[2]];
+			ic->ic_bsschan = ieee80211_find_channel(ic,
+				ieee80211_ieee2mhz(frm[2], 0),
+				IEEE80211_MODE_AUTO);
 
 		frm += frm[1] + 2;
 	}
@@ -1038,8 +1042,8 @@
 
 		tap->wr_flags = 0;
 		tap->wr_antsignal = status->rssi;
-		tap->wr_chan_freq = htole16(ic->ic_ibss_chan->ic_freq);
-		tap->wr_chan_flags = htole16(ic->ic_ibss_chan->ic_flags);
+		tap->wr_chan_freq = htole16(ic->ic_curchan->ic_freq);
+		tap->wr_chan_flags = htole16(ic->ic_curchan->ic_flags);
 
 		bpf_mtap2(sc->sc_drvbpf, tap, sc->sc_rxtap_len, m);
 	}
@@ -1335,8 +1339,8 @@
 		struct ipw_tx_radiotap_header *tap = &sc->sc_txtap;
 
 		tap->wt_flags = 0;
-		tap->wt_chan_freq = htole16(ic->ic_ibss_chan->ic_freq);
-		tap->wt_chan_flags = htole16(ic->ic_ibss_chan->ic_flags);
+		tap->wt_chan_freq = htole16(ic->ic_curchan->ic_freq);
+		tap->wt_chan_flags = htole16(ic->ic_curchan->ic_flags);
 
 		bpf_mtap2(sc->sc_drvbpf, tap, sc->sc_txtap_len, m0);
 	}
@@ -1851,7 +1855,7 @@
 
 	if (ic->ic_opmode == IEEE80211_M_IBSS ||
 	    ic->ic_opmode == IEEE80211_M_MONITOR) {
-		data = htole32(ieee80211_chan2ieee(ic, ic->ic_ibss_chan));
+		data = htole32(ieee80211_chan2ieee(ic, ic->ic_curchan));
 		DPRINTF(("Setting channel to %u\n", le32toh(data)));
 		error = ipw_cmd(sc, IPW_CMD_SET_CHANNEL, &data, sizeof data);
 		if (error != 0)

==== //depot/projects/wifi/sys/dev/iwi/if_iwi.c#7 (text+ko) ====

@@ -229,6 +229,7 @@
 	struct iwi_softc *sc = device_get_softc(dev);
 	struct ifnet *ifp;
 	struct ieee80211com *ic = &sc->sc_ic;
+	struct ieee80211_channel *c;
 	uint16_t val;
 	int error, i;
 
@@ -352,11 +353,12 @@
 
 	/* set supported .11b and .11g channels (1 through 14) */
 	for (i = 1; i <= 14; i++) {
-		ic->ic_channels[i].ic_freq =
-		    ieee80211_ieee2mhz(i, IEEE80211_CHAN_2GHZ);
-		ic->ic_channels[i].ic_flags =
+		c = &ic->ic_channels[ic->ic_nchans++];
+		c->ic_freq = ieee80211_ieee2mhz(i, IEEE80211_CHAN_2GHZ);
+		c->ic_flags = 
 		    IEEE80211_CHAN_CCK | IEEE80211_CHAN_OFDM |
 		    IEEE80211_CHAN_DYN | IEEE80211_CHAN_2GHZ;
+		c->ic_ieee = i;
 	}
 
 	ieee80211_ifattach(ic);
@@ -906,7 +908,7 @@
 		if (ic->ic_opmode == IEEE80211_M_IBSS)
 			ieee80211_new_state(ic, IEEE80211_S_AUTH, -1);
 		else if (ic->ic_opmode == IEEE80211_M_MONITOR)
-			iwi_set_chan(sc, ic->ic_ibss_chan);
+			iwi_set_chan(sc, ic->ic_curchan);
 
 		return sc->sc_newstate(ic, nstate,
 		    IEEE80211_FC0_SUBTYPE_ASSOC_RESP);
@@ -1009,7 +1011,9 @@
 #if IEEE80211_CHAN_MAX < 255
 		if (frm[2] <= IEEE80211_CHAN_MAX)
 #endif
-			ic->ic_bss->ni_chan = &ic->ic_channels[frm[2]];
+			ic->ic_bsschan = ieee80211_find_channel(ic,
+				ieee80211_ieee2mhz(frm[2], 0),
+				IEEE80211_MODE_AUTO);
 
 		frm += frm[1] + 2;
 	}
@@ -1050,10 +1054,9 @@
 
 		tap->wr_flags = 0;
 		tap->wr_rate = frame->rate;
-		tap->wr_chan_freq =
-		    htole16(ic->ic_channels[frame->chan].ic_freq);
-		tap->wr_chan_flags =
-		    htole16(ic->ic_channels[frame->chan].ic_flags);
+		/* XXX take from frame */
+		tap->wr_chan_freq = htole16(ic->ic_curchan->ic_freq);
+		tap->wr_chan_flags = htole16(ic->ic_curchan->ic_flags);
 		tap->wr_antsignal = frame->signal;
 		tap->wr_antenna = frame->antenna;
 
@@ -1115,7 +1118,7 @@
 			sc->flags &= ~IWI_FLAG_SCANNING;
 			ieee80211_end_scan(ic);
 		} else
-			iwi_set_chan(sc, ic->ic_ibss_chan);
+			iwi_set_chan(sc, ic->ic_curchan);
 		break;
 
 	case IWI_NOTIF_TYPE_AUTHENTICATION:
@@ -1354,8 +1357,8 @@
 		struct iwi_tx_radiotap_header *tap = &sc->sc_txtap;
 
 		tap->wt_flags = 0;
-		tap->wt_chan_freq = htole16(ic->ic_ibss_chan->ic_freq);
-		tap->wt_chan_flags = htole16(ic->ic_ibss_chan->ic_flags);
+		tap->wt_chan_freq = htole16(ic->ic_curchan->ic_freq);
+		tap->wt_chan_flags = htole16(ic->ic_curchan->ic_flags);
 
 		bpf_mtap2(sc->sc_drvbpf, tap, sc->sc_txtap_len, m0);
 	}
@@ -2106,7 +2109,7 @@
 	uint32_t data;
 	int error;
 
-	if (IEEE80211_IS_CHAN_2GHZ(ni->ni_chan)) {
+	if (IEEE80211_IS_CHAN_2GHZ(ic->ic_bsschan)) {
 		memset(&config, 0, sizeof config);
 		config.bluetooth_coexistence = sc->bluetooth;
 		config.antenna = sc->antenna;
@@ -2135,7 +2138,7 @@
 		return error;
 
 	/* the rate set has already been "negociated" */
-	rs.mode = IEEE80211_IS_CHAN_5GHZ(ni->ni_chan) ? IWI_MODE_11A :
+	rs.mode = IEEE80211_IS_CHAN_5GHZ(ic->ic_bsschan) ? IWI_MODE_11A :
 	    IWI_MODE_11G;
 	rs.type = IWI_RATESET_TYPE_NEGOCIATED;
 	rs.nrates = ni->ni_rates.rs_nrates;
@@ -2160,9 +2163,9 @@
 		return error;
 
 	memset(&assoc, 0, sizeof assoc);
-	assoc.mode = IEEE80211_IS_CHAN_5GHZ(ni->ni_chan) ? IWI_MODE_11A :
+	assoc.mode = IEEE80211_IS_CHAN_5GHZ(ic->ic_bsschan) ? IWI_MODE_11A :
 	    IWI_MODE_11G;
-	assoc.chan = ieee80211_chan2ieee(ic, ni->ni_chan);
+	assoc.chan = ieee80211_chan2ieee(ic, ic->ic_bsschan);
 	if (ni->ni_authmode == IEEE80211_AUTH_SHARED)
 		assoc.auth = ic->ic_crypto.cs_def_txkey << 4 | IWI_AUTH_SHARED;
 	if (ic->ic_opt_ie != NULL)
@@ -2176,7 +2179,7 @@
 	if (ic->ic_flags & IEEE80211_F_PRIVACY)
 		capinfo |= IEEE80211_CAPINFO_PRIVACY;
 	if ((ic->ic_flags & IEEE80211_F_SHPREAMBLE) &&
-	    IEEE80211_IS_CHAN_2GHZ(ni->ni_chan))
+	    IEEE80211_IS_CHAN_2GHZ(ic->ic_bsschan))
 		capinfo |= IEEE80211_CAPINFO_SHORT_PREAMBLE;
 	if (ic->ic_flags & IEEE80211_F_SHSLOT)
 		capinfo |= IEEE80211_CAPINFO_SHORT_SLOTTIME;

==== //depot/projects/wifi/sys/dev/ral/if_ral.c#4 (text+ko) ====

@@ -342,6 +342,7 @@
 	struct ral_softc *sc = device_get_softc(dev);
 	struct ifnet *ifp;
 	struct ieee80211com *ic = &sc->sc_ic;
+	struct ieee80211_channel *c;
 	int error, i;
 
 	sc->sc_dev = dev;
@@ -423,19 +424,22 @@
 
 		/* set supported .11a channels */
 		for (i = 36; i <= 64; i += 4) {
-			ic->ic_channels[i].ic_freq =
-			    ieee80211_ieee2mhz(i, IEEE80211_CHAN_5GHZ);
-			ic->ic_channels[i].ic_flags = IEEE80211_CHAN_A;
+			c = &ic->ic_channels[ic->ic_nchans++];
+			c->ic_freq = ieee80211_ieee2mhz(i, IEEE80211_CHAN_5GHZ);
+			c->ic_flags = IEEE80211_CHAN_A;
+			c->ic_ieee = i;
 		}
 		for (i = 100; i <= 140; i += 4) {
-			ic->ic_channels[i].ic_freq =
-			    ieee80211_ieee2mhz(i, IEEE80211_CHAN_5GHZ);
-			ic->ic_channels[i].ic_flags = IEEE80211_CHAN_A;
+			c = &ic->ic_channels[ic->ic_nchans++];
+			c->ic_freq = ieee80211_ieee2mhz(i, IEEE80211_CHAN_5GHZ);
+			c->ic_flags = IEEE80211_CHAN_A;
+			c->ic_ieee = i;
 		}
 		for (i = 149; i <= 161; i += 4) {
-			ic->ic_channels[i].ic_freq =
-			    ieee80211_ieee2mhz(i, IEEE80211_CHAN_5GHZ);
-			ic->ic_channels[i].ic_flags = IEEE80211_CHAN_A;
+			c = &ic->ic_channels[ic->ic_nchans++];
+			c->ic_freq = ieee80211_ieee2mhz(i, IEEE80211_CHAN_5GHZ);
+			c->ic_flags = IEEE80211_CHAN_A;
+			c->ic_ieee = i;
 		}
 	}
 
@@ -445,11 +449,13 @@
 
 	/* set supported .11b and .11g channels (1 through 14) */
 	for (i = 1; i <= 14; i++) {
-		ic->ic_channels[i].ic_freq =
+		c = &ic->ic_channels[ic->ic_nchans++];
+		c->ic_freq =
 		    ieee80211_ieee2mhz(i, IEEE80211_CHAN_2GHZ);
-		ic->ic_channels[i].ic_flags =
+		c->ic_flags =
 		    IEEE80211_CHAN_CCK | IEEE80211_CHAN_OFDM |
 		    IEEE80211_CHAN_DYN | IEEE80211_CHAN_2GHZ;
+		c->ic_ieee = i;
 	}
 
 	ieee80211_ifattach(ic);
@@ -989,21 +995,21 @@
 		break;
 
 	case IEEE80211_S_SCAN:
-		ral_set_chan(sc, ic->ic_bss->ni_chan);
+		ral_set_chan(sc, ic->ic_curchan);
 		callout_reset(&sc->scan_ch, (sc->dwelltime * hz) / 1000,
 		    ral_next_scan, sc);
 		break;
 
 	case IEEE80211_S_AUTH:
-		ral_set_chan(sc, ic->ic_bss->ni_chan);
+		ral_set_chan(sc, ic->ic_curchan);
 		break;
 
 	case IEEE80211_S_ASSOC:
-		ral_set_chan(sc, ic->ic_bss->ni_chan);
+		ral_set_chan(sc, ic->ic_curchan);
 		break;
 
 	case IEEE80211_S_RUN:
-		ral_set_chan(sc, ic->ic_bss->ni_chan);
+		ral_set_chan(sc, ic->ic_curchan);
 
 		if (ic->ic_opmode != IEEE80211_M_MONITOR)
 			ral_set_bssid(sc, ic->ic_bss->ni_bssid);
@@ -1354,9 +1360,9 @@
 			tap->wr_tsf =
 			    htole64(((uint64_t)tsf_hi << 32) | tsf_lo);
 			tap->wr_flags = 0;
-			tap->wr_chan_freq = htole16(ic->ic_ibss_chan->ic_freq);
+			tap->wr_chan_freq = htole16(ic->ic_curchan->ic_freq);
 			tap->wr_chan_flags =
-			    htole16(ic->ic_ibss_chan->ic_flags);
+			    htole16(ic->ic_curchan->ic_flags);
 			tap->wr_antenna = sc->rx_ant;
 			tap->wr_antsignal = desc->rssi;
 
@@ -1711,7 +1717,7 @@
 	desc = &sc->bcnq.desc[sc->bcnq.cur];
 	data = &sc->bcnq.data[sc->bcnq.cur];
 
-	rate = IEEE80211_IS_CHAN_5GHZ(ni->ni_chan) ? 12 : 4;
+	rate = IEEE80211_IS_CHAN_5GHZ(ic->ic_bsschan) ? 12 : 4;
 
 	error = bus_dmamap_load_mbuf_sg(sc->bcnq.data_dmat, data->map, m0,
 	    segs, &nsegs, BUS_DMA_NOWAIT);
@@ -1727,8 +1733,8 @@
 
 		tap->wt_flags = 0;
 		tap->wt_rate = rate;
-		tap->wt_chan_freq = htole16(ic->ic_ibss_chan->ic_freq);
-		tap->wt_chan_flags = htole16(ic->ic_ibss_chan->ic_flags);
+		tap->wt_chan_freq = htole16(ic->ic_curchan->ic_freq);
+		tap->wt_chan_flags = htole16(ic->ic_curchan->ic_flags);
 		tap->wt_antenna = sc->tx_ant;
 
 		bpf_mtap2(sc->sc_drvbpf, tap, sc->sc_txtap_len, m0);
@@ -1767,7 +1773,7 @@
 	desc = &sc->prioq.desc[sc->prioq.cur];
 	data = &sc->prioq.data[sc->prioq.cur];
 
-	rate = IEEE80211_IS_CHAN_5GHZ(ni->ni_chan) ? 12 : 4;
+	rate = IEEE80211_IS_CHAN_5GHZ(ic->ic_curchan) ? 12 : 4;
 
 	error = bus_dmamap_load_mbuf_sg(sc->prioq.data_dmat, data->map, m0,
 	    segs, &nsegs, 0);
@@ -1783,8 +1789,8 @@
 
 		tap->wt_flags = 0;
 		tap->wt_rate = rate;
-		tap->wt_chan_freq = htole16(ic->ic_ibss_chan->ic_freq);
-		tap->wt_chan_flags = htole16(ic->ic_ibss_chan->ic_flags);
+		tap->wt_chan_freq = htole16(ic->ic_curchan->ic_freq);
+		tap->wt_chan_flags = htole16(ic->ic_curchan->ic_flags);
 		tap->wt_antenna = sc->tx_ant;
 
 		bpf_mtap2(sc->sc_drvbpf, tap, sc->sc_txtap_len, m0);
@@ -1875,16 +1881,14 @@
 
 	wh = mtod(m0, struct ieee80211_frame *);
 
-	if (ic->ic_fixed_rate != -1) {
-		rs = &ic->ic_sup_rates[ic->ic_curmode];
-		rate = rs->rs_rates[ic->ic_fixed_rate];
-	} else {
+	if (ic->ic_fixed_rate == IEEE80211_FIXED_RATE_NONE) {
 		rs = &ni->ni_rates;
 		rn = (struct ral_node *)ni;
 		ni->ni_txrate = ral_rssadapt_choose(&rn->rssadapt, rs,
 		    wh, m0->m_pkthdr.len, NULL, 0);
 		rate = rs->rs_rates[ni->ni_txrate];
-	}
+	} else
+		rate = ic->ic_fixed_rate;
 	rate &= IEEE80211_RATE_VAL;
 
 	if (wh->i_fc[1] & IEEE80211_FC1_WEP) {
@@ -1909,7 +1913,7 @@
 		uint16_t dur;
 		int rtsrate, ackrate;
 
-		rtsrate = IEEE80211_IS_CHAN_5GHZ(ni->ni_chan) ? 12 : 4;
+		rtsrate = IEEE80211_IS_CHAN_5GHZ(ic->ic_curchan) ? 12 : 4;
 		ackrate = ral_ack_rate(rate);
 
 		dur = ral_txtime(m0->m_pkthdr.len + 4, rate, ic->ic_flags) +
@@ -1998,8 +2002,8 @@
 
 		tap->wt_flags = 0;
 		tap->wt_rate = rate;
-		tap->wt_chan_freq = htole16(ic->ic_ibss_chan->ic_freq);
-		tap->wt_chan_flags = htole16(ic->ic_ibss_chan->ic_flags);
+		tap->wt_chan_freq = htole16(ic->ic_curchan->ic_freq);
+		tap->wt_chan_flags = htole16(ic->ic_curchan->ic_flags);
 		tap->wt_antenna = sc->tx_ant;
 
 		bpf_mtap2(sc->sc_drvbpf, tap, sc->sc_txtap_len, m0);
@@ -2009,7 +2013,7 @@
 	data->ni = ni;
 
 	/* remember link conditions for rate adaptation algorithm */
-	if (ic->ic_fixed_rate == -1) {
+	if (ic->ic_fixed_rate == IEEE80211_FIXED_RATE_NONE) {
 		data->id.id_len = m0->m_pkthdr.len;
 		data->id.id_rateidx = ni->ni_txrate;
 		data->id.id_node = ni;
@@ -2159,7 +2163,7 @@
 	if (ic->ic_opmode != IEEE80211_M_MONITOR)
 		return ENETRESET;
 
-	ral_set_chan(sc, ic->ic_ibss_chan);
+	ral_set_chan(sc, ic->ic_curchan);
 
 	return 0;
 }
@@ -2469,7 +2473,7 @@
 	pifs = sifs + slottime;
 	difs = sifs + 2 * slottime;
 	eifs = sifs + ral_txtime(RAL_ACK_SIZE,
-	    (ic->ic_curmode == IEEE80211_MODE_11A) ? 12 : 2, 0) + difs;
+	    IEEE80211_IS_CHAN_A(ic->ic_curchan) ? 12 : 2, 0) + difs;
 
 	tmp = RAL_READ(sc, RAL_CSR11);
 	tmp = (tmp & ~0x1f00) | slottime << 8;
@@ -2737,8 +2741,7 @@
 	}
 
 	/* set default BSS channel */
-	ic->ic_bss->ni_chan = ic->ic_ibss_chan;
-	ral_set_chan(sc, ic->ic_bss->ni_chan);
+	ral_set_chan(sc, ic->ic_curchan);
 
 	/* kick Rx */
 	tmp = RAL_DROP_PHY_ERROR | RAL_DROP_CRC_ERROR;

==== //depot/projects/wifi/sys/dev/usb/if_ural.c#4 (text+ko) ====

@@ -355,6 +355,7 @@
 	USB_ATTACH_START(ural, sc, uaa);
 	struct ifnet *ifp;
 	struct ieee80211com *ic = &sc->sc_ic;
+	struct ieee80211_channel *c;
 	usb_interface_descriptor_t *id;
 	usb_endpoint_descriptor_t *ed;
 	usbd_status error;
@@ -456,19 +457,22 @@
 
 		/* set supported .11a channels */
 		for (i = 36; i <= 64; i += 4) {
-			ic->ic_channels[i].ic_freq =
-			    ieee80211_ieee2mhz(i, IEEE80211_CHAN_5GHZ);
-			ic->ic_channels[i].ic_flags = IEEE80211_CHAN_A;
+			c = &ic->ic_channels[ic->ic_nchans++];
+			c->ic_freq = ieee80211_ieee2mhz(i, IEEE80211_CHAN_5GHZ);
+			c->ic_flags = IEEE80211_CHAN_A;
+			c->ic_ieee = i;
 		}
 		for (i = 100; i <= 140; i += 4) {
-			ic->ic_channels[i].ic_freq =
-			    ieee80211_ieee2mhz(i, IEEE80211_CHAN_5GHZ);
-			ic->ic_channels[i].ic_flags = IEEE80211_CHAN_A;
+			c = &ic->ic_channels[ic->ic_nchans++];
+			c->ic_freq = ieee80211_ieee2mhz(i, IEEE80211_CHAN_5GHZ);
+			c->ic_flags = IEEE80211_CHAN_A;
+			c->ic_ieee = i;
 		}
 		for (i = 149; i <= 161; i += 4) {
-			ic->ic_channels[i].ic_freq =
-			    ieee80211_ieee2mhz(i, IEEE80211_CHAN_5GHZ);
-			ic->ic_channels[i].ic_flags = IEEE80211_CHAN_A;
+			c = &ic->ic_channels[ic->ic_nchans++];
+			c->ic_freq = ieee80211_ieee2mhz(i, IEEE80211_CHAN_5GHZ);
+			c->ic_flags = IEEE80211_CHAN_A;
+			c->ic_ieee = i;
 		}
 	}
 
@@ -478,11 +482,13 @@
 
 	/* set supported .11b and .11g channels (1 through 14) */
 	for (i = 1; i <= 14; i++) {
-		ic->ic_channels[i].ic_freq =
+		c = &ic->ic_channels[ic->ic_nchans++];
+		c->ic_freq =
 		    ieee80211_ieee2mhz(i, IEEE80211_CHAN_2GHZ);
-		ic->ic_channels[i].ic_flags =
+		c->ic_flags =
 		    IEEE80211_CHAN_CCK | IEEE80211_CHAN_OFDM |
 		    IEEE80211_CHAN_DYN | IEEE80211_CHAN_2GHZ;
+		c->ic_ieee = i;
 	}
 
 	ieee80211_ifattach(ic);
@@ -721,20 +727,20 @@
 		break;
 
 	case IEEE80211_S_SCAN:
-		ural_set_chan(sc, ic->ic_bss->ni_chan);
+		ural_set_chan(sc, ic->ic_curchan);
 		callout_reset(&sc->scan_ch, hz / 5, ural_next_scan, sc);
 		break;
 
 	case IEEE80211_S_AUTH:
-		ural_set_chan(sc, ic->ic_bss->ni_chan);
+		ural_set_chan(sc, ic->ic_curchan);
 		break;
 
 	case IEEE80211_S_ASSOC:
-		ural_set_chan(sc, ic->ic_bss->ni_chan);
+		ural_set_chan(sc, ic->ic_curchan);
 		break;
 
 	case IEEE80211_S_RUN:
-		ural_set_chan(sc, ic->ic_bss->ni_chan);
+		ural_set_chan(sc, ic->ic_bsschan);
 
 		if (ic->ic_opmode != IEEE80211_M_MONITOR)
 			ural_set_bssid(sc, ic->ic_bss->ni_bssid);
@@ -1124,15 +1130,15 @@
 	data = &sc->tx_data[0];
 	desc = (struct ural_tx_desc *)data->buf;
 
-	rate = IEEE80211_IS_CHAN_5GHZ(ni->ni_chan) ? 12 : 4;
+	rate = IEEE80211_IS_CHAN_5GHZ(ic->ic_curchan) ? 12 : 4;
 
 	if (sc->sc_drvbpf != NULL) {
 		struct ural_tx_radiotap_header *tap = &sc->sc_txtap;
 
 		tap->wt_flags = 0;
 		tap->wt_rate = rate;
-		tap->wt_chan_freq = htole16(ic->ic_ibss_chan->ic_freq);
-		tap->wt_chan_flags = htole16(ic->ic_ibss_chan->ic_flags);
+		tap->wt_chan_freq = htole16(ic->ic_curchan->ic_freq);
+		tap->wt_chan_flags = htole16(ic->ic_curchan->ic_flags);
 		tap->wt_antenna = sc->tx_ant;
 
 		bpf_mtap2(sc->sc_drvbpf, tap, sc->sc_txtap_len, m0);
@@ -1195,8 +1201,8 @@
 	wh = mtod(m0, struct ieee80211_frame *);
 
 	/* XXX should do automatic rate adaptation */
-	if (ic->ic_fixed_rate != -1)
-		rate = ic->ic_bss->ni_rates.rs_rates[ic->ic_fixed_rate];
+	if (ic->ic_fixed_rate != IEEE80211_FIXED_RATE_NONE)
+		rate = ic->ic_fixed_rate;
 	else
 		rate = ni->ni_rates.rs_rates[ni->ni_txrate];
 
@@ -1218,8 +1224,8 @@
 
 		tap->wt_flags = 0;
 		tap->wt_rate = rate;
-		tap->wt_chan_freq = htole16(ic->ic_ibss_chan->ic_freq);
-		tap->wt_chan_flags = htole16(ic->ic_ibss_chan->ic_flags);
+		tap->wt_chan_freq = htole16(ic->ic_curchan->ic_freq);
+		tap->wt_chan_flags = htole16(ic->ic_curchan->ic_flags);
 		tap->wt_antenna = sc->tx_ant;
 
 		bpf_mtap2(sc->sc_drvbpf, tap, sc->sc_txtap_len, m0);
@@ -1374,7 +1380,7 @@

>>> TRUNCATED FOR MAIL (1000 lines) <<<



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200507152142.j6FLgsYf035067>