From owner-p4-projects@FreeBSD.ORG Thu May 31 08:34:06 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 7FAC616A468; Thu, 31 May 2007 08:34:06 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3E6B416A421 for ; Thu, 31 May 2007 08:34:06 +0000 (UTC) (envelope-from thompsa@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id 2EB4F13C45D for ; Thu, 31 May 2007 08:34:06 +0000 (UTC) (envelope-from thompsa@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.8/8.13.8) with ESMTP id l4V8Y6CG079686 for ; Thu, 31 May 2007 08:34:06 GMT (envelope-from thompsa@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.8/8.13.8/Submit) id l4V8Y5It079673 for perforce@freebsd.org; Thu, 31 May 2007 08:34:05 GMT (envelope-from thompsa@freebsd.org) Date: Thu, 31 May 2007 08:34:05 GMT Message-Id: <200705310834.l4V8Y5It079673@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to thompsa@freebsd.org using -f From: Andrew Thompson To: Perforce Change Reviews Cc: Subject: PERFORCE change 120650 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 May 2007 08:34:06 -0000 http://perforce.freebsd.org/chv.cgi?CH=120650 Change 120650 by thompsa@thompsa_heff on 2007/05/31 08:33:19 Add support for scanning all channels at once. Affected files ... .. //depot/projects/wifi/sys/dev/iwi/if_iwi.c#33 edit Differences ... ==== //depot/projects/wifi/sys/dev/iwi/if_iwi.c#33 (text+ko) ==== @@ -162,11 +162,12 @@ static int iwi_config(struct iwi_softc *); static int iwi_get_firmware(struct iwi_softc *); static void iwi_put_firmware(struct iwi_softc *); -static int iwi_scanchan(struct iwi_softc *, unsigned long); +static int iwi_scanchan(struct iwi_softc *, unsigned long, int); static void iwi_scan_start(struct ieee80211com *); static void iwi_scan_end(struct ieee80211com *); static void iwi_set_channel(struct ieee80211com *); static void iwi_scan_curchan(struct ieee80211com *, unsigned long maxdwell); +static void iwi_scan_allchan(struct ieee80211com *, unsigned long maxdwell); static void iwi_scan_mindwell(struct ieee80211com *); static void iwi_assoc(struct ieee80211com *ic); static void iwi_ops(void *, int); @@ -1376,9 +1377,12 @@ switch (notif->type) { case IWI_NOTIF_TYPE_SCAN_CHANNEL: chan = (struct iwi_notif_scan_channel *)(notif + 1); - + DPRINTFN(3, ("Scan of channel %u complete (%u)\n", ic->ic_channels[chan->nchan].ic_freq, chan->nchan)); + + /* Reset the timer, the scan is still going */ + sc->sc_scan_timer = 3; break; case IWI_NOTIF_TYPE_SCAN_COMPLETE: @@ -2654,13 +2658,14 @@ * Scan on ic_curchan according to ic_scan (essid, active/passive, dwell ...) */ static int -iwi_scanchan(struct iwi_softc *sc, unsigned long maxdwell) +iwi_scanchan(struct iwi_softc *sc, unsigned long maxdwell, int mode) { struct ieee80211com *ic; struct ieee80211_channel *chan; struct ieee80211_scan_state *ss; struct iwi_scan_ext scan; int error = 0; + int i, type; IWI_LOCK_CHECK(sc); if (sc->flags & IWI_FLAG_SCANNING) { @@ -2682,25 +2687,37 @@ scan.dwell_time[IWI_SCAN_TYPE_BROADCAST] = htole16(maxdwell); scan.dwell_time[IWI_SCAN_TYPE_BDIRECTED] = htole16(maxdwell); - if (IEEE80211_IS_CHAN_5GHZ(chan)) - scan.channels[0] = 1 | IWI_CHAN_5GHZ; - else - scan.channels[0] = 1 | IWI_CHAN_2GHZ; - scan.channels[1] = ieee80211_chan2ieee(ic, chan); /* We can only set one essid for a directed scan */ if (ss->ss_nssid != 0) { - set_scan_type(&scan, 1, IWI_SCAN_TYPE_BDIRECTED); + type = IWI_SCAN_TYPE_BDIRECTED; error = iwi_cmd(sc, IWI_CMD_SET_ESSID, ss->ss_ssid[0].ssid, ss->ss_ssid[0].len); if (error) return (error); } else if ((ss->ss_flags & IEEE80211_SCAN_ACTIVE) && (chan->ic_flags & IEEE80211_CHAN_PASSIVE) == 0) { - set_scan_type(&scan, 1, IWI_SCAN_TYPE_BROADCAST); + type = IWI_SCAN_TYPE_BROADCAST; } else - set_scan_type(&scan, 1, IWI_SCAN_TYPE_PASSIVE); + type = IWI_SCAN_TYPE_PASSIVE; + + if (mode == IWI_SCAN_ALLCHAN) { + for (i = 0; i < ss->ss_last;) { + chan = ss->ss_chans[i]; + scan.channels[++i] = ieee80211_chan2ieee(ic, chan); + set_scan_type(&scan, i, type); + } + } else { + /* Scan the current channel only */ + i = 1; + scan.channels[i] = ieee80211_chan2ieee(ic, chan); + set_scan_type(&scan, i, type); + } + if (IEEE80211_IS_CHAN_5GHZ(chan)) + scan.channels[0] = i | IWI_CHAN_5GHZ; + else + scan.channels[0] = i | IWI_CHAN_2GHZ; - DPRINTF(("Scanning on channel %u\n", ieee80211_chan2ieee(ic, chan))); + DPRINTF(("Scanning on %d channel(s)\n", i)); sc->flags |= IWI_FLAG_SCANNING; sc->sc_scan_timer = 3; sc->sc_ifp->if_timer = 1; @@ -3443,13 +3460,14 @@ iwi_cmd(sc, IWI_CMD_ABORT_SCAN, NULL, 0); break; case IWI_SCAN_CURCHAN: + case IWI_SCAN_ALLCHAN: if (!(sc->flags & IWI_FLAG_CHANNEL_SCAN)) { DPRINTF(("%s: ic_scan_curchan while not scanning\n", __func__)); IWI_UNLOCK(sc); return; } - if (iwi_scanchan(sc, sc->sc_maxdwell)) + if (iwi_scanchan(sc, sc->sc_maxdwell, sc->sc_scanop)) ieee80211_cancel_scan(ic); break; @@ -3466,7 +3484,6 @@ sc->sc_scanop = IWI_SCAN_START; taskqueue_enqueue(sc->sc_tq, &sc->sc_opstask); - } static void @@ -3490,6 +3507,17 @@ } static void +iwi_scan_allchan(struct ieee80211com *ic, unsigned long maxdwell) +{ + struct ifnet *ifp = ic->ic_ifp; + struct iwi_softc *sc = ifp->if_softc; + + sc->sc_scanop = IWI_SCAN_ALLCHAN; + sc->sc_maxdwell = maxdwell; + taskqueue_enqueue(sc->sc_tq, &sc->sc_opstask); +} + +static void iwi_scan_mindwell(struct ieee80211com *ic) { /* NB: don't try to abort scan; wait for firmware to finish */