diff options
author | Kalle Valo <kalle.valo@nokia.com> | 2010-03-18 06:26:35 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-03-23 16:50:22 -0400 |
commit | 818e3063a9546fcd826155dd47582a6e2f4d1c37 (patch) | |
tree | 7a0063a898cbaabf3e22df73c437ab6bc20d0412 /drivers | |
parent | 899e6e65c39990a76c17940625dbe6001f618734 (diff) |
wl1271: get probe request template from mac80211
If we get probe request from mac80211, we can remove two functions.
Signed-off-by: Kalle Valo <kalle.valo@nokia.com>
Reviewed-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271_cmd.c | 137 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271_cmd.h | 11 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271_event.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271_main.c | 6 |
4 files changed, 40 insertions, 116 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.c b/drivers/net/wireless/wl12xx/wl1271_cmd.c index 3a615fac54e8..8364270b2d5c 100644 --- a/drivers/net/wireless/wl12xx/wl1271_cmd.c +++ b/drivers/net/wireless/wl12xx/wl1271_cmd.c | |||
@@ -546,9 +546,9 @@ out: | |||
546 | return ret; | 546 | return ret; |
547 | } | 547 | } |
548 | 548 | ||
549 | int wl1271_cmd_scan(struct wl1271 *wl, u8 *ssid, size_t len, | 549 | int wl1271_cmd_scan(struct wl1271 *wl, const u8 *ssid, size_t ssid_len, |
550 | u8 active_scan, u8 high_prio, u8 band, | 550 | const u8 *ie, size_t ie_len, u8 active_scan, |
551 | u8 probe_requests) | 551 | u8 high_prio, u8 band, u8 probe_requests) |
552 | { | 552 | { |
553 | 553 | ||
554 | struct wl1271_cmd_trigger_scan_to *trigger = NULL; | 554 | struct wl1271_cmd_trigger_scan_to *trigger = NULL; |
@@ -619,12 +619,13 @@ int wl1271_cmd_scan(struct wl1271 *wl, u8 *ssid, size_t len, | |||
619 | 619 | ||
620 | params->params.num_channels = j; | 620 | params->params.num_channels = j; |
621 | 621 | ||
622 | if (len && ssid) { | 622 | if (ssid_len && ssid) { |
623 | params->params.ssid_len = len; | 623 | params->params.ssid_len = ssid_len; |
624 | memcpy(params->params.ssid, ssid, len); | 624 | memcpy(params->params.ssid, ssid, ssid_len); |
625 | } | 625 | } |
626 | 626 | ||
627 | ret = wl1271_cmd_build_probe_req(wl, ssid, len, ieee_band); | 627 | ret = wl1271_cmd_build_probe_req(wl, ssid, ssid_len, |
628 | ie, ie_len, ieee_band); | ||
628 | if (ret < 0) { | 629 | if (ret < 0) { |
629 | wl1271_error("PROBE request template failed"); | 630 | wl1271_error("PROBE request template failed"); |
630 | goto out; | 631 | goto out; |
@@ -655,9 +656,9 @@ int wl1271_cmd_scan(struct wl1271 *wl, u8 *ssid, size_t len, | |||
655 | wl->scan.active = active_scan; | 656 | wl->scan.active = active_scan; |
656 | wl->scan.high_prio = high_prio; | 657 | wl->scan.high_prio = high_prio; |
657 | wl->scan.probe_requests = probe_requests; | 658 | wl->scan.probe_requests = probe_requests; |
658 | if (len && ssid) { | 659 | if (ssid_len && ssid) { |
659 | wl->scan.ssid_len = len; | 660 | wl->scan.ssid_len = ssid_len; |
660 | memcpy(wl->scan.ssid, ssid, len); | 661 | memcpy(wl->scan.ssid, ssid, ssid_len); |
661 | } else | 662 | } else |
662 | wl->scan.ssid_len = 0; | 663 | wl->scan.ssid_len = 0; |
663 | } | 664 | } |
@@ -714,66 +715,6 @@ out: | |||
714 | return ret; | 715 | return ret; |
715 | } | 716 | } |
716 | 717 | ||
717 | static int wl1271_build_basic_rates(u8 *rates, u8 band) | ||
718 | { | ||
719 | u8 index = 0; | ||
720 | |||
721 | if (band == IEEE80211_BAND_2GHZ) { | ||
722 | rates[index++] = | ||
723 | IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_1MB; | ||
724 | rates[index++] = | ||
725 | IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_2MB; | ||
726 | rates[index++] = | ||
727 | IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_5MB; | ||
728 | rates[index++] = | ||
729 | IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_11MB; | ||
730 | } else if (band == IEEE80211_BAND_5GHZ) { | ||
731 | rates[index++] = | ||
732 | IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_6MB; | ||
733 | rates[index++] = | ||
734 | IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_12MB; | ||
735 | rates[index++] = | ||
736 | IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_24MB; | ||
737 | } else { | ||
738 | wl1271_error("build_basic_rates invalid band: %d", band); | ||
739 | } | ||
740 | |||
741 | return index; | ||
742 | } | ||
743 | |||
744 | static int wl1271_build_extended_rates(u8 *rates, u8 band) | ||
745 | { | ||
746 | u8 index = 0; | ||
747 | |||
748 | if (band == IEEE80211_BAND_2GHZ) { | ||
749 | rates[index++] = IEEE80211_OFDM_RATE_6MB; | ||
750 | rates[index++] = IEEE80211_OFDM_RATE_9MB; | ||
751 | rates[index++] = IEEE80211_OFDM_RATE_12MB; | ||
752 | rates[index++] = IEEE80211_OFDM_RATE_18MB; | ||
753 | rates[index++] = IEEE80211_OFDM_RATE_24MB; | ||
754 | rates[index++] = IEEE80211_OFDM_RATE_36MB; | ||
755 | rates[index++] = IEEE80211_OFDM_RATE_48MB; | ||
756 | rates[index++] = IEEE80211_OFDM_RATE_54MB; | ||
757 | } else if (band == IEEE80211_BAND_5GHZ) { | ||
758 | rates[index++] = | ||
759 | IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_9MB; | ||
760 | rates[index++] = | ||
761 | IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_18MB; | ||
762 | rates[index++] = | ||
763 | IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_24MB; | ||
764 | rates[index++] = | ||
765 | IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_36MB; | ||
766 | rates[index++] = | ||
767 | IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_48MB; | ||
768 | rates[index++] = | ||
769 | IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_54MB; | ||
770 | } else { | ||
771 | wl1271_error("build_basic_rates invalid band: %d", band); | ||
772 | } | ||
773 | |||
774 | return index; | ||
775 | } | ||
776 | |||
777 | int wl1271_cmd_build_null_data(struct wl1271 *wl) | 718 | int wl1271_cmd_build_null_data(struct wl1271 *wl) |
778 | { | 719 | { |
779 | struct sk_buff *skb; | 720 | struct sk_buff *skb; |
@@ -809,53 +750,31 @@ out: | |||
809 | return ret; | 750 | return ret; |
810 | } | 751 | } |
811 | 752 | ||
812 | int wl1271_cmd_build_probe_req(struct wl1271 *wl, u8 *ssid, size_t ssid_len, | 753 | int wl1271_cmd_build_probe_req(struct wl1271 *wl, |
813 | u8 band) | 754 | const u8 *ssid, size_t ssid_len, |
755 | const u8 *ie, size_t ie_len, u8 band) | ||
814 | { | 756 | { |
815 | struct wl12xx_probe_req_template template; | 757 | struct sk_buff *skb; |
816 | struct wl12xx_ie_rates *rates; | ||
817 | char *ptr; | ||
818 | u16 size; | ||
819 | int ret; | 758 | int ret; |
820 | 759 | ||
821 | ptr = (char *)&template; | 760 | skb = ieee80211_probereq_get(wl->hw, wl->vif, ssid, ssid_len, |
822 | size = sizeof(struct ieee80211_header); | 761 | ie, ie_len); |
823 | 762 | if (!skb) { | |
824 | memset(template.header.da, 0xff, ETH_ALEN); | 763 | ret = -ENOMEM; |
825 | memset(template.header.bssid, 0xff, ETH_ALEN); | 764 | goto out; |
826 | memcpy(template.header.sa, wl->mac_addr, ETH_ALEN); | 765 | } |
827 | template.header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ); | 766 | |
828 | 767 | wl1271_dump(DEBUG_SCAN, "PROBE REQ: ", skb->data, skb->len); | |
829 | /* IEs */ | ||
830 | /* SSID */ | ||
831 | template.ssid.header.id = WLAN_EID_SSID; | ||
832 | template.ssid.header.len = ssid_len; | ||
833 | if (ssid_len && ssid) | ||
834 | memcpy(template.ssid.ssid, ssid, ssid_len); | ||
835 | size += sizeof(struct wl12xx_ie_header) + ssid_len; | ||
836 | ptr += size; | ||
837 | |||
838 | /* Basic Rates */ | ||
839 | rates = (struct wl12xx_ie_rates *)ptr; | ||
840 | rates->header.id = WLAN_EID_SUPP_RATES; | ||
841 | rates->header.len = wl1271_build_basic_rates(rates->rates, band); | ||
842 | size += sizeof(struct wl12xx_ie_header) + rates->header.len; | ||
843 | ptr += sizeof(struct wl12xx_ie_header) + rates->header.len; | ||
844 | |||
845 | /* Extended rates */ | ||
846 | rates = (struct wl12xx_ie_rates *)ptr; | ||
847 | rates->header.id = WLAN_EID_EXT_SUPP_RATES; | ||
848 | rates->header.len = wl1271_build_extended_rates(rates->rates, band); | ||
849 | size += sizeof(struct wl12xx_ie_header) + rates->header.len; | ||
850 | |||
851 | wl1271_dump(DEBUG_SCAN, "PROBE REQ: ", &template, size); | ||
852 | 768 | ||
853 | if (band == IEEE80211_BAND_2GHZ) | 769 | if (band == IEEE80211_BAND_2GHZ) |
854 | ret = wl1271_cmd_template_set(wl, CMD_TEMPL_CFG_PROBE_REQ_2_4, | 770 | ret = wl1271_cmd_template_set(wl, CMD_TEMPL_CFG_PROBE_REQ_2_4, |
855 | &template, size); | 771 | skb->data, skb->len); |
856 | else | 772 | else |
857 | ret = wl1271_cmd_template_set(wl, CMD_TEMPL_CFG_PROBE_REQ_5, | 773 | ret = wl1271_cmd_template_set(wl, CMD_TEMPL_CFG_PROBE_REQ_5, |
858 | &template, size); | 774 | skb->data, skb->len); |
775 | |||
776 | out: | ||
777 | dev_kfree_skb(skb); | ||
859 | return ret; | 778 | return ret; |
860 | } | 779 | } |
861 | 780 | ||
diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.h b/drivers/net/wireless/wl12xx/wl1271_cmd.h index 4297205b8d6d..e936d3ace7b8 100644 --- a/drivers/net/wireless/wl12xx/wl1271_cmd.h +++ b/drivers/net/wireless/wl12xx/wl1271_cmd.h | |||
@@ -41,15 +41,16 @@ int wl1271_cmd_data_path(struct wl1271 *wl, bool enable); | |||
41 | int wl1271_cmd_ps_mode(struct wl1271 *wl, u8 ps_mode, bool send); | 41 | int wl1271_cmd_ps_mode(struct wl1271 *wl, u8 ps_mode, bool send); |
42 | int wl1271_cmd_read_memory(struct wl1271 *wl, u32 addr, void *answer, | 42 | int wl1271_cmd_read_memory(struct wl1271 *wl, u32 addr, void *answer, |
43 | size_t len); | 43 | size_t len); |
44 | int wl1271_cmd_scan(struct wl1271 *wl, u8 *ssid, size_t len, | 44 | int wl1271_cmd_scan(struct wl1271 *wl, const u8 *ssid, size_t ssid_len, |
45 | u8 active_scan, u8 high_prio, u8 band, | 45 | const u8 *ie, size_t ie_len, u8 active_scan, |
46 | u8 probe_requests); | 46 | u8 high_prio, u8 band, u8 probe_requests); |
47 | int wl1271_cmd_template_set(struct wl1271 *wl, u16 template_id, | 47 | int wl1271_cmd_template_set(struct wl1271 *wl, u16 template_id, |
48 | void *buf, size_t buf_len); | 48 | void *buf, size_t buf_len); |
49 | int wl1271_cmd_build_null_data(struct wl1271 *wl); | 49 | int wl1271_cmd_build_null_data(struct wl1271 *wl); |
50 | int wl1271_cmd_build_ps_poll(struct wl1271 *wl, u16 aid); | 50 | int wl1271_cmd_build_ps_poll(struct wl1271 *wl, u16 aid); |
51 | int wl1271_cmd_build_probe_req(struct wl1271 *wl, u8 *ssid, size_t ssid_len, | 51 | int wl1271_cmd_build_probe_req(struct wl1271 *wl, |
52 | u8 band); | 52 | const u8 *ssid, size_t ssid_len, |
53 | const u8 *ie, size_t ie_len, u8 band); | ||
53 | int wl1271_cmd_set_default_wep_key(struct wl1271 *wl, u8 id); | 54 | int wl1271_cmd_set_default_wep_key(struct wl1271 *wl, u8 id); |
54 | int wl1271_cmd_set_key(struct wl1271 *wl, u16 action, u8 id, u8 key_type, | 55 | int wl1271_cmd_set_key(struct wl1271 *wl, u16 action, u8 id, u8 key_type, |
55 | u8 key_size, const u8 *key, const u8 *addr, | 56 | u8 key_size, const u8 *key, const u8 *addr, |
diff --git a/drivers/net/wireless/wl12xx/wl1271_event.c b/drivers/net/wireless/wl12xx/wl1271_event.c index 5533519a1418..4d35af96c597 100644 --- a/drivers/net/wireless/wl12xx/wl1271_event.c +++ b/drivers/net/wireless/wl12xx/wl1271_event.c | |||
@@ -44,7 +44,9 @@ static int wl1271_event_scan_complete(struct wl1271 *wl, | |||
44 | * scanning as it checks that. | 44 | * scanning as it checks that. |
45 | */ | 45 | */ |
46 | clear_bit(WL1271_FLAG_SCANNING, &wl->flags); | 46 | clear_bit(WL1271_FLAG_SCANNING, &wl->flags); |
47 | /* FIXME: ie missing! */ | ||
47 | wl1271_cmd_scan(wl, wl->scan.ssid, wl->scan.ssid_len, | 48 | wl1271_cmd_scan(wl, wl->scan.ssid, wl->scan.ssid_len, |
49 | NULL, 0, | ||
48 | wl->scan.active, | 50 | wl->scan.active, |
49 | wl->scan.high_prio, | 51 | wl->scan.high_prio, |
50 | WL1271_SCAN_BAND_5_GHZ, | 52 | WL1271_SCAN_BAND_5_GHZ, |
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c index d21bfe29531d..fbc42ceb39d8 100644 --- a/drivers/net/wireless/wl12xx/wl1271_main.c +++ b/drivers/net/wireless/wl12xx/wl1271_main.c | |||
@@ -1566,10 +1566,12 @@ static int wl1271_op_hw_scan(struct ieee80211_hw *hw, | |||
1566 | goto out; | 1566 | goto out; |
1567 | 1567 | ||
1568 | if (wl1271_11a_enabled()) | 1568 | if (wl1271_11a_enabled()) |
1569 | ret = wl1271_cmd_scan(hw->priv, ssid, len, 1, 0, | 1569 | ret = wl1271_cmd_scan(hw->priv, ssid, len, |
1570 | req->ie, req->ie_len, 1, 0, | ||
1570 | WL1271_SCAN_BAND_DUAL, 3); | 1571 | WL1271_SCAN_BAND_DUAL, 3); |
1571 | else | 1572 | else |
1572 | ret = wl1271_cmd_scan(hw->priv, ssid, len, 1, 0, | 1573 | ret = wl1271_cmd_scan(hw->priv, ssid, len, |
1574 | req->ie, req->ie_len, 1, 0, | ||
1573 | WL1271_SCAN_BAND_2_4_GHZ, 3); | 1575 | WL1271_SCAN_BAND_2_4_GHZ, 3); |
1574 | 1576 | ||
1575 | wl1271_ps_elp_sleep(wl); | 1577 | wl1271_ps_elp_sleep(wl); |