aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorAvri Altman <avri.altman@intel.com>2014-11-11 00:29:59 -0500
committerEmmanuel Grumbach <emmanuel.grumbach@intel.com>2014-11-23 12:59:19 -0500
commit5387b348b7af299c2aa8e0318498fa7d889da4fd (patch)
tree29210ae2bee4db3be18731a0b1f483cda2df3e4a /drivers/net/wireless
parent886ca9f5dd1129df2ca31ab2f43299658568cbbe (diff)
iwlwifi: mvm: Fix the keep_alive calculation
The driver must set the keep alive period regardless of power management state. The keep alive period must be greater or equal to both the NIC's maximum sleep period, and the listen interval. However, we were confusing time units (TU) and msec, so fix that. Signed-off-by: Avri Altman <avri.altman@intel.com> Reviewed-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/power.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/power.c b/drivers/net/wireless/iwlwifi/mvm/power.c
index cb653ac10412..2620dd0c45f9 100644
--- a/drivers/net/wireless/iwlwifi/mvm/power.c
+++ b/drivers/net/wireless/iwlwifi/mvm/power.c
@@ -329,7 +329,7 @@ static void iwl_mvm_power_build_cmd(struct iwl_mvm *mvm,
329 struct ieee80211_vif *vif, 329 struct ieee80211_vif *vif,
330 struct iwl_mac_power_cmd *cmd) 330 struct iwl_mac_power_cmd *cmd)
331{ 331{
332 int dtimper, dtimper_msec, bi; 332 int dtimper, bi;
333 int keep_alive; 333 int keep_alive;
334 bool radar_detect = false; 334 bool radar_detect = false;
335 struct iwl_mvm_vif *mvmvif __maybe_unused = 335 struct iwl_mvm_vif *mvmvif __maybe_unused =
@@ -346,10 +346,9 @@ static void iwl_mvm_power_build_cmd(struct iwl_mvm *mvm,
346 * immediately after association. Check that keep alive period 346 * immediately after association. Check that keep alive period
347 * is at least 3 * DTIM 347 * is at least 3 * DTIM
348 */ 348 */
349 dtimper_msec = dtimper * bi; 349 keep_alive = DIV_ROUND_UP(ieee80211_tu_to_usec(3 * dtimper * bi),
350 keep_alive = max_t(int, 3 * dtimper_msec, 350 USEC_PER_SEC);
351 MSEC_PER_SEC * POWER_KEEP_ALIVE_PERIOD_SEC); 351 keep_alive = max(keep_alive, POWER_KEEP_ALIVE_PERIOD_SEC);
352 keep_alive = DIV_ROUND_UP(keep_alive, MSEC_PER_SEC);
353 cmd->keep_alive_seconds = cpu_to_le16(keep_alive); 352 cmd->keep_alive_seconds = cpu_to_le16(keep_alive);
354 353
355 if (mvm->ps_disabled) 354 if (mvm->ps_disabled)