aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless/scan.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/wireless/scan.c')
-rw-r--r--net/wireless/scan.c162
1 files changed, 86 insertions, 76 deletions
diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index 88f108edfb58..0798c62e6085 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -81,10 +81,10 @@ static void bss_free(struct cfg80211_internal_bss *bss)
81 kfree(bss); 81 kfree(bss);
82} 82}
83 83
84static inline void bss_ref_get(struct cfg80211_registered_device *dev, 84static inline void bss_ref_get(struct cfg80211_registered_device *rdev,
85 struct cfg80211_internal_bss *bss) 85 struct cfg80211_internal_bss *bss)
86{ 86{
87 lockdep_assert_held(&dev->bss_lock); 87 lockdep_assert_held(&rdev->bss_lock);
88 88
89 bss->refcount++; 89 bss->refcount++;
90 if (bss->pub.hidden_beacon_bss) { 90 if (bss->pub.hidden_beacon_bss) {
@@ -95,10 +95,10 @@ static inline void bss_ref_get(struct cfg80211_registered_device *dev,
95 } 95 }
96} 96}
97 97
98static inline void bss_ref_put(struct cfg80211_registered_device *dev, 98static inline void bss_ref_put(struct cfg80211_registered_device *rdev,
99 struct cfg80211_internal_bss *bss) 99 struct cfg80211_internal_bss *bss)
100{ 100{
101 lockdep_assert_held(&dev->bss_lock); 101 lockdep_assert_held(&rdev->bss_lock);
102 102
103 if (bss->pub.hidden_beacon_bss) { 103 if (bss->pub.hidden_beacon_bss) {
104 struct cfg80211_internal_bss *hbss; 104 struct cfg80211_internal_bss *hbss;
@@ -114,10 +114,10 @@ static inline void bss_ref_put(struct cfg80211_registered_device *dev,
114 bss_free(bss); 114 bss_free(bss);
115} 115}
116 116
117static bool __cfg80211_unlink_bss(struct cfg80211_registered_device *dev, 117static bool __cfg80211_unlink_bss(struct cfg80211_registered_device *rdev,
118 struct cfg80211_internal_bss *bss) 118 struct cfg80211_internal_bss *bss)
119{ 119{
120 lockdep_assert_held(&dev->bss_lock); 120 lockdep_assert_held(&rdev->bss_lock);
121 121
122 if (!list_empty(&bss->hidden_list)) { 122 if (!list_empty(&bss->hidden_list)) {
123 /* 123 /*
@@ -134,31 +134,31 @@ static bool __cfg80211_unlink_bss(struct cfg80211_registered_device *dev,
134 } 134 }
135 135
136 list_del_init(&bss->list); 136 list_del_init(&bss->list);
137 rb_erase(&bss->rbn, &dev->bss_tree); 137 rb_erase(&bss->rbn, &rdev->bss_tree);
138 bss_ref_put(dev, bss); 138 bss_ref_put(rdev, bss);
139 return true; 139 return true;
140} 140}
141 141
142static void __cfg80211_bss_expire(struct cfg80211_registered_device *dev, 142static void __cfg80211_bss_expire(struct cfg80211_registered_device *rdev,
143 unsigned long expire_time) 143 unsigned long expire_time)
144{ 144{
145 struct cfg80211_internal_bss *bss, *tmp; 145 struct cfg80211_internal_bss *bss, *tmp;
146 bool expired = false; 146 bool expired = false;
147 147
148 lockdep_assert_held(&dev->bss_lock); 148 lockdep_assert_held(&rdev->bss_lock);
149 149
150 list_for_each_entry_safe(bss, tmp, &dev->bss_list, list) { 150 list_for_each_entry_safe(bss, tmp, &rdev->bss_list, list) {
151 if (atomic_read(&bss->hold)) 151 if (atomic_read(&bss->hold))
152 continue; 152 continue;
153 if (!time_after(expire_time, bss->ts)) 153 if (!time_after(expire_time, bss->ts))
154 continue; 154 continue;
155 155
156 if (__cfg80211_unlink_bss(dev, bss)) 156 if (__cfg80211_unlink_bss(rdev, bss))
157 expired = true; 157 expired = true;
158 } 158 }
159 159
160 if (expired) 160 if (expired)
161 dev->bss_generation++; 161 rdev->bss_generation++;
162} 162}
163 163
164void ___cfg80211_scan_done(struct cfg80211_registered_device *rdev, 164void ___cfg80211_scan_done(struct cfg80211_registered_device *rdev,
@@ -238,11 +238,11 @@ void __cfg80211_scan_done(struct work_struct *wk)
238void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted) 238void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted)
239{ 239{
240 trace_cfg80211_scan_done(request, aborted); 240 trace_cfg80211_scan_done(request, aborted);
241 WARN_ON(request != wiphy_to_dev(request->wiphy)->scan_req); 241 WARN_ON(request != wiphy_to_rdev(request->wiphy)->scan_req);
242 242
243 request->aborted = aborted; 243 request->aborted = aborted;
244 request->notified = true; 244 request->notified = true;
245 queue_work(cfg80211_wq, &wiphy_to_dev(request->wiphy)->scan_done_wk); 245 queue_work(cfg80211_wq, &wiphy_to_rdev(request->wiphy)->scan_done_wk);
246} 246}
247EXPORT_SYMBOL(cfg80211_scan_done); 247EXPORT_SYMBOL(cfg80211_scan_done);
248 248
@@ -278,15 +278,15 @@ void cfg80211_sched_scan_results(struct wiphy *wiphy)
278{ 278{
279 trace_cfg80211_sched_scan_results(wiphy); 279 trace_cfg80211_sched_scan_results(wiphy);
280 /* ignore if we're not scanning */ 280 /* ignore if we're not scanning */
281 if (wiphy_to_dev(wiphy)->sched_scan_req) 281 if (wiphy_to_rdev(wiphy)->sched_scan_req)
282 queue_work(cfg80211_wq, 282 queue_work(cfg80211_wq,
283 &wiphy_to_dev(wiphy)->sched_scan_results_wk); 283 &wiphy_to_rdev(wiphy)->sched_scan_results_wk);
284} 284}
285EXPORT_SYMBOL(cfg80211_sched_scan_results); 285EXPORT_SYMBOL(cfg80211_sched_scan_results);
286 286
287void cfg80211_sched_scan_stopped_rtnl(struct wiphy *wiphy) 287void cfg80211_sched_scan_stopped_rtnl(struct wiphy *wiphy)
288{ 288{
289 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); 289 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);
290 290
291 ASSERT_RTNL(); 291 ASSERT_RTNL();
292 292
@@ -330,21 +330,21 @@ int __cfg80211_stop_sched_scan(struct cfg80211_registered_device *rdev,
330 return 0; 330 return 0;
331} 331}
332 332
333void cfg80211_bss_age(struct cfg80211_registered_device *dev, 333void cfg80211_bss_age(struct cfg80211_registered_device *rdev,
334 unsigned long age_secs) 334 unsigned long age_secs)
335{ 335{
336 struct cfg80211_internal_bss *bss; 336 struct cfg80211_internal_bss *bss;
337 unsigned long age_jiffies = msecs_to_jiffies(age_secs * MSEC_PER_SEC); 337 unsigned long age_jiffies = msecs_to_jiffies(age_secs * MSEC_PER_SEC);
338 338
339 spin_lock_bh(&dev->bss_lock); 339 spin_lock_bh(&rdev->bss_lock);
340 list_for_each_entry(bss, &dev->bss_list, list) 340 list_for_each_entry(bss, &rdev->bss_list, list)
341 bss->ts -= age_jiffies; 341 bss->ts -= age_jiffies;
342 spin_unlock_bh(&dev->bss_lock); 342 spin_unlock_bh(&rdev->bss_lock);
343} 343}
344 344
345void cfg80211_bss_expire(struct cfg80211_registered_device *dev) 345void cfg80211_bss_expire(struct cfg80211_registered_device *rdev)
346{ 346{
347 __cfg80211_bss_expire(dev, jiffies - IEEE80211_SCAN_RESULT_EXPIRE); 347 __cfg80211_bss_expire(rdev, jiffies - IEEE80211_SCAN_RESULT_EXPIRE);
348} 348}
349 349
350const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len) 350const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len)
@@ -534,32 +534,34 @@ struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
534 const u8 *ssid, size_t ssid_len, 534 const u8 *ssid, size_t ssid_len,
535 u16 capa_mask, u16 capa_val) 535 u16 capa_mask, u16 capa_val)
536{ 536{
537 struct cfg80211_registered_device *dev = wiphy_to_dev(wiphy); 537 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);
538 struct cfg80211_internal_bss *bss, *res = NULL; 538 struct cfg80211_internal_bss *bss, *res = NULL;
539 unsigned long now = jiffies; 539 unsigned long now = jiffies;
540 540
541 trace_cfg80211_get_bss(wiphy, channel, bssid, ssid, ssid_len, capa_mask, 541 trace_cfg80211_get_bss(wiphy, channel, bssid, ssid, ssid_len, capa_mask,
542 capa_val); 542 capa_val);
543 543
544 spin_lock_bh(&dev->bss_lock); 544 spin_lock_bh(&rdev->bss_lock);
545 545
546 list_for_each_entry(bss, &dev->bss_list, list) { 546 list_for_each_entry(bss, &rdev->bss_list, list) {
547 if ((bss->pub.capability & capa_mask) != capa_val) 547 if ((bss->pub.capability & capa_mask) != capa_val)
548 continue; 548 continue;
549 if (channel && bss->pub.channel != channel) 549 if (channel && bss->pub.channel != channel)
550 continue; 550 continue;
551 if (!is_valid_ether_addr(bss->pub.bssid))
552 continue;
551 /* Don't get expired BSS structs */ 553 /* Don't get expired BSS structs */
552 if (time_after(now, bss->ts + IEEE80211_SCAN_RESULT_EXPIRE) && 554 if (time_after(now, bss->ts + IEEE80211_SCAN_RESULT_EXPIRE) &&
553 !atomic_read(&bss->hold)) 555 !atomic_read(&bss->hold))
554 continue; 556 continue;
555 if (is_bss(&bss->pub, bssid, ssid, ssid_len)) { 557 if (is_bss(&bss->pub, bssid, ssid, ssid_len)) {
556 res = bss; 558 res = bss;
557 bss_ref_get(dev, res); 559 bss_ref_get(rdev, res);
558 break; 560 break;
559 } 561 }
560 } 562 }
561 563
562 spin_unlock_bh(&dev->bss_lock); 564 spin_unlock_bh(&rdev->bss_lock);
563 if (!res) 565 if (!res)
564 return NULL; 566 return NULL;
565 trace_cfg80211_return_bss(&res->pub); 567 trace_cfg80211_return_bss(&res->pub);
@@ -567,10 +569,10 @@ struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
567} 569}
568EXPORT_SYMBOL(cfg80211_get_bss); 570EXPORT_SYMBOL(cfg80211_get_bss);
569 571
570static void rb_insert_bss(struct cfg80211_registered_device *dev, 572static void rb_insert_bss(struct cfg80211_registered_device *rdev,
571 struct cfg80211_internal_bss *bss) 573 struct cfg80211_internal_bss *bss)
572{ 574{
573 struct rb_node **p = &dev->bss_tree.rb_node; 575 struct rb_node **p = &rdev->bss_tree.rb_node;
574 struct rb_node *parent = NULL; 576 struct rb_node *parent = NULL;
575 struct cfg80211_internal_bss *tbss; 577 struct cfg80211_internal_bss *tbss;
576 int cmp; 578 int cmp;
@@ -593,15 +595,15 @@ static void rb_insert_bss(struct cfg80211_registered_device *dev,
593 } 595 }
594 596
595 rb_link_node(&bss->rbn, parent, p); 597 rb_link_node(&bss->rbn, parent, p);
596 rb_insert_color(&bss->rbn, &dev->bss_tree); 598 rb_insert_color(&bss->rbn, &rdev->bss_tree);
597} 599}
598 600
599static struct cfg80211_internal_bss * 601static struct cfg80211_internal_bss *
600rb_find_bss(struct cfg80211_registered_device *dev, 602rb_find_bss(struct cfg80211_registered_device *rdev,
601 struct cfg80211_internal_bss *res, 603 struct cfg80211_internal_bss *res,
602 enum bss_compare_mode mode) 604 enum bss_compare_mode mode)
603{ 605{
604 struct rb_node *n = dev->bss_tree.rb_node; 606 struct rb_node *n = rdev->bss_tree.rb_node;
605 struct cfg80211_internal_bss *bss; 607 struct cfg80211_internal_bss *bss;
606 int r; 608 int r;
607 609
@@ -620,7 +622,7 @@ rb_find_bss(struct cfg80211_registered_device *dev,
620 return NULL; 622 return NULL;
621} 623}
622 624
623static bool cfg80211_combine_bsses(struct cfg80211_registered_device *dev, 625static bool cfg80211_combine_bsses(struct cfg80211_registered_device *rdev,
624 struct cfg80211_internal_bss *new) 626 struct cfg80211_internal_bss *new)
625{ 627{
626 const struct cfg80211_bss_ies *ies; 628 const struct cfg80211_bss_ies *ies;
@@ -650,7 +652,7 @@ static bool cfg80211_combine_bsses(struct cfg80211_registered_device *dev,
650 652
651 /* This is the bad part ... */ 653 /* This is the bad part ... */
652 654
653 list_for_each_entry(bss, &dev->bss_list, list) { 655 list_for_each_entry(bss, &rdev->bss_list, list) {
654 if (!ether_addr_equal(bss->pub.bssid, new->pub.bssid)) 656 if (!ether_addr_equal(bss->pub.bssid, new->pub.bssid))
655 continue; 657 continue;
656 if (bss->pub.channel != new->pub.channel) 658 if (bss->pub.channel != new->pub.channel)
@@ -684,7 +686,7 @@ static bool cfg80211_combine_bsses(struct cfg80211_registered_device *dev,
684 686
685/* Returned bss is reference counted and must be cleaned up appropriately. */ 687/* Returned bss is reference counted and must be cleaned up appropriately. */
686static struct cfg80211_internal_bss * 688static struct cfg80211_internal_bss *
687cfg80211_bss_update(struct cfg80211_registered_device *dev, 689cfg80211_bss_update(struct cfg80211_registered_device *rdev,
688 struct cfg80211_internal_bss *tmp, 690 struct cfg80211_internal_bss *tmp,
689 bool signal_valid) 691 bool signal_valid)
690{ 692{
@@ -695,14 +697,14 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev,
695 697
696 tmp->ts = jiffies; 698 tmp->ts = jiffies;
697 699
698 spin_lock_bh(&dev->bss_lock); 700 spin_lock_bh(&rdev->bss_lock);
699 701
700 if (WARN_ON(!rcu_access_pointer(tmp->pub.ies))) { 702 if (WARN_ON(!rcu_access_pointer(tmp->pub.ies))) {
701 spin_unlock_bh(&dev->bss_lock); 703 spin_unlock_bh(&rdev->bss_lock);
702 return NULL; 704 return NULL;
703 } 705 }
704 706
705 found = rb_find_bss(dev, tmp, BSS_CMP_REGULAR); 707 found = rb_find_bss(rdev, tmp, BSS_CMP_REGULAR);
706 708
707 if (found) { 709 if (found) {
708 /* Update IEs */ 710 /* Update IEs */
@@ -789,7 +791,7 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev,
789 * is allocated on the stack since it's not needed in the 791 * is allocated on the stack since it's not needed in the
790 * more common case of an update 792 * more common case of an update
791 */ 793 */
792 new = kzalloc(sizeof(*new) + dev->wiphy.bss_priv_size, 794 new = kzalloc(sizeof(*new) + rdev->wiphy.bss_priv_size,
793 GFP_ATOMIC); 795 GFP_ATOMIC);
794 if (!new) { 796 if (!new) {
795 ies = (void *)rcu_dereference(tmp->pub.beacon_ies); 797 ies = (void *)rcu_dereference(tmp->pub.beacon_ies);
@@ -805,9 +807,9 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev,
805 INIT_LIST_HEAD(&new->hidden_list); 807 INIT_LIST_HEAD(&new->hidden_list);
806 808
807 if (rcu_access_pointer(tmp->pub.proberesp_ies)) { 809 if (rcu_access_pointer(tmp->pub.proberesp_ies)) {
808 hidden = rb_find_bss(dev, tmp, BSS_CMP_HIDE_ZLEN); 810 hidden = rb_find_bss(rdev, tmp, BSS_CMP_HIDE_ZLEN);
809 if (!hidden) 811 if (!hidden)
810 hidden = rb_find_bss(dev, tmp, 812 hidden = rb_find_bss(rdev, tmp,
811 BSS_CMP_HIDE_NUL); 813 BSS_CMP_HIDE_NUL);
812 if (hidden) { 814 if (hidden) {
813 new->pub.hidden_beacon_bss = &hidden->pub; 815 new->pub.hidden_beacon_bss = &hidden->pub;
@@ -824,24 +826,24 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev,
824 * expensive search for any probe responses that should 826 * expensive search for any probe responses that should
825 * be grouped with this beacon for updates ... 827 * be grouped with this beacon for updates ...
826 */ 828 */
827 if (!cfg80211_combine_bsses(dev, new)) { 829 if (!cfg80211_combine_bsses(rdev, new)) {
828 kfree(new); 830 kfree(new);
829 goto drop; 831 goto drop;
830 } 832 }
831 } 833 }
832 834
833 list_add_tail(&new->list, &dev->bss_list); 835 list_add_tail(&new->list, &rdev->bss_list);
834 rb_insert_bss(dev, new); 836 rb_insert_bss(rdev, new);
835 found = new; 837 found = new;
836 } 838 }
837 839
838 dev->bss_generation++; 840 rdev->bss_generation++;
839 bss_ref_get(dev, found); 841 bss_ref_get(rdev, found);
840 spin_unlock_bh(&dev->bss_lock); 842 spin_unlock_bh(&rdev->bss_lock);
841 843
842 return found; 844 return found;
843 drop: 845 drop:
844 spin_unlock_bh(&dev->bss_lock); 846 spin_unlock_bh(&rdev->bss_lock);
845 return NULL; 847 return NULL;
846} 848}
847 849
@@ -889,6 +891,7 @@ cfg80211_inform_bss_width(struct wiphy *wiphy,
889 struct cfg80211_bss_ies *ies; 891 struct cfg80211_bss_ies *ies;
890 struct ieee80211_channel *channel; 892 struct ieee80211_channel *channel;
891 struct cfg80211_internal_bss tmp = {}, *res; 893 struct cfg80211_internal_bss tmp = {}, *res;
894 bool signal_valid;
892 895
893 if (WARN_ON(!wiphy)) 896 if (WARN_ON(!wiphy))
894 return NULL; 897 return NULL;
@@ -925,8 +928,9 @@ cfg80211_inform_bss_width(struct wiphy *wiphy,
925 rcu_assign_pointer(tmp.pub.beacon_ies, ies); 928 rcu_assign_pointer(tmp.pub.beacon_ies, ies);
926 rcu_assign_pointer(tmp.pub.ies, ies); 929 rcu_assign_pointer(tmp.pub.ies, ies);
927 930
928 res = cfg80211_bss_update(wiphy_to_dev(wiphy), &tmp, 931 signal_valid = abs(rx_channel->center_freq - channel->center_freq) <=
929 rx_channel == channel); 932 wiphy->max_adj_channel_rssi_comp;
933 res = cfg80211_bss_update(wiphy_to_rdev(wiphy), &tmp, signal_valid);
930 if (!res) 934 if (!res)
931 return NULL; 935 return NULL;
932 936
@@ -950,6 +954,7 @@ cfg80211_inform_bss_width_frame(struct wiphy *wiphy,
950 struct cfg80211_internal_bss tmp = {}, *res; 954 struct cfg80211_internal_bss tmp = {}, *res;
951 struct cfg80211_bss_ies *ies; 955 struct cfg80211_bss_ies *ies;
952 struct ieee80211_channel *channel; 956 struct ieee80211_channel *channel;
957 bool signal_valid;
953 size_t ielen = len - offsetof(struct ieee80211_mgmt, 958 size_t ielen = len - offsetof(struct ieee80211_mgmt,
954 u.probe_resp.variable); 959 u.probe_resp.variable);
955 960
@@ -997,8 +1002,9 @@ cfg80211_inform_bss_width_frame(struct wiphy *wiphy,
997 tmp.pub.beacon_interval = le16_to_cpu(mgmt->u.probe_resp.beacon_int); 1002 tmp.pub.beacon_interval = le16_to_cpu(mgmt->u.probe_resp.beacon_int);
998 tmp.pub.capability = le16_to_cpu(mgmt->u.probe_resp.capab_info); 1003 tmp.pub.capability = le16_to_cpu(mgmt->u.probe_resp.capab_info);
999 1004
1000 res = cfg80211_bss_update(wiphy_to_dev(wiphy), &tmp, 1005 signal_valid = abs(rx_channel->center_freq - channel->center_freq) <=
1001 rx_channel == channel); 1006 wiphy->max_adj_channel_rssi_comp;
1007 res = cfg80211_bss_update(wiphy_to_rdev(wiphy), &tmp, signal_valid);
1002 if (!res) 1008 if (!res)
1003 return NULL; 1009 return NULL;
1004 1010
@@ -1013,7 +1019,7 @@ EXPORT_SYMBOL(cfg80211_inform_bss_width_frame);
1013 1019
1014void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *pub) 1020void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *pub)
1015{ 1021{
1016 struct cfg80211_registered_device *dev = wiphy_to_dev(wiphy); 1022 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);
1017 struct cfg80211_internal_bss *bss; 1023 struct cfg80211_internal_bss *bss;
1018 1024
1019 if (!pub) 1025 if (!pub)
@@ -1021,15 +1027,15 @@ void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *pub)
1021 1027
1022 bss = container_of(pub, struct cfg80211_internal_bss, pub); 1028 bss = container_of(pub, struct cfg80211_internal_bss, pub);
1023 1029
1024 spin_lock_bh(&dev->bss_lock); 1030 spin_lock_bh(&rdev->bss_lock);
1025 bss_ref_get(dev, bss); 1031 bss_ref_get(rdev, bss);
1026 spin_unlock_bh(&dev->bss_lock); 1032 spin_unlock_bh(&rdev->bss_lock);
1027} 1033}
1028EXPORT_SYMBOL(cfg80211_ref_bss); 1034EXPORT_SYMBOL(cfg80211_ref_bss);
1029 1035
1030void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *pub) 1036void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *pub)
1031{ 1037{
1032 struct cfg80211_registered_device *dev = wiphy_to_dev(wiphy); 1038 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);
1033 struct cfg80211_internal_bss *bss; 1039 struct cfg80211_internal_bss *bss;
1034 1040
1035 if (!pub) 1041 if (!pub)
@@ -1037,15 +1043,15 @@ void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *pub)
1037 1043
1038 bss = container_of(pub, struct cfg80211_internal_bss, pub); 1044 bss = container_of(pub, struct cfg80211_internal_bss, pub);
1039 1045
1040 spin_lock_bh(&dev->bss_lock); 1046 spin_lock_bh(&rdev->bss_lock);
1041 bss_ref_put(dev, bss); 1047 bss_ref_put(rdev, bss);
1042 spin_unlock_bh(&dev->bss_lock); 1048 spin_unlock_bh(&rdev->bss_lock);
1043} 1049}
1044EXPORT_SYMBOL(cfg80211_put_bss); 1050EXPORT_SYMBOL(cfg80211_put_bss);
1045 1051
1046void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *pub) 1052void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *pub)
1047{ 1053{
1048 struct cfg80211_registered_device *dev = wiphy_to_dev(wiphy); 1054 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);
1049 struct cfg80211_internal_bss *bss; 1055 struct cfg80211_internal_bss *bss;
1050 1056
1051 if (WARN_ON(!pub)) 1057 if (WARN_ON(!pub))
@@ -1053,12 +1059,12 @@ void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *pub)
1053 1059
1054 bss = container_of(pub, struct cfg80211_internal_bss, pub); 1060 bss = container_of(pub, struct cfg80211_internal_bss, pub);
1055 1061
1056 spin_lock_bh(&dev->bss_lock); 1062 spin_lock_bh(&rdev->bss_lock);
1057 if (!list_empty(&bss->list)) { 1063 if (!list_empty(&bss->list)) {
1058 if (__cfg80211_unlink_bss(dev, bss)) 1064 if (__cfg80211_unlink_bss(rdev, bss))
1059 dev->bss_generation++; 1065 rdev->bss_generation++;
1060 } 1066 }
1061 spin_unlock_bh(&dev->bss_lock); 1067 spin_unlock_bh(&rdev->bss_lock);
1062} 1068}
1063EXPORT_SYMBOL(cfg80211_unlink_bss); 1069EXPORT_SYMBOL(cfg80211_unlink_bss);
1064 1070
@@ -1075,7 +1081,7 @@ cfg80211_get_dev_from_ifindex(struct net *net, int ifindex)
1075 if (!dev) 1081 if (!dev)
1076 return ERR_PTR(-ENODEV); 1082 return ERR_PTR(-ENODEV);
1077 if (dev->ieee80211_ptr) 1083 if (dev->ieee80211_ptr)
1078 rdev = wiphy_to_dev(dev->ieee80211_ptr->wiphy); 1084 rdev = wiphy_to_rdev(dev->ieee80211_ptr->wiphy);
1079 else 1085 else
1080 rdev = ERR_PTR(-ENODEV); 1086 rdev = ERR_PTR(-ENODEV);
1081 dev_put(dev); 1087 dev_put(dev);
@@ -1155,7 +1161,11 @@ int cfg80211_wext_siwscan(struct net_device *dev,
1155 int k; 1161 int k;
1156 int wiphy_freq = wiphy->bands[band]->channels[j].center_freq; 1162 int wiphy_freq = wiphy->bands[band]->channels[j].center_freq;
1157 for (k = 0; k < wreq->num_channels; k++) { 1163 for (k = 0; k < wreq->num_channels; k++) {
1158 int wext_freq = cfg80211_wext_freq(wiphy, &wreq->channel_list[k]); 1164 struct iw_freq *freq =
1165 &wreq->channel_list[k];
1166 int wext_freq =
1167 cfg80211_wext_freq(freq);
1168
1159 if (wext_freq == wiphy_freq) 1169 if (wext_freq == wiphy_freq)
1160 goto wext_freq_found; 1170 goto wext_freq_found;
1161 } 1171 }
@@ -1467,7 +1477,7 @@ ieee80211_bss(struct wiphy *wiphy, struct iw_request_info *info,
1467} 1477}
1468 1478
1469 1479
1470static int ieee80211_scan_results(struct cfg80211_registered_device *dev, 1480static int ieee80211_scan_results(struct cfg80211_registered_device *rdev,
1471 struct iw_request_info *info, 1481 struct iw_request_info *info,
1472 char *buf, size_t len) 1482 char *buf, size_t len)
1473{ 1483{
@@ -1475,18 +1485,18 @@ static int ieee80211_scan_results(struct cfg80211_registered_device *dev,
1475 char *end_buf = buf + len; 1485 char *end_buf = buf + len;
1476 struct cfg80211_internal_bss *bss; 1486 struct cfg80211_internal_bss *bss;
1477 1487
1478 spin_lock_bh(&dev->bss_lock); 1488 spin_lock_bh(&rdev->bss_lock);
1479 cfg80211_bss_expire(dev); 1489 cfg80211_bss_expire(rdev);
1480 1490
1481 list_for_each_entry(bss, &dev->bss_list, list) { 1491 list_for_each_entry(bss, &rdev->bss_list, list) {
1482 if (buf + len - current_ev <= IW_EV_ADDR_LEN) { 1492 if (buf + len - current_ev <= IW_EV_ADDR_LEN) {
1483 spin_unlock_bh(&dev->bss_lock); 1493 spin_unlock_bh(&rdev->bss_lock);
1484 return -E2BIG; 1494 return -E2BIG;
1485 } 1495 }
1486 current_ev = ieee80211_bss(&dev->wiphy, info, bss, 1496 current_ev = ieee80211_bss(&rdev->wiphy, info, bss,
1487 current_ev, end_buf); 1497 current_ev, end_buf);
1488 } 1498 }
1489 spin_unlock_bh(&dev->bss_lock); 1499 spin_unlock_bh(&rdev->bss_lock);
1490 return current_ev - buf; 1500 return current_ev - buf;
1491} 1501}
1492 1502