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__ */
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to