aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/main.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-02-10 15:25:55 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-02-13 13:45:49 -0500
commit2a5193119269062608582418deba7af82844159a (patch)
tree1f2fe8cffbeb7530dce7fa708310f6fb29ab0dd8 /net/mac80211/main.c
parent849b7967818995a32c3017542e33eb3155944368 (diff)
cfg80211/nl80211: scanning (and mac80211 update to use it)
This patch adds basic scan capability to cfg80211/nl80211 and changes mac80211 to use it. The BSS list that cfg80211 maintains is made driver-accessible with a private area in each BSS struct, but mac80211 doesn't yet use it. That's another large project. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/main.c')
-rw-r--r--net/mac80211/main.c32
1 files changed, 29 insertions, 3 deletions
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index 956afea4214d..954edfbb6b6f 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -733,6 +733,7 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
733 return NULL; 733 return NULL;
734 734
735 wiphy->privid = mac80211_wiphy_privid; 735 wiphy->privid = mac80211_wiphy_privid;
736 wiphy->max_scan_ssids = 4;
736 737
737 local = wiphy_priv(wiphy); 738 local = wiphy_priv(wiphy);
738 local->hw.wiphy = wiphy; 739 local->hw.wiphy = wiphy;
@@ -817,25 +818,33 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
817 enum ieee80211_band band; 818 enum ieee80211_band band;
818 struct net_device *mdev; 819 struct net_device *mdev;
819 struct ieee80211_master_priv *mpriv; 820 struct ieee80211_master_priv *mpriv;
821 int channels, i, j;
820 822
821 /* 823 /*
822 * generic code guarantees at least one band, 824 * generic code guarantees at least one band,
823 * set this very early because much code assumes 825 * set this very early because much code assumes
824 * that hw.conf.channel is assigned 826 * that hw.conf.channel is assigned
825 */ 827 */
828 channels = 0;
826 for (band = 0; band < IEEE80211_NUM_BANDS; band++) { 829 for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
827 struct ieee80211_supported_band *sband; 830 struct ieee80211_supported_band *sband;
828 831
829 sband = local->hw.wiphy->bands[band]; 832 sband = local->hw.wiphy->bands[band];
830 if (sband) { 833 if (sband && !local->oper_channel) {
831 /* init channel we're on */ 834 /* init channel we're on */
832 local->hw.conf.channel = 835 local->hw.conf.channel =
833 local->oper_channel = 836 local->oper_channel =
834 local->scan_channel = &sband->channels[0]; 837 local->scan_channel = &sband->channels[0];
835 break;
836 } 838 }
839 if (sband)
840 channels += sband->n_channels;
837 } 841 }
838 842
843 local->int_scan_req.n_channels = channels;
844 local->int_scan_req.channels = kzalloc(sizeof(void *) * channels, GFP_KERNEL);
845 if (!local->int_scan_req.channels)
846 return -ENOMEM;
847
839 /* if low-level driver supports AP, we also support VLAN */ 848 /* if low-level driver supports AP, we also support VLAN */
840 if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_AP)) 849 if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_AP))
841 local->hw.wiphy->interface_modes |= BIT(NL80211_IFTYPE_AP_VLAN); 850 local->hw.wiphy->interface_modes |= BIT(NL80211_IFTYPE_AP_VLAN);
@@ -845,7 +854,7 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
845 854
846 result = wiphy_register(local->hw.wiphy); 855 result = wiphy_register(local->hw.wiphy);
847 if (result < 0) 856 if (result < 0)
848 return result; 857 goto fail_wiphy_register;
849 858
850 /* 859 /*
851 * We use the number of queues for feature tests (QoS, HT) internally 860 * We use the number of queues for feature tests (QoS, HT) internally
@@ -948,6 +957,20 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
948 957
949 ieee80211_led_init(local); 958 ieee80211_led_init(local);
950 959
960 /* alloc internal scan request */
961 i = 0;
962 local->int_scan_req.ssids = &local->scan_ssid;
963 local->int_scan_req.n_ssids = 1;
964 for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
965 if (!hw->wiphy->bands[band])
966 continue;
967 for (j = 0; j < hw->wiphy->bands[band]->n_channels; j++) {
968 local->int_scan_req.channels[i] =
969 &hw->wiphy->bands[band]->channels[j];
970 i++;
971 }
972 }
973
951 return 0; 974 return 0;
952 975
953fail_wep: 976fail_wep:
@@ -966,6 +989,8 @@ fail_workqueue:
966 free_netdev(local->mdev); 989 free_netdev(local->mdev);
967fail_mdev_alloc: 990fail_mdev_alloc:
968 wiphy_unregister(local->hw.wiphy); 991 wiphy_unregister(local->hw.wiphy);
992fail_wiphy_register:
993 kfree(local->int_scan_req.channels);
969 return result; 994 return result;
970} 995}
971EXPORT_SYMBOL(ieee80211_register_hw); 996EXPORT_SYMBOL(ieee80211_register_hw);
@@ -1011,6 +1036,7 @@ void ieee80211_unregister_hw(struct ieee80211_hw *hw)
1011 ieee80211_wep_free(local); 1036 ieee80211_wep_free(local);
1012 ieee80211_led_exit(local); 1037 ieee80211_led_exit(local);
1013 free_netdev(local->mdev); 1038 free_netdev(local->mdev);
1039 kfree(local->int_scan_req.channels);
1014} 1040}
1015EXPORT_SYMBOL(ieee80211_unregister_hw); 1041EXPORT_SYMBOL(ieee80211_unregister_hw);
1016 1042