diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2009-02-15 06:44:28 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-02-27 14:51:42 -0500 |
commit | 469002983fc90c2ff0959e2b03335c0fe2e4d5a9 (patch) | |
tree | fdcf78dcdaeadba897abd86d39d0275e236803b3 /net/mac80211/scan.c | |
parent | 96f5e66e8a79810e2982cdcfa28e554f3d97da21 (diff) |
mac80211: split IBSS/managed code
This patch splits out the ibss code and data from managed (station) mode.
The reason to do this is to better separate the state machines, and have
the code be contained better so it gets easier to determine what exactly
a given change will affect, that in turn makes it easier to understand.
This is quite some churn, especially because I split sdata->u.sta into
sdata->u.mgd and sdata->u.ibss, but I think it's easier to maintain that
way. I've also shuffled around some code -- null function sending is only
applicable to managed interfaces so put that into that file, some other
functions are needed from various places so put them into util, and also
rearranged the prototypes in ieee80211_i.h accordingly.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/scan.c')
-rw-r--r-- | net/mac80211/scan.c | 43 |
1 files changed, 7 insertions, 36 deletions
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c index f883ab9f1e6e..08a1fc27ca10 100644 --- a/net/mac80211/scan.c +++ b/net/mac80211/scan.c | |||
@@ -207,36 +207,6 @@ ieee80211_scan_rx(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb, | |||
207 | return RX_QUEUED; | 207 | return RX_QUEUED; |
208 | } | 208 | } |
209 | 209 | ||
210 | void ieee80211_send_nullfunc(struct ieee80211_local *local, | ||
211 | struct ieee80211_sub_if_data *sdata, | ||
212 | int powersave) | ||
213 | { | ||
214 | struct sk_buff *skb; | ||
215 | struct ieee80211_hdr *nullfunc; | ||
216 | __le16 fc; | ||
217 | |||
218 | skb = dev_alloc_skb(local->hw.extra_tx_headroom + 24); | ||
219 | if (!skb) { | ||
220 | printk(KERN_DEBUG "%s: failed to allocate buffer for nullfunc " | ||
221 | "frame\n", sdata->dev->name); | ||
222 | return; | ||
223 | } | ||
224 | skb_reserve(skb, local->hw.extra_tx_headroom); | ||
225 | |||
226 | nullfunc = (struct ieee80211_hdr *) skb_put(skb, 24); | ||
227 | memset(nullfunc, 0, 24); | ||
228 | fc = cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_NULLFUNC | | ||
229 | IEEE80211_FCTL_TODS); | ||
230 | if (powersave) | ||
231 | fc |= cpu_to_le16(IEEE80211_FCTL_PM); | ||
232 | nullfunc->frame_control = fc; | ||
233 | memcpy(nullfunc->addr1, sdata->u.sta.bssid, ETH_ALEN); | ||
234 | memcpy(nullfunc->addr2, sdata->dev->dev_addr, ETH_ALEN); | ||
235 | memcpy(nullfunc->addr3, sdata->u.sta.bssid, ETH_ALEN); | ||
236 | |||
237 | ieee80211_tx_skb(sdata, skb, 0); | ||
238 | } | ||
239 | |||
240 | void ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted) | 210 | void ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted) |
241 | { | 211 | { |
242 | struct ieee80211_local *local = hw_to_local(hw); | 212 | struct ieee80211_local *local = hw_to_local(hw); |
@@ -287,7 +257,7 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted) | |||
287 | 257 | ||
288 | /* Tell AP we're back */ | 258 | /* Tell AP we're back */ |
289 | if (sdata->vif.type == NL80211_IFTYPE_STATION) { | 259 | if (sdata->vif.type == NL80211_IFTYPE_STATION) { |
290 | if (sdata->u.sta.flags & IEEE80211_STA_ASSOCIATED) { | 260 | if (sdata->u.mgd.flags & IEEE80211_STA_ASSOCIATED) { |
291 | ieee80211_send_nullfunc(local, sdata, 0); | 261 | ieee80211_send_nullfunc(local, sdata, 0); |
292 | netif_tx_wake_all_queues(sdata->dev); | 262 | netif_tx_wake_all_queues(sdata->dev); |
293 | } | 263 | } |
@@ -305,6 +275,7 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted) | |||
305 | 275 | ||
306 | done: | 276 | done: |
307 | ieee80211_mlme_notify_scan_completed(local); | 277 | ieee80211_mlme_notify_scan_completed(local); |
278 | ieee80211_ibss_notify_scan_completed(local); | ||
308 | ieee80211_mesh_notify_scan_completed(local); | 279 | ieee80211_mesh_notify_scan_completed(local); |
309 | } | 280 | } |
310 | EXPORT_SYMBOL(ieee80211_scan_completed); | 281 | EXPORT_SYMBOL(ieee80211_scan_completed); |
@@ -442,7 +413,7 @@ int ieee80211_start_scan(struct ieee80211_sub_if_data *scan_sdata, | |||
442 | IEEE80211_IFCC_BEACON_ENABLED); | 413 | IEEE80211_IFCC_BEACON_ENABLED); |
443 | 414 | ||
444 | if (sdata->vif.type == NL80211_IFTYPE_STATION) { | 415 | if (sdata->vif.type == NL80211_IFTYPE_STATION) { |
445 | if (sdata->u.sta.flags & IEEE80211_STA_ASSOCIATED) { | 416 | if (sdata->u.mgd.flags & IEEE80211_STA_ASSOCIATED) { |
446 | netif_tx_stop_all_queues(sdata->dev); | 417 | netif_tx_stop_all_queues(sdata->dev); |
447 | ieee80211_send_nullfunc(local, sdata, 1); | 418 | ieee80211_send_nullfunc(local, sdata, 1); |
448 | } | 419 | } |
@@ -477,7 +448,7 @@ int ieee80211_request_scan(struct ieee80211_sub_if_data *sdata, | |||
477 | struct cfg80211_scan_request *req) | 448 | struct cfg80211_scan_request *req) |
478 | { | 449 | { |
479 | struct ieee80211_local *local = sdata->local; | 450 | struct ieee80211_local *local = sdata->local; |
480 | struct ieee80211_if_sta *ifsta; | 451 | struct ieee80211_if_managed *ifmgd; |
481 | 452 | ||
482 | if (!req) | 453 | if (!req) |
483 | return -EINVAL; | 454 | return -EINVAL; |
@@ -502,9 +473,9 @@ int ieee80211_request_scan(struct ieee80211_sub_if_data *sdata, | |||
502 | return -EBUSY; | 473 | return -EBUSY; |
503 | } | 474 | } |
504 | 475 | ||
505 | ifsta = &sdata->u.sta; | 476 | ifmgd = &sdata->u.mgd; |
506 | set_bit(IEEE80211_STA_REQ_SCAN, &ifsta->request); | 477 | set_bit(IEEE80211_STA_REQ_SCAN, &ifmgd->request); |
507 | queue_work(local->hw.workqueue, &ifsta->work); | 478 | queue_work(local->hw.workqueue, &ifmgd->work); |
508 | 479 | ||
509 | return 0; | 480 | return 0; |
510 | } | 481 | } |