summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorthompsa <thompsa@FreeBSD.org>2007-06-30 21:23:23 +0000
committerthompsa <thompsa@FreeBSD.org>2007-06-30 21:23:23 +0000
commit03a3b230428af3dfad8a2660809025cc47b938c6 (patch)
treeef8ffae136509b04a3591b2f9fd5c7b6b3d2cc99 /sys
parent59be299a4e0e2fe099e874859863a1c5971b06cb (diff)
downloadFreeBSD-src-03a3b230428af3dfad8a2660809025cc47b938c6.zip
FreeBSD-src-03a3b230428af3dfad8a2660809025cc47b938c6.tar.gz
Change the channel number in the scan results struct to be a pointer to the
operating channel and use this in the scan cache rather than directly using ic_curchan. Some firmware cards can only do a full scan and so ic_curchan does not have the correct value. Also add IEEE80211_CHAN2IEEE to directly dereference ic_ieee from the channel to be used in the fast path. Reviewed by: sam, sephe Approved by: re (kensmith)
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/wi/if_wi.c8
-rw-r--r--sys/net80211/_ieee80211.h2
-rw-r--r--sys/net80211/ieee80211_input.c13
-rw-r--r--sys/net80211/ieee80211_scan.c2
-rw-r--r--sys/net80211/ieee80211_scan.h4
-rw-r--r--sys/net80211/ieee80211_scan_sta.c2
6 files changed, 20 insertions, 11 deletions
diff --git a/sys/dev/wi/if_wi.c b/sys/dev/wi/if_wi.c
index 16f2d9f..86f8b96 100644
--- a/sys/dev/wi/if_wi.c
+++ b/sys/dev/wi/if_wi.c
@@ -3098,7 +3098,7 @@ wi_scan_result(struct wi_softc *sc, int fid, int cnt)
memcpy(wh.i_addr2, ws_dat.wi_bssid, sizeof(ap->bssid));
memcpy(wh.i_addr3, ws_dat.wi_bssid, sizeof(ap->bssid));
- sp.chan = ap->channel = le16toh(ws_dat.wi_chid);
+ ap->channel = le16toh(ws_dat.wi_chid);
ap->signal = le16toh(ws_dat.wi_signal);
ap->noise = le16toh(ws_dat.wi_noise);
ap->quality = ap->signal - ap->noise;
@@ -3114,6 +3114,12 @@ wi_scan_result(struct wi_softc *sc, int fid, int cnt)
sp.ssid = (uint8_t *)&ssid[0];
memcpy(sp.ssid + 2, ap->name, ap->namelen);
sp.ssid[1] = ap->namelen;
+ sp.bchan = ap->channel;
+ sp.curchan = ieee80211_find_channel(ic,
+ ieee80211_ieee2mhz(ap->channel, IEEE80211_CHAN_B),
+ IEEE80211_CHAN_B);
+ if (sp.curchan == NULL)
+ sp.curchan = &ic->ic_channels[0];
sp.rates = &rates[0];
sp.tstamp = (uint8_t *)&rstamp;
printf("calling add_scan \n");
diff --git a/sys/net80211/_ieee80211.h b/sys/net80211/_ieee80211.h
index 8747bfc..d952491 100644
--- a/sys/net80211/_ieee80211.h
+++ b/sys/net80211/_ieee80211.h
@@ -229,6 +229,8 @@ struct ieee80211_channel {
(IEEE80211_IS_CHAN_2GHZ(_c) && \
((_c)->ic_flags & IEEE80211_CHAN_HT) != 0)
+#define IEEE80211_CHAN2IEEE(_c) (_c)->ic_ieee
+
/* ni_chan encoding for FH phy */
#define IEEE80211_FH_CHANMOD 80
#define IEEE80211_FH_CHAN(set,pat) (((set)-1)*IEEE80211_FH_CHANMOD+(pat))
diff --git a/sys/net80211/ieee80211_input.c b/sys/net80211/ieee80211_input.c
index a5b5341..d756041 100644
--- a/sys/net80211/ieee80211_input.c
+++ b/sys/net80211/ieee80211_input.c
@@ -2090,8 +2090,8 @@ ieee80211_recv_mgmt(struct ieee80211com *ic, struct mbuf *m0,
scan.tstamp = frm; frm += 8;
scan.bintval = le16toh(*(uint16_t *)frm); frm += 2;
scan.capinfo = le16toh(*(uint16_t *)frm); frm += 2;
- scan.bchan = ieee80211_chan2ieee(ic, ic->ic_curchan);
- scan.chan = scan.bchan;
+ scan.bchan = IEEE80211_CHAN2IEEE(ic->ic_curchan);
+ scan.curchan = ic->ic_curchan;
while (efrm - frm > 1) {
IEEE80211_VERIFY_LENGTH(efrm - frm, frm[1] + 2, return);
@@ -2108,7 +2108,7 @@ ieee80211_recv_mgmt(struct ieee80211com *ic, struct mbuf *m0,
case IEEE80211_ELEMID_FHPARMS:
if (ic->ic_phytype == IEEE80211_T_FH) {
scan.fhdwell = LE_READ_2(&frm[2]);
- scan.chan = IEEE80211_FH_CHAN(frm[4], frm[5]);
+ scan.bchan = IEEE80211_FH_CHAN(frm[4], frm[5]);
scan.fhindex = frm[6];
}
break;
@@ -2118,7 +2118,7 @@ ieee80211_recv_mgmt(struct ieee80211com *ic, struct mbuf *m0,
* is problematic for multi-mode devices.
*/
if (ic->ic_phytype != IEEE80211_T_FH)
- scan.chan = frm[2];
+ scan.bchan = frm[2];
break;
case IEEE80211_ELEMID_TIM:
/* XXX ATIM? */
@@ -2194,7 +2194,7 @@ ieee80211_recv_mgmt(struct ieee80211com *ic, struct mbuf *m0,
return;
}
#endif
- if (scan.chan != scan.bchan &&
+ if (IEEE80211_CHAN2IEEE(scan.curchan) != scan.bchan &&
ic->ic_phytype != IEEE80211_T_FH) {
/*
* Frame was received on a channel different from the
@@ -2210,7 +2210,8 @@ ieee80211_recv_mgmt(struct ieee80211com *ic, struct mbuf *m0,
IEEE80211_MSG_ELEMID | IEEE80211_MSG_INPUT,
wh, ieee80211_mgt_subtype_name[subtype >>
IEEE80211_FC0_SUBTYPE_SHIFT],
- "for off-channel %u", scan.chan);
+ "for off-channel %u",
+ IEEE80211_CHAN2IEEE(scan.curchan));
ic->ic_stats.is_rx_chanmismatch++;
return;
}
diff --git a/sys/net80211/ieee80211_scan.c b/sys/net80211/ieee80211_scan.c
index 6099744..8835654 100644
--- a/sys/net80211/ieee80211_scan.c
+++ b/sys/net80211/ieee80211_scan.c
@@ -835,7 +835,7 @@ dump_probe_beacon(uint8_t subtype, int isnew,
printf("[%s] %s%s on chan %u (bss chan %u) ",
ether_sprintf(mac), isnew ? "new " : "",
ieee80211_mgt_subtype_name[subtype >> IEEE80211_FC0_SUBTYPE_SHIFT],
- sp->chan, sp->bchan);
+ IEEE80211_CHAN2IEEE(sp->curchan), sp->bchan);
ieee80211_print_essid(sp->ssid + 2, sp->ssid[1]);
printf("\n");
diff --git a/sys/net80211/ieee80211_scan.h b/sys/net80211/ieee80211_scan.h
index 4881aea..d8953c4 100644
--- a/sys/net80211/ieee80211_scan.h
+++ b/sys/net80211/ieee80211_scan.h
@@ -117,8 +117,8 @@ void ieee80211_scan_iterate(struct ieee80211com *,
struct ieee80211_scanparams {
uint16_t capinfo; /* 802.11 capabilities */
uint16_t fhdwell; /* FHSS dwell interval */
- uint8_t chan; /* */
- uint8_t bchan;
+ struct ieee80211_channel *curchan;
+ uint8_t bchan; /* chan# advertised inside beacon */
uint8_t fhindex;
uint8_t erp;
uint16_t bintval;
diff --git a/sys/net80211/ieee80211_scan_sta.c b/sys/net80211/ieee80211_scan_sta.c
index 7bd04c8..88e5090 100644
--- a/sys/net80211/ieee80211_scan_sta.c
+++ b/sys/net80211/ieee80211_scan_sta.c
@@ -257,7 +257,7 @@ found:
memcpy(ise->se_tstamp.data, sp->tstamp, sizeof(ise->se_tstamp));
ise->se_intval = sp->bintval;
ise->se_capinfo = sp->capinfo;
- ise->se_chan = ic->ic_curchan;
+ ise->se_chan = sp->curchan;
ise->se_fhdwell = sp->fhdwell;
ise->se_fhindex = sp->fhindex;
ise->se_erp = sp->erp;
OpenPOWER on IntegriCloud