svn commit: r191951 - head/sys/dev/iwi

Sam Leffler sam at FreeBSD.org
Sat May 9 19:22:38 UTC 2009


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 <sys/namei.h>
 #include <sys/linker.h>
 #include <sys/firmware.h>
-#include <sys/kthread.h>
 #include <sys/taskqueue.h>
 
 #include <machine/bus.h>
@@ -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]));	\


More information about the svn-src-all mailing list