diff options
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-core.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-scan.c | 98 |
2 files changed, 49 insertions, 51 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h index 7259cbf77da4..e0423c4c01c7 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.h +++ b/drivers/net/wireless/iwlwifi/iwl-core.h | |||
@@ -202,8 +202,6 @@ void iwl_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms); | |||
202 | void iwl_force_scan_end(struct iwl_priv *priv); | 202 | void iwl_force_scan_end(struct iwl_priv *priv); |
203 | void iwl_internal_short_hw_scan(struct iwl_priv *priv); | 203 | void iwl_internal_short_hw_scan(struct iwl_priv *priv); |
204 | int iwl_force_reset(struct iwl_priv *priv, int mode, bool external); | 204 | int iwl_force_reset(struct iwl_priv *priv, int mode, bool external); |
205 | u16 iwl_fill_probe_req(struct iwl_priv *priv, struct ieee80211_mgmt *frame, | ||
206 | const u8 *ta, const u8 *ie, int ie_len, int left); | ||
207 | void iwl_setup_rx_scan_handlers(struct iwl_priv *priv); | 205 | void iwl_setup_rx_scan_handlers(struct iwl_priv *priv); |
208 | void iwl_setup_scan_deferred_work(struct iwl_priv *priv); | 206 | void iwl_setup_scan_deferred_work(struct iwl_priv *priv); |
209 | void iwl_cancel_scan_deferred_work(struct iwl_priv *priv); | 207 | void iwl_cancel_scan_deferred_work(struct iwl_priv *priv); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c index 91a14577b8a8..8c3fb3233d9f 100644 --- a/drivers/net/wireless/iwlwifi/iwl-scan.c +++ b/drivers/net/wireless/iwlwifi/iwl-scan.c | |||
@@ -572,6 +572,53 @@ static int iwl_get_channels_for_scan(struct iwl_priv *priv, | |||
572 | return added; | 572 | return added; |
573 | } | 573 | } |
574 | 574 | ||
575 | /** | ||
576 | * iwl_fill_probe_req - fill in all required fields and IE for probe request | ||
577 | */ | ||
578 | |||
579 | static u16 iwl_fill_probe_req(struct ieee80211_mgmt *frame, const u8 *ta, | ||
580 | const u8 *ies, int ie_len, int left) | ||
581 | { | ||
582 | int len = 0; | ||
583 | u8 *pos = NULL; | ||
584 | |||
585 | /* Make sure there is enough space for the probe request, | ||
586 | * two mandatory IEs and the data */ | ||
587 | left -= 24; | ||
588 | if (left < 0) | ||
589 | return 0; | ||
590 | |||
591 | frame->frame_control = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ); | ||
592 | memcpy(frame->da, iwl_bcast_addr, ETH_ALEN); | ||
593 | memcpy(frame->sa, ta, ETH_ALEN); | ||
594 | memcpy(frame->bssid, iwl_bcast_addr, ETH_ALEN); | ||
595 | frame->seq_ctrl = 0; | ||
596 | |||
597 | len += 24; | ||
598 | |||
599 | /* ...next IE... */ | ||
600 | pos = &frame->u.probe_req.variable[0]; | ||
601 | |||
602 | /* fill in our indirect SSID IE */ | ||
603 | left -= 2; | ||
604 | if (left < 0) | ||
605 | return 0; | ||
606 | *pos++ = WLAN_EID_SSID; | ||
607 | *pos++ = 0; | ||
608 | |||
609 | len += 2; | ||
610 | |||
611 | if (WARN_ON(left < ie_len)) | ||
612 | return len; | ||
613 | |||
614 | if (ies && ie_len) { | ||
615 | memcpy(pos, ies, ie_len); | ||
616 | len += ie_len; | ||
617 | } | ||
618 | |||
619 | return (u16)len; | ||
620 | } | ||
621 | |||
575 | static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) | 622 | static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) |
576 | { | 623 | { |
577 | struct iwl_host_cmd cmd = { | 624 | struct iwl_host_cmd cmd = { |
@@ -791,7 +838,7 @@ static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) | |||
791 | scan->rx_chain = cpu_to_le16(rx_chain); | 838 | scan->rx_chain = cpu_to_le16(rx_chain); |
792 | switch (priv->scan_type) { | 839 | switch (priv->scan_type) { |
793 | case IWL_SCAN_NORMAL: | 840 | case IWL_SCAN_NORMAL: |
794 | cmd_len = iwl_fill_probe_req(priv, | 841 | cmd_len = iwl_fill_probe_req( |
795 | (struct ieee80211_mgmt *)scan->data, | 842 | (struct ieee80211_mgmt *)scan->data, |
796 | vif->addr, | 843 | vif->addr, |
797 | priv->scan_request->ie, | 844 | priv->scan_request->ie, |
@@ -801,7 +848,7 @@ static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) | |||
801 | case IWL_SCAN_RADIO_RESET: | 848 | case IWL_SCAN_RADIO_RESET: |
802 | case IWL_SCAN_ROC: | 849 | case IWL_SCAN_ROC: |
803 | /* use bcast addr, will not be transmitted but must be valid */ | 850 | /* use bcast addr, will not be transmitted but must be valid */ |
804 | cmd_len = iwl_fill_probe_req(priv, | 851 | cmd_len = iwl_fill_probe_req( |
805 | (struct ieee80211_mgmt *)scan->data, | 852 | (struct ieee80211_mgmt *)scan->data, |
806 | iwl_bcast_addr, NULL, 0, | 853 | iwl_bcast_addr, NULL, 0, |
807 | IWL_MAX_SCAN_SIZE - sizeof(*scan)); | 854 | IWL_MAX_SCAN_SIZE - sizeof(*scan)); |
@@ -1004,53 +1051,6 @@ static void iwl_bg_scan_check(struct work_struct *data) | |||
1004 | mutex_unlock(&priv->mutex); | 1051 | mutex_unlock(&priv->mutex); |
1005 | } | 1052 | } |
1006 | 1053 | ||
1007 | /** | ||
1008 | * iwl_fill_probe_req - fill in all required fields and IE for probe request | ||
1009 | */ | ||
1010 | |||
1011 | u16 iwl_fill_probe_req(struct iwl_priv *priv, struct ieee80211_mgmt *frame, | ||
1012 | const u8 *ta, const u8 *ies, int ie_len, int left) | ||
1013 | { | ||
1014 | int len = 0; | ||
1015 | u8 *pos = NULL; | ||
1016 | |||
1017 | /* Make sure there is enough space for the probe request, | ||
1018 | * two mandatory IEs and the data */ | ||
1019 | left -= 24; | ||
1020 | if (left < 0) | ||
1021 | return 0; | ||
1022 | |||
1023 | frame->frame_control = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ); | ||
1024 | memcpy(frame->da, iwl_bcast_addr, ETH_ALEN); | ||
1025 | memcpy(frame->sa, ta, ETH_ALEN); | ||
1026 | memcpy(frame->bssid, iwl_bcast_addr, ETH_ALEN); | ||
1027 | frame->seq_ctrl = 0; | ||
1028 | |||
1029 | len += 24; | ||
1030 | |||
1031 | /* ...next IE... */ | ||
1032 | pos = &frame->u.probe_req.variable[0]; | ||
1033 | |||
1034 | /* fill in our indirect SSID IE */ | ||
1035 | left -= 2; | ||
1036 | if (left < 0) | ||
1037 | return 0; | ||
1038 | *pos++ = WLAN_EID_SSID; | ||
1039 | *pos++ = 0; | ||
1040 | |||
1041 | len += 2; | ||
1042 | |||
1043 | if (WARN_ON(left < ie_len)) | ||
1044 | return len; | ||
1045 | |||
1046 | if (ies && ie_len) { | ||
1047 | memcpy(pos, ies, ie_len); | ||
1048 | len += ie_len; | ||
1049 | } | ||
1050 | |||
1051 | return (u16)len; | ||
1052 | } | ||
1053 | |||
1054 | static void iwl_bg_abort_scan(struct work_struct *work) | 1054 | static void iwl_bg_abort_scan(struct work_struct *work) |
1055 | { | 1055 | { |
1056 | struct iwl_priv *priv = container_of(work, struct iwl_priv, abort_scan); | 1056 | struct iwl_priv *priv = container_of(work, struct iwl_priv, abort_scan); |