Date: Tue, 2 Jan 2007 02:41:28 GMT From: Kip Macy <kmacy@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 112409 for review Message-ID: <200701020241.l022fSAm071426@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=112409 Change 112409 by kmacy@kmacy_serendipity:sam_wifi on 2007/01/02 02:40:36 - use taskqueue to handle scanning actions to avoid issues with locking - scanning now works, but ural bails out under load complaining about not being able to read / write the MAC register - we may need an interlock between calls to the taskqueue Affected files ... .. //depot/projects/wifi/sys/dev/usb/if_ural.c#12 edit .. //depot/projects/wifi/sys/dev/usb/if_uralvar.h#7 edit Differences ... ==== //depot/projects/wifi/sys/dev/usb/if_ural.c#12 (text+ko) ==== @@ -112,6 +112,7 @@ static void ural_free_rx_list(struct ural_softc *); static int ural_media_change(struct ifnet *); static void ural_task(void *); +static void ural_scantask(void *); static int ural_newstate(struct ieee80211com *, enum ieee80211_state, int); static int ural_rxrate(struct ural_rx_desc *); @@ -425,6 +426,8 @@ MTX_DEF | MTX_RECURSE); usb_init_task(&sc->sc_task, ural_task, sc); + usb_init_task(&sc->sc_scantask, ural_scantask, sc); + callout_init(&sc->amrr_ch, 0); /* retrieve RT2570 rev. no */ @@ -791,6 +794,28 @@ sc->sc_newstate(ic, sc->sc_state, -1); } +static void +ural_scantask(void *arg) +{ + struct ural_softc *sc = arg; + struct ieee80211com *ic = &sc->sc_ic; + struct ifnet *ifp = ic->ic_ifp; + + if (sc->sc_scan_action == URAL_SCAN_START) { + /* abort TSF synchronization */ + ural_write(sc, RAL_TXRX_CSR19, 0); + ural_set_bssid(sc, ifp->if_broadcastaddr); + } else if (sc->sc_scan_action == URAL_SET_CHANNEL) { + mtx_lock(&Giant); + ural_set_chan(sc, ic->ic_curchan); + mtx_unlock(&Giant); + } else { + ural_enable_tsf_sync(sc); + /* XXX keep local copy */ + ural_set_bssid(sc, ic->ic_bss->ni_bssid); + } +} + static int ural_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg) { @@ -1732,34 +1757,40 @@ static void ural_scan_start(struct ieee80211com *ic) { - struct ifnet *ifp = ic->ic_ifp; - struct ural_softc *sc = ifp->if_softc; + struct ural_softc *sc = ic->ic_ifp->if_softc; + + usb_rem_task(sc->sc_udev, &sc->sc_scantask); + + /* do it in a process context */ + sc->sc_scan_action = URAL_SCAN_START; + usb_add_task(sc->sc_udev, &sc->sc_scantask, USB_TASKQ_DRIVER); - /* abort TSF synchronization */ - ural_write(sc, RAL_TXRX_CSR19, 0); - ural_set_bssid(sc, ifp->if_broadcastaddr); } static void ural_scan_end(struct ieee80211com *ic) { - struct ifnet *ifp = ic->ic_ifp; - struct ural_softc *sc = ifp->if_softc; + struct ural_softc *sc = ic->ic_ifp->if_softc; + + usb_rem_task(sc->sc_udev, &sc->sc_scantask); + + /* do it in a process context */ + sc->sc_scan_action = URAL_SCAN_END; + usb_add_task(sc->sc_udev, &sc->sc_scantask, USB_TASKQ_DRIVER); - ural_enable_tsf_sync(sc); - /* XXX keep local copy */ - ural_set_bssid(sc, ic->ic_bss->ni_bssid); } static void ural_set_channel(struct ieee80211com *ic) { - struct ifnet *ifp = ic->ic_ifp; - struct ural_softc *sc = ifp->if_softc; + + struct ural_softc *sc = ic->ic_ifp->if_softc; + + usb_rem_task(sc->sc_udev, &sc->sc_scantask); - mtx_lock(&Giant); - ural_set_chan(sc, ic->ic_curchan); - mtx_unlock(&Giant); + /* do it in a process context */ + sc->sc_scan_action = URAL_SET_CHANNEL; + usb_add_task(sc->sc_udev, &sc->sc_scantask, USB_TASKQ_DRIVER); } static void ==== //depot/projects/wifi/sys/dev/usb/if_uralvar.h#7 (text+ko) ==== @@ -20,6 +20,11 @@ #define RAL_RX_LIST_COUNT 1 #define RAL_TX_LIST_COUNT 1 +#define URAL_SCAN_START 1 +#define URAL_SCAN_END 2 +#define URAL_SET_CHANNEL 3 + + struct ural_rx_radiotap_header { struct ieee80211_radiotap_header wr_ihdr; uint8_t wr_flags; @@ -98,7 +103,9 @@ usbd_pipe_handle sc_tx_pipeh; enum ieee80211_state sc_state; + int sc_scan_action; /* should be an enum */ struct usb_task sc_task; + struct usb_task sc_scantask; struct ural_amrr amrr;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200701020241.l022fSAm071426>