diff options
author | Alexander Bondar <alexander.bondar@intel.com> | 2013-06-03 10:29:33 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2013-06-05 02:52:47 -0400 |
commit | 482a9c74fa17c5d584995c19e1a36eaf710d1193 (patch) | |
tree | b75dca5fc3f09a9e682cafe083a48ba21bf8ddd7 /net/mac80211 | |
parent | 9b881963c1c81f965f89a3e89b1aa5557f67ee30 (diff) |
mac80211: fix powersave bug and clean up ieee80211_rx_bss_info
ieee80211_rx_bss_info() deals with dtim_period setting and PS update
when associated. Move all these to another locations cleaning this
function. Also, the current implementation is buggy because when it
calls ieee80211_recalc_ps() bss_conf->dtim_period is notset properly
yet and thus nothing will happen.
Signed-off-by: Alexander Bondar <alexander.bondar@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r-- | net/mac80211/mlme.c | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index df8170a80a56..aa5cd2e138be 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -2737,24 +2737,9 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, | |||
2737 | int freq; | 2737 | int freq; |
2738 | struct ieee80211_bss *bss; | 2738 | struct ieee80211_bss *bss; |
2739 | struct ieee80211_channel *channel; | 2739 | struct ieee80211_channel *channel; |
2740 | bool need_ps = false; | ||
2741 | 2740 | ||
2742 | sdata_assert_lock(sdata); | 2741 | sdata_assert_lock(sdata); |
2743 | 2742 | ||
2744 | if ((sdata->u.mgd.associated && | ||
2745 | ether_addr_equal(mgmt->bssid, sdata->u.mgd.associated->bssid)) || | ||
2746 | (sdata->u.mgd.assoc_data && | ||
2747 | ether_addr_equal(mgmt->bssid, | ||
2748 | sdata->u.mgd.assoc_data->bss->bssid))) { | ||
2749 | /* not previously set so we may need to recalc */ | ||
2750 | need_ps = sdata->u.mgd.associated && !sdata->u.mgd.dtim_period; | ||
2751 | |||
2752 | if (elems->tim && !elems->parse_error) { | ||
2753 | const struct ieee80211_tim_ie *tim_ie = elems->tim; | ||
2754 | sdata->u.mgd.dtim_period = tim_ie->dtim_period; | ||
2755 | } | ||
2756 | } | ||
2757 | |||
2758 | if (elems->ds_params) | 2743 | if (elems->ds_params) |
2759 | freq = ieee80211_channel_to_frequency(elems->ds_params[0], | 2744 | freq = ieee80211_channel_to_frequency(elems->ds_params[0], |
2760 | rx_status->band); | 2745 | rx_status->band); |
@@ -2775,12 +2760,6 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, | |||
2775 | !ether_addr_equal(mgmt->bssid, sdata->u.mgd.associated->bssid)) | 2760 | !ether_addr_equal(mgmt->bssid, sdata->u.mgd.associated->bssid)) |
2776 | return; | 2761 | return; |
2777 | 2762 | ||
2778 | if (need_ps) { | ||
2779 | mutex_lock(&local->iflist_mtx); | ||
2780 | ieee80211_recalc_ps(local, -1); | ||
2781 | mutex_unlock(&local->iflist_mtx); | ||
2782 | } | ||
2783 | |||
2784 | ieee80211_sta_process_chanswitch(sdata, rx_status->mactime, | 2763 | ieee80211_sta_process_chanswitch(sdata, rx_status->mactime, |
2785 | elems, true); | 2764 | elems, true); |
2786 | 2765 | ||
@@ -2894,6 +2873,10 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, | |||
2894 | len - baselen, false, &elems); | 2873 | len - baselen, false, &elems); |
2895 | 2874 | ||
2896 | ieee80211_rx_bss_info(sdata, mgmt, len, rx_status, &elems); | 2875 | ieee80211_rx_bss_info(sdata, mgmt, len, rx_status, &elems); |
2876 | if (elems.tim && !elems.parse_error) { | ||
2877 | const struct ieee80211_tim_ie *tim_ie = elems.tim; | ||
2878 | ifmgd->dtim_period = tim_ie->dtim_period; | ||
2879 | } | ||
2897 | ifmgd->assoc_data->have_beacon = true; | 2880 | ifmgd->assoc_data->have_beacon = true; |
2898 | ifmgd->assoc_data->need_beacon = false; | 2881 | ifmgd->assoc_data->need_beacon = false; |
2899 | if (local->hw.flags & IEEE80211_HW_TIMING_BEACON_ONLY) { | 2882 | if (local->hw.flags & IEEE80211_HW_TIMING_BEACON_ONLY) { |
@@ -3096,6 +3079,11 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, | |||
3096 | } | 3079 | } |
3097 | 3080 | ||
3098 | changed |= BSS_CHANGED_DTIM_PERIOD; | 3081 | changed |= BSS_CHANGED_DTIM_PERIOD; |
3082 | |||
3083 | mutex_lock(&local->iflist_mtx); | ||
3084 | ieee80211_recalc_ps(local, -1); | ||
3085 | mutex_unlock(&local->iflist_mtx); | ||
3086 | |||
3099 | ieee80211_recalc_ps_vif(sdata); | 3087 | ieee80211_recalc_ps_vif(sdata); |
3100 | } | 3088 | } |
3101 | 3089 | ||