aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2010-05-03 14:53:49 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-05-03 14:53:49 -0400
commit1d7d969dd0b467ba32cf3829e8bf104a5084150d (patch)
treef0de3aca8a33bed612ba2c09f61fcabe289dc14d /drivers
parent12ef116bf750c221e214e33c61e7f4c98300b5fd (diff)
parentf8478df1eab2f11aefc4b6668c5867949ab96bd7 (diff)
Merge branch 'wireless-next-2.6' of git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-2.6
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/iwlwifi/Makefile1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-1000.c1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945-debugfs.c500
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945-debugfs.h60
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.c72
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-5000.c73
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-6000.c73
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-lib.c23
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-rs.c10
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-tx.c16
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c13
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-commands.h4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c10
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-debugfs.c18
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h5
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c5
-rw-r--r--drivers/net/wireless/p54/p54pci.c2
18 files changed, 797 insertions, 91 deletions
diff --git a/drivers/net/wireless/iwlwifi/Makefile b/drivers/net/wireless/iwlwifi/Makefile
index 5ed2dcbe6d01..7c7235385513 100644
--- a/drivers/net/wireless/iwlwifi/Makefile
+++ b/drivers/net/wireless/iwlwifi/Makefile
@@ -22,5 +22,6 @@ iwlagn-$(CONFIG_IWL5000) += iwl-1000.o
22# 3945 22# 3945
23obj-$(CONFIG_IWL3945) += iwl3945.o 23obj-$(CONFIG_IWL3945) += iwl3945.o
24iwl3945-objs := iwl3945-base.o iwl-3945.o iwl-3945-rs.o iwl-3945-led.o 24iwl3945-objs := iwl3945-base.o iwl-3945.o iwl-3945-rs.o iwl-3945-led.o
25iwl3945-$(CONFIG_IWLWIFI_DEBUGFS) += iwl-3945-debugfs.o
25 26
26ccflags-y += -D__CHECK_ENDIAN__ 27ccflags-y += -D__CHECK_ENDIAN__
diff --git a/drivers/net/wireless/iwlwifi/iwl-1000.c b/drivers/net/wireless/iwlwifi/iwl-1000.c
index 8431ffce37d3..fb59af2d41c6 100644
--- a/drivers/net/wireless/iwlwifi/iwl-1000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-1000.c
@@ -282,7 +282,6 @@ struct iwl_cfg iwl1000_bg_cfg = {
282 .use_bsm = false, 282 .use_bsm = false,
283 .max_ll_items = OTP_MAX_LL_ITEMS_1000, 283 .max_ll_items = OTP_MAX_LL_ITEMS_1000,
284 .shadow_ram_support = false, 284 .shadow_ram_support = false,
285 .ht_greenfield_support = true,
286 .led_compensation = 51, 285 .led_compensation = 51,
287 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, 286 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
288 .support_ct_kill_exit = true, 287 .support_ct_kill_exit = true,
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-3945-debugfs.c
new file mode 100644
index 000000000000..6a9c64a50e36
--- /dev/null
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-debugfs.c
@@ -0,0 +1,500 @@
1/******************************************************************************
2 *
3 * GPL LICENSE SUMMARY
4 *
5 * Copyright(c) 2008 - 2010 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 * Intel Linux Wireless <ilw@linux.intel.com>
26 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
27 *****************************************************************************/
28
29#include "iwl-3945-debugfs.h"
30
31ssize_t iwl3945_ucode_rx_stats_read(struct file *file,
32 char __user *user_buf,
33 size_t count, loff_t *ppos)
34{
35 struct iwl_priv *priv = file->private_data;
36 int pos = 0;
37 char *buf;
38 int bufsz = sizeof(struct iwl39_statistics_rx_phy) * 40 +
39 sizeof(struct iwl39_statistics_rx_non_phy) * 40 + 400;
40 ssize_t ret;
41 struct iwl39_statistics_rx_phy *ofdm, *accum_ofdm, *delta_ofdm, *max_ofdm;
42 struct iwl39_statistics_rx_phy *cck, *accum_cck, *delta_cck, *max_cck;
43 struct iwl39_statistics_rx_non_phy *general, *accum_general;
44 struct iwl39_statistics_rx_non_phy *delta_general, *max_general;
45
46 if (!iwl_is_alive(priv))
47 return -EAGAIN;
48
49 buf = kzalloc(bufsz, GFP_KERNEL);
50 if (!buf) {
51 IWL_ERR(priv, "Can not allocate Buffer\n");
52 return -ENOMEM;
53 }
54
55 /*
56 * The statistic information display here is based on
57 * the last statistics notification from uCode
58 * might not reflect the current uCode activity
59 */
60 ofdm = &priv->_3945.statistics.rx.ofdm;
61 cck = &priv->_3945.statistics.rx.cck;
62 general = &priv->_3945.statistics.rx.general;
63 accum_ofdm = &priv->_3945.accum_statistics.rx.ofdm;
64 accum_cck = &priv->_3945.accum_statistics.rx.cck;
65 accum_general = &priv->_3945.accum_statistics.rx.general;
66 delta_ofdm = &priv->_3945.delta_statistics.rx.ofdm;
67 delta_cck = &priv->_3945.delta_statistics.rx.cck;
68 delta_general = &priv->_3945.delta_statistics.rx.general;
69 max_ofdm = &priv->_3945.max_delta.rx.ofdm;
70 max_cck = &priv->_3945.max_delta.rx.cck;
71 max_general = &priv->_3945.max_delta.rx.general;
72
73 pos += iwl_dbgfs_statistics_flag(priv, buf, bufsz);
74 pos += scnprintf(buf + pos, bufsz - pos, "%-32s current"
75 "acumulative delta max\n",
76 "Statistics_Rx - OFDM:");
77 pos += scnprintf(buf + pos, bufsz - pos,
78 " %-30s %10u %10u %10u %10u\n",
79 "ina_cnt:", le32_to_cpu(ofdm->ina_cnt),
80 accum_ofdm->ina_cnt,
81 delta_ofdm->ina_cnt, max_ofdm->ina_cnt);
82 pos += scnprintf(buf + pos, bufsz - pos,
83 " %-30s %10u %10u %10u %10u\n",
84 "fina_cnt:",
85 le32_to_cpu(ofdm->fina_cnt), accum_ofdm->fina_cnt,
86 delta_ofdm->fina_cnt, max_ofdm->fina_cnt);
87 pos += scnprintf(buf + pos, bufsz - pos,
88 " %-30s %10u %10u %10u %10u\n", "plcp_err:",
89 le32_to_cpu(ofdm->plcp_err), accum_ofdm->plcp_err,
90 delta_ofdm->plcp_err, max_ofdm->plcp_err);
91 pos += scnprintf(buf + pos, bufsz - pos,
92 " %-30s %10u %10u %10u %10u\n", "crc32_err:",
93 le32_to_cpu(ofdm->crc32_err), accum_ofdm->crc32_err,
94 delta_ofdm->crc32_err, max_ofdm->crc32_err);
95 pos += scnprintf(buf + pos, bufsz - pos,
96 " %-30s %10u %10u %10u %10u\n", "overrun_err:",
97 le32_to_cpu(ofdm->overrun_err),
98 accum_ofdm->overrun_err, delta_ofdm->overrun_err,
99 max_ofdm->overrun_err);
100 pos += scnprintf(buf + pos, bufsz - pos,
101 " %-30s %10u %10u %10u %10u\n",
102 "early_overrun_err:",
103 le32_to_cpu(ofdm->early_overrun_err),
104 accum_ofdm->early_overrun_err,
105 delta_ofdm->early_overrun_err,
106 max_ofdm->early_overrun_err);
107 pos += scnprintf(buf + pos, bufsz - pos,
108 " %-30s %10u %10u %10u %10u\n",
109 "crc32_good:", le32_to_cpu(ofdm->crc32_good),
110 accum_ofdm->crc32_good, delta_ofdm->crc32_good,
111 max_ofdm->crc32_good);
112 pos += scnprintf(buf + pos, bufsz - pos,
113 " %-30s %10u %10u %10u %10u\n", "false_alarm_cnt:",
114 le32_to_cpu(ofdm->false_alarm_cnt),
115 accum_ofdm->false_alarm_cnt,
116 delta_ofdm->false_alarm_cnt,
117 max_ofdm->false_alarm_cnt);
118 pos += scnprintf(buf + pos, bufsz - pos,
119 " %-30s %10u %10u %10u %10u\n",
120 "fina_sync_err_cnt:",
121 le32_to_cpu(ofdm->fina_sync_err_cnt),
122 accum_ofdm->fina_sync_err_cnt,
123 delta_ofdm->fina_sync_err_cnt,
124 max_ofdm->fina_sync_err_cnt);
125 pos += scnprintf(buf + pos, bufsz - pos,
126 " %-30s %10u %10u %10u %10u\n",
127 "sfd_timeout:",
128 le32_to_cpu(ofdm->sfd_timeout),
129 accum_ofdm->sfd_timeout,
130 delta_ofdm->sfd_timeout,
131 max_ofdm->sfd_timeout);
132 pos += scnprintf(buf + pos, bufsz - pos,
133 " %-30s %10u %10u %10u %10u\n",
134 "fina_timeout:",
135 le32_to_cpu(ofdm->fina_timeout),
136 accum_ofdm->fina_timeout,
137 delta_ofdm->fina_timeout,
138 max_ofdm->fina_timeout);
139 pos += scnprintf(buf + pos, bufsz - pos,
140 " %-30s %10u %10u %10u %10u\n",
141 "unresponded_rts:",
142 le32_to_cpu(ofdm->unresponded_rts),
143 accum_ofdm->unresponded_rts,
144 delta_ofdm->unresponded_rts,
145 max_ofdm->unresponded_rts);
146 pos += scnprintf(buf + pos, bufsz - pos,
147 " %-30s %10u %10u %10u %10u\n",
148 "rxe_frame_lmt_ovrun:",
149 le32_to_cpu(ofdm->rxe_frame_limit_overrun),
150 accum_ofdm->rxe_frame_limit_overrun,
151 delta_ofdm->rxe_frame_limit_overrun,
152 max_ofdm->rxe_frame_limit_overrun);
153 pos += scnprintf(buf + pos, bufsz - pos,
154 " %-30s %10u %10u %10u %10u\n",
155 "sent_ack_cnt:",
156 le32_to_cpu(ofdm->sent_ack_cnt),
157 accum_ofdm->sent_ack_cnt,
158 delta_ofdm->sent_ack_cnt,
159 max_ofdm->sent_ack_cnt);
160 pos += scnprintf(buf + pos, bufsz - pos,
161 " %-30s %10u %10u %10u %10u\n",
162 "sent_cts_cnt:",
163 le32_to_cpu(ofdm->sent_cts_cnt),
164 accum_ofdm->sent_cts_cnt,
165 delta_ofdm->sent_cts_cnt, max_ofdm->sent_cts_cnt);
166
167 pos += scnprintf(buf + pos, bufsz - pos, "%-32s current"
168 "acumulative delta max\n",
169 "Statistics_Rx - CCK:");
170 pos += scnprintf(buf + pos, bufsz - pos,
171 " %-30s %10u %10u %10u %10u\n",
172 "ina_cnt:",
173 le32_to_cpu(cck->ina_cnt), accum_cck->ina_cnt,
174 delta_cck->ina_cnt, max_cck->ina_cnt);
175 pos += scnprintf(buf + pos, bufsz - pos,
176 " %-30s %10u %10u %10u %10u\n",
177 "fina_cnt:",
178 le32_to_cpu(cck->fina_cnt), accum_cck->fina_cnt,
179 delta_cck->fina_cnt, max_cck->fina_cnt);
180 pos += scnprintf(buf + pos, bufsz - pos,
181 " %-30s %10u %10u %10u %10u\n",
182 "plcp_err:",
183 le32_to_cpu(cck->plcp_err), accum_cck->plcp_err,
184 delta_cck->plcp_err, max_cck->plcp_err);
185 pos += scnprintf(buf + pos, bufsz - pos,
186 " %-30s %10u %10u %10u %10u\n",
187 "crc32_err:",
188 le32_to_cpu(cck->crc32_err), accum_cck->crc32_err,
189 delta_cck->crc32_err, max_cck->crc32_err);
190 pos += scnprintf(buf + pos, bufsz - pos,
191 " %-30s %10u %10u %10u %10u\n",
192 "overrun_err:",
193 le32_to_cpu(cck->overrun_err),
194 accum_cck->overrun_err,
195 delta_cck->overrun_err, max_cck->overrun_err);
196 pos += scnprintf(buf + pos, bufsz - pos,
197 " %-30s %10u %10u %10u %10u\n",
198 "early_overrun_err:",
199 le32_to_cpu(cck->early_overrun_err),
200 accum_cck->early_overrun_err,
201 delta_cck->early_overrun_err,
202 max_cck->early_overrun_err);
203 pos += scnprintf(buf + pos, bufsz - pos,
204 " %-30s %10u %10u %10u %10u\n",
205 "crc32_good:",
206 le32_to_cpu(cck->crc32_good), accum_cck->crc32_good,
207 delta_cck->crc32_good,
208 max_cck->crc32_good);
209 pos += scnprintf(buf + pos, bufsz - pos,
210 " %-30s %10u %10u %10u %10u\n",
211 "false_alarm_cnt:",
212 le32_to_cpu(cck->false_alarm_cnt),
213 accum_cck->false_alarm_cnt,
214 delta_cck->false_alarm_cnt, max_cck->false_alarm_cnt);
215 pos += scnprintf(buf + pos, bufsz - pos,
216 " %-30s %10u %10u %10u %10u\n",
217 "fina_sync_err_cnt:",
218 le32_to_cpu(cck->fina_sync_err_cnt),
219 accum_cck->fina_sync_err_cnt,
220 delta_cck->fina_sync_err_cnt,
221 max_cck->fina_sync_err_cnt);
222 pos += scnprintf(buf + pos, bufsz - pos,
223 " %-30s %10u %10u %10u %10u\n",
224 "sfd_timeout:",
225 le32_to_cpu(cck->sfd_timeout),
226 accum_cck->sfd_timeout,
227 delta_cck->sfd_timeout, max_cck->sfd_timeout);
228 pos += scnprintf(buf + pos, bufsz - pos,
229 " %-30s %10u %10u %10u %10u\n",
230 "fina_timeout:",
231 le32_to_cpu(cck->fina_timeout),
232 accum_cck->fina_timeout,
233 delta_cck->fina_timeout, max_cck->fina_timeout);
234 pos += scnprintf(buf + pos, bufsz - pos,
235 " %-30s %10u %10u %10u %10u\n",
236 "unresponded_rts:",
237 le32_to_cpu(cck->unresponded_rts),
238 accum_cck->unresponded_rts,
239 delta_cck->unresponded_rts,
240 max_cck->unresponded_rts);
241 pos += scnprintf(buf + pos, bufsz - pos,
242 " %-30s %10u %10u %10u %10u\n",
243 "rxe_frame_lmt_ovrun:",
244 le32_to_cpu(cck->rxe_frame_limit_overrun),
245 accum_cck->rxe_frame_limit_overrun,
246 delta_cck->rxe_frame_limit_overrun,
247 max_cck->rxe_frame_limit_overrun);
248 pos += scnprintf(buf + pos, bufsz - pos,
249 " %-30s %10u %10u %10u %10u\n",
250 "sent_ack_cnt:",
251 le32_to_cpu(cck->sent_ack_cnt),
252 accum_cck->sent_ack_cnt,
253 delta_cck->sent_ack_cnt,
254 max_cck->sent_ack_cnt);
255 pos += scnprintf(buf + pos, bufsz - pos,
256 " %-30s %10u %10u %10u %10u\n",
257 "sent_cts_cnt:",
258 le32_to_cpu(cck->sent_cts_cnt),
259 accum_cck->sent_cts_cnt,
260 delta_cck->sent_cts_cnt,
261 max_cck->sent_cts_cnt);
262
263 pos += scnprintf(buf + pos, bufsz - pos, "%-32s current"
264 "acumulative delta max\n",
265 "Statistics_Rx - GENERAL:");
266 pos += scnprintf(buf + pos, bufsz - pos,
267 " %-30s %10u %10u %10u %10u\n",
268 "bogus_cts:",
269 le32_to_cpu(general->bogus_cts),
270 accum_general->bogus_cts,
271 delta_general->bogus_cts, max_general->bogus_cts);
272 pos += scnprintf(buf + pos, bufsz - pos,
273 " %-30s %10u %10u %10u %10u\n",
274 "bogus_ack:",
275 le32_to_cpu(general->bogus_ack),
276 accum_general->bogus_ack,
277 delta_general->bogus_ack, max_general->bogus_ack);
278 pos += scnprintf(buf + pos, bufsz - pos,
279 " %-30s %10u %10u %10u %10u\n",
280 "non_bssid_frames:",
281 le32_to_cpu(general->non_bssid_frames),
282 accum_general->non_bssid_frames,
283 delta_general->non_bssid_frames,
284 max_general->non_bssid_frames);
285 pos += scnprintf(buf + pos, bufsz - pos,
286 " %-30s %10u %10u %10u %10u\n",
287 "filtered_frames:",
288 le32_to_cpu(general->filtered_frames),
289 accum_general->filtered_frames,
290 delta_general->filtered_frames,
291 max_general->filtered_frames);
292 pos += scnprintf(buf + pos, bufsz - pos,
293 " %-30s %10u %10u %10u %10u\n",
294 "non_channel_beacons:",
295 le32_to_cpu(general->non_channel_beacons),
296 accum_general->non_channel_beacons,
297 delta_general->non_channel_beacons,
298 max_general->non_channel_beacons);
299
300 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
301 kfree(buf);
302 return ret;
303}
304
305ssize_t iwl3945_ucode_tx_stats_read(struct file *file,
306 char __user *user_buf,
307 size_t count, loff_t *ppos)
308{
309 struct iwl_priv *priv = file->private_data;
310 int pos = 0;
311 char *buf;
312 int bufsz = (sizeof(struct iwl39_statistics_tx) * 48) + 250;
313 ssize_t ret;
314 struct iwl39_statistics_tx *tx, *accum_tx, *delta_tx, *max_tx;
315
316 if (!iwl_is_alive(priv))
317 return -EAGAIN;
318
319 buf = kzalloc(bufsz, GFP_KERNEL);
320 if (!buf) {
321 IWL_ERR(priv, "Can not allocate Buffer\n");
322 return -ENOMEM;
323 }
324
325 /*
326 * The statistic information display here is based on
327 * the last statistics notification from uCode
328 * might not reflect the current uCode activity
329 */
330 tx = &priv->_3945.statistics.tx;
331 accum_tx = &priv->_3945.accum_statistics.tx;
332 delta_tx = &priv->_3945.delta_statistics.tx;
333 max_tx = &priv->_3945.max_delta.tx;
334 pos += iwl_dbgfs_statistics_flag(priv, buf, bufsz);
335 pos += scnprintf(buf + pos, bufsz - pos, "%-32s current"
336 "acumulative delta max\n",
337 "Statistics_Tx:");
338 pos += scnprintf(buf + pos, bufsz - pos,
339 " %-30s %10u %10u %10u %10u\n",
340 "preamble:",
341 le32_to_cpu(tx->preamble_cnt),
342 accum_tx->preamble_cnt,
343 delta_tx->preamble_cnt, max_tx->preamble_cnt);
344 pos += scnprintf(buf + pos, bufsz - pos,
345 " %-30s %10u %10u %10u %10u\n",
346 "rx_detected_cnt:",
347 le32_to_cpu(tx->rx_detected_cnt),
348 accum_tx->rx_detected_cnt,
349 delta_tx->rx_detected_cnt, max_tx->rx_detected_cnt);
350 pos += scnprintf(buf + pos, bufsz - pos,
351 " %-30s %10u %10u %10u %10u\n",
352 "bt_prio_defer_cnt:",
353 le32_to_cpu(tx->bt_prio_defer_cnt),
354 accum_tx->bt_prio_defer_cnt,
355 delta_tx->bt_prio_defer_cnt,
356 max_tx->bt_prio_defer_cnt);
357 pos += scnprintf(buf + pos, bufsz - pos,
358 " %-30s %10u %10u %10u %10u\n",
359 "bt_prio_kill_cnt:",
360 le32_to_cpu(tx->bt_prio_kill_cnt),
361 accum_tx->bt_prio_kill_cnt,
362 delta_tx->bt_prio_kill_cnt,
363 max_tx->bt_prio_kill_cnt);
364 pos += scnprintf(buf + pos, bufsz - pos,
365 " %-30s %10u %10u %10u %10u\n",
366 "few_bytes_cnt:",
367 le32_to_cpu(tx->few_bytes_cnt),
368 accum_tx->few_bytes_cnt,
369 delta_tx->few_bytes_cnt, max_tx->few_bytes_cnt);
370 pos += scnprintf(buf + pos, bufsz - pos,
371 " %-30s %10u %10u %10u %10u\n",
372 "cts_timeout:",
373 le32_to_cpu(tx->cts_timeout), accum_tx->cts_timeout,
374 delta_tx->cts_timeout, max_tx->cts_timeout);
375 pos += scnprintf(buf + pos, bufsz - pos,
376 " %-30s %10u %10u %10u %10u\n",
377 "ack_timeout:",
378 le32_to_cpu(tx->ack_timeout),
379 accum_tx->ack_timeout,
380 delta_tx->ack_timeout, max_tx->ack_timeout);
381 pos += scnprintf(buf + pos, bufsz - pos,
382 " %-30s %10u %10u %10u %10u\n",
383 "expected_ack_cnt:",
384 le32_to_cpu(tx->expected_ack_cnt),
385 accum_tx->expected_ack_cnt,
386 delta_tx->expected_ack_cnt,
387 max_tx->expected_ack_cnt);
388 pos += scnprintf(buf + pos, bufsz - pos,
389 " %-30s %10u %10u %10u %10u\n",
390 "actual_ack_cnt:",
391 le32_to_cpu(tx->actual_ack_cnt),
392 accum_tx->actual_ack_cnt,
393 delta_tx->actual_ack_cnt,
394 max_tx->actual_ack_cnt);
395
396 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
397 kfree(buf);
398 return ret;
399}
400
401ssize_t iwl3945_ucode_general_stats_read(struct file *file,
402 char __user *user_buf,
403 size_t count, loff_t *ppos)
404{
405 struct iwl_priv *priv = file->private_data;
406 int pos = 0;
407 char *buf;
408 int bufsz = sizeof(struct iwl39_statistics_general) * 10 + 300;
409 ssize_t ret;
410 struct iwl39_statistics_general *general, *accum_general;
411 struct iwl39_statistics_general *delta_general, *max_general;
412 struct statistics_dbg *dbg, *accum_dbg, *delta_dbg, *max_dbg;
413 struct iwl39_statistics_div *div, *accum_div, *delta_div, *max_div;
414
415 if (!iwl_is_alive(priv))
416 return -EAGAIN;
417
418 buf = kzalloc(bufsz, GFP_KERNEL);
419 if (!buf) {
420 IWL_ERR(priv, "Can not allocate Buffer\n");
421 return -ENOMEM;
422 }
423
424 /*
425 * The statistic information display here is based on
426 * the last statistics notification from uCode
427 * might not reflect the current uCode activity
428 */
429 general = &priv->_3945.statistics.general;
430 dbg = &priv->_3945.statistics.general.dbg;
431 div = &priv->_3945.statistics.general.div;
432 accum_general = &priv->_3945.accum_statistics.general;
433 delta_general = &priv->_3945.delta_statistics.general;
434 max_general = &priv->_3945.max_delta.general;
435 accum_dbg = &priv->_3945.accum_statistics.general.dbg;
436 delta_dbg = &priv->_3945.delta_statistics.general.dbg;
437 max_dbg = &priv->_3945.max_delta.general.dbg;
438 accum_div = &priv->_3945.accum_statistics.general.div;
439 delta_div = &priv->_3945.delta_statistics.general.div;
440 max_div = &priv->_3945.max_delta.general.div;
441 pos += iwl_dbgfs_statistics_flag(priv, buf, bufsz);
442 pos += scnprintf(buf + pos, bufsz - pos, "%-32s current"
443 "acumulative delta max\n",
444 "Statistics_General:");
445 pos += scnprintf(buf + pos, bufsz - pos,
446 " %-30s %10u %10u %10u %10u\n",
447 "burst_check:",
448 le32_to_cpu(dbg->burst_check),
449 accum_dbg->burst_check,
450 delta_dbg->burst_check, max_dbg->burst_check);
451 pos += scnprintf(buf + pos, bufsz - pos,
452 " %-30s %10u %10u %10u %10u\n",
453 "burst_count:",
454 le32_to_cpu(dbg->burst_count),
455 accum_dbg->burst_count,
456 delta_dbg->burst_count, max_dbg->burst_count);
457 pos += scnprintf(buf + pos, bufsz - pos,
458 " %-30s %10u %10u %10u %10u\n",
459 "sleep_time:",
460 le32_to_cpu(general->sleep_time),
461 accum_general->sleep_time,
462 delta_general->sleep_time, max_general->sleep_time);
463 pos += scnprintf(buf + pos, bufsz - pos,
464 " %-30s %10u %10u %10u %10u\n",
465 "slots_out:",
466 le32_to_cpu(general->slots_out),
467 accum_general->slots_out,
468 delta_general->slots_out, max_general->slots_out);
469 pos += scnprintf(buf + pos, bufsz - pos,
470 " %-30s %10u %10u %10u %10u\n",
471 "slots_idle:",
472 le32_to_cpu(general->slots_idle),
473 accum_general->slots_idle,
474 delta_general->slots_idle, max_general->slots_idle);
475 pos += scnprintf(buf + pos, bufsz - pos, "ttl_timestamp:\t\t\t%u\n",
476 le32_to_cpu(general->ttl_timestamp));
477 pos += scnprintf(buf + pos, bufsz - pos,
478 " %-30s %10u %10u %10u %10u\n",
479 "tx_on_a:",
480 le32_to_cpu(div->tx_on_a), accum_div->tx_on_a,
481 delta_div->tx_on_a, max_div->tx_on_a);
482 pos += scnprintf(buf + pos, bufsz - pos,
483 " %-30s %10u %10u %10u %10u\n",
484 "tx_on_b:",
485 le32_to_cpu(div->tx_on_b), accum_div->tx_on_b,
486 delta_div->tx_on_b, max_div->tx_on_b);
487 pos += scnprintf(buf + pos, bufsz - pos,
488 " %-30s %10u %10u %10u %10u\n",
489 "exec_time:",
490 le32_to_cpu(div->exec_time), accum_div->exec_time,
491 delta_div->exec_time, max_div->exec_time);
492 pos += scnprintf(buf + pos, bufsz - pos,
493 " %-30s %10u %10u %10u %10u\n",
494 "probe_time:",
495 le32_to_cpu(div->probe_time), accum_div->probe_time,
496 delta_div->probe_time, max_div->probe_time);
497 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
498 kfree(buf);
499 return ret;
500}
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-debugfs.h b/drivers/net/wireless/iwlwifi/iwl-3945-debugfs.h
new file mode 100644
index 000000000000..70809c53c215
--- /dev/null
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-debugfs.h
@@ -0,0 +1,60 @@
1/******************************************************************************
2 *
3 * GPL LICENSE SUMMARY
4 *
5 * Copyright(c) 2008 - 2010 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 * Intel Linux Wireless <ilw@linux.intel.com>
26 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
27 *****************************************************************************/
28
29#include "iwl-dev.h"
30#include "iwl-core.h"
31#include "iwl-debug.h"
32
33#ifdef CONFIG_IWLWIFI_DEBUGFS
34ssize_t iwl3945_ucode_rx_stats_read(struct file *file, char __user *user_buf,
35 size_t count, loff_t *ppos);
36ssize_t iwl3945_ucode_tx_stats_read(struct file *file, char __user *user_buf,
37 size_t count, loff_t *ppos);
38ssize_t iwl3945_ucode_general_stats_read(struct file *file,
39 char __user *user_buf, size_t count,
40 loff_t *ppos);
41#else
42static ssize_t iwl3945_ucode_rx_stats_read(struct file *file,
43 char __user *user_buf, size_t count,
44 loff_t *ppos)
45{
46 return 0;
47}
48static ssize_t iwl3945_ucode_tx_stats_read(struct file *file,
49 char __user *user_buf, size_t count,
50 loff_t *ppos)
51{
52 return 0;
53}
54static ssize_t iwl3945_ucode_general_stats_read(struct file *file,
55 char __user *user_buf,
56 size_t count, loff_t *ppos)
57{
58 return 0;
59}
60#endif
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index d10e59def53e..9dad8672d700 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -49,6 +49,7 @@
49#include "iwl-helpers.h" 49#include "iwl-helpers.h"
50#include "iwl-led.h" 50#include "iwl-led.h"
51#include "iwl-3945-led.h" 51#include "iwl-3945-led.h"
52#include "iwl-3945-debugfs.h"
52 53
53#define IWL_DECLARE_RATE_INFO(r, ip, in, rp, rn, pp, np) \ 54#define IWL_DECLARE_RATE_INFO(r, ip, in, rp, rn, pp, np) \
54 [IWL_RATE_##r##M_INDEX] = { IWL_RATE_##r##M_PLCP, \ 55 [IWL_RATE_##r##M_INDEX] = { IWL_RATE_##r##M_PLCP, \
@@ -292,7 +293,7 @@ static void iwl3945_tx_queue_reclaim(struct iwl_priv *priv,
292 * iwl3945_rx_reply_tx - Handle Tx response 293 * iwl3945_rx_reply_tx - Handle Tx response
293 */ 294 */
294static void iwl3945_rx_reply_tx(struct iwl_priv *priv, 295static void iwl3945_rx_reply_tx(struct iwl_priv *priv,
295 struct iwl_rx_mem_buffer *rxb) 296 struct iwl_rx_mem_buffer *rxb)
296{ 297{
297 struct iwl_rx_packet *pkt = rxb_addr(rxb); 298 struct iwl_rx_packet *pkt = rxb_addr(rxb);
298 u16 sequence = le16_to_cpu(pkt->hdr.sequence); 299 u16 sequence = le16_to_cpu(pkt->hdr.sequence);
@@ -350,18 +351,81 @@ static void iwl3945_rx_reply_tx(struct iwl_priv *priv,
350 * RX handler implementations 351 * RX handler implementations
351 * 352 *
352 *****************************************************************************/ 353 *****************************************************************************/
354#ifdef CONFIG_IWLWIFI_DEBUG
355/*
356 * based on the assumption of all statistics counter are in DWORD
357 * FIXME: This function is for debugging, do not deal with
358 * the case of counters roll-over.
359 */
360static void iwl3945_accumulative_statistics(struct iwl_priv *priv,
361 __le32 *stats)
362{
363 int i;
364 __le32 *prev_stats;
365 u32 *accum_stats;
366 u32 *delta, *max_delta;
367
368 prev_stats = (__le32 *)&priv->_3945.statistics;
369 accum_stats = (u32 *)&priv->_3945.accum_statistics;
370 delta = (u32 *)&priv->_3945.delta_statistics;
371 max_delta = (u32 *)&priv->_3945.max_delta;
372
373 for (i = sizeof(__le32); i < sizeof(struct iwl3945_notif_statistics);
374 i += sizeof(__le32), stats++, prev_stats++, delta++,
375 max_delta++, accum_stats++) {
376 if (le32_to_cpu(*stats) > le32_to_cpu(*prev_stats)) {
377 *delta = (le32_to_cpu(*stats) -
378 le32_to_cpu(*prev_stats));
379 *accum_stats += *delta;
380 if (*delta > *max_delta)
381 *max_delta = *delta;
382 }
383 }
384
385 /* reset accumulative statistics for "no-counter" type statistics */
386 priv->_3945.accum_statistics.general.temperature =
387 priv->_3945.statistics.general.temperature;
388 priv->_3945.accum_statistics.general.ttl_timestamp =
389 priv->_3945.statistics.general.ttl_timestamp;
390}
391#endif
353 392
354void iwl3945_hw_rx_statistics(struct iwl_priv *priv, 393void iwl3945_hw_rx_statistics(struct iwl_priv *priv,
355 struct iwl_rx_mem_buffer *rxb) 394 struct iwl_rx_mem_buffer *rxb)
356{ 395{
357 struct iwl_rx_packet *pkt = rxb_addr(rxb); 396 struct iwl_rx_packet *pkt = rxb_addr(rxb);
397
358 IWL_DEBUG_RX(priv, "Statistics notification received (%d vs %d).\n", 398 IWL_DEBUG_RX(priv, "Statistics notification received (%d vs %d).\n",
359 (int)sizeof(struct iwl3945_notif_statistics), 399 (int)sizeof(struct iwl3945_notif_statistics),
360 le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK); 400 le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK);
401#ifdef CONFIG_IWLWIFI_DEBUG
402 iwl3945_accumulative_statistics(priv, (__le32 *)&pkt->u.raw);
403#endif
361 404
362 memcpy(&priv->_3945.statistics, pkt->u.raw, sizeof(priv->_3945.statistics)); 405 memcpy(&priv->_3945.statistics, pkt->u.raw, sizeof(priv->_3945.statistics));
363} 406}
364 407
408void iwl3945_reply_statistics(struct iwl_priv *priv,
409 struct iwl_rx_mem_buffer *rxb)
410{
411 struct iwl_rx_packet *pkt = rxb_addr(rxb);
412 __le32 *flag = (__le32 *)&pkt->u.raw;
413
414 if (le32_to_cpu(*flag) & UCODE_STATISTICS_CLEAR_MSK) {
415#ifdef CONFIG_IWLWIFI_DEBUG
416 memset(&priv->_3945.accum_statistics, 0,
417 sizeof(struct iwl3945_notif_statistics));
418 memset(&priv->_3945.delta_statistics, 0,
419 sizeof(struct iwl3945_notif_statistics));
420 memset(&priv->_3945.max_delta, 0,
421 sizeof(struct iwl3945_notif_statistics));
422#endif
423 IWL_DEBUG_RX(priv, "Statistics have been cleared\n");
424 }
425 iwl3945_hw_rx_statistics(priv, rxb);
426}
427
428
365/****************************************************************************** 429/******************************************************************************
366 * 430 *
367 * Misc. internal state and helper functions 431 * Misc. internal state and helper functions
@@ -2735,6 +2799,12 @@ static struct iwl_lib_ops iwl3945_lib = {
2735 .isr = iwl_isr_legacy, 2799 .isr = iwl_isr_legacy,
2736 .config_ap = iwl3945_config_ap, 2800 .config_ap = iwl3945_config_ap,
2737 .add_bcast_station = iwl3945_add_bcast_station, 2801 .add_bcast_station = iwl3945_add_bcast_station,
2802
2803 .debugfs_ops = {
2804 .rx_stats_read = iwl3945_ucode_rx_stats_read,
2805 .tx_stats_read = iwl3945_ucode_tx_stats_read,
2806 .general_stats_read = iwl3945_ucode_general_stats_read,
2807 },
2738}; 2808};
2739 2809
2740static struct iwl_hcmd_utils_ops iwl3945_hcmd_utils = { 2810static struct iwl_hcmd_utils_ops iwl3945_hcmd_utils = {
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h
index e9674f0a1e94..643adb644bb8 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.h
@@ -264,6 +264,8 @@ extern int iwl3945_hw_reg_send_txpower(struct iwl_priv *priv);
264extern int iwl3945_hw_reg_set_txpower(struct iwl_priv *priv, s8 power); 264extern int iwl3945_hw_reg_set_txpower(struct iwl_priv *priv, s8 power);
265extern void iwl3945_hw_rx_statistics(struct iwl_priv *priv, 265extern void iwl3945_hw_rx_statistics(struct iwl_priv *priv,
266 struct iwl_rx_mem_buffer *rxb); 266 struct iwl_rx_mem_buffer *rxb);
267void iwl3945_reply_statistics(struct iwl_priv *priv,
268 struct iwl_rx_mem_buffer *rxb);
267extern void iwl3945_disable_events(struct iwl_priv *priv); 269extern void iwl3945_disable_events(struct iwl_priv *priv);
268extern int iwl4965_get_temperature(const struct iwl_priv *priv); 270extern int iwl4965_get_temperature(const struct iwl_priv *priv);
269extern void iwl3945_post_associate(struct iwl_priv *priv); 271extern void iwl3945_post_associate(struct iwl_priv *priv);
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index e43493685271..115d3ea1142f 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -200,26 +200,57 @@ static int iwl5000_hw_set_hw_params(struct iwl_priv *priv)
200 200
201 /* Set initial sensitivity parameters */ 201 /* Set initial sensitivity parameters */
202 /* Set initial calibration set */ 202 /* Set initial calibration set */
203 switch (priv->hw_rev & CSR_HW_REV_TYPE_MSK) { 203 priv->hw_params.sens = &iwl5000_sensitivity;
204 case CSR_HW_REV_TYPE_5150: 204 priv->hw_params.calib_init_cfg =
205 priv->hw_params.sens = &iwl5150_sensitivity; 205 BIT(IWL_CALIB_XTAL) |
206 priv->hw_params.calib_init_cfg = 206 BIT(IWL_CALIB_LO) |
207 BIT(IWL_CALIB_DC) | 207 BIT(IWL_CALIB_TX_IQ) |
208 BIT(IWL_CALIB_LO) | 208 BIT(IWL_CALIB_TX_IQ_PERD) |
209 BIT(IWL_CALIB_TX_IQ) | 209 BIT(IWL_CALIB_BASE_BAND);
210 BIT(IWL_CALIB_BASE_BAND); 210
211 211 return 0;
212 break; 212}
213 default: 213
214 priv->hw_params.sens = &iwl5000_sensitivity; 214static int iwl5150_hw_set_hw_params(struct iwl_priv *priv)
215 priv->hw_params.calib_init_cfg = 215{
216 BIT(IWL_CALIB_XTAL) | 216 if (priv->cfg->mod_params->num_of_queues >= IWL_MIN_NUM_QUEUES &&
217 BIT(IWL_CALIB_LO) | 217 priv->cfg->mod_params->num_of_queues <= IWLAGN_NUM_QUEUES)
218 BIT(IWL_CALIB_TX_IQ) | 218 priv->cfg->num_of_queues =
219 BIT(IWL_CALIB_TX_IQ_PERD) | 219 priv->cfg->mod_params->num_of_queues;
220 BIT(IWL_CALIB_BASE_BAND); 220
221 break; 221 priv->hw_params.max_txq_num = priv->cfg->num_of_queues;
222 } 222 priv->hw_params.dma_chnl_num = FH50_TCSR_CHNL_NUM;
223 priv->hw_params.scd_bc_tbls_size =
224 priv->cfg->num_of_queues *
225 sizeof(struct iwlagn_scd_bc_tbl);
226 priv->hw_params.tfd_size = sizeof(struct iwl_tfd);
227 priv->hw_params.max_stations = IWL5000_STATION_COUNT;
228 priv->hw_params.bcast_sta_id = IWL5000_BROADCAST_ID;
229
230 priv->hw_params.max_data_size = IWLAGN_RTC_DATA_SIZE;
231 priv->hw_params.max_inst_size = IWLAGN_RTC_INST_SIZE;
232
233 priv->hw_params.max_bsm_size = 0;
234 priv->hw_params.ht40_channel = BIT(IEEE80211_BAND_2GHZ) |
235 BIT(IEEE80211_BAND_5GHZ);
236 priv->hw_params.rx_wrt_ptr_reg = FH_RSCSR_CHNL0_WPTR;
237
238 priv->hw_params.tx_chains_num = num_of_ant(priv->cfg->valid_tx_ant);
239 priv->hw_params.rx_chains_num = num_of_ant(priv->cfg->valid_rx_ant);
240 priv->hw_params.valid_tx_ant = priv->cfg->valid_tx_ant;
241 priv->hw_params.valid_rx_ant = priv->cfg->valid_rx_ant;
242
243 if (priv->cfg->ops->lib->temp_ops.set_ct_kill)
244 priv->cfg->ops->lib->temp_ops.set_ct_kill(priv);
245
246 /* Set initial sensitivity parameters */
247 /* Set initial calibration set */
248 priv->hw_params.sens = &iwl5150_sensitivity;
249 priv->hw_params.calib_init_cfg =
250 BIT(IWL_CALIB_DC) |
251 BIT(IWL_CALIB_LO) |
252 BIT(IWL_CALIB_TX_IQ) |
253 BIT(IWL_CALIB_BASE_BAND);
223 254
224 return 0; 255 return 0;
225} 256}
@@ -332,7 +363,7 @@ static struct iwl_lib_ops iwl5000_lib = {
332}; 363};
333 364
334static struct iwl_lib_ops iwl5150_lib = { 365static struct iwl_lib_ops iwl5150_lib = {
335 .set_hw_params = iwl5000_hw_set_hw_params, 366 .set_hw_params = iwl5150_hw_set_hw_params,
336 .txq_update_byte_cnt_tbl = iwlagn_txq_update_byte_cnt_tbl, 367 .txq_update_byte_cnt_tbl = iwlagn_txq_update_byte_cnt_tbl,
337 .txq_inval_byte_cnt_tbl = iwlagn_txq_inval_byte_cnt_tbl, 368 .txq_inval_byte_cnt_tbl = iwlagn_txq_inval_byte_cnt_tbl,
338 .txq_set_sched = iwlagn_txq_set_sched, 369 .txq_set_sched = iwlagn_txq_set_sched,
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c
index 7da23d3ff7b6..7acef703253a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-6000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-6000.c
@@ -176,24 +176,56 @@ static int iwl6000_hw_set_hw_params(struct iwl_priv *priv)
176 /* Set initial sensitivity parameters */ 176 /* Set initial sensitivity parameters */
177 /* Set initial calibration set */ 177 /* Set initial calibration set */
178 priv->hw_params.sens = &iwl6000_sensitivity; 178 priv->hw_params.sens = &iwl6000_sensitivity;
179 switch (priv->hw_rev & CSR_HW_REV_TYPE_MSK) { 179 priv->hw_params.calib_init_cfg =
180 case CSR_HW_REV_TYPE_6x50: 180 BIT(IWL_CALIB_XTAL) |
181 priv->hw_params.calib_init_cfg = 181 BIT(IWL_CALIB_LO) |
182 BIT(IWL_CALIB_XTAL) | 182 BIT(IWL_CALIB_TX_IQ) |
183 BIT(IWL_CALIB_DC) | 183 BIT(IWL_CALIB_BASE_BAND);
184 BIT(IWL_CALIB_LO) | 184
185 BIT(IWL_CALIB_TX_IQ) | 185 return 0;
186 BIT(IWL_CALIB_BASE_BAND); 186}
187 187
188 break; 188static int iwl6050_hw_set_hw_params(struct iwl_priv *priv)
189 default: 189{
190 priv->hw_params.calib_init_cfg = 190 if (priv->cfg->mod_params->num_of_queues >= IWL_MIN_NUM_QUEUES &&
191 BIT(IWL_CALIB_XTAL) | 191 priv->cfg->mod_params->num_of_queues <= IWLAGN_NUM_QUEUES)
192 BIT(IWL_CALIB_LO) | 192 priv->cfg->num_of_queues =
193 BIT(IWL_CALIB_TX_IQ) | 193 priv->cfg->mod_params->num_of_queues;
194 BIT(IWL_CALIB_BASE_BAND); 194
195 break; 195 priv->hw_params.max_txq_num = priv->cfg->num_of_queues;
196 } 196 priv->hw_params.dma_chnl_num = FH50_TCSR_CHNL_NUM;
197 priv->hw_params.scd_bc_tbls_size =
198 priv->cfg->num_of_queues *
199 sizeof(struct iwlagn_scd_bc_tbl);
200 priv->hw_params.tfd_size = sizeof(struct iwl_tfd);
201 priv->hw_params.max_stations = IWL5000_STATION_COUNT;
202 priv->hw_params.bcast_sta_id = IWL5000_BROADCAST_ID;
203
204 priv->hw_params.max_data_size = IWL60_RTC_DATA_SIZE;
205 priv->hw_params.max_inst_size = IWL60_RTC_INST_SIZE;
206
207 priv->hw_params.max_bsm_size = 0;
208 priv->hw_params.ht40_channel = BIT(IEEE80211_BAND_2GHZ) |
209 BIT(IEEE80211_BAND_5GHZ);
210 priv->hw_params.rx_wrt_ptr_reg = FH_RSCSR_CHNL0_WPTR;
211
212 priv->hw_params.tx_chains_num = num_of_ant(priv->cfg->valid_tx_ant);
213 priv->hw_params.rx_chains_num = num_of_ant(priv->cfg->valid_rx_ant);
214 priv->hw_params.valid_tx_ant = priv->cfg->valid_tx_ant;
215 priv->hw_params.valid_rx_ant = priv->cfg->valid_rx_ant;
216
217 if (priv->cfg->ops->lib->temp_ops.set_ct_kill)
218 priv->cfg->ops->lib->temp_ops.set_ct_kill(priv);
219
220 /* Set initial sensitivity parameters */
221 /* Set initial calibration set */
222 priv->hw_params.sens = &iwl6000_sensitivity;
223 priv->hw_params.calib_init_cfg =
224 BIT(IWL_CALIB_XTAL) |
225 BIT(IWL_CALIB_DC) |
226 BIT(IWL_CALIB_LO) |
227 BIT(IWL_CALIB_TX_IQ) |
228 BIT(IWL_CALIB_BASE_BAND);
197 229
198 return 0; 230 return 0;
199} 231}
@@ -304,7 +336,7 @@ static const struct iwl_ops iwl6000_ops = {
304}; 336};
305 337
306static struct iwl_lib_ops iwl6050_lib = { 338static struct iwl_lib_ops iwl6050_lib = {
307 .set_hw_params = iwl6000_hw_set_hw_params, 339 .set_hw_params = iwl6050_hw_set_hw_params,
308 .txq_update_byte_cnt_tbl = iwlagn_txq_update_byte_cnt_tbl, 340 .txq_update_byte_cnt_tbl = iwlagn_txq_update_byte_cnt_tbl,
309 .txq_inval_byte_cnt_tbl = iwlagn_txq_inval_byte_cnt_tbl, 341 .txq_inval_byte_cnt_tbl = iwlagn_txq_inval_byte_cnt_tbl,
310 .txq_set_sched = iwlagn_txq_set_sched, 342 .txq_set_sched = iwlagn_txq_set_sched,
@@ -468,7 +500,6 @@ struct iwl_cfg iwl6000i_2abg_cfg = {
468 .pa_type = IWL_PA_INTERNAL, 500 .pa_type = IWL_PA_INTERNAL,
469 .max_ll_items = OTP_MAX_LL_ITEMS_6x00, 501 .max_ll_items = OTP_MAX_LL_ITEMS_6x00,
470 .shadow_ram_support = true, 502 .shadow_ram_support = true,
471 .ht_greenfield_support = true,
472 .led_compensation = 51, 503 .led_compensation = 51,
473 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, 504 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
474 .supports_idle = true, 505 .supports_idle = true,
@@ -501,7 +532,6 @@ struct iwl_cfg iwl6000i_2bg_cfg = {
501 .pa_type = IWL_PA_INTERNAL, 532 .pa_type = IWL_PA_INTERNAL,
502 .max_ll_items = OTP_MAX_LL_ITEMS_6x00, 533 .max_ll_items = OTP_MAX_LL_ITEMS_6x00,
503 .shadow_ram_support = true, 534 .shadow_ram_support = true,
504 .ht_greenfield_support = true,
505 .led_compensation = 51, 535 .led_compensation = 51,
506 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, 536 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
507 .supports_idle = true, 537 .supports_idle = true,
@@ -568,7 +598,6 @@ struct iwl_cfg iwl6050_2abg_cfg = {
568 .pa_type = IWL_PA_SYSTEM, 598 .pa_type = IWL_PA_SYSTEM,
569 .max_ll_items = OTP_MAX_LL_ITEMS_6x50, 599 .max_ll_items = OTP_MAX_LL_ITEMS_6x50,
570 .shadow_ram_support = true, 600 .shadow_ram_support = true,
571 .ht_greenfield_support = true,
572 .led_compensation = 51, 601 .led_compensation = 51,
573 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, 602 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
574 .supports_idle = true, 603 .supports_idle = true,
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
index 4bd0aecc7713..a27347425968 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
@@ -1395,16 +1395,29 @@ void iwlagn_request_scan(struct iwl_priv *priv)
1395 rate = IWL_RATE_1M_PLCP; 1395 rate = IWL_RATE_1M_PLCP;
1396 rate_flags = RATE_MCS_CCK_MSK; 1396 rate_flags = RATE_MCS_CCK_MSK;
1397 } 1397 }
1398 scan->good_CRC_th = 0; 1398 scan->good_CRC_th = IWL_GOOD_CRC_TH_DISABLED;
1399 break; 1399 break;
1400 case IEEE80211_BAND_5GHZ: 1400 case IEEE80211_BAND_5GHZ:
1401 rate = IWL_RATE_6M_PLCP; 1401 rate = IWL_RATE_6M_PLCP;
1402 /* 1402 /*
1403 * If active scaning is requested but a certain channel 1403 * If active scanning is requested but a certain channel is
1404 * is marked passive, we can do active scanning if we 1404 * marked passive, we can do active scanning if we detect
1405 * detect transmissions. 1405 * transmissions.
1406 *
1407 * There is an issue with some firmware versions that triggers
1408 * a sysassert on a "good CRC threshold" of zero (== disabled),
1409 * on a radar channel even though this means that we should NOT
1410 * send probes.
1411 *
1412 * The "good CRC threshold" is the number of frames that we
1413 * need to receive during our dwell time on a channel before
1414 * sending out probes -- setting this to a huge value will
1415 * mean we never reach it, but at the same time work around
1416 * the aforementioned issue. Thus use IWL_GOOD_CRC_TH_NEVER
1417 * here instead of IWL_GOOD_CRC_TH_DISABLED.
1406 */ 1418 */
1407 scan->good_CRC_th = is_active ? IWL_GOOD_CRC_TH : 0; 1419 scan->good_CRC_th = is_active ? IWL_GOOD_CRC_TH_DEFAULT :
1420 IWL_GOOD_CRC_TH_NEVER;
1408 break; 1421 break;
1409 default: 1422 default:
1410 IWL_WARN(priv, "Invalid scan band count\n"); 1423 IWL_WARN(priv, "Invalid scan band count\n");
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
index 8f8d5e3e688d..f01f242659c3 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
@@ -867,14 +867,14 @@ static void rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband,
867 rs_get_tbl_info_from_mcs(tx_rate, priv->band, &tbl_type, 867 rs_get_tbl_info_from_mcs(tx_rate, priv->band, &tbl_type,
868 &rs_index); 868 &rs_index);
869 rs_collect_tx_data(curr_tbl, rs_index, 869 rs_collect_tx_data(curr_tbl, rs_index,
870 info->status.ampdu_ack_len, 870 info->status.ampdu_len,
871 info->status.ampdu_ack_map); 871 info->status.ampdu_ack_len);
872 872
873 /* Update success/fail counts if not searching for new mode */ 873 /* Update success/fail counts if not searching for new mode */
874 if (lq_sta->stay_in_tbl) { 874 if (lq_sta->stay_in_tbl) {
875 lq_sta->total_success += info->status.ampdu_ack_map; 875 lq_sta->total_success += info->status.ampdu_ack_len;
876 lq_sta->total_failed += (info->status.ampdu_ack_len - 876 lq_sta->total_failed += (info->status.ampdu_len -
877 info->status.ampdu_ack_map); 877 info->status.ampdu_ack_len);
878 } 878 }
879 } else { 879 } else {
880 /* 880 /*
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
index 11661fa28f21..c2a5c85542bf 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
@@ -83,6 +83,15 @@ static inline int get_fifo_from_ac(u8 ac)
83 return ac_to_fifo[ac]; 83 return ac_to_fifo[ac];
84} 84}
85 85
86static inline int get_ac_from_tid(u16 tid)
87{
88 if (likely(tid < ARRAY_SIZE(tid_to_ac)))
89 return tid_to_ac[tid];
90
91 /* no support for TIDs 8-15 yet */
92 return -EINVAL;
93}
94
86static inline int get_fifo_from_tid(u16 tid) 95static inline int get_fifo_from_tid(u16 tid)
87{ 96{
88 if (likely(tid < ARRAY_SIZE(tid_to_ac))) 97 if (likely(tid < ARRAY_SIZE(tid_to_ac)))
@@ -991,7 +1000,7 @@ int iwlagn_tx_agg_start(struct iwl_priv *priv, const u8 *ra, u16 tid, u16 *ssn)
991 tid_data = &priv->stations[sta_id].tid[tid]; 1000 tid_data = &priv->stations[sta_id].tid[tid];
992 *ssn = SEQ_TO_SN(tid_data->seq_number); 1001 *ssn = SEQ_TO_SN(tid_data->seq_number);
993 tid_data->agg.txq_id = txq_id; 1002 tid_data->agg.txq_id = txq_id;
994 priv->txq[txq_id].swq_id = iwl_virtual_agg_queue_num(tx_fifo, txq_id); 1003 priv->txq[txq_id].swq_id = iwl_virtual_agg_queue_num(get_ac_from_tid(tid), txq_id);
995 spin_unlock_irqrestore(&priv->sta_lock, flags); 1004 spin_unlock_irqrestore(&priv->sta_lock, flags);
996 1005
997 ret = priv->cfg->ops->lib->txq_agg_enable(priv, txq_id, tx_fifo, 1006 ret = priv->cfg->ops->lib->txq_agg_enable(priv, txq_id, tx_fifo,
@@ -1224,8 +1233,9 @@ static int iwlagn_tx_status_reply_compressed_ba(struct iwl_priv *priv,
1224 memset(&info->status, 0, sizeof(info->status)); 1233 memset(&info->status, 0, sizeof(info->status));
1225 info->flags |= IEEE80211_TX_STAT_ACK; 1234 info->flags |= IEEE80211_TX_STAT_ACK;
1226 info->flags |= IEEE80211_TX_STAT_AMPDU; 1235 info->flags |= IEEE80211_TX_STAT_AMPDU;
1227 info->status.ampdu_ack_map = successes; 1236 info->status.ampdu_ack_len = successes;
1228 info->status.ampdu_ack_len = agg->frame_count; 1237 info->status.ampdu_ack_map = bitmap;
1238 info->status.ampdu_len = agg->frame_count;
1229 iwlagn_hwrate_to_tx_control(priv, agg->rate_n_flags, info); 1239 iwlagn_hwrate_to_tx_control(priv, agg->rate_n_flags, info);
1230 1240
1231 IWL_DEBUG_TX_REPLY(priv, "Bitmap %llx\n", (unsigned long long)bitmap); 1241 IWL_DEBUG_TX_REPLY(priv, "Bitmap %llx\n", (unsigned long long)bitmap);
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 0cd338631592..d18c61223ac5 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -3000,18 +3000,6 @@ static int iwl_mac_ampdu_action(struct ieee80211_hw *hw,
3000 return 0; 3000 return 0;
3001} 3001}
3002 3002
3003static int iwl_mac_get_stats(struct ieee80211_hw *hw,
3004 struct ieee80211_low_level_stats *stats)
3005{
3006 struct iwl_priv *priv = hw->priv;
3007
3008 priv = hw->priv;
3009 IWL_DEBUG_MAC80211(priv, "enter\n");
3010 IWL_DEBUG_MAC80211(priv, "leave\n");
3011
3012 return 0;
3013}
3014
3015static void iwl_mac_sta_notify(struct ieee80211_hw *hw, 3003static void iwl_mac_sta_notify(struct ieee80211_hw *hw,
3016 struct ieee80211_vif *vif, 3004 struct ieee80211_vif *vif,
3017 enum sta_notify_cmd cmd, 3005 enum sta_notify_cmd cmd,
@@ -3389,7 +3377,6 @@ static struct ieee80211_ops iwl_hw_ops = {
3389 .configure_filter = iwl_configure_filter, 3377 .configure_filter = iwl_configure_filter,
3390 .set_key = iwl_mac_set_key, 3378 .set_key = iwl_mac_set_key,
3391 .update_tkip_key = iwl_mac_update_tkip_key, 3379 .update_tkip_key = iwl_mac_update_tkip_key,
3392 .get_stats = iwl_mac_get_stats,
3393 .conf_tx = iwl_mac_conf_tx, 3380 .conf_tx = iwl_mac_conf_tx,
3394 .reset_tsf = iwl_mac_reset_tsf, 3381 .reset_tsf = iwl_mac_reset_tsf,
3395 .bss_info_changed = iwl_bss_info_changed, 3382 .bss_info_changed = iwl_bss_info_changed,
diff --git a/drivers/net/wireless/iwlwifi/iwl-commands.h b/drivers/net/wireless/iwlwifi/iwl-commands.h
index 67c723cc32d2..0086019b7a15 100644
--- a/drivers/net/wireless/iwlwifi/iwl-commands.h
+++ b/drivers/net/wireless/iwlwifi/iwl-commands.h
@@ -2663,7 +2663,9 @@ struct iwl_ssid_ie {
2663#define PROBE_OPTION_MAX_3945 4 2663#define PROBE_OPTION_MAX_3945 4
2664#define PROBE_OPTION_MAX 20 2664#define PROBE_OPTION_MAX 20
2665#define TX_CMD_LIFE_TIME_INFINITE cpu_to_le32(0xFFFFFFFF) 2665#define TX_CMD_LIFE_TIME_INFINITE cpu_to_le32(0xFFFFFFFF)
2666#define IWL_GOOD_CRC_TH cpu_to_le16(1) 2666#define IWL_GOOD_CRC_TH_DISABLED 0
2667#define IWL_GOOD_CRC_TH_DEFAULT cpu_to_le16(1)
2668#define IWL_GOOD_CRC_TH_NEVER cpu_to_le16(0xffff)
2667#define IWL_MAX_SCAN_SIZE 1024 2669#define IWL_MAX_SCAN_SIZE 1024
2668#define IWL_MAX_CMD_SIZE 4096 2670#define IWL_MAX_CMD_SIZE 4096
2669#define IWL_MAX_PROBE_REQUEST 200 2671#define IWL_MAX_PROBE_REQUEST 200
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index 457dc196ffdc..1e11706dcf63 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -2116,10 +2116,6 @@ EXPORT_SYMBOL(iwl_mac_remove_interface);
2116 2116
2117/** 2117/**
2118 * iwl_mac_config - mac80211 config callback 2118 * iwl_mac_config - mac80211 config callback
2119 *
2120 * We ignore conf->flags & IEEE80211_CONF_SHORT_SLOT_TIME since it seems to
2121 * be set inappropriately and the driver currently sets the hardware up to
2122 * use it whenever needed.
2123 */ 2119 */
2124int iwl_mac_config(struct ieee80211_hw *hw, u32 changed) 2120int iwl_mac_config(struct ieee80211_hw *hw, u32 changed)
2125{ 2121{
@@ -2934,6 +2930,12 @@ int iwl_pci_resume(struct pci_dev *pdev)
2934 struct iwl_priv *priv = pci_get_drvdata(pdev); 2930 struct iwl_priv *priv = pci_get_drvdata(pdev);
2935 int ret; 2931 int ret;
2936 2932
2933 /*
2934 * We disable the RETRY_TIMEOUT register (0x41) to keep
2935 * PCI Tx retries from interfering with C3 CPU state.
2936 */
2937 pci_write_config_byte(pdev, PCI_CFG_RETRY_TIMEOUT, 0x00);
2938
2937 pci_set_power_state(pdev, PCI_D0); 2939 pci_set_power_state(pdev, PCI_D0);
2938 ret = pci_enable_device(pdev); 2940 ret = pci_enable_device(pdev);
2939 if (ret) 2941 if (ret)
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
index d789f8db4481..0aedbec9cbc8 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
@@ -1053,10 +1053,8 @@ static ssize_t iwl_dbgfs_ucode_rx_stats_read(struct file *file,
1053 size_t count, loff_t *ppos) 1053 size_t count, loff_t *ppos)
1054{ 1054{
1055 struct iwl_priv *priv = file->private_data; 1055 struct iwl_priv *priv = file->private_data;
1056 if (priv->cfg->ops->lib->debugfs_ops.rx_stats_read) 1056 return priv->cfg->ops->lib->debugfs_ops.rx_stats_read(file,
1057 return priv->cfg->ops->lib->debugfs_ops.rx_stats_read(file, 1057 user_buf, count, ppos);
1058 user_buf, count, ppos);
1059 return 0;
1060} 1058}
1061 1059
1062static ssize_t iwl_dbgfs_ucode_tx_stats_read(struct file *file, 1060static ssize_t iwl_dbgfs_ucode_tx_stats_read(struct file *file,
@@ -1064,10 +1062,8 @@ static ssize_t iwl_dbgfs_ucode_tx_stats_read(struct file *file,
1064 size_t count, loff_t *ppos) 1062 size_t count, loff_t *ppos)
1065{ 1063{
1066 struct iwl_priv *priv = file->private_data; 1064 struct iwl_priv *priv = file->private_data;
1067 if (priv->cfg->ops->lib->debugfs_ops.tx_stats_read) 1065 return priv->cfg->ops->lib->debugfs_ops.tx_stats_read(file,
1068 return priv->cfg->ops->lib->debugfs_ops.tx_stats_read(file, 1066 user_buf, count, ppos);
1069 user_buf, count, ppos);
1070 return 0;
1071} 1067}
1072 1068
1073static ssize_t iwl_dbgfs_ucode_general_stats_read(struct file *file, 1069static ssize_t iwl_dbgfs_ucode_general_stats_read(struct file *file,
@@ -1075,10 +1071,8 @@ static ssize_t iwl_dbgfs_ucode_general_stats_read(struct file *file,
1075 size_t count, loff_t *ppos) 1071 size_t count, loff_t *ppos)
1076{ 1072{
1077 struct iwl_priv *priv = file->private_data; 1073 struct iwl_priv *priv = file->private_data;
1078 if (priv->cfg->ops->lib->debugfs_ops.general_stats_read) 1074 return priv->cfg->ops->lib->debugfs_ops.general_stats_read(file,
1079 return priv->cfg->ops->lib->debugfs_ops.general_stats_read(file, 1075 user_buf, count, ppos);
1080 user_buf, count, ppos);
1081 return 0;
1082} 1076}
1083 1077
1084static ssize_t iwl_dbgfs_sensitivity_read(struct file *file, 1078static ssize_t iwl_dbgfs_sensitivity_read(struct file *file,
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index bdc60aae75ec..58c69a5798d4 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -1202,6 +1202,11 @@ struct iwl_priv {
1202 struct delayed_work rfkill_poll; 1202 struct delayed_work rfkill_poll;
1203 1203
1204 struct iwl3945_notif_statistics statistics; 1204 struct iwl3945_notif_statistics statistics;
1205#ifdef CONFIG_IWLWIFI_DEBUG
1206 struct iwl3945_notif_statistics accum_statistics;
1207 struct iwl3945_notif_statistics delta_statistics;
1208 struct iwl3945_notif_statistics max_delta;
1209#endif
1205 1210
1206 u32 sta_supp_rates; 1211 u32 sta_supp_rates;
1207 int last_rx_rssi; /* From Rx packet statistics */ 1212 int last_rx_rssi; /* From Rx packet statistics */
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index c9da39d7c414..867d105c7f08 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -956,7 +956,7 @@ static void iwl3945_setup_rx_handlers(struct iwl_priv *priv)
956 * statistics request from the host as well as for the periodic 956 * statistics request from the host as well as for the periodic
957 * statistics notifications (after received beacons) from the uCode. 957 * statistics notifications (after received beacons) from the uCode.
958 */ 958 */
959 priv->rx_handlers[REPLY_STATISTICS_CMD] = iwl3945_hw_rx_statistics; 959 priv->rx_handlers[REPLY_STATISTICS_CMD] = iwl3945_reply_statistics;
960 priv->rx_handlers[STATISTICS_NOTIFICATION] = iwl3945_hw_rx_statistics; 960 priv->rx_handlers[STATISTICS_NOTIFICATION] = iwl3945_hw_rx_statistics;
961 961
962 iwl_setup_rx_scan_handlers(priv); 962 iwl_setup_rx_scan_handlers(priv);
@@ -2938,7 +2938,8 @@ void iwl3945_request_scan(struct iwl_priv *priv)
2938 * is marked passive, we can do active scanning if we 2938 * is marked passive, we can do active scanning if we
2939 * detect transmissions. 2939 * detect transmissions.
2940 */ 2940 */
2941 scan->good_CRC_th = is_active ? IWL_GOOD_CRC_TH : 0; 2941 scan->good_CRC_th = is_active ? IWL_GOOD_CRC_TH_DEFAULT :
2942 IWL_GOOD_CRC_TH_DISABLED;
2942 band = IEEE80211_BAND_5GHZ; 2943 band = IEEE80211_BAND_5GHZ;
2943 break; 2944 break;
2944 default: 2945 default:
diff --git a/drivers/net/wireless/p54/p54pci.c b/drivers/net/wireless/p54/p54pci.c
index fc67888db0ca..d7b9f48b3d3f 100644
--- a/drivers/net/wireless/p54/p54pci.c
+++ b/drivers/net/wireless/p54/p54pci.c
@@ -245,7 +245,7 @@ static void p54p_check_tx_ring(struct ieee80211_hw *dev, u32 *index,
245 u32 idx, i; 245 u32 idx, i;
246 246
247 i = (*index) % ring_limit; 247 i = (*index) % ring_limit;
248 (*index) = idx = le32_to_cpu(ring_control->device_idx[1]); 248 (*index) = idx = le32_to_cpu(ring_control->device_idx[ring_index]);
249 idx %= ring_limit; 249 idx %= ring_limit;
250 250
251 while (i != idx) { 251 while (i != idx) {