diff options
author | Alexander Bondar <alexander.bondar@intel.com> | 2013-05-16 10:34:17 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2013-06-05 03:12:20 -0400 |
commit | 989c6505cdda587f87573bb6828f23964dd3d19b (patch) | |
tree | 5804f7d8569273db24015655b16cd3e703756053 /net/mac80211/mlme.c | |
parent | 482a9c74fa17c5d584995c19e1a36eaf710d1193 (diff) |
mac80211: Use suitable semantics for beacon availability indication
Currently beacon availability upon association is marked by have_beacon
flag of assoc_data structure that becomes unavailable when association
completes. However beacon availability indication is required also after
association to inform a driver. Currently dtim_period parameter is used
for this purpose. Move have_beacon flag to another structure, persistant
throughout a interface's life cycle. Use suitable sematics for beacon
availability indication.
Signed-off-by: Alexander Bondar <alexander.bondar@intel.com>
[fix another instance of BSS_CHANGED_DTIM_PERIOD in docs]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/mlme.c')
-rw-r--r-- | net/mac80211/mlme.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index aa5cd2e138be..ad9bb9e10cbb 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -1360,7 +1360,7 @@ static bool ieee80211_powersave_allowed(struct ieee80211_sub_if_data *sdata) | |||
1360 | IEEE80211_STA_CONNECTION_POLL)) | 1360 | IEEE80211_STA_CONNECTION_POLL)) |
1361 | return false; | 1361 | return false; |
1362 | 1362 | ||
1363 | if (!sdata->vif.bss_conf.dtim_period) | 1363 | if (!mgd->have_beacon) |
1364 | return false; | 1364 | return false; |
1365 | 1365 | ||
1366 | rcu_read_lock(); | 1366 | rcu_read_lock(); |
@@ -1771,7 +1771,7 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata, | |||
1771 | 1771 | ||
1772 | ieee80211_led_assoc(local, 1); | 1772 | ieee80211_led_assoc(local, 1); |
1773 | 1773 | ||
1774 | if (sdata->u.mgd.assoc_data->have_beacon) { | 1774 | if (sdata->u.mgd.have_beacon) { |
1775 | /* | 1775 | /* |
1776 | * If the AP is buggy we may get here with no DTIM period | 1776 | * If the AP is buggy we may get here with no DTIM period |
1777 | * known, so assume it's 1 which is the only safe assumption | 1777 | * known, so assume it's 1 which is the only safe assumption |
@@ -1779,7 +1779,7 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata, | |||
1779 | * probably just won't work at all. | 1779 | * probably just won't work at all. |
1780 | */ | 1780 | */ |
1781 | bss_conf->dtim_period = sdata->u.mgd.dtim_period ?: 1; | 1781 | bss_conf->dtim_period = sdata->u.mgd.dtim_period ?: 1; |
1782 | bss_info_changed |= BSS_CHANGED_DTIM_PERIOD; | 1782 | bss_info_changed |= BSS_CHANGED_BEACON_INFO; |
1783 | } else { | 1783 | } else { |
1784 | bss_conf->dtim_period = 0; | 1784 | bss_conf->dtim_period = 0; |
1785 | } | 1785 | } |
@@ -1903,6 +1903,7 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata, | |||
1903 | del_timer_sync(&sdata->u.mgd.chswitch_timer); | 1903 | del_timer_sync(&sdata->u.mgd.chswitch_timer); |
1904 | 1904 | ||
1905 | sdata->vif.bss_conf.dtim_period = 0; | 1905 | sdata->vif.bss_conf.dtim_period = 0; |
1906 | ifmgd->have_beacon = false; | ||
1906 | 1907 | ||
1907 | ifmgd->flags = 0; | 1908 | ifmgd->flags = 0; |
1908 | ieee80211_vif_release_channel(sdata); | 1909 | ieee80211_vif_release_channel(sdata); |
@@ -2877,7 +2878,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, | |||
2877 | const struct ieee80211_tim_ie *tim_ie = elems.tim; | 2878 | const struct ieee80211_tim_ie *tim_ie = elems.tim; |
2878 | ifmgd->dtim_period = tim_ie->dtim_period; | 2879 | ifmgd->dtim_period = tim_ie->dtim_period; |
2879 | } | 2880 | } |
2880 | ifmgd->assoc_data->have_beacon = true; | 2881 | ifmgd->have_beacon = true; |
2881 | ifmgd->assoc_data->need_beacon = false; | 2882 | ifmgd->assoc_data->need_beacon = false; |
2882 | if (local->hw.flags & IEEE80211_HW_TIMING_BEACON_ONLY) { | 2883 | if (local->hw.flags & IEEE80211_HW_TIMING_BEACON_ONLY) { |
2883 | sdata->vif.bss_conf.sync_tsf = | 2884 | sdata->vif.bss_conf.sync_tsf = |
@@ -3059,7 +3060,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, | |||
3059 | * If we haven't had a beacon before, tell the driver about the | 3060 | * If we haven't had a beacon before, tell the driver about the |
3060 | * DTIM period (and beacon timing if desired) now. | 3061 | * DTIM period (and beacon timing if desired) now. |
3061 | */ | 3062 | */ |
3062 | if (!bss_conf->dtim_period) { | 3063 | if (!ifmgd->have_beacon) { |
3063 | /* a few bogus AP send dtim_period = 0 or no TIM IE */ | 3064 | /* a few bogus AP send dtim_period = 0 or no TIM IE */ |
3064 | if (elems.tim) | 3065 | if (elems.tim) |
3065 | bss_conf->dtim_period = elems.tim->dtim_period ?: 1; | 3066 | bss_conf->dtim_period = elems.tim->dtim_period ?: 1; |
@@ -3078,7 +3079,8 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, | |||
3078 | sdata->vif.bss_conf.sync_dtim_count = 0; | 3079 | sdata->vif.bss_conf.sync_dtim_count = 0; |
3079 | } | 3080 | } |
3080 | 3081 | ||
3081 | changed |= BSS_CHANGED_DTIM_PERIOD; | 3082 | changed |= BSS_CHANGED_BEACON_INFO; |
3083 | ifmgd->have_beacon = true; | ||
3082 | 3084 | ||
3083 | mutex_lock(&local->iflist_mtx); | 3085 | mutex_lock(&local->iflist_mtx); |
3084 | ieee80211_recalc_ps(local, -1); | 3086 | ieee80211_recalc_ps(local, -1); |
@@ -3424,8 +3426,7 @@ void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata) | |||
3424 | 3426 | ||
3425 | if (ifmgd->assoc_data && ifmgd->assoc_data->timeout_started && | 3427 | if (ifmgd->assoc_data && ifmgd->assoc_data->timeout_started && |
3426 | time_after(jiffies, ifmgd->assoc_data->timeout)) { | 3428 | time_after(jiffies, ifmgd->assoc_data->timeout)) { |
3427 | if ((ifmgd->assoc_data->need_beacon && | 3429 | if ((ifmgd->assoc_data->need_beacon && !ifmgd->have_beacon) || |
3428 | !ifmgd->assoc_data->have_beacon) || | ||
3429 | ieee80211_do_assoc(sdata)) { | 3430 | ieee80211_do_assoc(sdata)) { |
3430 | u8 bssid[ETH_ALEN]; | 3431 | u8 bssid[ETH_ALEN]; |
3431 | 3432 | ||
@@ -4193,6 +4194,7 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata, | |||
4193 | 4194 | ||
4194 | ifmgd->assoc_data = assoc_data; | 4195 | ifmgd->assoc_data = assoc_data; |
4195 | ifmgd->dtim_period = 0; | 4196 | ifmgd->dtim_period = 0; |
4197 | ifmgd->have_beacon = false; | ||
4196 | 4198 | ||
4197 | err = ieee80211_prep_connection(sdata, req->bss, true); | 4199 | err = ieee80211_prep_connection(sdata, req->bss, true); |
4198 | if (err) | 4200 | if (err) |
@@ -4224,7 +4226,7 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata, | |||
4224 | ifmgd->dtim_period = tim->dtim_period; | 4226 | ifmgd->dtim_period = tim->dtim_period; |
4225 | dtim_count = tim->dtim_count; | 4227 | dtim_count = tim->dtim_count; |
4226 | } | 4228 | } |
4227 | assoc_data->have_beacon = true; | 4229 | ifmgd->have_beacon = true; |
4228 | assoc_data->timeout = jiffies; | 4230 | assoc_data->timeout = jiffies; |
4229 | assoc_data->timeout_started = true; | 4231 | assoc_data->timeout_started = true; |
4230 | 4232 | ||