iwlwifi: mvm: don't allow diversity if BT Coex / TT forbid it
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Sun, 18 May 2014 06:16:45 +0000 (09:16 +0300)
committerEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Mon, 19 May 2014 13:38:21 +0000 (16:38 +0300)
We should not allow diversity when BT Coex needs the second
antenna. Thermal Throttling can also request to stop using
the second antenna. Honour those requests.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
drivers/net/wireless/iwlwifi/mvm/mvm.h
drivers/net/wireless/iwlwifi/mvm/phy-ctxt.c
drivers/net/wireless/iwlwifi/mvm/utils.c

index 5d2effb4832ab87d59b7963fee24628de4c87345..4a5db07ae0284f13213db17d611ceef530554553 100644 (file)
@@ -1008,6 +1008,7 @@ int iwl_mvm_update_beacon_filter(struct iwl_mvm *mvm,
 void iwl_mvm_update_smps(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
                                enum iwl_mvm_smps_type_request req_type,
                                enum ieee80211_smps_mode smps_request);
+bool iwl_mvm_rx_diversity_allowed(struct iwl_mvm *mvm);
 
 /* Low latency */
 int iwl_mvm_update_low_latency(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
index acb79af6fa8965228a342004575c346e9480489c..539f3a942d437565ab6ba9accd06f71874985af4 100644 (file)
@@ -163,8 +163,7 @@ static void iwl_mvm_phy_ctxt_cmd_data(struct iwl_mvm *mvm,
         * between the two antennas is sufficiently different to impact
         * performance.
         */
-       if (active_cnt == 1 && num_of_ant(mvm->fw->valid_rx_ant) > 1 &&
-           !mvm->cfg->rx_with_siso_diversity) {
+       if (active_cnt == 1 && iwl_mvm_rx_diversity_allowed(mvm)) {
                idle_cnt = 2;
                active_cnt = 2;
        }
index b269f1e30e87b75ac3c65969e1a6e688b544180d..42cea32ac5463e7dfedbe16df1ba08c04476f85b 100644 (file)
@@ -650,6 +650,39 @@ void iwl_mvm_update_smps(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
        ieee80211_request_smps(vif, smps_mode);
 }
 
+static void iwl_mvm_diversity_iter(void *_data, u8 *mac,
+                                  struct ieee80211_vif *vif)
+{
+       struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
+       bool *result = _data;
+       int i;
+
+       for (i = 0; i < NUM_IWL_MVM_SMPS_REQ; i++) {
+               if (mvmvif->smps_requests[i] == IEEE80211_SMPS_STATIC ||
+                   mvmvif->smps_requests[i] == IEEE80211_SMPS_DYNAMIC)
+                       *result = false;
+       }
+}
+
+bool iwl_mvm_rx_diversity_allowed(struct iwl_mvm *mvm)
+{
+       bool result = true;
+
+       lockdep_assert_held(&mvm->mutex);
+
+       if (num_of_ant(mvm->fw->valid_rx_ant) == 1)
+               return false;
+
+       if (!mvm->cfg->rx_with_siso_diversity)
+               return false;
+
+       ieee80211_iterate_active_interfaces_atomic(
+                       mvm->hw, IEEE80211_IFACE_ITER_NORMAL,
+                       iwl_mvm_diversity_iter, &result);
+
+       return result;
+}
+
 int iwl_mvm_update_low_latency(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
                               bool value)
 {