diff options
author | Kalle Valo <kalle.valo@nokia.com> | 2010-01-05 13:16:57 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-01-12 13:51:26 -0500 |
commit | e477c56e852c4c6db1f7665c642c9f45f76616a9 (patch) | |
tree | 493d434498964329c8192da2d865490fc6256c34 /drivers/net/wireless/wl12xx/wl1251_main.c | |
parent | 3a98c30f3e8bb1f32b5bcb74a39647b3670de275 (diff) |
wl1251: get probe request template from mac80211
Instead of creating the template in driver, get it from mac80211 instead.
Thanks to this, three functions can be now removed.
Signed-off-by: Kalle Valo <kalle.valo@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/wl12xx/wl1251_main.c')
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1251_main.c | 86 |
1 files changed, 12 insertions, 74 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1251_main.c b/drivers/net/wireless/wl12xx/wl1251_main.c index e038707294a5..1db97229af47 100644 --- a/drivers/net/wireless/wl12xx/wl1251_main.c +++ b/drivers/net/wireless/wl12xx/wl1251_main.c | |||
@@ -831,82 +831,11 @@ out: | |||
831 | return ret; | 831 | return ret; |
832 | } | 832 | } |
833 | 833 | ||
834 | static int wl1251_build_basic_rates(char *rates) | ||
835 | { | ||
836 | u8 index = 0; | ||
837 | |||
838 | rates[index++] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_1MB; | ||
839 | rates[index++] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_2MB; | ||
840 | rates[index++] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_5MB; | ||
841 | rates[index++] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_11MB; | ||
842 | |||
843 | return index; | ||
844 | } | ||
845 | |||
846 | static int wl1251_build_extended_rates(char *rates) | ||
847 | { | ||
848 | u8 index = 0; | ||
849 | |||
850 | rates[index++] = IEEE80211_OFDM_RATE_6MB; | ||
851 | rates[index++] = IEEE80211_OFDM_RATE_9MB; | ||
852 | rates[index++] = IEEE80211_OFDM_RATE_12MB; | ||
853 | rates[index++] = IEEE80211_OFDM_RATE_18MB; | ||
854 | rates[index++] = IEEE80211_OFDM_RATE_24MB; | ||
855 | rates[index++] = IEEE80211_OFDM_RATE_36MB; | ||
856 | rates[index++] = IEEE80211_OFDM_RATE_48MB; | ||
857 | rates[index++] = IEEE80211_OFDM_RATE_54MB; | ||
858 | |||
859 | return index; | ||
860 | } | ||
861 | |||
862 | |||
863 | static int wl1251_build_probe_req(struct wl1251 *wl, u8 *ssid, size_t ssid_len) | ||
864 | { | ||
865 | struct wl12xx_probe_req_template template; | ||
866 | struct wl12xx_ie_rates *rates; | ||
867 | char *ptr; | ||
868 | u16 size; | ||
869 | |||
870 | ptr = (char *)&template; | ||
871 | size = sizeof(struct ieee80211_header); | ||
872 | |||
873 | memset(template.header.da, 0xff, ETH_ALEN); | ||
874 | memset(template.header.bssid, 0xff, ETH_ALEN); | ||
875 | memcpy(template.header.sa, wl->mac_addr, ETH_ALEN); | ||
876 | template.header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ); | ||
877 | |||
878 | /* IEs */ | ||
879 | /* SSID */ | ||
880 | template.ssid.header.id = WLAN_EID_SSID; | ||
881 | template.ssid.header.len = ssid_len; | ||
882 | if (ssid_len && ssid) | ||
883 | memcpy(template.ssid.ssid, ssid, ssid_len); | ||
884 | size += sizeof(struct wl12xx_ie_header) + ssid_len; | ||
885 | ptr += size; | ||
886 | |||
887 | /* Basic Rates */ | ||
888 | rates = (struct wl12xx_ie_rates *)ptr; | ||
889 | rates->header.id = WLAN_EID_SUPP_RATES; | ||
890 | rates->header.len = wl1251_build_basic_rates(rates->rates); | ||
891 | size += sizeof(struct wl12xx_ie_header) + rates->header.len; | ||
892 | ptr += sizeof(struct wl12xx_ie_header) + rates->header.len; | ||
893 | |||
894 | /* Extended rates */ | ||
895 | rates = (struct wl12xx_ie_rates *)ptr; | ||
896 | rates->header.id = WLAN_EID_EXT_SUPP_RATES; | ||
897 | rates->header.len = wl1251_build_extended_rates(rates->rates); | ||
898 | size += sizeof(struct wl12xx_ie_header) + rates->header.len; | ||
899 | |||
900 | wl1251_dump(DEBUG_SCAN, "PROBE REQ: ", &template, size); | ||
901 | |||
902 | return wl1251_cmd_template_set(wl, CMD_PROBE_REQ, &template, | ||
903 | size); | ||
904 | } | ||
905 | |||
906 | static int wl1251_op_hw_scan(struct ieee80211_hw *hw, | 834 | static int wl1251_op_hw_scan(struct ieee80211_hw *hw, |
907 | struct cfg80211_scan_request *req) | 835 | struct cfg80211_scan_request *req) |
908 | { | 836 | { |
909 | struct wl1251 *wl = hw->priv; | 837 | struct wl1251 *wl = hw->priv; |
838 | struct sk_buff *skb; | ||
910 | size_t ssid_len = 0; | 839 | size_t ssid_len = 0; |
911 | u8 *ssid = NULL; | 840 | u8 *ssid = NULL; |
912 | int ret; | 841 | int ret; |
@@ -930,9 +859,18 @@ static int wl1251_op_hw_scan(struct ieee80211_hw *hw, | |||
930 | if (ret < 0) | 859 | if (ret < 0) |
931 | goto out; | 860 | goto out; |
932 | 861 | ||
933 | ret = wl1251_build_probe_req(wl, ssid, ssid_len); | 862 | skb = ieee80211_probereq_get(wl->hw, wl->vif, ssid, ssid_len, |
863 | req->ie, req->ie_len); | ||
864 | if (!skb) { | ||
865 | ret = -ENOMEM; | ||
866 | goto out; | ||
867 | } | ||
868 | |||
869 | ret = wl1251_cmd_template_set(wl, CMD_PROBE_REQ, skb->data, | ||
870 | skb->len); | ||
871 | dev_kfree_skb(skb); | ||
934 | if (ret < 0) | 872 | if (ret < 0) |
935 | wl1251_error("probe request template build failed"); | 873 | goto out_sleep; |
936 | 874 | ||
937 | ret = wl1251_cmd_trigger_scan_to(wl, 0); | 875 | ret = wl1251_cmd_trigger_scan_to(wl, 0); |
938 | if (ret < 0) | 876 | if (ret < 0) |