aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211')
-rw-r--r--net/mac80211/cfg.c8
-rw-r--r--net/mac80211/ibss.c18
-rw-r--r--net/mac80211/ieee80211_i.h1
-rw-r--r--net/mac80211/main.c131
-rw-r--r--net/mac80211/mesh.c6
-rw-r--r--net/mac80211/mlme.c8
-rw-r--r--net/mac80211/scan.c8
-rw-r--r--net/mac80211/util.c17
8 files changed, 80 insertions, 117 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index a898ccd3f2c9..648bac1c850e 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -521,8 +521,9 @@ static int ieee80211_config_beacon(struct ieee80211_sub_if_data *sdata,
521 521
522 kfree(old); 522 kfree(old);
523 523
524 return ieee80211_if_config(sdata, IEEE80211_IFCC_BEACON | 524 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON_ENABLED |
525 IEEE80211_IFCC_BEACON_ENABLED); 525 BSS_CHANGED_BEACON);
526 return 0;
526} 527}
527 528
528static int ieee80211_add_beacon(struct wiphy *wiphy, struct net_device *dev, 529static int ieee80211_add_beacon(struct wiphy *wiphy, struct net_device *dev,
@@ -573,7 +574,8 @@ static int ieee80211_del_beacon(struct wiphy *wiphy, struct net_device *dev)
573 synchronize_rcu(); 574 synchronize_rcu();
574 kfree(old); 575 kfree(old);
575 576
576 return ieee80211_if_config(sdata, IEEE80211_IFCC_BEACON_ENABLED); 577 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON_ENABLED);
578 return 0;
577} 579}
578 580
579/* Layer 2 Update frame (802.2 Type 1 LLC XID Update response) */ 581/* Layer 2 Update frame (802.2 Type 1 LLC XID Update response) */
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index f4879dad3cd7..c87caad383f0 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -95,17 +95,10 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
95 95
96 sdata->drop_unencrypted = capability & WLAN_CAPABILITY_PRIVACY ? 1 : 0; 96 sdata->drop_unencrypted = capability & WLAN_CAPABILITY_PRIVACY ? 1 : 0;
97 97
98 ieee80211_if_config(sdata, IEEE80211_IFCC_BSSID);
99
100 local->oper_channel = chan; 98 local->oper_channel = chan;
101 local->oper_channel_type = NL80211_CHAN_NO_HT; 99 local->oper_channel_type = NL80211_CHAN_NO_HT;
102 ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL); 100 ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL);
103 101
104 sdata->vif.bss_conf.beacon_int = beacon_int;
105 bss_change = BSS_CHANGED_BEACON_INT;
106 bss_change |= ieee80211_reset_erp_info(sdata);
107 ieee80211_bss_info_change_notify(sdata, bss_change);
108
109 sband = local->hw.wiphy->bands[chan->band]; 102 sband = local->hw.wiphy->bands[chan->band];
110 103
111 /* Build IBSS probe response */ 104 /* Build IBSS probe response */
@@ -161,8 +154,13 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
161 154
162 rcu_assign_pointer(ifibss->presp, skb); 155 rcu_assign_pointer(ifibss->presp, skb);
163 156
164 ieee80211_if_config(sdata, IEEE80211_IFCC_BEACON | 157 sdata->vif.bss_conf.beacon_int = beacon_int;
165 IEEE80211_IFCC_BEACON_ENABLED); 158 bss_change = BSS_CHANGED_BEACON_INT;
159 bss_change |= ieee80211_reset_erp_info(sdata);
160 bss_change |= BSS_CHANGED_BSSID;
161 bss_change |= BSS_CHANGED_BEACON;
162 bss_change |= BSS_CHANGED_BEACON_ENABLED;
163 ieee80211_bss_info_change_notify(sdata, bss_change);
166 164
167 rates = 0; 165 rates = 0;
168 for (i = 0; i < supp_rates_len; i++) { 166 for (i = 0; i < supp_rates_len; i++) {
@@ -887,7 +885,7 @@ int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata)
887 kfree(sdata->u.ibss.ie); 885 kfree(sdata->u.ibss.ie);
888 skb = sdata->u.ibss.presp; 886 skb = sdata->u.ibss.presp;
889 rcu_assign_pointer(sdata->u.ibss.presp, NULL); 887 rcu_assign_pointer(sdata->u.ibss.presp, NULL);
890 ieee80211_if_config(sdata, IEEE80211_IFCC_BEACON_ENABLED); 888 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON_ENABLED);
891 synchronize_rcu(); 889 synchronize_rcu();
892 kfree_skb(skb); 890 kfree_skb(skb);
893 891
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index e6fd4bcf1c3c..d8de1e159ee0 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -906,7 +906,6 @@ static inline int ieee80211_bssid_match(const u8 *raddr, const u8 *addr)
906 906
907 907
908int ieee80211_hw_config(struct ieee80211_local *local, u32 changed); 908int ieee80211_hw_config(struct ieee80211_local *local, u32 changed);
909int ieee80211_if_config(struct ieee80211_sub_if_data *sdata, u32 changed);
910void ieee80211_tx_set_protected(struct ieee80211_tx_data *tx); 909void ieee80211_tx_set_protected(struct ieee80211_tx_data *tx);
911void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata, 910void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata,
912 u32 changed); 911 u32 changed);
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index b254879d8631..c817c9ef215a 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -152,82 +152,6 @@ static void ieee80211_master_set_multicast_list(struct net_device *dev)
152 ieee80211_configure_filter(local); 152 ieee80211_configure_filter(local);
153} 153}
154 154
155/* everything else */
156
157int ieee80211_if_config(struct ieee80211_sub_if_data *sdata, u32 changed)
158{
159 struct ieee80211_local *local = sdata->local;
160 struct ieee80211_if_conf conf;
161
162 if (WARN_ON(!netif_running(sdata->dev)))
163 return 0;
164
165 memset(&conf, 0, sizeof(conf));
166
167 if (sdata->vif.type == NL80211_IFTYPE_STATION)
168 conf.bssid = sdata->u.mgd.bssid;
169 else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
170 conf.bssid = sdata->u.ibss.bssid;
171 else if (sdata->vif.type == NL80211_IFTYPE_AP)
172 conf.bssid = sdata->dev->dev_addr;
173 else if (ieee80211_vif_is_mesh(&sdata->vif)) {
174 static const u8 zero[ETH_ALEN] = { 0 };
175 conf.bssid = zero;
176 } else {
177 WARN_ON(1);
178 return -EINVAL;
179 }
180
181 if (!local->ops->config_interface)
182 return 0;
183
184 switch (sdata->vif.type) {
185 case NL80211_IFTYPE_AP:
186 case NL80211_IFTYPE_ADHOC:
187 case NL80211_IFTYPE_MESH_POINT:
188 break;
189 default:
190 /* do not warn to simplify caller in scan.c */
191 changed &= ~IEEE80211_IFCC_BEACON_ENABLED;
192 if (WARN_ON(changed & IEEE80211_IFCC_BEACON))
193 return -EINVAL;
194 changed &= ~IEEE80211_IFCC_BEACON;
195 break;
196 }
197
198 if (changed & IEEE80211_IFCC_BEACON_ENABLED) {
199 if (local->sw_scanning) {
200 conf.enable_beacon = false;
201 } else {
202 /*
203 * Beacon should be enabled, but AP mode must
204 * check whether there is a beacon configured.
205 */
206 switch (sdata->vif.type) {
207 case NL80211_IFTYPE_AP:
208 conf.enable_beacon =
209 !!rcu_dereference(sdata->u.ap.beacon);
210 break;
211 case NL80211_IFTYPE_ADHOC:
212 conf.enable_beacon = !!sdata->u.ibss.presp;
213 break;
214 case NL80211_IFTYPE_MESH_POINT:
215 conf.enable_beacon = true;
216 break;
217 default:
218 /* not reached */
219 WARN_ON(1);
220 break;
221 }
222 }
223 }
224
225 conf.changed = changed;
226
227 return local->ops->config_interface(local_to_hw(local),
228 &sdata->vif, &conf);
229}
230
231int ieee80211_hw_config(struct ieee80211_local *local, u32 changed) 155int ieee80211_hw_config(struct ieee80211_local *local, u32 changed)
232{ 156{
233 struct ieee80211_channel *chan; 157 struct ieee80211_channel *chan;
@@ -297,6 +221,61 @@ void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata,
297 if (!changed) 221 if (!changed)
298 return; 222 return;
299 223
224 if (sdata->vif.type == NL80211_IFTYPE_STATION)
225 sdata->vif.bss_conf.bssid = sdata->u.mgd.bssid;
226 else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
227 sdata->vif.bss_conf.bssid = sdata->u.ibss.bssid;
228 else if (sdata->vif.type == NL80211_IFTYPE_AP)
229 sdata->vif.bss_conf.bssid = sdata->dev->dev_addr;
230 else if (ieee80211_vif_is_mesh(&sdata->vif)) {
231 static const u8 zero[ETH_ALEN] = { 0 };
232 sdata->vif.bss_conf.bssid = zero;
233 } else {
234 WARN_ON(1);
235 return;
236 }
237
238 switch (sdata->vif.type) {
239 case NL80211_IFTYPE_AP:
240 case NL80211_IFTYPE_ADHOC:
241 case NL80211_IFTYPE_MESH_POINT:
242 break;
243 default:
244 /* do not warn to simplify caller in scan.c */
245 changed &= ~BSS_CHANGED_BEACON_ENABLED;
246 if (WARN_ON(changed & BSS_CHANGED_BEACON))
247 return;
248 break;
249 }
250
251 if (changed & BSS_CHANGED_BEACON_ENABLED) {
252 if (local->sw_scanning) {
253 sdata->vif.bss_conf.enable_beacon = false;
254 } else {
255 /*
256 * Beacon should be enabled, but AP mode must
257 * check whether there is a beacon configured.
258 */
259 switch (sdata->vif.type) {
260 case NL80211_IFTYPE_AP:
261 sdata->vif.bss_conf.enable_beacon =
262 !!rcu_dereference(sdata->u.ap.beacon);
263 break;
264 case NL80211_IFTYPE_ADHOC:
265 sdata->vif.bss_conf.enable_beacon =
266 !!rcu_dereference(sdata->u.ibss.presp);
267 break;
268 case NL80211_IFTYPE_MESH_POINT:
269 sdata->vif.bss_conf.enable_beacon = true;
270 break;
271 default:
272 /* not reached */
273 WARN_ON(1);
274 break;
275 }
276 }
277 }
278
300 if (local->ops->bss_info_changed) 279 if (local->ops->bss_info_changed)
301 local->ops->bss_info_changed(local_to_hw(local), 280 local->ops->bss_info_changed(local_to_hw(local),
302 &sdata->vif, 281 &sdata->vif,
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index 9a3e5de0410a..9000b01a1671 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -417,7 +417,7 @@ static void ieee80211_mesh_housekeeping(struct ieee80211_sub_if_data *sdata,
417 417
418 free_plinks = mesh_plink_availables(sdata); 418 free_plinks = mesh_plink_availables(sdata);
419 if (free_plinks != sdata->u.mesh.accepting_plinks) 419 if (free_plinks != sdata->u.mesh.accepting_plinks)
420 ieee80211_if_config(sdata, IEEE80211_IFCC_BEACON); 420 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON);
421 421
422 ifmsh->housekeeping = false; 422 ifmsh->housekeeping = false;
423 mod_timer(&ifmsh->housekeeping_timer, 423 mod_timer(&ifmsh->housekeeping_timer,
@@ -432,8 +432,8 @@ void ieee80211_start_mesh(struct ieee80211_sub_if_data *sdata)
432 432
433 ifmsh->housekeeping = true; 433 ifmsh->housekeeping = true;
434 queue_work(local->hw.workqueue, &ifmsh->work); 434 queue_work(local->hw.workqueue, &ifmsh->work);
435 ieee80211_if_config(sdata, IEEE80211_IFCC_BEACON | 435 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON |
436 IEEE80211_IFCC_BEACON_ENABLED); 436 BSS_CHANGED_BEACON_ENABLED);
437} 437}
438 438
439void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata) 439void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata)
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index bfd571e6f221..c7971196d9d5 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -2289,12 +2289,8 @@ int ieee80211_sta_set_bssid(struct ieee80211_sub_if_data *sdata, u8 *bssid)
2289 ifmgd->flags &= ~IEEE80211_STA_BSSID_SET; 2289 ifmgd->flags &= ~IEEE80211_STA_BSSID_SET;
2290 } 2290 }
2291 2291
2292 if (netif_running(sdata->dev)) { 2292 if (netif_running(sdata->dev))
2293 if (ieee80211_if_config(sdata, IEEE80211_IFCC_BSSID)) { 2293 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BSSID);
2294 printk(KERN_DEBUG "%s: Failed to config new BSSID to "
2295 "the low-level driver\n", sdata->dev->name);
2296 }
2297 }
2298 2294
2299 return ieee80211_sta_commit(sdata); 2295 return ieee80211_sta_commit(sdata);
2300} 2296}
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
index 086d21645cbc..04e270abdd22 100644
--- a/net/mac80211/scan.c
+++ b/net/mac80211/scan.c
@@ -346,8 +346,8 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted)
346 if (sdata->vif.type == NL80211_IFTYPE_AP || 346 if (sdata->vif.type == NL80211_IFTYPE_AP ||
347 sdata->vif.type == NL80211_IFTYPE_ADHOC || 347 sdata->vif.type == NL80211_IFTYPE_ADHOC ||
348 sdata->vif.type == NL80211_IFTYPE_MESH_POINT) 348 sdata->vif.type == NL80211_IFTYPE_MESH_POINT)
349 ieee80211_if_config(sdata, 349 ieee80211_bss_info_change_notify(
350 IEEE80211_IFCC_BEACON_ENABLED); 350 sdata, BSS_CHANGED_BEACON_ENABLED);
351 } 351 }
352 mutex_unlock(&local->iflist_mtx); 352 mutex_unlock(&local->iflist_mtx);
353 353
@@ -387,8 +387,8 @@ static int ieee80211_start_sw_scan(struct ieee80211_local *local)
387 if (sdata->vif.type == NL80211_IFTYPE_AP || 387 if (sdata->vif.type == NL80211_IFTYPE_AP ||
388 sdata->vif.type == NL80211_IFTYPE_ADHOC || 388 sdata->vif.type == NL80211_IFTYPE_ADHOC ||
389 sdata->vif.type == NL80211_IFTYPE_MESH_POINT) 389 sdata->vif.type == NL80211_IFTYPE_MESH_POINT)
390 ieee80211_if_config(sdata, 390 ieee80211_bss_info_change_notify(
391 IEEE80211_IFCC_BEACON_ENABLED); 391 sdata, BSS_CHANGED_BEACON_ENABLED);
392 392
393 if (sdata->vif.type == NL80211_IFTYPE_STATION) { 393 if (sdata->vif.type == NL80211_IFTYPE_STATION) {
394 if (sdata->u.mgd.flags & IEEE80211_STA_ASSOCIATED) { 394 if (sdata->u.mgd.flags & IEEE80211_STA_ASSOCIATED) {
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 61876eb50b49..2cde9bbfe7d9 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -1063,24 +1063,13 @@ int ieee80211_reconfig(struct ieee80211_local *local)
1063 switch (sdata->vif.type) { 1063 switch (sdata->vif.type) {
1064 case NL80211_IFTYPE_STATION: 1064 case NL80211_IFTYPE_STATION:
1065 /* disable beacon change bits */ 1065 /* disable beacon change bits */
1066 changed &= ~IEEE80211_IFCC_BEACON; 1066 changed &= ~(BSS_CHANGED_BEACON |
1067 BSS_CHANGED_BEACON_ENABLED);
1067 /* fall through */ 1068 /* fall through */
1068 case NL80211_IFTYPE_ADHOC: 1069 case NL80211_IFTYPE_ADHOC:
1069 case NL80211_IFTYPE_AP: 1070 case NL80211_IFTYPE_AP:
1070 case NL80211_IFTYPE_MESH_POINT: 1071 case NL80211_IFTYPE_MESH_POINT:
1071 /* 1072 ieee80211_bss_info_change_notify(sdata, changed);
1072 * Driver's config_interface can fail if rfkill is
1073 * enabled. Accommodate this return code.
1074 * FIXME: When mac80211 has knowledge of rfkill
1075 * state the code below can change back to:
1076 * WARN(ieee80211_if_config(sdata, changed));
1077 * ieee80211_bss_info_change_notify(sdata, ~0);
1078 */
1079 if (ieee80211_if_config(sdata, changed))
1080 printk(KERN_DEBUG "%s: failed to configure interface during resume\n",
1081 sdata->dev->name);
1082 else
1083 ieee80211_bss_info_change_notify(sdata, ~0);
1084 break; 1073 break;
1085 case NL80211_IFTYPE_WDS: 1074 case NL80211_IFTYPE_WDS:
1086 break; 1075 break;