aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/mesh_ps.c
diff options
context:
space:
mode:
authorThomas Pedersen <thomas@cozybit.com>2013-02-13 15:14:19 -0500
committerJohannes Berg <johannes.berg@intel.com>2013-02-15 03:41:09 -0500
commit39886b618aba3c39e650c191d601e26ec581ce0f (patch)
tree6a68823a37ba8e3b68293ad78d572653a5e0c72b /net/mac80211/mesh_ps.c
parentde74a1d9032f4d37ea453ad2a647e1aff4cd2591 (diff)
mac80211: consolidate MBSS change notification
A few mesh utility functions will call ieee80211_bss_info_change_notify(), and then the caller might notify the driver of the same change again. Avoid this redundancy by propagating the BSS changes and generally calling bss_info_change_notify() once per change. Signed-off-by: Thomas Pedersen <thomas@cozybit.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/mesh_ps.c')
-rw-r--r--net/mac80211/mesh_ps.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/net/mac80211/mesh_ps.c b/net/mac80211/mesh_ps.c
index b677962525ed..3b7bfc01ee36 100644
--- a/net/mac80211/mesh_ps.c
+++ b/net/mac80211/mesh_ps.c
@@ -74,14 +74,17 @@ static void mps_qos_null_tx(struct sta_info *sta)
74 * @sdata: local mesh subif 74 * @sdata: local mesh subif
75 * 75 *
76 * sets the non-peer power mode and triggers the driver PS (re-)configuration 76 * sets the non-peer power mode and triggers the driver PS (re-)configuration
77 * Return BSS_CHANGED_BEACON if a beacon update is necessary.
77 */ 78 */
78void ieee80211_mps_local_status_update(struct ieee80211_sub_if_data *sdata) 79u32 ieee80211_mps_local_status_update(struct ieee80211_sub_if_data *sdata)
79{ 80{
80 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; 81 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
81 struct sta_info *sta; 82 struct sta_info *sta;
82 bool peering = false; 83 bool peering = false;
83 int light_sleep_cnt = 0; 84 int light_sleep_cnt = 0;
84 int deep_sleep_cnt = 0; 85 int deep_sleep_cnt = 0;
86 u32 changed = 0;
87 enum nl80211_mesh_power_mode nonpeer_pm;
85 88
86 rcu_read_lock(); 89 rcu_read_lock();
87 list_for_each_entry_rcu(sta, &sdata->local->sta_list, list) { 90 list_for_each_entry_rcu(sta, &sdata->local->sta_list, list) {
@@ -115,17 +118,26 @@ void ieee80211_mps_local_status_update(struct ieee80211_sub_if_data *sdata)
115 */ 118 */
116 if (peering) { 119 if (peering) {
117 mps_dbg(sdata, "setting non-peer PM to active for peering\n"); 120 mps_dbg(sdata, "setting non-peer PM to active for peering\n");
118 ifmsh->nonpeer_pm = NL80211_MESH_POWER_ACTIVE; 121 nonpeer_pm = NL80211_MESH_POWER_ACTIVE;
119 } else if (light_sleep_cnt || deep_sleep_cnt) { 122 } else if (light_sleep_cnt || deep_sleep_cnt) {
120 mps_dbg(sdata, "setting non-peer PM to deep sleep\n"); 123 mps_dbg(sdata, "setting non-peer PM to deep sleep\n");
121 ifmsh->nonpeer_pm = NL80211_MESH_POWER_DEEP_SLEEP; 124 nonpeer_pm = NL80211_MESH_POWER_DEEP_SLEEP;
122 } else { 125 } else {
123 mps_dbg(sdata, "setting non-peer PM to user value\n"); 126 mps_dbg(sdata, "setting non-peer PM to user value\n");
124 ifmsh->nonpeer_pm = ifmsh->mshcfg.power_mode; 127 nonpeer_pm = ifmsh->mshcfg.power_mode;
125 } 128 }
126 129
130 /* need update if sleep counts move between 0 and non-zero */
131 if (ifmsh->nonpeer_pm != nonpeer_pm ||
132 !ifmsh->ps_peers_light_sleep != !light_sleep_cnt ||
133 !ifmsh->ps_peers_deep_sleep != !deep_sleep_cnt)
134 changed = BSS_CHANGED_BEACON;
135
136 ifmsh->nonpeer_pm = nonpeer_pm;
127 ifmsh->ps_peers_light_sleep = light_sleep_cnt; 137 ifmsh->ps_peers_light_sleep = light_sleep_cnt;
128 ifmsh->ps_peers_deep_sleep = deep_sleep_cnt; 138 ifmsh->ps_peers_deep_sleep = deep_sleep_cnt;
139
140 return changed;
129} 141}
130 142
131/** 143/**
@@ -133,9 +145,10 @@ void ieee80211_mps_local_status_update(struct ieee80211_sub_if_data *sdata)
133 * 145 *
134 * @sta: mesh STA 146 * @sta: mesh STA
135 * @pm: the power mode to set 147 * @pm: the power mode to set
148 * Return BSS_CHANGED_BEACON if a beacon update is in order.
136 */ 149 */
137void ieee80211_mps_set_sta_local_pm(struct sta_info *sta, 150u32 ieee80211_mps_set_sta_local_pm(struct sta_info *sta,
138 enum nl80211_mesh_power_mode pm) 151 enum nl80211_mesh_power_mode pm)
139{ 152{
140 struct ieee80211_sub_if_data *sdata = sta->sdata; 153 struct ieee80211_sub_if_data *sdata = sta->sdata;
141 154
@@ -151,7 +164,7 @@ void ieee80211_mps_set_sta_local_pm(struct sta_info *sta,
151 if (sta->plink_state == NL80211_PLINK_ESTAB) 164 if (sta->plink_state == NL80211_PLINK_ESTAB)
152 mps_qos_null_tx(sta); 165 mps_qos_null_tx(sta);
153 166
154 ieee80211_mps_local_status_update(sdata); 167 return ieee80211_mps_local_status_update(sdata);
155} 168}
156 169
157/** 170/**