From owner-svn-src-head@FreeBSD.ORG Sat May 9 19:22:38 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 564E71065706; Sat, 9 May 2009 19:22:38 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 450228FC19; Sat, 9 May 2009 19:22:38 +0000 (UTC) (envelope-from sam@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 n49JMcVG032395; Sat, 9 May 2009 19:22:38 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n49JMceQ032393; Sat, 9 May 2009 19:22:38 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200905091922.n49JMceQ032393@svn.freebsd.org> From: Sam Leffler Date: Sat, 9 May 2009 19:22:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191951 - head/sys/dev/iwi X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 May 2009 19:22:38 -0000 Author: sam Date: Sat May 9 19:22:37 2009 New Revision: 191951 URL: http://svn.freebsd.org/changeset/base/191951 Log: 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 Modified: head/sys/dev/iwi/if_iwi.c head/sys/dev/iwi/if_iwivar.h Modified: head/sys/dev/iwi/if_iwi.c ============================================================================== --- head/sys/dev/iwi/if_iwi.c Sat May 9 19:19:30 2009 (r191950) +++ head/sys/dev/iwi/if_iwi.c Sat May 9 19:22:37 2009 (r191951) @@ -53,7 +53,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -154,6 +153,7 @@ static void iwi_media_status(struct ifne 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, #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); } Modified: head/sys/dev/iwi/if_iwivar.h ============================================================================== --- head/sys/dev/iwi/if_iwivar.h Sat May 9 19:19:30 2009 (r191950) +++ head/sys/dev/iwi/if_iwivar.h Sat May 9 19:22:37 2009 (r191951) @@ -190,6 +190,7 @@ struct iwi_softc { struct task sc_radiofftask; /* radio off processing */ struct task sc_restarttask; /* restart adapter processing */ struct task sc_disassoctask; + struct task sc_wmetask; /* set wme parameters */ unsigned int sc_softled : 1, /* enable LED gpio status */ sc_ledstate: 1, /* LED on/off state */ @@ -220,7 +221,7 @@ struct iwi_softc { #define IWI_STATE_BEGIN(_sc, _state) do { \ KASSERT(_sc->fw_state == IWI_FW_IDLE, \ - ("iwi firmware not idle")); \ + ("iwi firmware not idle, state %s", iwi_fw_states[_sc->fw_state]));\ _sc->fw_state = _state; \ _sc->sc_state_timer = 5; \ DPRINTF(("enter %s state\n", iwi_fw_states[_state])); \