aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/main.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-04-01 05:58:36 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-04-22 16:54:39 -0400
commitde95a54b1aebe5592cae971ca5e5d9ec6a381a17 (patch)
tree55a622d1e61e73cd6426c5e0643ac9fd117a9fe8 /net/mac80211/main.c
parent18a8365992a8041aa178ae9ad5f0d951d0457230 (diff)
mac80211: pass all probe request IEs to driver
Instead of just passing the cfg80211-requested IEs, pass the locally generated ones as well. 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.c49
1 files changed, 34 insertions, 15 deletions
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index ee58a7873699..b3bbe78821d9 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -729,22 +729,12 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
729 729
730 wiphy->privid = mac80211_wiphy_privid; 730 wiphy->privid = mac80211_wiphy_privid;
731 731
732 if (!ops->hw_scan) {
733 /* For hw_scan, driver needs to set these up. */
734 wiphy->max_scan_ssids = 4;
735
736 /* we support a maximum of 32 rates in cfg80211 */
737 wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN
738 - 2 - 32 /* SSID */
739 - 4 - 32 /* (ext) supp rates */;
740
741 }
742
743 /* Yes, putting cfg80211_bss into ieee80211_bss is a hack */ 732 /* Yes, putting cfg80211_bss into ieee80211_bss is a hack */
744 wiphy->bss_priv_size = sizeof(struct ieee80211_bss) - 733 wiphy->bss_priv_size = sizeof(struct ieee80211_bss) -
745 sizeof(struct cfg80211_bss); 734 sizeof(struct cfg80211_bss);
746 735
747 local = wiphy_priv(wiphy); 736 local = wiphy_priv(wiphy);
737
748 local->hw.wiphy = wiphy; 738 local->hw.wiphy = wiphy;
749 739
750 local->hw.priv = (char *)local + 740 local->hw.priv = (char *)local +
@@ -831,7 +821,7 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
831 enum ieee80211_band band; 821 enum ieee80211_band band;
832 struct net_device *mdev; 822 struct net_device *mdev;
833 struct ieee80211_master_priv *mpriv; 823 struct ieee80211_master_priv *mpriv;
834 int channels, i, j; 824 int channels, i, j, max_bitrates;
835 825
836 /* 826 /*
837 * generic code guarantees at least one band, 827 * generic code guarantees at least one band,
@@ -839,18 +829,23 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
839 * that hw.conf.channel is assigned 829 * that hw.conf.channel is assigned
840 */ 830 */
841 channels = 0; 831 channels = 0;
832 max_bitrates = 0;
842 for (band = 0; band < IEEE80211_NUM_BANDS; band++) { 833 for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
843 struct ieee80211_supported_band *sband; 834 struct ieee80211_supported_band *sband;
844 835
845 sband = local->hw.wiphy->bands[band]; 836 sband = local->hw.wiphy->bands[band];
846 if (sband && !local->oper_channel) { 837 if (!sband)
838 continue;
839 if (!local->oper_channel) {
847 /* init channel we're on */ 840 /* init channel we're on */
848 local->hw.conf.channel = 841 local->hw.conf.channel =
849 local->oper_channel = 842 local->oper_channel =
850 local->scan_channel = &sband->channels[0]; 843 local->scan_channel = &sband->channels[0];
851 } 844 }
852 if (sband) 845 channels += sband->n_channels;
853 channels += sband->n_channels; 846
847 if (max_bitrates < sband->n_bitrates)
848 max_bitrates = sband->n_bitrates;
854 } 849 }
855 850
856 local->int_scan_req.n_channels = channels; 851 local->int_scan_req.n_channels = channels;
@@ -870,6 +865,30 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
870 else if (local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC) 865 else if (local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)
871 local->hw.wiphy->signal_type = CFG80211_SIGNAL_TYPE_UNSPEC; 866 local->hw.wiphy->signal_type = CFG80211_SIGNAL_TYPE_UNSPEC;
872 867
868 /*
869 * Calculate scan IE length -- we need this to alloc
870 * memory and to subtract from the driver limit. It
871 * includes the (extended) supported rates and HT
872 * information -- SSID is the driver's responsibility.
873 */
874 local->scan_ies_len = 4 + max_bitrates; /* (ext) supp rates */
875
876 if (!local->ops->hw_scan) {
877 /* For hw_scan, driver needs to set these up. */
878 local->hw.wiphy->max_scan_ssids = 4;
879 local->hw.wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN;
880 }
881
882 /*
883 * If the driver supports any scan IEs, then assume the
884 * limit includes the IEs mac80211 will add, otherwise
885 * leave it at zero and let the driver sort it out; we
886 * still pass our IEs to the driver but userspace will
887 * not be allowed to in that case.
888 */
889 if (local->hw.wiphy->max_scan_ie_len)
890 local->hw.wiphy->max_scan_ie_len -= local->scan_ies_len;
891
873 result = wiphy_register(local->hw.wiphy); 892 result = wiphy_register(local->hw.wiphy);
874 if (result < 0) 893 if (result < 0)
875 goto fail_wiphy_register; 894 goto fail_wiphy_register;