aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/mlme.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211/mlme.c')
-rw-r--r--net/mac80211/mlme.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index e819c02d13f0..df27c68620c9 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -545,10 +545,19 @@ void ieee80211_recalc_ps(struct ieee80211_local *local, s32 latency)
545 beaconint_us = ieee80211_tu_to_usec( 545 beaconint_us = ieee80211_tu_to_usec(
546 found->vif.bss_conf.beacon_int); 546 found->vif.bss_conf.beacon_int);
547 547
548 if (beaconint_us > latency) 548 if (beaconint_us > latency) {
549 local->ps_sdata = NULL; 549 local->ps_sdata = NULL;
550 else 550 } else {
551 u8 dtimper = found->vif.bss_conf.dtim_period;
552 int maxslp = 1;
553
554 if (dtimper > 1)
555 maxslp = min_t(int, dtimper,
556 latency / beaconint_us);
557
558 local->hw.conf.max_sleep_interval = maxslp;
551 local->ps_sdata = found; 559 local->ps_sdata = found;
560 }
552 } else { 561 } else {
553 local->ps_sdata = NULL; 562 local->ps_sdata = NULL;
554 } 563 }
@@ -851,8 +860,11 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata,
851 ieee80211_bss_info_change_notify(sdata, bss_info_changed); 860 ieee80211_bss_info_change_notify(sdata, bss_info_changed);
852 861
853 /* will be same as sdata */ 862 /* will be same as sdata */
854 if (local->ps_sdata) 863 if (local->ps_sdata) {
855 ieee80211_enable_ps(local, sdata); 864 mutex_lock(&local->iflist_mtx);
865 ieee80211_recalc_ps(local, -1);
866 mutex_unlock(&local->iflist_mtx);
867 }
856 868
857 netif_tx_start_all_queues(sdata->dev); 869 netif_tx_start_all_queues(sdata->dev);
858 netif_carrier_on(sdata->dev); 870 netif_carrier_on(sdata->dev);