From owner-svn-src-user@FreeBSD.ORG Wed Apr 15 17:05:20 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E131F1065675; Wed, 15 Apr 2009 17:05:20 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CEACB8FC0A; Wed, 15 Apr 2009 17:05:20 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3FH5KnN048751; Wed, 15 Apr 2009 17:05:20 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3FH5Klp048743; Wed, 15 Apr 2009 17:05:20 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200904151705.n3FH5Klp048743@svn.freebsd.org> From: Andrew Thompson Date: Wed, 15 Apr 2009 17:05:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191108 - in user/thompsa/vaptq/sys/dev: if_ndis ipw iwi iwn X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Apr 2009 17:05:21 -0000 Author: thompsa Date: Wed Apr 15 17:05:20 2009 New Revision: 191108 URL: http://svn.freebsd.org/changeset/base/191108 Log: Remove the deferral of scanning calls now that it can sleep. Modified: user/thompsa/vaptq/sys/dev/if_ndis/if_ndis.c user/thompsa/vaptq/sys/dev/if_ndis/if_ndisvar.h user/thompsa/vaptq/sys/dev/ipw/if_ipw.c user/thompsa/vaptq/sys/dev/ipw/if_ipwvar.h user/thompsa/vaptq/sys/dev/iwi/if_iwi.c user/thompsa/vaptq/sys/dev/iwi/if_iwivar.h user/thompsa/vaptq/sys/dev/iwn/if_iwn.c user/thompsa/vaptq/sys/dev/iwn/if_iwnvar.h Modified: user/thompsa/vaptq/sys/dev/if_ndis/if_ndis.c ============================================================================== --- user/thompsa/vaptq/sys/dev/if_ndis/if_ndis.c Wed Apr 15 16:36:13 2009 (r191107) +++ user/thompsa/vaptq/sys/dev/if_ndis/if_ndis.c Wed Apr 15 17:05:20 2009 (r191108) @@ -50,7 +50,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include @@ -173,7 +172,7 @@ static int ndis_newstate (struct ieee802 int); static int ndis_nettype_chan (uint32_t); static int ndis_nettype_mode (uint32_t); -static void ndis_scan (void *, int); +static void ndis_scan (void *); static void ndis_scan_results (struct ndis_softc *); static void ndis_scan_start (struct ieee80211com *); static void ndis_scan_end (struct ieee80211com *); @@ -739,11 +738,7 @@ ndis_attach(dev) uint32_t arg; int r; - sc->ndis_tq = taskqueue_create("nids_taskq", M_NOWAIT | M_ZERO, - taskqueue_thread_enqueue, &sc->ndis_tq); - taskqueue_start_threads(&sc->ndis_tq, 1, PI_NET, "%s taskq", - device_get_nameunit(dev)); - TASK_INIT(&sc->ndis_scantask, 0, ndis_scan, sc); + callout_init(&sc->ndis_scan_callout, CALLOUT_MPSAFE); ifp->if_ioctl = ndis_ioctl_80211; ic->ic_ifp = ifp; @@ -1050,10 +1045,6 @@ ndis_detach(dev) } else NDIS_UNLOCK(sc); - if (sc->ndis_80211) { - taskqueue_drain(sc->ndis_tq, &sc->ndis_scantask); - } - if (sc->ndis_tickitem != NULL) IoFreeWorkItem(sc->ndis_tickitem); if (sc->ndis_startitem != NULL) @@ -1115,8 +1106,6 @@ ndis_detach(dev) if (sc->ndis_iftype == PCIBus) bus_dma_tag_destroy(sc->ndis_parent_tag); - if (sc->ndis_80211) - taskqueue_free(sc->ndis_tq); return(0); } @@ -3289,54 +3278,18 @@ ndis_newstate(struct ieee80211vap *vap, } static void -ndis_scan(void *arg, int npending) +ndis_scan(void *arg) { struct ndis_softc *sc = arg; struct ieee80211com *ic; struct ieee80211vap *vap; - struct ieee80211_scan_state *ss; - ndis_80211_ssid ssid; - int error, len; ic = sc->ifp->if_l2com; - ss = ic->ic_scan; vap = TAILQ_FIRST(&ic->ic_vaps); - if (!NDIS_INITIALIZED(sc)) { - DPRINTF(("%s: scan aborted\n", __func__)); - ieee80211_cancel_scan(vap); - return; - } - - len = sizeof(ssid); - bzero((char *)&ssid, len); - if (ss->ss_nssid == 0) - ssid.ns_ssidlen = 1; - else { - /* Perform a directed scan */ - ssid.ns_ssidlen = ss->ss_ssid[0].len; - bcopy(ss->ss_ssid[0].ssid, ssid.ns_ssid, ssid.ns_ssidlen); - } - - error = ndis_set_info(sc, OID_802_11_SSID, &ssid, &len); - if (error) - DPRINTF(("%s: set ESSID failed\n", __func__)); - - len = 0; - error = ndis_set_info(sc, OID_802_11_BSSID_LIST_SCAN, - NULL, &len); - if (error) { - DPRINTF(("%s: scan command failed\n", __func__)); - ieee80211_cancel_scan(vap); - return; - } - - pause("ssidscan", hz * 3); - if (!NDIS_INITIALIZED(sc)) - /* The interface was downed while we were sleeping */ - return; - + NDIS_LOCK(sc); ndis_scan_results(sc); + NDIS_UNLOCK(sc); ieee80211_scan_done(vap); } @@ -3467,8 +3420,48 @@ ndis_scan_start(struct ieee80211com *ic) { struct ifnet *ifp = ic->ic_ifp; struct ndis_softc *sc = ifp->if_softc; + struct ieee80211vap *vap; + struct ieee80211_scan_state *ss; + ndis_80211_ssid ssid; + int error, len; + + ss = ic->ic_scan; + vap = TAILQ_FIRST(&ic->ic_vaps); + + NDIS_LOCK(sc); + if (!NDIS_INITIALIZED(sc)) { + DPRINTF(("%s: scan aborted\n", __func__)); + NDIS_UNLOCK(sc); + ieee80211_cancel_scan(vap); + return; + } + + len = sizeof(ssid); + bzero((char *)&ssid, len); + if (ss->ss_nssid == 0) + ssid.ns_ssidlen = 1; + else { + /* Perform a directed scan */ + ssid.ns_ssidlen = ss->ss_ssid[0].len; + bcopy(ss->ss_ssid[0].ssid, ssid.ns_ssid, ssid.ns_ssidlen); + } + + error = ndis_set_info(sc, OID_802_11_SSID, &ssid, &len); + if (error) + DPRINTF(("%s: set ESSID failed\n", __func__)); - taskqueue_enqueue(sc->ndis_tq, &sc->ndis_scantask); + len = 0; + error = ndis_set_info(sc, OID_802_11_BSSID_LIST_SCAN, + NULL, &len); + if (error) { + DPRINTF(("%s: scan command failed\n", __func__)); + NDIS_UNLOCK(sc); + ieee80211_cancel_scan(vap); + return; + } + NDIS_UNLOCK(sc); + /* Set a timer to collect the results */ + callout_reset(&sc->ndis_scan_callout, hz * 3, ndis_scan, sc); } static void Modified: user/thompsa/vaptq/sys/dev/if_ndis/if_ndisvar.h ============================================================================== --- user/thompsa/vaptq/sys/dev/if_ndis/if_ndisvar.h Wed Apr 15 16:36:13 2009 (r191107) +++ user/thompsa/vaptq/sys/dev/if_ndis/if_ndisvar.h Wed Apr 15 17:05:20 2009 (r191108) @@ -180,6 +180,7 @@ struct ndis_softc { ndis_miniport_block *ndis_block; ndis_miniport_characteristics *ndis_chars; interface_type ndis_type; + struct callout ndis_scan_callout; struct callout ndis_stat_callout; int ndis_maxpkts; ndis_oid *ndis_oids; @@ -219,8 +220,6 @@ struct ndis_softc { struct ifqueue ndis_rxqueue; kspin_lock ndis_rxlock; - struct taskqueue *ndis_tq; /* private task queue */ - struct task ndis_scantask; int (*ndis_newstate)(struct ieee80211com *, enum ieee80211_state, int); int ndis_tx_timer; Modified: user/thompsa/vaptq/sys/dev/ipw/if_ipw.c ============================================================================== --- user/thompsa/vaptq/sys/dev/ipw/if_ipw.c Wed Apr 15 16:36:13 2009 (r191107) +++ user/thompsa/vaptq/sys/dev/ipw/if_ipw.c Wed Apr 15 17:05:20 2009 (r191108) @@ -120,7 +120,6 @@ static uint16_t ipw_read_prom_word(struc static void ipw_rx_cmd_intr(struct ipw_softc *, struct ipw_soft_buf *); static void ipw_assocsuccess(void *, int); static void ipw_assocfailed(void *, int); -static void ipw_scandone(void *, int); static void ipw_bmiss(void *, int); static void ipw_rx_newstate_intr(struct ipw_softc *, struct ipw_soft_buf *); static void ipw_rx_data_intr(struct ipw_softc *, struct ipw_status *, @@ -166,7 +165,6 @@ static void ipw_read_mem_1(struct ipw_so #endif static void ipw_write_mem_1(struct ipw_softc *, bus_size_t, const uint8_t *, bus_size_t); -static void ipw_scan_task(void *, int); static int ipw_scan(struct ipw_softc *); static void ipw_scan_start(struct ieee80211com *); static void ipw_scan_end(struct ieee80211com *); @@ -239,7 +237,6 @@ ipw_attach(device_t dev) MTX_DEF | MTX_RECURSE); TASK_INIT(&sc->sc_init_task, 0, ipw_init_task, sc); - TASK_INIT(&sc->sc_scan_task, 0, ipw_scan_task, sc); TASK_INIT(&sc->sc_bmiss_task, 0, ipw_bmiss, sc); callout_init_mtx(&sc->sc_wdtimer, &sc->sc_mtx, 0); @@ -418,7 +415,6 @@ ipw_detach(device_t dev) callout_drain(&sc->sc_wdtimer); taskqueue_drain(taskqueue_fast, &sc->sc_init_task); - taskqueue_drain(taskqueue_fast, &sc->sc_scan_task); taskqueue_drain(taskqueue_fast, &sc->sc_bmiss_task); ipw_release(sc); @@ -513,7 +509,6 @@ ipw_vap_create(struct ieee80211com *ic, TASK_INIT(&ivp->assoc_success_task, 0, ipw_assocsuccess, vap); TASK_INIT(&ivp->assoc_failed_task, 0, ipw_assocfailed, vap); - TASK_INIT(&ivp->scandone_task, 0, ipw_scandone, vap); ieee80211_vap_setup(ic, vap, name, unit, opmode, flags, bssid, mac); /* override with driver methods */ @@ -1032,14 +1027,6 @@ ipw_assocfailed(void *arg, int npending) } static void -ipw_scandone(void *arg, int npending) -{ - struct ieee80211vap *vap = arg; - - ieee80211_scan_done(vap); -} - -static void ipw_bmiss(void *arg, int npending) { struct ieee80211com *ic = arg; @@ -1106,8 +1093,7 @@ ipw_rx_newstate_intr(struct ipw_softc *s break; } if (sc->flags & IPW_FLAG_SCANNING) { - taskqueue_enqueue(taskqueue_swi, - &IPW_VAP(vap)->scandone_task); + ieee80211_scan_done(vap); sc->flags &= ~IPW_FLAG_SCANNING; sc->sc_scan_timer = 0; } @@ -2177,20 +2163,6 @@ ipw_setscanopts(struct ipw_softc *sc, ui return ipw_cmd(sc, IPW_CMD_SET_SCAN_OPTIONS, &opts, sizeof(opts)); } -/* - * Handler for sc_scan_task. This is a simple wrapper around ipw_scan(). - */ -static void -ipw_scan_task(void *context, int pending) -{ - struct ipw_softc *sc = context; - IPW_LOCK_DECL; - - IPW_LOCK(sc); - ipw_scan(sc); - IPW_UNLOCK(sc); -} - static int ipw_scan(struct ipw_softc *sc) { @@ -2722,8 +2694,7 @@ ipw_scan_start(struct ieee80211com *ic) IPW_LOCK_DECL; IPW_LOCK(sc); - if (!(sc->flags & IPW_FLAG_SCANNING)) - taskqueue_enqueue(taskqueue_swi, &sc->sc_scan_task); + ipw_scan(sc); IPW_UNLOCK(sc); } Modified: user/thompsa/vaptq/sys/dev/ipw/if_ipwvar.h ============================================================================== --- user/thompsa/vaptq/sys/dev/ipw/if_ipwvar.h Wed Apr 15 16:36:13 2009 (r191107) +++ user/thompsa/vaptq/sys/dev/ipw/if_ipwvar.h Wed Apr 15 17:05:20 2009 (r191108) @@ -80,7 +80,6 @@ struct ipw_vap { struct ieee80211vap vap; struct task assoc_success_task; struct task assoc_failed_task; - struct task scandone_task; int (*newstate)(struct ieee80211vap *, enum ieee80211_state, int); @@ -93,8 +92,6 @@ struct ipw_softc { struct mtx sc_mtx; struct task sc_init_task; - struct task sc_scan_task; - struct task sc_chan_task; struct task sc_bmiss_task; struct callout sc_wdtimer; /* watchdog timer */ Modified: user/thompsa/vaptq/sys/dev/iwi/if_iwi.c ============================================================================== --- user/thompsa/vaptq/sys/dev/iwi/if_iwi.c Wed Apr 15 16:36:13 2009 (r191107) +++ user/thompsa/vaptq/sys/dev/iwi/if_iwi.c Wed Apr 15 17:05:20 2009 (r191108) @@ -186,12 +186,8 @@ static void iwi_put_firmware(struct iwi_ 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_scanabort(void *, int); static void iwi_set_channel(struct ieee80211com *); static void iwi_scan_curchan(struct ieee80211_scan_state *, unsigned long maxdwell); -#if 0 -static void iwi_scan_allchan(struct ieee80211com *, unsigned long maxdwell); -#endif static void iwi_scan_mindwell(struct ieee80211_scan_state *); static void iwi_ops(void *, int); static int iwi_queue_cmd(struct iwi_softc *, int, unsigned long); @@ -309,7 +305,6 @@ iwi_attach(device_t dev) TASK_INIT(&sc->sc_radiofftask, 0, iwi_radio_off, sc); TASK_INIT(&sc->sc_restarttask, 0, iwi_restart, sc); TASK_INIT(&sc->sc_opstask, 0, iwi_ops, sc); - TASK_INIT(&sc->sc_scanaborttask, 0, iwi_scanabort, sc); callout_init_mtx(&sc->sc_wdtimer, &sc->sc_mtx, 0); callout_init_mtx(&sc->sc_rftimer, &sc->sc_mtx, 0); @@ -2666,7 +2661,7 @@ scan_band(const struct ieee80211_channel * Start a scan on the current channel or all channels. */ static int -iwi_scanchan(struct iwi_softc *sc, unsigned long maxdwell, int mode) +iwi_scanchan(struct iwi_softc *sc, unsigned long maxdwell, int allchan) { struct ieee80211com *ic; struct ieee80211_channel *chan; @@ -2713,7 +2708,7 @@ iwi_scanchan(struct iwi_softc *sc, unsig return (error); } - if (mode == IWI_SCAN_ALLCHAN) { + if (allchan) { int i, next, band, b, bstart; /* * Convert scan list to run-length encoded channel list @@ -2782,20 +2777,6 @@ iwi_scanchan(struct iwi_softc *sc, unsig return (iwi_cmd(sc, IWI_CMD_SCAN_EXT, &scan, sizeof scan)); } -static void -iwi_scanabort(void *arg, int npending) -{ - struct iwi_softc *sc = arg; - IWI_LOCK_DECL; - - IWI_LOCK(sc); - sc->flags &= ~IWI_FLAG_CHANNEL_SCAN; - /* NB: make sure we're still scanning */ - if (sc->fw_state == IWI_FW_SCANNING) - iwi_cmd(sc, IWI_CMD_ABORT_SCAN, NULL, 0); - IWI_UNLOCK(sc); -} - static int iwi_set_sensitivity(struct iwi_softc *sc, int8_t rssi_dbm) { @@ -3538,11 +3519,7 @@ iwi_ops(void *arg0, int npending) { static const char *opnames[] = { [IWI_CMD_FREE] = "FREE", - [IWI_SCAN_START] = "SCAN_START", - [IWI_SET_CHANNEL] = "SET_CHANNEL", [IWI_DISASSOC] = "DISASSOC", - [IWI_SCAN_CURCHAN] = "SCAN_CURCHAN", - [IWI_SCAN_ALLCHAN] = "SCAN_ALLCHAN", [IWI_SET_WME] = "SET_WME", }; struct iwi_softc *sc = arg0; @@ -3585,21 +3562,7 @@ again: if (vap->iv_state == IEEE80211_S_RUN) (void) iwi_wme_setparams(sc, ic); break; - case IWI_SCAN_START: - sc->flags |= IWI_FLAG_CHANNEL_SCAN; - 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__)); - goto done; - } - if (iwi_scanchan(sc, arg, cmd)) - ieee80211_cancel_scan(vap); - break; } -done: IWI_UNLOCK(sc); /* Take another pass */ @@ -3627,10 +3590,7 @@ iwi_queue_cmd(struct iwi_softc *sc, int static void iwi_scan_start(struct ieee80211com *ic) { - struct ifnet *ifp = ic->ic_ifp; - struct iwi_softc *sc = ifp->if_softc; - - iwi_queue_cmd(sc, IWI_SCAN_START, 0); + /* ignore */ } static void @@ -3648,20 +3608,13 @@ iwi_scan_curchan(struct ieee80211_scan_s struct ieee80211vap *vap = ss->ss_vap; struct ifnet *ifp = vap->iv_ic->ic_ifp; struct iwi_softc *sc = ifp->if_softc; + IWI_LOCK_DECL; - iwi_queue_cmd(sc, IWI_SCAN_CURCHAN, maxdwell); -} - -#if 0 -static void -iwi_scan_allchan(struct ieee80211com *ic, unsigned long maxdwell) -{ - struct ifnet *ifp = ic->ic_ifp; - struct iwi_softc *sc = ifp->if_softc; - - iwi_queue_cmd(sc, IWI_SCAN_ALLCHAN, maxdwell); + IWI_LOCK(sc); + if (iwi_scanchan(sc, maxdwell, 0)) + ieee80211_cancel_scan(vap); + IWI_UNLOCK(sc); } -#endif static void iwi_scan_mindwell(struct ieee80211_scan_state *ss) @@ -3674,6 +3627,12 @@ iwi_scan_end(struct ieee80211com *ic) { struct ifnet *ifp = ic->ic_ifp; struct iwi_softc *sc = ifp->if_softc; + IWI_LOCK_DECL; - taskqueue_enqueue(sc->sc_tq2, &sc->sc_scanaborttask); + IWI_LOCK(sc); + sc->flags &= ~IWI_FLAG_CHANNEL_SCAN; + /* NB: make sure we're still scanning */ + if (sc->fw_state == IWI_FW_SCANNING) + iwi_cmd(sc, IWI_CMD_ABORT_SCAN, NULL, 0); + IWI_UNLOCK(sc); } Modified: user/thompsa/vaptq/sys/dev/iwi/if_iwivar.h ============================================================================== --- user/thompsa/vaptq/sys/dev/iwi/if_iwivar.h Wed Apr 15 16:36:13 2009 (r191107) +++ user/thompsa/vaptq/sys/dev/iwi/if_iwivar.h Wed Apr 15 17:05:20 2009 (r191108) @@ -195,7 +195,6 @@ struct iwi_softc { struct task sc_radiontask; /* radio on processing */ struct task sc_radiofftask; /* radio off processing */ - struct task sc_scanaborttask; /* cancel active scan */ struct task sc_restarttask; /* restart adapter processing */ struct task sc_opstask; /* scan / auth processing */ @@ -225,12 +224,8 @@ struct iwi_softc { int sc_cmd_cur; /* current queued scan task */ int sc_cmd_next; /* last queued scan task */ #define IWI_CMD_FREE 0 /* for marking slots unused */ -#define IWI_SCAN_START 1 -#define IWI_SET_CHANNEL 2 -#define IWI_DISASSOC 3 -#define IWI_SCAN_CURCHAN 4 -#define IWI_SCAN_ALLCHAN 5 -#define IWI_SET_WME 6 +#define IWI_DISASSOC 1 +#define IWI_SET_WME 2 struct iwi_rx_radiotap_header sc_rxtap; int sc_rxtap_len; Modified: user/thompsa/vaptq/sys/dev/iwn/if_iwn.c ============================================================================== --- user/thompsa/vaptq/sys/dev/iwn/if_iwn.c Wed Apr 15 16:36:13 2009 (r191107) +++ user/thompsa/vaptq/sys/dev/iwn/if_iwn.c Wed Apr 15 17:05:20 2009 (r191108) @@ -1774,7 +1774,7 @@ iwn_notif_intr(struct iwn_softc *sc) "scan finished nchan=%d status=%d chan=%d\n", scan->nchan, scan->status, scan->chan); - iwn_queue_cmd(sc, IWN_SCAN_NEXT, 0, IWN_QUEUE_NORMAL); + ieee80211_scan_next(vap); break; } } @@ -4300,7 +4300,10 @@ iwn_scan_start(struct ieee80211com *ic) struct ifnet *ifp = ic->ic_ifp; struct iwn_softc *sc = ifp->if_softc; - iwn_queue_cmd(sc, IWN_SCAN_START, 0, IWN_QUEUE_NORMAL); + IWN_LOCK(sc); + /* make the link LED blink while we're scanning */ + iwn_set_led(sc, IWN_LED_LINK, 20, 2); + IWN_UNLOCK(sc); } /* @@ -4309,10 +4312,7 @@ iwn_scan_start(struct ieee80211com *ic) static void iwn_scan_end(struct ieee80211com *ic) { - struct ifnet *ifp = ic->ic_ifp; - struct iwn_softc *sc = ifp->if_softc; - - iwn_queue_cmd(sc, IWN_SCAN_STOP, 0, IWN_QUEUE_NORMAL); + /* ignore */ } /* @@ -4323,15 +4323,29 @@ iwn_set_channel(struct ieee80211com *ic) { struct ifnet *ifp = ic->ic_ifp; struct iwn_softc *sc = ifp->if_softc; + struct ieee80211vap *vap; const struct ieee80211_channel *c = ic->ic_curchan; + int error; + + vap = TAILQ_FIRST(&ic->ic_vaps); /* XXX */ + IWN_LOCK(sc); if (c != sc->sc_curchan) { sc->sc_rxtap.wr_chan_freq = htole16(c->ic_freq); sc->sc_rxtap.wr_chan_flags = htole16(c->ic_flags); sc->sc_txtap.wt_chan_freq = htole16(c->ic_freq); sc->sc_txtap.wt_chan_flags = htole16(c->ic_flags); - iwn_queue_cmd(sc, IWN_SET_CHAN, 0, IWN_QUEUE_NORMAL); + + error = iwn_config(sc); + if (error != 0) { + DPRINTF(sc, IWN_DEBUG_STATE, + "%s: set chan failed, cancel scan\n", + __func__); + //XXX Handle failed scan correctly + ieee80211_cancel_scan(vap); + } } + IWN_UNLOCK(sc); } /* @@ -4342,8 +4356,13 @@ iwn_scan_curchan(struct ieee80211_scan_s { struct ieee80211vap *vap = ss->ss_vap; struct iwn_softc *sc = vap->iv_ic->ic_ifp->if_softc; + int error; - iwn_queue_cmd(sc, IWN_SCAN_CURCHAN, 0, IWN_QUEUE_NORMAL); + IWN_LOCK(sc); + error = iwn_scan(sc); + IWN_UNLOCK(sc); + if (error != 0) + ieee80211_cancel_scan(vap); } /* @@ -4367,7 +4386,7 @@ iwn_ops(void *arg0, int pending) struct ifnet *ifp = sc->sc_ifp; struct ieee80211com *ic = ifp->if_l2com; struct ieee80211vap *vap; - int cmd, arg, error; + int cmd, arg; for (;;) { IWN_CMD_LOCK(sc); @@ -4393,36 +4412,6 @@ iwn_ops(void *arg0, int pending) vap = TAILQ_FIRST(&ic->ic_vaps); /* XXX */ switch (cmd) { - case IWN_SCAN_START: - /* make the link LED blink while we're scanning */ - iwn_set_led(sc, IWN_LED_LINK, 20, 2); - break; - case IWN_SCAN_STOP: - break; - case IWN_SCAN_NEXT: - ieee80211_scan_next(vap); - break; - case IWN_SCAN_CURCHAN: - error = iwn_scan(sc); - if (error != 0) { - IWN_UNLOCK(sc); - ieee80211_cancel_scan(vap); - IWN_LOCK(sc); - return; - } - break; - case IWN_SET_CHAN: - error = iwn_config(sc); - if (error != 0) { - DPRINTF(sc, IWN_DEBUG_STATE, - "%s: set chan failed, cancel scan\n", - __func__); - IWN_UNLOCK(sc); - //XXX Handle failed scan correctly - ieee80211_cancel_scan(vap); - return; - } - break; case IWN_REINIT: IWN_UNLOCK(sc); iwn_init(sc); @@ -4512,11 +4501,6 @@ static const char * iwn_ops_str(int cmd) { switch (cmd) { - case IWN_SCAN_START: return "SCAN_START"; - case IWN_SCAN_CURCHAN: return "SCAN_CURCHAN"; - case IWN_SCAN_STOP: return "SCAN_STOP"; - case IWN_SET_CHAN: return "SET_CHAN"; - case IWN_SCAN_NEXT: return "SCAN_NEXT"; case IWN_RADIO_ENABLE: return "RADIO_ENABLE"; case IWN_RADIO_DISABLE: return "RADIO_DISABLE"; case IWN_REINIT: return "REINIT"; Modified: user/thompsa/vaptq/sys/dev/iwn/if_iwnvar.h ============================================================================== --- user/thompsa/vaptq/sys/dev/iwn/if_iwnvar.h Wed Apr 15 16:36:13 2009 (r191107) +++ user/thompsa/vaptq/sys/dev/iwn/if_iwnvar.h Wed Apr 15 17:05:20 2009 (r191108) @@ -181,22 +181,17 @@ struct iwn_softc { bus_size_t sc_sz; /* command queue related variables */ -#define IWN_SCAN_START (1<<0) -#define IWN_SCAN_CURCHAN (1<<1) -#define IWN_SCAN_STOP (1<<2) -#define IWN_SET_CHAN (1<<3) -#define IWN_SCAN_NEXT (1<<4) -#define IWN_RADIO_ENABLE (1<<5) -#define IWN_RADIO_DISABLE (1<<6) -#define IWN_REINIT (1<<7) +#define IWN_RADIO_ENABLE (1<<0) +#define IWN_RADIO_DISABLE (1<<1) +#define IWN_REINIT (1<<2) #define IWN_CMD_MAXOPS 10 /* command queuing request type */ #define IWN_QUEUE_NORMAL 0 #define IWN_QUEUE_CLEAR 1 int sc_cmd[IWN_CMD_MAXOPS]; int sc_cmd_arg[IWN_CMD_MAXOPS]; - int sc_cmd_cur; /* current queued scan task */ - int sc_cmd_next; /* last queued scan task */ + int sc_cmd_cur; /* current queued task */ + int sc_cmd_next; /* last queued task */ struct mtx sc_cmdlock; /* Task queues used to control the driver */