PERFORCE change 64984 for review
Sam Leffler
sam at FreeBSD.org
Fri Nov 12 15:41:33 PST 2004
http://perforce.freebsd.org/chv.cgi?CH=64984
Change 64984 by sam at sam_ebb on 2004/11/12 23:40:42
checkpoint background scanning work; ready to detach from the
state machine
Affected files ...
.. //depot/projects/wifi/sys/net80211/ieee80211_input.c#12 edit
.. //depot/projects/wifi/sys/net80211/ieee80211_node.c#13 edit
.. //depot/projects/wifi/sys/net80211/ieee80211_output.c#8 edit
.. //depot/projects/wifi/sys/net80211/ieee80211_proto.c#6 edit
.. //depot/projects/wifi/sys/net80211/ieee80211_var.h#9 edit
Differences ...
==== //depot/projects/wifi/sys/net80211/ieee80211_input.c#12 (text+ko) ====
@@ -69,7 +69,7 @@
{
switch (subtype) {
case IEEE80211_FC0_SUBTYPE_BEACON:
- return (ic->ic_state == IEEE80211_S_SCAN);
+ return (ic->ic_flags & IEEE80211_F_SCAN);
case IEEE80211_FC0_SUBTYPE_PROBE_REQ:
return (ic->ic_opmode == IEEE80211_M_IBSS);
}
@@ -160,7 +160,7 @@
dir = wh->i_fc[1] & IEEE80211_FC1_DIR_MASK;
type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK;
subtype = wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK;
- if (ic->ic_state != IEEE80211_S_SCAN) {
+ if ((ic->ic_flags & IEEE80211_F_SCAN) == 0) {
switch (ic->ic_opmode) {
case IEEE80211_M_STA:
bssid = wh->i_addr2;
@@ -1644,17 +1644,16 @@
} else
IEEE80211_NODE_STAT(ni, rx_proberesp);
/*
- * We process beacon/probe response frames for:
- * o station mode when associated: to collect state
- * updates such as 802.11g slot time
- * o adhoc mode: to discover neighbors
- * o when scanning
+ * We process beacon/probe response frames:
+ * o when scanning, or
+ * o station mode when associated (to collect state
+ * updates such as 802.11g slot time), or
+ * o adhoc mode (to discover neighbors)
* Frames otherwise received are discarded.
*/
- if (!((ic->ic_opmode == IEEE80211_M_STA && ni->ni_associd != 0)
- || ic->ic_opmode == IEEE80211_M_IBSS
- || ic->ic_state == IEEE80211_S_SCAN)) {
- /* XXX: may be useful for background scan */
+ if (!((ic->ic_flags & IEEE80211_F_SCAN) ||
+ (ic->ic_opmode == IEEE80211_M_STA && ni->ni_associd) ||
+ ic->ic_opmode != IEEE80211_M_IBSS)) {
ic->ic_stats.is_rx_mgtdiscard++;
return;
}
@@ -1785,10 +1784,17 @@
}
/*
- * Station mode, check for state updates. We
- * consider only 11g stuff right now.
+ * When operating in station mode, check for state updates.
+ * Be careful to ignore beacons received while doing a
+ * background scan. We consider only 11g stuff right now
+ * (XXX WME to come).
*/
- if (ic->ic_opmode == IEEE80211_M_STA && ni->ni_associd != 0) {
+ if (ni->ni_associd != 0 &&
+ ((ic->ic_flags & IEEE80211_F_SCAN) == 0 ||
+ IEEE80211_ADDR_EQ(wh->i_addr2, ni->ni_bssid))) {
+ KASSERT(ic->ic_opmode == IEEE80211_M_STA,
+ ("beacon in %u mode with associd 0x%x?",
+ ic->ic_opmode, ni->ni_associd));
if (ni->ni_erp != erp) {
IEEE80211_DPRINTF(ic, IEEE80211_MSG_ASSOC,
"erp change from %s: was 0x%x, now 0x%x\n",
@@ -1817,6 +1823,7 @@
/* XXX statistic */
}
ni->ni_inact = ic->ic_inact_run;
+ /* NB: don't need the rest of this */
return;
}
@@ -1834,7 +1841,7 @@
* as ibss participants so we don't populate our
* neighbor table with unintersting sta's.
*/
- if (ic->ic_state != IEEE80211_S_SCAN) {
+ if ((ic->ic_flags & IEEE80211_F_SCAN) == 0) {
if ((capinfo & IEEE80211_CAPINFO_IBSS) == 0)
return;
ni = ieee80211_fakeup_adhoc_node(ic->ic_sta,
==== //depot/projects/wifi/sys/net80211/ieee80211_node.c#13 (text+ko) ====
@@ -274,16 +274,14 @@
(ic->ic_flags & IEEE80211_F_ASCAN) ? "active" : "passive",
ic->ic_scan.nt_scangen);
/*
- * Clear scan state and flush any previously seen
- * AP's. Note that the latter assumes we don't act
- * as both an AP and a station, otherwise we'll
- * potentially flush state of stations associated
- * with us.
+ * Clear scan state and flush any previously seen AP's.
*/
ieee80211_reset_scan(ic);
if (reset)
ieee80211_free_allnodes(&ic->ic_scan);
+ ic->ic_flags |= IEEE80211_F_SCAN;
+
/* Scan the next channel. */
ieee80211_next_scan(ic);
}
@@ -314,7 +312,22 @@
ieee80211_chan2ieee(ic, ic->ic_bss->ni_chan),
ieee80211_chan2ieee(ic, chan));
ieee80211_set_chan(ic, ic->ic_bss, chan);
+#ifdef notyet
+ /* XXX driver state change */
+ /*
+ * Scan next channel. If doing an active scan
+ * and the channel is not marked passive-only
+ * then send a probe request. Otherwise just
+ * listen for beacons on the channel.
+ */
+ if ((ic->ic_flags & IEEE80211_F_ASCAN) &&
+ (ni->ni_chan->ic_flags & IEEE80211_CHAN_PASSIVE) == 0) {
+ IEEE80211_SEND_MGMT(ic, ni,
+ IEEE80211_FC0_SUBTYPE_PROBE_REQ, 0);
+ }
+#else
ieee80211_new_state(ic, IEEE80211_S_SCAN, -1);
+#endif
return 1;
}
} while (chan != ic->ic_bss->ni_chan);
@@ -505,7 +518,7 @@
IEEE80211_DPRINTF(ic, IEEE80211_MSG_SCAN, "end %s scan\n",
(ic->ic_flags & IEEE80211_F_ASCAN) ? "active" : "passive");
- ic->ic_flags &= ~IEEE80211_F_ASCAN;
+ ic->ic_flags &= ~(IEEE80211_F_SCAN | IEEE80211_F_ASCAN);
nt = &ic->ic_scan;
ni = TAILQ_FIRST(&nt->nt_node);
@@ -583,6 +596,7 @@
* Reset the list of channels to scan and start again.
*/
ieee80211_reset_scan(ic);
+ ic->ic_flags |= IEEE80211_F_SCAN;
ieee80211_next_scan(ic);
return;
}
@@ -960,7 +974,7 @@
/* XXX may want scanned nodes in the neighbor table for adhoc */
if (ic->ic_opmode == IEEE80211_M_STA ||
ic->ic_opmode == IEEE80211_M_MONITOR ||
- ic->ic_state == IEEE80211_S_SCAN /*XXX*/)
+ (ic->ic_flags & IEEE80211_F_SCAN))
nt = &ic->ic_scan;
else
nt = ic->ic_sta;
==== //depot/projects/wifi/sys/net80211/ieee80211_output.c#8 (text+ko) ====
@@ -126,7 +126,8 @@
* to communicate this directly rather than do something
* implicit based on surrounding state.
*/
- if (ni == ic->ic_bss && ic->ic_state == IEEE80211_S_SCAN) {
+ if (type == IEEE80211_FC0_SUBTYPE_PROBE_REQ &&
+ (ic->ic_flags & IEEE80211_F_SCAN)) {
IEEE80211_ADDR_COPY(wh->i_addr1, ifp->if_broadcastaddr);
IEEE80211_ADDR_COPY(wh->i_addr2, ic->ic_myaddr);
IEEE80211_ADDR_COPY(wh->i_addr3, ifp->if_broadcastaddr);
==== //depot/projects/wifi/sys/net80211/ieee80211_proto.c#6 (text+ko) ====
@@ -559,12 +559,6 @@
ic->ic_auth->ia_detach(ic);
break;
case IEEE80211_S_SCAN:
- ic->ic_flags &= ~IEEE80211_F_SIBSS;
- /* XXX initialize bss for probe request */
- ni->ni_rates = ic->ic_sup_rates[
- ieee80211_chan2mode(ic, ni->ni_chan)];
- ni->ni_associd = 0; /* XXX? */
- ni->ni_rstamp = 0; /* XXX? */
switch (ostate) {
case IEEE80211_S_INIT:
if ((ic->ic_opmode == IEEE80211_M_HOSTAP ||
@@ -599,6 +593,7 @@
"no recent beacons from %s; rescanning\n",
ether_sprintf(ic->ic_bss->ni_bssid));
ieee80211_sta_leave(ic, ni);
+ ic->ic_flags &= ~IEEE80211_F_SIBSS; /* XXX */
/* FALLTHRU */
case IEEE80211_S_AUTH:
case IEEE80211_S_ASSOC:
==== //depot/projects/wifi/sys/net80211/ieee80211_var.h#9 (text+ko) ====
@@ -291,8 +291,10 @@
#define IEEE80211_ADDR_COPY(dst,src) memcpy(dst,src,IEEE80211_ADDR_LEN)
/* ic_flags */
+/* NB: bits 0x6f available */
/* NB: this is intentionally setup to be IEEE80211_CAPINFO_PRIVACY */
#define IEEE80211_F_PRIVACY 0x00000010 /* CONF: privacy enabled */
+#define IEEE80211_F_SCAN 0x00000080 /* STATUS: scanning */
#define IEEE80211_F_ASCAN 0x00000100 /* STATUS: active scan */
#define IEEE80211_F_SIBSS 0x00000200 /* STATUS: start IBSS */
/* NB: this is intentionally setup to be IEEE80211_CAPINFO_SHORT_SLOTTIME */
@@ -300,7 +302,7 @@
#define IEEE80211_F_PMGTON 0x00000800 /* CONF: Power mgmt enable */
#define IEEE80211_F_DESBSSID 0x00001000 /* CONF: des_bssid is set */
#define IEEE80211_F_WME 0x00002000 /* CONF: enable WME use */
-#define IEEE80211_F_ROAMING 0x00004000 /* CONF: roaming enabled */
+#define IEEE80211_F_ROAMING 0x00004000 /* CONF: roaming enabled (???)*/
#define IEEE80211_F_SWRETRY 0x00008000 /* CONF: sw tx retry enabled */
#define IEEE80211_F_TXPOW_FIXED 0x00010000 /* TX Power: fixed rate */
#define IEEE80211_F_IBSSON 0x00020000 /* CONF: IBSS creation enable */
@@ -333,6 +335,9 @@
#define IEEE80211_C_SHPREAMBLE 0x00008000 /* CAPABILITY: short preamble */
#define IEEE80211_C_MONITOR 0x00010000 /* CAPABILITY: monitor mode */
#define IEEE80211_C_TKIPMIC 0x00020000 /* CAPABILITY: TKIP MIC avail */
+#define IEEE80211_C_WPA1 0x00800000 /* CAPABILITY: WPA1 avail */
+#define IEEE80211_C_WPA2 0x01000000 /* CAPABILITY: WPA2 avail */
+#define IEEE80211_C_WPA 0x01800000 /* CAPABILITY: WPA1+WPA2 avail*/
/* XXX protection/barker? */
#define IEEE80211_C_CRYPTO 0x0000002f /* CAPABILITY: crypto alg's */
More information about the p4-projects
mailing list