summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2005-08-10 16:22:30 +0000
committersam <sam@FreeBSD.org>2005-08-10 16:22:30 +0000
commit7d1366bf6d72fe0b21b589eee177dccbdccc5dc5 (patch)
treeb9c0e277abb905c850c4e7b7e0d8615bf32983ff /sys/dev
parentfcb7f09afa00151c86541bef3c214f25a101d786 (diff)
downloadFreeBSD-src-7d1366bf6d72fe0b21b589eee177dccbdccc5dc5.zip
FreeBSD-src-7d1366bf6d72fe0b21b589eee177dccbdccc5dc5.tar.gz
Clarify/fix handling of the current channel:
o add ic_curchan and use it uniformly for specifying the current channel instead of overloading ic->ic_bss->ni_chan (or in some drivers ic_ibss_chan) o add ieee80211_scanparams structure to encapsulate scanning-related state captured for rx frames o move rx beacon+probe response frame handling into separate routines o change beacon+probe response handling to treat the scan table more like a scan cache--look for an existing entry before adding a new one; this combined with ic_curchan use corrects handling of stations that were previously found at a different channel o move adhoc neighbor discovery by beacon+probe response frames to a new ieee80211_add_neighbor routine Reviewed by: avatar Tested by: avatar, Michal Mertl MFC after: 2 weeks
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ath/if_ath.c15
-rw-r--r--sys/dev/ipw/if_ipw.c2
-rw-r--r--sys/dev/ral/if_ral.c15
-rw-r--r--sys/dev/usb/if_ural.c13
-rw-r--r--sys/dev/wi/if_wi.c1
5 files changed, 23 insertions, 23 deletions
diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c
index afd9d61..05cad26 100644
--- a/sys/dev/ath/if_ath.c
+++ b/sys/dev/ath/if_ath.c
@@ -844,7 +844,6 @@ ath_init(void *arg)
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;
@@ -865,8 +864,8 @@ ath_init(void *arg)
* 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->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);
@@ -918,9 +917,7 @@ ath_init(void *arg)
* 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);
@@ -1022,7 +1019,7 @@ ath_reset(struct ifnet *ifp)
* 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);
@@ -4114,7 +4111,7 @@ ath_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg)
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);
@@ -4153,7 +4150,7 @@ ath_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg)
, 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:
diff --git a/sys/dev/ipw/if_ipw.c b/sys/dev/ipw/if_ipw.c
index 88afe1c..2d850a9 100644
--- a/sys/dev/ipw/if_ipw.c
+++ b/sys/dev/ipw/if_ipw.c
@@ -1002,7 +1002,7 @@ ipw_fix_channel(struct ieee80211com *ic, struct mbuf *m)
#if IEEE80211_CHAN_MAX < 255
if (frm[2] <= IEEE80211_CHAN_MAX)
#endif
- ic->ic_bss->ni_chan = &ic->ic_channels[frm[2]];
+ ic->ic_curchan = &ic->ic_channels[frm[2]];
frm += frm[1] + 2;
}
diff --git a/sys/dev/ral/if_ral.c b/sys/dev/ral/if_ral.c
index 716bde4..1b275e9 100644
--- a/sys/dev/ral/if_ral.c
+++ b/sys/dev/ral/if_ral.c
@@ -990,21 +990,21 @@ ral_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg)
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);
@@ -1768,7 +1768,7 @@ ral_tx_mgt(struct ral_softc *sc, struct mbuf *m0, struct ieee80211_node *ni)
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);
@@ -1910,7 +1910,7 @@ ral_tx_data(struct ral_softc *sc, struct mbuf *m0, struct ieee80211_node *ni)
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) +
@@ -2739,7 +2739,8 @@ ral_init(void *priv)
/* set default BSS channel */
ic->ic_bss->ni_chan = ic->ic_ibss_chan;
- ral_set_chan(sc, ic->ic_bss->ni_chan);
+ ic->ic_curchan = ic->ic_ibss_chan;
+ ral_set_chan(sc, ic->ic_curchan);
/* kick Rx */
tmp = RAL_DROP_PHY_ERROR | RAL_DROP_CRC_ERROR;
diff --git a/sys/dev/usb/if_ural.c b/sys/dev/usb/if_ural.c
index 0083652..7deb1bc 100644
--- a/sys/dev/usb/if_ural.c
+++ b/sys/dev/usb/if_ural.c
@@ -722,20 +722,20 @@ ural_task(void *arg)
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_curchan);
if (ic->ic_opmode != IEEE80211_M_MONITOR)
ural_set_bssid(sc, ic->ic_bss->ni_bssid);
@@ -1125,7 +1125,7 @@ ural_tx_mgt(struct ural_softc *sc, struct mbuf *m0, struct ieee80211_node *ni)
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;
@@ -1956,7 +1956,8 @@ ural_init(void *priv)
/* set default BSS channel */
ic->ic_bss->ni_chan = ic->ic_ibss_chan;
- ural_set_chan(sc, ic->ic_bss->ni_chan);
+ ic->ic_curchan = ic->ic_ibss_chan;
+ ural_set_chan(sc, ic->ic_curchan);
/* clear statistic registers (STA_CSR0 to STA_CSR10) */
ural_read_multi(sc, RAL_STA_CSR0, sta, sizeof sta);
diff --git a/sys/dev/wi/if_wi.c b/sys/dev/wi/if_wi.c
index 4de137c..fc9ab4d 100644
--- a/sys/dev/wi/if_wi.c
+++ b/sys/dev/wi/if_wi.c
@@ -2736,6 +2736,7 @@ wi_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg)
wi_read_rid(sc, WI_RID_CURRENT_CHAN, &val, &buflen);
/* XXX validate channel */
ni->ni_chan = &ic->ic_channels[le16toh(val)];
+ ic->ic_curchan = ni->ni_chan;
ic->ic_ibss_chan = ni->ni_chan;
#if NBPFILTER > 0
sc->sc_tx_th.wt_chan_freq = sc->sc_rx_th.wr_chan_freq =
OpenPOWER on IntegriCloud