iwlwifi: mvm: pass force_assoc_off all the way down to avoid hacks
authorLuciano Coelho <luciano.coelho@intel.com>
Tue, 13 May 2014 14:33:38 +0000 (17:33 +0300)
committerEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Wed, 21 May 2014 09:52:44 +0000 (12:52 +0300)
In some cases, we need to force the association to be off in the
MAC_CONTEXT_CMD command we send to the firmware.  Instead of having to
hack the vif->bss_conf.assoc value, pass it all the way down the call
chain.

Additionally, for the iwl_mvm_mac_ctxt_add() case, we *always* set
forced_assoc_off to true, so we can remove the hack in the d3 code
that was forcing it to off by hacking the bss_conf.assoc value.

Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
drivers/net/wireless/iwlwifi/mvm/d3.c
drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c
drivers/net/wireless/iwlwifi/mvm/mac80211.c
drivers/net/wireless/iwlwifi/mvm/mvm.h

index 7dc71f344c94ec6615c77c85e605cfdd36eb0a11..48c192d85c4c6a047d35392f5d637655b47664f8 100644 (file)
@@ -663,10 +663,8 @@ static int iwl_mvm_d3_reprogram(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
 
        if (WARN_ON(!vif->bss_conf.assoc))
                return -EINVAL;
-       /* hack */
-       vif->bss_conf.assoc = false;
+
        ret = iwl_mvm_mac_ctxt_add(mvm, vif);
-       vif->bss_conf.assoc = true;
        if (ret)
                return ret;
 
@@ -702,7 +700,7 @@ static int iwl_mvm_d3_reprogram(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
                return ret;
        rcu_assign_pointer(mvm->fw_id_to_mac_id[mvmvif->ap_sta_id], ap_sta);
 
-       ret = iwl_mvm_mac_ctxt_changed(mvm, vif);
+       ret = iwl_mvm_mac_ctxt_changed(mvm, vif, false);
        if (ret)
                return ret;
 
index fed012f2b6c09dce6a96511f0a69b7bdaad78721..8b530277763258551cf09292298f8f14be074174 100644 (file)
@@ -1109,12 +1109,12 @@ static int iwl_mvm_mac_ctxt_cmd_go(struct iwl_mvm *mvm,
 }
 
 static int iwl_mvm_mac_ctx_send(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
-                               u32 action)
+                               u32 action, bool force_assoc_off)
 {
        switch (vif->type) {
        case NL80211_IFTYPE_STATION:
                return iwl_mvm_mac_ctxt_cmd_sta(mvm, vif, action,
-                                               action == FW_CTXT_ACTION_ADD);
+                                               force_assoc_off);
                break;
        case NL80211_IFTYPE_AP:
                if (!vif->p2p)
@@ -1144,7 +1144,8 @@ int iwl_mvm_mac_ctxt_add(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
                      vif->addr, ieee80211_vif_type_p2p(vif)))
                return -EIO;
 
-       ret = iwl_mvm_mac_ctx_send(mvm, vif, FW_CTXT_ACTION_ADD);
+       ret = iwl_mvm_mac_ctx_send(mvm, vif, FW_CTXT_ACTION_ADD,
+                                  true);
        if (ret)
                return ret;
 
@@ -1155,7 +1156,8 @@ int iwl_mvm_mac_ctxt_add(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
        return 0;
 }
 
-int iwl_mvm_mac_ctxt_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
+int iwl_mvm_mac_ctxt_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
+                            bool force_assoc_off)
 {
        struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
 
@@ -1163,7 +1165,8 @@ int iwl_mvm_mac_ctxt_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
                      vif->addr, ieee80211_vif_type_p2p(vif)))
                return -EIO;
 
-       return iwl_mvm_mac_ctx_send(mvm, vif, FW_CTXT_ACTION_MODIFY);
+       return iwl_mvm_mac_ctx_send(mvm, vif, FW_CTXT_ACTION_MODIFY,
+                                   force_assoc_off);
 }
 
 int iwl_mvm_mac_ctxt_remove(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
index 7411f12fd88dc44b67d57a150d8a2aa1227928fd..1146cfbc72999ee09123b1782f8d121480b227bf 100644 (file)
@@ -1271,7 +1271,7 @@ static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm,
        if (changes & BSS_CHANGED_ASSOC && bss_conf->assoc)
                iwl_mvm_mac_ctxt_recalc_tsf_id(mvm, vif);
 
-       ret = iwl_mvm_mac_ctxt_changed(mvm, vif);
+       ret = iwl_mvm_mac_ctxt_changed(mvm, vif, false);
        if (ret)
                IWL_ERR(mvm, "failed to update MAC %pM\n", vif->addr);
 
@@ -1431,7 +1431,7 @@ static int iwl_mvm_start_ap_ibss(struct ieee80211_hw *hw,
 
        /* Need to update the P2P Device MAC (only GO, IBSS is single vif) */
        if (vif->p2p && mvm->p2p_device_vif)
-               iwl_mvm_mac_ctxt_changed(mvm, mvm->p2p_device_vif);
+               iwl_mvm_mac_ctxt_changed(mvm, mvm->p2p_device_vif, false);
 
        iwl_mvm_ref(mvm, IWL_MVM_REF_AP_IBSS);
 
@@ -1471,7 +1471,7 @@ static void iwl_mvm_stop_ap_ibss(struct ieee80211_hw *hw,
 
        /* Need to update the P2P Device MAC (only GO, IBSS is single vif) */
        if (vif->p2p && mvm->p2p_device_vif)
-               iwl_mvm_mac_ctxt_changed(mvm, mvm->p2p_device_vif);
+               iwl_mvm_mac_ctxt_changed(mvm, mvm->p2p_device_vif, false);
 
        iwl_mvm_update_quotas(mvm, NULL);
        iwl_mvm_send_rm_bcast_sta(mvm, &mvmvif->bcast_sta);
@@ -1498,7 +1498,7 @@ iwl_mvm_bss_info_changed_ap_ibss(struct iwl_mvm *mvm,
 
        if (changes & (BSS_CHANGED_ERP_CTS_PROT | BSS_CHANGED_HT |
                       BSS_CHANGED_BANDWIDTH) &&
-           iwl_mvm_mac_ctxt_changed(mvm, vif))
+           iwl_mvm_mac_ctxt_changed(mvm, vif, false))
                IWL_ERR(mvm, "failed to update MAC %pM\n", vif->addr);
 
        /* Need to send a new beacon template to the FW */
@@ -1799,7 +1799,7 @@ static int iwl_mvm_mac_conf_tx(struct ieee80211_hw *hw,
                int ret;
 
                mutex_lock(&mvm->mutex);
-               ret = iwl_mvm_mac_ctxt_changed(mvm, vif);
+               ret = iwl_mvm_mac_ctxt_changed(mvm, vif, false);
                mutex_unlock(&mvm->mutex);
                return ret;
        }
@@ -2255,7 +2255,7 @@ static int iwl_mvm_assign_vif_chanctx(struct ieee80211_hw *hw,
        /* Handle binding during CSA */
        if (vif->type == NL80211_IFTYPE_AP) {
                iwl_mvm_update_quotas(mvm, vif);
-               iwl_mvm_mac_ctxt_changed(mvm, vif);
+               iwl_mvm_mac_ctxt_changed(mvm, vif, false);
        }
 
        goto out_unlock;
index 6ccc88b0f76bda3f705105573687c3a348c4dcd2..da8dc1461b21ab83643216c772a315380552546a 100644 (file)
@@ -814,7 +814,8 @@ void iwl_mvm_phy_ctxt_unref(struct iwl_mvm *mvm,
 int iwl_mvm_mac_ctxt_init(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
 void iwl_mvm_mac_ctxt_release(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
 int iwl_mvm_mac_ctxt_add(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
-int iwl_mvm_mac_ctxt_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
+int iwl_mvm_mac_ctxt_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
+                            bool force_assoc_off);
 int iwl_mvm_mac_ctxt_remove(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
 u32 iwl_mvm_mac_get_queues_mask(struct iwl_mvm *mvm,
                                struct ieee80211_vif *vif);