Author: adrian
Date: Tue May  9 05:32:35 2017
New Revision: 318013
URL: https://svnweb.freebsd.org/changeset/base/318013

Log:
  [iwm] Move in_phyctxt from struct iwm_node to phy_ctxt in struct iwm_vap.
  
  * This better matches how things are organized in Linux's iwlwifi.
  
  Obtained from:        dragonflybsd.git 
0cf16dd2e0e09a3e5140e50222ac2e69bcdb19a2

Modified:
  head/sys/dev/iwm/if_iwm.c
  head/sys/dev/iwm/if_iwm_binding.c
  head/sys/dev/iwm/if_iwm_binding.h
  head/sys/dev/iwm/if_iwmvar.h

Modified: head/sys/dev/iwm/if_iwm.c
==============================================================================
--- head/sys/dev/iwm/if_iwm.c   Tue May  9 05:31:38 2017        (r318012)
+++ head/sys/dev/iwm/if_iwm.c   Tue May  9 05:32:35 2017        (r318013)
@@ -355,7 +355,7 @@ static int  iwm_mvm_add_int_sta_common(st
                                            struct iwm_int_sta *,
                                           const uint8_t *, uint16_t, uint16_t);
 static int     iwm_mvm_add_aux_sta(struct iwm_softc *);
-static int     iwm_mvm_update_quotas(struct iwm_softc *, struct iwm_node *);
+static int     iwm_mvm_update_quotas(struct iwm_softc *, struct iwm_vap *);
 static int     iwm_auth(struct ieee80211vap *, struct iwm_softc *);
 static int     iwm_assoc(struct ieee80211vap *, struct iwm_softc *);
 static int     iwm_release(struct iwm_softc *, struct iwm_node *);
@@ -1286,6 +1286,7 @@ iwm_stop_device(struct iwm_softc *sc)
         */
        if (vap) {
                struct iwm_vap *iv = IWM_VAP(vap);
+               iv->phy_ctxt = NULL;
                iv->is_uploaded = 0;
        }
 
@@ -4014,7 +4015,7 @@ iwm_mvm_add_aux_sta(struct iwm_softc *sc
  */
 
 static int
-iwm_mvm_update_quotas(struct iwm_softc *sc, struct iwm_node *in)
+iwm_mvm_update_quotas(struct iwm_softc *sc, struct iwm_vap *ivp)
 {
        struct iwm_time_quota_cmd cmd;
        int i, idx, ret, num_active_macs, quota, quota_rem;
@@ -4025,10 +4026,10 @@ iwm_mvm_update_quotas(struct iwm_softc *
        memset(&cmd, 0, sizeof(cmd));
 
        /* currently, PHY ID == binding ID */
-       if (in) {
-               id = in->in_phyctxt->id;
+       if (ivp) {
+               id = ivp->phy_ctxt->id;
                KASSERT(id < IWM_MAX_BINDINGS, ("invalid id"));
-               colors[id] = in->in_phyctxt->color;
+               colors[id] = ivp->phy_ctxt->color;
 
                if (1)
                        n_ifs[id] = 1;
@@ -4153,9 +4154,9 @@ iwm_auth(struct ieee80211vap *vap, struc
                            "%s: failed update phy ctxt\n", __func__);
                        goto out;
                }
-               in->in_phyctxt = &sc->sc_phyctxt[0];
+               iv->phy_ctxt = &sc->sc_phyctxt[0];
 
-               if ((error = iwm_mvm_binding_update(sc, in)) != 0) {
+               if ((error = iwm_mvm_binding_update(sc, iv)) != 0) {
                        device_printf(sc->sc_dev,
                            "%s: binding update cmd\n", __func__);
                        goto out;
@@ -4184,9 +4185,9 @@ iwm_auth(struct ieee80211vap *vap, struc
                        error = ETIMEDOUT;
                        goto out;
                }
-               in->in_phyctxt = &sc->sc_phyctxt[0];
+               iv->phy_ctxt = &sc->sc_phyctxt[0];
 
-               if ((error = iwm_mvm_binding_add_vif(sc, in)) != 0) {
+               if ((error = iwm_mvm_binding_add_vif(sc, iv)) != 0) {
                        device_printf(sc->sc_dev,
                            "%s: binding add cmd\n", __func__);
                        goto out;
@@ -4590,7 +4591,7 @@ iwm_newstate(struct ieee80211vap *vap, e
                in = IWM_NODE(vap->iv_bss);
                iwm_mvm_enable_beacon_filter(sc, in);
                iwm_mvm_power_update_mac(sc);
-               iwm_mvm_update_quotas(sc, in);
+               iwm_mvm_update_quotas(sc, ivp);
                iwm_setrates(sc, in);
 
                cmd.data[0] = &in->in_lq;
@@ -5761,7 +5762,6 @@ iwm_intr(void *arg)
                device_printf(sc->sc_dev, "%s: controller panicked, iv_state = 
%d; "
                    "restarting\n", __func__, vap->iv_state);
 
-               /* XXX TODO: turn this into a callout/taskqueue */
                ieee80211_restart_all(ic);
                return;
        }

Modified: head/sys/dev/iwm/if_iwm_binding.c
==============================================================================
--- head/sys/dev/iwm/if_iwm_binding.c   Tue May  9 05:31:38 2017        
(r318012)
+++ head/sys/dev/iwm/if_iwm_binding.c   Tue May  9 05:32:35 2017        
(r318013)
@@ -162,10 +162,10 @@ __FBSDID("$FreeBSD$");
  */
 
 int
-iwm_mvm_binding_cmd(struct iwm_softc *sc, struct iwm_node *in, uint32_t action)
+iwm_mvm_binding_cmd(struct iwm_softc *sc, struct iwm_vap *ivp, uint32_t action)
 {
        struct iwm_binding_cmd cmd;
-       struct iwm_mvm_phy_ctxt *phyctxt = in->in_phyctxt;
+       struct iwm_mvm_phy_ctxt *phyctxt = ivp->phy_ctxt;
        int i, ret;
        uint32_t status;
 
@@ -204,13 +204,13 @@ iwm_mvm_binding_cmd(struct iwm_softc *sc
 }
 
 int
-iwm_mvm_binding_update(struct iwm_softc *sc, struct iwm_node *in)
+iwm_mvm_binding_update(struct iwm_softc *sc, struct iwm_vap *ivp)
 {
-       return iwm_mvm_binding_cmd(sc, in, IWM_FW_CTXT_ACTION_MODIFY);
+       return iwm_mvm_binding_cmd(sc, ivp, IWM_FW_CTXT_ACTION_MODIFY);
 }
 
 int
-iwm_mvm_binding_add_vif(struct iwm_softc *sc, struct iwm_node *in)
+iwm_mvm_binding_add_vif(struct iwm_softc *sc, struct iwm_vap *ivp)
 {
-       return iwm_mvm_binding_cmd(sc, in, IWM_FW_CTXT_ACTION_ADD);
+       return iwm_mvm_binding_cmd(sc, ivp, IWM_FW_CTXT_ACTION_ADD);
 }

Modified: head/sys/dev/iwm/if_iwm_binding.h
==============================================================================
--- head/sys/dev/iwm/if_iwm_binding.h   Tue May  9 05:31:38 2017        
(r318012)
+++ head/sys/dev/iwm/if_iwm_binding.h   Tue May  9 05:32:35 2017        
(r318013)
@@ -105,9 +105,9 @@
 #ifndef        __IF_IWM_BINDING_H__
 #define        __IF_IWM_BINDING_H__
 
-extern int iwm_mvm_binding_cmd(struct iwm_softc *sc, struct iwm_node *in,
+extern int iwm_mvm_binding_cmd(struct iwm_softc *sc, struct iwm_vap *ivp,
            uint32_t action);
-extern int iwm_mvm_binding_update(struct iwm_softc *sc, struct iwm_node *in);
-extern int iwm_mvm_binding_add_vif(struct iwm_softc *sc, struct iwm_node *in);
+extern int iwm_mvm_binding_update(struct iwm_softc *sc, struct iwm_vap *ivp);
+extern int iwm_mvm_binding_add_vif(struct iwm_softc *sc, struct iwm_vap *ivp);
 
 #endif /* __IF_IWM_BINDING_H__ */

Modified: head/sys/dev/iwm/if_iwmvar.h
==============================================================================
--- head/sys/dev/iwm/if_iwmvar.h        Tue May  9 05:31:38 2017        
(r318012)
+++ head/sys/dev/iwm/if_iwmvar.h        Tue May  9 05:32:35 2017        
(r318013)
@@ -373,12 +373,13 @@ struct iwm_vap {
 
        int                     (*iv_newstate)(struct ieee80211vap *,
                                    enum ieee80211_state, int);
+
+       struct iwm_mvm_phy_ctxt *phy_ctxt;
 };
 #define IWM_VAP(_vap)          ((struct iwm_vap *)(_vap))
 
 struct iwm_node {
        struct ieee80211_node   in_ni;
-       struct iwm_mvm_phy_ctxt *in_phyctxt;
 
        /* status "bits" */
        int                     in_assoc;
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to