From owner-svn-src-head@FreeBSD.ORG Tue Jun 2 16:48:11 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 48505106564A; Tue, 2 Jun 2009 16:48:11 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1CA8C8FC2D; Tue, 2 Jun 2009 16:48:11 +0000 (UTC) (envelope-from imp@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 n52GmBTU021053; Tue, 2 Jun 2009 16:48:11 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n52GmAhp021052; Tue, 2 Jun 2009 16:48:10 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200906021648.n52GmAhp021052@svn.freebsd.org> From: Warner Losh Date: Tue, 2 Jun 2009 16:48:10 +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: r193310 - head/sys/dev/bwi 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: Tue, 02 Jun 2009 16:48:11 -0000 Author: imp Date: Tue Jun 2 16:48:10 2009 New Revision: 193310 URL: http://svn.freebsd.org/changeset/base/193310 Log: In bwi_newstate, only zero the bssid when we stop a STA. And only when we've not stopped the card. It hangs the system when we touch the CSR after bwistop. This fixes the hanging on kldunload. Modified: head/sys/dev/bwi/if_bwi.c Modified: head/sys/dev/bwi/if_bwi.c ============================================================================== --- head/sys/dev/bwi/if_bwi.c Tue Jun 2 15:59:46 2009 (r193309) +++ head/sys/dev/bwi/if_bwi.c Tue Jun 2 16:48:10 2009 (r193310) @@ -1771,10 +1771,12 @@ static int bwi_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) { struct bwi_vap *bvp = BWI_VAP(vap); - struct ifnet *ifp = vap->iv_ic->ic_ifp; + struct ieee80211com *ic= vap->iv_ic; + struct ifnet *ifp = ic->ic_ifp; + enum ieee80211_state ostate = vap->iv_state; struct bwi_softc *sc = ifp->if_softc; struct bwi_mac *mac; - struct ieee80211_node *ni; + struct ieee80211_node *ni = vap->iv_bss; int error; BWI_LOCK(sc); @@ -1790,11 +1792,25 @@ bwi_newstate(struct ieee80211vap *vap, e if (error != 0) goto back; + /* + * Clear the BSSID when we stop a STA + */ + if (vap->iv_opmode == IEEE80211_M_STA) { + if (ostate == IEEE80211_S_RUN && nstate != IEEE80211_S_RUN) { + /* + * Clear out the BSSID. If we reassociate to + * the same AP, this will reinialize things + * correctly... + */ + if (ic->ic_opmode == IEEE80211_M_STA && + !(sc->sc_flags & BWI_F_STOP)) + bwi_set_bssid(sc, bwi_zero_addr); + } + } + if (vap->iv_opmode == IEEE80211_M_MONITOR) { /* Nothing to do */ } else if (nstate == IEEE80211_S_RUN) { - ni = vap->iv_bss; - bwi_set_bssid(sc, vap->iv_bss->ni_bssid); KASSERT(sc->sc_cur_regwin->rw_type == BWI_REGWIN_T_MAC, @@ -1814,8 +1830,6 @@ bwi_newstate(struct ieee80211vap *vap, e } callout_reset(&sc->sc_calib_ch, hz, bwi_calibrate, sc); - } else { - bwi_set_bssid(sc, bwi_zero_addr); } back: BWI_UNLOCK(sc);