diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2008-06-11 21:47:10 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-06-14 12:18:08 -0400 |
commit | 2a421b91d6fe89e27ded7544a25449c0b050098f (patch) | |
tree | a1e0ba54c0457c20d1ac7b8b765899d695d796f6 | |
parent | 4564ce8b0e17d91d047aa875843deb2cccf3f268 (diff) |
iwlwifi: move scan to iwl-scan.c iwlcore
This patch moves scan code to iwl-scan.c file in iwlcore module.
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/iwlwifi/Makefile | 5 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-commands.h | 24 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-core.h | 10 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-dev.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-scan.c | 896 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl4965-base.c | 881 |
6 files changed, 946 insertions, 872 deletions
diff --git a/drivers/net/wireless/iwlwifi/Makefile b/drivers/net/wireless/iwlwifi/Makefile index 184fdeec3606..1f52b92f08b5 100644 --- a/drivers/net/wireless/iwlwifi/Makefile +++ b/drivers/net/wireless/iwlwifi/Makefile | |||
@@ -1,6 +1,7 @@ | |||
1 | obj-$(CONFIG_IWLCORE) += iwlcore.o | 1 | obj-$(CONFIG_IWLCORE) += iwlcore.o |
2 | iwlcore-objs := iwl-core.o iwl-eeprom.o iwl-hcmd.o iwl-power.o iwl-calib.o | 2 | iwlcore-objs := iwl-core.o iwl-eeprom.o iwl-hcmd.o iwl-power.o |
3 | iwlcore-objs += iwl-rx.o iwl-tx.o iwl-sta.o | 3 | iwlcore-objs += iwl-rx.o iwl-tx.o iwl-sta.o iwl-calib.o |
4 | iwlcore-objs += iwl-scan.o | ||
4 | iwlcore-$(CONFIG_IWLWIFI_DEBUGFS) += iwl-debugfs.o | 5 | iwlcore-$(CONFIG_IWLWIFI_DEBUGFS) += iwl-debugfs.o |
5 | iwlcore-$(CONFIG_IWLWIFI_LEDS) += iwl-led.o | 6 | iwlcore-$(CONFIG_IWLWIFI_LEDS) += iwl-led.o |
6 | iwlcore-$(CONFIG_IWLWIFI_RFKILL) += iwl-rfkill.o | 7 | iwlcore-$(CONFIG_IWLWIFI_RFKILL) += iwl-rfkill.o |
diff --git a/drivers/net/wireless/iwlwifi/iwl-commands.h b/drivers/net/wireless/iwlwifi/iwl-commands.h index b58f79626e10..058e76415042 100644 --- a/drivers/net/wireless/iwlwifi/iwl-commands.h +++ b/drivers/net/wireless/iwlwifi/iwl-commands.h | |||
@@ -2100,7 +2100,7 @@ struct iwl4965_ct_kill_config { | |||
2100 | *****************************************************************************/ | 2100 | *****************************************************************************/ |
2101 | 2101 | ||
2102 | /** | 2102 | /** |
2103 | * struct iwl4965_scan_channel - entry in REPLY_SCAN_CMD channel table | 2103 | * struct iwl_scan_channel - entry in REPLY_SCAN_CMD channel table |
2104 | * | 2104 | * |
2105 | * One for each channel in the scan list. | 2105 | * One for each channel in the scan list. |
2106 | * Each channel can independently select: | 2106 | * Each channel can independently select: |
@@ -2110,7 +2110,7 @@ struct iwl4965_ct_kill_config { | |||
2110 | * quiet_plcp_th, good_CRC_th) | 2110 | * quiet_plcp_th, good_CRC_th) |
2111 | * | 2111 | * |
2112 | * To avoid uCode errors, make sure the following are true (see comments | 2112 | * To avoid uCode errors, make sure the following are true (see comments |
2113 | * under struct iwl4965_scan_cmd about max_out_time and quiet_time): | 2113 | * under struct iwl_scan_cmd about max_out_time and quiet_time): |
2114 | * 1) If using passive_dwell (i.e. passive_dwell != 0): | 2114 | * 1) If using passive_dwell (i.e. passive_dwell != 0): |
2115 | * active_dwell <= passive_dwell (< max_out_time if max_out_time != 0) | 2115 | * active_dwell <= passive_dwell (< max_out_time if max_out_time != 0) |
2116 | * 2) quiet_time <= active_dwell | 2116 | * 2) quiet_time <= active_dwell |
@@ -2118,7 +2118,7 @@ struct iwl4965_ct_kill_config { | |||
2118 | * passive_dwell < max_out_time | 2118 | * passive_dwell < max_out_time |
2119 | * active_dwell < max_out_time | 2119 | * active_dwell < max_out_time |
2120 | */ | 2120 | */ |
2121 | struct iwl4965_scan_channel { | 2121 | struct iwl_scan_channel { |
2122 | /* | 2122 | /* |
2123 | * type is defined as: | 2123 | * type is defined as: |
2124 | * 0:0 1 = active, 0 = passive | 2124 | * 0:0 1 = active, 0 = passive |
@@ -2134,13 +2134,13 @@ struct iwl4965_scan_channel { | |||
2134 | } __attribute__ ((packed)); | 2134 | } __attribute__ ((packed)); |
2135 | 2135 | ||
2136 | /** | 2136 | /** |
2137 | * struct iwl4965_ssid_ie - directed scan network information element | 2137 | * struct iwl_ssid_ie - directed scan network information element |
2138 | * | 2138 | * |
2139 | * Up to 4 of these may appear in REPLY_SCAN_CMD, selected by "type" field | 2139 | * Up to 4 of these may appear in REPLY_SCAN_CMD, selected by "type" field |
2140 | * in struct iwl4965_scan_channel; each channel may select different ssids from | 2140 | * in struct iwl4965_scan_channel; each channel may select different ssids from |
2141 | * among the 4 entries. SSID IEs get transmitted in reverse order of entry. | 2141 | * among the 4 entries. SSID IEs get transmitted in reverse order of entry. |
2142 | */ | 2142 | */ |
2143 | struct iwl4965_ssid_ie { | 2143 | struct iwl_ssid_ie { |
2144 | u8 id; | 2144 | u8 id; |
2145 | u8 len; | 2145 | u8 len; |
2146 | u8 ssid[32]; | 2146 | u8 ssid[32]; |
@@ -2201,9 +2201,9 @@ struct iwl4965_ssid_ie { | |||
2201 | * Driver must use separate scan commands for 2.4 vs. 5 GHz bands. | 2201 | * Driver must use separate scan commands for 2.4 vs. 5 GHz bands. |
2202 | * | 2202 | * |
2203 | * To avoid uCode errors, see timing restrictions described under | 2203 | * To avoid uCode errors, see timing restrictions described under |
2204 | * struct iwl4965_scan_channel. | 2204 | * struct iwl_scan_channel. |
2205 | */ | 2205 | */ |
2206 | struct iwl4965_scan_cmd { | 2206 | struct iwl_scan_cmd { |
2207 | __le16 len; | 2207 | __le16 len; |
2208 | u8 reserved0; | 2208 | u8 reserved0; |
2209 | u8 channel_count; /* # channels in channel list */ | 2209 | u8 channel_count; /* # channels in channel list */ |
@@ -2227,7 +2227,7 @@ struct iwl4965_scan_cmd { | |||
2227 | struct iwl_tx_cmd tx_cmd; | 2227 | struct iwl_tx_cmd tx_cmd; |
2228 | 2228 | ||
2229 | /* For directed active scans (set to all-0s otherwise) */ | 2229 | /* For directed active scans (set to all-0s otherwise) */ |
2230 | struct iwl4965_ssid_ie direct_scan[PROBE_OPTION_MAX]; | 2230 | struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX]; |
2231 | 2231 | ||
2232 | /* | 2232 | /* |
2233 | * Probe request frame, followed by channel list. | 2233 | * Probe request frame, followed by channel list. |
@@ -2255,14 +2255,14 @@ struct iwl4965_scan_cmd { | |||
2255 | /* | 2255 | /* |
2256 | * REPLY_SCAN_CMD = 0x80 (response) | 2256 | * REPLY_SCAN_CMD = 0x80 (response) |
2257 | */ | 2257 | */ |
2258 | struct iwl4965_scanreq_notification { | 2258 | struct iwl_scanreq_notification { |
2259 | __le32 status; /* 1: okay, 2: cannot fulfill request */ | 2259 | __le32 status; /* 1: okay, 2: cannot fulfill request */ |
2260 | } __attribute__ ((packed)); | 2260 | } __attribute__ ((packed)); |
2261 | 2261 | ||
2262 | /* | 2262 | /* |
2263 | * SCAN_START_NOTIFICATION = 0x82 (notification only, not a command) | 2263 | * SCAN_START_NOTIFICATION = 0x82 (notification only, not a command) |
2264 | */ | 2264 | */ |
2265 | struct iwl4965_scanstart_notification { | 2265 | struct iwl_scanstart_notification { |
2266 | __le32 tsf_low; | 2266 | __le32 tsf_low; |
2267 | __le32 tsf_high; | 2267 | __le32 tsf_high; |
2268 | __le32 beacon_timer; | 2268 | __le32 beacon_timer; |
@@ -2279,7 +2279,7 @@ struct iwl4965_scanstart_notification { | |||
2279 | /* | 2279 | /* |
2280 | * SCAN_RESULTS_NOTIFICATION = 0x83 (notification only, not a command) | 2280 | * SCAN_RESULTS_NOTIFICATION = 0x83 (notification only, not a command) |
2281 | */ | 2281 | */ |
2282 | struct iwl4965_scanresults_notification { | 2282 | struct iwl_scanresults_notification { |
2283 | u8 channel; | 2283 | u8 channel; |
2284 | u8 band; | 2284 | u8 band; |
2285 | u8 reserved[2]; | 2285 | u8 reserved[2]; |
@@ -2291,7 +2291,7 @@ struct iwl4965_scanresults_notification { | |||
2291 | /* | 2291 | /* |
2292 | * SCAN_COMPLETE_NOTIFICATION = 0x84 (notification only, not a command) | 2292 | * SCAN_COMPLETE_NOTIFICATION = 0x84 (notification only, not a command) |
2293 | */ | 2293 | */ |
2294 | struct iwl4965_scancomplete_notification { | 2294 | struct iwl_scancomplete_notification { |
2295 | u8 scanned_channels; | 2295 | u8 scanned_channels; |
2296 | u8 status; | 2296 | u8 status; |
2297 | u8 reserved; | 2297 | u8 reserved; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h index 5bae691cc492..5837577caa8b 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.h +++ b/drivers/net/wireless/iwlwifi/iwl-core.h | |||
@@ -243,6 +243,16 @@ int iwl_txq_check_empty(struct iwl_priv *priv, int sta_id, u8 tid, int txq_id); | |||
243 | ****************************************************/ | 243 | ****************************************************/ |
244 | int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force); | 244 | int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force); |
245 | 245 | ||
246 | /******************************************************************************* | ||
247 | * Scanning | ||
248 | ******************************************************************************/ | ||
249 | int iwl_scan_cancel(struct iwl_priv *priv); | ||
250 | int iwl_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms); | ||
251 | const char *iwl_escape_essid(const char *essid, u8 essid_len); | ||
252 | int iwl_scan_initiate(struct iwl_priv *priv); | ||
253 | void iwl_setup_rx_scan_handlers(struct iwl_priv *priv); | ||
254 | void iwl_setup_scan_deferred_work(struct iwl_priv *priv); | ||
255 | |||
246 | /***************************************************** | 256 | /***************************************************** |
247 | * S e n d i n g H o s t C o m m a n d s * | 257 | * S e n d i n g H o s t C o m m a n d s * |
248 | *****************************************************/ | 258 | *****************************************************/ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h index b420f64dcb7d..e5869874213c 100644 --- a/drivers/net/wireless/iwlwifi/iwl-dev.h +++ b/drivers/net/wireless/iwlwifi/iwl-dev.h | |||
@@ -976,7 +976,7 @@ struct iwl_priv { | |||
976 | int one_direct_scan; | 976 | int one_direct_scan; |
977 | u8 direct_ssid_len; | 977 | u8 direct_ssid_len; |
978 | u8 direct_ssid[IW_ESSID_MAX_SIZE]; | 978 | u8 direct_ssid[IW_ESSID_MAX_SIZE]; |
979 | struct iwl4965_scan_cmd *scan; | 979 | struct iwl_scan_cmd *scan; |
980 | 980 | ||
981 | /* spinlock */ | 981 | /* spinlock */ |
982 | spinlock_t lock; /* protect general shared data */ | 982 | spinlock_t lock; /* protect general shared data */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c new file mode 100644 index 000000000000..c2ed7c17ea1f --- /dev/null +++ b/drivers/net/wireless/iwlwifi/iwl-scan.c | |||
@@ -0,0 +1,896 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * GPL LICENSE SUMMARY | ||
4 | * | ||
5 | * Copyright(c) 2008 Intel Corporation. All rights reserved. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of version 2 of the GNU General Public License as | ||
9 | * published by the Free Software Foundation. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, but | ||
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | * General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, | ||
19 | * USA | ||
20 | * | ||
21 | * The full GNU General Public License is included in this distribution | ||
22 | * in the file called LICENSE.GPL. | ||
23 | * | ||
24 | * Contact Information: | ||
25 | * Tomas Winkler <tomas.winkler@intel.com> | ||
26 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | ||
27 | *****************************************************************************/ | ||
28 | #include <net/mac80211.h> | ||
29 | #include <linux/etherdevice.h> | ||
30 | |||
31 | #include "iwl-eeprom.h" | ||
32 | #include "iwl-dev.h" | ||
33 | #include "iwl-core.h" | ||
34 | #include "iwl-sta.h" | ||
35 | #include "iwl-io.h" | ||
36 | #include "iwl-helpers.h" | ||
37 | |||
38 | /* For active scan, listen ACTIVE_DWELL_TIME (msec) on each channel after | ||
39 | * sending probe req. This should be set long enough to hear probe responses | ||
40 | * from more than one AP. */ | ||
41 | #define IWL_ACTIVE_DWELL_TIME_24 (20) /* all times in msec */ | ||
42 | #define IWL_ACTIVE_DWELL_TIME_52 (10) | ||
43 | |||
44 | /* For faster active scanning, scan will move to the next channel if fewer than | ||
45 | * PLCP_QUIET_THRESH packets are heard on this channel within | ||
46 | * ACTIVE_QUIET_TIME after sending probe request. This shortens the dwell | ||
47 | * time if it's a quiet channel (nothing responded to our probe, and there's | ||
48 | * no other traffic). | ||
49 | * Disable "quiet" feature by setting PLCP_QUIET_THRESH to 0. */ | ||
50 | #define IWL_PLCP_QUIET_THRESH __constant_cpu_to_le16(1) /* packets */ | ||
51 | #define IWL_ACTIVE_QUIET_TIME __constant_cpu_to_le16(5) /* msec */ | ||
52 | |||
53 | /* For passive scan, listen PASSIVE_DWELL_TIME (msec) on each channel. | ||
54 | * Must be set longer than active dwell time. | ||
55 | * For the most reliable scan, set > AP beacon interval (typically 100msec). */ | ||
56 | #define IWL_PASSIVE_DWELL_TIME_24 (20) /* all times in msec */ | ||
57 | #define IWL_PASSIVE_DWELL_TIME_52 (10) | ||
58 | #define IWL_PASSIVE_DWELL_BASE (100) | ||
59 | #define IWL_CHANNEL_TUNE_TIME 5 | ||
60 | |||
61 | |||
62 | |||
63 | static int iwl_is_empty_essid(const char *essid, int essid_len) | ||
64 | { | ||
65 | /* Single white space is for Linksys APs */ | ||
66 | if (essid_len == 1 && essid[0] == ' ') | ||
67 | return 1; | ||
68 | |||
69 | /* Otherwise, if the entire essid is 0, we assume it is hidden */ | ||
70 | while (essid_len) { | ||
71 | essid_len--; | ||
72 | if (essid[essid_len] != '\0') | ||
73 | return 0; | ||
74 | } | ||
75 | |||
76 | return 1; | ||
77 | } | ||
78 | |||
79 | |||
80 | |||
81 | const char *iwl_escape_essid(const char *essid, u8 essid_len) | ||
82 | { | ||
83 | static char escaped[IW_ESSID_MAX_SIZE * 2 + 1]; | ||
84 | const char *s = essid; | ||
85 | char *d = escaped; | ||
86 | |||
87 | if (iwl_is_empty_essid(essid, essid_len)) { | ||
88 | memcpy(escaped, "<hidden>", sizeof("<hidden>")); | ||
89 | return escaped; | ||
90 | } | ||
91 | |||
92 | essid_len = min(essid_len, (u8) IW_ESSID_MAX_SIZE); | ||
93 | while (essid_len--) { | ||
94 | if (*s == '\0') { | ||
95 | *d++ = '\\'; | ||
96 | *d++ = '0'; | ||
97 | s++; | ||
98 | } else | ||
99 | *d++ = *s++; | ||
100 | } | ||
101 | *d = '\0'; | ||
102 | return escaped; | ||
103 | } | ||
104 | EXPORT_SYMBOL(iwl_escape_essid); | ||
105 | |||
106 | /** | ||
107 | * iwl_scan_cancel - Cancel any currently executing HW scan | ||
108 | * | ||
109 | * NOTE: priv->mutex is not required before calling this function | ||
110 | */ | ||
111 | int iwl_scan_cancel(struct iwl_priv *priv) | ||
112 | { | ||
113 | if (!test_bit(STATUS_SCAN_HW, &priv->status)) { | ||
114 | clear_bit(STATUS_SCANNING, &priv->status); | ||
115 | return 0; | ||
116 | } | ||
117 | |||
118 | if (test_bit(STATUS_SCANNING, &priv->status)) { | ||
119 | if (!test_bit(STATUS_SCAN_ABORTING, &priv->status)) { | ||
120 | IWL_DEBUG_SCAN("Queuing scan abort.\n"); | ||
121 | set_bit(STATUS_SCAN_ABORTING, &priv->status); | ||
122 | queue_work(priv->workqueue, &priv->abort_scan); | ||
123 | |||
124 | } else | ||
125 | IWL_DEBUG_SCAN("Scan abort already in progress.\n"); | ||
126 | |||
127 | return test_bit(STATUS_SCANNING, &priv->status); | ||
128 | } | ||
129 | |||
130 | return 0; | ||
131 | } | ||
132 | EXPORT_SYMBOL(iwl_scan_cancel); | ||
133 | /** | ||
134 | * iwl_scan_cancel_timeout - Cancel any currently executing HW scan | ||
135 | * @ms: amount of time to wait (in milliseconds) for scan to abort | ||
136 | * | ||
137 | * NOTE: priv->mutex must be held before calling this function | ||
138 | */ | ||
139 | int iwl_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms) | ||
140 | { | ||
141 | unsigned long now = jiffies; | ||
142 | int ret; | ||
143 | |||
144 | ret = iwl_scan_cancel(priv); | ||
145 | if (ret && ms) { | ||
146 | mutex_unlock(&priv->mutex); | ||
147 | while (!time_after(jiffies, now + msecs_to_jiffies(ms)) && | ||
148 | test_bit(STATUS_SCANNING, &priv->status)) | ||
149 | msleep(1); | ||
150 | mutex_lock(&priv->mutex); | ||
151 | |||
152 | return test_bit(STATUS_SCANNING, &priv->status); | ||
153 | } | ||
154 | |||
155 | return ret; | ||
156 | } | ||
157 | EXPORT_SYMBOL(iwl_scan_cancel_timeout); | ||
158 | |||
159 | static int iwl_send_scan_abort(struct iwl_priv *priv) | ||
160 | { | ||
161 | int ret = 0; | ||
162 | struct iwl_rx_packet *res; | ||
163 | struct iwl_host_cmd cmd = { | ||
164 | .id = REPLY_SCAN_ABORT_CMD, | ||
165 | .meta.flags = CMD_WANT_SKB, | ||
166 | }; | ||
167 | |||
168 | /* If there isn't a scan actively going on in the hardware | ||
169 | * then we are in between scan bands and not actually | ||
170 | * actively scanning, so don't send the abort command */ | ||
171 | if (!test_bit(STATUS_SCAN_HW, &priv->status)) { | ||
172 | clear_bit(STATUS_SCAN_ABORTING, &priv->status); | ||
173 | return 0; | ||
174 | } | ||
175 | |||
176 | ret = iwl_send_cmd_sync(priv, &cmd); | ||
177 | if (ret) { | ||
178 | clear_bit(STATUS_SCAN_ABORTING, &priv->status); | ||
179 | return ret; | ||
180 | } | ||
181 | |||
182 | res = (struct iwl_rx_packet *)cmd.meta.u.skb->data; | ||
183 | if (res->u.status != CAN_ABORT_STATUS) { | ||
184 | /* The scan abort will return 1 for success or | ||
185 | * 2 for "failure". A failure condition can be | ||
186 | * due to simply not being in an active scan which | ||
187 | * can occur if we send the scan abort before we | ||
188 | * the microcode has notified us that a scan is | ||
189 | * completed. */ | ||
190 | IWL_DEBUG_INFO("SCAN_ABORT returned %d.\n", res->u.status); | ||
191 | clear_bit(STATUS_SCAN_ABORTING, &priv->status); | ||
192 | clear_bit(STATUS_SCAN_HW, &priv->status); | ||
193 | } | ||
194 | |||
195 | dev_kfree_skb_any(cmd.meta.u.skb); | ||
196 | |||
197 | return ret; | ||
198 | } | ||
199 | |||
200 | |||
201 | /* Service response to REPLY_SCAN_CMD (0x80) */ | ||
202 | static void iwl_rx_reply_scan(struct iwl_priv *priv, | ||
203 | struct iwl_rx_mem_buffer *rxb) | ||
204 | { | ||
205 | #ifdef CONFIG_IWLWIFI_DEBUG | ||
206 | struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; | ||
207 | struct iwl_scanreq_notification *notif = | ||
208 | (struct iwl_scanreq_notification *)pkt->u.raw; | ||
209 | |||
210 | IWL_DEBUG_RX("Scan request status = 0x%x\n", notif->status); | ||
211 | #endif | ||
212 | } | ||
213 | |||
214 | /* Service SCAN_START_NOTIFICATION (0x82) */ | ||
215 | static void iwl_rx_scan_start_notif(struct iwl_priv *priv, | ||
216 | struct iwl_rx_mem_buffer *rxb) | ||
217 | { | ||
218 | struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; | ||
219 | struct iwl_scanstart_notification *notif = | ||
220 | (struct iwl_scanstart_notification *)pkt->u.raw; | ||
221 | priv->scan_start_tsf = le32_to_cpu(notif->tsf_low); | ||
222 | IWL_DEBUG_SCAN("Scan start: " | ||
223 | "%d [802.11%s] " | ||
224 | "(TSF: 0x%08X:%08X) - %d (beacon timer %u)\n", | ||
225 | notif->channel, | ||
226 | notif->band ? "bg" : "a", | ||
227 | notif->tsf_high, | ||
228 | notif->tsf_low, notif->status, notif->beacon_timer); | ||
229 | } | ||
230 | |||
231 | /* Service SCAN_RESULTS_NOTIFICATION (0x83) */ | ||
232 | static void iwl_rx_scan_results_notif(struct iwl_priv *priv, | ||
233 | struct iwl_rx_mem_buffer *rxb) | ||
234 | { | ||
235 | #ifdef CONFIG_IWLWIFI_DEBUG | ||
236 | struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; | ||
237 | struct iwl_scanresults_notification *notif = | ||
238 | (struct iwl_scanresults_notification *)pkt->u.raw; | ||
239 | |||
240 | IWL_DEBUG_SCAN("Scan ch.res: " | ||
241 | "%d [802.11%s] " | ||
242 | "(TSF: 0x%08X:%08X) - %d " | ||
243 | "elapsed=%lu usec (%dms since last)\n", | ||
244 | notif->channel, | ||
245 | notif->band ? "bg" : "a", | ||
246 | le32_to_cpu(notif->tsf_high), | ||
247 | le32_to_cpu(notif->tsf_low), | ||
248 | le32_to_cpu(notif->statistics[0]), | ||
249 | le32_to_cpu(notif->tsf_low) - priv->scan_start_tsf, | ||
250 | jiffies_to_msecs(elapsed_jiffies | ||
251 | (priv->last_scan_jiffies, jiffies))); | ||
252 | #endif | ||
253 | |||
254 | priv->last_scan_jiffies = jiffies; | ||
255 | priv->next_scan_jiffies = 0; | ||
256 | } | ||
257 | |||
258 | /* Service SCAN_COMPLETE_NOTIFICATION (0x84) */ | ||
259 | static void iwl_rx_scan_complete_notif(struct iwl_priv *priv, | ||
260 | struct iwl_rx_mem_buffer *rxb) | ||
261 | { | ||
262 | struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; | ||
263 | struct iwl_scancomplete_notification *scan_notif = (void *)pkt->u.raw; | ||
264 | |||
265 | IWL_DEBUG_SCAN("Scan complete: %d channels (TSF 0x%08X:%08X) - %d\n", | ||
266 | scan_notif->scanned_channels, | ||
267 | scan_notif->tsf_low, | ||
268 | scan_notif->tsf_high, scan_notif->status); | ||
269 | |||
270 | /* The HW is no longer scanning */ | ||
271 | clear_bit(STATUS_SCAN_HW, &priv->status); | ||
272 | |||
273 | /* The scan completion notification came in, so kill that timer... */ | ||
274 | cancel_delayed_work(&priv->scan_check); | ||
275 | |||
276 | IWL_DEBUG_INFO("Scan pass on %sGHz took %dms\n", | ||
277 | (priv->scan_bands == 2) ? "2.4" : "5.2", | ||
278 | jiffies_to_msecs(elapsed_jiffies | ||
279 | (priv->scan_pass_start, jiffies))); | ||
280 | |||
281 | /* Remove this scanned band from the list | ||
282 | * of pending bands to scan */ | ||
283 | priv->scan_bands--; | ||
284 | |||
285 | /* If a request to abort was given, or the scan did not succeed | ||
286 | * then we reset the scan state machine and terminate, | ||
287 | * re-queuing another scan if one has been requested */ | ||
288 | if (test_bit(STATUS_SCAN_ABORTING, &priv->status)) { | ||
289 | IWL_DEBUG_INFO("Aborted scan completed.\n"); | ||
290 | clear_bit(STATUS_SCAN_ABORTING, &priv->status); | ||
291 | } else { | ||
292 | /* If there are more bands on this scan pass reschedule */ | ||
293 | if (priv->scan_bands > 0) | ||
294 | goto reschedule; | ||
295 | } | ||
296 | |||
297 | priv->last_scan_jiffies = jiffies; | ||
298 | priv->next_scan_jiffies = 0; | ||
299 | IWL_DEBUG_INFO("Setting scan to off\n"); | ||
300 | |||
301 | clear_bit(STATUS_SCANNING, &priv->status); | ||
302 | |||
303 | IWL_DEBUG_INFO("Scan took %dms\n", | ||
304 | jiffies_to_msecs(elapsed_jiffies(priv->scan_start, jiffies))); | ||
305 | |||
306 | queue_work(priv->workqueue, &priv->scan_completed); | ||
307 | |||
308 | return; | ||
309 | |||
310 | reschedule: | ||
311 | priv->scan_pass_start = jiffies; | ||
312 | queue_work(priv->workqueue, &priv->request_scan); | ||
313 | } | ||
314 | |||
315 | void iwl_setup_rx_scan_handlers(struct iwl_priv *priv) | ||
316 | { | ||
317 | /* scan handlers */ | ||
318 | priv->rx_handlers[REPLY_SCAN_CMD] = iwl_rx_reply_scan; | ||
319 | priv->rx_handlers[SCAN_START_NOTIFICATION] = iwl_rx_scan_start_notif; | ||
320 | priv->rx_handlers[SCAN_RESULTS_NOTIFICATION] = | ||
321 | iwl_rx_scan_results_notif; | ||
322 | priv->rx_handlers[SCAN_COMPLETE_NOTIFICATION] = | ||
323 | iwl_rx_scan_complete_notif; | ||
324 | } | ||
325 | EXPORT_SYMBOL(iwl_setup_rx_scan_handlers); | ||
326 | |||
327 | static inline u16 iwl_get_active_dwell_time(struct iwl_priv *priv, | ||
328 | enum ieee80211_band band) | ||
329 | { | ||
330 | if (band == IEEE80211_BAND_5GHZ) | ||
331 | return IWL_ACTIVE_DWELL_TIME_52; | ||
332 | else | ||
333 | return IWL_ACTIVE_DWELL_TIME_24; | ||
334 | } | ||
335 | |||
336 | static u16 iwl_get_passive_dwell_time(struct iwl_priv *priv, | ||
337 | enum ieee80211_band band) | ||
338 | { | ||
339 | u16 active = iwl_get_active_dwell_time(priv, band); | ||
340 | u16 passive = (band != IEEE80211_BAND_5GHZ) ? | ||
341 | IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_24 : | ||
342 | IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_52; | ||
343 | |||
344 | if (iwl_is_associated(priv)) { | ||
345 | /* If we're associated, we clamp the maximum passive | ||
346 | * dwell time to be 98% of the beacon interval (minus | ||
347 | * 2 * channel tune time) */ | ||
348 | passive = priv->beacon_int; | ||
349 | if ((passive > IWL_PASSIVE_DWELL_BASE) || !passive) | ||
350 | passive = IWL_PASSIVE_DWELL_BASE; | ||
351 | passive = (passive * 98) / 100 - IWL_CHANNEL_TUNE_TIME * 2; | ||
352 | } | ||
353 | |||
354 | if (passive <= active) | ||
355 | passive = active + 1; | ||
356 | |||
357 | return passive; | ||
358 | } | ||
359 | |||
360 | static int iwl_get_channels_for_scan(struct iwl_priv *priv, | ||
361 | enum ieee80211_band band, | ||
362 | u8 is_active, u8 direct_mask, | ||
363 | struct iwl_scan_channel *scan_ch) | ||
364 | { | ||
365 | const struct ieee80211_channel *channels = NULL; | ||
366 | const struct ieee80211_supported_band *sband; | ||
367 | const struct iwl_channel_info *ch_info; | ||
368 | u16 passive_dwell = 0; | ||
369 | u16 active_dwell = 0; | ||
370 | int added, i; | ||
371 | |||
372 | sband = iwl_get_hw_mode(priv, band); | ||
373 | if (!sband) | ||
374 | return 0; | ||
375 | |||
376 | channels = sband->channels; | ||
377 | |||
378 | active_dwell = iwl_get_active_dwell_time(priv, band); | ||
379 | passive_dwell = iwl_get_passive_dwell_time(priv, band); | ||
380 | |||
381 | for (i = 0, added = 0; i < sband->n_channels; i++) { | ||
382 | if (channels[i].flags & IEEE80211_CHAN_DISABLED) | ||
383 | continue; | ||
384 | |||
385 | scan_ch->channel = | ||
386 | ieee80211_frequency_to_channel(channels[i].center_freq); | ||
387 | |||
388 | ch_info = iwl_get_channel_info(priv, band, | ||
389 | scan_ch->channel); | ||
390 | if (!is_channel_valid(ch_info)) { | ||
391 | IWL_DEBUG_SCAN("Channel %d is INVALID for this SKU.\n", | ||
392 | scan_ch->channel); | ||
393 | continue; | ||
394 | } | ||
395 | |||
396 | if (!is_active || is_channel_passive(ch_info) || | ||
397 | (channels[i].flags & IEEE80211_CHAN_PASSIVE_SCAN)) | ||
398 | scan_ch->type = 0; /* passive */ | ||
399 | else | ||
400 | scan_ch->type = 1; /* active */ | ||
401 | |||
402 | if (scan_ch->type & 1) | ||
403 | scan_ch->type |= (direct_mask << 1); | ||
404 | |||
405 | scan_ch->active_dwell = cpu_to_le16(active_dwell); | ||
406 | scan_ch->passive_dwell = cpu_to_le16(passive_dwell); | ||
407 | |||
408 | /* Set txpower levels to defaults */ | ||
409 | scan_ch->tpc.dsp_atten = 110; | ||
410 | /* scan_pwr_info->tpc.dsp_atten; */ | ||
411 | |||
412 | /*scan_pwr_info->tpc.tx_gain; */ | ||
413 | if (band == IEEE80211_BAND_5GHZ) | ||
414 | scan_ch->tpc.tx_gain = ((1 << 5) | (3 << 3)) | 3; | ||
415 | else { | ||
416 | scan_ch->tpc.tx_gain = ((1 << 5) | (5 << 3)); | ||
417 | /* NOTE: if we were doing 6Mb OFDM for scans we'd use | ||
418 | * power level: | ||
419 | * scan_ch->tpc.tx_gain = ((1 << 5) | (2 << 3)) | 3; | ||
420 | */ | ||
421 | } | ||
422 | |||
423 | IWL_DEBUG_SCAN("Scanning %d [%s %d]\n", | ||
424 | scan_ch->channel, | ||
425 | (scan_ch->type & 1) ? "ACTIVE" : "PASSIVE", | ||
426 | (scan_ch->type & 1) ? | ||
427 | active_dwell : passive_dwell); | ||
428 | |||
429 | scan_ch++; | ||
430 | added++; | ||
431 | } | ||
432 | |||
433 | IWL_DEBUG_SCAN("total channels to scan %d \n", added); | ||
434 | return added; | ||
435 | } | ||
436 | |||
437 | int iwl_scan_initiate(struct iwl_priv *priv) | ||
438 | { | ||
439 | if (priv->iw_mode == IEEE80211_IF_TYPE_AP) { | ||
440 | IWL_ERROR("APs don't scan.\n"); | ||
441 | return 0; | ||
442 | } | ||
443 | |||
444 | if (!iwl_is_ready_rf(priv)) { | ||
445 | IWL_DEBUG_SCAN("Aborting scan due to not ready.\n"); | ||
446 | return -EIO; | ||
447 | } | ||
448 | |||
449 | if (test_bit(STATUS_SCANNING, &priv->status)) { | ||
450 | IWL_DEBUG_SCAN("Scan already in progress.\n"); | ||
451 | return -EAGAIN; | ||
452 | } | ||
453 | |||
454 | if (test_bit(STATUS_SCAN_ABORTING, &priv->status)) { | ||
455 | IWL_DEBUG_SCAN("Scan request while abort pending. " | ||
456 | "Queuing.\n"); | ||
457 | return -EAGAIN; | ||
458 | } | ||
459 | |||
460 | IWL_DEBUG_INFO("Starting scan...\n"); | ||
461 | priv->scan_bands = 2; | ||
462 | set_bit(STATUS_SCANNING, &priv->status); | ||
463 | priv->scan_start = jiffies; | ||
464 | priv->scan_pass_start = priv->scan_start; | ||
465 | |||
466 | queue_work(priv->workqueue, &priv->request_scan); | ||
467 | |||
468 | return 0; | ||
469 | } | ||
470 | EXPORT_SYMBOL(iwl_scan_initiate); | ||
471 | |||
472 | #define IWL_SCAN_CHECK_WATCHDOG (7 * HZ) | ||
473 | |||
474 | static void iwl_bg_scan_check(struct work_struct *data) | ||
475 | { | ||
476 | struct iwl_priv *priv = | ||
477 | container_of(data, struct iwl_priv, scan_check.work); | ||
478 | |||
479 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | ||
480 | return; | ||
481 | |||
482 | mutex_lock(&priv->mutex); | ||
483 | if (test_bit(STATUS_SCANNING, &priv->status) || | ||
484 | test_bit(STATUS_SCAN_ABORTING, &priv->status)) { | ||
485 | IWL_DEBUG(IWL_DL_SCAN, "Scan completion watchdog resetting " | ||
486 | "adapter (%dms)\n", | ||
487 | jiffies_to_msecs(IWL_SCAN_CHECK_WATCHDOG)); | ||
488 | |||
489 | if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) | ||
490 | iwl_send_scan_abort(priv); | ||
491 | } | ||
492 | mutex_unlock(&priv->mutex); | ||
493 | } | ||
494 | /** | ||
495 | * iwl_supported_rate_to_ie - fill in the supported rate in IE field | ||
496 | * | ||
497 | * return : set the bit for each supported rate insert in ie | ||
498 | */ | ||
499 | static u16 iwl_supported_rate_to_ie(u8 *ie, u16 supported_rate, | ||
500 | u16 basic_rate, int *left) | ||
501 | { | ||
502 | u16 ret_rates = 0, bit; | ||
503 | int i; | ||
504 | u8 *cnt = ie; | ||
505 | u8 *rates = ie + 1; | ||
506 | |||
507 | for (bit = 1, i = 0; i < IWL_RATE_COUNT; i++, bit <<= 1) { | ||
508 | if (bit & supported_rate) { | ||
509 | ret_rates |= bit; | ||
510 | rates[*cnt] = iwl_rates[i].ieee | | ||
511 | ((bit & basic_rate) ? 0x80 : 0x00); | ||
512 | (*cnt)++; | ||
513 | (*left)--; | ||
514 | if ((*left <= 0) || | ||
515 | (*cnt >= IWL_SUPPORTED_RATES_IE_LEN)) | ||
516 | break; | ||
517 | } | ||
518 | } | ||
519 | |||
520 | return ret_rates; | ||
521 | } | ||
522 | |||
523 | |||
524 | static void iwl_ht_cap_to_ie(const struct ieee80211_supported_band *sband, | ||
525 | u8 *pos, int *left) | ||
526 | { | ||
527 | struct ieee80211_ht_cap *ht_cap; | ||
528 | |||
529 | if (!sband || !sband->ht_info.ht_supported) | ||
530 | return; | ||
531 | |||
532 | if (*left < sizeof(struct ieee80211_ht_cap)) | ||
533 | return; | ||
534 | |||
535 | *pos++ = sizeof(struct ieee80211_ht_cap); | ||
536 | ht_cap = (struct ieee80211_ht_cap *) pos; | ||
537 | |||
538 | ht_cap->cap_info = cpu_to_le16(sband->ht_info.cap); | ||
539 | memcpy(ht_cap->supp_mcs_set, sband->ht_info.supp_mcs_set, 16); | ||
540 | ht_cap->ampdu_params_info = | ||
541 | (sband->ht_info.ampdu_factor & IEEE80211_HT_CAP_AMPDU_FACTOR) | | ||
542 | ((sband->ht_info.ampdu_density << 2) & | ||
543 | IEEE80211_HT_CAP_AMPDU_DENSITY); | ||
544 | *left -= sizeof(struct ieee80211_ht_cap); | ||
545 | } | ||
546 | |||
547 | /** | ||
548 | * iwl_fill_probe_req - fill in all required fields and IE for probe request | ||
549 | */ | ||
550 | static u16 iwl_fill_probe_req(struct iwl_priv *priv, | ||
551 | enum ieee80211_band band, | ||
552 | struct ieee80211_mgmt *frame, | ||
553 | int left, int is_direct) | ||
554 | { | ||
555 | int len = 0; | ||
556 | u8 *pos = NULL; | ||
557 | u16 active_rates, ret_rates, cck_rates, active_rate_basic; | ||
558 | const struct ieee80211_supported_band *sband = | ||
559 | iwl_get_hw_mode(priv, band); | ||
560 | |||
561 | /* Make sure there is enough space for the probe request, | ||
562 | * two mandatory IEs and the data */ | ||
563 | left -= 24; | ||
564 | if (left < 0) | ||
565 | return 0; | ||
566 | len += 24; | ||
567 | |||
568 | frame->frame_control = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ); | ||
569 | memcpy(frame->da, iwl_bcast_addr, ETH_ALEN); | ||
570 | memcpy(frame->sa, priv->mac_addr, ETH_ALEN); | ||
571 | memcpy(frame->bssid, iwl_bcast_addr, ETH_ALEN); | ||
572 | frame->seq_ctrl = 0; | ||
573 | |||
574 | /* fill in our indirect SSID IE */ | ||
575 | /* ...next IE... */ | ||
576 | |||
577 | left -= 2; | ||
578 | if (left < 0) | ||
579 | return 0; | ||
580 | len += 2; | ||
581 | pos = &(frame->u.probe_req.variable[0]); | ||
582 | *pos++ = WLAN_EID_SSID; | ||
583 | *pos++ = 0; | ||
584 | |||
585 | /* fill in our direct SSID IE... */ | ||
586 | if (is_direct) { | ||
587 | /* ...next IE... */ | ||
588 | left -= 2 + priv->essid_len; | ||
589 | if (left < 0) | ||
590 | return 0; | ||
591 | /* ... fill it in... */ | ||
592 | *pos++ = WLAN_EID_SSID; | ||
593 | *pos++ = priv->essid_len; | ||
594 | memcpy(pos, priv->essid, priv->essid_len); | ||
595 | pos += priv->essid_len; | ||
596 | len += 2 + priv->essid_len; | ||
597 | } | ||
598 | |||
599 | /* fill in supported rate */ | ||
600 | /* ...next IE... */ | ||
601 | left -= 2; | ||
602 | if (left < 0) | ||
603 | return 0; | ||
604 | |||
605 | /* ... fill it in... */ | ||
606 | *pos++ = WLAN_EID_SUPP_RATES; | ||
607 | *pos = 0; | ||
608 | |||
609 | /* exclude 60M rate */ | ||
610 | active_rates = priv->rates_mask; | ||
611 | active_rates &= ~IWL_RATE_60M_MASK; | ||
612 | |||
613 | active_rate_basic = active_rates & IWL_BASIC_RATES_MASK; | ||
614 | |||
615 | cck_rates = IWL_CCK_RATES_MASK & active_rates; | ||
616 | ret_rates = iwl_supported_rate_to_ie(pos, cck_rates, | ||
617 | active_rate_basic, &left); | ||
618 | active_rates &= ~ret_rates; | ||
619 | |||
620 | ret_rates = iwl_supported_rate_to_ie(pos, active_rates, | ||
621 | active_rate_basic, &left); | ||
622 | active_rates &= ~ret_rates; | ||
623 | |||
624 | len += 2 + *pos; | ||
625 | pos += (*pos) + 1; | ||
626 | if (active_rates == 0) | ||
627 | goto fill_end; | ||
628 | |||
629 | /* fill in supported extended rate */ | ||
630 | /* ...next IE... */ | ||
631 | left -= 2; | ||
632 | if (left < 0) | ||
633 | return 0; | ||
634 | /* ... fill it in... */ | ||
635 | *pos++ = WLAN_EID_EXT_SUPP_RATES; | ||
636 | *pos = 0; | ||
637 | iwl_supported_rate_to_ie(pos, active_rates, | ||
638 | active_rate_basic, &left); | ||
639 | if (*pos > 0) | ||
640 | len += 2 + *pos; | ||
641 | |||
642 | fill_end: | ||
643 | /* fill in HT IE */ | ||
644 | left -= 2; | ||
645 | if (left < 0) | ||
646 | return 0; | ||
647 | |||
648 | *pos++ = WLAN_EID_HT_CAPABILITY; | ||
649 | *pos = 0; | ||
650 | |||
651 | iwl_ht_cap_to_ie(sband, pos, &left); | ||
652 | |||
653 | if (*pos > 0) | ||
654 | len += 2 + *pos; | ||
655 | return (u16)len; | ||
656 | } | ||
657 | |||
658 | static void iwl_bg_request_scan(struct work_struct *data) | ||
659 | { | ||
660 | struct iwl_priv *priv = | ||
661 | container_of(data, struct iwl_priv, request_scan); | ||
662 | struct iwl_host_cmd cmd = { | ||
663 | .id = REPLY_SCAN_CMD, | ||
664 | .len = sizeof(struct iwl_scan_cmd), | ||
665 | .meta.flags = CMD_SIZE_HUGE, | ||
666 | }; | ||
667 | struct iwl_scan_cmd *scan; | ||
668 | struct ieee80211_conf *conf = NULL; | ||
669 | u16 cmd_len; | ||
670 | enum ieee80211_band band; | ||
671 | u8 direct_mask; | ||
672 | int ret = 0; | ||
673 | |||
674 | conf = ieee80211_get_hw_conf(priv->hw); | ||
675 | |||
676 | mutex_lock(&priv->mutex); | ||
677 | |||
678 | if (!iwl_is_ready(priv)) { | ||
679 | IWL_WARNING("request scan called when driver not ready.\n"); | ||
680 | goto done; | ||
681 | } | ||
682 | |||
683 | /* Make sure the scan wasn't cancelled before this queued work | ||
684 | * was given the chance to run... */ | ||
685 | if (!test_bit(STATUS_SCANNING, &priv->status)) | ||
686 | goto done; | ||
687 | |||
688 | /* This should never be called or scheduled if there is currently | ||
689 | * a scan active in the hardware. */ | ||
690 | if (test_bit(STATUS_SCAN_HW, &priv->status)) { | ||
691 | IWL_DEBUG_INFO("Multiple concurrent scan requests in parallel. " | ||
692 | "Ignoring second request.\n"); | ||
693 | ret = -EIO; | ||
694 | goto done; | ||
695 | } | ||
696 | |||
697 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) { | ||
698 | IWL_DEBUG_SCAN("Aborting scan due to device shutdown\n"); | ||
699 | goto done; | ||
700 | } | ||
701 | |||
702 | if (test_bit(STATUS_SCAN_ABORTING, &priv->status)) { | ||
703 | IWL_DEBUG_HC("Scan request while abort pending. Queuing.\n"); | ||
704 | goto done; | ||
705 | } | ||
706 | |||
707 | if (iwl_is_rfkill(priv)) { | ||
708 | IWL_DEBUG_HC("Aborting scan due to RF Kill activation\n"); | ||
709 | goto done; | ||
710 | } | ||
711 | |||
712 | if (!test_bit(STATUS_READY, &priv->status)) { | ||
713 | IWL_DEBUG_HC("Scan request while uninitialized. Queuing.\n"); | ||
714 | goto done; | ||
715 | } | ||
716 | |||
717 | if (!priv->scan_bands) { | ||
718 | IWL_DEBUG_HC("Aborting scan due to no requested bands\n"); | ||
719 | goto done; | ||
720 | } | ||
721 | |||
722 | if (!priv->scan) { | ||
723 | priv->scan = kmalloc(sizeof(struct iwl_scan_cmd) + | ||
724 | IWL_MAX_SCAN_SIZE, GFP_KERNEL); | ||
725 | if (!priv->scan) { | ||
726 | ret = -ENOMEM; | ||
727 | goto done; | ||
728 | } | ||
729 | } | ||
730 | scan = priv->scan; | ||
731 | memset(scan, 0, sizeof(struct iwl_scan_cmd) + IWL_MAX_SCAN_SIZE); | ||
732 | |||
733 | scan->quiet_plcp_th = IWL_PLCP_QUIET_THRESH; | ||
734 | scan->quiet_time = IWL_ACTIVE_QUIET_TIME; | ||
735 | |||
736 | if (iwl_is_associated(priv)) { | ||
737 | u16 interval = 0; | ||
738 | u32 extra; | ||
739 | u32 suspend_time = 100; | ||
740 | u32 scan_suspend_time = 100; | ||
741 | unsigned long flags; | ||
742 | |||
743 | IWL_DEBUG_INFO("Scanning while associated...\n"); | ||
744 | |||
745 | spin_lock_irqsave(&priv->lock, flags); | ||
746 | interval = priv->beacon_int; | ||
747 | spin_unlock_irqrestore(&priv->lock, flags); | ||
748 | |||
749 | scan->suspend_time = 0; | ||
750 | scan->max_out_time = cpu_to_le32(200 * 1024); | ||
751 | if (!interval) | ||
752 | interval = suspend_time; | ||
753 | |||
754 | extra = (suspend_time / interval) << 22; | ||
755 | scan_suspend_time = (extra | | ||
756 | ((suspend_time % interval) * 1024)); | ||
757 | scan->suspend_time = cpu_to_le32(scan_suspend_time); | ||
758 | IWL_DEBUG_SCAN("suspend_time 0x%X beacon interval %d\n", | ||
759 | scan_suspend_time, interval); | ||
760 | } | ||
761 | |||
762 | /* We should add the ability for user to lock to PASSIVE ONLY */ | ||
763 | if (priv->one_direct_scan) { | ||
764 | IWL_DEBUG_SCAN | ||
765 | ("Kicking off one direct scan for '%s'\n", | ||
766 | iwl_escape_essid(priv->direct_ssid, | ||
767 | priv->direct_ssid_len)); | ||
768 | scan->direct_scan[0].id = WLAN_EID_SSID; | ||
769 | scan->direct_scan[0].len = priv->direct_ssid_len; | ||
770 | memcpy(scan->direct_scan[0].ssid, | ||
771 | priv->direct_ssid, priv->direct_ssid_len); | ||
772 | direct_mask = 1; | ||
773 | } else if (!iwl_is_associated(priv) && priv->essid_len) { | ||
774 | IWL_DEBUG_SCAN | ||
775 | ("Kicking off one direct scan for '%s' when not associated\n", | ||
776 | iwl_escape_essid(priv->essid, priv->essid_len)); | ||
777 | scan->direct_scan[0].id = WLAN_EID_SSID; | ||
778 | scan->direct_scan[0].len = priv->essid_len; | ||
779 | memcpy(scan->direct_scan[0].ssid, priv->essid, priv->essid_len); | ||
780 | direct_mask = 1; | ||
781 | } else { | ||
782 | IWL_DEBUG_SCAN("Kicking off one indirect scan.\n"); | ||
783 | direct_mask = 0; | ||
784 | } | ||
785 | |||
786 | scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK; | ||
787 | scan->tx_cmd.sta_id = priv->hw_params.bcast_sta_id; | ||
788 | scan->tx_cmd.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; | ||
789 | |||
790 | |||
791 | switch (priv->scan_bands) { | ||
792 | case 2: | ||
793 | scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK; | ||
794 | scan->tx_cmd.rate_n_flags = | ||
795 | iwl4965_hw_set_rate_n_flags(IWL_RATE_1M_PLCP, | ||
796 | RATE_MCS_ANT_B_MSK|RATE_MCS_CCK_MSK); | ||
797 | |||
798 | scan->good_CRC_th = 0; | ||
799 | band = IEEE80211_BAND_2GHZ; | ||
800 | break; | ||
801 | |||
802 | case 1: | ||
803 | scan->tx_cmd.rate_n_flags = | ||
804 | iwl4965_hw_set_rate_n_flags(IWL_RATE_6M_PLCP, | ||
805 | RATE_MCS_ANT_B_MSK); | ||
806 | scan->good_CRC_th = IWL_GOOD_CRC_TH; | ||
807 | band = IEEE80211_BAND_5GHZ; | ||
808 | break; | ||
809 | |||
810 | default: | ||
811 | IWL_WARNING("Invalid scan band count\n"); | ||
812 | goto done; | ||
813 | } | ||
814 | |||
815 | /* We don't build a direct scan probe request; the uCode will do | ||
816 | * that based on the direct_mask added to each channel entry */ | ||
817 | cmd_len = iwl_fill_probe_req(priv, band, | ||
818 | (struct ieee80211_mgmt *)scan->data, | ||
819 | IWL_MAX_SCAN_SIZE - sizeof(*scan), 0); | ||
820 | |||
821 | scan->tx_cmd.len = cpu_to_le16(cmd_len); | ||
822 | /* select Rx chains */ | ||
823 | |||
824 | /* Force use of chains B and C (0x6) for scan Rx. | ||
825 | * Avoid A (0x1) because of its off-channel reception on A-band. | ||
826 | * MIMO is not used here, but value is required to make uCode happy. */ | ||
827 | scan->rx_chain = RXON_RX_CHAIN_DRIVER_FORCE_MSK | | ||
828 | cpu_to_le16((0x7 << RXON_RX_CHAIN_VALID_POS) | | ||
829 | (0x6 << RXON_RX_CHAIN_FORCE_SEL_POS) | | ||
830 | (0x7 << RXON_RX_CHAIN_FORCE_MIMO_SEL_POS)); | ||
831 | |||
832 | if (priv->iw_mode == IEEE80211_IF_TYPE_MNTR) | ||
833 | scan->filter_flags = RXON_FILTER_PROMISC_MSK; | ||
834 | |||
835 | if (direct_mask) | ||
836 | scan->channel_count = | ||
837 | iwl_get_channels_for_scan( | ||
838 | priv, band, 1, /* active */ | ||
839 | direct_mask, | ||
840 | (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)]); | ||
841 | else | ||
842 | scan->channel_count = | ||
843 | iwl_get_channels_for_scan( | ||
844 | priv, band, 0, /* passive */ | ||
845 | direct_mask, | ||
846 | (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)]); | ||
847 | |||
848 | scan->filter_flags |= (RXON_FILTER_ACCEPT_GRP_MSK | | ||
849 | RXON_FILTER_BCON_AWARE_MSK); | ||
850 | cmd.len += le16_to_cpu(scan->tx_cmd.len) + | ||
851 | scan->channel_count * sizeof(struct iwl_scan_channel); | ||
852 | cmd.data = scan; | ||
853 | scan->len = cpu_to_le16(cmd.len); | ||
854 | |||
855 | set_bit(STATUS_SCAN_HW, &priv->status); | ||
856 | ret = iwl_send_cmd_sync(priv, &cmd); | ||
857 | if (ret) | ||
858 | goto done; | ||
859 | |||
860 | queue_delayed_work(priv->workqueue, &priv->scan_check, | ||
861 | IWL_SCAN_CHECK_WATCHDOG); | ||
862 | |||
863 | mutex_unlock(&priv->mutex); | ||
864 | return; | ||
865 | |||
866 | done: | ||
867 | /* inform mac80211 scan aborted */ | ||
868 | queue_work(priv->workqueue, &priv->scan_completed); | ||
869 | mutex_unlock(&priv->mutex); | ||
870 | } | ||
871 | |||
872 | static void iwl_bg_abort_scan(struct work_struct *work) | ||
873 | { | ||
874 | struct iwl_priv *priv = container_of(work, struct iwl_priv, abort_scan); | ||
875 | |||
876 | if (!iwl_is_ready(priv)) | ||
877 | return; | ||
878 | |||
879 | mutex_lock(&priv->mutex); | ||
880 | |||
881 | set_bit(STATUS_SCAN_ABORTING, &priv->status); | ||
882 | iwl_send_scan_abort(priv); | ||
883 | |||
884 | mutex_unlock(&priv->mutex); | ||
885 | } | ||
886 | |||
887 | void iwl_setup_scan_deferred_work(struct iwl_priv *priv) | ||
888 | { | ||
889 | /* FIXME: move here when resolved PENDING | ||
890 | * INIT_WORK(&priv->scan_completed, iwl_bg_scan_completed); */ | ||
891 | INIT_WORK(&priv->request_scan, iwl_bg_request_scan); | ||
892 | INIT_WORK(&priv->abort_scan, iwl_bg_abort_scan); | ||
893 | INIT_DELAYED_WORK(&priv->scan_check, iwl_bg_scan_check); | ||
894 | } | ||
895 | EXPORT_SYMBOL(iwl_setup_scan_deferred_work); | ||
896 | |||
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index af448197cc05..4183bd5ebe32 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c | |||
@@ -87,46 +87,6 @@ MODULE_VERSION(DRV_VERSION); | |||
87 | MODULE_AUTHOR(DRV_COPYRIGHT); | 87 | MODULE_AUTHOR(DRV_COPYRIGHT); |
88 | MODULE_LICENSE("GPL"); | 88 | MODULE_LICENSE("GPL"); |
89 | 89 | ||
90 | static int iwl4965_is_empty_essid(const char *essid, int essid_len) | ||
91 | { | ||
92 | /* Single white space is for Linksys APs */ | ||
93 | if (essid_len == 1 && essid[0] == ' ') | ||
94 | return 1; | ||
95 | |||
96 | /* Otherwise, if the entire essid is 0, we assume it is hidden */ | ||
97 | while (essid_len) { | ||
98 | essid_len--; | ||
99 | if (essid[essid_len] != '\0') | ||
100 | return 0; | ||
101 | } | ||
102 | |||
103 | return 1; | ||
104 | } | ||
105 | |||
106 | static const char *iwl4965_escape_essid(const char *essid, u8 essid_len) | ||
107 | { | ||
108 | static char escaped[IW_ESSID_MAX_SIZE * 2 + 1]; | ||
109 | const char *s = essid; | ||
110 | char *d = escaped; | ||
111 | |||
112 | if (iwl4965_is_empty_essid(essid, essid_len)) { | ||
113 | memcpy(escaped, "<hidden>", sizeof("<hidden>")); | ||
114 | return escaped; | ||
115 | } | ||
116 | |||
117 | essid_len = min(essid_len, (u8) IW_ESSID_MAX_SIZE); | ||
118 | while (essid_len--) { | ||
119 | if (*s == '\0') { | ||
120 | *d++ = '\\'; | ||
121 | *d++ = '0'; | ||
122 | s++; | ||
123 | } else | ||
124 | *d++ = *s++; | ||
125 | } | ||
126 | *d = '\0'; | ||
127 | return escaped; | ||
128 | } | ||
129 | |||
130 | /*************** STATION TABLE MANAGEMENT **** | 90 | /*************** STATION TABLE MANAGEMENT **** |
131 | * mac80211 should be examined to determine if sta_info is duplicating | 91 | * mac80211 should be examined to determine if sta_info is duplicating |
132 | * the functionality provided here | 92 | * the functionality provided here |
@@ -419,47 +379,6 @@ static int iwl4965_send_bt_config(struct iwl_priv *priv) | |||
419 | sizeof(struct iwl4965_bt_cmd), &bt_cmd); | 379 | sizeof(struct iwl4965_bt_cmd), &bt_cmd); |
420 | } | 380 | } |
421 | 381 | ||
422 | static int iwl4965_send_scan_abort(struct iwl_priv *priv) | ||
423 | { | ||
424 | int ret = 0; | ||
425 | struct iwl_rx_packet *res; | ||
426 | struct iwl_host_cmd cmd = { | ||
427 | .id = REPLY_SCAN_ABORT_CMD, | ||
428 | .meta.flags = CMD_WANT_SKB, | ||
429 | }; | ||
430 | |||
431 | /* If there isn't a scan actively going on in the hardware | ||
432 | * then we are in between scan bands and not actually | ||
433 | * actively scanning, so don't send the abort command */ | ||
434 | if (!test_bit(STATUS_SCAN_HW, &priv->status)) { | ||
435 | clear_bit(STATUS_SCAN_ABORTING, &priv->status); | ||
436 | return 0; | ||
437 | } | ||
438 | |||
439 | ret = iwl_send_cmd_sync(priv, &cmd); | ||
440 | if (ret) { | ||
441 | clear_bit(STATUS_SCAN_ABORTING, &priv->status); | ||
442 | return ret; | ||
443 | } | ||
444 | |||
445 | res = (struct iwl_rx_packet *)cmd.meta.u.skb->data; | ||
446 | if (res->u.status != CAN_ABORT_STATUS) { | ||
447 | /* The scan abort will return 1 for success or | ||
448 | * 2 for "failure". A failure condition can be | ||
449 | * due to simply not being in an active scan which | ||
450 | * can occur if we send the scan abort before we | ||
451 | * the microcode has notified us that a scan is | ||
452 | * completed. */ | ||
453 | IWL_DEBUG_INFO("SCAN_ABORT returned %d.\n", res->u.status); | ||
454 | clear_bit(STATUS_SCAN_ABORTING, &priv->status); | ||
455 | clear_bit(STATUS_SCAN_HW, &priv->status); | ||
456 | } | ||
457 | |||
458 | dev_kfree_skb_any(cmd.meta.u.skb); | ||
459 | |||
460 | return ret; | ||
461 | } | ||
462 | |||
463 | /* | 382 | /* |
464 | * CARD_STATE_CMD | 383 | * CARD_STATE_CMD |
465 | * | 384 | * |
@@ -605,35 +524,6 @@ static int iwl4965_send_beacon_cmd(struct iwl_priv *priv) | |||
605 | * | 524 | * |
606 | ******************************************************************************/ | 525 | ******************************************************************************/ |
607 | 526 | ||
608 | /** | ||
609 | * iwl4965_supported_rate_to_ie - fill in the supported rate in IE field | ||
610 | * | ||
611 | * return : set the bit for each supported rate insert in ie | ||
612 | */ | ||
613 | static u16 iwl4965_supported_rate_to_ie(u8 *ie, u16 supported_rate, | ||
614 | u16 basic_rate, int *left) | ||
615 | { | ||
616 | u16 ret_rates = 0, bit; | ||
617 | int i; | ||
618 | u8 *cnt = ie; | ||
619 | u8 *rates = ie + 1; | ||
620 | |||
621 | for (bit = 1, i = 0; i < IWL_RATE_COUNT; i++, bit <<= 1) { | ||
622 | if (bit & supported_rate) { | ||
623 | ret_rates |= bit; | ||
624 | rates[*cnt] = iwl_rates[i].ieee | | ||
625 | ((bit & basic_rate) ? 0x80 : 0x00); | ||
626 | (*cnt)++; | ||
627 | (*left)--; | ||
628 | if ((*left <= 0) || | ||
629 | (*cnt >= IWL_SUPPORTED_RATES_IE_LEN)) | ||
630 | break; | ||
631 | } | ||
632 | } | ||
633 | |||
634 | return ret_rates; | ||
635 | } | ||
636 | |||
637 | static void iwl4965_ht_conf(struct iwl_priv *priv, | 527 | static void iwl4965_ht_conf(struct iwl_priv *priv, |
638 | struct ieee80211_bss_conf *bss_conf) | 528 | struct ieee80211_bss_conf *bss_conf) |
639 | { | 529 | { |
@@ -686,140 +576,6 @@ static void iwl4965_ht_conf(struct iwl_priv *priv, | |||
686 | IWL_DEBUG_MAC80211("leave\n"); | 576 | IWL_DEBUG_MAC80211("leave\n"); |
687 | } | 577 | } |
688 | 578 | ||
689 | static void iwl_ht_cap_to_ie(const struct ieee80211_supported_band *sband, | ||
690 | u8 *pos, int *left) | ||
691 | { | ||
692 | struct ieee80211_ht_cap *ht_cap; | ||
693 | |||
694 | if (!sband || !sband->ht_info.ht_supported) | ||
695 | return; | ||
696 | |||
697 | if (*left < sizeof(struct ieee80211_ht_cap)) | ||
698 | return; | ||
699 | |||
700 | *pos++ = sizeof(struct ieee80211_ht_cap); | ||
701 | ht_cap = (struct ieee80211_ht_cap *) pos; | ||
702 | |||
703 | ht_cap->cap_info = cpu_to_le16(sband->ht_info.cap); | ||
704 | memcpy(ht_cap->supp_mcs_set, sband->ht_info.supp_mcs_set, 16); | ||
705 | ht_cap->ampdu_params_info = | ||
706 | (sband->ht_info.ampdu_factor & IEEE80211_HT_CAP_AMPDU_FACTOR) | | ||
707 | ((sband->ht_info.ampdu_density << 2) & | ||
708 | IEEE80211_HT_CAP_AMPDU_DENSITY); | ||
709 | *left -= sizeof(struct ieee80211_ht_cap); | ||
710 | } | ||
711 | |||
712 | /** | ||
713 | * iwl4965_fill_probe_req - fill in all required fields and IE for probe request | ||
714 | */ | ||
715 | static u16 iwl4965_fill_probe_req(struct iwl_priv *priv, | ||
716 | enum ieee80211_band band, | ||
717 | struct ieee80211_mgmt *frame, | ||
718 | int left, int is_direct) | ||
719 | { | ||
720 | int len = 0; | ||
721 | u8 *pos = NULL; | ||
722 | u16 active_rates, ret_rates, cck_rates, active_rate_basic; | ||
723 | const struct ieee80211_supported_band *sband = | ||
724 | iwl_get_hw_mode(priv, band); | ||
725 | |||
726 | /* Make sure there is enough space for the probe request, | ||
727 | * two mandatory IEs and the data */ | ||
728 | left -= 24; | ||
729 | if (left < 0) | ||
730 | return 0; | ||
731 | len += 24; | ||
732 | |||
733 | frame->frame_control = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ); | ||
734 | memcpy(frame->da, iwl_bcast_addr, ETH_ALEN); | ||
735 | memcpy(frame->sa, priv->mac_addr, ETH_ALEN); | ||
736 | memcpy(frame->bssid, iwl_bcast_addr, ETH_ALEN); | ||
737 | frame->seq_ctrl = 0; | ||
738 | |||
739 | /* fill in our indirect SSID IE */ | ||
740 | /* ...next IE... */ | ||
741 | |||
742 | left -= 2; | ||
743 | if (left < 0) | ||
744 | return 0; | ||
745 | len += 2; | ||
746 | pos = &(frame->u.probe_req.variable[0]); | ||
747 | *pos++ = WLAN_EID_SSID; | ||
748 | *pos++ = 0; | ||
749 | |||
750 | /* fill in our direct SSID IE... */ | ||
751 | if (is_direct) { | ||
752 | /* ...next IE... */ | ||
753 | left -= 2 + priv->essid_len; | ||
754 | if (left < 0) | ||
755 | return 0; | ||
756 | /* ... fill it in... */ | ||
757 | *pos++ = WLAN_EID_SSID; | ||
758 | *pos++ = priv->essid_len; | ||
759 | memcpy(pos, priv->essid, priv->essid_len); | ||
760 | pos += priv->essid_len; | ||
761 | len += 2 + priv->essid_len; | ||
762 | } | ||
763 | |||
764 | /* fill in supported rate */ | ||
765 | /* ...next IE... */ | ||
766 | left -= 2; | ||
767 | if (left < 0) | ||
768 | return 0; | ||
769 | |||
770 | /* ... fill it in... */ | ||
771 | *pos++ = WLAN_EID_SUPP_RATES; | ||
772 | *pos = 0; | ||
773 | |||
774 | /* exclude 60M rate */ | ||
775 | active_rates = priv->rates_mask; | ||
776 | active_rates &= ~IWL_RATE_60M_MASK; | ||
777 | |||
778 | active_rate_basic = active_rates & IWL_BASIC_RATES_MASK; | ||
779 | |||
780 | cck_rates = IWL_CCK_RATES_MASK & active_rates; | ||
781 | ret_rates = iwl4965_supported_rate_to_ie(pos, cck_rates, | ||
782 | active_rate_basic, &left); | ||
783 | active_rates &= ~ret_rates; | ||
784 | |||
785 | ret_rates = iwl4965_supported_rate_to_ie(pos, active_rates, | ||
786 | active_rate_basic, &left); | ||
787 | active_rates &= ~ret_rates; | ||
788 | |||
789 | len += 2 + *pos; | ||
790 | pos += (*pos) + 1; | ||
791 | if (active_rates == 0) | ||
792 | goto fill_end; | ||
793 | |||
794 | /* fill in supported extended rate */ | ||
795 | /* ...next IE... */ | ||
796 | left -= 2; | ||
797 | if (left < 0) | ||
798 | return 0; | ||
799 | /* ... fill it in... */ | ||
800 | *pos++ = WLAN_EID_EXT_SUPP_RATES; | ||
801 | *pos = 0; | ||
802 | iwl4965_supported_rate_to_ie(pos, active_rates, | ||
803 | active_rate_basic, &left); | ||
804 | if (*pos > 0) | ||
805 | len += 2 + *pos; | ||
806 | |||
807 | fill_end: | ||
808 | /* fill in HT IE */ | ||
809 | left -= 2; | ||
810 | if (left < 0) | ||
811 | return 0; | ||
812 | |||
813 | *pos++ = WLAN_EID_HT_CAPABILITY; | ||
814 | *pos = 0; | ||
815 | |||
816 | iwl_ht_cap_to_ie(sband, pos, &left); | ||
817 | |||
818 | if (*pos > 0) | ||
819 | len += 2 + *pos; | ||
820 | return (u16)len; | ||
821 | } | ||
822 | |||
823 | /* | 579 | /* |
824 | * QoS support | 580 | * QoS support |
825 | */ | 581 | */ |
@@ -897,60 +653,6 @@ int iwl4965_is_network_packet(struct iwl_priv *priv, struct ieee80211_hdr *heade | |||
897 | return 1; | 653 | return 1; |
898 | } | 654 | } |
899 | 655 | ||
900 | |||
901 | |||
902 | /** | ||
903 | * iwl4965_scan_cancel - Cancel any currently executing HW scan | ||
904 | * | ||
905 | * NOTE: priv->mutex is not required before calling this function | ||
906 | */ | ||
907 | static int iwl4965_scan_cancel(struct iwl_priv *priv) | ||
908 | { | ||
909 | if (!test_bit(STATUS_SCAN_HW, &priv->status)) { | ||
910 | clear_bit(STATUS_SCANNING, &priv->status); | ||
911 | return 0; | ||
912 | } | ||
913 | |||
914 | if (test_bit(STATUS_SCANNING, &priv->status)) { | ||
915 | if (!test_bit(STATUS_SCAN_ABORTING, &priv->status)) { | ||
916 | IWL_DEBUG_SCAN("Queuing scan abort.\n"); | ||
917 | set_bit(STATUS_SCAN_ABORTING, &priv->status); | ||
918 | queue_work(priv->workqueue, &priv->abort_scan); | ||
919 | |||
920 | } else | ||
921 | IWL_DEBUG_SCAN("Scan abort already in progress.\n"); | ||
922 | |||
923 | return test_bit(STATUS_SCANNING, &priv->status); | ||
924 | } | ||
925 | |||
926 | return 0; | ||
927 | } | ||
928 | |||
929 | /** | ||
930 | * iwl4965_scan_cancel_timeout - Cancel any currently executing HW scan | ||
931 | * @ms: amount of time to wait (in milliseconds) for scan to abort | ||
932 | * | ||
933 | * NOTE: priv->mutex must be held before calling this function | ||
934 | */ | ||
935 | static int iwl4965_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms) | ||
936 | { | ||
937 | unsigned long now = jiffies; | ||
938 | int ret; | ||
939 | |||
940 | ret = iwl4965_scan_cancel(priv); | ||
941 | if (ret && ms) { | ||
942 | mutex_unlock(&priv->mutex); | ||
943 | while (!time_after(jiffies, now + msecs_to_jiffies(ms)) && | ||
944 | test_bit(STATUS_SCANNING, &priv->status)) | ||
945 | msleep(1); | ||
946 | mutex_lock(&priv->mutex); | ||
947 | |||
948 | return test_bit(STATUS_SCANNING, &priv->status); | ||
949 | } | ||
950 | |||
951 | return ret; | ||
952 | } | ||
953 | |||
954 | static void iwl4965_sequence_reset(struct iwl_priv *priv) | 656 | static void iwl4965_sequence_reset(struct iwl_priv *priv) |
955 | { | 657 | { |
956 | /* Reset ieee stats */ | 658 | /* Reset ieee stats */ |
@@ -962,7 +664,7 @@ static void iwl4965_sequence_reset(struct iwl_priv *priv) | |||
962 | priv->last_frag_num = -1; | 664 | priv->last_frag_num = -1; |
963 | priv->last_packet_time = 0; | 665 | priv->last_packet_time = 0; |
964 | 666 | ||
965 | iwl4965_scan_cancel(priv); | 667 | iwl_scan_cancel(priv); |
966 | } | 668 | } |
967 | 669 | ||
968 | #define MAX_UCODE_BEACON_INTERVAL 4096 | 670 | #define MAX_UCODE_BEACON_INTERVAL 4096 |
@@ -1037,41 +739,6 @@ static void iwl4965_setup_rxon_timing(struct iwl_priv *priv) | |||
1037 | le16_to_cpu(priv->rxon_timing.atim_window)); | 739 | le16_to_cpu(priv->rxon_timing.atim_window)); |
1038 | } | 740 | } |
1039 | 741 | ||
1040 | static int iwl4965_scan_initiate(struct iwl_priv *priv) | ||
1041 | { | ||
1042 | if (priv->iw_mode == IEEE80211_IF_TYPE_AP) { | ||
1043 | IWL_ERROR("APs don't scan.\n"); | ||
1044 | return 0; | ||
1045 | } | ||
1046 | |||
1047 | if (!iwl_is_ready_rf(priv)) { | ||
1048 | IWL_DEBUG_SCAN("Aborting scan due to not ready.\n"); | ||
1049 | return -EIO; | ||
1050 | } | ||
1051 | |||
1052 | if (test_bit(STATUS_SCANNING, &priv->status)) { | ||
1053 | IWL_DEBUG_SCAN("Scan already in progress.\n"); | ||
1054 | return -EAGAIN; | ||
1055 | } | ||
1056 | |||
1057 | if (test_bit(STATUS_SCAN_ABORTING, &priv->status)) { | ||
1058 | IWL_DEBUG_SCAN("Scan request while abort pending. " | ||
1059 | "Queuing.\n"); | ||
1060 | return -EAGAIN; | ||
1061 | } | ||
1062 | |||
1063 | IWL_DEBUG_INFO("Starting scan...\n"); | ||
1064 | priv->scan_bands = 2; | ||
1065 | set_bit(STATUS_SCANNING, &priv->status); | ||
1066 | priv->scan_start = jiffies; | ||
1067 | priv->scan_pass_start = priv->scan_start; | ||
1068 | |||
1069 | queue_work(priv->workqueue, &priv->request_scan); | ||
1070 | |||
1071 | return 0; | ||
1072 | } | ||
1073 | |||
1074 | |||
1075 | static void iwl_set_flags_for_band(struct iwl_priv *priv, | 742 | static void iwl_set_flags_for_band(struct iwl_priv *priv, |
1076 | enum ieee80211_band band) | 743 | enum ieee80211_band band) |
1077 | { | 744 | { |
@@ -1191,7 +858,7 @@ static int iwl4965_set_mode(struct iwl_priv *priv, int mode) | |||
1191 | return -EAGAIN; | 858 | return -EAGAIN; |
1192 | 859 | ||
1193 | cancel_delayed_work(&priv->scan_check); | 860 | cancel_delayed_work(&priv->scan_check); |
1194 | if (iwl4965_scan_cancel_timeout(priv, 100)) { | 861 | if (iwl_scan_cancel_timeout(priv, 100)) { |
1195 | IWL_WARNING("Aborted scan still in progress after 100ms\n"); | 862 | IWL_WARNING("Aborted scan still in progress after 100ms\n"); |
1196 | IWL_DEBUG_MAC80211("leaving - scan abort failed.\n"); | 863 | IWL_DEBUG_MAC80211("leaving - scan abort failed.\n"); |
1197 | return -EAGAIN; | 864 | return -EAGAIN; |
@@ -1260,7 +927,7 @@ int iwl4965_radio_kill_sw(struct iwl_priv *priv, int disable_radio) | |||
1260 | disable_radio ? "OFF" : "ON"); | 927 | disable_radio ? "OFF" : "ON"); |
1261 | 928 | ||
1262 | if (disable_radio) { | 929 | if (disable_radio) { |
1263 | iwl4965_scan_cancel(priv); | 930 | iwl_scan_cancel(priv); |
1264 | /* FIXME: This is a workaround for AP */ | 931 | /* FIXME: This is a workaround for AP */ |
1265 | if (priv->iw_mode != IEEE80211_IF_TYPE_AP) { | 932 | if (priv->iw_mode != IEEE80211_IF_TYPE_AP) { |
1266 | spin_lock_irqsave(&priv->lock, flags); | 933 | spin_lock_irqsave(&priv->lock, flags); |
@@ -1680,118 +1347,6 @@ static void iwl4965_rx_beacon_notif(struct iwl_priv *priv, | |||
1680 | queue_work(priv->workqueue, &priv->beacon_update); | 1347 | queue_work(priv->workqueue, &priv->beacon_update); |
1681 | } | 1348 | } |
1682 | 1349 | ||
1683 | /* Service response to REPLY_SCAN_CMD (0x80) */ | ||
1684 | static void iwl4965_rx_reply_scan(struct iwl_priv *priv, | ||
1685 | struct iwl_rx_mem_buffer *rxb) | ||
1686 | { | ||
1687 | #ifdef CONFIG_IWLWIFI_DEBUG | ||
1688 | struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; | ||
1689 | struct iwl4965_scanreq_notification *notif = | ||
1690 | (struct iwl4965_scanreq_notification *)pkt->u.raw; | ||
1691 | |||
1692 | IWL_DEBUG_RX("Scan request status = 0x%x\n", notif->status); | ||
1693 | #endif | ||
1694 | } | ||
1695 | |||
1696 | /* Service SCAN_START_NOTIFICATION (0x82) */ | ||
1697 | static void iwl4965_rx_scan_start_notif(struct iwl_priv *priv, | ||
1698 | struct iwl_rx_mem_buffer *rxb) | ||
1699 | { | ||
1700 | struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; | ||
1701 | struct iwl4965_scanstart_notification *notif = | ||
1702 | (struct iwl4965_scanstart_notification *)pkt->u.raw; | ||
1703 | priv->scan_start_tsf = le32_to_cpu(notif->tsf_low); | ||
1704 | IWL_DEBUG_SCAN("Scan start: " | ||
1705 | "%d [802.11%s] " | ||
1706 | "(TSF: 0x%08X:%08X) - %d (beacon timer %u)\n", | ||
1707 | notif->channel, | ||
1708 | notif->band ? "bg" : "a", | ||
1709 | notif->tsf_high, | ||
1710 | notif->tsf_low, notif->status, notif->beacon_timer); | ||
1711 | } | ||
1712 | |||
1713 | /* Service SCAN_RESULTS_NOTIFICATION (0x83) */ | ||
1714 | static void iwl4965_rx_scan_results_notif(struct iwl_priv *priv, | ||
1715 | struct iwl_rx_mem_buffer *rxb) | ||
1716 | { | ||
1717 | struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; | ||
1718 | struct iwl4965_scanresults_notification *notif = | ||
1719 | (struct iwl4965_scanresults_notification *)pkt->u.raw; | ||
1720 | |||
1721 | IWL_DEBUG_SCAN("Scan ch.res: " | ||
1722 | "%d [802.11%s] " | ||
1723 | "(TSF: 0x%08X:%08X) - %d " | ||
1724 | "elapsed=%lu usec (%dms since last)\n", | ||
1725 | notif->channel, | ||
1726 | notif->band ? "bg" : "a", | ||
1727 | le32_to_cpu(notif->tsf_high), | ||
1728 | le32_to_cpu(notif->tsf_low), | ||
1729 | le32_to_cpu(notif->statistics[0]), | ||
1730 | le32_to_cpu(notif->tsf_low) - priv->scan_start_tsf, | ||
1731 | jiffies_to_msecs(elapsed_jiffies | ||
1732 | (priv->last_scan_jiffies, jiffies))); | ||
1733 | |||
1734 | priv->last_scan_jiffies = jiffies; | ||
1735 | priv->next_scan_jiffies = 0; | ||
1736 | } | ||
1737 | |||
1738 | /* Service SCAN_COMPLETE_NOTIFICATION (0x84) */ | ||
1739 | static void iwl4965_rx_scan_complete_notif(struct iwl_priv *priv, | ||
1740 | struct iwl_rx_mem_buffer *rxb) | ||
1741 | { | ||
1742 | struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; | ||
1743 | struct iwl4965_scancomplete_notification *scan_notif = (void *)pkt->u.raw; | ||
1744 | |||
1745 | IWL_DEBUG_SCAN("Scan complete: %d channels (TSF 0x%08X:%08X) - %d\n", | ||
1746 | scan_notif->scanned_channels, | ||
1747 | scan_notif->tsf_low, | ||
1748 | scan_notif->tsf_high, scan_notif->status); | ||
1749 | |||
1750 | /* The HW is no longer scanning */ | ||
1751 | clear_bit(STATUS_SCAN_HW, &priv->status); | ||
1752 | |||
1753 | /* The scan completion notification came in, so kill that timer... */ | ||
1754 | cancel_delayed_work(&priv->scan_check); | ||
1755 | |||
1756 | IWL_DEBUG_INFO("Scan pass on %sGHz took %dms\n", | ||
1757 | (priv->scan_bands == 2) ? "2.4" : "5.2", | ||
1758 | jiffies_to_msecs(elapsed_jiffies | ||
1759 | (priv->scan_pass_start, jiffies))); | ||
1760 | |||
1761 | /* Remove this scanned band from the list | ||
1762 | * of pending bands to scan */ | ||
1763 | priv->scan_bands--; | ||
1764 | |||
1765 | /* If a request to abort was given, or the scan did not succeed | ||
1766 | * then we reset the scan state machine and terminate, | ||
1767 | * re-queuing another scan if one has been requested */ | ||
1768 | if (test_bit(STATUS_SCAN_ABORTING, &priv->status)) { | ||
1769 | IWL_DEBUG_INFO("Aborted scan completed.\n"); | ||
1770 | clear_bit(STATUS_SCAN_ABORTING, &priv->status); | ||
1771 | } else { | ||
1772 | /* If there are more bands on this scan pass reschedule */ | ||
1773 | if (priv->scan_bands > 0) | ||
1774 | goto reschedule; | ||
1775 | } | ||
1776 | |||
1777 | priv->last_scan_jiffies = jiffies; | ||
1778 | priv->next_scan_jiffies = 0; | ||
1779 | IWL_DEBUG_INFO("Setting scan to off\n"); | ||
1780 | |||
1781 | clear_bit(STATUS_SCANNING, &priv->status); | ||
1782 | |||
1783 | IWL_DEBUG_INFO("Scan took %dms\n", | ||
1784 | jiffies_to_msecs(elapsed_jiffies(priv->scan_start, jiffies))); | ||
1785 | |||
1786 | queue_work(priv->workqueue, &priv->scan_completed); | ||
1787 | |||
1788 | return; | ||
1789 | |||
1790 | reschedule: | ||
1791 | priv->scan_pass_start = jiffies; | ||
1792 | queue_work(priv->workqueue, &priv->request_scan); | ||
1793 | } | ||
1794 | |||
1795 | /* Handle notification from uCode that card's power state is changing | 1350 | /* Handle notification from uCode that card's power state is changing |
1796 | * due to software, hardware, or critical temperature RFKILL */ | 1351 | * due to software, hardware, or critical temperature RFKILL */ |
1797 | static void iwl4965_rx_card_state_notif(struct iwl_priv *priv, | 1352 | static void iwl4965_rx_card_state_notif(struct iwl_priv *priv, |
@@ -1852,7 +1407,7 @@ static void iwl4965_rx_card_state_notif(struct iwl_priv *priv, | |||
1852 | clear_bit(STATUS_RF_KILL_SW, &priv->status); | 1407 | clear_bit(STATUS_RF_KILL_SW, &priv->status); |
1853 | 1408 | ||
1854 | if (!(flags & RXON_CARD_DISABLED)) | 1409 | if (!(flags & RXON_CARD_DISABLED)) |
1855 | iwl4965_scan_cancel(priv); | 1410 | iwl_scan_cancel(priv); |
1856 | 1411 | ||
1857 | if ((test_bit(STATUS_RF_KILL_HW, &status) != | 1412 | if ((test_bit(STATUS_RF_KILL_HW, &status) != |
1858 | test_bit(STATUS_RF_KILL_HW, &priv->status)) || | 1413 | test_bit(STATUS_RF_KILL_HW, &priv->status)) || |
@@ -1902,13 +1457,9 @@ static void iwl4965_setup_rx_handlers(struct iwl_priv *priv) | |||
1902 | */ | 1457 | */ |
1903 | priv->rx_handlers[REPLY_STATISTICS_CMD] = iwl4965_hw_rx_statistics; | 1458 | priv->rx_handlers[REPLY_STATISTICS_CMD] = iwl4965_hw_rx_statistics; |
1904 | priv->rx_handlers[STATISTICS_NOTIFICATION] = iwl4965_hw_rx_statistics; | 1459 | priv->rx_handlers[STATISTICS_NOTIFICATION] = iwl4965_hw_rx_statistics; |
1905 | /* scan handlers */ | 1460 | |
1906 | priv->rx_handlers[REPLY_SCAN_CMD] = iwl4965_rx_reply_scan; | 1461 | iwl_setup_rx_scan_handlers(priv); |
1907 | priv->rx_handlers[SCAN_START_NOTIFICATION] = iwl4965_rx_scan_start_notif; | 1462 | |
1908 | priv->rx_handlers[SCAN_RESULTS_NOTIFICATION] = | ||
1909 | iwl4965_rx_scan_results_notif; | ||
1910 | priv->rx_handlers[SCAN_COMPLETE_NOTIFICATION] = | ||
1911 | iwl4965_rx_scan_complete_notif; | ||
1912 | /* status change handler */ | 1463 | /* status change handler */ |
1913 | priv->rx_handlers[CARD_STATE_NOTIFICATION] = iwl4965_rx_card_state_notif; | 1464 | priv->rx_handlers[CARD_STATE_NOTIFICATION] = iwl4965_rx_card_state_notif; |
1914 | 1465 | ||
@@ -2456,138 +2007,6 @@ static irqreturn_t iwl4965_isr(int irq, void *data) | |||
2456 | return IRQ_NONE; | 2007 | return IRQ_NONE; |
2457 | } | 2008 | } |
2458 | 2009 | ||
2459 | /* For active scan, listen ACTIVE_DWELL_TIME (msec) on each channel after | ||
2460 | * sending probe req. This should be set long enough to hear probe responses | ||
2461 | * from more than one AP. */ | ||
2462 | #define IWL_ACTIVE_DWELL_TIME_24 (20) /* all times in msec */ | ||
2463 | #define IWL_ACTIVE_DWELL_TIME_52 (10) | ||
2464 | |||
2465 | /* For faster active scanning, scan will move to the next channel if fewer than | ||
2466 | * PLCP_QUIET_THRESH packets are heard on this channel within | ||
2467 | * ACTIVE_QUIET_TIME after sending probe request. This shortens the dwell | ||
2468 | * time if it's a quiet channel (nothing responded to our probe, and there's | ||
2469 | * no other traffic). | ||
2470 | * Disable "quiet" feature by setting PLCP_QUIET_THRESH to 0. */ | ||
2471 | #define IWL_PLCP_QUIET_THRESH __constant_cpu_to_le16(1) /* packets */ | ||
2472 | #define IWL_ACTIVE_QUIET_TIME __constant_cpu_to_le16(5) /* msec */ | ||
2473 | |||
2474 | /* For passive scan, listen PASSIVE_DWELL_TIME (msec) on each channel. | ||
2475 | * Must be set longer than active dwell time. | ||
2476 | * For the most reliable scan, set > AP beacon interval (typically 100msec). */ | ||
2477 | #define IWL_PASSIVE_DWELL_TIME_24 (20) /* all times in msec */ | ||
2478 | #define IWL_PASSIVE_DWELL_TIME_52 (10) | ||
2479 | #define IWL_PASSIVE_DWELL_BASE (100) | ||
2480 | #define IWL_CHANNEL_TUNE_TIME 5 | ||
2481 | |||
2482 | static inline u16 iwl4965_get_active_dwell_time(struct iwl_priv *priv, | ||
2483 | enum ieee80211_band band) | ||
2484 | { | ||
2485 | if (band == IEEE80211_BAND_5GHZ) | ||
2486 | return IWL_ACTIVE_DWELL_TIME_52; | ||
2487 | else | ||
2488 | return IWL_ACTIVE_DWELL_TIME_24; | ||
2489 | } | ||
2490 | |||
2491 | static u16 iwl4965_get_passive_dwell_time(struct iwl_priv *priv, | ||
2492 | enum ieee80211_band band) | ||
2493 | { | ||
2494 | u16 active = iwl4965_get_active_dwell_time(priv, band); | ||
2495 | u16 passive = (band != IEEE80211_BAND_5GHZ) ? | ||
2496 | IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_24 : | ||
2497 | IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_52; | ||
2498 | |||
2499 | if (iwl_is_associated(priv)) { | ||
2500 | /* If we're associated, we clamp the maximum passive | ||
2501 | * dwell time to be 98% of the beacon interval (minus | ||
2502 | * 2 * channel tune time) */ | ||
2503 | passive = priv->beacon_int; | ||
2504 | if ((passive > IWL_PASSIVE_DWELL_BASE) || !passive) | ||
2505 | passive = IWL_PASSIVE_DWELL_BASE; | ||
2506 | passive = (passive * 98) / 100 - IWL_CHANNEL_TUNE_TIME * 2; | ||
2507 | } | ||
2508 | |||
2509 | if (passive <= active) | ||
2510 | passive = active + 1; | ||
2511 | |||
2512 | return passive; | ||
2513 | } | ||
2514 | |||
2515 | static int iwl4965_get_channels_for_scan(struct iwl_priv *priv, | ||
2516 | enum ieee80211_band band, | ||
2517 | u8 is_active, u8 direct_mask, | ||
2518 | struct iwl4965_scan_channel *scan_ch) | ||
2519 | { | ||
2520 | const struct ieee80211_channel *channels = NULL; | ||
2521 | const struct ieee80211_supported_band *sband; | ||
2522 | const struct iwl_channel_info *ch_info; | ||
2523 | u16 passive_dwell = 0; | ||
2524 | u16 active_dwell = 0; | ||
2525 | int added, i; | ||
2526 | |||
2527 | sband = iwl_get_hw_mode(priv, band); | ||
2528 | if (!sband) | ||
2529 | return 0; | ||
2530 | |||
2531 | channels = sband->channels; | ||
2532 | |||
2533 | active_dwell = iwl4965_get_active_dwell_time(priv, band); | ||
2534 | passive_dwell = iwl4965_get_passive_dwell_time(priv, band); | ||
2535 | |||
2536 | for (i = 0, added = 0; i < sband->n_channels; i++) { | ||
2537 | if (channels[i].flags & IEEE80211_CHAN_DISABLED) | ||
2538 | continue; | ||
2539 | |||
2540 | scan_ch->channel = ieee80211_frequency_to_channel(channels[i].center_freq); | ||
2541 | |||
2542 | ch_info = iwl_get_channel_info(priv, band, | ||
2543 | scan_ch->channel); | ||
2544 | if (!is_channel_valid(ch_info)) { | ||
2545 | IWL_DEBUG_SCAN("Channel %d is INVALID for this SKU.\n", | ||
2546 | scan_ch->channel); | ||
2547 | continue; | ||
2548 | } | ||
2549 | |||
2550 | if (!is_active || is_channel_passive(ch_info) || | ||
2551 | (channels[i].flags & IEEE80211_CHAN_PASSIVE_SCAN)) | ||
2552 | scan_ch->type = 0; /* passive */ | ||
2553 | else | ||
2554 | scan_ch->type = 1; /* active */ | ||
2555 | |||
2556 | if (scan_ch->type & 1) | ||
2557 | scan_ch->type |= (direct_mask << 1); | ||
2558 | |||
2559 | scan_ch->active_dwell = cpu_to_le16(active_dwell); | ||
2560 | scan_ch->passive_dwell = cpu_to_le16(passive_dwell); | ||
2561 | |||
2562 | /* Set txpower levels to defaults */ | ||
2563 | scan_ch->tpc.dsp_atten = 110; | ||
2564 | /* scan_pwr_info->tpc.dsp_atten; */ | ||
2565 | |||
2566 | /*scan_pwr_info->tpc.tx_gain; */ | ||
2567 | if (band == IEEE80211_BAND_5GHZ) | ||
2568 | scan_ch->tpc.tx_gain = ((1 << 5) | (3 << 3)) | 3; | ||
2569 | else { | ||
2570 | scan_ch->tpc.tx_gain = ((1 << 5) | (5 << 3)); | ||
2571 | /* NOTE: if we were doing 6Mb OFDM for scans we'd use | ||
2572 | * power level: | ||
2573 | * scan_ch->tpc.tx_gain = ((1 << 5) | (2 << 3)) | 3; | ||
2574 | */ | ||
2575 | } | ||
2576 | |||
2577 | IWL_DEBUG_SCAN("Scanning %d [%s %d]\n", | ||
2578 | scan_ch->channel, | ||
2579 | (scan_ch->type & 1) ? "ACTIVE" : "PASSIVE", | ||
2580 | (scan_ch->type & 1) ? | ||
2581 | active_dwell : passive_dwell); | ||
2582 | |||
2583 | scan_ch++; | ||
2584 | added++; | ||
2585 | } | ||
2586 | |||
2587 | IWL_DEBUG_SCAN("total channels to scan %d \n", added); | ||
2588 | return added; | ||
2589 | } | ||
2590 | |||
2591 | /****************************************************************************** | 2010 | /****************************************************************************** |
2592 | * | 2011 | * |
2593 | * uCode download functions | 2012 | * uCode download functions |
@@ -3200,243 +2619,6 @@ static void iwl4965_bg_set_monitor(struct work_struct *work) | |||
3200 | mutex_unlock(&priv->mutex); | 2619 | mutex_unlock(&priv->mutex); |
3201 | } | 2620 | } |
3202 | 2621 | ||
3203 | #define IWL_SCAN_CHECK_WATCHDOG (7 * HZ) | ||
3204 | |||
3205 | static void iwl4965_bg_scan_check(struct work_struct *data) | ||
3206 | { | ||
3207 | struct iwl_priv *priv = | ||
3208 | container_of(data, struct iwl_priv, scan_check.work); | ||
3209 | |||
3210 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | ||
3211 | return; | ||
3212 | |||
3213 | mutex_lock(&priv->mutex); | ||
3214 | if (test_bit(STATUS_SCANNING, &priv->status) || | ||
3215 | test_bit(STATUS_SCAN_ABORTING, &priv->status)) { | ||
3216 | IWL_DEBUG(IWL_DL_SCAN, "Scan completion watchdog resetting " | ||
3217 | "adapter (%dms)\n", | ||
3218 | jiffies_to_msecs(IWL_SCAN_CHECK_WATCHDOG)); | ||
3219 | |||
3220 | if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) | ||
3221 | iwl4965_send_scan_abort(priv); | ||
3222 | } | ||
3223 | mutex_unlock(&priv->mutex); | ||
3224 | } | ||
3225 | |||
3226 | static void iwl4965_bg_request_scan(struct work_struct *data) | ||
3227 | { | ||
3228 | struct iwl_priv *priv = | ||
3229 | container_of(data, struct iwl_priv, request_scan); | ||
3230 | struct iwl_host_cmd cmd = { | ||
3231 | .id = REPLY_SCAN_CMD, | ||
3232 | .len = sizeof(struct iwl4965_scan_cmd), | ||
3233 | .meta.flags = CMD_SIZE_HUGE, | ||
3234 | }; | ||
3235 | struct iwl4965_scan_cmd *scan; | ||
3236 | struct ieee80211_conf *conf = NULL; | ||
3237 | u16 cmd_len; | ||
3238 | enum ieee80211_band band; | ||
3239 | u8 direct_mask; | ||
3240 | int ret = 0; | ||
3241 | |||
3242 | conf = ieee80211_get_hw_conf(priv->hw); | ||
3243 | |||
3244 | mutex_lock(&priv->mutex); | ||
3245 | |||
3246 | if (!iwl_is_ready(priv)) { | ||
3247 | IWL_WARNING("request scan called when driver not ready.\n"); | ||
3248 | goto done; | ||
3249 | } | ||
3250 | |||
3251 | /* Make sure the scan wasn't cancelled before this queued work | ||
3252 | * was given the chance to run... */ | ||
3253 | if (!test_bit(STATUS_SCANNING, &priv->status)) | ||
3254 | goto done; | ||
3255 | |||
3256 | /* This should never be called or scheduled if there is currently | ||
3257 | * a scan active in the hardware. */ | ||
3258 | if (test_bit(STATUS_SCAN_HW, &priv->status)) { | ||
3259 | IWL_DEBUG_INFO("Multiple concurrent scan requests in parallel. " | ||
3260 | "Ignoring second request.\n"); | ||
3261 | ret = -EIO; | ||
3262 | goto done; | ||
3263 | } | ||
3264 | |||
3265 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) { | ||
3266 | IWL_DEBUG_SCAN("Aborting scan due to device shutdown\n"); | ||
3267 | goto done; | ||
3268 | } | ||
3269 | |||
3270 | if (test_bit(STATUS_SCAN_ABORTING, &priv->status)) { | ||
3271 | IWL_DEBUG_HC("Scan request while abort pending. Queuing.\n"); | ||
3272 | goto done; | ||
3273 | } | ||
3274 | |||
3275 | if (iwl_is_rfkill(priv)) { | ||
3276 | IWL_DEBUG_HC("Aborting scan due to RF Kill activation\n"); | ||
3277 | goto done; | ||
3278 | } | ||
3279 | |||
3280 | if (!test_bit(STATUS_READY, &priv->status)) { | ||
3281 | IWL_DEBUG_HC("Scan request while uninitialized. Queuing.\n"); | ||
3282 | goto done; | ||
3283 | } | ||
3284 | |||
3285 | if (!priv->scan_bands) { | ||
3286 | IWL_DEBUG_HC("Aborting scan due to no requested bands\n"); | ||
3287 | goto done; | ||
3288 | } | ||
3289 | |||
3290 | if (!priv->scan) { | ||
3291 | priv->scan = kmalloc(sizeof(struct iwl4965_scan_cmd) + | ||
3292 | IWL_MAX_SCAN_SIZE, GFP_KERNEL); | ||
3293 | if (!priv->scan) { | ||
3294 | ret = -ENOMEM; | ||
3295 | goto done; | ||
3296 | } | ||
3297 | } | ||
3298 | scan = priv->scan; | ||
3299 | memset(scan, 0, sizeof(struct iwl4965_scan_cmd) + IWL_MAX_SCAN_SIZE); | ||
3300 | |||
3301 | scan->quiet_plcp_th = IWL_PLCP_QUIET_THRESH; | ||
3302 | scan->quiet_time = IWL_ACTIVE_QUIET_TIME; | ||
3303 | |||
3304 | if (iwl_is_associated(priv)) { | ||
3305 | u16 interval = 0; | ||
3306 | u32 extra; | ||
3307 | u32 suspend_time = 100; | ||
3308 | u32 scan_suspend_time = 100; | ||
3309 | unsigned long flags; | ||
3310 | |||
3311 | IWL_DEBUG_INFO("Scanning while associated...\n"); | ||
3312 | |||
3313 | spin_lock_irqsave(&priv->lock, flags); | ||
3314 | interval = priv->beacon_int; | ||
3315 | spin_unlock_irqrestore(&priv->lock, flags); | ||
3316 | |||
3317 | scan->suspend_time = 0; | ||
3318 | scan->max_out_time = cpu_to_le32(200 * 1024); | ||
3319 | if (!interval) | ||
3320 | interval = suspend_time; | ||
3321 | |||
3322 | extra = (suspend_time / interval) << 22; | ||
3323 | scan_suspend_time = (extra | | ||
3324 | ((suspend_time % interval) * 1024)); | ||
3325 | scan->suspend_time = cpu_to_le32(scan_suspend_time); | ||
3326 | IWL_DEBUG_SCAN("suspend_time 0x%X beacon interval %d\n", | ||
3327 | scan_suspend_time, interval); | ||
3328 | } | ||
3329 | |||
3330 | /* We should add the ability for user to lock to PASSIVE ONLY */ | ||
3331 | if (priv->one_direct_scan) { | ||
3332 | IWL_DEBUG_SCAN | ||
3333 | ("Kicking off one direct scan for '%s'\n", | ||
3334 | iwl4965_escape_essid(priv->direct_ssid, | ||
3335 | priv->direct_ssid_len)); | ||
3336 | scan->direct_scan[0].id = WLAN_EID_SSID; | ||
3337 | scan->direct_scan[0].len = priv->direct_ssid_len; | ||
3338 | memcpy(scan->direct_scan[0].ssid, | ||
3339 | priv->direct_ssid, priv->direct_ssid_len); | ||
3340 | direct_mask = 1; | ||
3341 | } else if (!iwl_is_associated(priv) && priv->essid_len) { | ||
3342 | IWL_DEBUG_SCAN | ||
3343 | ("Kicking off one direct scan for '%s' when not associated\n", | ||
3344 | iwl4965_escape_essid(priv->essid, priv->essid_len)); | ||
3345 | scan->direct_scan[0].id = WLAN_EID_SSID; | ||
3346 | scan->direct_scan[0].len = priv->essid_len; | ||
3347 | memcpy(scan->direct_scan[0].ssid, priv->essid, priv->essid_len); | ||
3348 | direct_mask = 1; | ||
3349 | } else { | ||
3350 | IWL_DEBUG_SCAN("Kicking off one indirect scan.\n"); | ||
3351 | direct_mask = 0; | ||
3352 | } | ||
3353 | |||
3354 | scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK; | ||
3355 | scan->tx_cmd.sta_id = priv->hw_params.bcast_sta_id; | ||
3356 | scan->tx_cmd.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; | ||
3357 | |||
3358 | |||
3359 | switch (priv->scan_bands) { | ||
3360 | case 2: | ||
3361 | scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK; | ||
3362 | scan->tx_cmd.rate_n_flags = | ||
3363 | iwl4965_hw_set_rate_n_flags(IWL_RATE_1M_PLCP, | ||
3364 | RATE_MCS_ANT_B_MSK|RATE_MCS_CCK_MSK); | ||
3365 | |||
3366 | scan->good_CRC_th = 0; | ||
3367 | band = IEEE80211_BAND_2GHZ; | ||
3368 | break; | ||
3369 | |||
3370 | case 1: | ||
3371 | scan->tx_cmd.rate_n_flags = | ||
3372 | iwl4965_hw_set_rate_n_flags(IWL_RATE_6M_PLCP, | ||
3373 | RATE_MCS_ANT_B_MSK); | ||
3374 | scan->good_CRC_th = IWL_GOOD_CRC_TH; | ||
3375 | band = IEEE80211_BAND_5GHZ; | ||
3376 | break; | ||
3377 | |||
3378 | default: | ||
3379 | IWL_WARNING("Invalid scan band count\n"); | ||
3380 | goto done; | ||
3381 | } | ||
3382 | |||
3383 | /* We don't build a direct scan probe request; the uCode will do | ||
3384 | * that based on the direct_mask added to each channel entry */ | ||
3385 | cmd_len = iwl4965_fill_probe_req(priv, band, | ||
3386 | (struct ieee80211_mgmt *)scan->data, | ||
3387 | IWL_MAX_SCAN_SIZE - sizeof(*scan), 0); | ||
3388 | |||
3389 | scan->tx_cmd.len = cpu_to_le16(cmd_len); | ||
3390 | /* select Rx chains */ | ||
3391 | |||
3392 | /* Force use of chains B and C (0x6) for scan Rx. | ||
3393 | * Avoid A (0x1) because of its off-channel reception on A-band. | ||
3394 | * MIMO is not used here, but value is required to make uCode happy. */ | ||
3395 | scan->rx_chain = RXON_RX_CHAIN_DRIVER_FORCE_MSK | | ||
3396 | cpu_to_le16((0x7 << RXON_RX_CHAIN_VALID_POS) | | ||
3397 | (0x6 << RXON_RX_CHAIN_FORCE_SEL_POS) | | ||
3398 | (0x7 << RXON_RX_CHAIN_FORCE_MIMO_SEL_POS)); | ||
3399 | |||
3400 | if (priv->iw_mode == IEEE80211_IF_TYPE_MNTR) | ||
3401 | scan->filter_flags = RXON_FILTER_PROMISC_MSK; | ||
3402 | |||
3403 | if (direct_mask) | ||
3404 | scan->channel_count = | ||
3405 | iwl4965_get_channels_for_scan( | ||
3406 | priv, band, 1, /* active */ | ||
3407 | direct_mask, | ||
3408 | (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)]); | ||
3409 | else | ||
3410 | scan->channel_count = | ||
3411 | iwl4965_get_channels_for_scan( | ||
3412 | priv, band, 0, /* passive */ | ||
3413 | direct_mask, | ||
3414 | (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)]); | ||
3415 | |||
3416 | scan->filter_flags |= (RXON_FILTER_ACCEPT_GRP_MSK | | ||
3417 | RXON_FILTER_BCON_AWARE_MSK); | ||
3418 | cmd.len += le16_to_cpu(scan->tx_cmd.len) + | ||
3419 | scan->channel_count * sizeof(struct iwl4965_scan_channel); | ||
3420 | cmd.data = scan; | ||
3421 | scan->len = cpu_to_le16(cmd.len); | ||
3422 | |||
3423 | set_bit(STATUS_SCAN_HW, &priv->status); | ||
3424 | ret = iwl_send_cmd_sync(priv, &cmd); | ||
3425 | if (ret) | ||
3426 | goto done; | ||
3427 | |||
3428 | queue_delayed_work(priv->workqueue, &priv->scan_check, | ||
3429 | IWL_SCAN_CHECK_WATCHDOG); | ||
3430 | |||
3431 | mutex_unlock(&priv->mutex); | ||
3432 | return; | ||
3433 | |||
3434 | done: | ||
3435 | /* inform mac80211 scan aborted */ | ||
3436 | queue_work(priv->workqueue, &priv->scan_completed); | ||
3437 | mutex_unlock(&priv->mutex); | ||
3438 | } | ||
3439 | |||
3440 | static void iwl_bg_run_time_calib_work(struct work_struct *work) | 2622 | static void iwl_bg_run_time_calib_work(struct work_struct *work) |
3441 | { | 2623 | { |
3442 | struct iwl_priv *priv = container_of(work, struct iwl_priv, | 2624 | struct iwl_priv *priv = container_of(work, struct iwl_priv, |
@@ -3521,7 +2703,7 @@ static void iwl4965_post_associate(struct iwl_priv *priv) | |||
3521 | if (!priv->vif || !priv->is_open) | 2703 | if (!priv->vif || !priv->is_open) |
3522 | return; | 2704 | return; |
3523 | 2705 | ||
3524 | iwl4965_scan_cancel_timeout(priv, 200); | 2706 | iwl_scan_cancel_timeout(priv, 200); |
3525 | 2707 | ||
3526 | conf = ieee80211_get_hw_conf(priv->hw); | 2708 | conf = ieee80211_get_hw_conf(priv->hw); |
3527 | 2709 | ||
@@ -3615,24 +2797,9 @@ static void iwl4965_bg_post_associate(struct work_struct *data) | |||
3615 | 2797 | ||
3616 | } | 2798 | } |
3617 | 2799 | ||
3618 | static void iwl4965_bg_abort_scan(struct work_struct *work) | ||
3619 | { | ||
3620 | struct iwl_priv *priv = container_of(work, struct iwl_priv, abort_scan); | ||
3621 | |||
3622 | if (!iwl_is_ready(priv)) | ||
3623 | return; | ||
3624 | |||
3625 | mutex_lock(&priv->mutex); | ||
3626 | |||
3627 | set_bit(STATUS_SCAN_ABORTING, &priv->status); | ||
3628 | iwl4965_send_scan_abort(priv); | ||
3629 | |||
3630 | mutex_unlock(&priv->mutex); | ||
3631 | } | ||
3632 | |||
3633 | static int iwl4965_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf); | 2800 | static int iwl4965_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf); |
3634 | 2801 | ||
3635 | static void iwl4965_bg_scan_completed(struct work_struct *work) | 2802 | static void iwl_bg_scan_completed(struct work_struct *work) |
3636 | { | 2803 | { |
3637 | struct iwl_priv *priv = | 2804 | struct iwl_priv *priv = |
3638 | container_of(work, struct iwl_priv, scan_completed); | 2805 | container_of(work, struct iwl_priv, scan_completed); |
@@ -3759,7 +2926,7 @@ static void iwl4965_mac_stop(struct ieee80211_hw *hw) | |||
3759 | * RXON_FILTER_ASSOC_MSK BIT | 2926 | * RXON_FILTER_ASSOC_MSK BIT |
3760 | */ | 2927 | */ |
3761 | mutex_lock(&priv->mutex); | 2928 | mutex_lock(&priv->mutex); |
3762 | iwl4965_scan_cancel_timeout(priv, 100); | 2929 | iwl_scan_cancel_timeout(priv, 100); |
3763 | cancel_delayed_work(&priv->post_associate); | 2930 | cancel_delayed_work(&priv->post_associate); |
3764 | mutex_unlock(&priv->mutex); | 2931 | mutex_unlock(&priv->mutex); |
3765 | } | 2932 | } |
@@ -4071,7 +3238,7 @@ static int iwl4965_mac_config_interface(struct ieee80211_hw *hw, | |||
4071 | !is_multicast_ether_addr(conf->bssid)) { | 3238 | !is_multicast_ether_addr(conf->bssid)) { |
4072 | /* If there is currently a HW scan going on in the background | 3239 | /* If there is currently a HW scan going on in the background |
4073 | * then we need to cancel it else the RXON below will fail. */ | 3240 | * then we need to cancel it else the RXON below will fail. */ |
4074 | if (iwl4965_scan_cancel_timeout(priv, 100)) { | 3241 | if (iwl_scan_cancel_timeout(priv, 100)) { |
4075 | IWL_WARNING("Aborted scan still in progress " | 3242 | IWL_WARNING("Aborted scan still in progress " |
4076 | "after 100ms\n"); | 3243 | "after 100ms\n"); |
4077 | IWL_DEBUG_MAC80211("leaving - scan abort failed.\n"); | 3244 | IWL_DEBUG_MAC80211("leaving - scan abort failed.\n"); |
@@ -4096,7 +3263,7 @@ static int iwl4965_mac_config_interface(struct ieee80211_hw *hw, | |||
4096 | } | 3263 | } |
4097 | 3264 | ||
4098 | } else { | 3265 | } else { |
4099 | iwl4965_scan_cancel_timeout(priv, 100); | 3266 | iwl_scan_cancel_timeout(priv, 100); |
4100 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 3267 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
4101 | iwl4965_commit_rxon(priv); | 3268 | iwl4965_commit_rxon(priv); |
4102 | } | 3269 | } |
@@ -4154,7 +3321,7 @@ static void iwl4965_mac_remove_interface(struct ieee80211_hw *hw, | |||
4154 | mutex_lock(&priv->mutex); | 3321 | mutex_lock(&priv->mutex); |
4155 | 3322 | ||
4156 | if (iwl_is_ready_rf(priv)) { | 3323 | if (iwl_is_ready_rf(priv)) { |
4157 | iwl4965_scan_cancel_timeout(priv, 100); | 3324 | iwl_scan_cancel_timeout(priv, 100); |
4158 | cancel_delayed_work(&priv->post_associate); | 3325 | cancel_delayed_work(&priv->post_associate); |
4159 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 3326 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
4160 | iwl4965_commit_rxon(priv); | 3327 | iwl4965_commit_rxon(priv); |
@@ -4268,7 +3435,7 @@ static int iwl4965_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len) | |||
4268 | } | 3435 | } |
4269 | if (len) { | 3436 | if (len) { |
4270 | IWL_DEBUG_SCAN("direct scan for %s [%d]\n ", | 3437 | IWL_DEBUG_SCAN("direct scan for %s [%d]\n ", |
4271 | iwl4965_escape_essid(ssid, len), (int)len); | 3438 | iwl_escape_essid(ssid, len), (int)len); |
4272 | 3439 | ||
4273 | priv->one_direct_scan = 1; | 3440 | priv->one_direct_scan = 1; |
4274 | priv->direct_ssid_len = (u8) | 3441 | priv->direct_ssid_len = (u8) |
@@ -4277,7 +3444,7 @@ static int iwl4965_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len) | |||
4277 | } else | 3444 | } else |
4278 | priv->one_direct_scan = 0; | 3445 | priv->one_direct_scan = 0; |
4279 | 3446 | ||
4280 | rc = iwl4965_scan_initiate(priv); | 3447 | rc = iwl_scan_initiate(priv); |
4281 | 3448 | ||
4282 | IWL_DEBUG_MAC80211("leave\n"); | 3449 | IWL_DEBUG_MAC80211("leave\n"); |
4283 | 3450 | ||
@@ -4308,7 +3475,7 @@ static void iwl4965_mac_update_tkip_key(struct ieee80211_hw *hw, | |||
4308 | return; | 3475 | return; |
4309 | } | 3476 | } |
4310 | 3477 | ||
4311 | iwl4965_scan_cancel_timeout(priv, 100); | 3478 | iwl_scan_cancel_timeout(priv, 100); |
4312 | 3479 | ||
4313 | key_flags |= (STA_KEY_FLG_TKIP | STA_KEY_FLG_MAP_KEY_MSK); | 3480 | key_flags |= (STA_KEY_FLG_TKIP | STA_KEY_FLG_MAP_KEY_MSK); |
4314 | key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS); | 3481 | key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS); |
@@ -4366,7 +3533,7 @@ static int iwl4965_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
4366 | } | 3533 | } |
4367 | 3534 | ||
4368 | mutex_lock(&priv->mutex); | 3535 | mutex_lock(&priv->mutex); |
4369 | iwl4965_scan_cancel_timeout(priv, 100); | 3536 | iwl_scan_cancel_timeout(priv, 100); |
4370 | mutex_unlock(&priv->mutex); | 3537 | mutex_unlock(&priv->mutex); |
4371 | 3538 | ||
4372 | /* If we are getting WEP group key and we didn't receive any key mapping | 3539 | /* If we are getting WEP group key and we didn't receive any key mapping |
@@ -4562,7 +3729,7 @@ static void iwl4965_mac_reset_tsf(struct ieee80211_hw *hw) | |||
4562 | * clear RXON_FILTER_ASSOC_MSK bit | 3729 | * clear RXON_FILTER_ASSOC_MSK bit |
4563 | */ | 3730 | */ |
4564 | if (priv->iw_mode != IEEE80211_IF_TYPE_AP) { | 3731 | if (priv->iw_mode != IEEE80211_IF_TYPE_AP) { |
4565 | iwl4965_scan_cancel_timeout(priv, 100); | 3732 | iwl_scan_cancel_timeout(priv, 100); |
4566 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 3733 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
4567 | iwl4965_commit_rxon(priv); | 3734 | iwl4965_commit_rxon(priv); |
4568 | } | 3735 | } |
@@ -4759,7 +3926,7 @@ static ssize_t store_flags(struct device *d, | |||
4759 | mutex_lock(&priv->mutex); | 3926 | mutex_lock(&priv->mutex); |
4760 | if (le32_to_cpu(priv->staging_rxon.flags) != flags) { | 3927 | if (le32_to_cpu(priv->staging_rxon.flags) != flags) { |
4761 | /* Cancel any currently running scans... */ | 3928 | /* Cancel any currently running scans... */ |
4762 | if (iwl4965_scan_cancel_timeout(priv, 100)) | 3929 | if (iwl_scan_cancel_timeout(priv, 100)) |
4763 | IWL_WARNING("Could not cancel scan.\n"); | 3930 | IWL_WARNING("Could not cancel scan.\n"); |
4764 | else { | 3931 | else { |
4765 | IWL_DEBUG_INFO("Committing rxon.flags = 0x%04X\n", | 3932 | IWL_DEBUG_INFO("Committing rxon.flags = 0x%04X\n", |
@@ -4794,7 +3961,7 @@ static ssize_t store_filter_flags(struct device *d, | |||
4794 | mutex_lock(&priv->mutex); | 3961 | mutex_lock(&priv->mutex); |
4795 | if (le32_to_cpu(priv->staging_rxon.filter_flags) != filter_flags) { | 3962 | if (le32_to_cpu(priv->staging_rxon.filter_flags) != filter_flags) { |
4796 | /* Cancel any currently running scans... */ | 3963 | /* Cancel any currently running scans... */ |
4797 | if (iwl4965_scan_cancel_timeout(priv, 100)) | 3964 | if (iwl_scan_cancel_timeout(priv, 100)) |
4798 | IWL_WARNING("Could not cancel scan.\n"); | 3965 | IWL_WARNING("Could not cancel scan.\n"); |
4799 | else { | 3966 | else { |
4800 | IWL_DEBUG_INFO("Committing rxon.filter_flags = " | 3967 | IWL_DEBUG_INFO("Committing rxon.filter_flags = " |
@@ -5062,9 +4229,6 @@ static void iwl_setup_deferred_work(struct iwl_priv *priv) | |||
5062 | INIT_WORK(&priv->up, iwl4965_bg_up); | 4229 | INIT_WORK(&priv->up, iwl4965_bg_up); |
5063 | INIT_WORK(&priv->restart, iwl4965_bg_restart); | 4230 | INIT_WORK(&priv->restart, iwl4965_bg_restart); |
5064 | INIT_WORK(&priv->rx_replenish, iwl4965_bg_rx_replenish); | 4231 | INIT_WORK(&priv->rx_replenish, iwl4965_bg_rx_replenish); |
5065 | INIT_WORK(&priv->scan_completed, iwl4965_bg_scan_completed); | ||
5066 | INIT_WORK(&priv->request_scan, iwl4965_bg_request_scan); | ||
5067 | INIT_WORK(&priv->abort_scan, iwl4965_bg_abort_scan); | ||
5068 | INIT_WORK(&priv->rf_kill, iwl4965_bg_rf_kill); | 4232 | INIT_WORK(&priv->rf_kill, iwl4965_bg_rf_kill); |
5069 | INIT_WORK(&priv->beacon_update, iwl4965_bg_beacon_update); | 4233 | INIT_WORK(&priv->beacon_update, iwl4965_bg_beacon_update); |
5070 | INIT_WORK(&priv->set_monitor, iwl4965_bg_set_monitor); | 4234 | INIT_WORK(&priv->set_monitor, iwl4965_bg_set_monitor); |
@@ -5072,7 +4236,10 @@ static void iwl_setup_deferred_work(struct iwl_priv *priv) | |||
5072 | INIT_DELAYED_WORK(&priv->post_associate, iwl4965_bg_post_associate); | 4236 | INIT_DELAYED_WORK(&priv->post_associate, iwl4965_bg_post_associate); |
5073 | INIT_DELAYED_WORK(&priv->init_alive_start, iwl_bg_init_alive_start); | 4237 | INIT_DELAYED_WORK(&priv->init_alive_start, iwl_bg_init_alive_start); |
5074 | INIT_DELAYED_WORK(&priv->alive_start, iwl_bg_alive_start); | 4238 | INIT_DELAYED_WORK(&priv->alive_start, iwl_bg_alive_start); |
5075 | INIT_DELAYED_WORK(&priv->scan_check, iwl4965_bg_scan_check); | 4239 | |
4240 | /* FIXME : remove when resolved PENDING */ | ||
4241 | INIT_WORK(&priv->scan_completed, iwl_bg_scan_completed); | ||
4242 | iwl_setup_scan_deferred_work(priv); | ||
5076 | 4243 | ||
5077 | if (priv->cfg->ops->lib->setup_deferred_work) | 4244 | if (priv->cfg->ops->lib->setup_deferred_work) |
5078 | priv->cfg->ops->lib->setup_deferred_work(priv); | 4245 | priv->cfg->ops->lib->setup_deferred_work(priv); |