aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/mvm/mac80211.c
diff options
context:
space:
mode:
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>2014-01-27 09:57:33 -0500
committerEmmanuel Grumbach <emmanuel.grumbach@intel.com>2014-02-03 15:43:57 -0500
commite5e7aa8e2561019fb3f417041d50e1c0df8f5e42 (patch)
tree030d73f1b8d7aa21f2305b3fb4ad20e5b3cb6f33 /drivers/net/wireless/iwlwifi/mvm/mac80211.c
parent6345061fda7766b937bc0e52e3467071a640c6c4 (diff)
iwlwifi: mvm: refactor power code
The main complexity of the power code is that it needs to take into account the firmware limitations. These limitations state that we need to have a global picture of the vifs present in the system to be able to decide if we can enable power management on a specific vif. Even device power save (as opposed to vif power management) must be disabled in certain circumstances (monitor vif). Refactor the current code to make this clearer by defining a function that explicitely computes these constraints. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/mvm/mac80211.c')
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/mac80211.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
index 9d290697fbba..b9b6bfb5b25b 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
@@ -717,7 +717,9 @@ static int iwl_mvm_mac_add_interface(struct ieee80211_hw *hw,
717 if (ret) 717 if (ret)
718 goto out_release; 718 goto out_release;
719 719
720 iwl_mvm_power_mac_update_mode(mvm, vif); 720 ret = iwl_mvm_power_update_mac(mvm, vif);
721 if (ret)
722 goto out_release;
721 723
722 /* beacon filtering */ 724 /* beacon filtering */
723 ret = iwl_mvm_disable_beacon_filter(mvm, vif, CMD_SYNC); 725 ret = iwl_mvm_disable_beacon_filter(mvm, vif, CMD_SYNC);
@@ -867,6 +869,7 @@ static void iwl_mvm_mac_remove_interface(struct ieee80211_hw *hw,
867 if (mvm->vif_count && vif->type != NL80211_IFTYPE_P2P_DEVICE) 869 if (mvm->vif_count && vif->type != NL80211_IFTYPE_P2P_DEVICE)
868 mvm->vif_count--; 870 mvm->vif_count--;
869 871
872 iwl_mvm_power_update_mac(mvm, vif);
870 iwl_mvm_mac_ctxt_remove(mvm, vif); 873 iwl_mvm_mac_ctxt_remove(mvm, vif);
871 874
872out_release: 875out_release:
@@ -1231,7 +1234,7 @@ static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm,
1231 &mvmvif->time_event_data); 1234 &mvmvif->time_event_data);
1232 } else if (changes & (BSS_CHANGED_PS | BSS_CHANGED_P2P_PS | 1235 } else if (changes & (BSS_CHANGED_PS | BSS_CHANGED_P2P_PS |
1233 BSS_CHANGED_QOS)) { 1236 BSS_CHANGED_QOS)) {
1234 ret = iwl_mvm_power_mac_update_mode(mvm, vif); 1237 ret = iwl_mvm_power_update_mac(mvm, vif);
1235 if (ret) 1238 if (ret)
1236 IWL_ERR(mvm, "failed to update power mode\n"); 1239 IWL_ERR(mvm, "failed to update power mode\n");
1237 } 1240 }
@@ -1298,7 +1301,7 @@ static int iwl_mvm_start_ap_ibss(struct ieee80211_hw *hw,
1298 1301
1299 /* power updated needs to be done before quotas */ 1302 /* power updated needs to be done before quotas */
1300 mvm->bound_vif_cnt++; 1303 mvm->bound_vif_cnt++;
1301 iwl_mvm_power_update_binding(mvm, vif, true); 1304 iwl_mvm_power_update_mac(mvm, vif);
1302 1305
1303 ret = iwl_mvm_update_quotas(mvm, vif); 1306 ret = iwl_mvm_update_quotas(mvm, vif);
1304 if (ret) 1307 if (ret)
@@ -1317,7 +1320,7 @@ static int iwl_mvm_start_ap_ibss(struct ieee80211_hw *hw,
1317 1320
1318out_quota_failed: 1321out_quota_failed:
1319 mvm->bound_vif_cnt--; 1322 mvm->bound_vif_cnt--;
1320 iwl_mvm_power_update_binding(mvm, vif, false); 1323 iwl_mvm_power_update_mac(mvm, vif);
1321 mvmvif->ap_ibss_active = false; 1324 mvmvif->ap_ibss_active = false;
1322 iwl_mvm_send_rm_bcast_sta(mvm, &mvmvif->bcast_sta); 1325 iwl_mvm_send_rm_bcast_sta(mvm, &mvmvif->bcast_sta);
1323out_unbind: 1326out_unbind:
@@ -1354,7 +1357,7 @@ static void iwl_mvm_stop_ap_ibss(struct ieee80211_hw *hw,
1354 iwl_mvm_binding_remove_vif(mvm, vif); 1357 iwl_mvm_binding_remove_vif(mvm, vif);
1355 1358
1356 mvm->bound_vif_cnt--; 1359 mvm->bound_vif_cnt--;
1357 iwl_mvm_power_update_binding(mvm, vif, false); 1360 iwl_mvm_power_update_mac(mvm, vif);
1358 1361
1359 iwl_mvm_mac_ctxt_remove(mvm, vif); 1362 iwl_mvm_mac_ctxt_remove(mvm, vif);
1360 1363
@@ -2088,7 +2091,7 @@ static int iwl_mvm_assign_vif_chanctx(struct ieee80211_hw *hw,
2088 * otherwise fw will complain. 2091 * otherwise fw will complain.
2089 */ 2092 */
2090 mvm->bound_vif_cnt++; 2093 mvm->bound_vif_cnt++;
2091 iwl_mvm_power_update_binding(mvm, vif, true); 2094 iwl_mvm_power_update_mac(mvm, vif);
2092 2095
2093 /* Setting the quota at this stage is only required for monitor 2096 /* Setting the quota at this stage is only required for monitor
2094 * interfaces. For the other types, the bss_info changed flow 2097 * interfaces. For the other types, the bss_info changed flow
@@ -2106,7 +2109,7 @@ static int iwl_mvm_assign_vif_chanctx(struct ieee80211_hw *hw,
2106 out_remove_binding: 2109 out_remove_binding:
2107 iwl_mvm_binding_remove_vif(mvm, vif); 2110 iwl_mvm_binding_remove_vif(mvm, vif);
2108 mvm->bound_vif_cnt--; 2111 mvm->bound_vif_cnt--;
2109 iwl_mvm_power_update_binding(mvm, vif, false); 2112 iwl_mvm_power_update_mac(mvm, vif);
2110 out_unlock: 2113 out_unlock:
2111 mutex_unlock(&mvm->mutex); 2114 mutex_unlock(&mvm->mutex);
2112 if (ret) 2115 if (ret)
@@ -2139,7 +2142,7 @@ static void iwl_mvm_unassign_vif_chanctx(struct ieee80211_hw *hw,
2139 2142
2140 iwl_mvm_binding_remove_vif(mvm, vif); 2143 iwl_mvm_binding_remove_vif(mvm, vif);
2141 mvm->bound_vif_cnt--; 2144 mvm->bound_vif_cnt--;
2142 iwl_mvm_power_update_binding(mvm, vif, false); 2145 iwl_mvm_power_update_mac(mvm, vif);
2143 2146
2144out_unlock: 2147out_unlock:
2145 mvmvif->phy_ctxt = NULL; 2148 mvmvif->phy_ctxt = NULL;