aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/mvm/power.c
diff options
context:
space:
mode:
authorAvri Altman <avri.altman@intel.com>2014-04-01 05:08:13 -0400
committerEmmanuel Grumbach <emmanuel.grumbach@intel.com>2014-04-13 15:23:19 -0400
commitc6e37a686e02f5859000c0a01428e375d5e59d65 (patch)
tree497c4538d4fc6d118766f34abe59ad7b9c23b748 /drivers/net/wireless/iwlwifi/mvm/power.c
parent3a58d98e8dc94225137105f94ad625eb7034813c (diff)
iwlwifi: mvm: Re-factor enabling uAPSD logic
The driver can enable uAPSD and specify some of its related parameters. This patch organizes this logic in a separate function. Signed-off-by: Avri Altman <avri.altman@intel.com> Reviewed-by: Alexander Bondar <alexander.bondar@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/mvm/power.c')
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/power.c43
1 files changed, 25 insertions, 18 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/power.c b/drivers/net/wireless/iwlwifi/mvm/power.c
index 2e6f477676f0..78309f7d0b7b 100644
--- a/drivers/net/wireless/iwlwifi/mvm/power.c
+++ b/drivers/net/wireless/iwlwifi/mvm/power.c
@@ -268,6 +268,30 @@ static void iwl_mvm_power_configure_uapsd(struct iwl_mvm *mvm,
268 IWL_MVM_PS_HEAVY_RX_THLD_PERCENT; 268 IWL_MVM_PS_HEAVY_RX_THLD_PERCENT;
269} 269}
270 270
271static bool iwl_mvm_power_allow_uapsd(struct iwl_mvm *mvm,
272 struct ieee80211_vif *vif)
273{
274 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
275
276 if (!memcmp(mvmvif->uapsd_misbehaving_bssid, vif->bss_conf.bssid,
277 ETH_ALEN))
278 return false;
279
280 if (vif->p2p &&
281 !(mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_P2P_PS_UAPSD))
282 return false;
283 /*
284 * Avoid using uAPSD if P2P client is associated to GO that uses
285 * opportunistic power save. This is due to current FW limitation.
286 */
287 if (vif->p2p &&
288 (vif->bss_conf.p2p_noa_attr.oppps_ctwindow &
289 IEEE80211_P2P_OPPPS_ENABLE_BIT))
290 return false;
291
292 return true;
293}
294
271static void iwl_mvm_power_build_cmd(struct iwl_mvm *mvm, 295static void iwl_mvm_power_build_cmd(struct iwl_mvm *mvm,
272 struct ieee80211_vif *vif, 296 struct ieee80211_vif *vif,
273 struct iwl_mac_power_cmd *cmd) 297 struct iwl_mac_power_cmd *cmd)
@@ -280,7 +304,6 @@ static void iwl_mvm_power_build_cmd(struct iwl_mvm *mvm,
280 bool radar_detect = false; 304 bool radar_detect = false;
281 struct iwl_mvm_vif *mvmvif __maybe_unused = 305 struct iwl_mvm_vif *mvmvif __maybe_unused =
282 iwl_mvm_vif_from_mac80211(vif); 306 iwl_mvm_vif_from_mac80211(vif);
283 bool allow_uapsd = true;
284 307
285 cmd->id_and_color = cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, 308 cmd->id_and_color = cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id,
286 mvmvif->color)); 309 mvmvif->color));
@@ -346,23 +369,7 @@ static void iwl_mvm_power_build_cmd(struct iwl_mvm *mvm,
346 cpu_to_le32(IWL_MVM_WOWLAN_PS_TX_DATA_TIMEOUT); 369 cpu_to_le32(IWL_MVM_WOWLAN_PS_TX_DATA_TIMEOUT);
347 } 370 }
348 371
349 if (!memcmp(mvmvif->uapsd_misbehaving_bssid, vif->bss_conf.bssid, 372 if (iwl_mvm_power_allow_uapsd(mvm, vif))
350 ETH_ALEN))
351 allow_uapsd = false;
352
353 if (vif->p2p &&
354 !(mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_P2P_PS_UAPSD))
355 allow_uapsd = false;
356 /*
357 * Avoid using uAPSD if P2P client is associated to GO that uses
358 * opportunistic power save. This is due to current FW limitation.
359 */
360 if (vif->p2p &&
361 vif->bss_conf.p2p_noa_attr.oppps_ctwindow &
362 IEEE80211_P2P_OPPPS_ENABLE_BIT)
363 allow_uapsd = false;
364
365 if (allow_uapsd)
366 iwl_mvm_power_configure_uapsd(mvm, vif, cmd); 373 iwl_mvm_power_configure_uapsd(mvm, vif, cmd);
367 374
368#ifdef CONFIG_IWLWIFI_DEBUGFS 375#ifdef CONFIG_IWLWIFI_DEBUGFS