From owner-svn-src-all@freebsd.org Fri May 12 06:33:08 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D060FD6925F; Fri, 12 May 2017 06:33:08 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ABB29383; Fri, 12 May 2017 06:33:08 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v4C6X7lk073525; Fri, 12 May 2017 06:33:07 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v4C6X7cK073522; Fri, 12 May 2017 06:33:07 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201705120633.v4C6X7cK073522@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Fri, 12 May 2017 06:33:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r318229 - head/sys/dev/iwm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 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: Fri, 12 May 2017 06:33:08 -0000 Author: adrian Date: Fri May 12 06:33:07 2017 New Revision: 318229 URL: https://svnweb.freebsd.org/changeset/base/318229 Log: [iwm] Adjust if_iwm_sta.h prototypes, don't pass iwm_node to rm_sta(). * Since a RUN -> INIT/SCAN transition seems to immediately destroy the ieee80211_node for the AP, we can't read the in_assoc value from there. Instead just directly pass that information via a boolean_t argument. * Adds iwm_mvm_rm_sta_id() function, which just unconditionally removes the station from the firmware. * The iwm_mvm_rm_sta() function shouldn't actually remove the station from firmware when we are still associated (i.e. during a RUN -> INIT/SCAN transition). * So when disassociating we will first call iwm_mvm_rm_sta() to drain the queues/fifos. Later during disassociation we will then use iwm_mvm_rm_sta_id() to actually remove the station. Inspired-By: Linux iwlwifi Obtained from: dragonflybsd.git 81b3c1fe9122fa22f33d97103039cc375f656231 Modified: head/sys/dev/iwm/if_iwm.c head/sys/dev/iwm/if_iwm_sta.c head/sys/dev/iwm/if_iwm_sta.h Modified: head/sys/dev/iwm/if_iwm.c ============================================================================== --- head/sys/dev/iwm/if_iwm.c Fri May 12 06:31:57 2017 (r318228) +++ head/sys/dev/iwm/if_iwm.c Fri May 12 06:33:07 2017 (r318229) @@ -4396,8 +4396,7 @@ iwm_newstate(struct ieee80211vap *vap, e myerr = ivp->iv_newstate(vap, nstate, arg); IEEE80211_UNLOCK(ic); IWM_LOCK(sc); - in = IWM_NODE(vap->iv_bss); - error = iwm_mvm_rm_sta(sc, vap, in); + error = iwm_mvm_rm_sta(sc, vap, FALSE); if (error) { device_printf(sc->sc_dev, "%s: Failed to remove station: %d\n", Modified: head/sys/dev/iwm/if_iwm_sta.c ============================================================================== --- head/sys/dev/iwm/if_iwm_sta.c Fri May 12 06:31:57 2017 (r318228) +++ head/sys/dev/iwm/if_iwm_sta.c Fri May 12 06:33:07 2017 (r318229) @@ -213,10 +213,9 @@ iwm_mvm_update_sta(struct iwm_softc *sc, } int -iwm_mvm_drain_sta(struct iwm_softc *sc, struct iwm_node *in, boolean_t drain) +iwm_mvm_drain_sta(struct iwm_softc *sc, struct iwm_vap *ivp, boolean_t drain) { struct iwm_mvm_add_sta_cmd cmd = {}; - struct iwm_vap *ivp = IWM_VAP(in->in_ni.ni_vap); int ret; uint32_t status; @@ -275,13 +274,13 @@ iwm_mvm_rm_sta_common(struct iwm_softc * int iwm_mvm_rm_sta(struct iwm_softc *sc, struct ieee80211vap *vap, - struct iwm_node *in) + boolean_t is_assoc) { uint32_t tfd_queue_msk = 0; int ret; int ac; - ret = iwm_mvm_drain_sta(sc, in, TRUE); + ret = iwm_mvm_drain_sta(sc, IWM_VAP(vap), TRUE); if (ret) return ret; mbufq_drain(&sc->sc_snd); /* XXX needed ? */ @@ -297,13 +296,12 @@ iwm_mvm_rm_sta(struct iwm_softc *sc, str if (ret) return ret; #endif - ret = iwm_mvm_drain_sta(sc, in, FALSE); + ret = iwm_mvm_drain_sta(sc, IWM_VAP(vap), FALSE); -#if 0 /* if we are associated - we can't remove the AP STA now */ - if (sta->assoc) + if (is_assoc) return ret; -#endif + /* XXX wait until STA is drained */ ret = iwm_mvm_rm_sta_common(sc); @@ -311,6 +309,14 @@ iwm_mvm_rm_sta(struct iwm_softc *sc, str return ret; } +int +iwm_mvm_rm_sta_id(struct iwm_softc *sc, struct ieee80211vap *vap) +{ + /* XXX wait until STA is drained */ + + return iwm_mvm_rm_sta_common(sc); +} + static int iwm_mvm_add_int_sta_common(struct iwm_softc *sc, struct iwm_int_sta *sta, const uint8_t *addr, uint16_t mac_id, uint16_t color) Modified: head/sys/dev/iwm/if_iwm_sta.h ============================================================================== --- head/sys/dev/iwm/if_iwm_sta.h Fri May 12 06:31:57 2017 (r318228) +++ head/sys/dev/iwm/if_iwm_sta.h Fri May 12 06:33:07 2017 (r318229) @@ -211,12 +211,13 @@ extern int iwm_mvm_sta_send_to_fw(struct extern int iwm_mvm_add_sta(struct iwm_softc *sc, struct iwm_node *in); extern int iwm_mvm_update_sta(struct iwm_softc *sc, struct iwm_node *in); extern int iwm_mvm_rm_sta(struct iwm_softc *sc, struct ieee80211vap *vap, - struct iwm_node *in); + boolean_t is_assoc); +extern int iwm_mvm_rm_sta_id(struct iwm_softc *sc, struct ieee80211vap *vap); extern int iwm_mvm_add_aux_sta(struct iwm_softc *sc); extern void iwm_mvm_del_aux_sta(struct iwm_softc *sc); -extern int iwm_mvm_drain_sta(struct iwm_softc *sc, struct iwm_node *in, +extern int iwm_mvm_drain_sta(struct iwm_softc *sc, struct iwm_vap *ivp, boolean_t drain); #endif /* __IF_IWM_STA_H__ */