aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211
diff options
context:
space:
mode:
authorEliad Peller <eliad@wizery.com>2012-07-27 05:33:22 -0400
committerJohannes Berg <johannes.berg@intel.com>2012-07-31 10:11:04 -0400
commitab09587740fddf6b4116be7b6716ab47f34d2634 (patch)
tree18c304410c82725356a3a8d6076b2f9af173b21a /net/mac80211
parent2b2b64380785bdcaaa9a123e7e5829acc749c4ca (diff)
mac80211: add PS flag to bss_conf
Currently, ps mode is indicated per device (rather than per interface), which doesn't make a lot of sense. Moreover, there are subtle bugs caused by the inability to indicate ps change along with other changes (e.g. when the AP deauth us, we'd like to indicate CHANGED_PS | CHANGED_ASSOC, as changing PS before notifying about disassociation will result in null-packets being sent (if IEEE80211_HW_SUPPORTS_DYNAMIC_PS) while the sta is already disconnected.) Keep the current per-device notifications, and add parallel per-vif notifications. In order to keep it simple, the per-device ps and the per-vif ps are orthogonal - the per-vif ps configuration is determined only by the user configuration (enable/disable) and the connection state, and is not affected by other vifs state and (temporary) dynamic_ps/offchannel operations (unlike per-device ps). Signed-off-by: Eliad Peller <eliad@wizery.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r--net/mac80211/cfg.c6
-rw-r--r--net/mac80211/ieee80211_i.h1
-rw-r--r--net/mac80211/mlme.c15
-rw-r--r--net/mac80211/util.c3
4 files changed, 22 insertions, 3 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index d41974aacf51..06b8d39780e9 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1285,9 +1285,10 @@ static int ieee80211_change_station(struct wiphy *wiphy,
1285 mutex_unlock(&local->sta_mtx); 1285 mutex_unlock(&local->sta_mtx);
1286 1286
1287 if (sdata->vif.type == NL80211_IFTYPE_STATION && 1287 if (sdata->vif.type == NL80211_IFTYPE_STATION &&
1288 params->sta_flags_mask & BIT(NL80211_STA_FLAG_AUTHORIZED)) 1288 params->sta_flags_mask & BIT(NL80211_STA_FLAG_AUTHORIZED)) {
1289 ieee80211_recalc_ps(local, -1); 1289 ieee80211_recalc_ps(local, -1);
1290 1290 ieee80211_recalc_ps_vif(sdata);
1291 }
1291 return 0; 1292 return 0;
1292} 1293}
1293 1294
@@ -2079,6 +2080,7 @@ static int ieee80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
2079 ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS); 2080 ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS);
2080 2081
2081 ieee80211_recalc_ps(local, -1); 2082 ieee80211_recalc_ps(local, -1);
2083 ieee80211_recalc_ps_vif(sdata);
2082 2084
2083 return 0; 2085 return 0;
2084} 2086}
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 3e2f03b1b50e..8e65ad9c870a 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -1203,6 +1203,7 @@ int ieee80211_mgd_disassoc(struct ieee80211_sub_if_data *sdata,
1203void ieee80211_send_pspoll(struct ieee80211_local *local, 1203void ieee80211_send_pspoll(struct ieee80211_local *local,
1204 struct ieee80211_sub_if_data *sdata); 1204 struct ieee80211_sub_if_data *sdata);
1205void ieee80211_recalc_ps(struct ieee80211_local *local, s32 latency); 1205void ieee80211_recalc_ps(struct ieee80211_local *local, s32 latency);
1206void ieee80211_recalc_ps_vif(struct ieee80211_sub_if_data *sdata);
1206int ieee80211_max_network_latency(struct notifier_block *nb, 1207int ieee80211_max_network_latency(struct notifier_block *nb,
1207 unsigned long data, void *dummy); 1208 unsigned long data, void *dummy);
1208int ieee80211_set_arp_filter(struct ieee80211_sub_if_data *sdata); 1209int ieee80211_set_arp_filter(struct ieee80211_sub_if_data *sdata);
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index f0d6fa283071..ea46c6446450 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -1032,6 +1032,16 @@ void ieee80211_recalc_ps(struct ieee80211_local *local, s32 latency)
1032 ieee80211_change_ps(local); 1032 ieee80211_change_ps(local);
1033} 1033}
1034 1034
1035void ieee80211_recalc_ps_vif(struct ieee80211_sub_if_data *sdata)
1036{
1037 bool ps_allowed = ieee80211_powersave_allowed(sdata);
1038
1039 if (sdata->vif.bss_conf.ps != ps_allowed) {
1040 sdata->vif.bss_conf.ps = ps_allowed;
1041 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_PS);
1042 }
1043}
1044
1035void ieee80211_dynamic_ps_disable_work(struct work_struct *work) 1045void ieee80211_dynamic_ps_disable_work(struct work_struct *work)
1036{ 1046{
1037 struct ieee80211_local *local = 1047 struct ieee80211_local *local =
@@ -1335,6 +1345,8 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata,
1335 ieee80211_recalc_smps(local); 1345 ieee80211_recalc_smps(local);
1336 mutex_unlock(&local->iflist_mtx); 1346 mutex_unlock(&local->iflist_mtx);
1337 1347
1348 ieee80211_recalc_ps_vif(sdata);
1349
1338 netif_tx_start_all_queues(sdata->dev); 1350 netif_tx_start_all_queues(sdata->dev);
1339 netif_carrier_on(sdata->dev); 1351 netif_carrier_on(sdata->dev);
1340} 1352}
@@ -1396,6 +1408,9 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
1396 } 1408 }
1397 local->ps_sdata = NULL; 1409 local->ps_sdata = NULL;
1398 1410
1411 /* disable per-vif ps */
1412 ieee80211_recalc_ps_vif(sdata);
1413
1399 /* flush out any pending frame (e.g. DELBA) before deauth/disassoc */ 1414 /* flush out any pending frame (e.g. DELBA) before deauth/disassoc */
1400 if (tx) 1415 if (tx)
1401 drv_flush(local, false); 1416 drv_flush(local, false);
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 39b82fee4904..037d148e9f19 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -1359,7 +1359,8 @@ int ieee80211_reconfig(struct ieee80211_local *local)
1359 switch (sdata->vif.type) { 1359 switch (sdata->vif.type) {
1360 case NL80211_IFTYPE_STATION: 1360 case NL80211_IFTYPE_STATION:
1361 changed |= BSS_CHANGED_ASSOC | 1361 changed |= BSS_CHANGED_ASSOC |
1362 BSS_CHANGED_ARP_FILTER; 1362 BSS_CHANGED_ARP_FILTER |
1363 BSS_CHANGED_PS;
1363 mutex_lock(&sdata->u.mgd.mtx); 1364 mutex_lock(&sdata->u.mgd.mtx);
1364 ieee80211_bss_info_change_notify(sdata, changed); 1365 ieee80211_bss_info_change_notify(sdata, changed);
1365 mutex_unlock(&sdata->u.mgd.mtx); 1366 mutex_unlock(&sdata->u.mgd.mtx);