From be3decb79f61298da7998be016a4b268b0d7ef66 Mon Sep 17 00:00:00 2001 From: sam Date: Sat, 9 May 2009 19:22:37 +0000 Subject: push wme parameter setting to the taskq thread; the update callback from net80211 can happen from the ithread and submitting the fw cmd requires a sleepable context --- sys/dev/iwi/if_iwi.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'sys/dev/iwi/if_iwi.c') diff --git a/sys/dev/iwi/if_iwi.c b/sys/dev/iwi/if_iwi.c index b04403b..6513522 100644 --- a/sys/dev/iwi/if_iwi.c +++ b/sys/dev/iwi/if_iwi.c @@ -53,7 +53,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -154,6 +153,7 @@ static void iwi_media_status(struct ifnet *, struct ifmediareq *); static int iwi_newstate(struct ieee80211vap *, enum ieee80211_state, int); static void iwi_wme_init(struct iwi_softc *); static int iwi_wme_setparams(struct iwi_softc *, struct ieee80211com *); +static void iwi_update_wme(void *, int); static int iwi_wme_update(struct ieee80211com *); static uint16_t iwi_read_prom_word(struct iwi_softc *, uint8_t); static void iwi_frame_intr(struct iwi_softc *, struct iwi_rx_data *, int, @@ -291,6 +291,7 @@ 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_disassoctask, 0, iwi_disassoc, sc); + TASK_INIT(&sc->sc_wmetask, 0, iwi_update_wme, sc); callout_init_mtx(&sc->sc_wdtimer, &sc->sc_mtx, 0); callout_init_mtx(&sc->sc_rftimer, &sc->sc_mtx, 0); @@ -1082,6 +1083,18 @@ iwi_wme_setparams(struct iwi_softc *sc, struct ieee80211com *ic) #undef IWI_USEC #undef IWI_EXP2 +static void +iwi_update_wme(void *arg, int npending) +{ + struct ieee80211com *ic = arg; + struct iwi_softc *sc = ic->ic_ifp->if_softc; + IWI_LOCK_DECL; + + IWI_LOCK(sc); + (void) iwi_wme_setparams(sc, ic); + IWI_UNLOCK(sc); +} + static int iwi_wme_update(struct ieee80211com *ic) { @@ -1091,13 +1104,13 @@ iwi_wme_update(struct ieee80211com *ic) /* * We may be called to update the WME parameters in * the adapter at various places. If we're already - * associated then initiate the request immediately - * (via the taskqueue); otherwise we assume the params - * will get sent down to the adapter as part of the - * work iwi_auth_and_assoc does. + * associated then initiate the request immediately; + * otherwise we assume the params will get sent down + * to the adapter as part of the work iwi_auth_and_assoc + * does. */ if (vap->iv_state == IEEE80211_S_RUN) - (void) iwi_wme_setparams(sc, ic); + ieee80211_runtask(ic, &sc->sc_wmetask); return (0); } -- cgit v1.1