Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 9 Jun 2007 19:43:34 GMT
From:      Andrew Thompson <thompsa@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 121287 for review
Message-ID:  <200706091943.l59JhYxc009577@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=121287

Change 121287 by thompsa@thompsa_heff on 2007/06/09 19:42:34

	Move setwme and disassoc into the command queue.

Affected files ...

.. //depot/projects/wifi/sys/dev/iwi/if_iwi.c#44 edit
.. //depot/projects/wifi/sys/dev/iwi/if_iwivar.h#18 edit

Differences ...

==== //depot/projects/wifi/sys/dev/iwi/if_iwi.c#44 (text+ko) ====

@@ -138,7 +138,7 @@
 static void	iwi_media_status(struct ifnet *, struct ifmediareq *);
 static int	iwi_newstate(struct ieee80211com *, enum ieee80211_state, int);
 static void	iwi_wme_init(struct iwi_softc *);
-static void	iwi_wme_setparams(void *, int);
+static int	iwi_wme_setparams(struct iwi_softc *);
 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,
@@ -172,11 +172,11 @@
 #endif
 static void	iwi_scan_mindwell(struct ieee80211com *);
 static void     iwi_assoc(struct ieee80211com *ic);
+static void     iwi_disassoc(struct ieee80211com *);
 static void	iwi_ops(void *, int);
 static int	iwi_scan_cmd(struct iwi_softc *, int);
 static int	iwi_auth_and_assoc(struct iwi_softc *);
 static int	iwi_disassociate(struct iwi_softc *, int quiet);
-static void	iwi_down(void *, int);
 static void	iwi_init(void *);
 static void	iwi_init_locked(void *, int);
 static void	iwi_stop(void *);
@@ -278,8 +278,6 @@
 #endif
 	TASK_INIT(&sc->sc_radiontask, 0, iwi_radio_on, sc);
 	TASK_INIT(&sc->sc_radiofftask, 0, iwi_radio_off, sc);
-	TASK_INIT(&sc->sc_setwmetask, 0, iwi_wme_setparams, sc);
-	TASK_INIT(&sc->sc_downtask, 0, iwi_down, sc);
 	TASK_INIT(&sc->sc_restarttask, 0, iwi_restart, sc);
 	TASK_INIT(&sc->sc_opstask, 0, iwi_ops, sc);
 	callout_init_mtx(&sc->sc_wdtimer, &sc->sc_mtx, 0);
@@ -978,7 +976,7 @@
 		 */
 		if (ic->ic_state == IEEE80211_S_RUN &&
 		    (sc->flags & IWI_FLAG_FW_INITED))
-			taskqueue_enqueue(sc->sc_tq, &sc->sc_downtask);
+			iwi_disassoc(ic);
 		if (ic->ic_state == IEEE80211_S_SCAN &&
 		    (sc->flags & IWI_FLAG_SCANNING))
 			ieee80211_cancel_scan(ic);
@@ -1046,7 +1044,7 @@
 }
 
 static int
-iwi_wme_setparams_locked(struct iwi_softc *sc)
+iwi_wme_setparams(struct iwi_softc *sc)
 {
 	struct ieee80211com *ic = &sc->sc_ic;
 	const struct wmeParams *wmep;
@@ -1065,17 +1063,6 @@
 	DPRINTF(("Setting WME parameters\n"));
 	return iwi_cmd(sc, IWI_CMD_SET_WME_PARAMS, sc->wme, sizeof sc->wme);
 }
-
-static void
-iwi_wme_setparams(void *arg, int npending)
-{
-	struct iwi_softc *sc = arg;
-	IWI_LOCK_DECL;
-
-	IWI_LOCK(sc);
-	(void) iwi_wme_setparams_locked(sc);
-	IWI_UNLOCK(sc);
-}
 #undef IWI_USEC
 #undef IWI_EXP2
 
@@ -1092,9 +1079,7 @@
 	 * will get sent down to the adapter as part of the
 	 * work iwi_auth_and_assoc does.
 	 */
-	if (ic->ic_state == IEEE80211_S_RUN)
-		taskqueue_enqueue(sc->sc_tq, &sc->sc_setwmetask);
-	return 0;
+	return (iwi_scan_cmd(sc, IWI_SET_WME));
 }
 
 static int
@@ -2899,7 +2884,7 @@
 
 	if ((ic->ic_flags & IEEE80211_F_WME) && ni->ni_wme_ie != NULL) {
 		/* NB: don't treat WME setup as failure */
-		if (iwi_wme_setparams_locked(sc) == 0 && iwi_wme_setie(sc) == 0)
+		if (iwi_wme_setparams(sc) == 0 && iwi_wme_setie(sc) == 0)
 			assoc->policy |= htole16(IWI_POLICY_WME);
 		/* XXX complain on failure? */
 	}
@@ -3003,17 +2988,6 @@
 }
 
 static void
-iwi_down(void *arg, int npending)
-{
-	struct iwi_softc *sc = arg;
-	IWI_LOCK_DECL;
-
-	IWI_LOCK(sc);
-	iwi_disassociate(sc, 0);
-	IWI_UNLOCK(sc);
-}
-
-static void
 iwi_init(void *priv)
 {
 	struct iwi_softc *sc = priv;
@@ -3556,6 +3530,13 @@
 	case IWI_ASSOC:
 		iwi_auth_and_assoc(sc);
 		break;
+	case IWI_DISASSOC:
+		iwi_disassociate(sc, 0);
+		break;
+	case IWI_SET_WME:
+		if (ic->ic_state == IEEE80211_S_RUN)
+			(void) iwi_wme_setparams(sc);
+		break;
 	case IWI_SCAN_START:
 		sc->flags |= IWI_FLAG_CHANNEL_SCAN;
 		break;
@@ -3664,3 +3645,12 @@
 
 	iwi_scan_cmd(sc, IWI_ASSOC);
 }
+
+static void
+iwi_disassoc(struct ieee80211com *ic)
+{
+	struct ifnet *ifp = ic->ic_ifp;
+	struct iwi_softc *sc = ifp->if_softc;
+
+	iwi_scan_cmd(sc, IWI_DISASSOC);
+}

==== //depot/projects/wifi/sys/dev/iwi/if_iwivar.h#18 (text+ko) ====

@@ -185,8 +185,6 @@
 
 	struct task		sc_radiontask;	/* radio on processing */
 	struct task		sc_radiofftask;	/* radio off processing */
-	struct task		sc_setwmetask;	/* set wme params processing */
-	struct task		sc_downtask;	/* disassociate processing */
 	struct task		sc_restarttask;	/* restart adapter processing */
 	struct task		sc_opstask;	/* scan / auth processing */
 
@@ -209,12 +207,14 @@
 	int			sc_rfkill_timer;/* poll for rfkill change */
 	int			sc_scan_timer;	/* scan request timeout */
 
-#define IWI_SCAN_START  	(1 << 0)
+#define IWI_SCAN_START		(1 << 0)
 #define IWI_SET_CHANNEL	        (1 << 1)
-#define	IWI_SCAN_END    	(1 << 2)
-#define	IWI_ASSOC    	        (1 << 3)
-#define	IWI_SCAN_CURCHAN	(1 << 4)
-#define	IWI_SCAN_ALLCHAN	(1 << 5)
+#define	IWI_SCAN_END		(1 << 2)
+#define	IWI_ASSOC		(1 << 3)
+#define	IWI_DISASSOC		(1 << 4)
+#define	IWI_SCAN_CURCHAN	(1 << 5)
+#define	IWI_SCAN_ALLCHAN	(1 << 6)
+#define	IWI_SET_WME		(1 << 7)
 #define	IWI_SCAN_OPS		5
 	int                     sc_scanop[IWI_SCAN_OPS];
 	int                     sc_scan_cur;    /* current queued scan task */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200706091943.l59JhYxc009577>