aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-09-10 18:01:55 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-09-15 16:48:22 -0400
commitc2b13452b283f9c4a5b02a6b53ed6416ebf4c03c (patch)
tree756b8c9668c643293a46389b8b8f34b8efd3d2ea /net
parent213cd118cbb88b76ae48f92cfb7dbef9a83cca62 (diff)
mac80211: clean up scan namespace
Most of the scan functions are called ieee80211_sta_scan_* or similar, make clean it up so they are all just called ieee80211_scan_*. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net')
-rw-r--r--net/mac80211/ieee80211_i.h53
-rw-r--r--net/mac80211/main.c6
-rw-r--r--net/mac80211/mesh.c2
-rw-r--r--net/mac80211/mlme.c51
-rw-r--r--net/mac80211/rx.c10
-rw-r--r--net/mac80211/scan.c153
-rw-r--r--net/mac80211/tx.c2
-rw-r--r--net/mac80211/util.c2
-rw-r--r--net/mac80211/wext.c6
9 files changed, 145 insertions, 140 deletions
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 52f36ab1ee57..5c38ea084540 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -71,9 +71,9 @@ struct ieee80211_fragment_entry {
71}; 71};
72 72
73 73
74struct ieee80211_sta_bss { 74struct ieee80211_bss {
75 struct list_head list; 75 struct list_head list;
76 struct ieee80211_sta_bss *hnext; 76 struct ieee80211_bss *hnext;
77 size_t ssid_len; 77 size_t ssid_len;
78 78
79 atomic_t users; 79 atomic_t users;
@@ -112,7 +112,7 @@ struct ieee80211_sta_bss {
112 u8 erp_value; 112 u8 erp_value;
113}; 113};
114 114
115static inline u8 *bss_mesh_cfg(struct ieee80211_sta_bss *bss) 115static inline u8 *bss_mesh_cfg(struct ieee80211_bss *bss)
116{ 116{
117#ifdef CONFIG_MAC80211_MESH 117#ifdef CONFIG_MAC80211_MESH
118 return bss->mesh_cfg; 118 return bss->mesh_cfg;
@@ -120,7 +120,7 @@ static inline u8 *bss_mesh_cfg(struct ieee80211_sta_bss *bss)
120 return NULL; 120 return NULL;
121} 121}
122 122
123static inline u8 *bss_mesh_id(struct ieee80211_sta_bss *bss) 123static inline u8 *bss_mesh_id(struct ieee80211_bss *bss)
124{ 124{
125#ifdef CONFIG_MAC80211_MESH 125#ifdef CONFIG_MAC80211_MESH
126 return bss->mesh_id; 126 return bss->mesh_id;
@@ -128,7 +128,7 @@ static inline u8 *bss_mesh_id(struct ieee80211_sta_bss *bss)
128 return NULL; 128 return NULL;
129} 129}
130 130
131static inline u8 bss_mesh_id_len(struct ieee80211_sta_bss *bss) 131static inline u8 bss_mesh_id_len(struct ieee80211_bss *bss)
132{ 132{
133#ifdef CONFIG_MAC80211_MESH 133#ifdef CONFIG_MAC80211_MESH
134 return bss->mesh_id_len; 134 return bss->mesh_id_len;
@@ -658,8 +658,8 @@ struct ieee80211_local {
658 spinlock_t key_lock; 658 spinlock_t key_lock;
659 659
660 660
661 bool sta_sw_scanning; 661 /* Scanning and BSS list */
662 bool sta_hw_scanning; 662 bool sw_scanning, hw_scanning;
663 int scan_channel_idx; 663 int scan_channel_idx;
664 enum ieee80211_band scan_band; 664 enum ieee80211_band scan_band;
665 665
@@ -670,9 +670,9 @@ struct ieee80211_local {
670 struct ieee80211_channel *oper_channel, *scan_channel; 670 struct ieee80211_channel *oper_channel, *scan_channel;
671 u8 scan_ssid[IEEE80211_MAX_SSID_LEN]; 671 u8 scan_ssid[IEEE80211_MAX_SSID_LEN];
672 size_t scan_ssid_len; 672 size_t scan_ssid_len;
673 struct list_head sta_bss_list; 673 struct list_head bss_list;
674 struct ieee80211_sta_bss *sta_bss_hash[STA_HASH_SIZE]; 674 struct ieee80211_bss *bss_hash[STA_HASH_SIZE];
675 spinlock_t sta_bss_lock; 675 spinlock_t bss_lock;
676 676
677 /* SNMP counters */ 677 /* SNMP counters */
678 /* dot11CountersTable */ 678 /* dot11CountersTable */
@@ -905,7 +905,7 @@ extern const struct iw_handler_def ieee80211_iw_handler_def;
905 905
906/* STA/IBSS code */ 906/* STA/IBSS code */
907void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata); 907void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata);
908void ieee80211_sta_scan_work(struct work_struct *work); 908void ieee80211_scan_work(struct work_struct *work);
909void ieee80211_sta_rx_mgmt(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb, 909void ieee80211_sta_rx_mgmt(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb,
910 struct ieee80211_rx_status *rx_status); 910 struct ieee80211_rx_status *rx_status);
911int ieee80211_sta_set_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t len); 911int ieee80211_sta_set_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t len);
@@ -926,35 +926,38 @@ void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst,
926 u8 *ssid, size_t ssid_len); 926 u8 *ssid, size_t ssid_len);
927 927
928/* scan/BSS handling */ 928/* scan/BSS handling */
929int ieee80211_sta_req_scan(struct ieee80211_sub_if_data *sdata, u8 *ssid, size_t ssid_len); 929int ieee80211_request_scan(struct ieee80211_sub_if_data *sdata,
930int ieee80211_sta_scan_results(struct ieee80211_local *local, 930 u8 *ssid, size_t ssid_len);
931 struct iw_request_info *info, 931int ieee80211_scan_results(struct ieee80211_local *local,
932 char *buf, size_t len); 932 struct iw_request_info *info,
933ieee80211_rx_result ieee80211_sta_rx_scan( 933 char *buf, size_t len);
934 struct ieee80211_sub_if_data *sdata, struct sk_buff *skb, 934ieee80211_rx_result
935 struct ieee80211_rx_status *rx_status); 935ieee80211_scan_rx(struct ieee80211_sub_if_data *sdata,
936 struct sk_buff *skb,
937 struct ieee80211_rx_status *rx_status);
936void ieee80211_rx_bss_list_init(struct ieee80211_local *local); 938void ieee80211_rx_bss_list_init(struct ieee80211_local *local);
937void ieee80211_rx_bss_list_deinit(struct ieee80211_local *local); 939void ieee80211_rx_bss_list_deinit(struct ieee80211_local *local);
938int ieee80211_sta_set_extra_ie(struct ieee80211_sub_if_data *sdata, char *ie, size_t len); 940int ieee80211_sta_set_extra_ie(struct ieee80211_sub_if_data *sdata,
941 char *ie, size_t len);
939 942
940void ieee80211_mlme_notify_scan_completed(struct ieee80211_local *local); 943void ieee80211_mlme_notify_scan_completed(struct ieee80211_local *local);
941int ieee80211_sta_start_scan(struct ieee80211_sub_if_data *scan_sdata, 944int ieee80211_start_scan(struct ieee80211_sub_if_data *scan_sdata,
942 u8 *ssid, size_t ssid_len); 945 u8 *ssid, size_t ssid_len);
943struct ieee80211_sta_bss * 946struct ieee80211_bss *
944ieee80211_bss_info_update(struct ieee80211_local *local, 947ieee80211_bss_info_update(struct ieee80211_local *local,
945 struct ieee80211_rx_status *rx_status, 948 struct ieee80211_rx_status *rx_status,
946 struct ieee80211_mgmt *mgmt, 949 struct ieee80211_mgmt *mgmt,
947 size_t len, 950 size_t len,
948 struct ieee802_11_elems *elems, 951 struct ieee802_11_elems *elems,
949 int freq, bool beacon); 952 int freq, bool beacon);
950struct ieee80211_sta_bss * 953struct ieee80211_bss *
951ieee80211_rx_bss_add(struct ieee80211_local *local, u8 *bssid, int freq, 954ieee80211_rx_bss_add(struct ieee80211_local *local, u8 *bssid, int freq,
952 u8 *ssid, u8 ssid_len); 955 u8 *ssid, u8 ssid_len);
953struct ieee80211_sta_bss * 956struct ieee80211_bss *
954ieee80211_rx_bss_get(struct ieee80211_local *local, u8 *bssid, int freq, 957ieee80211_rx_bss_get(struct ieee80211_local *local, u8 *bssid, int freq,
955 u8 *ssid, u8 ssid_len); 958 u8 *ssid, u8 ssid_len);
956void ieee80211_rx_bss_put(struct ieee80211_local *local, 959void ieee80211_rx_bss_put(struct ieee80211_local *local,
957 struct ieee80211_sta_bss *bss); 960 struct ieee80211_bss *bss);
958 961
959/* interface handling */ 962/* interface handling */
960void ieee80211_if_setup(struct net_device *dev); 963void ieee80211_if_setup(struct net_device *dev);
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index 72e3f5574e9f..4c424acc01a4 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -598,7 +598,7 @@ static int ieee80211_stop(struct net_device *dev)
598 * the scan_sdata is NULL already don't send out a 598 * the scan_sdata is NULL already don't send out a
599 * scan event to userspace -- the scan is incomplete. 599 * scan event to userspace -- the scan is incomplete.
600 */ 600 */
601 if (local->sta_sw_scanning) 601 if (local->sw_scanning)
602 ieee80211_scan_completed(&local->hw); 602 ieee80211_scan_completed(&local->hw);
603 } 603 }
604 604
@@ -732,7 +732,7 @@ int ieee80211_hw_config(struct ieee80211_local *local)
732 struct ieee80211_channel *chan; 732 struct ieee80211_channel *chan;
733 int ret = 0; 733 int ret = 0;
734 734
735 if (local->sta_sw_scanning) 735 if (local->sw_scanning)
736 chan = local->scan_channel; 736 chan = local->scan_channel;
737 else 737 else
738 chan = local->oper_channel; 738 chan = local->oper_channel;
@@ -1290,7 +1290,7 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
1290 1290
1291 spin_lock_init(&local->key_lock); 1291 spin_lock_init(&local->key_lock);
1292 1292
1293 INIT_DELAYED_WORK(&local->scan_work, ieee80211_sta_scan_work); 1293 INIT_DELAYED_WORK(&local->scan_work, ieee80211_scan_work);
1294 1294
1295 sta_info_init(local); 1295 sta_info_init(local);
1296 1296
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index a0141f5ff184..30cf891fd3a8 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -566,7 +566,7 @@ static void ieee80211_mesh_work(struct work_struct *work)
566 if (!netif_running(sdata->dev)) 566 if (!netif_running(sdata->dev))
567 return; 567 return;
568 568
569 if (local->sta_sw_scanning || local->sta_hw_scanning) 569 if (local->sw_scanning || local->hw_scanning)
570 return; 570 return;
571 571
572 while ((skb = skb_dequeue(&ifmsh->skb_queue))) 572 while ((skb = skb_dequeue(&ifmsh->skb_queue)))
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index e14830106526..5b748447eb7d 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -52,7 +52,7 @@ static int ecw2cw(int ecw)
52 return (1 << ecw) - 1; 52 return (1 << ecw) - 1;
53} 53}
54 54
55static u8 *ieee80211_bss_get_ie(struct ieee80211_sta_bss *bss, u8 ie) 55static u8 *ieee80211_bss_get_ie(struct ieee80211_bss *bss, u8 ie)
56{ 56{
57 u8 *end, *pos; 57 u8 *end, *pos;
58 58
@@ -72,7 +72,7 @@ static u8 *ieee80211_bss_get_ie(struct ieee80211_sta_bss *bss, u8 ie)
72 return NULL; 72 return NULL;
73} 73}
74 74
75static int ieee80211_compatible_rates(struct ieee80211_sta_bss *bss, 75static int ieee80211_compatible_rates(struct ieee80211_bss *bss,
76 struct ieee80211_supported_band *sband, 76 struct ieee80211_supported_band *sband,
77 u64 *rates) 77 u64 *rates)
78{ 78{
@@ -239,7 +239,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata,
239 u8 *pos, *ies, *ht_add_ie; 239 u8 *pos, *ies, *ht_add_ie;
240 int i, len, count, rates_len, supp_rates_len; 240 int i, len, count, rates_len, supp_rates_len;
241 u16 capab; 241 u16 capab;
242 struct ieee80211_sta_bss *bss; 242 struct ieee80211_bss *bss;
243 int wmm = 0; 243 int wmm = 0;
244 struct ieee80211_supported_band *sband; 244 struct ieee80211_supported_band *sband;
245 u64 rates = 0; 245 u64 rates = 0;
@@ -470,7 +470,7 @@ static void ieee80211_send_deauth_disassoc(struct ieee80211_sub_if_data *sdata,
470 470
471/* MLME */ 471/* MLME */
472static void ieee80211_sta_def_wmm_params(struct ieee80211_sub_if_data *sdata, 472static void ieee80211_sta_def_wmm_params(struct ieee80211_sub_if_data *sdata,
473 struct ieee80211_sta_bss *bss) 473 struct ieee80211_bss *bss)
474{ 474{
475 struct ieee80211_local *local = sdata->local; 475 struct ieee80211_local *local = sdata->local;
476 int i, have_higher_than_11mbit = 0; 476 int i, have_higher_than_11mbit = 0;
@@ -621,7 +621,7 @@ static u32 ieee80211_handle_erp_ie(struct ieee80211_sub_if_data *sdata,
621} 621}
622 622
623static u32 ieee80211_handle_bss_capability(struct ieee80211_sub_if_data *sdata, 623static u32 ieee80211_handle_bss_capability(struct ieee80211_sub_if_data *sdata,
624 struct ieee80211_sta_bss *bss) 624 struct ieee80211_bss *bss)
625{ 625{
626 u32 changed = 0; 626 u32 changed = 0;
627 627
@@ -674,7 +674,7 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata,
674 struct ieee80211_conf *conf = &local_to_hw(local)->conf; 674 struct ieee80211_conf *conf = &local_to_hw(local)->conf;
675 u32 changed = BSS_CHANGED_ASSOC; 675 u32 changed = BSS_CHANGED_ASSOC;
676 676
677 struct ieee80211_sta_bss *bss; 677 struct ieee80211_bss *bss;
678 678
679 ifsta->flags |= IEEE80211_STA_ASSOCIATED; 679 ifsta->flags |= IEEE80211_STA_ASSOCIATED;
680 680
@@ -846,7 +846,7 @@ static int ieee80211_privacy_mismatch(struct ieee80211_sub_if_data *sdata,
846 struct ieee80211_if_sta *ifsta) 846 struct ieee80211_if_sta *ifsta)
847{ 847{
848 struct ieee80211_local *local = sdata->local; 848 struct ieee80211_local *local = sdata->local;
849 struct ieee80211_sta_bss *bss; 849 struct ieee80211_bss *bss;
850 int bss_privacy; 850 int bss_privacy;
851 int wep_privacy; 851 int wep_privacy;
852 int privacy_invoked; 852 int privacy_invoked;
@@ -1219,7 +1219,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
1219 /* Add STA entry for the AP */ 1219 /* Add STA entry for the AP */
1220 sta = sta_info_get(local, ifsta->bssid); 1220 sta = sta_info_get(local, ifsta->bssid);
1221 if (!sta) { 1221 if (!sta) {
1222 struct ieee80211_sta_bss *bss; 1222 struct ieee80211_bss *bss;
1223 int err; 1223 int err;
1224 1224
1225 sta = sta_info_alloc(sdata, ifsta->bssid, GFP_ATOMIC); 1225 sta = sta_info_alloc(sdata, ifsta->bssid, GFP_ATOMIC);
@@ -1339,7 +1339,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
1339 1339
1340static int ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, 1340static int ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
1341 struct ieee80211_if_sta *ifsta, 1341 struct ieee80211_if_sta *ifsta,
1342 struct ieee80211_sta_bss *bss) 1342 struct ieee80211_bss *bss)
1343{ 1343{
1344 struct ieee80211_local *local = sdata->local; 1344 struct ieee80211_local *local = sdata->local;
1345 int res, rates, i, j; 1345 int res, rates, i, j;
@@ -1490,7 +1490,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
1490{ 1490{
1491 struct ieee80211_local *local = sdata->local; 1491 struct ieee80211_local *local = sdata->local;
1492 int freq; 1492 int freq;
1493 struct ieee80211_sta_bss *bss; 1493 struct ieee80211_bss *bss;
1494 struct sta_info *sta; 1494 struct sta_info *sta;
1495 struct ieee80211_channel *channel; 1495 struct ieee80211_channel *channel;
1496 u64 beacon_timestamp, rx_timestamp; 1496 u64 beacon_timestamp, rx_timestamp;
@@ -1893,7 +1893,7 @@ static void ieee80211_sta_merge_ibss(struct ieee80211_sub_if_data *sdata,
1893 1893
1894 printk(KERN_DEBUG "%s: No active IBSS STAs - trying to scan for other " 1894 printk(KERN_DEBUG "%s: No active IBSS STAs - trying to scan for other "
1895 "IBSS networks with same SSID (merge)\n", sdata->dev->name); 1895 "IBSS networks with same SSID (merge)\n", sdata->dev->name);
1896 ieee80211_sta_req_scan(sdata, ifsta->ssid, ifsta->ssid_len); 1896 ieee80211_request_scan(sdata, ifsta->ssid, ifsta->ssid_len);
1897} 1897}
1898 1898
1899 1899
@@ -1974,7 +1974,7 @@ static int ieee80211_sta_create_ibss(struct ieee80211_sub_if_data *sdata,
1974 struct ieee80211_if_sta *ifsta) 1974 struct ieee80211_if_sta *ifsta)
1975{ 1975{
1976 struct ieee80211_local *local = sdata->local; 1976 struct ieee80211_local *local = sdata->local;
1977 struct ieee80211_sta_bss *bss; 1977 struct ieee80211_bss *bss;
1978 struct ieee80211_supported_band *sband; 1978 struct ieee80211_supported_band *sband;
1979 u8 bssid[ETH_ALEN], *pos; 1979 u8 bssid[ETH_ALEN], *pos;
1980 int i; 1980 int i;
@@ -2035,7 +2035,7 @@ static int ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata,
2035 struct ieee80211_if_sta *ifsta) 2035 struct ieee80211_if_sta *ifsta)
2036{ 2036{
2037 struct ieee80211_local *local = sdata->local; 2037 struct ieee80211_local *local = sdata->local;
2038 struct ieee80211_sta_bss *bss; 2038 struct ieee80211_bss *bss;
2039 int found = 0; 2039 int found = 0;
2040 u8 bssid[ETH_ALEN]; 2040 u8 bssid[ETH_ALEN];
2041 int active_ibss; 2041 int active_ibss;
@@ -2050,8 +2050,8 @@ static int ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata,
2050 printk(KERN_DEBUG "%s: sta_find_ibss (active_ibss=%d)\n", 2050 printk(KERN_DEBUG "%s: sta_find_ibss (active_ibss=%d)\n",
2051 sdata->dev->name, active_ibss); 2051 sdata->dev->name, active_ibss);
2052#endif /* CONFIG_MAC80211_IBSS_DEBUG */ 2052#endif /* CONFIG_MAC80211_IBSS_DEBUG */
2053 spin_lock_bh(&local->sta_bss_lock); 2053 spin_lock_bh(&local->bss_lock);
2054 list_for_each_entry(bss, &local->sta_bss_list, list) { 2054 list_for_each_entry(bss, &local->bss_list, list) {
2055 if (ifsta->ssid_len != bss->ssid_len || 2055 if (ifsta->ssid_len != bss->ssid_len ||
2056 memcmp(ifsta->ssid, bss->ssid, bss->ssid_len) != 0 2056 memcmp(ifsta->ssid, bss->ssid, bss->ssid_len) != 0
2057 || !(bss->capability & WLAN_CAPABILITY_IBSS)) 2057 || !(bss->capability & WLAN_CAPABILITY_IBSS))
@@ -2065,7 +2065,7 @@ static int ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata,
2065 if (active_ibss || memcmp(bssid, ifsta->bssid, ETH_ALEN) != 0) 2065 if (active_ibss || memcmp(bssid, ifsta->bssid, ETH_ALEN) != 0)
2066 break; 2066 break;
2067 } 2067 }
2068 spin_unlock_bh(&local->sta_bss_lock); 2068 spin_unlock_bh(&local->bss_lock);
2069 2069
2070#ifdef CONFIG_MAC80211_IBSS_DEBUG 2070#ifdef CONFIG_MAC80211_IBSS_DEBUG
2071 if (found) 2071 if (found)
@@ -2110,7 +2110,7 @@ dont_join:
2110 IEEE80211_SCAN_INTERVAL)) { 2110 IEEE80211_SCAN_INTERVAL)) {
2111 printk(KERN_DEBUG "%s: Trigger new scan to find an IBSS to " 2111 printk(KERN_DEBUG "%s: Trigger new scan to find an IBSS to "
2112 "join\n", sdata->dev->name); 2112 "join\n", sdata->dev->name);
2113 return ieee80211_sta_req_scan(sdata, ifsta->ssid, 2113 return ieee80211_request_scan(sdata, ifsta->ssid,
2114 ifsta->ssid_len); 2114 ifsta->ssid_len);
2115 } else if (ifsta->state != IEEE80211_STA_MLME_IBSS_JOINED) { 2115 } else if (ifsta->state != IEEE80211_STA_MLME_IBSS_JOINED) {
2116 int interval = IEEE80211_SCAN_INTERVAL; 2116 int interval = IEEE80211_SCAN_INTERVAL;
@@ -2145,12 +2145,12 @@ static int ieee80211_sta_config_auth(struct ieee80211_sub_if_data *sdata,
2145 struct ieee80211_if_sta *ifsta) 2145 struct ieee80211_if_sta *ifsta)
2146{ 2146{
2147 struct ieee80211_local *local = sdata->local; 2147 struct ieee80211_local *local = sdata->local;
2148 struct ieee80211_sta_bss *bss, *selected = NULL; 2148 struct ieee80211_bss *bss, *selected = NULL;
2149 int top_rssi = 0, freq; 2149 int top_rssi = 0, freq;
2150 2150
2151 spin_lock_bh(&local->sta_bss_lock); 2151 spin_lock_bh(&local->bss_lock);
2152 freq = local->oper_channel->center_freq; 2152 freq = local->oper_channel->center_freq;
2153 list_for_each_entry(bss, &local->sta_bss_list, list) { 2153 list_for_each_entry(bss, &local->bss_list, list) {
2154 if (!(bss->capability & WLAN_CAPABILITY_ESS)) 2154 if (!(bss->capability & WLAN_CAPABILITY_ESS))
2155 continue; 2155 continue;
2156 2156
@@ -2180,7 +2180,7 @@ static int ieee80211_sta_config_auth(struct ieee80211_sub_if_data *sdata,
2180 } 2180 }
2181 if (selected) 2181 if (selected)
2182 atomic_inc(&selected->users); 2182 atomic_inc(&selected->users);
2183 spin_unlock_bh(&local->sta_bss_lock); 2183 spin_unlock_bh(&local->bss_lock);
2184 2184
2185 if (selected) { 2185 if (selected) {
2186 ieee80211_set_freq(sdata, selected->freq); 2186 ieee80211_set_freq(sdata, selected->freq);
@@ -2207,9 +2207,9 @@ static int ieee80211_sta_config_auth(struct ieee80211_sub_if_data *sdata,
2207 if (ifsta->assoc_scan_tries < IEEE80211_ASSOC_SCANS_MAX_TRIES) { 2207 if (ifsta->assoc_scan_tries < IEEE80211_ASSOC_SCANS_MAX_TRIES) {
2208 ifsta->assoc_scan_tries++; 2208 ifsta->assoc_scan_tries++;
2209 if (ifsta->flags & IEEE80211_STA_AUTO_SSID_SEL) 2209 if (ifsta->flags & IEEE80211_STA_AUTO_SSID_SEL)
2210 ieee80211_sta_start_scan(sdata, NULL, 0); 2210 ieee80211_start_scan(sdata, NULL, 0);
2211 else 2211 else
2212 ieee80211_sta_start_scan(sdata, ifsta->ssid, 2212 ieee80211_start_scan(sdata, ifsta->ssid,
2213 ifsta->ssid_len); 2213 ifsta->ssid_len);
2214 ifsta->state = IEEE80211_STA_MLME_AUTHENTICATE; 2214 ifsta->state = IEEE80211_STA_MLME_AUTHENTICATE;
2215 set_bit(IEEE80211_STA_REQ_AUTH, &ifsta->request); 2215 set_bit(IEEE80211_STA_REQ_AUTH, &ifsta->request);
@@ -2231,7 +2231,7 @@ static void ieee80211_sta_work(struct work_struct *work)
2231 if (!netif_running(sdata->dev)) 2231 if (!netif_running(sdata->dev))
2232 return; 2232 return;
2233 2233
2234 if (local->sta_sw_scanning || local->sta_hw_scanning) 2234 if (local->sw_scanning || local->hw_scanning)
2235 return; 2235 return;
2236 2236
2237 if (WARN_ON(sdata->vif.type != IEEE80211_IF_TYPE_STA && 2237 if (WARN_ON(sdata->vif.type != IEEE80211_IF_TYPE_STA &&
@@ -2246,7 +2246,8 @@ static void ieee80211_sta_work(struct work_struct *work)
2246 ifsta->state != IEEE80211_STA_MLME_AUTHENTICATE && 2246 ifsta->state != IEEE80211_STA_MLME_AUTHENTICATE &&
2247 ifsta->state != IEEE80211_STA_MLME_ASSOCIATE && 2247 ifsta->state != IEEE80211_STA_MLME_ASSOCIATE &&
2248 test_and_clear_bit(IEEE80211_STA_REQ_SCAN, &ifsta->request)) { 2248 test_and_clear_bit(IEEE80211_STA_REQ_SCAN, &ifsta->request)) {
2249 ieee80211_sta_start_scan(sdata, ifsta->scan_ssid, ifsta->scan_ssid_len); 2249 ieee80211_start_scan(sdata, ifsta->scan_ssid,
2250 ifsta->scan_ssid_len);
2250 return; 2251 return;
2251 } 2252 }
2252 2253
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 93f2cda9926e..582396a4fdb5 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -403,12 +403,12 @@ ieee80211_rx_h_passive_scan(struct ieee80211_rx_data *rx)
403 struct ieee80211_local *local = rx->local; 403 struct ieee80211_local *local = rx->local;
404 struct sk_buff *skb = rx->skb; 404 struct sk_buff *skb = rx->skb;
405 405
406 if (unlikely(local->sta_hw_scanning)) 406 if (unlikely(local->hw_scanning))
407 return ieee80211_sta_rx_scan(rx->sdata, skb, rx->status); 407 return ieee80211_scan_rx(rx->sdata, skb, rx->status);
408 408
409 if (unlikely(local->sta_sw_scanning)) { 409 if (unlikely(local->sw_scanning)) {
410 /* drop all the other packets during a software scan anyway */ 410 /* drop all the other packets during a software scan anyway */
411 if (ieee80211_sta_rx_scan(rx->sdata, skb, rx->status) 411 if (ieee80211_scan_rx(rx->sdata, skb, rx->status)
412 != RX_QUEUED) 412 != RX_QUEUED)
413 dev_kfree_skb(skb); 413 dev_kfree_skb(skb);
414 return RX_QUEUED; 414 return RX_QUEUED;
@@ -1918,7 +1918,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
1918 return; 1918 return;
1919 } 1919 }
1920 1920
1921 if (unlikely(local->sta_sw_scanning || local->sta_hw_scanning)) 1921 if (unlikely(local->sw_scanning || local->hw_scanning))
1922 rx.flags |= IEEE80211_RX_IN_SCAN; 1922 rx.flags |= IEEE80211_RX_IN_SCAN;
1923 1923
1924 ieee80211_parse_qos(&rx); 1924 ieee80211_parse_qos(&rx);
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
index 27727027d76d..5e719e7b720b 100644
--- a/net/mac80211/scan.c
+++ b/net/mac80211/scan.c
@@ -32,26 +32,26 @@
32 32
33void ieee80211_rx_bss_list_init(struct ieee80211_local *local) 33void ieee80211_rx_bss_list_init(struct ieee80211_local *local)
34{ 34{
35 spin_lock_init(&local->sta_bss_lock); 35 spin_lock_init(&local->bss_lock);
36 INIT_LIST_HEAD(&local->sta_bss_list); 36 INIT_LIST_HEAD(&local->bss_list);
37} 37}
38 38
39void ieee80211_rx_bss_list_deinit(struct ieee80211_local *local) 39void ieee80211_rx_bss_list_deinit(struct ieee80211_local *local)
40{ 40{
41 struct ieee80211_sta_bss *bss, *tmp; 41 struct ieee80211_bss *bss, *tmp;
42 42
43 list_for_each_entry_safe(bss, tmp, &local->sta_bss_list, list) 43 list_for_each_entry_safe(bss, tmp, &local->bss_list, list)
44 ieee80211_rx_bss_put(local, bss); 44 ieee80211_rx_bss_put(local, bss);
45} 45}
46 46
47struct ieee80211_sta_bss * 47struct ieee80211_bss *
48ieee80211_rx_bss_get(struct ieee80211_local *local, u8 *bssid, int freq, 48ieee80211_rx_bss_get(struct ieee80211_local *local, u8 *bssid, int freq,
49 u8 *ssid, u8 ssid_len) 49 u8 *ssid, u8 ssid_len)
50{ 50{
51 struct ieee80211_sta_bss *bss; 51 struct ieee80211_bss *bss;
52 52
53 spin_lock_bh(&local->sta_bss_lock); 53 spin_lock_bh(&local->bss_lock);
54 bss = local->sta_bss_hash[STA_HASH(bssid)]; 54 bss = local->bss_hash[STA_HASH(bssid)];
55 while (bss) { 55 while (bss) {
56 if (!bss_mesh_cfg(bss) && 56 if (!bss_mesh_cfg(bss) &&
57 !memcmp(bss->bssid, bssid, ETH_ALEN) && 57 !memcmp(bss->bssid, bssid, ETH_ALEN) &&
@@ -63,13 +63,13 @@ ieee80211_rx_bss_get(struct ieee80211_local *local, u8 *bssid, int freq,
63 } 63 }
64 bss = bss->hnext; 64 bss = bss->hnext;
65 } 65 }
66 spin_unlock_bh(&local->sta_bss_lock); 66 spin_unlock_bh(&local->bss_lock);
67 return bss; 67 return bss;
68} 68}
69 69
70/* Caller must hold local->sta_bss_lock */ 70/* Caller must hold local->bss_lock */
71static void __ieee80211_rx_bss_hash_add(struct ieee80211_local *local, 71static void __ieee80211_rx_bss_hash_add(struct ieee80211_local *local,
72 struct ieee80211_sta_bss *bss) 72 struct ieee80211_bss *bss)
73{ 73{
74 u8 hash_idx; 74 u8 hash_idx;
75 75
@@ -79,20 +79,20 @@ static void __ieee80211_rx_bss_hash_add(struct ieee80211_local *local,
79 else 79 else
80 hash_idx = STA_HASH(bss->bssid); 80 hash_idx = STA_HASH(bss->bssid);
81 81
82 bss->hnext = local->sta_bss_hash[hash_idx]; 82 bss->hnext = local->bss_hash[hash_idx];
83 local->sta_bss_hash[hash_idx] = bss; 83 local->bss_hash[hash_idx] = bss;
84} 84}
85 85
86/* Caller must hold local->sta_bss_lock */ 86/* Caller must hold local->bss_lock */
87static void __ieee80211_rx_bss_hash_del(struct ieee80211_local *local, 87static void __ieee80211_rx_bss_hash_del(struct ieee80211_local *local,
88 struct ieee80211_sta_bss *bss) 88 struct ieee80211_bss *bss)
89{ 89{
90 struct ieee80211_sta_bss *b, *prev = NULL; 90 struct ieee80211_bss *b, *prev = NULL;
91 b = local->sta_bss_hash[STA_HASH(bss->bssid)]; 91 b = local->bss_hash[STA_HASH(bss->bssid)];
92 while (b) { 92 while (b) {
93 if (b == bss) { 93 if (b == bss) {
94 if (!prev) 94 if (!prev)
95 local->sta_bss_hash[STA_HASH(bss->bssid)] = 95 local->bss_hash[STA_HASH(bss->bssid)] =
96 bss->hnext; 96 bss->hnext;
97 else 97 else
98 prev->hnext = bss->hnext; 98 prev->hnext = bss->hnext;
@@ -103,11 +103,11 @@ static void __ieee80211_rx_bss_hash_del(struct ieee80211_local *local,
103 } 103 }
104} 104}
105 105
106struct ieee80211_sta_bss * 106struct ieee80211_bss *
107ieee80211_rx_bss_add(struct ieee80211_local *local, u8 *bssid, int freq, 107ieee80211_rx_bss_add(struct ieee80211_local *local, u8 *bssid, int freq,
108 u8 *ssid, u8 ssid_len) 108 u8 *ssid, u8 ssid_len)
109{ 109{
110 struct ieee80211_sta_bss *bss; 110 struct ieee80211_bss *bss;
111 111
112 bss = kzalloc(sizeof(*bss), GFP_ATOMIC); 112 bss = kzalloc(sizeof(*bss), GFP_ATOMIC);
113 if (!bss) 113 if (!bss)
@@ -120,23 +120,23 @@ ieee80211_rx_bss_add(struct ieee80211_local *local, u8 *bssid, int freq,
120 bss->ssid_len = ssid_len; 120 bss->ssid_len = ssid_len;
121 } 121 }
122 122
123 spin_lock_bh(&local->sta_bss_lock); 123 spin_lock_bh(&local->bss_lock);
124 /* TODO: order by RSSI? */ 124 /* TODO: order by RSSI? */
125 list_add_tail(&bss->list, &local->sta_bss_list); 125 list_add_tail(&bss->list, &local->bss_list);
126 __ieee80211_rx_bss_hash_add(local, bss); 126 __ieee80211_rx_bss_hash_add(local, bss);
127 spin_unlock_bh(&local->sta_bss_lock); 127 spin_unlock_bh(&local->bss_lock);
128 return bss; 128 return bss;
129} 129}
130 130
131#ifdef CONFIG_MAC80211_MESH 131#ifdef CONFIG_MAC80211_MESH
132static struct ieee80211_sta_bss * 132static struct ieee80211_bss *
133ieee80211_rx_mesh_bss_get(struct ieee80211_local *local, u8 *mesh_id, int mesh_id_len, 133ieee80211_rx_mesh_bss_get(struct ieee80211_local *local, u8 *mesh_id, int mesh_id_len,
134 u8 *mesh_cfg, int freq) 134 u8 *mesh_cfg, int freq)
135{ 135{
136 struct ieee80211_sta_bss *bss; 136 struct ieee80211_bss *bss;
137 137
138 spin_lock_bh(&local->sta_bss_lock); 138 spin_lock_bh(&local->bss_lock);
139 bss = local->sta_bss_hash[mesh_id_hash(mesh_id, mesh_id_len)]; 139 bss = local->bss_hash[mesh_id_hash(mesh_id, mesh_id_len)];
140 while (bss) { 140 while (bss) {
141 if (bss_mesh_cfg(bss) && 141 if (bss_mesh_cfg(bss) &&
142 !memcmp(bss_mesh_cfg(bss), mesh_cfg, MESH_CFG_CMP_LEN) && 142 !memcmp(bss_mesh_cfg(bss), mesh_cfg, MESH_CFG_CMP_LEN) &&
@@ -149,15 +149,15 @@ ieee80211_rx_mesh_bss_get(struct ieee80211_local *local, u8 *mesh_id, int mesh_i
149 } 149 }
150 bss = bss->hnext; 150 bss = bss->hnext;
151 } 151 }
152 spin_unlock_bh(&local->sta_bss_lock); 152 spin_unlock_bh(&local->bss_lock);
153 return bss; 153 return bss;
154} 154}
155 155
156static struct ieee80211_sta_bss * 156static struct ieee80211_bss *
157ieee80211_rx_mesh_bss_add(struct ieee80211_local *local, u8 *mesh_id, int mesh_id_len, 157ieee80211_rx_mesh_bss_add(struct ieee80211_local *local, u8 *mesh_id, int mesh_id_len,
158 u8 *mesh_cfg, int mesh_config_len, int freq) 158 u8 *mesh_cfg, int mesh_config_len, int freq)
159{ 159{
160 struct ieee80211_sta_bss *bss; 160 struct ieee80211_bss *bss;
161 161
162 if (mesh_config_len != MESH_CFG_LEN) 162 if (mesh_config_len != MESH_CFG_LEN)
163 return NULL; 163 return NULL;
@@ -186,16 +186,16 @@ ieee80211_rx_mesh_bss_add(struct ieee80211_local *local, u8 *mesh_id, int mesh_i
186 memcpy(bss->mesh_cfg, mesh_cfg, MESH_CFG_CMP_LEN); 186 memcpy(bss->mesh_cfg, mesh_cfg, MESH_CFG_CMP_LEN);
187 bss->mesh_id_len = mesh_id_len; 187 bss->mesh_id_len = mesh_id_len;
188 bss->freq = freq; 188 bss->freq = freq;
189 spin_lock_bh(&local->sta_bss_lock); 189 spin_lock_bh(&local->bss_lock);
190 /* TODO: order by RSSI? */ 190 /* TODO: order by RSSI? */
191 list_add_tail(&bss->list, &local->sta_bss_list); 191 list_add_tail(&bss->list, &local->bss_list);
192 __ieee80211_rx_bss_hash_add(local, bss); 192 __ieee80211_rx_bss_hash_add(local, bss);
193 spin_unlock_bh(&local->sta_bss_lock); 193 spin_unlock_bh(&local->bss_lock);
194 return bss; 194 return bss;
195} 195}
196#endif 196#endif
197 197
198static void ieee80211_rx_bss_free(struct ieee80211_sta_bss *bss) 198static void ieee80211_rx_bss_free(struct ieee80211_bss *bss)
199{ 199{
200 kfree(bss->ies); 200 kfree(bss->ies);
201 kfree(bss_mesh_id(bss)); 201 kfree(bss_mesh_id(bss));
@@ -204,21 +204,21 @@ static void ieee80211_rx_bss_free(struct ieee80211_sta_bss *bss)
204} 204}
205 205
206void ieee80211_rx_bss_put(struct ieee80211_local *local, 206void ieee80211_rx_bss_put(struct ieee80211_local *local,
207 struct ieee80211_sta_bss *bss) 207 struct ieee80211_bss *bss)
208{ 208{
209 local_bh_disable(); 209 local_bh_disable();
210 if (!atomic_dec_and_lock(&bss->users, &local->sta_bss_lock)) { 210 if (!atomic_dec_and_lock(&bss->users, &local->bss_lock)) {
211 local_bh_enable(); 211 local_bh_enable();
212 return; 212 return;
213 } 213 }
214 214
215 __ieee80211_rx_bss_hash_del(local, bss); 215 __ieee80211_rx_bss_hash_del(local, bss);
216 list_del(&bss->list); 216 list_del(&bss->list);
217 spin_unlock_bh(&local->sta_bss_lock); 217 spin_unlock_bh(&local->bss_lock);
218 ieee80211_rx_bss_free(bss); 218 ieee80211_rx_bss_free(bss);
219} 219}
220 220
221struct ieee80211_sta_bss * 221struct ieee80211_bss *
222ieee80211_bss_info_update(struct ieee80211_local *local, 222ieee80211_bss_info_update(struct ieee80211_local *local,
223 struct ieee80211_rx_status *rx_status, 223 struct ieee80211_rx_status *rx_status,
224 struct ieee80211_mgmt *mgmt, 224 struct ieee80211_mgmt *mgmt,
@@ -226,7 +226,7 @@ ieee80211_bss_info_update(struct ieee80211_local *local,
226 struct ieee802_11_elems *elems, 226 struct ieee802_11_elems *elems,
227 int freq, bool beacon) 227 int freq, bool beacon)
228{ 228{
229 struct ieee80211_sta_bss *bss; 229 struct ieee80211_bss *bss;
230 int clen; 230 int clen;
231 231
232#ifdef CONFIG_MAC80211_MESH 232#ifdef CONFIG_MAC80211_MESH
@@ -252,9 +252,9 @@ ieee80211_bss_info_update(struct ieee80211_local *local,
252 } else { 252 } else {
253#if 0 253#if 0
254 /* TODO: order by RSSI? */ 254 /* TODO: order by RSSI? */
255 spin_lock_bh(&local->sta_bss_lock); 255 spin_lock_bh(&local->bss_lock);
256 list_move_tail(&bss->list, &local->sta_bss_list); 256 list_move_tail(&bss->list, &local->bss_list);
257 spin_unlock_bh(&local->sta_bss_lock); 257 spin_unlock_bh(&local->bss_lock);
258#endif 258#endif
259 } 259 }
260 260
@@ -327,11 +327,11 @@ ieee80211_bss_info_update(struct ieee80211_local *local,
327} 327}
328 328
329ieee80211_rx_result 329ieee80211_rx_result
330ieee80211_sta_rx_scan(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb, 330ieee80211_scan_rx(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb,
331 struct ieee80211_rx_status *rx_status) 331 struct ieee80211_rx_status *rx_status)
332{ 332{
333 struct ieee80211_mgmt *mgmt; 333 struct ieee80211_mgmt *mgmt;
334 struct ieee80211_sta_bss *bss; 334 struct ieee80211_bss *bss;
335 u8 *elements; 335 u8 *elements;
336 struct ieee80211_channel *channel; 336 struct ieee80211_channel *channel;
337 size_t baselen; 337 size_t baselen;
@@ -430,7 +430,7 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw)
430 struct ieee80211_sub_if_data *sdata; 430 struct ieee80211_sub_if_data *sdata;
431 union iwreq_data wrqu; 431 union iwreq_data wrqu;
432 432
433 if (WARN_ON(!local->sta_hw_scanning && !local->sta_sw_scanning)) 433 if (WARN_ON(!local->hw_scanning && !local->sw_scanning))
434 return; 434 return;
435 435
436 local->last_scan_completed = jiffies; 436 local->last_scan_completed = jiffies;
@@ -445,8 +445,8 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw)
445 if (sdata) 445 if (sdata)
446 wireless_send_event(sdata->dev, SIOCGIWSCAN, &wrqu, NULL); 446 wireless_send_event(sdata->dev, SIOCGIWSCAN, &wrqu, NULL);
447 447
448 if (local->sta_hw_scanning) { 448 if (local->hw_scanning) {
449 local->sta_hw_scanning = 0; 449 local->hw_scanning = false;
450 if (ieee80211_hw_config(local)) 450 if (ieee80211_hw_config(local))
451 printk(KERN_DEBUG "%s: failed to restore operational " 451 printk(KERN_DEBUG "%s: failed to restore operational "
452 "channel after scan\n", wiphy_name(local->hw.wiphy)); 452 "channel after scan\n", wiphy_name(local->hw.wiphy));
@@ -454,7 +454,7 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw)
454 goto done; 454 goto done;
455 } 455 }
456 456
457 local->sta_sw_scanning = 0; 457 local->sw_scanning = false;
458 if (ieee80211_hw_config(local)) 458 if (ieee80211_hw_config(local))
459 printk(KERN_DEBUG "%s: failed to restore operational " 459 printk(KERN_DEBUG "%s: failed to restore operational "
460 "channel after scan\n", wiphy_name(local->hw.wiphy)); 460 "channel after scan\n", wiphy_name(local->hw.wiphy));
@@ -492,7 +492,7 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw)
492EXPORT_SYMBOL(ieee80211_scan_completed); 492EXPORT_SYMBOL(ieee80211_scan_completed);
493 493
494 494
495void ieee80211_sta_scan_work(struct work_struct *work) 495void ieee80211_scan_work(struct work_struct *work)
496{ 496{
497 struct ieee80211_local *local = 497 struct ieee80211_local *local =
498 container_of(work, struct ieee80211_local, scan_work.work); 498 container_of(work, struct ieee80211_local, scan_work.work);
@@ -589,8 +589,8 @@ void ieee80211_sta_scan_work(struct work_struct *work)
589} 589}
590 590
591 591
592int ieee80211_sta_start_scan(struct ieee80211_sub_if_data *scan_sdata, 592int ieee80211_start_scan(struct ieee80211_sub_if_data *scan_sdata,
593 u8 *ssid, size_t ssid_len) 593 u8 *ssid, size_t ssid_len)
594{ 594{
595 struct ieee80211_local *local = scan_sdata->local; 595 struct ieee80211_local *local = scan_sdata->local;
596 struct ieee80211_sub_if_data *sdata; 596 struct ieee80211_sub_if_data *sdata;
@@ -615,7 +615,7 @@ int ieee80211_sta_start_scan(struct ieee80211_sub_if_data *scan_sdata,
615 * ResultCode: SUCCESS, INVALID_PARAMETERS 615 * ResultCode: SUCCESS, INVALID_PARAMETERS
616 */ 616 */
617 617
618 if (local->sta_sw_scanning || local->sta_hw_scanning) { 618 if (local->sw_scanning || local->hw_scanning) {
619 if (local->scan_sdata == scan_sdata) 619 if (local->scan_sdata == scan_sdata)
620 return 0; 620 return 0;
621 return -EBUSY; 621 return -EBUSY;
@@ -624,17 +624,17 @@ int ieee80211_sta_start_scan(struct ieee80211_sub_if_data *scan_sdata,
624 if (local->ops->hw_scan) { 624 if (local->ops->hw_scan) {
625 int rc; 625 int rc;
626 626
627 local->sta_hw_scanning = 1; 627 local->hw_scanning = true;
628 rc = local->ops->hw_scan(local_to_hw(local), ssid, ssid_len); 628 rc = local->ops->hw_scan(local_to_hw(local), ssid, ssid_len);
629 if (rc) { 629 if (rc) {
630 local->sta_hw_scanning = 0; 630 local->hw_scanning = false;
631 return rc; 631 return rc;
632 } 632 }
633 local->scan_sdata = scan_sdata; 633 local->scan_sdata = scan_sdata;
634 return 0; 634 return 0;
635 } 635 }
636 636
637 local->sta_sw_scanning = 1; 637 local->sw_scanning = true;
638 638
639 rcu_read_lock(); 639 rcu_read_lock();
640 list_for_each_entry_rcu(sdata, &local->interfaces, list) { 640 list_for_each_entry_rcu(sdata, &local->interfaces, list) {
@@ -675,13 +675,14 @@ int ieee80211_sta_start_scan(struct ieee80211_sub_if_data *scan_sdata,
675} 675}
676 676
677 677
678int ieee80211_sta_req_scan(struct ieee80211_sub_if_data *sdata, u8 *ssid, size_t ssid_len) 678int ieee80211_request_scan(struct ieee80211_sub_if_data *sdata,
679 u8 *ssid, size_t ssid_len)
679{ 680{
680 struct ieee80211_local *local = sdata->local; 681 struct ieee80211_local *local = sdata->local;
681 struct ieee80211_if_sta *ifsta; 682 struct ieee80211_if_sta *ifsta;
682 683
683 if (sdata->vif.type != IEEE80211_IF_TYPE_STA) 684 if (sdata->vif.type != IEEE80211_IF_TYPE_STA)
684 return ieee80211_sta_start_scan(sdata, ssid, ssid_len); 685 return ieee80211_start_scan(sdata, ssid, ssid_len);
685 686
686 /* 687 /*
687 * STA has a state machine that might need to defer scanning 688 * STA has a state machine that might need to defer scanning
@@ -689,7 +690,7 @@ int ieee80211_sta_req_scan(struct ieee80211_sub_if_data *sdata, u8 *ssid, size_t
689 * queue it up to the state machine in that case. 690 * queue it up to the state machine in that case.
690 */ 691 */
691 692
692 if (local->sta_sw_scanning || local->sta_hw_scanning) { 693 if (local->sw_scanning || local->hw_scanning) {
693 if (local->scan_sdata == sdata) 694 if (local->scan_sdata == sdata)
694 return 0; 695 return 0;
695 return -EBUSY; 696 return -EBUSY;
@@ -707,9 +708,9 @@ int ieee80211_sta_req_scan(struct ieee80211_sub_if_data *sdata, u8 *ssid, size_t
707} 708}
708 709
709 710
710static void ieee80211_sta_add_scan_ies(struct iw_request_info *info, 711static void ieee80211_scan_add_ies(struct iw_request_info *info,
711 struct ieee80211_sta_bss *bss, 712 struct ieee80211_bss *bss,
712 char **current_ev, char *end_buf) 713 char **current_ev, char *end_buf)
713{ 714{
714 u8 *pos, *end, *next; 715 u8 *pos, *end, *next;
715 struct iw_event iwe; 716 struct iw_event iwe;
@@ -749,10 +750,10 @@ static void ieee80211_sta_add_scan_ies(struct iw_request_info *info,
749 750
750 751
751static char * 752static char *
752ieee80211_sta_scan_result(struct ieee80211_local *local, 753ieee80211_scan_result(struct ieee80211_local *local,
753 struct iw_request_info *info, 754 struct iw_request_info *info,
754 struct ieee80211_sta_bss *bss, 755 struct ieee80211_bss *bss,
755 char *current_ev, char *end_buf) 756 char *current_ev, char *end_buf)
756{ 757{
757 struct iw_event iwe; 758 struct iw_event iwe;
758 char *buf; 759 char *buf;
@@ -828,7 +829,7 @@ ieee80211_sta_scan_result(struct ieee80211_local *local,
828 current_ev = iwe_stream_add_point(info, current_ev, end_buf, 829 current_ev = iwe_stream_add_point(info, current_ev, end_buf,
829 &iwe, ""); 830 &iwe, "");
830 831
831 ieee80211_sta_add_scan_ies(info, bss, &current_ev, end_buf); 832 ieee80211_scan_add_ies(info, bss, &current_ev, end_buf);
832 833
833 if (bss->supp_rates_len > 0) { 834 if (bss->supp_rates_len > 0) {
834 /* display all supported rates in readable format */ 835 /* display all supported rates in readable format */
@@ -914,23 +915,23 @@ ieee80211_sta_scan_result(struct ieee80211_local *local,
914} 915}
915 916
916 917
917int ieee80211_sta_scan_results(struct ieee80211_local *local, 918int ieee80211_scan_results(struct ieee80211_local *local,
918 struct iw_request_info *info, 919 struct iw_request_info *info,
919 char *buf, size_t len) 920 char *buf, size_t len)
920{ 921{
921 char *current_ev = buf; 922 char *current_ev = buf;
922 char *end_buf = buf + len; 923 char *end_buf = buf + len;
923 struct ieee80211_sta_bss *bss; 924 struct ieee80211_bss *bss;
924 925
925 spin_lock_bh(&local->sta_bss_lock); 926 spin_lock_bh(&local->bss_lock);
926 list_for_each_entry(bss, &local->sta_bss_list, list) { 927 list_for_each_entry(bss, &local->bss_list, list) {
927 if (buf + len - current_ev <= IW_EV_ADDR_LEN) { 928 if (buf + len - current_ev <= IW_EV_ADDR_LEN) {
928 spin_unlock_bh(&local->sta_bss_lock); 929 spin_unlock_bh(&local->bss_lock);
929 return -E2BIG; 930 return -E2BIG;
930 } 931 }
931 current_ev = ieee80211_sta_scan_result(local, info, bss, 932 current_ev = ieee80211_scan_result(local, info, bss,
932 current_ev, end_buf); 933 current_ev, end_buf);
933 } 934 }
934 spin_unlock_bh(&local->sta_bss_lock); 935 spin_unlock_bh(&local->bss_lock);
935 return current_ev - buf; 936 return current_ev - buf;
936} 937}
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 1059b17c83b0..e606ba08ddd4 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -222,7 +222,7 @@ ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx)
222 if (unlikely(info->flags & IEEE80211_TX_CTL_INJECTED)) 222 if (unlikely(info->flags & IEEE80211_TX_CTL_INJECTED))
223 return TX_CONTINUE; 223 return TX_CONTINUE;
224 224
225 if (unlikely(tx->local->sta_sw_scanning) && 225 if (unlikely(tx->local->sw_scanning) &&
226 !ieee80211_is_probe_req(hdr->frame_control)) 226 !ieee80211_is_probe_req(hdr->frame_control))
227 return TX_DROP; 227 return TX_DROP;
228 228
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index cf0b820a0eaa..a7968df9dacb 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -630,7 +630,7 @@ int ieee80211_set_freq(struct ieee80211_sub_if_data *sdata, int freqMHz)
630 } 630 }
631 local->oper_channel = chan; 631 local->oper_channel = chan;
632 632
633 if (local->sta_sw_scanning || local->sta_hw_scanning) 633 if (local->sw_scanning || local->hw_scanning)
634 ret = 0; 634 ret = 0;
635 else 635 else
636 ret = ieee80211_hw_config(local); 636 ret = ieee80211_hw_config(local);
diff --git a/net/mac80211/wext.c b/net/mac80211/wext.c
index 97d132811c81..77b68ed8b832 100644
--- a/net/mac80211/wext.c
+++ b/net/mac80211/wext.c
@@ -552,7 +552,7 @@ static int ieee80211_ioctl_siwscan(struct net_device *dev,
552 ssid_len = req->essid_len; 552 ssid_len = req->essid_len;
553 } 553 }
554 554
555 return ieee80211_sta_req_scan(sdata, ssid, ssid_len); 555 return ieee80211_request_scan(sdata, ssid, ssid_len);
556} 556}
557 557
558 558
@@ -566,10 +566,10 @@ static int ieee80211_ioctl_giwscan(struct net_device *dev,
566 566
567 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 567 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
568 568
569 if (local->sta_sw_scanning || local->sta_hw_scanning) 569 if (local->sw_scanning || local->hw_scanning)
570 return -EAGAIN; 570 return -EAGAIN;
571 571
572 res = ieee80211_sta_scan_results(local, info, extra, data->length); 572 res = ieee80211_scan_results(local, info, extra, data->length);
573 if (res >= 0) { 573 if (res >= 0) {
574 data->length = res; 574 data->length = res;
575 return 0; 575 return 0;