Date: Sat, 24 Mar 2007 15:57:16 GMT From: Sam Leffler <sam@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 116492 for review Message-ID: <200703241557.l2OFvGu2034274@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=116492 Change 116492 by sam@sam_ebb on 2007/03/24 15:56:53 checkpoint scanning changes for iwi & co. Affected files ... .. //depot/projects/wifi/sys/net80211/ieee80211_scan.c#11 edit .. //depot/projects/wifi/sys/net80211/ieee80211_scan.h#6 edit .. //depot/projects/wifi/sys/net80211/ieee80211_var.h#52 edit Differences ... ==== //depot/projects/wifi/sys/net80211/ieee80211_scan.c#11 (text+ko) ==== @@ -88,6 +88,8 @@ #define ROAM_RATE_11BONLY_DEFAULT 2*1 /* tx rate thresh for 11b-only bss */ static void scan_restart_pwrsav(void *); +static void scan_curchan(struct ieee80211com *, unsigned long); +static void scan_mindwell(struct ieee80211com *); static void scan_next(void *); MALLOC_DEFINE(M_80211_SCAN, "80211scan", "802.11 scan state"); @@ -108,6 +110,9 @@ callout_init(&ss->ss_scan_timer, CALLOUT_MPSAFE); ic->ic_scan = &ss->base; + ic->ic_scan_curchan = scan_curchan; + ic->ic_scan_mindwell = scan_mindwell; + ic->ic_bgscanidle = (IEEE80211_BGSCAN_IDLE_DEFAULT*1000)/hz; ic->ic_bgscanintvl = IEEE80211_BGSCAN_INTVAL_DEFAULT*hz; ic->ic_scanvalid = IEEE80211_SCAN_VALID_DEFAULT*hz; @@ -610,6 +615,73 @@ } /* + * Public access to scan_next for drivers that manage + * scanning themselves (e.g. for firmware-based devices). + */ +void +ieee80211_scan_next(struct ieee80211com *ic) +{ + /* + * XXX: We might need/want to decouple context here by either: + * callout_reset(&SCAN_PRIVATE(ss)->ss_scan_timer, 0, scan_next, ss); + * or using a taskqueue. Let's see what kind of problems direct + * dispatch has for now. + */ + scan_next(ic->ic_scan); +} + +/* + * Scan curchan. If this is an active scan and the channel + * is not marked passive then send probe request frame(s). + * Arrange for the channel change after maxdwell ticks. + */ +static void +scan_curchan(struct ieee80211com *ic, unsigned long maxdwell) +{ + struct ieee80211_scan_state *ss = ic->ic_scan; + + if ((ss->ss_flags & IEEE80211_SCAN_ACTIVE) && + (ic->ic_curchan->ic_flags & IEEE80211_CHAN_PASSIVE) == 0) { + struct ifnet *ifp = ic->ic_ifp; + int i; + + /* + * Send a broadcast probe request followed by + * any specified directed probe requests. + * XXX suppress broadcast probe req? + * XXX remove dependence on ic/ic->ic_bss + * XXX move to policy code? + */ + ieee80211_send_probereq(ic->ic_bss, + ic->ic_myaddr, ifp->if_broadcastaddr, + ifp->if_broadcastaddr, + "", 0, + ic->ic_opt_ie, ic->ic_opt_ie_len); + for (i = 0; i < ss->ss_nssid; i++) + ieee80211_send_probereq(ic->ic_bss, + ic->ic_myaddr, ifp->if_broadcastaddr, + ifp->if_broadcastaddr, + ss->ss_ssid[i].ssid, + ss->ss_ssid[i].len, + ic->ic_opt_ie, ic->ic_opt_ie_len); + } + callout_reset(&SCAN_PRIVATE(ss)->ss_scan_timer, + maxdwell, scan_next, ss); +} + +/* + * Handle mindwell requirements completed; initiate a channel + * change to the next channel asap. + */ +static void +scan_mindwell(struct ieee80211com *ic) +{ + struct ieee80211_scan_state *ss = ic->ic_scan; + + callout_reset(&SCAN_PRIVATE(ss)->ss_scan_timer, 0, scan_next, ss); +} + +/* * Switch to the next channel marked for scanning. */ static void @@ -620,7 +692,7 @@ struct ieee80211com *ic = ss->ss_ic; struct ieee80211_channel *chan; unsigned long maxdwell, scanend; - int scanning, scandone, i; + int scanning, scandone; IEEE80211_LOCK(ic); scanning = (ic->ic_flags & IEEE80211_F_SCAN) != 0; @@ -663,36 +735,15 @@ change_channel(ic, chan); /* - * If doing an active scan and the channel is not - * marked passive-only then send a probe request. - * Otherwise just listen for traffic on the channel. + * Scan curchan. Drivers for "intelligent hardware" + * override ic_scan_curchan to tell the device to do + * the work. Otherwise we manage the work outselves; + * sending a probe request (as needed), and arming the + * timeout to switch channels after maxdwell ticks. */ - if ((ss->ss_flags & IEEE80211_SCAN_ACTIVE) && - (chan->ic_flags & IEEE80211_CHAN_PASSIVE) == 0) { - struct ifnet *ifp = ic->ic_ifp; - /* - * Send a broadcast probe request followed by - * any specified directed probe requests. - * XXX suppress broadcast probe req? - * XXX remove dependence on ic/ic->ic_bss - * XXX move to policy code? - */ - ieee80211_send_probereq(ic->ic_bss, - ic->ic_myaddr, ifp->if_broadcastaddr, - ifp->if_broadcastaddr, - "", 0, - ic->ic_opt_ie, ic->ic_opt_ie_len); - for (i = 0; i < ss->ss_nssid; i++) - ieee80211_send_probereq(ic->ic_bss, - ic->ic_myaddr, ifp->if_broadcastaddr, - ifp->if_broadcastaddr, - ss->ss_ssid[i].ssid, - ss->ss_ssid[i].len, - ic->ic_opt_ie, ic->ic_opt_ie_len); - } + ic->ic_scan_curchan(ic, maxdwell); + SCAN_PRIVATE(ss)->ss_chanmindwell = ticks + ss->ss_mindwell; - callout_reset(&SCAN_PRIVATE(ss)->ss_scan_timer, - maxdwell, scan_next, ss); /* clear mindwell lock and initial channel change flush */ SCAN_PRIVATE(ss)->ss_iflags &= ~ISCAN_REP; } else { @@ -861,9 +912,11 @@ #else SCAN_PRIVATE(ss)->ss_iflags |= ISCAN_DISCARD; #endif - /* NB: trigger at next clock tick */ - callout_reset(&SCAN_PRIVATE(ss)->ss_scan_timer, - 0, scan_next, ss); + /* + * NB: trigger at next clock tick or wait for the + * hardware + */ + ic->ic_scan_mindwell(ic); } } } ==== //depot/projects/wifi/sys/net80211/ieee80211_scan.h#6 (text+ko) ==== @@ -88,6 +88,7 @@ u_int nssid, const struct ieee80211_scan_ssid ssids[]); int ieee80211_bg_scan(struct ieee80211com *); void ieee80211_cancel_scan(struct ieee80211com *); +void ieee80211_scan_next(struct ieee80211com *); struct ieee80211_scanparams; void ieee80211_add_scan(struct ieee80211com *, ==== //depot/projects/wifi/sys/net80211/ieee80211_var.h#52 (text+ko) ==== @@ -249,6 +249,9 @@ void (*ic_scan_start)(struct ieee80211com *); void (*ic_scan_end)(struct ieee80211com *); void (*ic_set_channel)(struct ieee80211com *); + void (*ic_scan_curchan)(struct ieee80211com *, + unsigned long); + void (*ic_scan_mindwell)(struct ieee80211com *); /* per-vap eventually... */ int (*ic_newstate)(struct ieee80211com *, enum ieee80211_state, int);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200703241557.l2OFvGu2034274>