diff options
| author | John W. Linville <linville@tuxdriver.com> | 2010-10-01 11:12:36 -0400 |
|---|---|---|
| committer | John W. Linville <linville@tuxdriver.com> | 2010-10-01 11:12:36 -0400 |
| commit | 41f4a6f71fe33faa7971c173c263fb431fe987fe (patch) | |
| tree | fdc3e603162e3ad63f6ae4160f68eb803bb78d58 /net/mac80211/util.c | |
| parent | 94d57c4cfaa43e29ca5fa5ff874048cfc67276f5 (diff) | |
| parent | 1728943d83e9fd919e454332fe344944123b3c3a (diff) | |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6 into for-davem
Diffstat (limited to 'net/mac80211/util.c')
| -rw-r--r-- | net/mac80211/util.c | 47 |
1 files changed, 33 insertions, 14 deletions
diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 737f4267c335..aba025d748e9 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c | |||
| @@ -895,26 +895,34 @@ void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata, | |||
| 895 | 895 | ||
| 896 | int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer, | 896 | int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer, |
| 897 | const u8 *ie, size_t ie_len, | 897 | const u8 *ie, size_t ie_len, |
| 898 | enum ieee80211_band band) | 898 | enum ieee80211_band band, u32 rate_mask, |
| 899 | u8 channel) | ||
| 899 | { | 900 | { |
| 900 | struct ieee80211_supported_band *sband; | 901 | struct ieee80211_supported_band *sband; |
| 901 | u8 *pos; | 902 | u8 *pos; |
| 902 | size_t offset = 0, noffset; | 903 | size_t offset = 0, noffset; |
| 903 | int supp_rates_len, i; | 904 | int supp_rates_len, i; |
| 905 | u8 rates[32]; | ||
| 906 | int num_rates; | ||
| 907 | int ext_rates_len; | ||
| 904 | 908 | ||
| 905 | sband = local->hw.wiphy->bands[band]; | 909 | sband = local->hw.wiphy->bands[band]; |
| 906 | 910 | ||
| 907 | pos = buffer; | 911 | pos = buffer; |
| 908 | 912 | ||
| 909 | supp_rates_len = min_t(int, sband->n_bitrates, 8); | 913 | num_rates = 0; |
| 914 | for (i = 0; i < sband->n_bitrates; i++) { | ||
| 915 | if ((BIT(i) & rate_mask) == 0) | ||
| 916 | continue; /* skip rate */ | ||
| 917 | rates[num_rates++] = (u8) (sband->bitrates[i].bitrate / 5); | ||
| 918 | } | ||
| 919 | |||
| 920 | supp_rates_len = min_t(int, num_rates, 8); | ||
| 910 | 921 | ||
| 911 | *pos++ = WLAN_EID_SUPP_RATES; | 922 | *pos++ = WLAN_EID_SUPP_RATES; |
| 912 | *pos++ = supp_rates_len; | 923 | *pos++ = supp_rates_len; |
| 913 | 924 | memcpy(pos, rates, supp_rates_len); | |
| 914 | for (i = 0; i < supp_rates_len; i++) { | 925 | pos += supp_rates_len; |
| 915 | int rate = sband->bitrates[i].bitrate; | ||
| 916 | *pos++ = (u8) (rate / 5); | ||
| 917 | } | ||
| 918 | 926 | ||
| 919 | /* insert "request information" if in custom IEs */ | 927 | /* insert "request information" if in custom IEs */ |
| 920 | if (ie && ie_len) { | 928 | if (ie && ie_len) { |
| @@ -932,14 +940,18 @@ int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer, | |||
| 932 | offset = noffset; | 940 | offset = noffset; |
| 933 | } | 941 | } |
| 934 | 942 | ||
| 935 | if (sband->n_bitrates > i) { | 943 | ext_rates_len = num_rates - supp_rates_len; |
| 944 | if (ext_rates_len > 0) { | ||
| 936 | *pos++ = WLAN_EID_EXT_SUPP_RATES; | 945 | *pos++ = WLAN_EID_EXT_SUPP_RATES; |
| 937 | *pos++ = sband->n_bitrates - i; | 946 | *pos++ = ext_rates_len; |
| 947 | memcpy(pos, rates + supp_rates_len, ext_rates_len); | ||
| 948 | pos += ext_rates_len; | ||
| 949 | } | ||
| 938 | 950 | ||
| 939 | for (; i < sband->n_bitrates; i++) { | 951 | if (channel && sband->band == IEEE80211_BAND_2GHZ) { |
| 940 | int rate = sband->bitrates[i].bitrate; | 952 | *pos++ = WLAN_EID_DS_PARAMS; |
| 941 | *pos++ = (u8) (rate / 5); | 953 | *pos++ = 1; |
| 942 | } | 954 | *pos++ = channel; |
| 943 | } | 955 | } |
| 944 | 956 | ||
| 945 | /* insert custom IEs that go before HT */ | 957 | /* insert custom IEs that go before HT */ |
| @@ -1008,6 +1020,7 @@ void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst, | |||
| 1008 | struct ieee80211_mgmt *mgmt; | 1020 | struct ieee80211_mgmt *mgmt; |
| 1009 | size_t buf_len; | 1021 | size_t buf_len; |
| 1010 | u8 *buf; | 1022 | u8 *buf; |
| 1023 | u8 chan; | ||
| 1011 | 1024 | ||
| 1012 | /* FIXME: come up with a proper value */ | 1025 | /* FIXME: come up with a proper value */ |
| 1013 | buf = kmalloc(200 + ie_len, GFP_KERNEL); | 1026 | buf = kmalloc(200 + ie_len, GFP_KERNEL); |
| @@ -1017,8 +1030,14 @@ void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst, | |||
| 1017 | return; | 1030 | return; |
| 1018 | } | 1031 | } |
| 1019 | 1032 | ||
| 1033 | chan = ieee80211_frequency_to_channel( | ||
| 1034 | local->hw.conf.channel->center_freq); | ||
| 1035 | |||
| 1020 | buf_len = ieee80211_build_preq_ies(local, buf, ie, ie_len, | 1036 | buf_len = ieee80211_build_preq_ies(local, buf, ie, ie_len, |
| 1021 | local->hw.conf.channel->band); | 1037 | local->hw.conf.channel->band, |
| 1038 | sdata->rc_rateidx_mask | ||
| 1039 | [local->hw.conf.channel->band], | ||
| 1040 | chan); | ||
| 1022 | 1041 | ||
| 1023 | skb = ieee80211_probereq_get(&local->hw, &sdata->vif, | 1042 | skb = ieee80211_probereq_get(&local->hw, &sdata->vif, |
| 1024 | ssid, ssid_len, | 1043 | ssid, ssid_len, |
