From owner-svn-src-all@FreeBSD.ORG Mon Dec 6 19:05:45 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3F242106564A; Mon, 6 Dec 2010 19:05:45 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2D5978FC14; Mon, 6 Dec 2010 19:05:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oB6J5jBl041920; Mon, 6 Dec 2010 19:05:45 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oB6J5jok041918; Mon, 6 Dec 2010 19:05:45 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201012061905.oB6J5jok041918@svn.freebsd.org> From: Bernhard Schmidt Date: Mon, 6 Dec 2010 19:05:45 +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: r216238 - head/sys/dev/wpi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Dec 2010 19:05:45 -0000 Author: bschmidt Date: Mon Dec 6 19:05:44 2010 New Revision: 216238 URL: http://svn.freebsd.org/changeset/base/216238 Log: Fix scanning after loosing a connection. The firmware assumes that as long as an association ID is set any scan is supposed to be a background scan. This implies that the firmware will switch back to the associated channel after a certain threshold, though, we are not notified about that. We currently catch this case by a timer which will reset the firmware after a 'scan timeout', though, upper layers are not notified about that and will simply hang until manual intervention. Fix this by resetting the firmware's knowledge about any association on RUN -> ASSOC and !INIT -> SCAN transitions. Tested by: Zhihao Yuan MFC after: 1 week Modified: head/sys/dev/wpi/if_wpi.c Modified: head/sys/dev/wpi/if_wpi.c ============================================================================== --- head/sys/dev/wpi/if_wpi.c Mon Dec 6 18:28:39 2010 (r216237) +++ head/sys/dev/wpi/if_wpi.c Mon Dec 6 19:05:44 2010 (r216238) @@ -1248,8 +1248,25 @@ wpi_newstate(struct ieee80211vap *vap, e IEEE80211_UNLOCK(ic); WPI_LOCK(sc); - if (nstate == IEEE80211_S_AUTH) { - /* The node must be registered in the firmware before auth */ + if (nstate == IEEE80211_S_SCAN && vap->iv_state != IEEE80211_S_INIT) { + /* + * On !INIT -> SCAN transitions, we need to clear any possible + * knowledge about associations. + */ + error = wpi_config(sc); + if (error != 0) { + device_printf(sc->sc_dev, + "%s: device config failed, error %d\n", + __func__, error); + } + } + if (nstate == IEEE80211_S_AUTH || + (nstate == IEEE80211_S_ASSOC && vap->iv_state == IEEE80211_S_RUN)) { + /* + * The node must be registered in the firmware before auth. + * Also the associd must be cleared on RUN -> ASSOC + * transitions. + */ error = wpi_auth(sc, vap); if (error != 0) { device_printf(sc->sc_dev,