aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAvri Altman <avri.altman@intel.com>2014-08-27 12:58:56 -0400
committerEmmanuel Grumbach <emmanuel.grumbach@intel.com>2014-09-14 15:02:24 -0400
commit49c6d8021f11a4e86ab2689c62fbfca2ea8cbd0d (patch)
tree5c6a88c1f0f8081ac1ce8f2f90529700fc7b4036
parentd4317252330d9d0b24a8d707270c38cf3c0943ad (diff)
iwlwifi: mvm: Fix skip over dtim configuration in d0i3
There was some confusion concerning the units of the beacon interval. The driver assumed that it was in msec where it was in TU - so fix that. Skip over dtim was capped by 300TU where it should be by 306TU. It should also be subjected to several conditions: Not a DFS channel, dtim period < 10, and the multicast wake-lock is off. Concerning multicast lock - there is an implementation gap in the supplicant, so just leave a TODO. 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>
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/power.c48
1 files changed, 31 insertions, 17 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/power.c b/drivers/net/wireless/iwlwifi/mvm/power.c
index 5a29c193b72a..ff842eef453a 100644
--- a/drivers/net/wireless/iwlwifi/mvm/power.c
+++ b/drivers/net/wireless/iwlwifi/mvm/power.c
@@ -286,12 +286,28 @@ static bool iwl_mvm_power_allow_uapsd(struct iwl_mvm *mvm,
286 return true; 286 return true;
287} 287}
288 288
289static bool iwl_mvm_power_is_radar(struct ieee80211_vif *vif)
290{
291 struct ieee80211_chanctx_conf *chanctx_conf;
292 struct ieee80211_channel *chan;
293 bool radar_detect = false;
294
295 rcu_read_lock();
296 chanctx_conf = rcu_dereference(vif->chanctx_conf);
297 WARN_ON(!chanctx_conf);
298 if (chanctx_conf) {
299 chan = chanctx_conf->def.chan;
300 radar_detect = chan->flags & IEEE80211_CHAN_RADAR;
301 }
302 rcu_read_unlock();
303
304 return radar_detect;
305}
306
289static void iwl_mvm_power_build_cmd(struct iwl_mvm *mvm, 307static void iwl_mvm_power_build_cmd(struct iwl_mvm *mvm,
290 struct ieee80211_vif *vif, 308 struct ieee80211_vif *vif,
291 struct iwl_mac_power_cmd *cmd) 309 struct iwl_mac_power_cmd *cmd)
292{ 310{
293 struct ieee80211_chanctx_conf *chanctx_conf;
294 struct ieee80211_channel *chan;
295 int dtimper, dtimper_msec; 311 int dtimper, dtimper_msec;
296 int keep_alive; 312 int keep_alive;
297 bool radar_detect = false; 313 bool radar_detect = false;
@@ -333,14 +349,7 @@ static void iwl_mvm_power_build_cmd(struct iwl_mvm *mvm,
333 } 349 }
334 350
335 /* Check if radar detection is required on current channel */ 351 /* Check if radar detection is required on current channel */
336 rcu_read_lock(); 352 radar_detect = iwl_mvm_power_is_radar(vif);
337 chanctx_conf = rcu_dereference(vif->chanctx_conf);
338 WARN_ON(!chanctx_conf);
339 if (chanctx_conf) {
340 chan = chanctx_conf->def.chan;
341 radar_detect = chan->flags & IEEE80211_CHAN_RADAR;
342 }
343 rcu_read_unlock();
344 353
345 /* Check skip over DTIM conditions */ 354 /* Check skip over DTIM conditions */
346 if (!radar_detect && (dtimper <= 10) && 355 if (!radar_detect && (dtimper <= 10) &&
@@ -961,17 +970,22 @@ int iwl_mvm_update_d0i3_power_mode(struct iwl_mvm *mvm,
961 970
962 iwl_mvm_power_build_cmd(mvm, vif, &cmd); 971 iwl_mvm_power_build_cmd(mvm, vif, &cmd);
963 if (enable) { 972 if (enable) {
964 /* configure skip over dtim up to 300 msec */ 973 /* configure skip over dtim up to 306TU - 314 msec */
965 int dtimper = vif->bss_conf.dtim_period ?: 1; 974 int dtimper = vif->bss_conf.dtim_period ?: 1;
966 int dtimper_msec = dtimper * vif->bss_conf.beacon_int; 975 int dtimper_tu = dtimper * vif->bss_conf.beacon_int;
976 bool radar_detect = iwl_mvm_power_is_radar(vif);
967 977
968 if (WARN_ON(!dtimper_msec)) 978 if (WARN_ON(!dtimper_tu))
969 return 0; 979 return 0;
970 980
971 cmd.skip_dtim_periods = 300 / dtimper_msec; 981 /* Check skip over DTIM conditions */
972 if (cmd.skip_dtim_periods) 982 /* TODO: check that multicast wake lock is off */
973 cmd.flags |= 983 if (!radar_detect && (dtimper < 10)) {
974 cpu_to_le16(POWER_FLAGS_SKIP_OVER_DTIM_MSK); 984 cmd.skip_dtim_periods = 306 / dtimper_tu;
985 if (cmd.skip_dtim_periods)
986 cmd.flags |= cpu_to_le16(
987 POWER_FLAGS_SKIP_OVER_DTIM_MSK);
988 }
975 } 989 }
976 iwl_mvm_power_log(mvm, &cmd); 990 iwl_mvm_power_log(mvm, &cmd);
977#ifdef CONFIG_IWLWIFI_DEBUGFS 991#ifdef CONFIG_IWLWIFI_DEBUGFS