changeset 4298:411ec4c6f829

6542321 dladm tripped up by iwi hardware's auto-connect "feature"
author eh146360
date Tue, 22 May 2007 20:22:05 -0700
parents ada3277692df
children c692001191da
files usr/src/uts/common/io/iwi/ipw2200.c
diffstat 1 files changed, 21 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/common/io/iwi/ipw2200.c	Tue May 22 18:58:34 2007 -0700
+++ b/usr/src/uts/common/io/iwi/ipw2200.c	Tue May 22 20:22:05 2007 -0700
@@ -968,7 +968,6 @@
 	 */
 	delay(drv_usectohz(delay_config_stable));
 
-	ieee80211_begin_scan(&sc->sc_ic, 1); /* reset scan */
 	return (DDI_SUCCESS); /* return successfully */
 fail:
 	ipw2200_stop(sc);
@@ -1714,6 +1713,7 @@
 ipw2200_thread(struct ipw2200_softc *sc)
 {
 	struct ieee80211com	*ic = &sc->sc_ic;
+	enum ieee80211_state	ostate;
 	int32_t			nlstate;
 	int			stat_cnt = 0;
 
@@ -1753,12 +1753,22 @@
 			sc->sc_flags &= ~IPW2200_FLAG_HW_ERR_RECOVER;
 
 			mutex_exit(&sc->sc_mflock);
+
+			ostate = ic->ic_state;
 			(void) ipw2200_init(sc); /* Force state machine */
 			/*
 			 * workround. Delay for a while after init especially
 			 * when something wrong happened already.
 			 */
 			delay(drv_usectohz(delay_fatal_recover));
+
+			/*
+			 * Init scan will recovery the original connection if
+			 * the original state is run
+			 */
+			if (ostate != IEEE80211_S_INIT)
+				ieee80211_begin_scan(ic, 0);
+
 			mutex_enter(&sc->sc_mflock);
 		}
 
@@ -1789,6 +1799,7 @@
 ipw2200_m_start(void *arg)
 {
 	struct ipw2200_softc	*sc = (struct ipw2200_softc *)arg;
+	struct ieee80211com	*ic = &sc->sc_ic;
 
 	IPW2200_DBG(IPW2200_DBG_GLD, (sc->sc_dip, CE_CONT,
 	    "ipw2200_m_start(): enter\n"));
@@ -1796,6 +1807,10 @@
 	 * initialize ipw2200 hardware, everything ok will start scan
 	 */
 	(void) ipw2200_init(sc);
+	/*
+	 * set the state machine to INIT
+	 */
+	ieee80211_new_state(ic, IEEE80211_S_INIT, -1);
 
 	sc->sc_flags |= IPW2200_FLAG_RUNNING;
 
@@ -1806,11 +1821,16 @@
 ipw2200_m_stop(void *arg)
 {
 	struct ipw2200_softc	*sc = (struct ipw2200_softc *)arg;
+	struct ieee80211com	*ic = &sc->sc_ic;
 
 	IPW2200_DBG(IPW2200_DBG_GLD, (sc->sc_dip, CE_CONT,
 	    "ipw2200_m_stop(): enter\n"));
 
 	ipw2200_stop(sc);
+	/*
+	 * set the state machine to INIT
+	 */
+	ieee80211_new_state(ic, IEEE80211_S_INIT, -1);
 
 	sc->sc_flags &= ~IPW2200_FLAG_RUNNING;
 }