aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2005-07-31 13:07:36 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-07-31 13:07:36 -0400
commit4fa969cfb2a6406fcffd0d1ec5f33ebf3fea9053 (patch)
treee6d62bb802fade3a58cd3d67dcd5bd7e2a2878f1 /drivers/net
parent24735354f3074fa90b185b8cd7cb13fd53c39e6b (diff)
parentbf79451ec5862510b402c112c039698e68d0c250 (diff)
/spare/repo/netdev-2.6 branch 'ieee80211'
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/ipw2200.c1600
-rw-r--r--drivers/net/wireless/ipw2200.h234
2 files changed, 917 insertions, 917 deletions
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c
index 133666d43d7e..5df203155aa3 100644
--- a/drivers/net/wireless/ipw2200.c
+++ b/drivers/net/wireless/ipw2200.c
@@ -1,5 +1,5 @@
1/****************************************************************************** 1/******************************************************************************
2 2
3 Copyright(c) 2003 - 2004 Intel Corporation. All rights reserved. 3 Copyright(c) 2003 - 2004 Intel Corporation. All rights reserved.
4 4
5 802.11 status code portion of this file from ethereal-0.10.6: 5 802.11 status code portion of this file from ethereal-0.10.6:
@@ -8,22 +8,22 @@
8 By Gerald Combs <gerald@ethereal.com> 8 By Gerald Combs <gerald@ethereal.com>
9 Copyright 1998 Gerald Combs 9 Copyright 1998 Gerald Combs
10 10
11 This program is free software; you can redistribute it and/or modify it 11 This program is free software; you can redistribute it and/or modify it
12 under the terms of version 2 of the GNU General Public License as 12 under the terms of version 2 of the GNU General Public License as
13 published by the Free Software Foundation. 13 published by the Free Software Foundation.
14 14
15 This program is distributed in the hope that it will be useful, but WITHOUT 15 This program is distributed in the hope that it will be useful, but WITHOUT
16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 17 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18 more details. 18 more details.
19 19
20 You should have received a copy of the GNU General Public License along with 20 You should have received a copy of the GNU General Public License along with
21 this program; if not, write to the Free Software Foundation, Inc., 59 21 this program; if not, write to the Free Software Foundation, Inc., 59
22 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 22 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 23
24 The full GNU General Public License is included in this distribution in the 24 The full GNU General Public License is included in this distribution in the
25 file called LICENSE. 25 file called LICENSE.
26 26
27 Contact Information: 27 Contact Information:
28 James P. Ketrenos <ipw2100-admin@linux.intel.com> 28 James P. Ketrenos <ipw2100-admin@linux.intel.com>
29 Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 29 Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
@@ -56,7 +56,7 @@ static const char ipw_modes[] = {
56}; 56};
57 57
58static void ipw_rx(struct ipw_priv *priv); 58static void ipw_rx(struct ipw_priv *priv);
59static int ipw_queue_tx_reclaim(struct ipw_priv *priv, 59static int ipw_queue_tx_reclaim(struct ipw_priv *priv,
60 struct clx2_tx_queue *txq, int qindex); 60 struct clx2_tx_queue *txq, int qindex);
61static int ipw_queue_reset(struct ipw_priv *priv); 61static int ipw_queue_reset(struct ipw_priv *priv);
62 62
@@ -101,23 +101,23 @@ static int is_valid_channel(int mode_mask, int channel)
101 return 0; 101 return 0;
102} 102}
103 103
104static char *snprint_line(char *buf, size_t count, 104static char *snprint_line(char *buf, size_t count,
105 const u8 *data, u32 len, u32 ofs) 105 const u8 *data, u32 len, u32 ofs)
106{ 106{
107 int out, i, j, l; 107 int out, i, j, l;
108 char c; 108 char c;
109 109
110 out = snprintf(buf, count, "%08X", ofs); 110 out = snprintf(buf, count, "%08X", ofs);
111 111
112 for (l = 0, i = 0; i < 2; i++) { 112 for (l = 0, i = 0; i < 2; i++) {
113 out += snprintf(buf + out, count - out, " "); 113 out += snprintf(buf + out, count - out, " ");
114 for (j = 0; j < 8 && l < len; j++, l++) 114 for (j = 0; j < 8 && l < len; j++, l++)
115 out += snprintf(buf + out, count - out, "%02X ", 115 out += snprintf(buf + out, count - out, "%02X ",
116 data[(i * 8 + j)]); 116 data[(i * 8 + j)]);
117 for (; j < 8; j++) 117 for (; j < 8; j++)
118 out += snprintf(buf + out, count - out, " "); 118 out += snprintf(buf + out, count - out, " ");
119 } 119 }
120 120
121 out += snprintf(buf + out, count - out, " "); 121 out += snprintf(buf + out, count - out, " ");
122 for (l = 0, i = 0; i < 2; i++) { 122 for (l = 0, i = 0; i < 2; i++) {
123 out += snprintf(buf + out, count - out, " "); 123 out += snprintf(buf + out, count - out, " ");
@@ -125,14 +125,14 @@ static char *snprint_line(char *buf, size_t count,
125 c = data[(i * 8 + j)]; 125 c = data[(i * 8 + j)];
126 if (!isascii(c) || !isprint(c)) 126 if (!isascii(c) || !isprint(c))
127 c = '.'; 127 c = '.';
128 128
129 out += snprintf(buf + out, count - out, "%c", c); 129 out += snprintf(buf + out, count - out, "%c", c);
130 } 130 }
131 131
132 for (; j < 8; j++) 132 for (; j < 8; j++)
133 out += snprintf(buf + out, count - out, " "); 133 out += snprintf(buf + out, count - out, " ");
134 } 134 }
135 135
136 return buf; 136 return buf;
137} 137}
138 138
@@ -145,7 +145,7 @@ static void printk_buf(int level, const u8 *data, u32 len)
145 145
146 while (len) { 146 while (len) {
147 printk(KERN_DEBUG "%s\n", 147 printk(KERN_DEBUG "%s\n",
148 snprint_line(line, sizeof(line), &data[ofs], 148 snprint_line(line, sizeof(line), &data[ofs],
149 min(len, 16U), ofs)); 149 min(len, 16U), ofs));
150 ofs += 16; 150 ofs += 16;
151 len -= min(len, 16U); 151 len -= min(len, 16U);
@@ -161,21 +161,21 @@ static u8 _ipw_read_reg8(struct ipw_priv *ipw, u32 reg);
161static void _ipw_write_reg8(struct ipw_priv *priv, u32 reg, u8 value); 161static void _ipw_write_reg8(struct ipw_priv *priv, u32 reg, u8 value);
162static inline void ipw_write_reg8(struct ipw_priv *a, u32 b, u8 c) 162static inline void ipw_write_reg8(struct ipw_priv *a, u32 b, u8 c)
163{ 163{
164 IPW_DEBUG_IO("%s %d: write_indirect8(0x%08X, 0x%08X)\n", __FILE__, __LINE__, (u32)(b), (u32)(c)); 164 IPW_DEBUG_IO("%s %d: write_indirect8(0x%08X, 0x%08X)\n", __FILE__, __LINE__, (u32)(b), (u32)(c));
165 _ipw_write_reg8(a, b, c); 165 _ipw_write_reg8(a, b, c);
166} 166}
167 167
168static void _ipw_write_reg16(struct ipw_priv *priv, u32 reg, u16 value); 168static void _ipw_write_reg16(struct ipw_priv *priv, u32 reg, u16 value);
169static inline void ipw_write_reg16(struct ipw_priv *a, u32 b, u16 c) 169static inline void ipw_write_reg16(struct ipw_priv *a, u32 b, u16 c)
170{ 170{
171 IPW_DEBUG_IO("%s %d: write_indirect16(0x%08X, 0x%08X)\n", __FILE__, __LINE__, (u32)(b), (u32)(c)); 171 IPW_DEBUG_IO("%s %d: write_indirect16(0x%08X, 0x%08X)\n", __FILE__, __LINE__, (u32)(b), (u32)(c));
172 _ipw_write_reg16(a, b, c); 172 _ipw_write_reg16(a, b, c);
173} 173}
174 174
175static void _ipw_write_reg32(struct ipw_priv *priv, u32 reg, u32 value); 175static void _ipw_write_reg32(struct ipw_priv *priv, u32 reg, u32 value);
176static inline void ipw_write_reg32(struct ipw_priv *a, u32 b, u32 c) 176static inline void ipw_write_reg32(struct ipw_priv *a, u32 b, u32 c)
177{ 177{
178 IPW_DEBUG_IO("%s %d: write_indirect32(0x%08X, 0x%08X)\n", __FILE__, __LINE__, (u32)(b), (u32)(c)); 178 IPW_DEBUG_IO("%s %d: write_indirect32(0x%08X, 0x%08X)\n", __FILE__, __LINE__, (u32)(b), (u32)(c));
179 _ipw_write_reg32(a, b, c); 179 _ipw_write_reg32(a, b, c);
180} 180}
181 181
@@ -229,7 +229,7 @@ static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 *data, int n
229static void _ipw_write_reg32(struct ipw_priv *priv, u32 reg, 229static void _ipw_write_reg32(struct ipw_priv *priv, u32 reg,
230 u32 value) 230 u32 value)
231{ 231{
232 IPW_DEBUG_IO(" %p : reg = 0x%8X : value = 0x%8X\n", 232 IPW_DEBUG_IO(" %p : reg = 0x%8X : value = 0x%8X\n",
233 priv, reg, value); 233 priv, reg, value);
234 _ipw_write32(priv, CX2_INDIRECT_ADDR, reg); 234 _ipw_write32(priv, CX2_INDIRECT_ADDR, reg);
235 _ipw_write32(priv, CX2_INDIRECT_DATA, value); 235 _ipw_write32(priv, CX2_INDIRECT_DATA, value);
@@ -241,7 +241,7 @@ static void _ipw_write_reg8(struct ipw_priv *priv, u32 reg, u8 value)
241 IPW_DEBUG_IO(" reg = 0x%8X : value = 0x%8X\n", reg, value); 241 IPW_DEBUG_IO(" reg = 0x%8X : value = 0x%8X\n", reg, value);
242 _ipw_write32(priv, CX2_INDIRECT_ADDR, reg & CX2_INDIRECT_ADDR_MASK); 242 _ipw_write32(priv, CX2_INDIRECT_ADDR, reg & CX2_INDIRECT_ADDR_MASK);
243 _ipw_write8(priv, CX2_INDIRECT_DATA, value); 243 _ipw_write8(priv, CX2_INDIRECT_DATA, value);
244 IPW_DEBUG_IO(" reg = 0x%8lX : value = 0x%8X\n", 244 IPW_DEBUG_IO(" reg = 0x%8lX : value = 0x%8X\n",
245 (unsigned long)(priv->hw_base + CX2_INDIRECT_DATA), 245 (unsigned long)(priv->hw_base + CX2_INDIRECT_DATA),
246 value); 246 value);
247} 247}
@@ -285,7 +285,7 @@ static void _ipw_read_indirect(struct ipw_priv *priv, u32 addr, u8 * buf,
285 u32 dif_len = addr - aligned_addr; 285 u32 dif_len = addr - aligned_addr;
286 u32 aligned_len; 286 u32 aligned_len;
287 u32 i; 287 u32 i;
288 288
289 IPW_DEBUG_IO("addr = %i, buf = %p, num = %i\n", addr, buf, num); 289 IPW_DEBUG_IO("addr = %i, buf = %p, num = %i\n", addr, buf, num);
290 290
291 /* Read the first nibble byte by byte */ 291 /* Read the first nibble byte by byte */
@@ -303,7 +303,7 @@ static void _ipw_read_indirect(struct ipw_priv *priv, u32 addr, u8 * buf,
303 aligned_len = num & CX2_INDIRECT_ADDR_MASK; 303 aligned_len = num & CX2_INDIRECT_ADDR_MASK;
304 for (i = 0; i < aligned_len; i += 4, buf += 4, aligned_addr += 4) 304 for (i = 0; i < aligned_len; i += 4, buf += 4, aligned_addr += 4)
305 *(u32*)buf = ipw_read32(priv, CX2_AUTOINC_DATA); 305 *(u32*)buf = ipw_read32(priv, CX2_AUTOINC_DATA);
306 306
307 /* Copy the last nibble */ 307 /* Copy the last nibble */
308 dif_len = num - aligned_len; 308 dif_len = num - aligned_len;
309 _ipw_write32(priv, CX2_INDIRECT_ADDR, aligned_addr); 309 _ipw_write32(priv, CX2_INDIRECT_ADDR, aligned_addr);
@@ -311,16 +311,16 @@ static void _ipw_read_indirect(struct ipw_priv *priv, u32 addr, u8 * buf,
311 *buf = ipw_read8(priv, CX2_INDIRECT_DATA + i); 311 *buf = ipw_read8(priv, CX2_INDIRECT_DATA + i);
312} 312}
313 313
314static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 *buf, 314static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 *buf,
315 int num) 315 int num)
316{ 316{
317 u32 aligned_addr = addr & CX2_INDIRECT_ADDR_MASK; 317 u32 aligned_addr = addr & CX2_INDIRECT_ADDR_MASK;
318 u32 dif_len = addr - aligned_addr; 318 u32 dif_len = addr - aligned_addr;
319 u32 aligned_len; 319 u32 aligned_len;
320 u32 i; 320 u32 i;
321 321
322 IPW_DEBUG_IO("addr = %i, buf = %p, num = %i\n", addr, buf, num); 322 IPW_DEBUG_IO("addr = %i, buf = %p, num = %i\n", addr, buf, num);
323 323
324 /* Write the first nibble byte by byte */ 324 /* Write the first nibble byte by byte */
325 if (unlikely(dif_len)) { 325 if (unlikely(dif_len)) {
326 /* Start writing at aligned_addr + dif_len */ 326 /* Start writing at aligned_addr + dif_len */
@@ -330,13 +330,13 @@ static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 *buf,
330 num -= dif_len; 330 num -= dif_len;
331 aligned_addr += 4; 331 aligned_addr += 4;
332 } 332 }
333 333
334 /* Write DWs through autoinc register */ 334 /* Write DWs through autoinc register */
335 _ipw_write32(priv, CX2_AUTOINC_ADDR, aligned_addr); 335 _ipw_write32(priv, CX2_AUTOINC_ADDR, aligned_addr);
336 aligned_len = num & CX2_INDIRECT_ADDR_MASK; 336 aligned_len = num & CX2_INDIRECT_ADDR_MASK;
337 for (i = 0; i < aligned_len; i += 4, buf += 4, aligned_addr += 4) 337 for (i = 0; i < aligned_len; i += 4, buf += 4, aligned_addr += 4)
338 _ipw_write32(priv, CX2_AUTOINC_DATA, *(u32*)buf); 338 _ipw_write32(priv, CX2_AUTOINC_DATA, *(u32*)buf);
339 339
340 /* Copy the last nibble */ 340 /* Copy the last nibble */
341 dif_len = num - aligned_len; 341 dif_len = num - aligned_len;
342 _ipw_write32(priv, CX2_INDIRECT_ADDR, aligned_addr); 342 _ipw_write32(priv, CX2_INDIRECT_ADDR, aligned_addr);
@@ -344,7 +344,7 @@ static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 *buf,
344 _ipw_write8(priv, CX2_INDIRECT_DATA + i, *buf); 344 _ipw_write8(priv, CX2_INDIRECT_DATA + i, *buf);
345} 345}
346 346
347static void ipw_write_direct(struct ipw_priv *priv, u32 addr, void *buf, 347static void ipw_write_direct(struct ipw_priv *priv, u32 addr, void *buf,
348 int num) 348 int num)
349{ 349{
350 memcpy_toio((priv->hw_base + addr), buf, num); 350 memcpy_toio((priv->hw_base + addr), buf, num);
@@ -379,37 +379,37 @@ static inline void ipw_disable_interrupts(struct ipw_priv *priv)
379static char *ipw_error_desc(u32 val) 379static char *ipw_error_desc(u32 val)
380{ 380{
381 switch (val) { 381 switch (val) {
382 case IPW_FW_ERROR_OK: 382 case IPW_FW_ERROR_OK:
383 return "ERROR_OK"; 383 return "ERROR_OK";
384 case IPW_FW_ERROR_FAIL: 384 case IPW_FW_ERROR_FAIL:
385 return "ERROR_FAIL"; 385 return "ERROR_FAIL";
386 case IPW_FW_ERROR_MEMORY_UNDERFLOW: 386 case IPW_FW_ERROR_MEMORY_UNDERFLOW:
387 return "MEMORY_UNDERFLOW"; 387 return "MEMORY_UNDERFLOW";
388 case IPW_FW_ERROR_MEMORY_OVERFLOW: 388 case IPW_FW_ERROR_MEMORY_OVERFLOW:
389 return "MEMORY_OVERFLOW"; 389 return "MEMORY_OVERFLOW";
390 case IPW_FW_ERROR_BAD_PARAM: 390 case IPW_FW_ERROR_BAD_PARAM:
391 return "ERROR_BAD_PARAM"; 391 return "ERROR_BAD_PARAM";
392 case IPW_FW_ERROR_BAD_CHECKSUM: 392 case IPW_FW_ERROR_BAD_CHECKSUM:
393 return "ERROR_BAD_CHECKSUM"; 393 return "ERROR_BAD_CHECKSUM";
394 case IPW_FW_ERROR_NMI_INTERRUPT: 394 case IPW_FW_ERROR_NMI_INTERRUPT:
395 return "ERROR_NMI_INTERRUPT"; 395 return "ERROR_NMI_INTERRUPT";
396 case IPW_FW_ERROR_BAD_DATABASE: 396 case IPW_FW_ERROR_BAD_DATABASE:
397 return "ERROR_BAD_DATABASE"; 397 return "ERROR_BAD_DATABASE";
398 case IPW_FW_ERROR_ALLOC_FAIL: 398 case IPW_FW_ERROR_ALLOC_FAIL:
399 return "ERROR_ALLOC_FAIL"; 399 return "ERROR_ALLOC_FAIL";
400 case IPW_FW_ERROR_DMA_UNDERRUN: 400 case IPW_FW_ERROR_DMA_UNDERRUN:
401 return "ERROR_DMA_UNDERRUN"; 401 return "ERROR_DMA_UNDERRUN";
402 case IPW_FW_ERROR_DMA_STATUS: 402 case IPW_FW_ERROR_DMA_STATUS:
403 return "ERROR_DMA_STATUS"; 403 return "ERROR_DMA_STATUS";
404 case IPW_FW_ERROR_DINOSTATUS_ERROR: 404 case IPW_FW_ERROR_DINOSTATUS_ERROR:
405 return "ERROR_DINOSTATUS_ERROR"; 405 return "ERROR_DINOSTATUS_ERROR";
406 case IPW_FW_ERROR_EEPROMSTATUS_ERROR: 406 case IPW_FW_ERROR_EEPROMSTATUS_ERROR:
407 return "ERROR_EEPROMSTATUS_ERROR"; 407 return "ERROR_EEPROMSTATUS_ERROR";
408 case IPW_FW_ERROR_SYSASSERT: 408 case IPW_FW_ERROR_SYSASSERT:
409 return "ERROR_SYSASSERT"; 409 return "ERROR_SYSASSERT";
410 case IPW_FW_ERROR_FATAL_ERROR: 410 case IPW_FW_ERROR_FATAL_ERROR:
411 return "ERROR_FATALSTATUS_ERROR"; 411 return "ERROR_FATALSTATUS_ERROR";
412 default: 412 default:
413 return "UNKNOWNSTATUS_ERROR"; 413 return "UNKNOWNSTATUS_ERROR";
414 } 414 }
415} 415}
@@ -420,15 +420,15 @@ static void ipw_dump_nic_error_log(struct ipw_priv *priv)
420 420
421 base = ipw_read32(priv, IPWSTATUS_ERROR_LOG); 421 base = ipw_read32(priv, IPWSTATUS_ERROR_LOG);
422 count = ipw_read_reg32(priv, base); 422 count = ipw_read_reg32(priv, base);
423 423
424 if (ERROR_START_OFFSET <= count * ERROR_ELEM_SIZE) { 424 if (ERROR_START_OFFSET <= count * ERROR_ELEM_SIZE) {
425 IPW_ERROR("Start IPW Error Log Dump:\n"); 425 IPW_ERROR("Start IPW Error Log Dump:\n");
426 IPW_ERROR("Status: 0x%08X, Config: %08X\n", 426 IPW_ERROR("Status: 0x%08X, Config: %08X\n",
427 priv->status, priv->config); 427 priv->status, priv->config);
428 } 428 }
429 429
430 for (i = ERROR_START_OFFSET; 430 for (i = ERROR_START_OFFSET;
431 i <= count * ERROR_ELEM_SIZE; 431 i <= count * ERROR_ELEM_SIZE;
432 i += ERROR_ELEM_SIZE) { 432 i += ERROR_ELEM_SIZE) {
433 desc = ipw_read_reg32(priv, base + i); 433 desc = ipw_read_reg32(priv, base + i);
434 time = ipw_read_reg32(priv, base + i + 1*sizeof(u32)); 434 time = ipw_read_reg32(priv, base + i + 1*sizeof(u32));
@@ -439,8 +439,8 @@ static void ipw_dump_nic_error_log(struct ipw_priv *priv)
439 idata = ipw_read_reg32(priv, base + i + 6*sizeof(u32)); 439 idata = ipw_read_reg32(priv, base + i + 6*sizeof(u32));
440 440
441 IPW_ERROR( 441 IPW_ERROR(
442 "%s %i 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n", 442 "%s %i 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n",
443 ipw_error_desc(desc), time, blink1, blink2, 443 ipw_error_desc(desc), time, blink1, blink2,
444 ilink1, ilink2, idata); 444 ilink1, ilink2, idata);
445 } 445 }
446} 446}
@@ -451,12 +451,12 @@ static void ipw_dump_nic_event_log(struct ipw_priv *priv)
451 451
452 base = ipw_read32(priv, IPW_EVENT_LOG); 452 base = ipw_read32(priv, IPW_EVENT_LOG);
453 count = ipw_read_reg32(priv, base); 453 count = ipw_read_reg32(priv, base);
454 454
455 if (EVENT_START_OFFSET <= count * EVENT_ELEM_SIZE) 455 if (EVENT_START_OFFSET <= count * EVENT_ELEM_SIZE)
456 IPW_ERROR("Start IPW Event Log Dump:\n"); 456 IPW_ERROR("Start IPW Event Log Dump:\n");
457 457
458 for (i = EVENT_START_OFFSET; 458 for (i = EVENT_START_OFFSET;
459 i <= count * EVENT_ELEM_SIZE; 459 i <= count * EVENT_ELEM_SIZE;
460 i += EVENT_ELEM_SIZE) { 460 i += EVENT_ELEM_SIZE) {
461 ev = ipw_read_reg32(priv, base + i); 461 ev = ipw_read_reg32(priv, base + i);
462 time = ipw_read_reg32(priv, base + i + 1*sizeof(u32)); 462 time = ipw_read_reg32(priv, base + i + 1*sizeof(u32));
@@ -479,7 +479,7 @@ static int ipw_get_ordinal(struct ipw_priv *priv, u32 ord, void *val,
479 IPW_DEBUG_ORD("Invalid argument\n"); 479 IPW_DEBUG_ORD("Invalid argument\n");
480 return -EINVAL; 480 return -EINVAL;
481 } 481 }
482 482
483 /* verify device ordinal tables have been initialized */ 483 /* verify device ordinal tables have been initialized */
484 if (!priv->table0_addr || !priv->table1_addr || !priv->table2_addr) { 484 if (!priv->table0_addr || !priv->table1_addr || !priv->table2_addr) {
485 IPW_DEBUG_ORD("Access ordinals before initialization\n"); 485 IPW_DEBUG_ORD("Access ordinals before initialization\n");
@@ -491,7 +491,7 @@ static int ipw_get_ordinal(struct ipw_priv *priv, u32 ord, void *val,
491 /* 491 /*
492 * TABLE 0: Direct access to a table of 32 bit values 492 * TABLE 0: Direct access to a table of 32 bit values
493 * 493 *
494 * This is a very simple table with the data directly 494 * This is a very simple table with the data directly
495 * read from the table 495 * read from the table
496 */ 496 */
497 497
@@ -523,15 +523,15 @@ static int ipw_get_ordinal(struct ipw_priv *priv, u32 ord, void *val,
523 case IPW_ORD_TABLE_1_MASK: 523 case IPW_ORD_TABLE_1_MASK:
524 /* 524 /*
525 * TABLE 1: Indirect access to a table of 32 bit values 525 * TABLE 1: Indirect access to a table of 32 bit values
526 * 526 *
527 * This is a fairly large table of u32 values each 527 * This is a fairly large table of u32 values each
528 * representing starting addr for the data (which is 528 * representing starting addr for the data (which is
529 * also a u32) 529 * also a u32)
530 */ 530 */
531 531
532 /* remove the table id from the ordinal */ 532 /* remove the table id from the ordinal */
533 ord &= IPW_ORD_TABLE_VALUE_MASK; 533 ord &= IPW_ORD_TABLE_VALUE_MASK;
534 534
535 /* boundary check */ 535 /* boundary check */
536 if (ord > priv->table1_len) { 536 if (ord > priv->table1_len) {
537 IPW_DEBUG_ORD("ordinal value too long\n"); 537 IPW_DEBUG_ORD("ordinal value too long\n");
@@ -570,30 +570,30 @@ static int ipw_get_ordinal(struct ipw_priv *priv, u32 ord, void *val,
570 570
571 /* get the address of statistic */ 571 /* get the address of statistic */
572 addr = ipw_read_reg32(priv, priv->table2_addr + (ord << 3)); 572 addr = ipw_read_reg32(priv, priv->table2_addr + (ord << 3));
573 573
574 /* get the second DW of statistics ; 574 /* get the second DW of statistics ;
575 * two 16-bit words - first is length, second is count */ 575 * two 16-bit words - first is length, second is count */
576 field_info = ipw_read_reg32(priv, priv->table2_addr + (ord << 3) + sizeof(u32)); 576 field_info = ipw_read_reg32(priv, priv->table2_addr + (ord << 3) + sizeof(u32));
577 577
578 /* get each entry length */ 578 /* get each entry length */
579 field_len = *((u16 *)&field_info); 579 field_len = *((u16 *)&field_info);
580 580
581 /* get number of entries */ 581 /* get number of entries */
582 field_count = *(((u16 *)&field_info) + 1); 582 field_count = *(((u16 *)&field_info) + 1);
583 583
584 /* abort if not enought memory */ 584 /* abort if not enought memory */
585 total_len = field_len * field_count; 585 total_len = field_len * field_count;
586 if (total_len > *len) { 586 if (total_len > *len) {
587 *len = total_len; 587 *len = total_len;
588 return -EINVAL; 588 return -EINVAL;
589 } 589 }
590 590
591 *len = total_len; 591 *len = total_len;
592 if (!total_len) 592 if (!total_len)
593 return 0; 593 return 0;
594 594
595 IPW_DEBUG_ORD("addr = 0x%08x, total_len = %i, " 595 IPW_DEBUG_ORD("addr = 0x%08x, total_len = %i, "
596 "field_info = 0x%08x\n", 596 "field_info = 0x%08x\n",
597 addr, total_len, field_info); 597 addr, total_len, field_info);
598 ipw_read_indirect(priv, addr, val, total_len); 598 ipw_read_indirect(priv, addr, val, total_len);
599 break; 599 break;
@@ -604,14 +604,14 @@ static int ipw_get_ordinal(struct ipw_priv *priv, u32 ord, void *val,
604 604
605 } 605 }
606 606
607 607
608 return 0; 608 return 0;
609} 609}
610 610
611static void ipw_init_ordinals(struct ipw_priv *priv) 611static void ipw_init_ordinals(struct ipw_priv *priv)
612{ 612{
613 priv->table0_addr = IPW_ORDINALS_TABLE_LOWER; 613 priv->table0_addr = IPW_ORDINALS_TABLE_LOWER;
614 priv->table0_len = ipw_read32(priv, priv->table0_addr); 614 priv->table0_len = ipw_read32(priv, priv->table0_addr);
615 615
616 IPW_DEBUG_ORD("table 0 offset at 0x%08x, len = %i\n", 616 IPW_DEBUG_ORD("table 0 offset at 0x%08x, len = %i\n",
617 priv->table0_addr, priv->table0_len); 617 priv->table0_addr, priv->table0_len);
@@ -635,7 +635,7 @@ static void ipw_init_ordinals(struct ipw_priv *priv)
635 * The following adds a new attribute to the sysfs representation 635 * The following adds a new attribute to the sysfs representation
636 * of this device driver (i.e. a new file in /sys/bus/pci/drivers/ipw/) 636 * of this device driver (i.e. a new file in /sys/bus/pci/drivers/ipw/)
637 * used for controling the debug level. 637 * used for controling the debug level.
638 * 638 *
639 * See the level definitions in ipw for details. 639 * See the level definitions in ipw for details.
640 */ 640 */
641static ssize_t show_debug_level(struct device_driver *d, char *buf) 641static ssize_t show_debug_level(struct device_driver *d, char *buf)
@@ -655,8 +655,8 @@ static ssize_t store_debug_level(struct device_driver *d,
655 val = simple_strtoul(p, &p, 16); 655 val = simple_strtoul(p, &p, 16);
656 } else 656 } else
657 val = simple_strtoul(p, &p, 10); 657 val = simple_strtoul(p, &p, 10);
658 if (p == buf) 658 if (p == buf)
659 printk(KERN_INFO DRV_NAME 659 printk(KERN_INFO DRV_NAME
660 ": %s is not in hex or decimal form.\n", buf); 660 ": %s is not in hex or decimal form.\n", buf);
661 else 661 else
662 ipw_debug_level = val; 662 ipw_debug_level = val;
@@ -664,7 +664,7 @@ static ssize_t store_debug_level(struct device_driver *d,
664 return strnlen(buf, count); 664 return strnlen(buf, count);
665} 665}
666 666
667static DRIVER_ATTR(debug_level, S_IWUSR | S_IRUGO, 667static DRIVER_ATTR(debug_level, S_IWUSR | S_IRUGO,
668 show_debug_level, store_debug_level); 668 show_debug_level, store_debug_level);
669 669
670static ssize_t show_status(struct device *d, 670static ssize_t show_status(struct device *d,
@@ -701,7 +701,7 @@ static ssize_t show_nic_type(struct device *d,
701 case EEPROM_NIC_TYPE_HP: 701 case EEPROM_NIC_TYPE_HP:
702 return sprintf(buf, "HP\n"); 702 return sprintf(buf, "HP\n");
703 } 703 }
704 704
705 return sprintf(buf, "UNKNOWN\n"); 705 return sprintf(buf, "UNKNOWN\n");
706} 706}
707static DEVICE_ATTR(nic_type, S_IRUGO, show_nic_type, NULL); 707static DEVICE_ATTR(nic_type, S_IRUGO, show_nic_type, NULL);
@@ -711,7 +711,7 @@ static ssize_t dump_error_log(struct device *d,
711{ 711{
712 char *p = (char *)buf; 712 char *p = (char *)buf;
713 713
714 if (p[0] == '1') 714 if (p[0] == '1')
715 ipw_dump_nic_error_log((struct ipw_priv*)d->driver_data); 715 ipw_dump_nic_error_log((struct ipw_priv*)d->driver_data);
716 716
717 return strnlen(buf, count); 717 return strnlen(buf, count);
@@ -723,7 +723,7 @@ static ssize_t dump_event_log(struct device *d,
723{ 723{
724 char *p = (char *)buf; 724 char *p = (char *)buf;
725 725
726 if (p[0] == '1') 726 if (p[0] == '1')
727 ipw_dump_nic_event_log((struct ipw_priv*)d->driver_data); 727 ipw_dump_nic_event_log((struct ipw_priv*)d->driver_data);
728 728
729 return strnlen(buf, count); 729 return strnlen(buf, count);
@@ -774,7 +774,7 @@ static ssize_t store_eeprom_delay(struct device *d,
774 sscanf(buf, "%i", &p->eeprom_delay); 774 sscanf(buf, "%i", &p->eeprom_delay);
775 return strnlen(buf, count); 775 return strnlen(buf, count);
776} 776}
777static DEVICE_ATTR(eeprom_delay, S_IWUSR|S_IRUGO, 777static DEVICE_ATTR(eeprom_delay, S_IWUSR|S_IRUGO,
778 show_eeprom_delay,store_eeprom_delay); 778 show_eeprom_delay,store_eeprom_delay);
779 779
780static ssize_t show_command_event_reg(struct device *d, 780static ssize_t show_command_event_reg(struct device *d,
@@ -797,7 +797,7 @@ static ssize_t store_command_event_reg(struct device *d,
797 ipw_write_reg32(p, CX2_INTERNAL_CMD_EVENT, reg); 797 ipw_write_reg32(p, CX2_INTERNAL_CMD_EVENT, reg);
798 return strnlen(buf, count); 798 return strnlen(buf, count);
799} 799}
800static DEVICE_ATTR(command_event_reg, S_IWUSR|S_IRUGO, 800static DEVICE_ATTR(command_event_reg, S_IWUSR|S_IRUGO,
801 show_command_event_reg,store_command_event_reg); 801 show_command_event_reg,store_command_event_reg);
802 802
803static ssize_t show_mem_gpio_reg(struct device *d, 803static ssize_t show_mem_gpio_reg(struct device *d,
@@ -828,11 +828,11 @@ static ssize_t show_indirect_dword(struct device *d,
828{ 828{
829 u32 reg = 0; 829 u32 reg = 0;
830 struct ipw_priv *priv = d->driver_data; 830 struct ipw_priv *priv = d->driver_data;
831 if (priv->status & STATUS_INDIRECT_DWORD) 831 if (priv->status & STATUS_INDIRECT_DWORD)
832 reg = ipw_read_reg32(priv, priv->indirect_dword); 832 reg = ipw_read_reg32(priv, priv->indirect_dword);
833 else 833 else
834 reg = 0; 834 reg = 0;
835 835
836 return sprintf(buf, "0x%08x\n", reg); 836 return sprintf(buf, "0x%08x\n", reg);
837} 837}
838static ssize_t store_indirect_dword(struct device *d, 838static ssize_t store_indirect_dword(struct device *d,
@@ -845,7 +845,7 @@ static ssize_t store_indirect_dword(struct device *d,
845 priv->status |= STATUS_INDIRECT_DWORD; 845 priv->status |= STATUS_INDIRECT_DWORD;
846 return strnlen(buf, count); 846 return strnlen(buf, count);
847} 847}
848static DEVICE_ATTR(indirect_dword, S_IWUSR|S_IRUGO, 848static DEVICE_ATTR(indirect_dword, S_IWUSR|S_IRUGO,
849 show_indirect_dword,store_indirect_dword); 849 show_indirect_dword,store_indirect_dword);
850 850
851static ssize_t show_indirect_byte(struct device *d, 851static ssize_t show_indirect_byte(struct device *d,
@@ -853,9 +853,9 @@ static ssize_t show_indirect_byte(struct device *d,
853{ 853{
854 u8 reg = 0; 854 u8 reg = 0;
855 struct ipw_priv *priv = d->driver_data; 855 struct ipw_priv *priv = d->driver_data;
856 if (priv->status & STATUS_INDIRECT_BYTE) 856 if (priv->status & STATUS_INDIRECT_BYTE)
857 reg = ipw_read_reg8(priv, priv->indirect_byte); 857 reg = ipw_read_reg8(priv, priv->indirect_byte);
858 else 858 else
859 reg = 0; 859 reg = 0;
860 860
861 return sprintf(buf, "0x%02x\n", reg); 861 return sprintf(buf, "0x%02x\n", reg);
@@ -870,7 +870,7 @@ static ssize_t store_indirect_byte(struct device *d,
870 priv->status |= STATUS_INDIRECT_BYTE; 870 priv->status |= STATUS_INDIRECT_BYTE;
871 return strnlen(buf, count); 871 return strnlen(buf, count);
872} 872}
873static DEVICE_ATTR(indirect_byte, S_IWUSR|S_IRUGO, 873static DEVICE_ATTR(indirect_byte, S_IWUSR|S_IRUGO,
874 show_indirect_byte, store_indirect_byte); 874 show_indirect_byte, store_indirect_byte);
875 875
876static ssize_t show_direct_dword(struct device *d, 876static ssize_t show_direct_dword(struct device *d,
@@ -879,9 +879,9 @@ static ssize_t show_direct_dword(struct device *d,
879 u32 reg = 0; 879 u32 reg = 0;
880 struct ipw_priv *priv = d->driver_data; 880 struct ipw_priv *priv = d->driver_data;
881 881
882 if (priv->status & STATUS_DIRECT_DWORD) 882 if (priv->status & STATUS_DIRECT_DWORD)
883 reg = ipw_read32(priv, priv->direct_dword); 883 reg = ipw_read32(priv, priv->direct_dword);
884 else 884 else
885 reg = 0; 885 reg = 0;
886 886
887 return sprintf(buf, "0x%08x\n", reg); 887 return sprintf(buf, "0x%08x\n", reg);
@@ -896,7 +896,7 @@ static ssize_t store_direct_dword(struct device *d,
896 priv->status |= STATUS_DIRECT_DWORD; 896 priv->status |= STATUS_DIRECT_DWORD;
897 return strnlen(buf, count); 897 return strnlen(buf, count);
898} 898}
899static DEVICE_ATTR(direct_dword, S_IWUSR|S_IRUGO, 899static DEVICE_ATTR(direct_dword, S_IWUSR|S_IRUGO,
900 show_direct_dword,store_direct_dword); 900 show_direct_dword,store_direct_dword);
901 901
902 902
@@ -914,7 +914,7 @@ static ssize_t show_rf_kill(struct device *d, struct device_attribute *attr,
914 char *buf) 914 char *buf)
915{ 915{
916 /* 0 - RF kill not enabled 916 /* 0 - RF kill not enabled
917 1 - SW based RF kill active (sysfs) 917 1 - SW based RF kill active (sysfs)
918 2 - HW based RF kill active 918 2 - HW based RF kill active
919 3 - Both HW and SW baed RF kill active */ 919 3 - Both HW and SW baed RF kill active */
920 struct ipw_priv *priv = d->driver_data; 920 struct ipw_priv *priv = d->driver_data;
@@ -925,7 +925,7 @@ static ssize_t show_rf_kill(struct device *d, struct device_attribute *attr,
925 925
926static int ipw_radio_kill_sw(struct ipw_priv *priv, int disable_radio) 926static int ipw_radio_kill_sw(struct ipw_priv *priv, int disable_radio)
927{ 927{
928 if ((disable_radio ? 1 : 0) == 928 if ((disable_radio ? 1 : 0) ==
929 (priv->status & STATUS_RF_KILL_SW ? 1 : 0)) 929 (priv->status & STATUS_RF_KILL_SW ? 1 : 0))
930 return 0 ; 930 return 0 ;
931 931
@@ -935,7 +935,7 @@ static int ipw_radio_kill_sw(struct ipw_priv *priv, int disable_radio)
935 if (disable_radio) { 935 if (disable_radio) {
936 priv->status |= STATUS_RF_KILL_SW; 936 priv->status |= STATUS_RF_KILL_SW;
937 937
938 if (priv->workqueue) { 938 if (priv->workqueue) {
939 cancel_delayed_work(&priv->request_scan); 939 cancel_delayed_work(&priv->request_scan);
940 } 940 }
941 wake_up_interruptible(&priv->wait_command_queue); 941 wake_up_interruptible(&priv->wait_command_queue);
@@ -947,9 +947,9 @@ static int ipw_radio_kill_sw(struct ipw_priv *priv, int disable_radio)
947 "disabled by HW switch\n"); 947 "disabled by HW switch\n");
948 /* Make sure the RF_KILL check timer is running */ 948 /* Make sure the RF_KILL check timer is running */
949 cancel_delayed_work(&priv->rf_kill); 949 cancel_delayed_work(&priv->rf_kill);
950 queue_delayed_work(priv->workqueue, &priv->rf_kill, 950 queue_delayed_work(priv->workqueue, &priv->rf_kill,
951 2 * HZ); 951 2 * HZ);
952 } else 952 } else
953 queue_work(priv->workqueue, &priv->up); 953 queue_work(priv->workqueue, &priv->up);
954 } 954 }
955 955
@@ -960,7 +960,7 @@ static ssize_t store_rf_kill(struct device *d, struct device_attribute *attr,
960 const char *buf, size_t count) 960 const char *buf, size_t count)
961{ 961{
962 struct ipw_priv *priv = d->driver_data; 962 struct ipw_priv *priv = d->driver_data;
963 963
964 ipw_radio_kill_sw(priv, buf[0] == '1'); 964 ipw_radio_kill_sw(priv, buf[0] == '1');
965 965
966 return count; 966 return count;
@@ -1055,7 +1055,7 @@ static void ipw_irq_tasklet(struct ipw_priv *priv)
1055 queue_delayed_work(priv->workqueue, &priv->rf_kill, 2 * HZ); 1055 queue_delayed_work(priv->workqueue, &priv->rf_kill, 2 * HZ);
1056 handled |= CX2_INTA_BIT_RF_KILL_DONE; 1056 handled |= CX2_INTA_BIT_RF_KILL_DONE;
1057 } 1057 }
1058 1058
1059 if (inta & CX2_INTA_BIT_FATAL_ERROR) { 1059 if (inta & CX2_INTA_BIT_FATAL_ERROR) {
1060 IPW_ERROR("Firmware error detected. Restarting.\n"); 1060 IPW_ERROR("Firmware error detected. Restarting.\n");
1061#ifdef CONFIG_IPW_DEBUG 1061#ifdef CONFIG_IPW_DEBUG
@@ -1074,7 +1074,7 @@ static void ipw_irq_tasklet(struct ipw_priv *priv)
1074 } 1074 }
1075 1075
1076 if (handled != inta) { 1076 if (handled != inta) {
1077 IPW_ERROR("Unhandled INTA bits 0x%08x\n", 1077 IPW_ERROR("Unhandled INTA bits 0x%08x\n",
1078 inta & ~handled); 1078 inta & ~handled);
1079 } 1079 }
1080 1080
@@ -1083,63 +1083,63 @@ static void ipw_irq_tasklet(struct ipw_priv *priv)
1083 1083
1084 spin_unlock_irqrestore(&priv->lock, flags); 1084 spin_unlock_irqrestore(&priv->lock, flags);
1085} 1085}
1086 1086
1087#ifdef CONFIG_IPW_DEBUG 1087#ifdef CONFIG_IPW_DEBUG
1088#define IPW_CMD(x) case IPW_CMD_ ## x : return #x 1088#define IPW_CMD(x) case IPW_CMD_ ## x : return #x
1089static char *get_cmd_string(u8 cmd) 1089static char *get_cmd_string(u8 cmd)
1090{ 1090{
1091 switch (cmd) { 1091 switch (cmd) {
1092 IPW_CMD(HOST_COMPLETE); 1092 IPW_CMD(HOST_COMPLETE);
1093 IPW_CMD(POWER_DOWN); 1093 IPW_CMD(POWER_DOWN);
1094 IPW_CMD(SYSTEM_CONFIG); 1094 IPW_CMD(SYSTEM_CONFIG);
1095 IPW_CMD(MULTICAST_ADDRESS); 1095 IPW_CMD(MULTICAST_ADDRESS);
1096 IPW_CMD(SSID); 1096 IPW_CMD(SSID);
1097 IPW_CMD(ADAPTER_ADDRESS); 1097 IPW_CMD(ADAPTER_ADDRESS);
1098 IPW_CMD(PORT_TYPE); 1098 IPW_CMD(PORT_TYPE);
1099 IPW_CMD(RTS_THRESHOLD); 1099 IPW_CMD(RTS_THRESHOLD);
1100 IPW_CMD(FRAG_THRESHOLD); 1100 IPW_CMD(FRAG_THRESHOLD);
1101 IPW_CMD(POWER_MODE); 1101 IPW_CMD(POWER_MODE);
1102 IPW_CMD(WEP_KEY); 1102 IPW_CMD(WEP_KEY);
1103 IPW_CMD(TGI_TX_KEY); 1103 IPW_CMD(TGI_TX_KEY);
1104 IPW_CMD(SCAN_REQUEST); 1104 IPW_CMD(SCAN_REQUEST);
1105 IPW_CMD(SCAN_REQUEST_EXT); 1105 IPW_CMD(SCAN_REQUEST_EXT);
1106 IPW_CMD(ASSOCIATE); 1106 IPW_CMD(ASSOCIATE);
1107 IPW_CMD(SUPPORTED_RATES); 1107 IPW_CMD(SUPPORTED_RATES);
1108 IPW_CMD(SCAN_ABORT); 1108 IPW_CMD(SCAN_ABORT);
1109 IPW_CMD(TX_FLUSH); 1109 IPW_CMD(TX_FLUSH);
1110 IPW_CMD(QOS_PARAMETERS); 1110 IPW_CMD(QOS_PARAMETERS);
1111 IPW_CMD(DINO_CONFIG); 1111 IPW_CMD(DINO_CONFIG);
1112 IPW_CMD(RSN_CAPABILITIES); 1112 IPW_CMD(RSN_CAPABILITIES);
1113 IPW_CMD(RX_KEY); 1113 IPW_CMD(RX_KEY);
1114 IPW_CMD(CARD_DISABLE); 1114 IPW_CMD(CARD_DISABLE);
1115 IPW_CMD(SEED_NUMBER); 1115 IPW_CMD(SEED_NUMBER);
1116 IPW_CMD(TX_POWER); 1116 IPW_CMD(TX_POWER);
1117 IPW_CMD(COUNTRY_INFO); 1117 IPW_CMD(COUNTRY_INFO);
1118 IPW_CMD(AIRONET_INFO); 1118 IPW_CMD(AIRONET_INFO);
1119 IPW_CMD(AP_TX_POWER); 1119 IPW_CMD(AP_TX_POWER);
1120 IPW_CMD(CCKM_INFO); 1120 IPW_CMD(CCKM_INFO);
1121 IPW_CMD(CCX_VER_INFO); 1121 IPW_CMD(CCX_VER_INFO);
1122 IPW_CMD(SET_CALIBRATION); 1122 IPW_CMD(SET_CALIBRATION);
1123 IPW_CMD(SENSITIVITY_CALIB); 1123 IPW_CMD(SENSITIVITY_CALIB);
1124 IPW_CMD(RETRY_LIMIT); 1124 IPW_CMD(RETRY_LIMIT);
1125 IPW_CMD(IPW_PRE_POWER_DOWN); 1125 IPW_CMD(IPW_PRE_POWER_DOWN);
1126 IPW_CMD(VAP_BEACON_TEMPLATE); 1126 IPW_CMD(VAP_BEACON_TEMPLATE);
1127 IPW_CMD(VAP_DTIM_PERIOD); 1127 IPW_CMD(VAP_DTIM_PERIOD);
1128 IPW_CMD(EXT_SUPPORTED_RATES); 1128 IPW_CMD(EXT_SUPPORTED_RATES);
1129 IPW_CMD(VAP_LOCAL_TX_PWR_CONSTRAINT); 1129 IPW_CMD(VAP_LOCAL_TX_PWR_CONSTRAINT);
1130 IPW_CMD(VAP_QUIET_INTERVALS); 1130 IPW_CMD(VAP_QUIET_INTERVALS);
1131 IPW_CMD(VAP_CHANNEL_SWITCH); 1131 IPW_CMD(VAP_CHANNEL_SWITCH);
1132 IPW_CMD(VAP_MANDATORY_CHANNELS); 1132 IPW_CMD(VAP_MANDATORY_CHANNELS);
1133 IPW_CMD(VAP_CELL_PWR_LIMIT); 1133 IPW_CMD(VAP_CELL_PWR_LIMIT);
1134 IPW_CMD(VAP_CF_PARAM_SET); 1134 IPW_CMD(VAP_CF_PARAM_SET);
1135 IPW_CMD(VAP_SET_BEACONING_STATE); 1135 IPW_CMD(VAP_SET_BEACONING_STATE);
1136 IPW_CMD(MEASUREMENT); 1136 IPW_CMD(MEASUREMENT);
1137 IPW_CMD(POWER_CAPABILITY); 1137 IPW_CMD(POWER_CAPABILITY);
1138 IPW_CMD(SUPPORTED_CHANNELS); 1138 IPW_CMD(SUPPORTED_CHANNELS);
1139 IPW_CMD(TPC_REPORT); 1139 IPW_CMD(TPC_REPORT);
1140 IPW_CMD(WME_INFO); 1140 IPW_CMD(WME_INFO);
1141 IPW_CMD(PRODUCTION_COMMAND); 1141 IPW_CMD(PRODUCTION_COMMAND);
1142 default: 1142 default:
1143 return "UNKNOWN"; 1143 return "UNKNOWN";
1144 } 1144 }
1145} 1145}
@@ -1156,8 +1156,8 @@ static int ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd)
1156 } 1156 }
1157 1157
1158 priv->status |= STATUS_HCMD_ACTIVE; 1158 priv->status |= STATUS_HCMD_ACTIVE;
1159 1159
1160 IPW_DEBUG_HC("Sending %s command (#%d), %d bytes\n", 1160 IPW_DEBUG_HC("Sending %s command (#%d), %d bytes\n",
1161 get_cmd_string(cmd->cmd), cmd->cmd, cmd->len); 1161 get_cmd_string(cmd->cmd), cmd->cmd, cmd->len);
1162 printk_buf(IPW_DL_HOST_COMMAND, (u8*)cmd->param, cmd->len); 1162 printk_buf(IPW_DL_HOST_COMMAND, (u8*)cmd->param, cmd->len);
1163 1163
@@ -1198,11 +1198,11 @@ static int ipw_send_host_complete(struct ipw_priv *priv)
1198 IPW_ERROR("failed to send HOST_COMPLETE command\n"); 1198 IPW_ERROR("failed to send HOST_COMPLETE command\n");
1199 return -1; 1199 return -1;
1200 } 1200 }
1201 1201
1202 return 0; 1202 return 0;
1203} 1203}
1204 1204
1205static int ipw_send_system_config(struct ipw_priv *priv, 1205static int ipw_send_system_config(struct ipw_priv *priv,
1206 struct ipw_sys_config *config) 1206 struct ipw_sys_config *config)
1207{ 1207{
1208 struct host_cmd cmd = { 1208 struct host_cmd cmd = {
@@ -1241,7 +1241,7 @@ static int ipw_send_ssid(struct ipw_priv *priv, u8 *ssid, int len)
1241 IPW_ERROR("failed to send SSID command\n"); 1241 IPW_ERROR("failed to send SSID command\n");
1242 return -1; 1242 return -1;
1243 } 1243 }
1244 1244
1245 return 0; 1245 return 0;
1246} 1246}
1247 1247
@@ -1266,7 +1266,7 @@ static int ipw_send_adapter_address(struct ipw_priv *priv, u8 *mac)
1266 IPW_ERROR("failed to send ADAPTER_ADDRESS command\n"); 1266 IPW_ERROR("failed to send ADAPTER_ADDRESS command\n");
1267 return -1; 1267 return -1;
1268 } 1268 }
1269 1269
1270 return 0; 1270 return 0;
1271} 1271}
1272 1272
@@ -1294,7 +1294,7 @@ static void ipw_scan_check(void *data)
1294 struct ipw_priv *priv = data; 1294 struct ipw_priv *priv = data;
1295 if (priv->status & (STATUS_SCANNING | STATUS_SCAN_ABORTING)) { 1295 if (priv->status & (STATUS_SCANNING | STATUS_SCAN_ABORTING)) {
1296 IPW_DEBUG_SCAN("Scan completion watchdog resetting " 1296 IPW_DEBUG_SCAN("Scan completion watchdog resetting "
1297 "adapter (%dms).\n", 1297 "adapter (%dms).\n",
1298 IPW_SCAN_CHECK_WATCHDOG / 100); 1298 IPW_SCAN_CHECK_WATCHDOG / 100);
1299 ipw_adapter_restart(priv); 1299 ipw_adapter_restart(priv);
1300 } 1300 }
@@ -1318,8 +1318,8 @@ static int ipw_send_scan_request_ext(struct ipw_priv *priv,
1318 IPW_ERROR("failed to send SCAN_REQUEST_EXT command\n"); 1318 IPW_ERROR("failed to send SCAN_REQUEST_EXT command\n");
1319 return -1; 1319 return -1;
1320 } 1320 }
1321 1321
1322 queue_delayed_work(priv->workqueue, &priv->scan_check, 1322 queue_delayed_work(priv->workqueue, &priv->scan_check,
1323 IPW_SCAN_CHECK_WATCHDOG); 1323 IPW_SCAN_CHECK_WATCHDOG);
1324 return 0; 1324 return 0;
1325} 1325}
@@ -1340,7 +1340,7 @@ static int ipw_send_scan_abort(struct ipw_priv *priv)
1340 IPW_ERROR("failed to send SCAN_ABORT command\n"); 1340 IPW_ERROR("failed to send SCAN_ABORT command\n");
1341 return -1; 1341 return -1;
1342 } 1342 }
1343 1343
1344 return 0; 1344 return 0;
1345} 1345}
1346 1346
@@ -1379,7 +1379,7 @@ static int ipw_send_associate(struct ipw_priv *priv,
1379 IPW_ERROR("failed to send ASSOCIATE command\n"); 1379 IPW_ERROR("failed to send ASSOCIATE command\n");
1380 return -1; 1380 return -1;
1381 } 1381 }
1382 1382
1383 return 0; 1383 return 0;
1384} 1384}
1385 1385
@@ -1401,7 +1401,7 @@ static int ipw_send_supported_rates(struct ipw_priv *priv,
1401 IPW_ERROR("failed to send SUPPORTED_RATES command\n"); 1401 IPW_ERROR("failed to send SUPPORTED_RATES command\n");
1402 return -1; 1402 return -1;
1403 } 1403 }
1404 1404
1405 return 0; 1405 return 0;
1406} 1406}
1407 1407
@@ -1423,7 +1423,7 @@ static int ipw_set_random_seed(struct ipw_priv *priv)
1423 IPW_ERROR("failed to send SEED_NUMBER command\n"); 1423 IPW_ERROR("failed to send SEED_NUMBER command\n");
1424 return -1; 1424 return -1;
1425 } 1425 }
1426 1426
1427 return 0; 1427 return 0;
1428} 1428}
1429 1429
@@ -1446,7 +1446,7 @@ static int ipw_send_card_disable(struct ipw_priv *priv, u32 phy_off)
1446 IPW_ERROR("failed to send CARD_DISABLE command\n"); 1446 IPW_ERROR("failed to send CARD_DISABLE command\n");
1447 return -1; 1447 return -1;
1448 } 1448 }
1449 1449
1450 return 0; 1450 return 0;
1451} 1451}
1452#endif 1452#endif
@@ -1469,7 +1469,7 @@ static int ipw_send_tx_power(struct ipw_priv *priv,
1469 IPW_ERROR("failed to send TX_POWER command\n"); 1469 IPW_ERROR("failed to send TX_POWER command\n");
1470 return -1; 1470 return -1;
1471 } 1471 }
1472 1472
1473 return 0; 1473 return 0;
1474} 1474}
1475 1475
@@ -1533,7 +1533,7 @@ static int ipw_send_power_mode(struct ipw_priv *priv, u32 mode)
1533 IPW_ERROR("Invalid args\n"); 1533 IPW_ERROR("Invalid args\n");
1534 return -1; 1534 return -1;
1535 } 1535 }
1536 1536
1537 /* If on battery, set to 3, if AC set to CAM, else user 1537 /* If on battery, set to 3, if AC set to CAM, else user
1538 * level */ 1538 * level */
1539 switch (mode) { 1539 switch (mode) {
@@ -1577,7 +1577,7 @@ static int ipw_send_power_mode(struct ipw_priv *priv, u32 mode)
1577static inline void eeprom_write_reg(struct ipw_priv *p, u32 data) 1577static inline void eeprom_write_reg(struct ipw_priv *p, u32 data)
1578{ 1578{
1579 ipw_write_reg32(p, FW_MEM_REG_EEPROM_ACCESS, data); 1579 ipw_write_reg32(p, FW_MEM_REG_EEPROM_ACCESS, data);
1580 1580
1581 /* the eeprom requires some time to complete the operation */ 1581 /* the eeprom requires some time to complete the operation */
1582 udelay(p->eeprom_delay); 1582 udelay(p->eeprom_delay);
1583 1583
@@ -1628,7 +1628,7 @@ static u16 eeprom_read_u16(struct ipw_priv* priv, u8 addr)
1628{ 1628{
1629 int i; 1629 int i;
1630 u16 r=0; 1630 u16 r=0;
1631 1631
1632 /* Send READ Opcode */ 1632 /* Send READ Opcode */
1633 eeprom_op(priv,EEPROM_CMD_READ,addr); 1633 eeprom_op(priv,EEPROM_CMD_READ,addr);
1634 1634
@@ -1643,11 +1643,11 @@ static u16 eeprom_read_u16(struct ipw_priv* priv, u8 addr)
1643 data = ipw_read_reg32(priv,FW_MEM_REG_EEPROM_ACCESS); 1643 data = ipw_read_reg32(priv,FW_MEM_REG_EEPROM_ACCESS);
1644 r = (r<<1) | ((data & EEPROM_BIT_DO)?1:0); 1644 r = (r<<1) | ((data & EEPROM_BIT_DO)?1:0);
1645 } 1645 }
1646 1646
1647 /* Send another dummy bit */ 1647 /* Send another dummy bit */
1648 eeprom_write_reg(priv,0); 1648 eeprom_write_reg(priv,0);
1649 eeprom_disable_cs(priv); 1649 eeprom_disable_cs(priv);
1650 1650
1651 return r; 1651 return r;
1652} 1652}
1653 1653
@@ -1671,15 +1671,15 @@ static void ipw_eeprom_init_sram(struct ipw_priv *priv)
1671{ 1671{
1672 int i; 1672 int i;
1673 u16 *eeprom = (u16 *)priv->eeprom; 1673 u16 *eeprom = (u16 *)priv->eeprom;
1674 1674
1675 IPW_DEBUG_TRACE(">>\n"); 1675 IPW_DEBUG_TRACE(">>\n");
1676 1676
1677 /* read entire contents of eeprom into private buffer */ 1677 /* read entire contents of eeprom into private buffer */
1678 for ( i=0; i<128; i++ ) 1678 for ( i=0; i<128; i++ )
1679 eeprom[i] = eeprom_read_u16(priv,(u8)i); 1679 eeprom[i] = eeprom_read_u16(priv,(u8)i);
1680 1680
1681 /* 1681 /*
1682 If the data looks correct, then copy it to our private 1682 If the data looks correct, then copy it to our private
1683 copy. Otherwise let the firmware know to perform the operation 1683 copy. Otherwise let the firmware know to perform the operation
1684 on it's own 1684 on it's own
1685 */ 1685 */
@@ -1688,7 +1688,7 @@ static void ipw_eeprom_init_sram(struct ipw_priv *priv)
1688 1688
1689 /* write the eeprom data to sram */ 1689 /* write the eeprom data to sram */
1690 for( i=0; i<CX2_EEPROM_IMAGE_SIZE; i++ ) 1690 for( i=0; i<CX2_EEPROM_IMAGE_SIZE; i++ )
1691 ipw_write8(priv, IPW_EEPROM_DATA + i, 1691 ipw_write8(priv, IPW_EEPROM_DATA + i,
1692 priv->eeprom[i]); 1692 priv->eeprom[i]);
1693 1693
1694 /* Do not load eeprom data on fatal error or suspend */ 1694 /* Do not load eeprom data on fatal error or suspend */
@@ -1709,14 +1709,14 @@ static inline void ipw_zero_memory(struct ipw_priv *priv, u32 start, u32 count)
1709 count >>= 2; 1709 count >>= 2;
1710 if (!count) return; 1710 if (!count) return;
1711 _ipw_write32(priv, CX2_AUTOINC_ADDR, start); 1711 _ipw_write32(priv, CX2_AUTOINC_ADDR, start);
1712 while (count--) 1712 while (count--)
1713 _ipw_write32(priv, CX2_AUTOINC_DATA, 0); 1713 _ipw_write32(priv, CX2_AUTOINC_DATA, 0);
1714} 1714}
1715 1715
1716static inline void ipw_fw_dma_reset_command_blocks(struct ipw_priv *priv) 1716static inline void ipw_fw_dma_reset_command_blocks(struct ipw_priv *priv)
1717{ 1717{
1718 ipw_zero_memory(priv, CX2_SHARED_SRAM_DMA_CONTROL, 1718 ipw_zero_memory(priv, CX2_SHARED_SRAM_DMA_CONTROL,
1719 CB_NUMBER_OF_ELEMENTS_SMALL * 1719 CB_NUMBER_OF_ELEMENTS_SMALL *
1720 sizeof(struct command_block)); 1720 sizeof(struct command_block));
1721} 1721}
1722 1722
@@ -1724,10 +1724,10 @@ static int ipw_fw_dma_enable(struct ipw_priv *priv)
1724{ /* start dma engine but no transfers yet*/ 1724{ /* start dma engine but no transfers yet*/
1725 1725
1726 IPW_DEBUG_FW(">> : \n"); 1726 IPW_DEBUG_FW(">> : \n");
1727 1727
1728 /* Start the dma */ 1728 /* Start the dma */
1729 ipw_fw_dma_reset_command_blocks(priv); 1729 ipw_fw_dma_reset_command_blocks(priv);
1730 1730
1731 /* Write CB base address */ 1731 /* Write CB base address */
1732 ipw_write_reg32(priv, CX2_DMA_I_CB_BASE, CX2_SHARED_SRAM_DMA_CONTROL); 1732 ipw_write_reg32(priv, CX2_DMA_I_CB_BASE, CX2_SHARED_SRAM_DMA_CONTROL);
1733 1733
@@ -1740,18 +1740,18 @@ static void ipw_fw_dma_abort(struct ipw_priv *priv)
1740 u32 control = 0; 1740 u32 control = 0;
1741 1741
1742 IPW_DEBUG_FW(">> :\n"); 1742 IPW_DEBUG_FW(">> :\n");
1743 1743
1744 //set the Stop and Abort bit 1744 //set the Stop and Abort bit
1745 control = DMA_CONTROL_SMALL_CB_CONST_VALUE | DMA_CB_STOP_AND_ABORT; 1745 control = DMA_CONTROL_SMALL_CB_CONST_VALUE | DMA_CB_STOP_AND_ABORT;
1746 ipw_write_reg32(priv, CX2_DMA_I_DMA_CONTROL, control); 1746 ipw_write_reg32(priv, CX2_DMA_I_DMA_CONTROL, control);
1747 priv->sram_desc.last_cb_index = 0; 1747 priv->sram_desc.last_cb_index = 0;
1748 1748
1749 IPW_DEBUG_FW("<< \n"); 1749 IPW_DEBUG_FW("<< \n");
1750} 1750}
1751 1751
1752static int ipw_fw_dma_write_command_block(struct ipw_priv *priv, int index, struct command_block *cb) 1752static int ipw_fw_dma_write_command_block(struct ipw_priv *priv, int index, struct command_block *cb)
1753{ 1753{
1754 u32 address = CX2_SHARED_SRAM_DMA_CONTROL + (sizeof(struct command_block) * index); 1754 u32 address = CX2_SHARED_SRAM_DMA_CONTROL + (sizeof(struct command_block) * index);
1755 IPW_DEBUG_FW(">> :\n"); 1755 IPW_DEBUG_FW(">> :\n");
1756 1756
1757 ipw_write_indirect(priv, address, (u8*)cb, (int)sizeof(struct command_block)); 1757 ipw_write_indirect(priv, address, (u8*)cb, (int)sizeof(struct command_block));
@@ -1767,13 +1767,13 @@ static int ipw_fw_dma_kick(struct ipw_priv *priv)
1767 u32 index=0; 1767 u32 index=0;
1768 1768
1769 IPW_DEBUG_FW(">> :\n"); 1769 IPW_DEBUG_FW(">> :\n");
1770 1770
1771 for (index = 0; index < priv->sram_desc.last_cb_index; index++) 1771 for (index = 0; index < priv->sram_desc.last_cb_index; index++)
1772 ipw_fw_dma_write_command_block(priv, index, &priv->sram_desc.cb_list[index]); 1772 ipw_fw_dma_write_command_block(priv, index, &priv->sram_desc.cb_list[index]);
1773 1773
1774 /* Enable the DMA in the CSR register */ 1774 /* Enable the DMA in the CSR register */
1775 ipw_clear_bit(priv, CX2_RESET_REG,CX2_RESET_REG_MASTER_DISABLED | CX2_RESET_REG_STOP_MASTER); 1775 ipw_clear_bit(priv, CX2_RESET_REG,CX2_RESET_REG_MASTER_DISABLED | CX2_RESET_REG_STOP_MASTER);
1776 1776
1777 /* Set the Start bit. */ 1777 /* Set the Start bit. */
1778 control = DMA_CONTROL_SMALL_CB_CONST_VALUE | DMA_CB_START; 1778 control = DMA_CONTROL_SMALL_CB_CONST_VALUE | DMA_CB_START;
1779 ipw_write_reg32(priv, CX2_DMA_I_DMA_CONTROL, control); 1779 ipw_write_reg32(priv, CX2_DMA_I_DMA_CONTROL, control);
@@ -1824,10 +1824,10 @@ static int ipw_fw_dma_command_block_index(struct ipw_priv *priv)
1824 1824
1825 IPW_DEBUG_FW("<< :\n"); 1825 IPW_DEBUG_FW("<< :\n");
1826 current_cb_address= ipw_read_reg32(priv, CX2_DMA_I_CURRENT_CB); 1826 current_cb_address= ipw_read_reg32(priv, CX2_DMA_I_CURRENT_CB);
1827 1827
1828 current_cb_index = (current_cb_address - CX2_SHARED_SRAM_DMA_CONTROL )/ 1828 current_cb_index = (current_cb_address - CX2_SHARED_SRAM_DMA_CONTROL )/
1829 sizeof (struct command_block); 1829 sizeof (struct command_block);
1830 1830
1831 IPW_DEBUG_FW_INFO("Current CB index 0x%x address = 0x%X \n", 1831 IPW_DEBUG_FW_INFO("Current CB index 0x%x address = 0x%X \n",
1832 current_cb_index, current_cb_address ); 1832 current_cb_index, current_cb_address );
1833 1833
@@ -1844,8 +1844,8 @@ static int ipw_fw_dma_add_command_block(struct ipw_priv *priv,
1844 int is_last) 1844 int is_last)
1845{ 1845{
1846 1846
1847 u32 control = CB_VALID | CB_SRC_LE | CB_DEST_LE | CB_SRC_AUTOINC | 1847 u32 control = CB_VALID | CB_SRC_LE | CB_DEST_LE | CB_SRC_AUTOINC |
1848 CB_SRC_IO_GATED | CB_DEST_AUTOINC | CB_SRC_SIZE_LONG | 1848 CB_SRC_IO_GATED | CB_DEST_AUTOINC | CB_SRC_SIZE_LONG |
1849 CB_DEST_SIZE_LONG; 1849 CB_DEST_SIZE_LONG;
1850 struct command_block *cb; 1850 struct command_block *cb;
1851 u32 last_cb_element=0; 1851 u32 last_cb_element=0;
@@ -1866,7 +1866,7 @@ static int ipw_fw_dma_add_command_block(struct ipw_priv *priv,
1866 1866
1867 if (is_last) 1867 if (is_last)
1868 control |= CB_LAST_VALID; 1868 control |= CB_LAST_VALID;
1869 1869
1870 control |= length; 1870 control |= length;
1871 1871
1872 /* Calculate the CB Element's checksum value */ 1872 /* Calculate the CB Element's checksum value */
@@ -1902,7 +1902,7 @@ static int ipw_fw_dma_add_buffer(struct ipw_priv *priv,
1902 if (status) { 1902 if (status) {
1903 IPW_DEBUG_FW_INFO(": Failed\n"); 1903 IPW_DEBUG_FW_INFO(": Failed\n");
1904 return -1; 1904 return -1;
1905 } else 1905 } else
1906 IPW_DEBUG_FW_INFO(": Added new cb\n"); 1906 IPW_DEBUG_FW_INFO(": Added new cb\n");
1907 1907
1908 src_offset += CB_MAX_LENGTH; 1908 src_offset += CB_MAX_LENGTH;
@@ -1919,11 +1919,11 @@ static int ipw_fw_dma_add_buffer(struct ipw_priv *priv,
1919 if (status) { 1919 if (status) {
1920 IPW_DEBUG_FW_INFO(": Failed on the buffer tail\n"); 1920 IPW_DEBUG_FW_INFO(": Failed on the buffer tail\n");
1921 return -1; 1921 return -1;
1922 } else 1922 } else
1923 IPW_DEBUG_FW_INFO(": Adding new cb - the buffer tail\n"); 1923 IPW_DEBUG_FW_INFO(": Adding new cb - the buffer tail\n");
1924 } 1924 }
1925 1925
1926 1926
1927 IPW_DEBUG_FW("<< \n"); 1927 IPW_DEBUG_FW("<< \n");
1928 return 0; 1928 return 0;
1929} 1929}
@@ -1936,7 +1936,7 @@ static int ipw_fw_dma_wait(struct ipw_priv *priv)
1936 IPW_DEBUG_FW(">> : \n"); 1936 IPW_DEBUG_FW(">> : \n");
1937 1937
1938 current_index = ipw_fw_dma_command_block_index(priv); 1938 current_index = ipw_fw_dma_command_block_index(priv);
1939 IPW_DEBUG_FW_INFO("sram_desc.last_cb_index:0x%8X\n", 1939 IPW_DEBUG_FW_INFO("sram_desc.last_cb_index:0x%8X\n",
1940 (int) priv->sram_desc.last_cb_index); 1940 (int) priv->sram_desc.last_cb_index);
1941 1941
1942 while (current_index < priv->sram_desc.last_cb_index) { 1942 while (current_index < priv->sram_desc.last_cb_index) {
@@ -1956,33 +1956,33 @@ static int ipw_fw_dma_wait(struct ipw_priv *priv)
1956 ipw_fw_dma_abort(priv); 1956 ipw_fw_dma_abort(priv);
1957 1957
1958 /*Disable the DMA in the CSR register*/ 1958 /*Disable the DMA in the CSR register*/
1959 ipw_set_bit(priv, CX2_RESET_REG, 1959 ipw_set_bit(priv, CX2_RESET_REG,
1960 CX2_RESET_REG_MASTER_DISABLED | CX2_RESET_REG_STOP_MASTER); 1960 CX2_RESET_REG_MASTER_DISABLED | CX2_RESET_REG_STOP_MASTER);
1961 1961
1962 IPW_DEBUG_FW("<< dmaWaitSync \n"); 1962 IPW_DEBUG_FW("<< dmaWaitSync \n");
1963 return 0; 1963 return 0;
1964} 1964}
1965 1965
1966static void ipw_remove_current_network(struct ipw_priv *priv) 1966static void ipw_remove_current_network(struct ipw_priv *priv)
1967{ 1967{
1968 struct list_head *element, *safe; 1968 struct list_head *element, *safe;
1969 struct ieee80211_network *network = NULL; 1969 struct ieee80211_network *network = NULL;
1970 list_for_each_safe(element, safe, &priv->ieee->network_list) { 1970 list_for_each_safe(element, safe, &priv->ieee->network_list) {
1971 network = list_entry(element, struct ieee80211_network, list); 1971 network = list_entry(element, struct ieee80211_network, list);
1972 if (!memcmp(network->bssid, priv->bssid, ETH_ALEN)) { 1972 if (!memcmp(network->bssid, priv->bssid, ETH_ALEN)) {
1973 list_del(element); 1973 list_del(element);
1974 list_add_tail(&network->list, 1974 list_add_tail(&network->list,
1975 &priv->ieee->network_free_list); 1975 &priv->ieee->network_free_list);
1976 } 1976 }
1977 } 1977 }
1978} 1978}
1979 1979
1980/** 1980/**
1981 * Check that card is still alive. 1981 * Check that card is still alive.
1982 * Reads debug register from domain0. 1982 * Reads debug register from domain0.
1983 * If card is present, pre-defined value should 1983 * If card is present, pre-defined value should
1984 * be found there. 1984 * be found there.
1985 * 1985 *
1986 * @param priv 1986 * @param priv
1987 * @return 1 if card is present, 0 otherwise 1987 * @return 1 if card is present, 0 otherwise
1988 */ 1988 */
@@ -1997,16 +1997,16 @@ static inline int ipw_poll_bit(struct ipw_priv *priv, u32 addr, u32 mask,
1997 int i = 0; 1997 int i = 0;
1998 1998
1999 do { 1999 do {
2000 if ((ipw_read32(priv, addr) & mask) == mask) 2000 if ((ipw_read32(priv, addr) & mask) == mask)
2001 return i; 2001 return i;
2002 mdelay(10); 2002 mdelay(10);
2003 i += 10; 2003 i += 10;
2004 } while (i < timeout); 2004 } while (i < timeout);
2005 2005
2006 return -ETIME; 2006 return -ETIME;
2007} 2007}
2008 2008
2009/* These functions load the firmware and micro code for the operation of 2009/* These functions load the firmware and micro code for the operation of
2010 * the ipw hardware. It assumes the buffer has all the bits for the 2010 * the ipw hardware. It assumes the buffer has all the bits for the
2011 * image and the caller is handling the memory allocation and clean up. 2011 * image and the caller is handling the memory allocation and clean up.
2012 */ 2012 */
@@ -2015,7 +2015,7 @@ static inline int ipw_poll_bit(struct ipw_priv *priv, u32 addr, u32 mask,
2015static int ipw_stop_master(struct ipw_priv * priv) 2015static int ipw_stop_master(struct ipw_priv * priv)
2016{ 2016{
2017 int rc; 2017 int rc;
2018 2018
2019 IPW_DEBUG_TRACE(">> \n"); 2019 IPW_DEBUG_TRACE(">> \n");
2020 /* stop master. typical delay - 0 */ 2020 /* stop master. typical delay - 0 */
2021 ipw_set_bit(priv, CX2_RESET_REG, CX2_RESET_REG_STOP_MASTER); 2021 ipw_set_bit(priv, CX2_RESET_REG, CX2_RESET_REG_STOP_MASTER);
@@ -2079,16 +2079,16 @@ static int ipw_load_ucode(struct ipw_priv *priv, u8 * data,
2079 u16 *image; 2079 u16 *image;
2080 2080
2081 image = (u16 *)data; 2081 image = (u16 *)data;
2082 2082
2083 IPW_DEBUG_TRACE(">> \n"); 2083 IPW_DEBUG_TRACE(">> \n");
2084 2084
2085 rc = ipw_stop_master(priv); 2085 rc = ipw_stop_master(priv);
2086 2086
2087 if (rc < 0) 2087 if (rc < 0)
2088 return rc; 2088 return rc;
2089 2089
2090// spin_lock_irqsave(&priv->lock, flags); 2090// spin_lock_irqsave(&priv->lock, flags);
2091 2091
2092 for (addr = CX2_SHARED_LOWER_BOUND; 2092 for (addr = CX2_SHARED_LOWER_BOUND;
2093 addr < CX2_REGISTER_DOMAIN1_END; addr += 4) { 2093 addr < CX2_REGISTER_DOMAIN1_END; addr += 4) {
2094 ipw_write32(priv, addr, 0); 2094 ipw_write32(priv, addr, 0);
@@ -2107,10 +2107,10 @@ static int ipw_load_ucode(struct ipw_priv *priv, u8 * data,
2107 /* reset PHY */ 2107 /* reset PHY */
2108 ipw_write_reg32(priv, CX2_INTERNAL_CMD_EVENT, CX2_BASEBAND_POWER_DOWN); 2108 ipw_write_reg32(priv, CX2_INTERNAL_CMD_EVENT, CX2_BASEBAND_POWER_DOWN);
2109 mdelay(1); 2109 mdelay(1);
2110 2110
2111 ipw_write_reg32(priv, CX2_INTERNAL_CMD_EVENT, 0); 2111 ipw_write_reg32(priv, CX2_INTERNAL_CMD_EVENT, 0);
2112 mdelay(1); 2112 mdelay(1);
2113 2113
2114 /* enable ucode store */ 2114 /* enable ucode store */
2115 ipw_write_reg8(priv, DINO_CONTROL_REG, 0x0); 2115 ipw_write_reg8(priv, DINO_CONTROL_REG, 0x0);
2116 ipw_write_reg8(priv, DINO_CONTROL_REG, DINO_ENABLE_CS); 2116 ipw_write_reg8(priv, DINO_CONTROL_REG, DINO_ENABLE_CS);
@@ -2128,7 +2128,7 @@ static int ipw_load_ucode(struct ipw_priv *priv, u8 * data,
2128 for (i = 0; i < len / 2; i++) 2128 for (i = 0; i < len / 2; i++)
2129 ipw_write_reg16(priv, CX2_BASEBAND_CONTROL_STORE, image[i]); 2129 ipw_write_reg16(priv, CX2_BASEBAND_CONTROL_STORE, image[i]);
2130 2130
2131 2131
2132 /* enable DINO */ 2132 /* enable DINO */
2133 ipw_write_reg8(priv, CX2_BASEBAND_CONTROL_STATUS, 0); 2133 ipw_write_reg8(priv, CX2_BASEBAND_CONTROL_STATUS, 0);
2134 ipw_write_reg8(priv, CX2_BASEBAND_CONTROL_STATUS, 2134 ipw_write_reg8(priv, CX2_BASEBAND_CONTROL_STATUS,
@@ -2148,10 +2148,10 @@ static int ipw_load_ucode(struct ipw_priv *priv, u8 * data,
2148 if (cr & DINO_RXFIFO_DATA) { 2148 if (cr & DINO_RXFIFO_DATA) {
2149 /* alive_command_responce size is NOT multiple of 4 */ 2149 /* alive_command_responce size is NOT multiple of 4 */
2150 u32 response_buffer[(sizeof(priv->dino_alive) + 3) / 4]; 2150 u32 response_buffer[(sizeof(priv->dino_alive) + 3) / 4];
2151 2151
2152 for (i = 0; i < ARRAY_SIZE(response_buffer); i++) 2152 for (i = 0; i < ARRAY_SIZE(response_buffer); i++)
2153 response_buffer[i] = 2153 response_buffer[i] =
2154 ipw_read_reg32(priv, 2154 ipw_read_reg32(priv,
2155 CX2_BASEBAND_RX_FIFO_READ); 2155 CX2_BASEBAND_RX_FIFO_READ);
2156 memcpy(&priv->dino_alive, response_buffer, 2156 memcpy(&priv->dino_alive, response_buffer,
2157 sizeof(priv->dino_alive)); 2157 sizeof(priv->dino_alive));
@@ -2218,7 +2218,7 @@ static int ipw_load_firmware(struct ipw_priv *priv, u8 * data,
2218 chunk = (struct fw_chunk *)(data + offset); 2218 chunk = (struct fw_chunk *)(data + offset);
2219 offset += sizeof(struct fw_chunk); 2219 offset += sizeof(struct fw_chunk);
2220 /* build DMA packet and queue up for sending */ 2220 /* build DMA packet and queue up for sending */
2221 /* dma to chunk->address, the chunk->length bytes from data + 2221 /* dma to chunk->address, the chunk->length bytes from data +
2222 * offeset*/ 2222 * offeset*/
2223 /* Dma loading */ 2223 /* Dma loading */
2224 rc = ipw_fw_dma_add_buffer(priv, shared_phys + offset, 2224 rc = ipw_fw_dma_add_buffer(priv, shared_phys + offset,
@@ -2227,7 +2227,7 @@ static int ipw_load_firmware(struct ipw_priv *priv, u8 * data,
2227 IPW_DEBUG_INFO("dmaAddBuffer Failed\n"); 2227 IPW_DEBUG_INFO("dmaAddBuffer Failed\n");
2228 goto out; 2228 goto out;
2229 } 2229 }
2230 2230
2231 offset += chunk->length; 2231 offset += chunk->length;
2232 } while (offset < len); 2232 } while (offset < len);
2233 2233
@@ -2255,16 +2255,16 @@ static int ipw_stop_nic(struct ipw_priv *priv)
2255 2255
2256 /* stop*/ 2256 /* stop*/
2257 ipw_write32(priv, CX2_RESET_REG, CX2_RESET_REG_STOP_MASTER); 2257 ipw_write32(priv, CX2_RESET_REG, CX2_RESET_REG_STOP_MASTER);
2258 2258
2259 rc = ipw_poll_bit(priv, CX2_RESET_REG, 2259 rc = ipw_poll_bit(priv, CX2_RESET_REG,
2260 CX2_RESET_REG_MASTER_DISABLED, 500); 2260 CX2_RESET_REG_MASTER_DISABLED, 500);
2261 if (rc < 0) { 2261 if (rc < 0) {
2262 IPW_ERROR("wait for reg master disabled failed\n"); 2262 IPW_ERROR("wait for reg master disabled failed\n");
2263 return rc; 2263 return rc;
2264 } 2264 }
2265 2265
2266 ipw_set_bit(priv, CX2_RESET_REG, CBD_RESET_REG_PRINCETON_RESET); 2266 ipw_set_bit(priv, CX2_RESET_REG, CBD_RESET_REG_PRINCETON_RESET);
2267 2267
2268 return rc; 2268 return rc;
2269} 2269}
2270 2270
@@ -2274,22 +2274,22 @@ static void ipw_start_nic(struct ipw_priv *priv)
2274 2274
2275 /* prvHwStartNic release ARC*/ 2275 /* prvHwStartNic release ARC*/
2276 ipw_clear_bit(priv, CX2_RESET_REG, 2276 ipw_clear_bit(priv, CX2_RESET_REG,
2277 CX2_RESET_REG_MASTER_DISABLED | 2277 CX2_RESET_REG_MASTER_DISABLED |
2278 CX2_RESET_REG_STOP_MASTER | 2278 CX2_RESET_REG_STOP_MASTER |
2279 CBD_RESET_REG_PRINCETON_RESET); 2279 CBD_RESET_REG_PRINCETON_RESET);
2280 2280
2281 /* enable power management */ 2281 /* enable power management */
2282 ipw_set_bit(priv, CX2_GP_CNTRL_RW, CX2_GP_CNTRL_BIT_HOST_ALLOWS_STANDBY); 2282 ipw_set_bit(priv, CX2_GP_CNTRL_RW, CX2_GP_CNTRL_BIT_HOST_ALLOWS_STANDBY);
2283 2283
2284 IPW_DEBUG_TRACE("<<\n"); 2284 IPW_DEBUG_TRACE("<<\n");
2285} 2285}
2286 2286
2287static int ipw_init_nic(struct ipw_priv *priv) 2287static int ipw_init_nic(struct ipw_priv *priv)
2288{ 2288{
2289 int rc; 2289 int rc;
2290 2290
2291 IPW_DEBUG_TRACE(">>\n"); 2291 IPW_DEBUG_TRACE(">>\n");
2292 /* reset */ 2292 /* reset */
2293 /*prvHwInitNic */ 2293 /*prvHwInitNic */
2294 /* set "initialization complete" bit to move adapter to D0 state */ 2294 /* set "initialization complete" bit to move adapter to D0 state */
2295 ipw_set_bit(priv, CX2_GP_CNTRL_RW, CX2_GP_CNTRL_BIT_INIT_DONE); 2295 ipw_set_bit(priv, CX2_GP_CNTRL_RW, CX2_GP_CNTRL_BIT_INIT_DONE);
@@ -2298,8 +2298,8 @@ static int ipw_init_nic(struct ipw_priv *priv)
2298 ipw_write32(priv, CX2_READ_INT_REGISTER, CX2_BIT_INT_HOST_SRAM_READ_INT_REGISTER); 2298 ipw_write32(priv, CX2_READ_INT_REGISTER, CX2_BIT_INT_HOST_SRAM_READ_INT_REGISTER);
2299 2299
2300 /* wait for clock stabilization */ 2300 /* wait for clock stabilization */
2301 rc = ipw_poll_bit(priv, CX2_GP_CNTRL_RW, 2301 rc = ipw_poll_bit(priv, CX2_GP_CNTRL_RW,
2302 CX2_GP_CNTRL_BIT_CLOCK_READY, 250); 2302 CX2_GP_CNTRL_BIT_CLOCK_READY, 250);
2303 if (rc < 0 ) 2303 if (rc < 0 )
2304 IPW_DEBUG_INFO("FAILED wait for clock stablization\n"); 2304 IPW_DEBUG_INFO("FAILED wait for clock stablization\n");
2305 2305
@@ -2316,7 +2316,7 @@ static int ipw_init_nic(struct ipw_priv *priv)
2316} 2316}
2317 2317
2318 2318
2319/* Call this function from process context, it will sleep in request_firmware. 2319/* Call this function from process context, it will sleep in request_firmware.
2320 * Probe is an ok place to call this from. 2320 * Probe is an ok place to call this from.
2321 */ 2321 */
2322static int ipw_reset_nic(struct ipw_priv *priv) 2322static int ipw_reset_nic(struct ipw_priv *priv)
@@ -2324,18 +2324,18 @@ static int ipw_reset_nic(struct ipw_priv *priv)
2324 int rc = 0; 2324 int rc = 0;
2325 2325
2326 IPW_DEBUG_TRACE(">>\n"); 2326 IPW_DEBUG_TRACE(">>\n");
2327 2327
2328 rc = ipw_init_nic(priv); 2328 rc = ipw_init_nic(priv);
2329 2329
2330 /* Clear the 'host command active' bit... */ 2330 /* Clear the 'host command active' bit... */
2331 priv->status &= ~STATUS_HCMD_ACTIVE; 2331 priv->status &= ~STATUS_HCMD_ACTIVE;
2332 wake_up_interruptible(&priv->wait_command_queue); 2332 wake_up_interruptible(&priv->wait_command_queue);
2333 2333
2334 IPW_DEBUG_TRACE("<<\n"); 2334 IPW_DEBUG_TRACE("<<\n");
2335 return rc; 2335 return rc;
2336} 2336}
2337 2337
2338static int ipw_get_fw(struct ipw_priv *priv, 2338static int ipw_get_fw(struct ipw_priv *priv,
2339 const struct firmware **fw, const char *name) 2339 const struct firmware **fw, const char *name)
2340{ 2340{
2341 struct fw_header *header; 2341 struct fw_header *header;
@@ -2346,7 +2346,7 @@ static int ipw_get_fw(struct ipw_priv *priv,
2346 if (rc < 0) { 2346 if (rc < 0) {
2347 IPW_ERROR("%s load failed: Reason %d\n", name, rc); 2347 IPW_ERROR("%s load failed: Reason %d\n", name, rc);
2348 return rc; 2348 return rc;
2349 } 2349 }
2350 2350
2351 header = (struct fw_header *)(*fw)->data; 2351 header = (struct fw_header *)(*fw)->data;
2352 if (IPW_FW_MAJOR(header->version) != IPW_FW_MAJOR_VERSION) { 2352 if (IPW_FW_MAJOR(header->version) != IPW_FW_MAJOR_VERSION) {
@@ -2389,7 +2389,7 @@ static inline void ipw_rx_queue_reset(struct ipw_priv *priv,
2389 } 2389 }
2390 list_add_tail(&rxq->pool[i].list, &rxq->rx_used); 2390 list_add_tail(&rxq->pool[i].list, &rxq->rx_used);
2391 } 2391 }
2392 2392
2393 /* Set us so that we have processed and used all buffers, but have 2393 /* Set us so that we have processed and used all buffers, but have
2394 * not restocked the Rx queue with fresh buffers */ 2394 * not restocked the Rx queue with fresh buffers */
2395 rxq->read = rxq->write = 0; 2395 rxq->read = rxq->write = 0;
@@ -2418,43 +2418,43 @@ static int ipw_load(struct ipw_priv *priv)
2418 if (!fw_loaded) { 2418 if (!fw_loaded) {
2419#endif 2419#endif
2420 rc = ipw_get_fw(priv, &bootfw, IPW_FW_NAME("boot")); 2420 rc = ipw_get_fw(priv, &bootfw, IPW_FW_NAME("boot"));
2421 if (rc) 2421 if (rc)
2422 goto error; 2422 goto error;
2423 2423
2424 switch (priv->ieee->iw_mode) { 2424 switch (priv->ieee->iw_mode) {
2425 case IW_MODE_ADHOC: 2425 case IW_MODE_ADHOC:
2426 rc = ipw_get_fw(priv, &ucode, 2426 rc = ipw_get_fw(priv, &ucode,
2427 IPW_FW_NAME("ibss_ucode")); 2427 IPW_FW_NAME("ibss_ucode"));
2428 if (rc) 2428 if (rc)
2429 goto error; 2429 goto error;
2430 2430
2431 rc = ipw_get_fw(priv, &firmware, IPW_FW_NAME("ibss")); 2431 rc = ipw_get_fw(priv, &firmware, IPW_FW_NAME("ibss"));
2432 break; 2432 break;
2433 2433
2434#ifdef CONFIG_IPW_PROMISC 2434#ifdef CONFIG_IPW_PROMISC
2435 case IW_MODE_MONITOR: 2435 case IW_MODE_MONITOR:
2436 rc = ipw_get_fw(priv, &ucode, 2436 rc = ipw_get_fw(priv, &ucode,
2437 IPW_FW_NAME("ibss_ucode")); 2437 IPW_FW_NAME("ibss_ucode"));
2438 if (rc) 2438 if (rc)
2439 goto error; 2439 goto error;
2440 2440
2441 rc = ipw_get_fw(priv, &firmware, IPW_FW_NAME("sniffer")); 2441 rc = ipw_get_fw(priv, &firmware, IPW_FW_NAME("sniffer"));
2442 break; 2442 break;
2443#endif 2443#endif
2444 case IW_MODE_INFRA: 2444 case IW_MODE_INFRA:
2445 rc = ipw_get_fw(priv, &ucode, 2445 rc = ipw_get_fw(priv, &ucode,
2446 IPW_FW_NAME("bss_ucode")); 2446 IPW_FW_NAME("bss_ucode"));
2447 if (rc) 2447 if (rc)
2448 goto error; 2448 goto error;
2449 2449
2450 rc = ipw_get_fw(priv, &firmware, IPW_FW_NAME("bss")); 2450 rc = ipw_get_fw(priv, &firmware, IPW_FW_NAME("bss"));
2451 break; 2451 break;
2452 2452
2453 default: 2453 default:
2454 rc = -EINVAL; 2454 rc = -EINVAL;
2455 } 2455 }
2456 2456
2457 if (rc) 2457 if (rc)
2458 goto error; 2458 goto error;
2459 2459
2460#ifdef CONFIG_PM 2460#ifdef CONFIG_PM
@@ -2478,7 +2478,7 @@ static int ipw_load(struct ipw_priv *priv)
2478 2478
2479 /* ack pending interrupts */ 2479 /* ack pending interrupts */
2480 ipw_write32(priv, CX2_INTA_RW, CX2_INTA_MASK_ALL); 2480 ipw_write32(priv, CX2_INTA_RW, CX2_INTA_MASK_ALL);
2481 2481
2482 ipw_stop_nic(priv); 2482 ipw_stop_nic(priv);
2483 2483
2484 rc = ipw_reset_nic(priv); 2484 rc = ipw_reset_nic(priv);
@@ -2487,11 +2487,11 @@ static int ipw_load(struct ipw_priv *priv)
2487 goto error; 2487 goto error;
2488 } 2488 }
2489 2489
2490 ipw_zero_memory(priv, CX2_NIC_SRAM_LOWER_BOUND, 2490 ipw_zero_memory(priv, CX2_NIC_SRAM_LOWER_BOUND,
2491 CX2_NIC_SRAM_UPPER_BOUND - CX2_NIC_SRAM_LOWER_BOUND); 2491 CX2_NIC_SRAM_UPPER_BOUND - CX2_NIC_SRAM_LOWER_BOUND);
2492 2492
2493 /* DMA the initial boot firmware into the device */ 2493 /* DMA the initial boot firmware into the device */
2494 rc = ipw_load_firmware(priv, bootfw->data + sizeof(struct fw_header), 2494 rc = ipw_load_firmware(priv, bootfw->data + sizeof(struct fw_header),
2495 bootfw->size - sizeof(struct fw_header)); 2495 bootfw->size - sizeof(struct fw_header));
2496 if (rc < 0) { 2496 if (rc < 0) {
2497 IPW_ERROR("Unable to load boot firmware\n"); 2497 IPW_ERROR("Unable to load boot firmware\n");
@@ -2502,31 +2502,31 @@ static int ipw_load(struct ipw_priv *priv)
2502 ipw_start_nic(priv); 2502 ipw_start_nic(priv);
2503 2503
2504 /* wait for the device to finish it's initial startup sequence */ 2504 /* wait for the device to finish it's initial startup sequence */
2505 rc = ipw_poll_bit(priv, CX2_INTA_RW, 2505 rc = ipw_poll_bit(priv, CX2_INTA_RW,
2506 CX2_INTA_BIT_FW_INITIALIZATION_DONE, 500); 2506 CX2_INTA_BIT_FW_INITIALIZATION_DONE, 500);
2507 if (rc < 0) { 2507 if (rc < 0) {
2508 IPW_ERROR("device failed to boot initial fw image\n"); 2508 IPW_ERROR("device failed to boot initial fw image\n");
2509 goto error; 2509 goto error;
2510 } 2510 }
2511 IPW_DEBUG_INFO("initial device response after %dms\n", rc); 2511 IPW_DEBUG_INFO("initial device response after %dms\n", rc);
2512 2512
2513 /* ack fw init done interrupt */ 2513 /* ack fw init done interrupt */
2514 ipw_write32(priv, CX2_INTA_RW, CX2_INTA_BIT_FW_INITIALIZATION_DONE); 2514 ipw_write32(priv, CX2_INTA_RW, CX2_INTA_BIT_FW_INITIALIZATION_DONE);
2515 2515
2516 /* DMA the ucode into the device */ 2516 /* DMA the ucode into the device */
2517 rc = ipw_load_ucode(priv, ucode->data + sizeof(struct fw_header), 2517 rc = ipw_load_ucode(priv, ucode->data + sizeof(struct fw_header),
2518 ucode->size - sizeof(struct fw_header)); 2518 ucode->size - sizeof(struct fw_header));
2519 if (rc < 0) { 2519 if (rc < 0) {
2520 IPW_ERROR("Unable to load ucode\n"); 2520 IPW_ERROR("Unable to load ucode\n");
2521 goto error; 2521 goto error;
2522 } 2522 }
2523 2523
2524 /* stop nic */ 2524 /* stop nic */
2525 ipw_stop_nic(priv); 2525 ipw_stop_nic(priv);
2526 2526
2527 /* DMA bss firmware into the device */ 2527 /* DMA bss firmware into the device */
2528 rc = ipw_load_firmware(priv, firmware->data + 2528 rc = ipw_load_firmware(priv, firmware->data +
2529 sizeof(struct fw_header), 2529 sizeof(struct fw_header),
2530 firmware->size - sizeof(struct fw_header)); 2530 firmware->size - sizeof(struct fw_header));
2531 if (rc < 0 ) { 2531 if (rc < 0 ) {
2532 IPW_ERROR("Unable to load firmware\n"); 2532 IPW_ERROR("Unable to load firmware\n");
@@ -2543,7 +2543,7 @@ static int ipw_load(struct ipw_priv *priv)
2543 2543
2544 /* Ensure interrupts are disabled */ 2544 /* Ensure interrupts are disabled */
2545 ipw_write32(priv, CX2_INTA_MASK_R, ~CX2_INTA_MASK_ALL); 2545 ipw_write32(priv, CX2_INTA_MASK_R, ~CX2_INTA_MASK_ALL);
2546 2546
2547 /* kick start the device */ 2547 /* kick start the device */
2548 ipw_start_nic(priv); 2548 ipw_start_nic(priv);
2549 2549
@@ -2560,8 +2560,8 @@ static int ipw_load(struct ipw_priv *priv)
2560 } 2560 }
2561 2561
2562 /* wait for the device */ 2562 /* wait for the device */
2563 rc = ipw_poll_bit(priv, CX2_INTA_RW, 2563 rc = ipw_poll_bit(priv, CX2_INTA_RW,
2564 CX2_INTA_BIT_FW_INITIALIZATION_DONE, 500); 2564 CX2_INTA_BIT_FW_INITIALIZATION_DONE, 500);
2565 if (rc < 0) { 2565 if (rc < 0) {
2566 IPW_ERROR("device failed to start after 500ms\n"); 2566 IPW_ERROR("device failed to start after 500ms\n");
2567 goto error; 2567 goto error;
@@ -2573,7 +2573,7 @@ static int ipw_load(struct ipw_priv *priv)
2573 2573
2574 /* read eeprom data and initialize the eeprom region of sram */ 2574 /* read eeprom data and initialize the eeprom region of sram */
2575 priv->eeprom_delay = 1; 2575 priv->eeprom_delay = 1;
2576 ipw_eeprom_init_sram(priv); 2576 ipw_eeprom_init_sram(priv);
2577 2577
2578 /* enable interrupts */ 2578 /* enable interrupts */
2579 ipw_enable_interrupts(priv); 2579 ipw_enable_interrupts(priv);
@@ -2613,7 +2613,7 @@ static int ipw_load(struct ipw_priv *priv)
2613 return rc; 2613 return rc;
2614} 2614}
2615 2615
2616/** 2616/**
2617 * DMA services 2617 * DMA services
2618 * 2618 *
2619 * Theory of operation 2619 * Theory of operation
@@ -2622,17 +2622,17 @@ static int ipw_load(struct ipw_priv *priv)
2622 * 2 empty entries always kept in the buffer to protect from overflow. 2622 * 2 empty entries always kept in the buffer to protect from overflow.
2623 * 2623 *
2624 * For Tx queue, there are low mark and high mark limits. If, after queuing 2624 * For Tx queue, there are low mark and high mark limits. If, after queuing
2625 * the packet for Tx, free space become < low mark, Tx queue stopped. When 2625 * the packet for Tx, free space become < low mark, Tx queue stopped. When
2626 * reclaiming packets (on 'tx done IRQ), if free space become > high mark, 2626 * reclaiming packets (on 'tx done IRQ), if free space become > high mark,
2627 * Tx queue resumed. 2627 * Tx queue resumed.
2628 * 2628 *
2629 * The IPW operates with six queues, one receive queue in the device's 2629 * The IPW operates with six queues, one receive queue in the device's
2630 * sram, one transmit queue for sending commands to the device firmware, 2630 * sram, one transmit queue for sending commands to the device firmware,
2631 * and four transmit queues for data. 2631 * and four transmit queues for data.
2632 * 2632 *
2633 * The four transmit queues allow for performing quality of service (qos) 2633 * The four transmit queues allow for performing quality of service (qos)
2634 * transmissions as per the 802.11 protocol. Currently Linux does not 2634 * transmissions as per the 802.11 protocol. Currently Linux does not
2635 * provide a mechanism to the user for utilizing prioritized queues, so 2635 * provide a mechanism to the user for utilizing prioritized queues, so
2636 * we only utilize the first data transmit queue (queue1). 2636 * we only utilize the first data transmit queue (queue1).
2637 */ 2637 */
2638 2638
@@ -2658,7 +2658,7 @@ static inline int ipw_queue_inc_wrap(int index, int n_bd)
2658 2658
2659/** 2659/**
2660 * Initialize common DMA queue structure 2660 * Initialize common DMA queue structure
2661 * 2661 *
2662 * @param q queue to init 2662 * @param q queue to init
2663 * @param count Number of BD's to allocate. Should be power of 2 2663 * @param count Number of BD's to allocate. Should be power of 2
2664 * @param read_register Address for 'read' register 2664 * @param read_register Address for 'read' register
@@ -2670,7 +2670,7 @@ static inline int ipw_queue_inc_wrap(int index, int n_bd)
2670 * @param size Address for 'size' register 2670 * @param size Address for 'size' register
2671 * (not offset within BAR, full address) 2671 * (not offset within BAR, full address)
2672 */ 2672 */
2673static void ipw_queue_init(struct ipw_priv *priv, struct clx2_queue *q, 2673static void ipw_queue_init(struct ipw_priv *priv, struct clx2_queue *q,
2674 int count, u32 read, u32 write, 2674 int count, u32 read, u32 write,
2675 u32 base, u32 size) 2675 u32 base, u32 size)
2676{ 2676{
@@ -2696,7 +2696,7 @@ static void ipw_queue_init(struct ipw_priv *priv, struct clx2_queue *q,
2696 _ipw_read32(priv, 0x90); 2696 _ipw_read32(priv, 0x90);
2697} 2697}
2698 2698
2699static int ipw_queue_tx_init(struct ipw_priv *priv, 2699static int ipw_queue_tx_init(struct ipw_priv *priv,
2700 struct clx2_tx_queue *q, 2700 struct clx2_tx_queue *q,
2701 int count, u32 read, u32 write, 2701 int count, u32 read, u32 write,
2702 u32 base, u32 size) 2702 u32 base, u32 size)
@@ -2725,7 +2725,7 @@ static int ipw_queue_tx_init(struct ipw_priv *priv,
2725/** 2725/**
2726 * Free one TFD, those at index [txq->q.last_used]. 2726 * Free one TFD, those at index [txq->q.last_used].
2727 * Do NOT advance any indexes 2727 * Do NOT advance any indexes
2728 * 2728 *
2729 * @param dev 2729 * @param dev
2730 * @param txq 2730 * @param txq
2731 */ 2731 */
@@ -2735,7 +2735,7 @@ static void ipw_queue_tx_free_tfd(struct ipw_priv *priv,
2735 struct tfd_frame *bd = &txq->bd[txq->q.last_used]; 2735 struct tfd_frame *bd = &txq->bd[txq->q.last_used];
2736 struct pci_dev *dev = priv->pci_dev; 2736 struct pci_dev *dev = priv->pci_dev;
2737 int i; 2737 int i;
2738 2738
2739 /* classify bd */ 2739 /* classify bd */
2740 if (bd->control_flags.message_type == TX_HOST_COMMAND_TYPE) 2740 if (bd->control_flags.message_type == TX_HOST_COMMAND_TYPE)
2741 /* nothing to cleanup after for host commands */ 2741 /* nothing to cleanup after for host commands */
@@ -2761,10 +2761,10 @@ static void ipw_queue_tx_free_tfd(struct ipw_priv *priv,
2761 2761
2762/** 2762/**
2763 * Deallocate DMA queue. 2763 * Deallocate DMA queue.
2764 * 2764 *
2765 * Empty queue by removing and destroying all BD's. 2765 * Empty queue by removing and destroying all BD's.
2766 * Free all buffers. 2766 * Free all buffers.
2767 * 2767 *
2768 * @param dev 2768 * @param dev
2769 * @param q 2769 * @param q
2770 */ 2770 */
@@ -2774,17 +2774,17 @@ static void ipw_queue_tx_free(struct ipw_priv *priv,
2774 struct clx2_queue *q = &txq->q; 2774 struct clx2_queue *q = &txq->q;
2775 struct pci_dev *dev = priv->pci_dev; 2775 struct pci_dev *dev = priv->pci_dev;
2776 2776
2777 if (q->n_bd == 0) 2777 if (q->n_bd == 0)
2778 return; 2778 return;
2779 2779
2780 /* first, empty all BD's */ 2780 /* first, empty all BD's */
2781 for (; q->first_empty != q->last_used; 2781 for (; q->first_empty != q->last_used;
2782 q->last_used = ipw_queue_inc_wrap(q->last_used, q->n_bd)) { 2782 q->last_used = ipw_queue_inc_wrap(q->last_used, q->n_bd)) {
2783 ipw_queue_tx_free_tfd(priv, txq); 2783 ipw_queue_tx_free_tfd(priv, txq);
2784 } 2784 }
2785 2785
2786 /* free buffers belonging to queue itself */ 2786 /* free buffers belonging to queue itself */
2787 pci_free_consistent(dev, sizeof(txq->bd[0])*q->n_bd, txq->bd, 2787 pci_free_consistent(dev, sizeof(txq->bd[0])*q->n_bd, txq->bd,
2788 q->dma_addr); 2788 q->dma_addr);
2789 kfree(txq->txb); 2789 kfree(txq->txb);
2790 2790
@@ -2795,7 +2795,7 @@ static void ipw_queue_tx_free(struct ipw_priv *priv,
2795 2795
2796/** 2796/**
2797 * Destroy all DMA queues and structures 2797 * Destroy all DMA queues and structures
2798 * 2798 *
2799 * @param priv 2799 * @param priv
2800 */ 2800 */
2801static void ipw_tx_queue_free(struct ipw_priv *priv) 2801static void ipw_tx_queue_free(struct ipw_priv *priv)
@@ -2877,8 +2877,8 @@ static inline u8 ipw_find_station(struct ipw_priv *priv, u8 *bssid)
2877{ 2877{
2878 int i; 2878 int i;
2879 2879
2880 for (i = 0; i < priv->num_stations; i++) 2880 for (i = 0; i < priv->num_stations; i++)
2881 if (!memcmp(priv->stations[i], bssid, ETH_ALEN)) 2881 if (!memcmp(priv->stations[i], bssid, ETH_ALEN))
2882 return i; 2882 return i;
2883 2883
2884 return IPW_INVALID_STATION; 2884 return IPW_INVALID_STATION;
@@ -2895,7 +2895,7 @@ static void ipw_send_disassociate(struct ipw_priv *priv, int quiet)
2895 2895
2896 IPW_DEBUG_ASSOC("Disassocation attempt from " MAC_FMT " " 2896 IPW_DEBUG_ASSOC("Disassocation attempt from " MAC_FMT " "
2897 "on channel %d.\n", 2897 "on channel %d.\n",
2898 MAC_ARG(priv->assoc_request.bssid), 2898 MAC_ARG(priv->assoc_request.bssid),
2899 priv->assoc_request.channel); 2899 priv->assoc_request.channel);
2900 2900
2901 priv->status &= ~(STATUS_ASSOCIATING | STATUS_ASSOCIATED); 2901 priv->status &= ~(STATUS_ASSOCIATING | STATUS_ASSOCIATED);
@@ -2975,10 +2975,10 @@ static const struct ipw_status_code ipw_status_codes[] = {
2975}; 2975};
2976 2976
2977#ifdef CONFIG_IPW_DEBUG 2977#ifdef CONFIG_IPW_DEBUG
2978static const char *ipw_get_status_code(u16 status) 2978static const char *ipw_get_status_code(u16 status)
2979{ 2979{
2980 int i; 2980 int i;
2981 for (i = 0; i < ARRAY_SIZE(ipw_status_codes); i++) 2981 for (i = 0; i < ARRAY_SIZE(ipw_status_codes); i++)
2982 if (ipw_status_codes[i].status == status) 2982 if (ipw_status_codes[i].status == status)
2983 return ipw_status_codes[i].reason; 2983 return ipw_status_codes[i].reason;
2984 return "Unknown status value."; 2984 return "Unknown status value.";
@@ -3027,12 +3027,12 @@ static void ipw_reset_stats(struct ipw_priv *priv)
3027 priv->last_rx_packets = 0; 3027 priv->last_rx_packets = 0;
3028 priv->last_tx_packets = 0; 3028 priv->last_tx_packets = 0;
3029 priv->last_tx_failures = 0; 3029 priv->last_tx_failures = 0;
3030 3030
3031 /* Firmware managed, reset only when NIC is restarted, so we have to 3031 /* Firmware managed, reset only when NIC is restarted, so we have to
3032 * normalize on the current value */ 3032 * normalize on the current value */
3033 ipw_get_ordinal(priv, IPW_ORD_STAT_RX_ERR_CRC, 3033 ipw_get_ordinal(priv, IPW_ORD_STAT_RX_ERR_CRC,
3034 &priv->last_rx_err, &len); 3034 &priv->last_rx_err, &len);
3035 ipw_get_ordinal(priv, IPW_ORD_STAT_TX_FAILURE, 3035 ipw_get_ordinal(priv, IPW_ORD_STAT_TX_FAILURE,
3036 &priv->last_tx_failures, &len); 3036 &priv->last_tx_failures, &len);
3037 3037
3038 /* Driver managed, reset with each association */ 3038 /* Driver managed, reset with each association */
@@ -3072,7 +3072,7 @@ static inline u32 ipw_get_max_rate(struct ipw_priv *priv)
3072 case IEEE80211_OFDM_RATE_54MB_MASK: return 54000000; 3072 case IEEE80211_OFDM_RATE_54MB_MASK: return 54000000;
3073 } 3073 }
3074 3074
3075 if (priv->ieee->mode == IEEE_B) 3075 if (priv->ieee->mode == IEEE_B)
3076 return 11000000; 3076 return 11000000;
3077 else 3077 else
3078 return 54000000; 3078 return 54000000;
@@ -3083,32 +3083,32 @@ static u32 ipw_get_current_rate(struct ipw_priv *priv)
3083 u32 rate, len = sizeof(rate); 3083 u32 rate, len = sizeof(rate);
3084 int err; 3084 int err;
3085 3085
3086 if (!(priv->status & STATUS_ASSOCIATED)) 3086 if (!(priv->status & STATUS_ASSOCIATED))
3087 return 0; 3087 return 0;
3088 3088
3089 if (priv->tx_packets > IPW_REAL_RATE_RX_PACKET_THRESHOLD) { 3089 if (priv->tx_packets > IPW_REAL_RATE_RX_PACKET_THRESHOLD) {
3090 err = ipw_get_ordinal(priv, IPW_ORD_STAT_TX_CURR_RATE, &rate, 3090 err = ipw_get_ordinal(priv, IPW_ORD_STAT_TX_CURR_RATE, &rate,
3091 &len); 3091 &len);
3092 if (err) { 3092 if (err) {
3093 IPW_DEBUG_INFO("failed querying ordinals.\n"); 3093 IPW_DEBUG_INFO("failed querying ordinals.\n");
3094 return 0; 3094 return 0;
3095 } 3095 }
3096 } else 3096 } else
3097 return ipw_get_max_rate(priv); 3097 return ipw_get_max_rate(priv);
3098 3098
3099 switch (rate) { 3099 switch (rate) {
3100 case IPW_TX_RATE_1MB: return 1000000; 3100 case IPW_TX_RATE_1MB: return 1000000;
3101 case IPW_TX_RATE_2MB: return 2000000; 3101 case IPW_TX_RATE_2MB: return 2000000;
3102 case IPW_TX_RATE_5MB: return 5500000; 3102 case IPW_TX_RATE_5MB: return 5500000;
3103 case IPW_TX_RATE_6MB: return 6000000; 3103 case IPW_TX_RATE_6MB: return 6000000;
3104 case IPW_TX_RATE_9MB: return 9000000; 3104 case IPW_TX_RATE_9MB: return 9000000;
3105 case IPW_TX_RATE_11MB: return 11000000; 3105 case IPW_TX_RATE_11MB: return 11000000;
3106 case IPW_TX_RATE_12MB: return 12000000; 3106 case IPW_TX_RATE_12MB: return 12000000;
3107 case IPW_TX_RATE_18MB: return 18000000; 3107 case IPW_TX_RATE_18MB: return 18000000;
3108 case IPW_TX_RATE_24MB: return 24000000; 3108 case IPW_TX_RATE_24MB: return 24000000;
3109 case IPW_TX_RATE_36MB: return 36000000; 3109 case IPW_TX_RATE_36MB: return 36000000;
3110 case IPW_TX_RATE_48MB: return 48000000; 3110 case IPW_TX_RATE_48MB: return 48000000;
3111 case IPW_TX_RATE_54MB: return 54000000; 3111 case IPW_TX_RATE_54MB: return 54000000;
3112 } 3112 }
3113 3113
3114 return 0; 3114 return 0;
@@ -3125,7 +3125,7 @@ static void ipw_gather_stats(struct ipw_priv *priv)
3125 u32 quality = 0; 3125 u32 quality = 0;
3126 u32 len = sizeof(u32); 3126 u32 len = sizeof(u32);
3127 s16 rssi; 3127 s16 rssi;
3128 u32 beacon_quality, signal_quality, tx_quality, rx_quality, 3128 u32 beacon_quality, signal_quality, tx_quality, rx_quality,
3129 rate_quality; 3129 rate_quality;
3130 3130
3131 if (!(priv->status & STATUS_ASSOCIATED)) { 3131 if (!(priv->status & STATUS_ASSOCIATED)) {
@@ -3134,9 +3134,9 @@ static void ipw_gather_stats(struct ipw_priv *priv)
3134 } 3134 }
3135 3135
3136 /* Update the statistics */ 3136 /* Update the statistics */
3137 ipw_get_ordinal(priv, IPW_ORD_STAT_MISSED_BEACONS, 3137 ipw_get_ordinal(priv, IPW_ORD_STAT_MISSED_BEACONS,
3138 &priv->missed_beacons, &len); 3138 &priv->missed_beacons, &len);
3139 missed_beacons_delta = priv->missed_beacons - 3139 missed_beacons_delta = priv->missed_beacons -
3140 priv->last_missed_beacons; 3140 priv->last_missed_beacons;
3141 priv->last_missed_beacons = priv->missed_beacons; 3141 priv->last_missed_beacons = priv->missed_beacons;
3142 if (priv->assoc_request.beacon_interval) { 3142 if (priv->assoc_request.beacon_interval) {
@@ -3163,13 +3163,13 @@ static void ipw_gather_stats(struct ipw_priv *priv)
3163 priv->last_tx_packets = priv->tx_packets; 3163 priv->last_tx_packets = priv->tx_packets;
3164 3164
3165 /* Calculate quality based on the following: 3165 /* Calculate quality based on the following:
3166 * 3166 *
3167 * Missed beacon: 100% = 0, 0% = 70% missed 3167 * Missed beacon: 100% = 0, 0% = 70% missed
3168 * Rate: 60% = 1Mbs, 100% = Max 3168 * Rate: 60% = 1Mbs, 100% = Max
3169 * Rx and Tx errors represent a straight % of total Rx/Tx 3169 * Rx and Tx errors represent a straight % of total Rx/Tx
3170 * RSSI: 100% = > -50, 0% = < -80 3170 * RSSI: 100% = > -50, 0% = < -80
3171 * Rx errors: 100% = 0, 0% = 50% missed 3171 * Rx errors: 100% = 0, 0% = 50% missed
3172 * 3172 *
3173 * The lowest computed quality is used. 3173 * The lowest computed quality is used.
3174 * 3174 *
3175 */ 3175 */
@@ -3178,72 +3178,72 @@ static void ipw_gather_stats(struct ipw_priv *priv)
3178 if (beacon_quality < BEACON_THRESHOLD) 3178 if (beacon_quality < BEACON_THRESHOLD)
3179 beacon_quality = 0; 3179 beacon_quality = 0;
3180 else 3180 else
3181 beacon_quality = (beacon_quality - BEACON_THRESHOLD) * 100 / 3181 beacon_quality = (beacon_quality - BEACON_THRESHOLD) * 100 /
3182 (100 - BEACON_THRESHOLD); 3182 (100 - BEACON_THRESHOLD);
3183 IPW_DEBUG_STATS("Missed beacon: %3d%% (%d%%)\n", 3183 IPW_DEBUG_STATS("Missed beacon: %3d%% (%d%%)\n",
3184 beacon_quality, missed_beacons_percent); 3184 beacon_quality, missed_beacons_percent);
3185 3185
3186 priv->last_rate = ipw_get_current_rate(priv); 3186 priv->last_rate = ipw_get_current_rate(priv);
3187 rate_quality = priv->last_rate * 40 / priv->last_rate + 60; 3187 rate_quality = priv->last_rate * 40 / priv->last_rate + 60;
3188 IPW_DEBUG_STATS("Rate quality : %3d%% (%dMbs)\n", 3188 IPW_DEBUG_STATS("Rate quality : %3d%% (%dMbs)\n",
3189 rate_quality, priv->last_rate / 1000000); 3189 rate_quality, priv->last_rate / 1000000);
3190 3190
3191 if (rx_packets_delta > 100 && 3191 if (rx_packets_delta > 100 &&
3192 rx_packets_delta + rx_err_delta) 3192 rx_packets_delta + rx_err_delta)
3193 rx_quality = 100 - (rx_err_delta * 100) / 3193 rx_quality = 100 - (rx_err_delta * 100) /
3194 (rx_packets_delta + rx_err_delta); 3194 (rx_packets_delta + rx_err_delta);
3195 else 3195 else
3196 rx_quality = 100; 3196 rx_quality = 100;
3197 IPW_DEBUG_STATS("Rx quality : %3d%% (%u errors, %u packets)\n", 3197 IPW_DEBUG_STATS("Rx quality : %3d%% (%u errors, %u packets)\n",
3198 rx_quality, rx_err_delta, rx_packets_delta); 3198 rx_quality, rx_err_delta, rx_packets_delta);
3199 3199
3200 if (tx_packets_delta > 100 && 3200 if (tx_packets_delta > 100 &&
3201 tx_packets_delta + tx_failures_delta) 3201 tx_packets_delta + tx_failures_delta)
3202 tx_quality = 100 - (tx_failures_delta * 100) / 3202 tx_quality = 100 - (tx_failures_delta * 100) /
3203 (tx_packets_delta + tx_failures_delta); 3203 (tx_packets_delta + tx_failures_delta);
3204 else 3204 else
3205 tx_quality = 100; 3205 tx_quality = 100;
3206 IPW_DEBUG_STATS("Tx quality : %3d%% (%u errors, %u packets)\n", 3206 IPW_DEBUG_STATS("Tx quality : %3d%% (%u errors, %u packets)\n",
3207 tx_quality, tx_failures_delta, tx_packets_delta); 3207 tx_quality, tx_failures_delta, tx_packets_delta);
3208 3208
3209 rssi = average_value(&priv->average_rssi); 3209 rssi = average_value(&priv->average_rssi);
3210 if (rssi > PERFECT_RSSI) 3210 if (rssi > PERFECT_RSSI)
3211 signal_quality = 100; 3211 signal_quality = 100;
3212 else if (rssi < WORST_RSSI) 3212 else if (rssi < WORST_RSSI)
3213 signal_quality = 0; 3213 signal_quality = 0;
3214 else 3214 else
3215 signal_quality = (rssi - WORST_RSSI) * 100 / 3215 signal_quality = (rssi - WORST_RSSI) * 100 /
3216 (PERFECT_RSSI - WORST_RSSI); 3216 (PERFECT_RSSI - WORST_RSSI);
3217 IPW_DEBUG_STATS("Signal level : %3d%% (%d dBm)\n", 3217 IPW_DEBUG_STATS("Signal level : %3d%% (%d dBm)\n",
3218 signal_quality, rssi); 3218 signal_quality, rssi);
3219 3219
3220 quality = min(beacon_quality, 3220 quality = min(beacon_quality,
3221 min(rate_quality, 3221 min(rate_quality,
3222 min(tx_quality, min(rx_quality, signal_quality)))); 3222 min(tx_quality, min(rx_quality, signal_quality))));
3223 if (quality == beacon_quality) 3223 if (quality == beacon_quality)
3224 IPW_DEBUG_STATS( 3224 IPW_DEBUG_STATS(
3225 "Quality (%d%%): Clamped to missed beacons.\n", 3225 "Quality (%d%%): Clamped to missed beacons.\n",
3226 quality); 3226 quality);
3227 if (quality == rate_quality) 3227 if (quality == rate_quality)
3228 IPW_DEBUG_STATS( 3228 IPW_DEBUG_STATS(
3229 "Quality (%d%%): Clamped to rate quality.\n", 3229 "Quality (%d%%): Clamped to rate quality.\n",
3230 quality); 3230 quality);
3231 if (quality == tx_quality) 3231 if (quality == tx_quality)
3232 IPW_DEBUG_STATS( 3232 IPW_DEBUG_STATS(
3233 "Quality (%d%%): Clamped to Tx quality.\n", 3233 "Quality (%d%%): Clamped to Tx quality.\n",
3234 quality); 3234 quality);
3235 if (quality == rx_quality) 3235 if (quality == rx_quality)
3236 IPW_DEBUG_STATS( 3236 IPW_DEBUG_STATS(
3237 "Quality (%d%%): Clamped to Rx quality.\n", 3237 "Quality (%d%%): Clamped to Rx quality.\n",
3238 quality); 3238 quality);
3239 if (quality == signal_quality) 3239 if (quality == signal_quality)
3240 IPW_DEBUG_STATS( 3240 IPW_DEBUG_STATS(
3241 "Quality (%d%%): Clamped to signal quality.\n", 3241 "Quality (%d%%): Clamped to signal quality.\n",
3242 quality); 3242 quality);
3243 3243
3244 priv->quality = quality; 3244 priv->quality = quality;
3245 3245
3246 queue_delayed_work(priv->workqueue, &priv->gather_stats, 3246 queue_delayed_work(priv->workqueue, &priv->gather_stats,
3247 IPW_STATS_INTERVAL); 3247 IPW_STATS_INTERVAL);
3248} 3248}
3249 3249
@@ -3254,35 +3254,35 @@ static void ipw_gather_stats(struct ipw_priv *priv)
3254static inline void ipw_rx_notification(struct ipw_priv* priv, 3254static inline void ipw_rx_notification(struct ipw_priv* priv,
3255 struct ipw_rx_notification *notif) 3255 struct ipw_rx_notification *notif)
3256{ 3256{
3257 IPW_DEBUG_NOTIF("type = %i (%d bytes)\n", 3257 IPW_DEBUG_NOTIF("type = %i (%d bytes)\n",
3258 notif->subtype, notif->size); 3258 notif->subtype, notif->size);
3259 3259
3260 switch (notif->subtype) { 3260 switch (notif->subtype) {
3261 case HOST_NOTIFICATION_STATUS_ASSOCIATED: { 3261 case HOST_NOTIFICATION_STATUS_ASSOCIATED: {
3262 struct notif_association *assoc = &notif->u.assoc; 3262 struct notif_association *assoc = &notif->u.assoc;
3263 3263
3264 switch (assoc->state) { 3264 switch (assoc->state) {
3265 case CMAS_ASSOCIATED: { 3265 case CMAS_ASSOCIATED: {
3266 IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | IPW_DL_ASSOC, 3266 IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | IPW_DL_ASSOC,
3267 "associated: '%s' " MAC_FMT " \n", 3267 "associated: '%s' " MAC_FMT " \n",
3268 escape_essid(priv->essid, priv->essid_len), 3268 escape_essid(priv->essid, priv->essid_len),
3269 MAC_ARG(priv->bssid)); 3269 MAC_ARG(priv->bssid));
3270 3270
3271 switch (priv->ieee->iw_mode) { 3271 switch (priv->ieee->iw_mode) {
3272 case IW_MODE_INFRA: 3272 case IW_MODE_INFRA:
3273 memcpy(priv->ieee->bssid, priv->bssid, 3273 memcpy(priv->ieee->bssid, priv->bssid,
3274 ETH_ALEN); 3274 ETH_ALEN);
3275 break; 3275 break;
3276 3276
3277 case IW_MODE_ADHOC: 3277 case IW_MODE_ADHOC:
3278 memcpy(priv->ieee->bssid, priv->bssid, 3278 memcpy(priv->ieee->bssid, priv->bssid,
3279 ETH_ALEN); 3279 ETH_ALEN);
3280 3280
3281 /* clear out the station table */ 3281 /* clear out the station table */
3282 priv->num_stations = 0; 3282 priv->num_stations = 0;
3283 3283
3284 IPW_DEBUG_ASSOC("queueing adhoc check\n"); 3284 IPW_DEBUG_ASSOC("queueing adhoc check\n");
3285 queue_delayed_work(priv->workqueue, 3285 queue_delayed_work(priv->workqueue,
3286 &priv->adhoc_check, 3286 &priv->adhoc_check,
3287 priv->assoc_request.beacon_interval); 3287 priv->assoc_request.beacon_interval);
3288 break; 3288 break;
@@ -3306,19 +3306,19 @@ static inline void ipw_rx_notification(struct ipw_priv* priv,
3306 schedule_work(&priv->gather_stats); 3306 schedule_work(&priv->gather_stats);
3307 notify_wx_assoc_event(priv); 3307 notify_wx_assoc_event(priv);
3308 3308
3309/* queue_delayed_work(priv->workqueue, 3309/* queue_delayed_work(priv->workqueue,
3310 &priv->request_scan, 3310 &priv->request_scan,
3311 SCAN_ASSOCIATED_INTERVAL); 3311 SCAN_ASSOCIATED_INTERVAL);
3312*/ 3312*/
3313 break; 3313 break;
3314 } 3314 }
3315 3315
3316 case CMAS_AUTHENTICATED: { 3316 case CMAS_AUTHENTICATED: {
3317 if (priv->status & (STATUS_ASSOCIATED | STATUS_AUTH)) { 3317 if (priv->status & (STATUS_ASSOCIATED | STATUS_AUTH)) {
3318#ifdef CONFIG_IPW_DEBUG 3318#ifdef CONFIG_IPW_DEBUG
3319 struct notif_authenticate *auth = &notif->u.auth; 3319 struct notif_authenticate *auth = &notif->u.auth;
3320 IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | IPW_DL_ASSOC, 3320 IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | IPW_DL_ASSOC,
3321 "deauthenticated: '%s' " MAC_FMT ": (0x%04X) - %s \n", 3321 "deauthenticated: '%s' " MAC_FMT ": (0x%04X) - %s \n",
3322 escape_essid(priv->essid, priv->essid_len), 3322 escape_essid(priv->essid, priv->essid_len),
3323 MAC_ARG(priv->bssid), 3323 MAC_ARG(priv->bssid),
3324 ntohs(auth->status), 3324 ntohs(auth->status),
@@ -3332,29 +3332,29 @@ static inline void ipw_rx_notification(struct ipw_priv* priv,
3332 netif_carrier_off(priv->net_dev); 3332 netif_carrier_off(priv->net_dev);
3333 netif_stop_queue(priv->net_dev); 3333 netif_stop_queue(priv->net_dev);
3334 queue_work(priv->workqueue, &priv->request_scan); 3334 queue_work(priv->workqueue, &priv->request_scan);
3335 notify_wx_assoc_event(priv); 3335 notify_wx_assoc_event(priv);
3336 break; 3336 break;
3337 } 3337 }
3338 3338
3339 IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | IPW_DL_ASSOC, 3339 IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | IPW_DL_ASSOC,
3340 "authenticated: '%s' " MAC_FMT "\n", 3340 "authenticated: '%s' " MAC_FMT "\n",
3341 escape_essid(priv->essid, priv->essid_len), 3341 escape_essid(priv->essid, priv->essid_len),
3342 MAC_ARG(priv->bssid)); 3342 MAC_ARG(priv->bssid));
3343 break; 3343 break;
3344 } 3344 }
3345 3345
3346 case CMAS_INIT: { 3346 case CMAS_INIT: {
3347 IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | IPW_DL_ASSOC, 3347 IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | IPW_DL_ASSOC,
3348 "disassociated: '%s' " MAC_FMT " \n", 3348 "disassociated: '%s' " MAC_FMT " \n",
3349 escape_essid(priv->essid, priv->essid_len), 3349 escape_essid(priv->essid, priv->essid_len),
3350 MAC_ARG(priv->bssid)); 3350 MAC_ARG(priv->bssid));
3351 3351
3352 priv->status &= ~( 3352 priv->status &= ~(
3353 STATUS_DISASSOCIATING | 3353 STATUS_DISASSOCIATING |
3354 STATUS_ASSOCIATING | 3354 STATUS_ASSOCIATING |
3355 STATUS_ASSOCIATED | 3355 STATUS_ASSOCIATED |
3356 STATUS_AUTH); 3356 STATUS_AUTH);
3357 3357
3358 netif_stop_queue(priv->net_dev); 3358 netif_stop_queue(priv->net_dev);
3359 if (!(priv->status & STATUS_ROAMING)) { 3359 if (!(priv->status & STATUS_ROAMING)) {
3360 netif_carrier_off(priv->net_dev); 3360 netif_carrier_off(priv->net_dev);
@@ -3365,21 +3365,21 @@ static inline void ipw_rx_notification(struct ipw_priv* priv,
3365 cancel_delayed_work(&priv->adhoc_check); 3365 cancel_delayed_work(&priv->adhoc_check);
3366 3366
3367 /* Queue up another scan... */ 3367 /* Queue up another scan... */
3368 queue_work(priv->workqueue, 3368 queue_work(priv->workqueue,
3369 &priv->request_scan); 3369 &priv->request_scan);
3370 3370
3371 cancel_delayed_work(&priv->gather_stats); 3371 cancel_delayed_work(&priv->gather_stats);
3372 } else { 3372 } else {
3373 priv->status |= STATUS_ROAMING; 3373 priv->status |= STATUS_ROAMING;
3374 queue_work(priv->workqueue, 3374 queue_work(priv->workqueue,
3375 &priv->request_scan); 3375 &priv->request_scan);
3376 } 3376 }
3377 3377
3378 ipw_reset_stats(priv); 3378 ipw_reset_stats(priv);
3379 break; 3379 break;
3380 } 3380 }
3381 3381
3382 default: 3382 default:
3383 IPW_ERROR("assoc: unknown (%d)\n", 3383 IPW_ERROR("assoc: unknown (%d)\n",
3384 assoc->state); 3384 assoc->state);
3385 break; 3385 break;
@@ -3393,7 +3393,7 @@ static inline void ipw_rx_notification(struct ipw_priv* priv,
3393 switch (auth->state) { 3393 switch (auth->state) {
3394 case CMAS_AUTHENTICATED: 3394 case CMAS_AUTHENTICATED:
3395 IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE, 3395 IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE,
3396 "authenticated: '%s' " MAC_FMT " \n", 3396 "authenticated: '%s' " MAC_FMT " \n",
3397 escape_essid(priv->essid, priv->essid_len), 3397 escape_essid(priv->essid, priv->essid_len),
3398 MAC_ARG(priv->bssid)); 3398 MAC_ARG(priv->bssid));
3399 priv->status |= STATUS_AUTH; 3399 priv->status |= STATUS_AUTH;
@@ -3405,9 +3405,9 @@ static inline void ipw_rx_notification(struct ipw_priv* priv,
3405 "authentication failed (0x%04X): %s\n", 3405 "authentication failed (0x%04X): %s\n",
3406 ntohs(auth->status), 3406 ntohs(auth->status),
3407 ipw_get_status_code(ntohs(auth->status))); 3407 ipw_get_status_code(ntohs(auth->status)));
3408 } 3408 }
3409 IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | IPW_DL_ASSOC, 3409 IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | IPW_DL_ASSOC,
3410 "deauthenticated: '%s' " MAC_FMT "\n", 3410 "deauthenticated: '%s' " MAC_FMT "\n",
3411 escape_essid(priv->essid, priv->essid_len), 3411 escape_essid(priv->essid, priv->essid_len),
3412 MAC_ARG(priv->bssid)); 3412 MAC_ARG(priv->bssid));
3413 3413
@@ -3420,7 +3420,7 @@ static inline void ipw_rx_notification(struct ipw_priv* priv,
3420 queue_work(priv->workqueue, &priv->request_scan); 3420 queue_work(priv->workqueue, &priv->request_scan);
3421 notify_wx_assoc_event(priv); 3421 notify_wx_assoc_event(priv);
3422 break; 3422 break;
3423 3423
3424 case CMAS_TX_AUTH_SEQ_1: 3424 case CMAS_TX_AUTH_SEQ_1:
3425 IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | IPW_DL_ASSOC, 3425 IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | IPW_DL_ASSOC,
3426 "AUTH_SEQ_1\n"); 3426 "AUTH_SEQ_1\n");
@@ -3474,9 +3474,9 @@ static inline void ipw_rx_notification(struct ipw_priv* priv,
3474 3474
3475 case HOST_NOTIFICATION_STATUS_SCAN_CHANNEL_RESULT: { 3475 case HOST_NOTIFICATION_STATUS_SCAN_CHANNEL_RESULT: {
3476 struct notif_channel_result *x = &notif->u.channel_result; 3476 struct notif_channel_result *x = &notif->u.channel_result;
3477 3477
3478 if (notif->size == sizeof(*x)) { 3478 if (notif->size == sizeof(*x)) {
3479 IPW_DEBUG_SCAN("Scan result for channel %d\n", 3479 IPW_DEBUG_SCAN("Scan result for channel %d\n",
3480 x->channel_num); 3480 x->channel_num);
3481 } else { 3481 } else {
3482 IPW_DEBUG_SCAN("Scan result of wrong size %d " 3482 IPW_DEBUG_SCAN("Scan result of wrong size %d "
@@ -3491,20 +3491,20 @@ static inline void ipw_rx_notification(struct ipw_priv* priv,
3491 if (notif->size == sizeof(*x)) { 3491 if (notif->size == sizeof(*x)) {
3492 IPW_DEBUG_SCAN("Scan completed: type %d, %d channels, " 3492 IPW_DEBUG_SCAN("Scan completed: type %d, %d channels, "
3493 "%d status\n", 3493 "%d status\n",
3494 x->scan_type, 3494 x->scan_type,
3495 x->num_channels, 3495 x->num_channels,
3496 x->status); 3496 x->status);
3497 } else { 3497 } else {
3498 IPW_ERROR("Scan completed of wrong size %d " 3498 IPW_ERROR("Scan completed of wrong size %d "
3499 "(should be %zd)\n", 3499 "(should be %zd)\n",
3500 notif->size, sizeof(*x)); 3500 notif->size, sizeof(*x));
3501 } 3501 }
3502 3502
3503 priv->status &= ~(STATUS_SCANNING | STATUS_SCAN_ABORTING); 3503 priv->status &= ~(STATUS_SCANNING | STATUS_SCAN_ABORTING);
3504 3504
3505 cancel_delayed_work(&priv->scan_check); 3505 cancel_delayed_work(&priv->scan_check);
3506 3506
3507 if (!(priv->status & (STATUS_ASSOCIATED | 3507 if (!(priv->status & (STATUS_ASSOCIATED |
3508 STATUS_ASSOCIATING | 3508 STATUS_ASSOCIATING |
3509 STATUS_ROAMING | 3509 STATUS_ROAMING |
3510 STATUS_DISASSOCIATING))) 3510 STATUS_DISASSOCIATING)))
@@ -3512,7 +3512,7 @@ static inline void ipw_rx_notification(struct ipw_priv* priv,
3512 else if (priv->status & STATUS_ROAMING) { 3512 else if (priv->status & STATUS_ROAMING) {
3513 /* If a scan completed and we are in roam mode, then 3513 /* If a scan completed and we are in roam mode, then
3514 * the scan that completed was the one requested as a 3514 * the scan that completed was the one requested as a
3515 * result of entering roam... so, schedule the 3515 * result of entering roam... so, schedule the
3516 * roam work */ 3516 * roam work */
3517 queue_work(priv->workqueue, &priv->roam); 3517 queue_work(priv->workqueue, &priv->roam);
3518 } else if (priv->status & STATUS_SCAN_PENDING) 3518 } else if (priv->status & STATUS_SCAN_PENDING)
@@ -3536,11 +3536,11 @@ static inline void ipw_rx_notification(struct ipw_priv* priv,
3536 } 3536 }
3537 3537
3538 case HOST_NOTIFICATION_STATUS_LINK_DETERIORATION: { 3538 case HOST_NOTIFICATION_STATUS_LINK_DETERIORATION: {
3539 struct notif_link_deterioration *x = 3539 struct notif_link_deterioration *x =
3540 &notif->u.link_deterioration; 3540 &notif->u.link_deterioration;
3541 if (notif->size==sizeof(*x)) { 3541 if (notif->size==sizeof(*x)) {
3542 IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE, 3542 IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE,
3543 "link deterioration: '%s' " MAC_FMT " \n", 3543 "link deterioration: '%s' " MAC_FMT " \n",
3544 escape_essid(priv->essid, priv->essid_len), 3544 escape_essid(priv->essid, priv->essid_len),
3545 MAC_ARG(priv->bssid)); 3545 MAC_ARG(priv->bssid));
3546 memcpy(&priv->last_link_deterioration, x, sizeof(*x)); 3546 memcpy(&priv->last_link_deterioration, x, sizeof(*x));
@@ -3580,14 +3580,14 @@ static inline void ipw_rx_notification(struct ipw_priv* priv,
3580 3580
3581 if (x->number > priv->missed_beacon_threshold && 3581 if (x->number > priv->missed_beacon_threshold &&
3582 priv->status & STATUS_ASSOCIATED) { 3582 priv->status & STATUS_ASSOCIATED) {
3583 IPW_DEBUG(IPW_DL_INFO | IPW_DL_NOTIF | 3583 IPW_DEBUG(IPW_DL_INFO | IPW_DL_NOTIF |
3584 IPW_DL_STATE, 3584 IPW_DL_STATE,
3585 "Missed beacon: %d - disassociate\n", 3585 "Missed beacon: %d - disassociate\n",
3586 x->number); 3586 x->number);
3587 queue_work(priv->workqueue, 3587 queue_work(priv->workqueue,
3588 &priv->disassociate); 3588 &priv->disassociate);
3589 } else if (x->number > priv->roaming_threshold) { 3589 } else if (x->number > priv->roaming_threshold) {
3590 IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE, 3590 IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE,
3591 "Missed beacon: %d - initiate " 3591 "Missed beacon: %d - initiate "
3592 "roaming\n", 3592 "roaming\n",
3593 x->number); 3593 x->number);
@@ -3614,7 +3614,7 @@ static inline void ipw_rx_notification(struct ipw_priv* priv,
3614 x->key_state,x->security_type, 3614 x->key_state,x->security_type,
3615 x->station_index); 3615 x->station_index);
3616 break; 3616 break;
3617 } 3617 }
3618 3618
3619 IPW_ERROR("TGi Tx Key of wrong size %d (should be %zd)\n", 3619 IPW_ERROR("TGi Tx Key of wrong size %d (should be %zd)\n",
3620 notif->size, sizeof(*x)); 3620 notif->size, sizeof(*x));
@@ -3628,8 +3628,8 @@ static inline void ipw_rx_notification(struct ipw_priv* priv,
3628 memcpy(&priv->calib, x, sizeof(*x)); 3628 memcpy(&priv->calib, x, sizeof(*x));
3629 IPW_DEBUG_INFO("TODO: Calibration\n"); 3629 IPW_DEBUG_INFO("TODO: Calibration\n");
3630 break; 3630 break;
3631 } 3631 }
3632 3632
3633 IPW_ERROR("Calibration of wrong size %d (should be %zd)\n", 3633 IPW_ERROR("Calibration of wrong size %d (should be %zd)\n",
3634 notif->size, sizeof(*x)); 3634 notif->size, sizeof(*x));
3635 break; 3635 break;
@@ -3656,7 +3656,7 @@ static inline void ipw_rx_notification(struct ipw_priv* priv,
3656 3656
3657/** 3657/**
3658 * Destroys all DMA structures and initialise them again 3658 * Destroys all DMA structures and initialise them again
3659 * 3659 *
3660 * @param priv 3660 * @param priv
3661 * @return error code 3661 * @return error code
3662 */ 3662 */
@@ -3725,18 +3725,18 @@ static int ipw_queue_reset(struct ipw_priv *priv)
3725 3725
3726/** 3726/**
3727 * Reclaim Tx queue entries no more used by NIC. 3727 * Reclaim Tx queue entries no more used by NIC.
3728 * 3728 *
3729 * When FW adwances 'R' index, all entries between old and 3729 * When FW adwances 'R' index, all entries between old and
3730 * new 'R' index need to be reclaimed. As result, some free space 3730 * new 'R' index need to be reclaimed. As result, some free space
3731 * forms. If there is enough free space (> low mark), wake Tx queue. 3731 * forms. If there is enough free space (> low mark), wake Tx queue.
3732 * 3732 *
3733 * @note Need to protect against garbage in 'R' index 3733 * @note Need to protect against garbage in 'R' index
3734 * @param priv 3734 * @param priv
3735 * @param txq 3735 * @param txq
3736 * @param qindex 3736 * @param qindex
3737 * @return Number of used entries remains in the queue 3737 * @return Number of used entries remains in the queue
3738 */ 3738 */
3739static int ipw_queue_tx_reclaim(struct ipw_priv *priv, 3739static int ipw_queue_tx_reclaim(struct ipw_priv *priv,
3740 struct clx2_tx_queue *txq, int qindex) 3740 struct clx2_tx_queue *txq, int qindex)
3741{ 3741{
3742 u32 hw_tail; 3742 u32 hw_tail;
@@ -3797,7 +3797,7 @@ static int ipw_queue_tx_hcmd(struct ipw_priv *priv, int hcmd, void *buf,
3797 3797
3798 3798
3799 3799
3800/* 3800/*
3801 * Rx theory of operation 3801 * Rx theory of operation
3802 * 3802 *
3803 * The host allocates 32 DMA target addresses and passes the host address 3803 * The host allocates 32 DMA target addresses and passes the host address
@@ -3807,43 +3807,43 @@ static int ipw_queue_tx_hcmd(struct ipw_priv *priv, int hcmd, void *buf,
3807 * Rx Queue Indexes 3807 * Rx Queue Indexes
3808 * The host/firmware share two index registers for managing the Rx buffers. 3808 * The host/firmware share two index registers for managing the Rx buffers.
3809 * 3809 *
3810 * The READ index maps to the first position that the firmware may be writing 3810 * The READ index maps to the first position that the firmware may be writing
3811 * to -- the driver can read up to (but not including) this position and get 3811 * to -- the driver can read up to (but not including) this position and get
3812 * good data. 3812 * good data.
3813 * The READ index is managed by the firmware once the card is enabled. 3813 * The READ index is managed by the firmware once the card is enabled.
3814 * 3814 *
3815 * The WRITE index maps to the last position the driver has read from -- the 3815 * The WRITE index maps to the last position the driver has read from -- the
3816 * position preceding WRITE is the last slot the firmware can place a packet. 3816 * position preceding WRITE is the last slot the firmware can place a packet.
3817 * 3817 *
3818 * The queue is empty (no good data) if WRITE = READ - 1, and is full if 3818 * The queue is empty (no good data) if WRITE = READ - 1, and is full if
3819 * WRITE = READ. 3819 * WRITE = READ.
3820 * 3820 *
3821 * During initialization the host sets up the READ queue position to the first 3821 * During initialization the host sets up the READ queue position to the first
3822 * INDEX position, and WRITE to the last (READ - 1 wrapped) 3822 * INDEX position, and WRITE to the last (READ - 1 wrapped)
3823 * 3823 *
3824 * When the firmware places a packet in a buffer it will advance the READ index 3824 * When the firmware places a packet in a buffer it will advance the READ index
3825 * and fire the RX interrupt. The driver can then query the READ index and 3825 * and fire the RX interrupt. The driver can then query the READ index and
3826 * process as many packets as possible, moving the WRITE index forward as it 3826 * process as many packets as possible, moving the WRITE index forward as it
3827 * resets the Rx queue buffers with new memory. 3827 * resets the Rx queue buffers with new memory.
3828 * 3828 *
3829 * The management in the driver is as follows: 3829 * The management in the driver is as follows:
3830 * + A list of pre-allocated SKBs is stored in ipw->rxq->rx_free. When 3830 * + A list of pre-allocated SKBs is stored in ipw->rxq->rx_free. When
3831 * ipw->rxq->free_count drops to or below RX_LOW_WATERMARK, work is scheduled 3831 * ipw->rxq->free_count drops to or below RX_LOW_WATERMARK, work is scheduled
3832 * to replensish the ipw->rxq->rx_free. 3832 * to replensish the ipw->rxq->rx_free.
3833 * + In ipw_rx_queue_replenish (scheduled) if 'processed' != 'read' then the 3833 * + In ipw_rx_queue_replenish (scheduled) if 'processed' != 'read' then the
3834 * ipw->rxq is replenished and the READ INDEX is updated (updating the 3834 * ipw->rxq is replenished and the READ INDEX is updated (updating the
3835 * 'processed' and 'read' driver indexes as well) 3835 * 'processed' and 'read' driver indexes as well)
3836 * + A received packet is processed and handed to the kernel network stack, 3836 * + A received packet is processed and handed to the kernel network stack,
3837 * detached from the ipw->rxq. The driver 'processed' index is updated. 3837 * detached from the ipw->rxq. The driver 'processed' index is updated.
3838 * + The Host/Firmware ipw->rxq is replenished at tasklet time from the rx_free 3838 * + The Host/Firmware ipw->rxq is replenished at tasklet time from the rx_free
3839 * list. If there are no allocated buffers in ipw->rxq->rx_free, the READ 3839 * list. If there are no allocated buffers in ipw->rxq->rx_free, the READ
3840 * INDEX is not incremented and ipw->status(RX_STALLED) is set. If there 3840 * INDEX is not incremented and ipw->status(RX_STALLED) is set. If there
3841 * were enough free buffers and RX_STALLED is set it is cleared. 3841 * were enough free buffers and RX_STALLED is set it is cleared.
3842 * 3842 *
3843 * 3843 *
3844 * Driver sequence: 3844 * Driver sequence:
3845 * 3845 *
3846 * ipw_rx_queue_alloc() Allocates rx_free 3846 * ipw_rx_queue_alloc() Allocates rx_free
3847 * ipw_rx_queue_replenish() Replenishes rx_free list from rx_used, and calls 3847 * ipw_rx_queue_replenish() Replenishes rx_free list from rx_used, and calls
3848 * ipw_rx_queue_restock 3848 * ipw_rx_queue_restock
3849 * ipw_rx_queue_restock() Moves available buffers from rx_free into Rx 3849 * ipw_rx_queue_restock() Moves available buffers from rx_free into Rx
@@ -3853,7 +3853,7 @@ static int ipw_queue_tx_hcmd(struct ipw_priv *priv, int hcmd, void *buf,
3853 * 3853 *
3854 * -- enable interrupts -- 3854 * -- enable interrupts --
3855 * ISR - ipw_rx() Detach ipw_rx_mem_buffers from pool up to the 3855 * ISR - ipw_rx() Detach ipw_rx_mem_buffers from pool up to the
3856 * READ INDEX, detaching the SKB from the pool. 3856 * READ INDEX, detaching the SKB from the pool.
3857 * Moves the packet buffer from queue to rx_used. 3857 * Moves the packet buffer from queue to rx_used.
3858 * Calls ipw_rx_queue_restock to refill any empty 3858 * Calls ipw_rx_queue_restock to refill any empty
3859 * slots. 3859 * slots.
@@ -3861,7 +3861,7 @@ static int ipw_queue_tx_hcmd(struct ipw_priv *priv, int hcmd, void *buf,
3861 * 3861 *
3862 */ 3862 */
3863 3863
3864/* 3864/*
3865 * If there are slots in the RX queue that need to be restocked, 3865 * If there are slots in the RX queue that need to be restocked,
3866 * and we have free pre-allocated buffers, fill the ranks as much 3866 * and we have free pre-allocated buffers, fill the ranks as much
3867 * as we can pulling from rx_free. 3867 * as we can pulling from rx_free.
@@ -3893,20 +3893,20 @@ static void ipw_rx_queue_restock(struct ipw_priv *priv)
3893 } 3893 }
3894 spin_unlock_irqrestore(&rxq->lock, flags); 3894 spin_unlock_irqrestore(&rxq->lock, flags);
3895 3895
3896 /* If the pre-allocated buffer pool is dropping low, schedule to 3896 /* If the pre-allocated buffer pool is dropping low, schedule to
3897 * refill it */ 3897 * refill it */
3898 if (rxq->free_count <= RX_LOW_WATERMARK) 3898 if (rxq->free_count <= RX_LOW_WATERMARK)
3899 queue_work(priv->workqueue, &priv->rx_replenish); 3899 queue_work(priv->workqueue, &priv->rx_replenish);
3900 3900
3901 /* If we've added more space for the firmware to place data, tell it */ 3901 /* If we've added more space for the firmware to place data, tell it */
3902 if (write != rxq->write) 3902 if (write != rxq->write)
3903 ipw_write32(priv, CX2_RX_WRITE_INDEX, rxq->write); 3903 ipw_write32(priv, CX2_RX_WRITE_INDEX, rxq->write);
3904} 3904}
3905 3905
3906/* 3906/*
3907 * Move all used packet from rx_used to rx_free, allocating a new SKB for each. 3907 * Move all used packet from rx_used to rx_free, allocating a new SKB for each.
3908 * Also restock the Rx queue via ipw_rx_queue_restock. 3908 * Also restock the Rx queue via ipw_rx_queue_restock.
3909 * 3909 *
3910 * This is called as a scheduled work item (except for during intialization) 3910 * This is called as a scheduled work item (except for during intialization)
3911 */ 3911 */
3912static void ipw_rx_queue_replenish(void *data) 3912static void ipw_rx_queue_replenish(void *data)
@@ -3931,12 +3931,12 @@ static void ipw_rx_queue_replenish(void *data)
3931 break; 3931 break;
3932 } 3932 }
3933 list_del(element); 3933 list_del(element);
3934 3934
3935 rxb->rxb = (struct ipw_rx_buffer *)rxb->skb->data; 3935 rxb->rxb = (struct ipw_rx_buffer *)rxb->skb->data;
3936 rxb->dma_addr = pci_map_single( 3936 rxb->dma_addr = pci_map_single(
3937 priv->pci_dev, rxb->skb->data, CX2_RX_BUF_SIZE, 3937 priv->pci_dev, rxb->skb->data, CX2_RX_BUF_SIZE,
3938 PCI_DMA_FROMDEVICE); 3938 PCI_DMA_FROMDEVICE);
3939 3939
3940 list_add_tail(&rxb->list, &rxq->rx_free); 3940 list_add_tail(&rxb->list, &rxq->rx_free);
3941 rxq->free_count++; 3941 rxq->free_count++;
3942 } 3942 }
@@ -3947,17 +3947,17 @@ static void ipw_rx_queue_replenish(void *data)
3947 3947
3948/* Assumes that the skb field of the buffers in 'pool' is kept accurate. 3948/* Assumes that the skb field of the buffers in 'pool' is kept accurate.
3949 * If an SKB has been detached, the POOL needs to have it's SKB set to NULL 3949 * If an SKB has been detached, the POOL needs to have it's SKB set to NULL
3950 * This free routine walks the list of POOL entries and if SKB is set to 3950 * This free routine walks the list of POOL entries and if SKB is set to
3951 * non NULL it is unmapped and freed 3951 * non NULL it is unmapped and freed
3952 */ 3952 */
3953static void ipw_rx_queue_free(struct ipw_priv *priv, 3953static void ipw_rx_queue_free(struct ipw_priv *priv,
3954 struct ipw_rx_queue *rxq) 3954 struct ipw_rx_queue *rxq)
3955{ 3955{
3956 int i; 3956 int i;
3957 3957
3958 if (!rxq) 3958 if (!rxq)
3959 return; 3959 return;
3960 3960
3961 for (i = 0; i < RX_QUEUE_SIZE + RX_FREE_BUFFERS; i++) { 3961 for (i = 0; i < RX_QUEUE_SIZE + RX_FREE_BUFFERS; i++) {
3962 if (rxq->pool[i].skb != NULL) { 3962 if (rxq->pool[i].skb != NULL) {
3963 pci_unmap_single(priv->pci_dev, rxq->pool[i].dma_addr, 3963 pci_unmap_single(priv->pci_dev, rxq->pool[i].dma_addr,
@@ -3982,7 +3982,7 @@ static struct ipw_rx_queue *ipw_rx_queue_alloc(struct ipw_priv *priv)
3982 INIT_LIST_HEAD(&rxq->rx_used); 3982 INIT_LIST_HEAD(&rxq->rx_used);
3983 3983
3984 /* Fill the rx_used queue with _all_ of the Rx buffers */ 3984 /* Fill the rx_used queue with _all_ of the Rx buffers */
3985 for (i = 0; i < RX_FREE_BUFFERS + RX_QUEUE_SIZE; i++) 3985 for (i = 0; i < RX_FREE_BUFFERS + RX_QUEUE_SIZE; i++)
3986 list_add_tail(&rxq->pool[i].list, &rxq->rx_used); 3986 list_add_tail(&rxq->pool[i].list, &rxq->rx_used);
3987 3987
3988 /* Set us so that we have processed and used all buffers, but have 3988 /* Set us so that we have processed and used all buffers, but have
@@ -3999,44 +3999,44 @@ static int ipw_is_rate_in_mask(struct ipw_priv *priv, int ieee_mode, u8 rate)
3999 rate &= ~IEEE80211_BASIC_RATE_MASK; 3999 rate &= ~IEEE80211_BASIC_RATE_MASK;
4000 if (ieee_mode == IEEE_A) { 4000 if (ieee_mode == IEEE_A) {
4001 switch (rate) { 4001 switch (rate) {
4002 case IEEE80211_OFDM_RATE_6MB: 4002 case IEEE80211_OFDM_RATE_6MB:
4003 return priv->rates_mask & IEEE80211_OFDM_RATE_6MB_MASK ? 4003 return priv->rates_mask & IEEE80211_OFDM_RATE_6MB_MASK ?
4004 1 : 0; 4004 1 : 0;
4005 case IEEE80211_OFDM_RATE_9MB: 4005 case IEEE80211_OFDM_RATE_9MB:
4006 return priv->rates_mask & IEEE80211_OFDM_RATE_9MB_MASK ? 4006 return priv->rates_mask & IEEE80211_OFDM_RATE_9MB_MASK ?
4007 1 : 0; 4007 1 : 0;
4008 case IEEE80211_OFDM_RATE_12MB: 4008 case IEEE80211_OFDM_RATE_12MB:
4009 return priv->rates_mask & IEEE80211_OFDM_RATE_12MB_MASK ? 4009 return priv->rates_mask & IEEE80211_OFDM_RATE_12MB_MASK ?
4010 1 : 0; 4010 1 : 0;
4011 case IEEE80211_OFDM_RATE_18MB: 4011 case IEEE80211_OFDM_RATE_18MB:
4012 return priv->rates_mask & IEEE80211_OFDM_RATE_18MB_MASK ? 4012 return priv->rates_mask & IEEE80211_OFDM_RATE_18MB_MASK ?
4013 1 : 0; 4013 1 : 0;
4014 case IEEE80211_OFDM_RATE_24MB: 4014 case IEEE80211_OFDM_RATE_24MB:
4015 return priv->rates_mask & IEEE80211_OFDM_RATE_24MB_MASK ? 4015 return priv->rates_mask & IEEE80211_OFDM_RATE_24MB_MASK ?
4016 1 : 0; 4016 1 : 0;
4017 case IEEE80211_OFDM_RATE_36MB: 4017 case IEEE80211_OFDM_RATE_36MB:
4018 return priv->rates_mask & IEEE80211_OFDM_RATE_36MB_MASK ? 4018 return priv->rates_mask & IEEE80211_OFDM_RATE_36MB_MASK ?
4019 1 : 0; 4019 1 : 0;
4020 case IEEE80211_OFDM_RATE_48MB: 4020 case IEEE80211_OFDM_RATE_48MB:
4021 return priv->rates_mask & IEEE80211_OFDM_RATE_48MB_MASK ? 4021 return priv->rates_mask & IEEE80211_OFDM_RATE_48MB_MASK ?
4022 1 : 0; 4022 1 : 0;
4023 case IEEE80211_OFDM_RATE_54MB: 4023 case IEEE80211_OFDM_RATE_54MB:
4024 return priv->rates_mask & IEEE80211_OFDM_RATE_54MB_MASK ? 4024 return priv->rates_mask & IEEE80211_OFDM_RATE_54MB_MASK ?
4025 1 : 0; 4025 1 : 0;
4026 default: 4026 default:
4027 return 0; 4027 return 0;
4028 } 4028 }
4029 } 4029 }
4030 4030
4031 /* B and G mixed */ 4031 /* B and G mixed */
4032 switch (rate) { 4032 switch (rate) {
4033 case IEEE80211_CCK_RATE_1MB: 4033 case IEEE80211_CCK_RATE_1MB:
4034 return priv->rates_mask & IEEE80211_CCK_RATE_1MB_MASK ? 1 : 0; 4034 return priv->rates_mask & IEEE80211_CCK_RATE_1MB_MASK ? 1 : 0;
4035 case IEEE80211_CCK_RATE_2MB: 4035 case IEEE80211_CCK_RATE_2MB:
4036 return priv->rates_mask & IEEE80211_CCK_RATE_2MB_MASK ? 1 : 0; 4036 return priv->rates_mask & IEEE80211_CCK_RATE_2MB_MASK ? 1 : 0;
4037 case IEEE80211_CCK_RATE_5MB: 4037 case IEEE80211_CCK_RATE_5MB:
4038 return priv->rates_mask & IEEE80211_CCK_RATE_5MB_MASK ? 1 : 0; 4038 return priv->rates_mask & IEEE80211_CCK_RATE_5MB_MASK ? 1 : 0;
4039 case IEEE80211_CCK_RATE_11MB: 4039 case IEEE80211_CCK_RATE_11MB:
4040 return priv->rates_mask & IEEE80211_CCK_RATE_11MB_MASK ? 1 : 0; 4040 return priv->rates_mask & IEEE80211_CCK_RATE_11MB_MASK ? 1 : 0;
4041 } 4041 }
4042 4042
@@ -4046,28 +4046,28 @@ static int ipw_is_rate_in_mask(struct ipw_priv *priv, int ieee_mode, u8 rate)
4046 4046
4047 /* G */ 4047 /* G */
4048 switch (rate) { 4048 switch (rate) {
4049 case IEEE80211_OFDM_RATE_6MB: 4049 case IEEE80211_OFDM_RATE_6MB:
4050 return priv->rates_mask & IEEE80211_OFDM_RATE_6MB_MASK ? 1 : 0; 4050 return priv->rates_mask & IEEE80211_OFDM_RATE_6MB_MASK ? 1 : 0;
4051 case IEEE80211_OFDM_RATE_9MB: 4051 case IEEE80211_OFDM_RATE_9MB:
4052 return priv->rates_mask & IEEE80211_OFDM_RATE_9MB_MASK ? 1 : 0; 4052 return priv->rates_mask & IEEE80211_OFDM_RATE_9MB_MASK ? 1 : 0;
4053 case IEEE80211_OFDM_RATE_12MB: 4053 case IEEE80211_OFDM_RATE_12MB:
4054 return priv->rates_mask & IEEE80211_OFDM_RATE_12MB_MASK ? 1 : 0; 4054 return priv->rates_mask & IEEE80211_OFDM_RATE_12MB_MASK ? 1 : 0;
4055 case IEEE80211_OFDM_RATE_18MB: 4055 case IEEE80211_OFDM_RATE_18MB:
4056 return priv->rates_mask & IEEE80211_OFDM_RATE_18MB_MASK ? 1 : 0; 4056 return priv->rates_mask & IEEE80211_OFDM_RATE_18MB_MASK ? 1 : 0;
4057 case IEEE80211_OFDM_RATE_24MB: 4057 case IEEE80211_OFDM_RATE_24MB:
4058 return priv->rates_mask & IEEE80211_OFDM_RATE_24MB_MASK ? 1 : 0; 4058 return priv->rates_mask & IEEE80211_OFDM_RATE_24MB_MASK ? 1 : 0;
4059 case IEEE80211_OFDM_RATE_36MB: 4059 case IEEE80211_OFDM_RATE_36MB:
4060 return priv->rates_mask & IEEE80211_OFDM_RATE_36MB_MASK ? 1 : 0; 4060 return priv->rates_mask & IEEE80211_OFDM_RATE_36MB_MASK ? 1 : 0;
4061 case IEEE80211_OFDM_RATE_48MB: 4061 case IEEE80211_OFDM_RATE_48MB:
4062 return priv->rates_mask & IEEE80211_OFDM_RATE_48MB_MASK ? 1 : 0; 4062 return priv->rates_mask & IEEE80211_OFDM_RATE_48MB_MASK ? 1 : 0;
4063 case IEEE80211_OFDM_RATE_54MB: 4063 case IEEE80211_OFDM_RATE_54MB:
4064 return priv->rates_mask & IEEE80211_OFDM_RATE_54MB_MASK ? 1 : 0; 4064 return priv->rates_mask & IEEE80211_OFDM_RATE_54MB_MASK ? 1 : 0;
4065 } 4065 }
4066 4066
4067 return 0; 4067 return 0;
4068} 4068}
4069 4069
4070static int ipw_compatible_rates(struct ipw_priv *priv, 4070static int ipw_compatible_rates(struct ipw_priv *priv,
4071 const struct ieee80211_network *network, 4071 const struct ieee80211_network *network,
4072 struct ipw_supported_rates *rates) 4072 struct ipw_supported_rates *rates)
4073{ 4073{
@@ -4082,7 +4082,7 @@ static int ipw_compatible_rates(struct ipw_priv *priv,
4082 network->rates[i], priv->rates_mask); 4082 network->rates[i], priv->rates_mask);
4083 continue; 4083 continue;
4084 } 4084 }
4085 4085
4086 rates->supported_rates[rates->num_rates++] = network->rates[i]; 4086 rates->supported_rates[rates->num_rates++] = network->rates[i];
4087 } 4087 }
4088 4088
@@ -4093,7 +4093,7 @@ static int ipw_compatible_rates(struct ipw_priv *priv,
4093 network->rates_ex[i], priv->rates_mask); 4093 network->rates_ex[i], priv->rates_mask);
4094 continue; 4094 continue;
4095 } 4095 }
4096 4096
4097 rates->supported_rates[rates->num_rates++] = network->rates_ex[i]; 4097 rates->supported_rates[rates->num_rates++] = network->rates_ex[i];
4098 } 4098 }
4099 4099
@@ -4115,62 +4115,62 @@ static inline void ipw_copy_rates(struct ipw_supported_rates *dest,
4115static void ipw_add_cck_scan_rates(struct ipw_supported_rates *rates, 4115static void ipw_add_cck_scan_rates(struct ipw_supported_rates *rates,
4116 u8 modulation, u32 rate_mask) 4116 u8 modulation, u32 rate_mask)
4117{ 4117{
4118 u8 basic_mask = (IEEE80211_OFDM_MODULATION == modulation) ? 4118 u8 basic_mask = (IEEE80211_OFDM_MODULATION == modulation) ?
4119 IEEE80211_BASIC_RATE_MASK : 0; 4119 IEEE80211_BASIC_RATE_MASK : 0;
4120 4120
4121 if (rate_mask & IEEE80211_CCK_RATE_1MB_MASK) 4121 if (rate_mask & IEEE80211_CCK_RATE_1MB_MASK)
4122 rates->supported_rates[rates->num_rates++] = 4122 rates->supported_rates[rates->num_rates++] =
4123 IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_1MB; 4123 IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_1MB;
4124 4124
4125 if (rate_mask & IEEE80211_CCK_RATE_2MB_MASK) 4125 if (rate_mask & IEEE80211_CCK_RATE_2MB_MASK)
4126 rates->supported_rates[rates->num_rates++] = 4126 rates->supported_rates[rates->num_rates++] =
4127 IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_2MB; 4127 IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_2MB;
4128 4128
4129 if (rate_mask & IEEE80211_CCK_RATE_5MB_MASK) 4129 if (rate_mask & IEEE80211_CCK_RATE_5MB_MASK)
4130 rates->supported_rates[rates->num_rates++] = basic_mask | 4130 rates->supported_rates[rates->num_rates++] = basic_mask |
4131 IEEE80211_CCK_RATE_5MB; 4131 IEEE80211_CCK_RATE_5MB;
4132 4132
4133 if (rate_mask & IEEE80211_CCK_RATE_11MB_MASK) 4133 if (rate_mask & IEEE80211_CCK_RATE_11MB_MASK)
4134 rates->supported_rates[rates->num_rates++] = basic_mask | 4134 rates->supported_rates[rates->num_rates++] = basic_mask |
4135 IEEE80211_CCK_RATE_11MB; 4135 IEEE80211_CCK_RATE_11MB;
4136} 4136}
4137 4137
4138static void ipw_add_ofdm_scan_rates(struct ipw_supported_rates *rates, 4138static void ipw_add_ofdm_scan_rates(struct ipw_supported_rates *rates,
4139 u8 modulation, u32 rate_mask) 4139 u8 modulation, u32 rate_mask)
4140{ 4140{
4141 u8 basic_mask = (IEEE80211_OFDM_MODULATION == modulation) ? 4141 u8 basic_mask = (IEEE80211_OFDM_MODULATION == modulation) ?
4142 IEEE80211_BASIC_RATE_MASK : 0; 4142 IEEE80211_BASIC_RATE_MASK : 0;
4143 4143
4144 if (rate_mask & IEEE80211_OFDM_RATE_6MB_MASK) 4144 if (rate_mask & IEEE80211_OFDM_RATE_6MB_MASK)
4145 rates->supported_rates[rates->num_rates++] = basic_mask | 4145 rates->supported_rates[rates->num_rates++] = basic_mask |
4146 IEEE80211_OFDM_RATE_6MB; 4146 IEEE80211_OFDM_RATE_6MB;
4147 4147
4148 if (rate_mask & IEEE80211_OFDM_RATE_9MB_MASK) 4148 if (rate_mask & IEEE80211_OFDM_RATE_9MB_MASK)
4149 rates->supported_rates[rates->num_rates++] = 4149 rates->supported_rates[rates->num_rates++] =
4150 IEEE80211_OFDM_RATE_9MB; 4150 IEEE80211_OFDM_RATE_9MB;
4151 4151
4152 if (rate_mask & IEEE80211_OFDM_RATE_12MB_MASK) 4152 if (rate_mask & IEEE80211_OFDM_RATE_12MB_MASK)
4153 rates->supported_rates[rates->num_rates++] = basic_mask | 4153 rates->supported_rates[rates->num_rates++] = basic_mask |
4154 IEEE80211_OFDM_RATE_12MB; 4154 IEEE80211_OFDM_RATE_12MB;
4155 4155
4156 if (rate_mask & IEEE80211_OFDM_RATE_18MB_MASK) 4156 if (rate_mask & IEEE80211_OFDM_RATE_18MB_MASK)
4157 rates->supported_rates[rates->num_rates++] = 4157 rates->supported_rates[rates->num_rates++] =
4158 IEEE80211_OFDM_RATE_18MB; 4158 IEEE80211_OFDM_RATE_18MB;
4159 4159
4160 if (rate_mask & IEEE80211_OFDM_RATE_24MB_MASK) 4160 if (rate_mask & IEEE80211_OFDM_RATE_24MB_MASK)
4161 rates->supported_rates[rates->num_rates++] = basic_mask | 4161 rates->supported_rates[rates->num_rates++] = basic_mask |
4162 IEEE80211_OFDM_RATE_24MB; 4162 IEEE80211_OFDM_RATE_24MB;
4163 4163
4164 if (rate_mask & IEEE80211_OFDM_RATE_36MB_MASK) 4164 if (rate_mask & IEEE80211_OFDM_RATE_36MB_MASK)
4165 rates->supported_rates[rates->num_rates++] = 4165 rates->supported_rates[rates->num_rates++] =
4166 IEEE80211_OFDM_RATE_36MB; 4166 IEEE80211_OFDM_RATE_36MB;
4167 4167
4168 if (rate_mask & IEEE80211_OFDM_RATE_48MB_MASK) 4168 if (rate_mask & IEEE80211_OFDM_RATE_48MB_MASK)
4169 rates->supported_rates[rates->num_rates++] = 4169 rates->supported_rates[rates->num_rates++] =
4170 IEEE80211_OFDM_RATE_48MB; 4170 IEEE80211_OFDM_RATE_48MB;
4171 4171
4172 if (rate_mask & IEEE80211_OFDM_RATE_54MB_MASK) 4172 if (rate_mask & IEEE80211_OFDM_RATE_54MB_MASK)
4173 rates->supported_rates[rates->num_rates++] = 4173 rates->supported_rates[rates->num_rates++] =
4174 IEEE80211_OFDM_RATE_54MB; 4174 IEEE80211_OFDM_RATE_54MB;
4175} 4175}
4176 4176
@@ -4190,11 +4190,11 @@ static int ipw_best_network(
4190 /* Verify that this network's capability is compatible with the 4190 /* Verify that this network's capability is compatible with the
4191 * current mode (AdHoc or Infrastructure) */ 4191 * current mode (AdHoc or Infrastructure) */
4192 if ((priv->ieee->iw_mode == IW_MODE_INFRA && 4192 if ((priv->ieee->iw_mode == IW_MODE_INFRA &&
4193 !(network->capability & WLAN_CAPABILITY_BSS)) || 4193 !(network->capability & WLAN_CAPABILITY_BSS)) ||
4194 (priv->ieee->iw_mode == IW_MODE_ADHOC && 4194 (priv->ieee->iw_mode == IW_MODE_ADHOC &&
4195 !(network->capability & WLAN_CAPABILITY_IBSS))) { 4195 !(network->capability & WLAN_CAPABILITY_IBSS))) {
4196 IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded due to " 4196 IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded due to "
4197 "capability mismatch.\n", 4197 "capability mismatch.\n",
4198 escape_essid(network->ssid, network->ssid_len), 4198 escape_essid(network->ssid, network->ssid_len),
4199 MAC_ARG(network->bssid)); 4199 MAC_ARG(network->bssid));
4200 return 0; 4200 return 0;
@@ -4209,33 +4209,33 @@ static int ipw_best_network(
4209 MAC_ARG(network->bssid)); 4209 MAC_ARG(network->bssid));
4210 return 0; 4210 return 0;
4211 } 4211 }
4212 4212
4213 if (unlikely(roaming)) { 4213 if (unlikely(roaming)) {
4214 /* If we are roaming, then ensure check if this is a valid 4214 /* If we are roaming, then ensure check if this is a valid
4215 * network to try and roam to */ 4215 * network to try and roam to */
4216 if ((network->ssid_len != match->network->ssid_len) || 4216 if ((network->ssid_len != match->network->ssid_len) ||
4217 memcmp(network->ssid, match->network->ssid, 4217 memcmp(network->ssid, match->network->ssid,
4218 network->ssid_len)) { 4218 network->ssid_len)) {
4219 IPW_DEBUG_ASSOC("Netowrk '%s (" MAC_FMT ")' excluded " 4219 IPW_DEBUG_ASSOC("Netowrk '%s (" MAC_FMT ")' excluded "
4220 "because of non-network ESSID.\n", 4220 "because of non-network ESSID.\n",
4221 escape_essid(network->ssid, 4221 escape_essid(network->ssid,
4222 network->ssid_len), 4222 network->ssid_len),
4223 MAC_ARG(network->bssid)); 4223 MAC_ARG(network->bssid));
4224 return 0; 4224 return 0;
4225 } 4225 }
4226 } else { 4226 } else {
4227 /* If an ESSID has been configured then compare the broadcast 4227 /* If an ESSID has been configured then compare the broadcast
4228 * ESSID to ours */ 4228 * ESSID to ours */
4229 if ((priv->config & CFG_STATIC_ESSID) && 4229 if ((priv->config & CFG_STATIC_ESSID) &&
4230 ((network->ssid_len != priv->essid_len) || 4230 ((network->ssid_len != priv->essid_len) ||
4231 memcmp(network->ssid, priv->essid, 4231 memcmp(network->ssid, priv->essid,
4232 min(network->ssid_len, priv->essid_len)))) { 4232 min(network->ssid_len, priv->essid_len)))) {
4233 char escaped[IW_ESSID_MAX_SIZE * 2 + 1]; 4233 char escaped[IW_ESSID_MAX_SIZE * 2 + 1];
4234 strncpy(escaped, escape_essid( 4234 strncpy(escaped, escape_essid(
4235 network->ssid, network->ssid_len), 4235 network->ssid, network->ssid_len),
4236 sizeof(escaped)); 4236 sizeof(escaped));
4237 IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " 4237 IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded "
4238 "because of ESSID mismatch: '%s'.\n", 4238 "because of ESSID mismatch: '%s'.\n",
4239 escaped, MAC_ARG(network->bssid), 4239 escaped, MAC_ARG(network->bssid),
4240 escape_essid(priv->essid, priv->essid_len)); 4240 escape_essid(priv->essid, priv->essid_len));
4241 return 0; 4241 return 0;
@@ -4244,11 +4244,11 @@ static int ipw_best_network(
4244 4244
4245 /* If the old network rate is better than this one, don't bother 4245 /* If the old network rate is better than this one, don't bother
4246 * testing everything else. */ 4246 * testing everything else. */
4247 if (match->network && match->network->stats.rssi > 4247 if (match->network && match->network->stats.rssi >
4248 network->stats.rssi) { 4248 network->stats.rssi) {
4249 char escaped[IW_ESSID_MAX_SIZE * 2 + 1]; 4249 char escaped[IW_ESSID_MAX_SIZE * 2 + 1];
4250 strncpy(escaped, 4250 strncpy(escaped,
4251 escape_essid(network->ssid, network->ssid_len), 4251 escape_essid(network->ssid, network->ssid_len),
4252 sizeof(escaped)); 4252 sizeof(escaped));
4253 IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded because " 4253 IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded because "
4254 "'%s (" MAC_FMT ")' has a stronger signal.\n", 4254 "'%s (" MAC_FMT ")' has a stronger signal.\n",
@@ -4258,7 +4258,7 @@ static int ipw_best_network(
4258 MAC_ARG(match->network->bssid)); 4258 MAC_ARG(match->network->bssid));
4259 return 0; 4259 return 0;
4260 } 4260 }
4261 4261
4262 /* If this network has already had an association attempt within the 4262 /* If this network has already had an association attempt within the
4263 * last 3 seconds, do not try and associate again... */ 4263 * last 3 seconds, do not try and associate again... */
4264 if (network->last_associate && 4264 if (network->last_associate &&
@@ -4273,7 +4273,7 @@ static int ipw_best_network(
4273 } 4273 }
4274 4274
4275 /* Now go through and see if the requested network is valid... */ 4275 /* Now go through and see if the requested network is valid... */
4276 if (priv->ieee->scan_age != 0 && 4276 if (priv->ieee->scan_age != 0 &&
4277 jiffies - network->last_scanned > priv->ieee->scan_age) { 4277 jiffies - network->last_scanned > priv->ieee->scan_age) {
4278 IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " 4278 IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded "
4279 "because of age: %lums.\n", 4279 "because of age: %lums.\n",
@@ -4281,9 +4281,9 @@ static int ipw_best_network(
4281 MAC_ARG(network->bssid), 4281 MAC_ARG(network->bssid),
4282 (jiffies - network->last_scanned) / (HZ / 100)); 4282 (jiffies - network->last_scanned) / (HZ / 100));
4283 return 0; 4283 return 0;
4284 } 4284 }
4285 4285
4286 if ((priv->config & CFG_STATIC_CHANNEL) && 4286 if ((priv->config & CFG_STATIC_CHANNEL) &&
4287 (network->channel != priv->channel)) { 4287 (network->channel != priv->channel)) {
4288 IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " 4288 IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded "
4289 "because of channel mismatch: %d != %d.\n", 4289 "because of channel mismatch: %d != %d.\n",
@@ -4292,22 +4292,22 @@ static int ipw_best_network(
4292 network->channel, priv->channel); 4292 network->channel, priv->channel);
4293 return 0; 4293 return 0;
4294 } 4294 }
4295 4295
4296 /* Verify privacy compatability */ 4296 /* Verify privacy compatability */
4297 if (((priv->capability & CAP_PRIVACY_ON) ? 1 : 0) != 4297 if (((priv->capability & CAP_PRIVACY_ON) ? 1 : 0) !=
4298 ((network->capability & WLAN_CAPABILITY_PRIVACY) ? 1 : 0)) { 4298 ((network->capability & WLAN_CAPABILITY_PRIVACY) ? 1 : 0)) {
4299 IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " 4299 IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded "
4300 "because of privacy mismatch: %s != %s.\n", 4300 "because of privacy mismatch: %s != %s.\n",
4301 escape_essid(network->ssid, network->ssid_len), 4301 escape_essid(network->ssid, network->ssid_len),
4302 MAC_ARG(network->bssid), 4302 MAC_ARG(network->bssid),
4303 priv->capability & CAP_PRIVACY_ON ? "on" : 4303 priv->capability & CAP_PRIVACY_ON ? "on" :
4304 "off", 4304 "off",
4305 network->capability & 4305 network->capability &
4306 WLAN_CAPABILITY_PRIVACY ?"on" : "off"); 4306 WLAN_CAPABILITY_PRIVACY ?"on" : "off");
4307 return 0; 4307 return 0;
4308 } 4308 }
4309 4309
4310 if ((priv->config & CFG_STATIC_BSSID) && 4310 if ((priv->config & CFG_STATIC_BSSID) &&
4311 memcmp(network->bssid, priv->bssid, ETH_ALEN)) { 4311 memcmp(network->bssid, priv->bssid, ETH_ALEN)) {
4312 IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " 4312 IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded "
4313 "because of BSSID mismatch: " MAC_FMT ".\n", 4313 "because of BSSID mismatch: " MAC_FMT ".\n",
@@ -4316,7 +4316,7 @@ static int ipw_best_network(
4316 MAC_ARG(priv->bssid)); 4316 MAC_ARG(priv->bssid));
4317 return 0; 4317 return 0;
4318 } 4318 }
4319 4319
4320 /* Filter out any incompatible freq / mode combinations */ 4320 /* Filter out any incompatible freq / mode combinations */
4321 if (!ieee80211_is_valid_mode(priv->ieee, network->mode)) { 4321 if (!ieee80211_is_valid_mode(priv->ieee, network->mode)) {
4322 IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " 4322 IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded "
@@ -4326,7 +4326,7 @@ static int ipw_best_network(
4326 MAC_ARG(network->bssid)); 4326 MAC_ARG(network->bssid));
4327 return 0; 4327 return 0;
4328 } 4328 }
4329 4329
4330 ipw_compatible_rates(priv, network, &rates); 4330 ipw_compatible_rates(priv, network, &rates);
4331 if (rates.num_rates == 0) { 4331 if (rates.num_rates == 0) {
4332 IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " 4332 IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded "
@@ -4335,7 +4335,7 @@ static int ipw_best_network(
4335 MAC_ARG(network->bssid)); 4335 MAC_ARG(network->bssid));
4336 return 0; 4336 return 0;
4337 } 4337 }
4338 4338
4339 /* TODO: Perform any further minimal comparititive tests. We do not 4339 /* TODO: Perform any further minimal comparititive tests. We do not
4340 * want to put too much policy logic here; intelligent scan selection 4340 * want to put too much policy logic here; intelligent scan selection
4341 * should occur within a generic IEEE 802.11 user space tool. */ 4341 * should occur within a generic IEEE 802.11 user space tool. */
@@ -4352,7 +4352,7 @@ static int ipw_best_network(
4352} 4352}
4353 4353
4354 4354
4355static void ipw_adhoc_create(struct ipw_priv *priv, 4355static void ipw_adhoc_create(struct ipw_priv *priv,
4356 struct ieee80211_network *network) 4356 struct ieee80211_network *network)
4357{ 4357{
4358 /* 4358 /*
@@ -4361,7 +4361,7 @@ static void ipw_adhoc_create(struct ipw_priv *priv,
4361 * comes to creating a new ad-hoc network, we have tell the FW 4361 * comes to creating a new ad-hoc network, we have tell the FW
4362 * exactly which band to use. 4362 * exactly which band to use.
4363 * 4363 *
4364 * We also have the possibility of an invalid channel for the 4364 * We also have the possibility of an invalid channel for the
4365 * chossen band. Attempting to create a new ad-hoc network 4365 * chossen band. Attempting to create a new ad-hoc network
4366 * with an invalid channel for wireless mode will trigger a 4366 * with an invalid channel for wireless mode will trigger a
4367 * FW fatal error. 4367 * FW fatal error.
@@ -4393,10 +4393,10 @@ static void ipw_adhoc_create(struct ipw_priv *priv,
4393 if (priv->capability & CAP_PRIVACY_ON) 4393 if (priv->capability & CAP_PRIVACY_ON)
4394 network->capability |= WLAN_CAPABILITY_PRIVACY; 4394 network->capability |= WLAN_CAPABILITY_PRIVACY;
4395 network->rates_len = min(priv->rates.num_rates, MAX_RATES_LENGTH); 4395 network->rates_len = min(priv->rates.num_rates, MAX_RATES_LENGTH);
4396 memcpy(network->rates, priv->rates.supported_rates, 4396 memcpy(network->rates, priv->rates.supported_rates,
4397 network->rates_len); 4397 network->rates_len);
4398 network->rates_ex_len = priv->rates.num_rates - network->rates_len; 4398 network->rates_ex_len = priv->rates.num_rates - network->rates_len;
4399 memcpy(network->rates_ex, 4399 memcpy(network->rates_ex,
4400 &priv->rates.supported_rates[network->rates_len], 4400 &priv->rates.supported_rates[network->rates_len],
4401 network->rates_ex_len); 4401 network->rates_ex_len);
4402 network->last_scanned = 0; 4402 network->last_scanned = 0;
@@ -4407,10 +4407,10 @@ static void ipw_adhoc_create(struct ipw_priv *priv,
4407 network->beacon_interval = 100; /* Default */ 4407 network->beacon_interval = 100; /* Default */
4408 network->listen_interval = 10; /* Default */ 4408 network->listen_interval = 10; /* Default */
4409 network->atim_window = 0; /* Default */ 4409 network->atim_window = 0; /* Default */
4410#ifdef CONFIG_IEEE80211_WPA 4410#ifdef CONFIG_IEEE80211_WPA
4411 network->wpa_ie_len = 0; 4411 network->wpa_ie_len = 0;
4412 network->rsn_ie_len = 0; 4412 network->rsn_ie_len = 0;
4413#endif /* CONFIG_IEEE80211_WPA */ 4413#endif /* CONFIG_IEEE80211_WPA */
4414} 4414}
4415 4415
4416static void ipw_send_wep_keys(struct ipw_priv *priv) 4416static void ipw_send_wep_keys(struct ipw_priv *priv)
@@ -4426,7 +4426,7 @@ static void ipw_send_wep_keys(struct ipw_priv *priv)
4426 key->cmd_id = DINO_CMD_WEP_KEY; 4426 key->cmd_id = DINO_CMD_WEP_KEY;
4427 key->seq_num = 0; 4427 key->seq_num = 0;
4428 4428
4429 for (i = 0; i < 4; i++) { 4429 for (i = 0; i < 4; i++) {
4430 key->key_index = i; 4430 key->key_index = i;
4431 if (!(priv->sec.flags & (1 << i))) { 4431 if (!(priv->sec.flags & (1 << i))) {
4432 key->key_size = 0; 4432 key->key_size = 0;
@@ -4439,13 +4439,13 @@ static void ipw_send_wep_keys(struct ipw_priv *priv)
4439 IPW_ERROR("failed to send WEP_KEY command\n"); 4439 IPW_ERROR("failed to send WEP_KEY command\n");
4440 return; 4440 return;
4441 } 4441 }
4442 } 4442 }
4443} 4443}
4444 4444
4445static void ipw_adhoc_check(void *data) 4445static void ipw_adhoc_check(void *data)
4446{ 4446{
4447 struct ipw_priv *priv = data; 4447 struct ipw_priv *priv = data;
4448 4448
4449 if (priv->missed_adhoc_beacons++ > priv->missed_beacon_threshold && 4449 if (priv->missed_adhoc_beacons++ > priv->missed_beacon_threshold &&
4450 !(priv->config & CFG_ADHOC_PERSIST)) { 4450 !(priv->config & CFG_ADHOC_PERSIST)) {
4451 IPW_DEBUG_SCAN("Disassociating due to missed beacons\n"); 4451 IPW_DEBUG_SCAN("Disassociating due to missed beacons\n");
@@ -4454,7 +4454,7 @@ static void ipw_adhoc_check(void *data)
4454 return; 4454 return;
4455 } 4455 }
4456 4456
4457 queue_delayed_work(priv->workqueue, &priv->adhoc_check, 4457 queue_delayed_work(priv->workqueue, &priv->adhoc_check,
4458 priv->assoc_request.beacon_interval); 4458 priv->assoc_request.beacon_interval);
4459} 4459}
4460 4460
@@ -4464,13 +4464,13 @@ static void ipw_debug_config(struct ipw_priv *priv)
4464 IPW_DEBUG_INFO("Scan completed, no valid APs matched " 4464 IPW_DEBUG_INFO("Scan completed, no valid APs matched "
4465 "[CFG 0x%08X]\n", priv->config); 4465 "[CFG 0x%08X]\n", priv->config);
4466 if (priv->config & CFG_STATIC_CHANNEL) 4466 if (priv->config & CFG_STATIC_CHANNEL)
4467 IPW_DEBUG_INFO("Channel locked to %d\n", 4467 IPW_DEBUG_INFO("Channel locked to %d\n",
4468 priv->channel); 4468 priv->channel);
4469 else 4469 else
4470 IPW_DEBUG_INFO("Channel unlocked.\n"); 4470 IPW_DEBUG_INFO("Channel unlocked.\n");
4471 if (priv->config & CFG_STATIC_ESSID) 4471 if (priv->config & CFG_STATIC_ESSID)
4472 IPW_DEBUG_INFO("ESSID locked to '%s'\n", 4472 IPW_DEBUG_INFO("ESSID locked to '%s'\n",
4473 escape_essid(priv->essid, 4473 escape_essid(priv->essid,
4474 priv->essid_len)); 4474 priv->essid_len));
4475 else 4475 else
4476 IPW_DEBUG_INFO("ESSID unlocked.\n"); 4476 IPW_DEBUG_INFO("ESSID unlocked.\n");
@@ -4498,9 +4498,9 @@ static inline void ipw_set_fixed_rate(struct ipw_priv *priv,
4498 u32 reg; 4498 u32 reg;
4499 u16 mask = 0; 4499 u16 mask = 0;
4500 4500
4501 /* Identify 'current FW band' and match it with the fixed 4501 /* Identify 'current FW band' and match it with the fixed
4502 * Tx rates */ 4502 * Tx rates */
4503 4503
4504 switch (priv->ieee->freq_band) { 4504 switch (priv->ieee->freq_band) {
4505 case IEEE80211_52GHZ_BAND: /* A only */ 4505 case IEEE80211_52GHZ_BAND: /* A only */
4506 /* IEEE_A */ 4506 /* IEEE_A */
@@ -4509,7 +4509,7 @@ static inline void ipw_set_fixed_rate(struct ipw_priv *priv,
4509 fr.tx_rates = 0; 4509 fr.tx_rates = 0;
4510 break; 4510 break;
4511 } 4511 }
4512 4512
4513 fr.tx_rates >>= IEEE80211_OFDM_SHIFT_MASK_A; 4513 fr.tx_rates >>= IEEE80211_OFDM_SHIFT_MASK_A;
4514 break; 4514 break;
4515 4515
@@ -4521,7 +4521,7 @@ static inline void ipw_set_fixed_rate(struct ipw_priv *priv,
4521 fr.tx_rates = 0; 4521 fr.tx_rates = 0;
4522 } 4522 }
4523 break; 4523 break;
4524 } 4524 }
4525 4525
4526 /* IEEE_G */ 4526 /* IEEE_G */
4527 if (fr.tx_rates & ~(IEEE80211_CCK_RATES_MASK | 4527 if (fr.tx_rates & ~(IEEE80211_CCK_RATES_MASK |
@@ -4535,17 +4535,17 @@ static inline void ipw_set_fixed_rate(struct ipw_priv *priv,
4535 mask |= (IEEE80211_OFDM_RATE_6MB_MASK >> 1); 4535 mask |= (IEEE80211_OFDM_RATE_6MB_MASK >> 1);
4536 fr.tx_rates &= ~IEEE80211_OFDM_RATE_6MB_MASK; 4536 fr.tx_rates &= ~IEEE80211_OFDM_RATE_6MB_MASK;
4537 } 4537 }
4538 4538
4539 if (IEEE80211_OFDM_RATE_9MB_MASK & fr.tx_rates) { 4539 if (IEEE80211_OFDM_RATE_9MB_MASK & fr.tx_rates) {
4540 mask |= (IEEE80211_OFDM_RATE_9MB_MASK >> 1); 4540 mask |= (IEEE80211_OFDM_RATE_9MB_MASK >> 1);
4541 fr.tx_rates &= ~IEEE80211_OFDM_RATE_9MB_MASK; 4541 fr.tx_rates &= ~IEEE80211_OFDM_RATE_9MB_MASK;
4542 } 4542 }
4543 4543
4544 if (IEEE80211_OFDM_RATE_12MB_MASK & fr.tx_rates) { 4544 if (IEEE80211_OFDM_RATE_12MB_MASK & fr.tx_rates) {
4545 mask |= (IEEE80211_OFDM_RATE_12MB_MASK >> 1); 4545 mask |= (IEEE80211_OFDM_RATE_12MB_MASK >> 1);
4546 fr.tx_rates &= ~IEEE80211_OFDM_RATE_12MB_MASK; 4546 fr.tx_rates &= ~IEEE80211_OFDM_RATE_12MB_MASK;
4547 } 4547 }
4548 4548
4549 fr.tx_rates |= mask; 4549 fr.tx_rates |= mask;
4550 break; 4550 break;
4551 } 4551 }
@@ -4565,7 +4565,7 @@ static int ipw_associate_network(struct ipw_priv *priv,
4565 ipw_set_fixed_rate(priv, network); 4565 ipw_set_fixed_rate(priv, network);
4566 4566
4567 if (!(priv->config & CFG_STATIC_ESSID)) { 4567 if (!(priv->config & CFG_STATIC_ESSID)) {
4568 priv->essid_len = min(network->ssid_len, 4568 priv->essid_len = min(network->ssid_len,
4569 (u8)IW_ESSID_MAX_SIZE); 4569 (u8)IW_ESSID_MAX_SIZE);
4570 memcpy(priv->essid, network->ssid, priv->essid_len); 4570 memcpy(priv->essid, network->ssid, priv->essid_len);
4571 } 4571 }
@@ -4583,12 +4583,12 @@ static int ipw_associate_network(struct ipw_priv *priv,
4583 priv->assoc_request.auth_key = 0; 4583 priv->assoc_request.auth_key = 0;
4584 } 4584 }
4585 4585
4586 if (priv->capability & CAP_PRIVACY_ON) 4586 if (priv->capability & CAP_PRIVACY_ON)
4587 ipw_send_wep_keys(priv); 4587 ipw_send_wep_keys(priv);
4588 4588
4589 /* 4589 /*
4590 * It is valid for our ieee device to support multiple modes, but 4590 * It is valid for our ieee device to support multiple modes, but
4591 * when it comes to associating to a given network we have to choose 4591 * when it comes to associating to a given network we have to choose
4592 * just one mode. 4592 * just one mode.
4593 */ 4593 */
4594 if (network->mode & priv->ieee->mode & IEEE_A) 4594 if (network->mode & priv->ieee->mode & IEEE_A)
@@ -4601,18 +4601,18 @@ static int ipw_associate_network(struct ipw_priv *priv,
4601 IPW_DEBUG_ASSOC("%sssocation attempt: '%s', channel %d, " 4601 IPW_DEBUG_ASSOC("%sssocation attempt: '%s', channel %d, "
4602 "802.11%c [%d], enc=%s%s%s%c%c\n", 4602 "802.11%c [%d], enc=%s%s%s%c%c\n",
4603 roaming ? "Rea" : "A", 4603 roaming ? "Rea" : "A",
4604 escape_essid(priv->essid, priv->essid_len), 4604 escape_essid(priv->essid, priv->essid_len),
4605 network->channel, 4605 network->channel,
4606 ipw_modes[priv->assoc_request.ieee_mode], 4606 ipw_modes[priv->assoc_request.ieee_mode],
4607 rates->num_rates, 4607 rates->num_rates,
4608 priv->capability & CAP_PRIVACY_ON ? "on " : "off", 4608 priv->capability & CAP_PRIVACY_ON ? "on " : "off",
4609 priv->capability & CAP_PRIVACY_ON ? 4609 priv->capability & CAP_PRIVACY_ON ?
4610 (priv->capability & CAP_SHARED_KEY ? "(shared)" : 4610 (priv->capability & CAP_SHARED_KEY ? "(shared)" :
4611 "(open)") : "", 4611 "(open)") : "",
4612 priv->capability & CAP_PRIVACY_ON ? " key=" : "", 4612 priv->capability & CAP_PRIVACY_ON ? " key=" : "",
4613 priv->capability & CAP_PRIVACY_ON ? 4613 priv->capability & CAP_PRIVACY_ON ?
4614 '1' + priv->sec.active_key : '.', 4614 '1' + priv->sec.active_key : '.',
4615 priv->capability & CAP_PRIVACY_ON ? 4615 priv->capability & CAP_PRIVACY_ON ?
4616 '.' : ' '); 4616 '.' : ' ');
4617 4617
4618 priv->assoc_request.beacon_interval = network->beacon_interval; 4618 priv->assoc_request.beacon_interval = network->beacon_interval;
@@ -4637,14 +4637,14 @@ static int ipw_associate_network(struct ipw_priv *priv,
4637 memset(&priv->assoc_request.dest, 0xFF, ETH_ALEN); 4637 memset(&priv->assoc_request.dest, 0xFF, ETH_ALEN);
4638 priv->assoc_request.atim_window = network->atim_window; 4638 priv->assoc_request.atim_window = network->atim_window;
4639 } else { 4639 } else {
4640 memcpy(&priv->assoc_request.dest, network->bssid, 4640 memcpy(&priv->assoc_request.dest, network->bssid,
4641 ETH_ALEN); 4641 ETH_ALEN);
4642 priv->assoc_request.atim_window = 0; 4642 priv->assoc_request.atim_window = 0;
4643 } 4643 }
4644 4644
4645 priv->assoc_request.capability = network->capability; 4645 priv->assoc_request.capability = network->capability;
4646 priv->assoc_request.listen_interval = network->listen_interval; 4646 priv->assoc_request.listen_interval = network->listen_interval;
4647 4647
4648 err = ipw_send_ssid(priv, priv->essid, priv->essid_len); 4648 err = ipw_send_ssid(priv, priv->essid, priv->essid_len);
4649 if (err) { 4649 if (err) {
4650 IPW_DEBUG_HC("Attempt to send SSID command failed.\n"); 4650 IPW_DEBUG_HC("Attempt to send SSID command failed.\n");
@@ -4654,7 +4654,7 @@ static int ipw_associate_network(struct ipw_priv *priv,
4654 rates->ieee_mode = priv->assoc_request.ieee_mode; 4654 rates->ieee_mode = priv->assoc_request.ieee_mode;
4655 rates->purpose = IPW_RATE_CONNECT; 4655 rates->purpose = IPW_RATE_CONNECT;
4656 ipw_send_supported_rates(priv, rates); 4656 ipw_send_supported_rates(priv, rates);
4657 4657
4658 if (priv->assoc_request.ieee_mode == IPW_G_MODE) 4658 if (priv->assoc_request.ieee_mode == IPW_G_MODE)
4659 priv->sys_config.dot11g_auto_detection = 1; 4659 priv->sys_config.dot11g_auto_detection = 1;
4660 else 4660 else
@@ -4664,7 +4664,7 @@ static int ipw_associate_network(struct ipw_priv *priv,
4664 IPW_DEBUG_HC("Attempt to send sys config command failed.\n"); 4664 IPW_DEBUG_HC("Attempt to send sys config command failed.\n");
4665 return err; 4665 return err;
4666 } 4666 }
4667 4667
4668 IPW_DEBUG_ASSOC("Association sensitivity: %d\n", network->stats.rssi); 4668 IPW_DEBUG_ASSOC("Association sensitivity: %d\n", network->stats.rssi);
4669 err = ipw_set_sensitivity(priv, network->stats.rssi); 4669 err = ipw_set_sensitivity(priv, network->stats.rssi);
4670 if (err) { 4670 if (err) {
@@ -4679,7 +4679,7 @@ static int ipw_associate_network(struct ipw_priv *priv,
4679 */ 4679 */
4680 priv->channel = network->channel; 4680 priv->channel = network->channel;
4681 memcpy(priv->bssid, network->bssid, ETH_ALEN); 4681 memcpy(priv->bssid, network->bssid, ETH_ALEN);
4682 priv->status |= STATUS_ASSOCIATING; 4682 priv->status |= STATUS_ASSOCIATING;
4683 priv->status &= ~STATUS_SECURITY_UPDATED; 4683 priv->status &= ~STATUS_SECURITY_UPDATED;
4684 4684
4685 priv->assoc_network = network; 4685 priv->assoc_network = network;
@@ -4689,8 +4689,8 @@ static int ipw_associate_network(struct ipw_priv *priv,
4689 IPW_DEBUG_HC("Attempt to send associate command failed.\n"); 4689 IPW_DEBUG_HC("Attempt to send associate command failed.\n");
4690 return err; 4690 return err;
4691 } 4691 }
4692 4692
4693 IPW_DEBUG(IPW_DL_STATE, "associating: '%s' " MAC_FMT " \n", 4693 IPW_DEBUG(IPW_DL_STATE, "associating: '%s' " MAC_FMT " \n",
4694 escape_essid(priv->essid, priv->essid_len), 4694 escape_essid(priv->essid, priv->essid_len),
4695 MAC_ARG(priv->bssid)); 4695 MAC_ARG(priv->bssid));
4696 4696
@@ -4706,8 +4706,8 @@ static void ipw_roam(void *data)
4706 }; 4706 };
4707 4707
4708 /* The roaming process is as follows: 4708 /* The roaming process is as follows:
4709 * 4709 *
4710 * 1. Missed beacon threshold triggers the roaming process by 4710 * 1. Missed beacon threshold triggers the roaming process by
4711 * setting the status ROAM bit and requesting a scan. 4711 * setting the status ROAM bit and requesting a scan.
4712 * 2. When the scan completes, it schedules the ROAM work 4712 * 2. When the scan completes, it schedules the ROAM work
4713 * 3. The ROAM work looks at all of the known networks for one that 4713 * 3. The ROAM work looks at all of the known networks for one that
@@ -4718,7 +4718,7 @@ static void ipw_roam(void *data)
4718 * 5. When the disassociation completes, the roam work is again 4718 * 5. When the disassociation completes, the roam work is again
4719 * scheduled. The second time through, the driver is no longer 4719 * scheduled. The second time through, the driver is no longer
4720 * associated, and the newly selected network is sent an 4720 * associated, and the newly selected network is sent an
4721 * association request. 4721 * association request.
4722 * 6. At this point ,the roaming process is complete and the ROAM 4722 * 6. At this point ,the roaming process is complete and the ROAM
4723 * status bit is cleared. 4723 * status bit is cleared.
4724 */ 4724 */
@@ -4727,9 +4727,9 @@ static void ipw_roam(void *data)
4727 * set, then we are not actively roaming, so just return */ 4727 * set, then we are not actively roaming, so just return */
4728 if (!(priv->status & (STATUS_ASSOCIATED | STATUS_ROAMING))) 4728 if (!(priv->status & (STATUS_ASSOCIATED | STATUS_ROAMING)))
4729 return; 4729 return;
4730 4730
4731 if (priv->status & STATUS_ASSOCIATED) { 4731 if (priv->status & STATUS_ASSOCIATED) {
4732 /* First pass through ROAM process -- look for a better 4732 /* First pass through ROAM process -- look for a better
4733 * network */ 4733 * network */
4734 u8 rssi = priv->assoc_network->stats.rssi; 4734 u8 rssi = priv->assoc_network->stats.rssi;
4735 priv->assoc_network->stats.rssi = -128; 4735 priv->assoc_network->stats.rssi = -128;
@@ -4738,7 +4738,7 @@ static void ipw_roam(void *data)
4738 ipw_best_network(priv, &match, network, 1); 4738 ipw_best_network(priv, &match, network, 1);
4739 } 4739 }
4740 priv->assoc_network->stats.rssi = rssi; 4740 priv->assoc_network->stats.rssi = rssi;
4741 4741
4742 if (match.network == priv->assoc_network) { 4742 if (match.network == priv->assoc_network) {
4743 IPW_DEBUG_ASSOC("No better APs in this network to " 4743 IPW_DEBUG_ASSOC("No better APs in this network to "
4744 "roam to.\n"); 4744 "roam to.\n");
@@ -4746,12 +4746,12 @@ static void ipw_roam(void *data)
4746 ipw_debug_config(priv); 4746 ipw_debug_config(priv);
4747 return; 4747 return;
4748 } 4748 }
4749 4749
4750 ipw_send_disassociate(priv, 1); 4750 ipw_send_disassociate(priv, 1);
4751 priv->assoc_network = match.network; 4751 priv->assoc_network = match.network;
4752 4752
4753 return; 4753 return;
4754 } 4754 }
4755 4755
4756 /* Second pass through ROAM process -- request association */ 4756 /* Second pass through ROAM process -- request association */
4757 ipw_compatible_rates(priv, priv->assoc_network, &match.rates); 4757 ipw_compatible_rates(priv, priv->assoc_network, &match.rates);
@@ -4778,7 +4778,7 @@ static void ipw_associate(void *data)
4778 return; 4778 return;
4779 } 4779 }
4780 4780
4781 list_for_each_entry(network, &priv->ieee->network_list, list) 4781 list_for_each_entry(network, &priv->ieee->network_list, list)
4782 ipw_best_network(priv, &match, network, 0); 4782 ipw_best_network(priv, &match, network, 0);
4783 4783
4784 network = match.network; 4784 network = match.network;
@@ -4790,29 +4790,29 @@ static void ipw_associate(void *data)
4790 priv->config & CFG_STATIC_ESSID && 4790 priv->config & CFG_STATIC_ESSID &&
4791 !list_empty(&priv->ieee->network_free_list)) { 4791 !list_empty(&priv->ieee->network_free_list)) {
4792 element = priv->ieee->network_free_list.next; 4792 element = priv->ieee->network_free_list.next;
4793 network = list_entry(element, struct ieee80211_network, 4793 network = list_entry(element, struct ieee80211_network,
4794 list); 4794 list);
4795 ipw_adhoc_create(priv, network); 4795 ipw_adhoc_create(priv, network);
4796 rates = &priv->rates; 4796 rates = &priv->rates;
4797 list_del(element); 4797 list_del(element);
4798 list_add_tail(&network->list, &priv->ieee->network_list); 4798 list_add_tail(&network->list, &priv->ieee->network_list);
4799 } 4799 }
4800 4800
4801 /* If we reached the end of the list, then we don't have any valid 4801 /* If we reached the end of the list, then we don't have any valid
4802 * matching APs */ 4802 * matching APs */
4803 if (!network) { 4803 if (!network) {
4804 ipw_debug_config(priv); 4804 ipw_debug_config(priv);
4805 4805
4806 queue_delayed_work(priv->workqueue, &priv->request_scan, 4806 queue_delayed_work(priv->workqueue, &priv->request_scan,
4807 SCAN_INTERVAL); 4807 SCAN_INTERVAL);
4808 4808
4809 return; 4809 return;
4810 } 4810 }
4811 4811
4812 ipw_associate_network(priv, network, rates, 0); 4812 ipw_associate_network(priv, network, rates, 0);
4813} 4813}
4814 4814
4815static inline void ipw_handle_data_packet(struct ipw_priv *priv, 4815static inline void ipw_handle_data_packet(struct ipw_priv *priv,
4816 struct ipw_rx_mem_buffer *rxb, 4816 struct ipw_rx_mem_buffer *rxb,
4817 struct ieee80211_rx_stats *stats) 4817 struct ieee80211_rx_stats *stats)
4818{ 4818{
@@ -4821,9 +4821,9 @@ static inline void ipw_handle_data_packet(struct ipw_priv *priv,
4821 /* We received data from the HW, so stop the watchdog */ 4821 /* We received data from the HW, so stop the watchdog */
4822 priv->net_dev->trans_start = jiffies; 4822 priv->net_dev->trans_start = jiffies;
4823 4823
4824 /* We only process data packets if the 4824 /* We only process data packets if the
4825 * interface is open */ 4825 * interface is open */
4826 if (unlikely((pkt->u.frame.length + IPW_RX_FRAME_SIZE) > 4826 if (unlikely((pkt->u.frame.length + IPW_RX_FRAME_SIZE) >
4827 skb_tailroom(rxb->skb))) { 4827 skb_tailroom(rxb->skb))) {
4828 priv->ieee->stats.rx_errors++; 4828 priv->ieee->stats.rx_errors++;
4829 priv->wstats.discard.misc++; 4829 priv->wstats.discard.misc++;
@@ -4844,7 +4844,7 @@ static inline void ipw_handle_data_packet(struct ipw_priv *priv,
4844 4844
4845 IPW_DEBUG_RX("Rx packet of %d bytes.\n", rxb->skb->len); 4845 IPW_DEBUG_RX("Rx packet of %d bytes.\n", rxb->skb->len);
4846 4846
4847 if (!ieee80211_rx(priv->ieee, rxb->skb, stats)) 4847 if (!ieee80211_rx(priv->ieee, rxb->skb, stats))
4848 priv->ieee->stats.rx_errors++; 4848 priv->ieee->stats.rx_errors++;
4849 else /* ieee80211_rx succeeded, so it now owns the SKB */ 4849 else /* ieee80211_rx succeeded, so it now owns the SKB */
4850 rxb->skb = NULL; 4850 rxb->skb = NULL;
@@ -4879,7 +4879,7 @@ static void ipw_rx(struct ipw_priv *priv)
4879 priv->rxq->queue[i] = NULL; 4879 priv->rxq->queue[i] = NULL;
4880 4880
4881 pci_dma_sync_single_for_cpu(priv->pci_dev, rxb->dma_addr, 4881 pci_dma_sync_single_for_cpu(priv->pci_dev, rxb->dma_addr,
4882 CX2_RX_BUF_SIZE, 4882 CX2_RX_BUF_SIZE,
4883 PCI_DMA_FROMDEVICE); 4883 PCI_DMA_FROMDEVICE);
4884 4884
4885 pkt = (struct ipw_rx_packet *)rxb->skb->data; 4885 pkt = (struct ipw_rx_packet *)rxb->skb->data;
@@ -4891,14 +4891,14 @@ static void ipw_rx(struct ipw_priv *priv)
4891 switch (pkt->header.message_type) { 4891 switch (pkt->header.message_type) {
4892 case RX_FRAME_TYPE: /* 802.11 frame */ { 4892 case RX_FRAME_TYPE: /* 802.11 frame */ {
4893 struct ieee80211_rx_stats stats = { 4893 struct ieee80211_rx_stats stats = {
4894 .rssi = pkt->u.frame.rssi_dbm - 4894 .rssi = pkt->u.frame.rssi_dbm -
4895 IPW_RSSI_TO_DBM, 4895 IPW_RSSI_TO_DBM,
4896 .signal = pkt->u.frame.signal, 4896 .signal = pkt->u.frame.signal,
4897 .rate = pkt->u.frame.rate, 4897 .rate = pkt->u.frame.rate,
4898 .mac_time = jiffies, 4898 .mac_time = jiffies,
4899 .received_channel = 4899 .received_channel =
4900 pkt->u.frame.received_channel, 4900 pkt->u.frame.received_channel,
4901 .freq = (pkt->u.frame.control & (1<<0)) ? 4901 .freq = (pkt->u.frame.control & (1<<0)) ?
4902 IEEE80211_24GHZ_BAND : IEEE80211_52GHZ_BAND, 4902 IEEE80211_24GHZ_BAND : IEEE80211_52GHZ_BAND,
4903 .len = pkt->u.frame.length, 4903 .len = pkt->u.frame.length,
4904 }; 4904 };
@@ -4918,21 +4918,21 @@ static void ipw_rx(struct ipw_priv *priv)
4918 break; 4918 break;
4919 } 4919 }
4920#endif 4920#endif
4921 4921
4922 header = (struct ieee80211_hdr *)(rxb->skb->data + 4922 header = (struct ieee80211_hdr *)(rxb->skb->data +
4923 IPW_RX_FRAME_SIZE); 4923 IPW_RX_FRAME_SIZE);
4924 /* TODO: Check Ad-Hoc dest/source and make sure 4924 /* TODO: Check Ad-Hoc dest/source and make sure
4925 * that we are actually parsing these packets 4925 * that we are actually parsing these packets
4926 * correctly -- we should probably use the 4926 * correctly -- we should probably use the
4927 * frame control of the packet and disregard 4927 * frame control of the packet and disregard
4928 * the current iw_mode */ 4928 * the current iw_mode */
4929 switch (priv->ieee->iw_mode) { 4929 switch (priv->ieee->iw_mode) {
4930 case IW_MODE_ADHOC: 4930 case IW_MODE_ADHOC:
4931 network_packet = 4931 network_packet =
4932 !memcmp(header->addr1, 4932 !memcmp(header->addr1,
4933 priv->net_dev->dev_addr, 4933 priv->net_dev->dev_addr,
4934 ETH_ALEN) || 4934 ETH_ALEN) ||
4935 !memcmp(header->addr3, 4935 !memcmp(header->addr3,
4936 priv->bssid, ETH_ALEN) || 4936 priv->bssid, ETH_ALEN) ||
4937 is_broadcast_ether_addr(header->addr1) || 4937 is_broadcast_ether_addr(header->addr1) ||
4938 is_multicast_ether_addr(header->addr1); 4938 is_multicast_ether_addr(header->addr1);
@@ -4940,20 +4940,20 @@ static void ipw_rx(struct ipw_priv *priv)
4940 4940
4941 case IW_MODE_INFRA: 4941 case IW_MODE_INFRA:
4942 default: 4942 default:
4943 network_packet = 4943 network_packet =
4944 !memcmp(header->addr3, 4944 !memcmp(header->addr3,
4945 priv->bssid, ETH_ALEN) || 4945 priv->bssid, ETH_ALEN) ||
4946 !memcmp(header->addr1, 4946 !memcmp(header->addr1,
4947 priv->net_dev->dev_addr, 4947 priv->net_dev->dev_addr,
4948 ETH_ALEN) || 4948 ETH_ALEN) ||
4949 is_broadcast_ether_addr(header->addr1) || 4949 is_broadcast_ether_addr(header->addr1) ||
4950 is_multicast_ether_addr(header->addr1); 4950 is_multicast_ether_addr(header->addr1);
4951 break; 4951 break;
4952 } 4952 }
4953 4953
4954 if (network_packet && priv->assoc_network) { 4954 if (network_packet && priv->assoc_network) {
4955 priv->assoc_network->stats.rssi = stats.rssi; 4955 priv->assoc_network->stats.rssi = stats.rssi;
4956 average_add(&priv->average_rssi, 4956 average_add(&priv->average_rssi,
4957 stats.rssi); 4957 stats.rssi);
4958 priv->last_rx_rssi = stats.rssi; 4958 priv->last_rx_rssi = stats.rssi;
4959 } 4959 }
@@ -4967,7 +4967,7 @@ static void ipw_rx(struct ipw_priv *priv)
4967 priv->wstats.discard.misc++; 4967 priv->wstats.discard.misc++;
4968 break; 4968 break;
4969 } 4969 }
4970 4970
4971 switch (WLAN_FC_GET_TYPE(header->frame_ctl)) { 4971 switch (WLAN_FC_GET_TYPE(header->frame_ctl)) {
4972 case IEEE80211_FTYPE_MGMT: 4972 case IEEE80211_FTYPE_MGMT:
4973 ieee80211_rx_mgt(priv->ieee, header, &stats); 4973 ieee80211_rx_mgt(priv->ieee, header, &stats);
@@ -4979,17 +4979,17 @@ static void ipw_rx(struct ipw_priv *priv)
4979 !memcmp(header->addr3, priv->bssid, ETH_ALEN)) 4979 !memcmp(header->addr3, priv->bssid, ETH_ALEN))
4980 ipw_add_station(priv, header->addr2); 4980 ipw_add_station(priv, header->addr2);
4981 break; 4981 break;
4982 4982
4983 case IEEE80211_FTYPE_CTL: 4983 case IEEE80211_FTYPE_CTL:
4984 break; 4984 break;
4985 4985
4986 case IEEE80211_FTYPE_DATA: 4986 case IEEE80211_FTYPE_DATA:
4987 if (network_packet) 4987 if (network_packet)
4988 ipw_handle_data_packet(priv, rxb, &stats); 4988 ipw_handle_data_packet(priv, rxb, &stats);
4989 else 4989 else
4990 IPW_DEBUG_DROP("Dropping: " MAC_FMT 4990 IPW_DEBUG_DROP("Dropping: " MAC_FMT
4991 ", " MAC_FMT ", " MAC_FMT "\n", 4991 ", " MAC_FMT ", " MAC_FMT "\n",
4992 MAC_ARG(header->addr1), MAC_ARG(header->addr2), 4992 MAC_ARG(header->addr1), MAC_ARG(header->addr2),
4993 MAC_ARG(header->addr3)); 4993 MAC_ARG(header->addr3));
4994 break; 4994 break;
4995 } 4995 }
@@ -5010,19 +5010,19 @@ static void ipw_rx(struct ipw_priv *priv)
5010 pkt->header.message_type); 5010 pkt->header.message_type);
5011 break; 5011 break;
5012 } 5012 }
5013 5013
5014 /* For now we just don't re-use anything. We can tweak this 5014 /* For now we just don't re-use anything. We can tweak this
5015 * later to try and re-use notification packets and SKBs that 5015 * later to try and re-use notification packets and SKBs that
5016 * fail to Rx correctly */ 5016 * fail to Rx correctly */
5017 if (rxb->skb != NULL) { 5017 if (rxb->skb != NULL) {
5018 dev_kfree_skb_any(rxb->skb); 5018 dev_kfree_skb_any(rxb->skb);
5019 rxb->skb = NULL; 5019 rxb->skb = NULL;
5020 } 5020 }
5021 5021
5022 pci_unmap_single(priv->pci_dev, rxb->dma_addr, 5022 pci_unmap_single(priv->pci_dev, rxb->dma_addr,
5023 CX2_RX_BUF_SIZE, PCI_DMA_FROMDEVICE); 5023 CX2_RX_BUF_SIZE, PCI_DMA_FROMDEVICE);
5024 list_add_tail(&rxb->list, &priv->rxq->rx_used); 5024 list_add_tail(&rxb->list, &priv->rxq->rx_used);
5025 5025
5026 i = (i + 1) % RX_QUEUE_SIZE; 5026 i = (i + 1) % RX_QUEUE_SIZE;
5027 } 5027 }
5028 5028
@@ -5043,7 +5043,7 @@ static void ipw_abort_scan(struct ipw_priv *priv)
5043 priv->status |= STATUS_SCAN_ABORTING; 5043 priv->status |= STATUS_SCAN_ABORTING;
5044 5044
5045 err = ipw_send_scan_abort(priv); 5045 err = ipw_send_scan_abort(priv);
5046 if (err) 5046 if (err)
5047 IPW_DEBUG_HC("Request to abort scan failed.\n"); 5047 IPW_DEBUG_HC("Request to abort scan failed.\n");
5048} 5048}
5049 5049
@@ -5052,7 +5052,7 @@ static int ipw_request_scan(struct ipw_priv *priv)
5052 struct ipw_scan_request_ext scan; 5052 struct ipw_scan_request_ext scan;
5053 int channel_index = 0; 5053 int channel_index = 0;
5054 int i, err, scan_type; 5054 int i, err, scan_type;
5055 5055
5056 if (priv->status & STATUS_EXIT_PENDING) { 5056 if (priv->status & STATUS_EXIT_PENDING) {
5057 IPW_DEBUG_SCAN("Aborting scan due to device shutdown\n"); 5057 IPW_DEBUG_SCAN("Aborting scan due to device shutdown\n");
5058 priv->status |= STATUS_SCAN_PENDING; 5058 priv->status |= STATUS_SCAN_PENDING;
@@ -5065,7 +5065,7 @@ static int ipw_request_scan(struct ipw_priv *priv)
5065 ipw_abort_scan(priv); 5065 ipw_abort_scan(priv);
5066 return 0; 5066 return 0;
5067 } 5067 }
5068 5068
5069 if (priv->status & STATUS_SCAN_ABORTING) { 5069 if (priv->status & STATUS_SCAN_ABORTING) {
5070 IPW_DEBUG_HC("Scan request while abort pending. Queuing.\n"); 5070 IPW_DEBUG_HC("Scan request while abort pending. Queuing.\n");
5071 priv->status |= STATUS_SCAN_PENDING; 5071 priv->status |= STATUS_SCAN_PENDING;
@@ -5086,23 +5086,23 @@ static int ipw_request_scan(struct ipw_priv *priv)
5086 5086
5087 scan.full_scan_index = ieee80211_get_scans(priv->ieee); 5087 scan.full_scan_index = ieee80211_get_scans(priv->ieee);
5088 /* If we are roaming, then make this a directed scan for the current 5088 /* If we are roaming, then make this a directed scan for the current
5089 * network. Otherwise, ensure that every other scan is a fast 5089 * network. Otherwise, ensure that every other scan is a fast
5090 * channel hop scan */ 5090 * channel hop scan */
5091 if ((priv->status & STATUS_ROAMING) || ( 5091 if ((priv->status & STATUS_ROAMING) || (
5092 !(priv->status & STATUS_ASSOCIATED) && 5092 !(priv->status & STATUS_ASSOCIATED) &&
5093 (priv->config & CFG_STATIC_ESSID) && 5093 (priv->config & CFG_STATIC_ESSID) &&
5094 (scan.full_scan_index % 2))) { 5094 (scan.full_scan_index % 2))) {
5095 err = ipw_send_ssid(priv, priv->essid, priv->essid_len); 5095 err = ipw_send_ssid(priv, priv->essid, priv->essid_len);
5096 if (err) { 5096 if (err) {
5097 IPW_DEBUG_HC("Attempt to send SSID command failed.\n"); 5097 IPW_DEBUG_HC("Attempt to send SSID command failed.\n");
5098 return err; 5098 return err;
5099 } 5099 }
5100 5100
5101 scan_type = IPW_SCAN_ACTIVE_BROADCAST_AND_DIRECT_SCAN; 5101 scan_type = IPW_SCAN_ACTIVE_BROADCAST_AND_DIRECT_SCAN;
5102 } else { 5102 } else {
5103 scan_type = IPW_SCAN_ACTIVE_BROADCAST_SCAN; 5103 scan_type = IPW_SCAN_ACTIVE_BROADCAST_SCAN;
5104 } 5104 }
5105 5105
5106 if (priv->ieee->freq_band & IEEE80211_52GHZ_BAND) { 5106 if (priv->ieee->freq_band & IEEE80211_52GHZ_BAND) {
5107 int start = channel_index; 5107 int start = channel_index;
5108 for (i = 0; i < MAX_A_CHANNELS; i++) { 5108 for (i = 0; i < MAX_A_CHANNELS; i++) {
@@ -5112,13 +5112,13 @@ static int ipw_request_scan(struct ipw_priv *priv)
5112 band_a_active_channel[i] == priv->channel) 5112 band_a_active_channel[i] == priv->channel)
5113 continue; 5113 continue;
5114 channel_index++; 5114 channel_index++;
5115 scan.channels_list[channel_index] = 5115 scan.channels_list[channel_index] =
5116 band_a_active_channel[i]; 5116 band_a_active_channel[i];
5117 ipw_set_scan_type(&scan, channel_index, scan_type); 5117 ipw_set_scan_type(&scan, channel_index, scan_type);
5118 } 5118 }
5119 5119
5120 if (start != channel_index) { 5120 if (start != channel_index) {
5121 scan.channels_list[start] = (u8)(IPW_A_MODE << 6) | 5121 scan.channels_list[start] = (u8)(IPW_A_MODE << 6) |
5122 (channel_index - start); 5122 (channel_index - start);
5123 channel_index++; 5123 channel_index++;
5124 } 5124 }
@@ -5133,17 +5133,17 @@ static int ipw_request_scan(struct ipw_priv *priv)
5133 band_b_active_channel[i] == priv->channel) 5133 band_b_active_channel[i] == priv->channel)
5134 continue; 5134 continue;
5135 channel_index++; 5135 channel_index++;
5136 scan.channels_list[channel_index] = 5136 scan.channels_list[channel_index] =
5137 band_b_active_channel[i]; 5137 band_b_active_channel[i];
5138 ipw_set_scan_type(&scan, channel_index, scan_type); 5138 ipw_set_scan_type(&scan, channel_index, scan_type);
5139 } 5139 }
5140 5140
5141 if (start != channel_index) { 5141 if (start != channel_index) {
5142 scan.channels_list[start] = (u8)(IPW_B_MODE << 6) | 5142 scan.channels_list[start] = (u8)(IPW_B_MODE << 6) |
5143 (channel_index - start); 5143 (channel_index - start);
5144 } 5144 }
5145 } 5145 }
5146 5146
5147 err = ipw_send_scan_request_ext(priv, &scan); 5147 err = ipw_send_scan_request_ext(priv, &scan);
5148 if (err) { 5148 if (err) {
5149 IPW_DEBUG_HC("Sending scan command failed: %08X\n", 5149 IPW_DEBUG_HC("Sending scan command failed: %08X\n",
@@ -5161,20 +5161,20 @@ static int ipw_request_scan(struct ipw_priv *priv)
5161 * This file defines the Wireless Extension handlers. It does not 5161 * This file defines the Wireless Extension handlers. It does not
5162 * define any methods of hardware manipulation and relies on the 5162 * define any methods of hardware manipulation and relies on the
5163 * functions defined in ipw_main to provide the HW interaction. 5163 * functions defined in ipw_main to provide the HW interaction.
5164 * 5164 *
5165 * The exception to this is the use of the ipw_get_ordinal() 5165 * The exception to this is the use of the ipw_get_ordinal()
5166 * function used to poll the hardware vs. making unecessary calls. 5166 * function used to poll the hardware vs. making unecessary calls.
5167 * 5167 *
5168 */ 5168 */
5169 5169
5170static int ipw_wx_get_name(struct net_device *dev, 5170static int ipw_wx_get_name(struct net_device *dev,
5171 struct iw_request_info *info, 5171 struct iw_request_info *info,
5172 union iwreq_data *wrqu, char *extra) 5172 union iwreq_data *wrqu, char *extra)
5173{ 5173{
5174 struct ipw_priv *priv = ieee80211_priv(dev); 5174 struct ipw_priv *priv = ieee80211_priv(dev);
5175 if (!(priv->status & STATUS_ASSOCIATED)) 5175 if (!(priv->status & STATUS_ASSOCIATED))
5176 strcpy(wrqu->name, "unassociated"); 5176 strcpy(wrqu->name, "unassociated");
5177 else 5177 else
5178 snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11%c", 5178 snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11%c",
5179 ipw_modes[priv->assoc_request.ieee_mode]); 5179 ipw_modes[priv->assoc_request.ieee_mode]);
5180 IPW_DEBUG_WX("Name: %s\n", wrqu->name); 5180 IPW_DEBUG_WX("Name: %s\n", wrqu->name);
@@ -5220,42 +5220,42 @@ static int ipw_set_channel(struct ipw_priv *priv, u8 channel)
5220 return 0; 5220 return 0;
5221} 5221}
5222 5222
5223static int ipw_wx_set_freq(struct net_device *dev, 5223static int ipw_wx_set_freq(struct net_device *dev,
5224 struct iw_request_info *info, 5224 struct iw_request_info *info,
5225 union iwreq_data *wrqu, char *extra) 5225 union iwreq_data *wrqu, char *extra)
5226{ 5226{
5227 struct ipw_priv *priv = ieee80211_priv(dev); 5227 struct ipw_priv *priv = ieee80211_priv(dev);
5228 struct iw_freq *fwrq = &wrqu->freq; 5228 struct iw_freq *fwrq = &wrqu->freq;
5229 5229
5230 /* if setting by freq convert to channel */ 5230 /* if setting by freq convert to channel */
5231 if (fwrq->e == 1) { 5231 if (fwrq->e == 1) {
5232 if ((fwrq->m >= (int) 2.412e8 && 5232 if ((fwrq->m >= (int) 2.412e8 &&
5233 fwrq->m <= (int) 2.487e8)) { 5233 fwrq->m <= (int) 2.487e8)) {
5234 int f = fwrq->m / 100000; 5234 int f = fwrq->m / 100000;
5235 int c = 0; 5235 int c = 0;
5236 5236
5237 while ((c < REG_MAX_CHANNEL) && 5237 while ((c < REG_MAX_CHANNEL) &&
5238 (f != ipw_frequencies[c])) 5238 (f != ipw_frequencies[c]))
5239 c++; 5239 c++;
5240 5240
5241 /* hack to fall through */ 5241 /* hack to fall through */
5242 fwrq->e = 0; 5242 fwrq->e = 0;
5243 fwrq->m = c + 1; 5243 fwrq->m = c + 1;
5244 } 5244 }
5245 } 5245 }
5246 5246
5247 if (fwrq->e > 0 || fwrq->m > 1000) 5247 if (fwrq->e > 0 || fwrq->m > 1000)
5248 return -EOPNOTSUPP; 5248 return -EOPNOTSUPP;
5249 5249
5250 IPW_DEBUG_WX("SET Freq/Channel -> %d \n", fwrq->m); 5250 IPW_DEBUG_WX("SET Freq/Channel -> %d \n", fwrq->m);
5251 return ipw_set_channel(priv, (u8)fwrq->m); 5251 return ipw_set_channel(priv, (u8)fwrq->m);
5252 5252
5253 return 0; 5253 return 0;
5254} 5254}
5255 5255
5256 5256
5257static int ipw_wx_get_freq(struct net_device *dev, 5257static int ipw_wx_get_freq(struct net_device *dev,
5258 struct iw_request_info *info, 5258 struct iw_request_info *info,
5259 union iwreq_data *wrqu, char *extra) 5259 union iwreq_data *wrqu, char *extra)
5260{ 5260{
5261 struct ipw_priv *priv = ieee80211_priv(dev); 5261 struct ipw_priv *priv = ieee80211_priv(dev);
@@ -5267,15 +5267,15 @@ static int ipw_wx_get_freq(struct net_device *dev,
5267 if (priv->config & CFG_STATIC_CHANNEL || 5267 if (priv->config & CFG_STATIC_CHANNEL ||
5268 priv->status & (STATUS_ASSOCIATING | STATUS_ASSOCIATED)) 5268 priv->status & (STATUS_ASSOCIATING | STATUS_ASSOCIATED))
5269 wrqu->freq.m = priv->channel; 5269 wrqu->freq.m = priv->channel;
5270 else 5270 else
5271 wrqu->freq.m = 0; 5271 wrqu->freq.m = 0;
5272 5272
5273 IPW_DEBUG_WX("GET Freq/Channel -> %d \n", priv->channel); 5273 IPW_DEBUG_WX("GET Freq/Channel -> %d \n", priv->channel);
5274 return 0; 5274 return 0;
5275} 5275}
5276 5276
5277static int ipw_wx_set_mode(struct net_device *dev, 5277static int ipw_wx_set_mode(struct net_device *dev,
5278 struct iw_request_info *info, 5278 struct iw_request_info *info,
5279 union iwreq_data *wrqu, char *extra) 5279 union iwreq_data *wrqu, char *extra)
5280{ 5280{
5281 struct ipw_priv *priv = ieee80211_priv(dev); 5281 struct ipw_priv *priv = ieee80211_priv(dev);
@@ -5301,15 +5301,15 @@ static int ipw_wx_set_mode(struct net_device *dev,
5301 } 5301 }
5302 5302
5303#ifdef CONFIG_IPW_PROMISC 5303#ifdef CONFIG_IPW_PROMISC
5304 if (priv->ieee->iw_mode == IW_MODE_MONITOR) 5304 if (priv->ieee->iw_mode == IW_MODE_MONITOR)
5305 priv->net_dev->type = ARPHRD_ETHER; 5305 priv->net_dev->type = ARPHRD_ETHER;
5306 5306
5307 if (wrqu->mode == IW_MODE_MONITOR) 5307 if (wrqu->mode == IW_MODE_MONITOR)
5308 priv->net_dev->type = ARPHRD_IEEE80211; 5308 priv->net_dev->type = ARPHRD_IEEE80211;
5309#endif /* CONFIG_IPW_PROMISC */ 5309#endif /* CONFIG_IPW_PROMISC */
5310 5310
5311#ifdef CONFIG_PM 5311#ifdef CONFIG_PM
5312 /* Free the existing firmware and reset the fw_loaded 5312 /* Free the existing firmware and reset the fw_loaded
5313 * flag so ipw_load() will bring in the new firmawre */ 5313 * flag so ipw_load() will bring in the new firmawre */
5314 if (fw_loaded) { 5314 if (fw_loaded) {
5315 fw_loaded = 0; 5315 fw_loaded = 0;
@@ -5323,12 +5323,12 @@ static int ipw_wx_set_mode(struct net_device *dev,
5323 5323
5324 priv->ieee->iw_mode = wrqu->mode; 5324 priv->ieee->iw_mode = wrqu->mode;
5325 ipw_adapter_restart(priv); 5325 ipw_adapter_restart(priv);
5326 5326
5327 return err; 5327 return err;
5328} 5328}
5329 5329
5330static int ipw_wx_get_mode(struct net_device *dev, 5330static int ipw_wx_get_mode(struct net_device *dev,
5331 struct iw_request_info *info, 5331 struct iw_request_info *info,
5332 union iwreq_data *wrqu, char *extra) 5332 union iwreq_data *wrqu, char *extra)
5333{ 5333{
5334 struct ipw_priv *priv = ieee80211_priv(dev); 5334 struct ipw_priv *priv = ieee80211_priv(dev);
@@ -5364,8 +5364,8 @@ static const s32 period_duration[] = {
5364 1000000 5364 1000000
5365}; 5365};
5366 5366
5367static int ipw_wx_get_range(struct net_device *dev, 5367static int ipw_wx_get_range(struct net_device *dev,
5368 struct iw_request_info *info, 5368 struct iw_request_info *info,
5369 union iwreq_data *wrqu, char *extra) 5369 union iwreq_data *wrqu, char *extra)
5370{ 5370{
5371 struct ipw_priv *priv = ieee80211_priv(dev); 5371 struct ipw_priv *priv = ieee80211_priv(dev);
@@ -5377,7 +5377,7 @@ static int ipw_wx_get_range(struct net_device *dev,
5377 memset(range, 0, sizeof(*range)); 5377 memset(range, 0, sizeof(*range));
5378 5378
5379 /* 54Mbs == ~27 Mb/s real (802.11g) */ 5379 /* 54Mbs == ~27 Mb/s real (802.11g) */
5380 range->throughput = 27 * 1000 * 1000; 5380 range->throughput = 27 * 1000 * 1000;
5381 5381
5382 range->max_qual.qual = 100; 5382 range->max_qual.qual = 100;
5383 /* TODO: Find real max RSSI and stick here */ 5383 /* TODO: Find real max RSSI and stick here */
@@ -5393,16 +5393,16 @@ static int ipw_wx_get_range(struct net_device *dev,
5393 5393
5394 range->num_bitrates = min(priv->rates.num_rates, (u8)IW_MAX_BITRATES); 5394 range->num_bitrates = min(priv->rates.num_rates, (u8)IW_MAX_BITRATES);
5395 5395
5396 for (i = 0; i < range->num_bitrates; i++) 5396 for (i = 0; i < range->num_bitrates; i++)
5397 range->bitrate[i] = (priv->rates.supported_rates[i] & 0x7F) * 5397 range->bitrate[i] = (priv->rates.supported_rates[i] & 0x7F) *
5398 500000; 5398 500000;
5399 5399
5400 range->max_rts = DEFAULT_RTS_THRESHOLD; 5400 range->max_rts = DEFAULT_RTS_THRESHOLD;
5401 range->min_frag = MIN_FRAG_THRESHOLD; 5401 range->min_frag = MIN_FRAG_THRESHOLD;
5402 range->max_frag = MAX_FRAG_THRESHOLD; 5402 range->max_frag = MAX_FRAG_THRESHOLD;
5403 5403
5404 range->encoding_size[0] = 5; 5404 range->encoding_size[0] = 5;
5405 range->encoding_size[1] = 13; 5405 range->encoding_size[1] = 13;
5406 range->num_encoding_sizes = 2; 5406 range->num_encoding_sizes = 2;
5407 range->max_encoding_tokens = WEP_KEYS; 5407 range->max_encoding_tokens = WEP_KEYS;
5408 5408
@@ -5428,8 +5428,8 @@ static int ipw_wx_get_range(struct net_device *dev,
5428 return 0; 5428 return 0;
5429} 5429}
5430 5430
5431static int ipw_wx_set_wap(struct net_device *dev, 5431static int ipw_wx_set_wap(struct net_device *dev,
5432 struct iw_request_info *info, 5432 struct iw_request_info *info,
5433 union iwreq_data *wrqu, char *extra) 5433 union iwreq_data *wrqu, char *extra)
5434{ 5434{
5435 struct ipw_priv *priv = ieee80211_priv(dev); 5435 struct ipw_priv *priv = ieee80211_priv(dev);
@@ -5441,7 +5441,7 @@ static int ipw_wx_set_wap(struct net_device *dev,
5441 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 5441 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
5442 }; 5442 };
5443 5443
5444 if (wrqu->ap_addr.sa_family != ARPHRD_ETHER) 5444 if (wrqu->ap_addr.sa_family != ARPHRD_ETHER)
5445 return -EINVAL; 5445 return -EINVAL;
5446 5446
5447 if (!memcmp(any, wrqu->ap_addr.sa_data, ETH_ALEN) || 5447 if (!memcmp(any, wrqu->ap_addr.sa_data, ETH_ALEN) ||
@@ -5482,14 +5482,14 @@ static int ipw_wx_set_wap(struct net_device *dev,
5482 return 0; 5482 return 0;
5483} 5483}
5484 5484
5485static int ipw_wx_get_wap(struct net_device *dev, 5485static int ipw_wx_get_wap(struct net_device *dev,
5486 struct iw_request_info *info, 5486 struct iw_request_info *info,
5487 union iwreq_data *wrqu, char *extra) 5487 union iwreq_data *wrqu, char *extra)
5488{ 5488{
5489 struct ipw_priv *priv = ieee80211_priv(dev); 5489 struct ipw_priv *priv = ieee80211_priv(dev);
5490 /* If we are associated, trying to associate, or have a statically 5490 /* If we are associated, trying to associate, or have a statically
5491 * configured BSSID then return that; otherwise return ANY */ 5491 * configured BSSID then return that; otherwise return ANY */
5492 if (priv->config & CFG_STATIC_BSSID || 5492 if (priv->config & CFG_STATIC_BSSID ||
5493 priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { 5493 priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) {
5494 wrqu->ap_addr.sa_family = ARPHRD_ETHER; 5494 wrqu->ap_addr.sa_family = ARPHRD_ETHER;
5495 memcpy(wrqu->ap_addr.sa_data, &priv->bssid, ETH_ALEN); 5495 memcpy(wrqu->ap_addr.sa_data, &priv->bssid, ETH_ALEN);
@@ -5501,14 +5501,14 @@ static int ipw_wx_get_wap(struct net_device *dev,
5501 return 0; 5501 return 0;
5502} 5502}
5503 5503
5504static int ipw_wx_set_essid(struct net_device *dev, 5504static int ipw_wx_set_essid(struct net_device *dev,
5505 struct iw_request_info *info, 5505 struct iw_request_info *info,
5506 union iwreq_data *wrqu, char *extra) 5506 union iwreq_data *wrqu, char *extra)
5507{ 5507{
5508 struct ipw_priv *priv = ieee80211_priv(dev); 5508 struct ipw_priv *priv = ieee80211_priv(dev);
5509 char *essid = ""; /* ANY */ 5509 char *essid = ""; /* ANY */
5510 int length = 0; 5510 int length = 0;
5511 5511
5512 if (wrqu->essid.flags && wrqu->essid.length) { 5512 if (wrqu->essid.flags && wrqu->essid.length) {
5513 length = wrqu->essid.length - 1; 5513 length = wrqu->essid.length - 1;
5514 essid = extra; 5514 essid = extra;
@@ -5540,7 +5540,7 @@ static int ipw_wx_set_essid(struct net_device *dev,
5540 5540
5541 priv->essid_len = length; 5541 priv->essid_len = length;
5542 memcpy(priv->essid, essid, priv->essid_len); 5542 memcpy(priv->essid, essid, priv->essid_len);
5543 5543
5544 /* If we are currently associated, or trying to associate 5544 /* If we are currently associated, or trying to associate
5545 * then see if this is a new ESSID (causing us to disassociate) */ 5545 * then see if this is a new ESSID (causing us to disassociate) */
5546 if (priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { 5546 if (priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) {
@@ -5553,8 +5553,8 @@ static int ipw_wx_set_essid(struct net_device *dev,
5553 return 0; 5553 return 0;
5554} 5554}
5555 5555
5556static int ipw_wx_get_essid(struct net_device *dev, 5556static int ipw_wx_get_essid(struct net_device *dev,
5557 struct iw_request_info *info, 5557 struct iw_request_info *info,
5558 union iwreq_data *wrqu, char *extra) 5558 union iwreq_data *wrqu, char *extra)
5559{ 5559{
5560 struct ipw_priv *priv = ieee80211_priv(dev); 5560 struct ipw_priv *priv = ieee80211_priv(dev);
@@ -5562,10 +5562,10 @@ static int ipw_wx_get_essid(struct net_device *dev,
5562 /* If we are associated, trying to associate, or have a statically 5562 /* If we are associated, trying to associate, or have a statically
5563 * configured ESSID then return that; otherwise return ANY */ 5563 * configured ESSID then return that; otherwise return ANY */
5564 if (priv->config & CFG_STATIC_ESSID || 5564 if (priv->config & CFG_STATIC_ESSID ||
5565 priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { 5565 priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) {
5566 IPW_DEBUG_WX("Getting essid: '%s'\n", 5566 IPW_DEBUG_WX("Getting essid: '%s'\n",
5567 escape_essid(priv->essid, priv->essid_len)); 5567 escape_essid(priv->essid, priv->essid_len));
5568 memcpy(extra, priv->essid, priv->essid_len); 5568 memcpy(extra, priv->essid, priv->essid_len);
5569 wrqu->essid.length = priv->essid_len; 5569 wrqu->essid.length = priv->essid_len;
5570 wrqu->essid.flags = 1; /* active */ 5570 wrqu->essid.flags = 1; /* active */
5571 } else { 5571 } else {
@@ -5577,10 +5577,10 @@ static int ipw_wx_get_essid(struct net_device *dev,
5577 return 0; 5577 return 0;
5578} 5578}
5579 5579
5580static int ipw_wx_set_nick(struct net_device *dev, 5580static int ipw_wx_set_nick(struct net_device *dev,
5581 struct iw_request_info *info, 5581 struct iw_request_info *info,
5582 union iwreq_data *wrqu, char *extra) 5582 union iwreq_data *wrqu, char *extra)
5583{ 5583{
5584 struct ipw_priv *priv = ieee80211_priv(dev); 5584 struct ipw_priv *priv = ieee80211_priv(dev);
5585 5585
5586 IPW_DEBUG_WX("Setting nick to '%s'\n", extra); 5586 IPW_DEBUG_WX("Setting nick to '%s'\n", extra);
@@ -5596,10 +5596,10 @@ static int ipw_wx_set_nick(struct net_device *dev,
5596} 5596}
5597 5597
5598 5598
5599static int ipw_wx_get_nick(struct net_device *dev, 5599static int ipw_wx_get_nick(struct net_device *dev,
5600 struct iw_request_info *info, 5600 struct iw_request_info *info,
5601 union iwreq_data *wrqu, char *extra) 5601 union iwreq_data *wrqu, char *extra)
5602{ 5602{
5603 struct ipw_priv *priv = ieee80211_priv(dev); 5603 struct ipw_priv *priv = ieee80211_priv(dev);
5604 IPW_DEBUG_WX("Getting nick\n"); 5604 IPW_DEBUG_WX("Getting nick\n");
5605 wrqu->data.length = strlen(priv->nick) + 1; 5605 wrqu->data.length = strlen(priv->nick) + 1;
@@ -5612,15 +5612,15 @@ static int ipw_wx_get_nick(struct net_device *dev,
5612static int ipw_wx_set_rate(struct net_device *dev, 5612static int ipw_wx_set_rate(struct net_device *dev,
5613 struct iw_request_info *info, 5613 struct iw_request_info *info,
5614 union iwreq_data *wrqu, char *extra) 5614 union iwreq_data *wrqu, char *extra)
5615{ 5615{
5616 IPW_DEBUG_WX("0x%p, 0x%p, 0x%p\n", dev, info, wrqu); 5616 IPW_DEBUG_WX("0x%p, 0x%p, 0x%p\n", dev, info, wrqu);
5617 return -EOPNOTSUPP; 5617 return -EOPNOTSUPP;
5618} 5618}
5619 5619
5620static int ipw_wx_get_rate(struct net_device *dev, 5620static int ipw_wx_get_rate(struct net_device *dev,
5621 struct iw_request_info *info, 5621 struct iw_request_info *info,
5622 union iwreq_data *wrqu, char *extra) 5622 union iwreq_data *wrqu, char *extra)
5623{ 5623{
5624 struct ipw_priv * priv = ieee80211_priv(dev); 5624 struct ipw_priv * priv = ieee80211_priv(dev);
5625 wrqu->bitrate.value = priv->last_rate; 5625 wrqu->bitrate.value = priv->last_rate;
5626 5626
@@ -5629,10 +5629,10 @@ static int ipw_wx_get_rate(struct net_device *dev,
5629} 5629}
5630 5630
5631 5631
5632static int ipw_wx_set_rts(struct net_device *dev, 5632static int ipw_wx_set_rts(struct net_device *dev,
5633 struct iw_request_info *info, 5633 struct iw_request_info *info,
5634 union iwreq_data *wrqu, char *extra) 5634 union iwreq_data *wrqu, char *extra)
5635{ 5635{
5636 struct ipw_priv *priv = ieee80211_priv(dev); 5636 struct ipw_priv *priv = ieee80211_priv(dev);
5637 5637
5638 if (wrqu->rts.disabled) 5638 if (wrqu->rts.disabled)
@@ -5641,7 +5641,7 @@ static int ipw_wx_set_rts(struct net_device *dev,
5641 if (wrqu->rts.value < MIN_RTS_THRESHOLD || 5641 if (wrqu->rts.value < MIN_RTS_THRESHOLD ||
5642 wrqu->rts.value > MAX_RTS_THRESHOLD) 5642 wrqu->rts.value > MAX_RTS_THRESHOLD)
5643 return -EINVAL; 5643 return -EINVAL;
5644 5644
5645 priv->rts_threshold = wrqu->rts.value; 5645 priv->rts_threshold = wrqu->rts.value;
5646 } 5646 }
5647 5647
@@ -5650,14 +5650,14 @@ static int ipw_wx_set_rts(struct net_device *dev,
5650 return 0; 5650 return 0;
5651} 5651}
5652 5652
5653static int ipw_wx_get_rts(struct net_device *dev, 5653static int ipw_wx_get_rts(struct net_device *dev,
5654 struct iw_request_info *info, 5654 struct iw_request_info *info,
5655 union iwreq_data *wrqu, char *extra) 5655 union iwreq_data *wrqu, char *extra)
5656{ 5656{
5657 struct ipw_priv *priv = ieee80211_priv(dev); 5657 struct ipw_priv *priv = ieee80211_priv(dev);
5658 wrqu->rts.value = priv->rts_threshold; 5658 wrqu->rts.value = priv->rts_threshold;
5659 wrqu->rts.fixed = 0; /* no auto select */ 5659 wrqu->rts.fixed = 0; /* no auto select */
5660 wrqu->rts.disabled = 5660 wrqu->rts.disabled =
5661 (wrqu->rts.value == DEFAULT_RTS_THRESHOLD); 5661 (wrqu->rts.value == DEFAULT_RTS_THRESHOLD);
5662 5662
5663 IPW_DEBUG_WX("GET RTS Threshold -> %d \n", wrqu->rts.value); 5663 IPW_DEBUG_WX("GET RTS Threshold -> %d \n", wrqu->rts.value);
@@ -5665,10 +5665,10 @@ static int ipw_wx_get_rts(struct net_device *dev,
5665} 5665}
5666 5666
5667 5667
5668static int ipw_wx_set_txpow(struct net_device *dev, 5668static int ipw_wx_set_txpow(struct net_device *dev,
5669 struct iw_request_info *info, 5669 struct iw_request_info *info,
5670 union iwreq_data *wrqu, char *extra) 5670 union iwreq_data *wrqu, char *extra)
5671{ 5671{
5672 struct ipw_priv *priv = ieee80211_priv(dev); 5672 struct ipw_priv *priv = ieee80211_priv(dev);
5673 struct ipw_tx_power tx_power; 5673 struct ipw_tx_power tx_power;
5674 int i; 5674 int i;
@@ -5679,7 +5679,7 @@ static int ipw_wx_set_txpow(struct net_device *dev,
5679 if (wrqu->power.flags != IW_TXPOW_DBM) 5679 if (wrqu->power.flags != IW_TXPOW_DBM)
5680 return -EINVAL; 5680 return -EINVAL;
5681 5681
5682 if ((wrqu->power.value > 20) || 5682 if ((wrqu->power.value > 20) ||
5683 (wrqu->power.value < -12)) 5683 (wrqu->power.value < -12))
5684 return -EINVAL; 5684 return -EINVAL;
5685 5685
@@ -5709,10 +5709,10 @@ static int ipw_wx_set_txpow(struct net_device *dev,
5709} 5709}
5710 5710
5711 5711
5712static int ipw_wx_get_txpow(struct net_device *dev, 5712static int ipw_wx_get_txpow(struct net_device *dev,
5713 struct iw_request_info *info, 5713 struct iw_request_info *info,
5714 union iwreq_data *wrqu, char *extra) 5714 union iwreq_data *wrqu, char *extra)
5715{ 5715{
5716 struct ipw_priv *priv = ieee80211_priv(dev); 5716 struct ipw_priv *priv = ieee80211_priv(dev);
5717 5717
5718 wrqu->power.value = priv->tx_power; 5718 wrqu->power.value = priv->tx_power;
@@ -5720,15 +5720,15 @@ static int ipw_wx_get_txpow(struct net_device *dev,
5720 wrqu->power.flags = IW_TXPOW_DBM; 5720 wrqu->power.flags = IW_TXPOW_DBM;
5721 wrqu->power.disabled = (priv->status & STATUS_RF_KILL_MASK) ? 1 : 0; 5721 wrqu->power.disabled = (priv->status & STATUS_RF_KILL_MASK) ? 1 : 0;
5722 5722
5723 IPW_DEBUG_WX("GET TX Power -> %s %d \n", 5723 IPW_DEBUG_WX("GET TX Power -> %s %d \n",
5724 wrqu->power.disabled ? "ON" : "OFF", 5724 wrqu->power.disabled ? "ON" : "OFF",
5725 wrqu->power.value); 5725 wrqu->power.value);
5726 5726
5727 return 0; 5727 return 0;
5728} 5728}
5729 5729
5730static int ipw_wx_set_frag(struct net_device *dev, 5730static int ipw_wx_set_frag(struct net_device *dev,
5731 struct iw_request_info *info, 5731 struct iw_request_info *info,
5732 union iwreq_data *wrqu, char *extra) 5732 union iwreq_data *wrqu, char *extra)
5733{ 5733{
5734 struct ipw_priv *priv = ieee80211_priv(dev); 5734 struct ipw_priv *priv = ieee80211_priv(dev);
@@ -5739,7 +5739,7 @@ static int ipw_wx_set_frag(struct net_device *dev,
5739 if (wrqu->frag.value < MIN_FRAG_THRESHOLD || 5739 if (wrqu->frag.value < MIN_FRAG_THRESHOLD ||
5740 wrqu->frag.value > MAX_FRAG_THRESHOLD) 5740 wrqu->frag.value > MAX_FRAG_THRESHOLD)
5741 return -EINVAL; 5741 return -EINVAL;
5742 5742
5743 priv->ieee->fts = wrqu->frag.value & ~0x1; 5743 priv->ieee->fts = wrqu->frag.value & ~0x1;
5744 } 5744 }
5745 5745
@@ -5748,14 +5748,14 @@ static int ipw_wx_set_frag(struct net_device *dev,
5748 return 0; 5748 return 0;
5749} 5749}
5750 5750
5751static int ipw_wx_get_frag(struct net_device *dev, 5751static int ipw_wx_get_frag(struct net_device *dev,
5752 struct iw_request_info *info, 5752 struct iw_request_info *info,
5753 union iwreq_data *wrqu, char *extra) 5753 union iwreq_data *wrqu, char *extra)
5754{ 5754{
5755 struct ipw_priv *priv = ieee80211_priv(dev); 5755 struct ipw_priv *priv = ieee80211_priv(dev);
5756 wrqu->frag.value = priv->ieee->fts; 5756 wrqu->frag.value = priv->ieee->fts;
5757 wrqu->frag.fixed = 0; /* no auto select */ 5757 wrqu->frag.fixed = 0; /* no auto select */
5758 wrqu->frag.disabled = 5758 wrqu->frag.disabled =
5759 (wrqu->frag.value == DEFAULT_FTS); 5759 (wrqu->frag.value == DEFAULT_FTS);
5760 5760
5761 IPW_DEBUG_WX("GET Frag Threshold -> %d \n", wrqu->frag.value); 5761 IPW_DEBUG_WX("GET Frag Threshold -> %d \n", wrqu->frag.value);
@@ -5763,26 +5763,26 @@ static int ipw_wx_get_frag(struct net_device *dev,
5763 return 0; 5763 return 0;
5764} 5764}
5765 5765
5766static int ipw_wx_set_retry(struct net_device *dev, 5766static int ipw_wx_set_retry(struct net_device *dev,
5767 struct iw_request_info *info, 5767 struct iw_request_info *info,
5768 union iwreq_data *wrqu, char *extra) 5768 union iwreq_data *wrqu, char *extra)
5769{ 5769{
5770 IPW_DEBUG_WX("0x%p, 0x%p, 0x%p\n", dev, info, wrqu); 5770 IPW_DEBUG_WX("0x%p, 0x%p, 0x%p\n", dev, info, wrqu);
5771 return -EOPNOTSUPP; 5771 return -EOPNOTSUPP;
5772} 5772}
5773 5773
5774 5774
5775static int ipw_wx_get_retry(struct net_device *dev, 5775static int ipw_wx_get_retry(struct net_device *dev,
5776 struct iw_request_info *info, 5776 struct iw_request_info *info,
5777 union iwreq_data *wrqu, char *extra) 5777 union iwreq_data *wrqu, char *extra)
5778{ 5778{
5779 IPW_DEBUG_WX("0x%p, 0x%p, 0x%p\n", dev, info, wrqu); 5779 IPW_DEBUG_WX("0x%p, 0x%p, 0x%p\n", dev, info, wrqu);
5780 return -EOPNOTSUPP; 5780 return -EOPNOTSUPP;
5781} 5781}
5782 5782
5783 5783
5784static int ipw_wx_set_scan(struct net_device *dev, 5784static int ipw_wx_set_scan(struct net_device *dev,
5785 struct iw_request_info *info, 5785 struct iw_request_info *info,
5786 union iwreq_data *wrqu, char *extra) 5786 union iwreq_data *wrqu, char *extra)
5787{ 5787{
5788 struct ipw_priv *priv = ieee80211_priv(dev); 5788 struct ipw_priv *priv = ieee80211_priv(dev);
@@ -5792,32 +5792,32 @@ static int ipw_wx_set_scan(struct net_device *dev,
5792 return 0; 5792 return 0;
5793} 5793}
5794 5794
5795static int ipw_wx_get_scan(struct net_device *dev, 5795static int ipw_wx_get_scan(struct net_device *dev,
5796 struct iw_request_info *info, 5796 struct iw_request_info *info,
5797 union iwreq_data *wrqu, char *extra) 5797 union iwreq_data *wrqu, char *extra)
5798{ 5798{
5799 struct ipw_priv *priv = ieee80211_priv(dev); 5799 struct ipw_priv *priv = ieee80211_priv(dev);
5800 return ieee80211_wx_get_scan(priv->ieee, info, wrqu, extra); 5800 return ieee80211_wx_get_scan(priv->ieee, info, wrqu, extra);
5801} 5801}
5802 5802
5803static int ipw_wx_set_encode(struct net_device *dev, 5803static int ipw_wx_set_encode(struct net_device *dev,
5804 struct iw_request_info *info, 5804 struct iw_request_info *info,
5805 union iwreq_data *wrqu, char *key) 5805 union iwreq_data *wrqu, char *key)
5806{ 5806{
5807 struct ipw_priv *priv = ieee80211_priv(dev); 5807 struct ipw_priv *priv = ieee80211_priv(dev);
5808 return ieee80211_wx_set_encode(priv->ieee, info, wrqu, key); 5808 return ieee80211_wx_set_encode(priv->ieee, info, wrqu, key);
5809} 5809}
5810 5810
5811static int ipw_wx_get_encode(struct net_device *dev, 5811static int ipw_wx_get_encode(struct net_device *dev,
5812 struct iw_request_info *info, 5812 struct iw_request_info *info,
5813 union iwreq_data *wrqu, char *key) 5813 union iwreq_data *wrqu, char *key)
5814{ 5814{
5815 struct ipw_priv *priv = ieee80211_priv(dev); 5815 struct ipw_priv *priv = ieee80211_priv(dev);
5816 return ieee80211_wx_get_encode(priv->ieee, info, wrqu, key); 5816 return ieee80211_wx_get_encode(priv->ieee, info, wrqu, key);
5817} 5817}
5818 5818
5819static int ipw_wx_set_power(struct net_device *dev, 5819static int ipw_wx_set_power(struct net_device *dev,
5820 struct iw_request_info *info, 5820 struct iw_request_info *info,
5821 union iwreq_data *wrqu, char *extra) 5821 union iwreq_data *wrqu, char *extra)
5822{ 5822{
5823 struct ipw_priv *priv = ieee80211_priv(dev); 5823 struct ipw_priv *priv = ieee80211_priv(dev);
@@ -5834,7 +5834,7 @@ static int ipw_wx_set_power(struct net_device *dev,
5834 IPW_DEBUG_WX("SET Power Management Mode -> off\n"); 5834 IPW_DEBUG_WX("SET Power Management Mode -> off\n");
5835 5835
5836 return 0; 5836 return 0;
5837 } 5837 }
5838 5838
5839 switch (wrqu->power.flags & IW_POWER_MODE) { 5839 switch (wrqu->power.flags & IW_POWER_MODE) {
5840 case IW_POWER_ON: /* If not specified */ 5840 case IW_POWER_ON: /* If not specified */
@@ -5844,14 +5844,14 @@ static int ipw_wx_set_power(struct net_device *dev,
5844 default: /* Otherwise we don't support it */ 5844 default: /* Otherwise we don't support it */
5845 IPW_DEBUG_WX("SET PM Mode: %X not supported.\n", 5845 IPW_DEBUG_WX("SET PM Mode: %X not supported.\n",
5846 wrqu->power.flags); 5846 wrqu->power.flags);
5847 return -EOPNOTSUPP; 5847 return -EOPNOTSUPP;
5848 } 5848 }
5849 5849
5850 /* If the user hasn't specified a power management mode yet, default 5850 /* If the user hasn't specified a power management mode yet, default
5851 * to BATTERY */ 5851 * to BATTERY */
5852 if (IPW_POWER_LEVEL(priv->power_mode) == IPW_POWER_AC) 5852 if (IPW_POWER_LEVEL(priv->power_mode) == IPW_POWER_AC)
5853 priv->power_mode = IPW_POWER_ENABLED | IPW_POWER_BATTERY; 5853 priv->power_mode = IPW_POWER_ENABLED | IPW_POWER_BATTERY;
5854 else 5854 else
5855 priv->power_mode = IPW_POWER_ENABLED | priv->power_mode; 5855 priv->power_mode = IPW_POWER_ENABLED | priv->power_mode;
5856 err = ipw_send_power_mode(priv, IPW_POWER_LEVEL(priv->power_mode)); 5856 err = ipw_send_power_mode(priv, IPW_POWER_LEVEL(priv->power_mode));
5857 if (err) { 5857 if (err) {
@@ -5861,12 +5861,12 @@ static int ipw_wx_set_power(struct net_device *dev,
5861 5861
5862 IPW_DEBUG_WX("SET Power Management Mode -> 0x%02X\n", 5862 IPW_DEBUG_WX("SET Power Management Mode -> 0x%02X\n",
5863 priv->power_mode); 5863 priv->power_mode);
5864 5864
5865 return 0; 5865 return 0;
5866} 5866}
5867 5867
5868static int ipw_wx_get_power(struct net_device *dev, 5868static int ipw_wx_get_power(struct net_device *dev,
5869 struct iw_request_info *info, 5869 struct iw_request_info *info,
5870 union iwreq_data *wrqu, char *extra) 5870 union iwreq_data *wrqu, char *extra)
5871{ 5871{
5872 struct ipw_priv *priv = ieee80211_priv(dev); 5872 struct ipw_priv *priv = ieee80211_priv(dev);
@@ -5878,40 +5878,40 @@ static int ipw_wx_get_power(struct net_device *dev,
5878 } 5878 }
5879 5879
5880 IPW_DEBUG_WX("GET Power Management Mode -> %02X\n", priv->power_mode); 5880 IPW_DEBUG_WX("GET Power Management Mode -> %02X\n", priv->power_mode);
5881 5881
5882 return 0; 5882 return 0;
5883} 5883}
5884 5884
5885static int ipw_wx_set_powermode(struct net_device *dev, 5885static int ipw_wx_set_powermode(struct net_device *dev,
5886 struct iw_request_info *info, 5886 struct iw_request_info *info,
5887 union iwreq_data *wrqu, char *extra) 5887 union iwreq_data *wrqu, char *extra)
5888{ 5888{
5889 struct ipw_priv *priv = ieee80211_priv(dev); 5889 struct ipw_priv *priv = ieee80211_priv(dev);
5890 int mode = *(int *)extra; 5890 int mode = *(int *)extra;
5891 int err; 5891 int err;
5892 5892
5893 if ((mode < 1) || (mode > IPW_POWER_LIMIT)) { 5893 if ((mode < 1) || (mode > IPW_POWER_LIMIT)) {
5894 mode = IPW_POWER_AC; 5894 mode = IPW_POWER_AC;
5895 priv->power_mode = mode; 5895 priv->power_mode = mode;
5896 } else { 5896 } else {
5897 priv->power_mode = IPW_POWER_ENABLED | mode; 5897 priv->power_mode = IPW_POWER_ENABLED | mode;
5898 } 5898 }
5899 5899
5900 if (priv->power_mode != mode) { 5900 if (priv->power_mode != mode) {
5901 err = ipw_send_power_mode(priv, mode); 5901 err = ipw_send_power_mode(priv, mode);
5902 5902
5903 if (err) { 5903 if (err) {
5904 IPW_DEBUG_WX("failed setting power mode.\n"); 5904 IPW_DEBUG_WX("failed setting power mode.\n");
5905 return err; 5905 return err;
5906 } 5906 }
5907 } 5907 }
5908 5908
5909 return 0; 5909 return 0;
5910} 5910}
5911 5911
5912#define MAX_WX_STRING 80 5912#define MAX_WX_STRING 80
5913static int ipw_wx_get_powermode(struct net_device *dev, 5913static int ipw_wx_get_powermode(struct net_device *dev,
5914 struct iw_request_info *info, 5914 struct iw_request_info *info,
5915 union iwreq_data *wrqu, char *extra) 5915 union iwreq_data *wrqu, char *extra)
5916{ 5916{
5917 struct ipw_priv *priv = ieee80211_priv(dev); 5917 struct ipw_priv *priv = ieee80211_priv(dev);
@@ -5929,7 +5929,7 @@ static int ipw_wx_get_powermode(struct net_device *dev,
5929 break; 5929 break;
5930 default: 5930 default:
5931 p += snprintf(p, MAX_WX_STRING - (p - extra), 5931 p += snprintf(p, MAX_WX_STRING - (p - extra),
5932 "(Timeout %dms, Period %dms)", 5932 "(Timeout %dms, Period %dms)",
5933 timeout_duration[level - 1] / 1000, 5933 timeout_duration[level - 1] / 1000,
5934 period_duration[level - 1] / 1000); 5934 period_duration[level - 1] / 1000);
5935 } 5935 }
@@ -5955,7 +5955,7 @@ static int ipw_wx_set_wireless_mode(struct net_device *dev,
5955 mode); 5955 mode);
5956 return -EINVAL; 5956 return -EINVAL;
5957 } 5957 }
5958 5958
5959 if (priv->adapter == IPW_2915ABG) { 5959 if (priv->adapter == IPW_2915ABG) {
5960 priv->ieee->abg_ture = 1; 5960 priv->ieee->abg_ture = 1;
5961 if (mode & IEEE_A) { 5961 if (mode & IEEE_A) {
@@ -5978,7 +5978,7 @@ static int ipw_wx_set_wireless_mode(struct net_device *dev,
5978 modulation |= IEEE80211_CCK_MODULATION; 5978 modulation |= IEEE80211_CCK_MODULATION;
5979 } else 5979 } else
5980 priv->ieee->abg_ture = 0; 5980 priv->ieee->abg_ture = 0;
5981 5981
5982 if (mode & IEEE_G) { 5982 if (mode & IEEE_G) {
5983 band |= IEEE80211_24GHZ_BAND; 5983 band |= IEEE80211_24GHZ_BAND;
5984 modulation |= IEEE80211_OFDM_MODULATION; 5984 modulation |= IEEE80211_OFDM_MODULATION;
@@ -5991,17 +5991,17 @@ static int ipw_wx_set_wireless_mode(struct net_device *dev,
5991 init_supported_rates(priv, &priv->rates); 5991 init_supported_rates(priv, &priv->rates);
5992 5992
5993 /* If we are currently associated, or trying to associate 5993 /* If we are currently associated, or trying to associate
5994 * then see if this is a new configuration (causing us to 5994 * then see if this is a new configuration (causing us to
5995 * disassociate) */ 5995 * disassociate) */
5996 if (priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { 5996 if (priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) {
5997 /* The resulting association will trigger 5997 /* The resulting association will trigger
5998 * the new rates to be sent to the device */ 5998 * the new rates to be sent to the device */
5999 IPW_DEBUG_ASSOC("Disassociating due to mode change.\n"); 5999 IPW_DEBUG_ASSOC("Disassociating due to mode change.\n");
6000 ipw_disassociate(priv); 6000 ipw_disassociate(priv);
6001 } else 6001 } else
6002 ipw_send_supported_rates(priv, &priv->rates); 6002 ipw_send_supported_rates(priv, &priv->rates);
6003 6003
6004 IPW_DEBUG_WX("PRIV SET MODE: %c%c%c\n", 6004 IPW_DEBUG_WX("PRIV SET MODE: %c%c%c\n",
6005 mode & IEEE_A ? 'a' : '.', 6005 mode & IEEE_A ? 'a' : '.',
6006 mode & IEEE_B ? 'b' : '.', 6006 mode & IEEE_B ? 'b' : '.',
6007 mode & IEEE_G ? 'g' : '.'); 6007 mode & IEEE_G ? 'g' : '.');
@@ -6020,7 +6020,7 @@ static int ipw_wx_get_wireless_mode(struct net_device *dev,
6020 case IEEE80211_CCK_MODULATION: 6020 case IEEE80211_CCK_MODULATION:
6021 strncpy(extra, "802.11b (2)", MAX_WX_STRING); 6021 strncpy(extra, "802.11b (2)", MAX_WX_STRING);
6022 break; 6022 break;
6023 case IEEE80211_OFDM_MODULATION: 6023 case IEEE80211_OFDM_MODULATION:
6024 strncpy(extra, "802.11g (4)", MAX_WX_STRING); 6024 strncpy(extra, "802.11g (4)", MAX_WX_STRING);
6025 break; 6025 break;
6026 default: 6026 default:
@@ -6029,7 +6029,7 @@ static int ipw_wx_get_wireless_mode(struct net_device *dev,
6029 } 6029 }
6030 break; 6030 break;
6031 6031
6032 case IEEE80211_52GHZ_BAND: 6032 case IEEE80211_52GHZ_BAND:
6033 strncpy(extra, "802.11a (1)", MAX_WX_STRING); 6033 strncpy(extra, "802.11a (1)", MAX_WX_STRING);
6034 break; 6034 break;
6035 6035
@@ -6038,7 +6038,7 @@ static int ipw_wx_get_wireless_mode(struct net_device *dev,
6038 case IEEE80211_CCK_MODULATION: 6038 case IEEE80211_CCK_MODULATION:
6039 strncpy(extra, "802.11ab (3)", MAX_WX_STRING); 6039 strncpy(extra, "802.11ab (3)", MAX_WX_STRING);
6040 break; 6040 break;
6041 case IEEE80211_OFDM_MODULATION: 6041 case IEEE80211_OFDM_MODULATION:
6042 strncpy(extra, "802.11ag (5)", MAX_WX_STRING); 6042 strncpy(extra, "802.11ag (5)", MAX_WX_STRING);
6043 break; 6043 break;
6044 default: 6044 default:
@@ -6046,8 +6046,8 @@ static int ipw_wx_get_wireless_mode(struct net_device *dev,
6046 break; 6046 break;
6047 } 6047 }
6048 break; 6048 break;
6049 } 6049 }
6050 6050
6051 IPW_DEBUG_WX("PRIV GET MODE: %s\n", extra); 6051 IPW_DEBUG_WX("PRIV GET MODE: %s\n", extra);
6052 6052
6053 wrqu->data.length = strlen(extra) + 1; 6053 wrqu->data.length = strlen(extra) + 1;
@@ -6056,10 +6056,10 @@ static int ipw_wx_get_wireless_mode(struct net_device *dev,
6056} 6056}
6057 6057
6058#ifdef CONFIG_IPW_PROMISC 6058#ifdef CONFIG_IPW_PROMISC
6059static int ipw_wx_set_promisc(struct net_device *dev, 6059static int ipw_wx_set_promisc(struct net_device *dev,
6060 struct iw_request_info *info, 6060 struct iw_request_info *info,
6061 union iwreq_data *wrqu, char *extra) 6061 union iwreq_data *wrqu, char *extra)
6062{ 6062{
6063 struct ipw_priv *priv = ieee80211_priv(dev); 6063 struct ipw_priv *priv = ieee80211_priv(dev);
6064 int *parms = (int *)extra; 6064 int *parms = (int *)extra;
6065 int enable = (parms[0] > 0); 6065 int enable = (parms[0] > 0);
@@ -6070,7 +6070,7 @@ static int ipw_wx_set_promisc(struct net_device *dev,
6070 priv->net_dev->type = ARPHRD_IEEE80211; 6070 priv->net_dev->type = ARPHRD_IEEE80211;
6071 ipw_adapter_restart(priv); 6071 ipw_adapter_restart(priv);
6072 } 6072 }
6073 6073
6074 ipw_set_channel(priv, parms[1]); 6074 ipw_set_channel(priv, parms[1]);
6075 } else { 6075 } else {
6076 if (priv->ieee->iw_mode != IW_MODE_MONITOR) 6076 if (priv->ieee->iw_mode != IW_MODE_MONITOR)
@@ -6082,10 +6082,10 @@ static int ipw_wx_set_promisc(struct net_device *dev,
6082} 6082}
6083 6083
6084 6084
6085static int ipw_wx_reset(struct net_device *dev, 6085static int ipw_wx_reset(struct net_device *dev,
6086 struct iw_request_info *info, 6086 struct iw_request_info *info,
6087 union iwreq_data *wrqu, char *extra) 6087 union iwreq_data *wrqu, char *extra)
6088{ 6088{
6089 struct ipw_priv *priv = ieee80211_priv(dev); 6089 struct ipw_priv *priv = ieee80211_priv(dev);
6090 IPW_DEBUG_WX("RESET\n"); 6090 IPW_DEBUG_WX("RESET\n");
6091 ipw_adapter_restart(priv); 6091 ipw_adapter_restart(priv);
@@ -6135,35 +6135,35 @@ static iw_handler ipw_wx_handlers[] =
6135#define IPW_PRIV_RESET SIOCIWFIRSTPRIV+5 6135#define IPW_PRIV_RESET SIOCIWFIRSTPRIV+5
6136 6136
6137 6137
6138static struct iw_priv_args ipw_priv_args[] = { 6138static struct iw_priv_args ipw_priv_args[] = {
6139 { 6139 {
6140 .cmd = IPW_PRIV_SET_POWER, 6140 .cmd = IPW_PRIV_SET_POWER,
6141 .set_args = IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 6141 .set_args = IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
6142 .name = "set_power" 6142 .name = "set_power"
6143 }, 6143 },
6144 { 6144 {
6145 .cmd = IPW_PRIV_GET_POWER, 6145 .cmd = IPW_PRIV_GET_POWER,
6146 .get_args = IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | MAX_WX_STRING, 6146 .get_args = IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | MAX_WX_STRING,
6147 .name = "get_power" 6147 .name = "get_power"
6148 }, 6148 },
6149 { 6149 {
6150 .cmd = IPW_PRIV_SET_MODE, 6150 .cmd = IPW_PRIV_SET_MODE,
6151 .set_args = IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 6151 .set_args = IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
6152 .name = "set_mode" 6152 .name = "set_mode"
6153 }, 6153 },
6154 { 6154 {
6155 .cmd = IPW_PRIV_GET_MODE, 6155 .cmd = IPW_PRIV_GET_MODE,
6156 .get_args = IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | MAX_WX_STRING, 6156 .get_args = IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | MAX_WX_STRING,
6157 .name = "get_mode" 6157 .name = "get_mode"
6158 }, 6158 },
6159#ifdef CONFIG_IPW_PROMISC 6159#ifdef CONFIG_IPW_PROMISC
6160 { 6160 {
6161 IPW_PRIV_SET_PROMISC, 6161 IPW_PRIV_SET_PROMISC,
6162 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, 0, "monitor" 6162 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, 0, "monitor"
6163 }, 6163 },
6164 { 6164 {
6165 IPW_PRIV_RESET, 6165 IPW_PRIV_RESET,
6166 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 0, 0, "reset" 6166 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 0, 0, "reset"
6167 }, 6167 },
6168#endif /* CONFIG_IPW_PROMISC */ 6168#endif /* CONFIG_IPW_PROMISC */
6169}; 6169};
@@ -6175,18 +6175,18 @@ static iw_handler ipw_priv_handler[] = {
6175 ipw_wx_get_wireless_mode, 6175 ipw_wx_get_wireless_mode,
6176#ifdef CONFIG_IPW_PROMISC 6176#ifdef CONFIG_IPW_PROMISC
6177 ipw_wx_set_promisc, 6177 ipw_wx_set_promisc,
6178 ipw_wx_reset, 6178 ipw_wx_reset,
6179#endif 6179#endif
6180}; 6180};
6181 6181
6182static struct iw_handler_def ipw_wx_handler_def = 6182static struct iw_handler_def ipw_wx_handler_def =
6183{ 6183{
6184 .standard = ipw_wx_handlers, 6184 .standard = ipw_wx_handlers,
6185 .num_standard = ARRAY_SIZE(ipw_wx_handlers), 6185 .num_standard = ARRAY_SIZE(ipw_wx_handlers),
6186 .num_private = ARRAY_SIZE(ipw_priv_handler), 6186 .num_private = ARRAY_SIZE(ipw_priv_handler),
6187 .num_private_args = ARRAY_SIZE(ipw_priv_args), 6187 .num_private_args = ARRAY_SIZE(ipw_priv_args),
6188 .private = ipw_priv_handler, 6188 .private = ipw_priv_handler,
6189 .private_args = ipw_priv_args, 6189 .private_args = ipw_priv_args,
6190}; 6190};
6191 6191
6192 6192
@@ -6201,11 +6201,11 @@ static struct iw_statistics *ipw_get_wireless_stats(struct net_device * dev)
6201{ 6201{
6202 struct ipw_priv *priv = ieee80211_priv(dev); 6202 struct ipw_priv *priv = ieee80211_priv(dev);
6203 struct iw_statistics *wstats; 6203 struct iw_statistics *wstats;
6204 6204
6205 wstats = &priv->wstats; 6205 wstats = &priv->wstats;
6206 6206
6207 /* if hw is disabled, then ipw2100_get_ordinal() can't be called. 6207 /* if hw is disabled, then ipw2100_get_ordinal() can't be called.
6208 * ipw2100_wx_wireless_stats seems to be called before fw is 6208 * ipw2100_wx_wireless_stats seems to be called before fw is
6209 * initialized. STATUS_ASSOCIATED will only be set if the hw is up 6209 * initialized. STATUS_ASSOCIATED will only be set if the hw is up
6210 * and associated; if not associcated, the values are all meaningless 6210 * and associated; if not associcated, the values are all meaningless
6211 * anyway, so set them all to NULL and INVALID */ 6211 * anyway, so set them all to NULL and INVALID */
@@ -6219,7 +6219,7 @@ static struct iw_statistics *ipw_get_wireless_stats(struct net_device * dev)
6219 wstats->qual.updated |= IW_QUAL_NOISE_INVALID | 6219 wstats->qual.updated |= IW_QUAL_NOISE_INVALID |
6220 IW_QUAL_QUAL_INVALID | IW_QUAL_LEVEL_INVALID; 6220 IW_QUAL_QUAL_INVALID | IW_QUAL_LEVEL_INVALID;
6221 return wstats; 6221 return wstats;
6222 } 6222 }
6223 6223
6224 wstats->qual.qual = priv->quality; 6224 wstats->qual.qual = priv->quality;
6225 wstats->qual.level = average_value(&priv->average_rssi); 6225 wstats->qual.level = average_value(&priv->average_rssi);
@@ -6230,11 +6230,11 @@ static struct iw_statistics *ipw_get_wireless_stats(struct net_device * dev)
6230 wstats->miss.beacon = average_value(&priv->average_missed_beacons); 6230 wstats->miss.beacon = average_value(&priv->average_missed_beacons);
6231 wstats->discard.retries = priv->last_tx_failures; 6231 wstats->discard.retries = priv->last_tx_failures;
6232 wstats->discard.code = priv->ieee->ieee_stats.rx_discards_undecryptable; 6232 wstats->discard.code = priv->ieee->ieee_stats.rx_discards_undecryptable;
6233 6233
6234/* if (ipw_get_ordinal(priv, IPW_ORD_STAT_TX_RETRY, &tx_retry, &len)) 6234/* if (ipw_get_ordinal(priv, IPW_ORD_STAT_TX_RETRY, &tx_retry, &len))
6235 goto fail_get_ordinal; 6235 goto fail_get_ordinal;
6236 wstats->discard.retries += tx_retry; */ 6236 wstats->discard.retries += tx_retry; */
6237 6237
6238 return wstats; 6238 return wstats;
6239} 6239}
6240 6240
@@ -6255,7 +6255,7 @@ static inline void init_sys_config(struct ipw_sys_config *sys_config)
6255 sys_config->antenna_diversity = CFG_SYS_ANTENNA_BOTH; 6255 sys_config->antenna_diversity = CFG_SYS_ANTENNA_BOTH;
6256 sys_config->pass_crc_to_host = 0; /* TODO: See if 1 gives us FCS */ 6256 sys_config->pass_crc_to_host = 0; /* TODO: See if 1 gives us FCS */
6257 sys_config->dot11g_auto_detection = 0; 6257 sys_config->dot11g_auto_detection = 0;
6258 sys_config->enable_cts_to_self = 0; 6258 sys_config->enable_cts_to_self = 0;
6259 sys_config->bt_coexist_collision_thr = 0; 6259 sys_config->bt_coexist_collision_thr = 0;
6260 sys_config->pass_noise_stats_to_host = 1; 6260 sys_config->pass_noise_stats_to_host = 1;
6261} 6261}
@@ -6265,8 +6265,8 @@ static int ipw_net_open(struct net_device *dev)
6265 struct ipw_priv *priv = ieee80211_priv(dev); 6265 struct ipw_priv *priv = ieee80211_priv(dev);
6266 IPW_DEBUG_INFO("dev->open\n"); 6266 IPW_DEBUG_INFO("dev->open\n");
6267 /* we should be verifying the device is ready to be opened */ 6267 /* we should be verifying the device is ready to be opened */
6268 if (!(priv->status & STATUS_RF_KILL_MASK) && 6268 if (!(priv->status & STATUS_RF_KILL_MASK) &&
6269 (priv->status & STATUS_ASSOCIATED)) 6269 (priv->status & STATUS_ASSOCIATED))
6270 netif_start_queue(dev); 6270 netif_start_queue(dev);
6271 return 0; 6271 return 0;
6272} 6272}
@@ -6306,7 +6306,7 @@ static inline void ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb)
6306 id = ipw_add_station(priv, hdr->addr1); 6306 id = ipw_add_station(priv, hdr->addr1);
6307 if (id == IPW_INVALID_STATION) { 6307 if (id == IPW_INVALID_STATION) {
6308 IPW_WARNING("Attempt to send data to " 6308 IPW_WARNING("Attempt to send data to "
6309 "invalid cell: " MAC_FMT "\n", 6309 "invalid cell: " MAC_FMT "\n",
6310 MAC_ARG(hdr->addr1)); 6310 MAC_ARG(hdr->addr1));
6311 goto drop; 6311 goto drop;
6312 } 6312 }
@@ -6337,7 +6337,7 @@ static inline void ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb)
6337 tfd->u.data.tx_flags = DCT_FLAG_NO_WEP; 6337 tfd->u.data.tx_flags = DCT_FLAG_NO_WEP;
6338 else 6338 else
6339 tfd->u.data.tx_flags = DCT_FLAG_NO_WEP | DCT_FLAG_ACK_REQD; 6339 tfd->u.data.tx_flags = DCT_FLAG_NO_WEP | DCT_FLAG_ACK_REQD;
6340 6340
6341 if (priv->assoc_request.ieee_mode == IPW_B_MODE) 6341 if (priv->assoc_request.ieee_mode == IPW_B_MODE)
6342 tfd->u.data.tx_flags_ext = DCT_FLAG_EXT_MODE_CCK; 6342 tfd->u.data.tx_flags_ext = DCT_FLAG_EXT_MODE_CCK;
6343 else 6343 else
@@ -6351,10 +6351,10 @@ static inline void ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb)
6351 /* payload */ 6351 /* payload */
6352 tfd->u.data.num_chunks = min((u8)(NUM_TFD_CHUNKS - 2), txb->nr_frags); 6352 tfd->u.data.num_chunks = min((u8)(NUM_TFD_CHUNKS - 2), txb->nr_frags);
6353 for (i = 0; i < tfd->u.data.num_chunks; i++) { 6353 for (i = 0; i < tfd->u.data.num_chunks; i++) {
6354 IPW_DEBUG_TX("Dumping TX packet frag %i of %i (%d bytes):\n", 6354 IPW_DEBUG_TX("Dumping TX packet frag %i of %i (%d bytes):\n",
6355 i, tfd->u.data.num_chunks, 6355 i, tfd->u.data.num_chunks,
6356 txb->fragments[i]->len - hdr_len); 6356 txb->fragments[i]->len - hdr_len);
6357 printk_buf(IPW_DL_TX, txb->fragments[i]->data + hdr_len, 6357 printk_buf(IPW_DL_TX, txb->fragments[i]->data + hdr_len,
6358 txb->fragments[i]->len - hdr_len); 6358 txb->fragments[i]->len - hdr_len);
6359 6359
6360 tfd->u.data.chunk_ptr[i] = pci_map_single( 6360 tfd->u.data.chunk_ptr[i] = pci_map_single(
@@ -6390,14 +6390,14 @@ static inline void ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb)
6390 priv->pci_dev, skb->data, 6390 priv->pci_dev, skb->data,
6391 tfd->u.data.chunk_len[i], PCI_DMA_TODEVICE); 6391 tfd->u.data.chunk_len[i], PCI_DMA_TODEVICE);
6392 tfd->u.data.num_chunks++; 6392 tfd->u.data.num_chunks++;
6393 } 6393 }
6394 } 6394 }
6395 6395
6396 /* kick DMA */ 6396 /* kick DMA */
6397 q->first_empty = ipw_queue_inc_wrap(q->first_empty, q->n_bd); 6397 q->first_empty = ipw_queue_inc_wrap(q->first_empty, q->n_bd);
6398 ipw_write32(priv, q->reg_w, q->first_empty); 6398 ipw_write32(priv, q->reg_w, q->first_empty);
6399 6399
6400 if (ipw_queue_space(q) < q->high_mark) 6400 if (ipw_queue_space(q) < q->high_mark)
6401 netif_stop_queue(priv->net_dev); 6401 netif_stop_queue(priv->net_dev);
6402 6402
6403 return; 6403 return;
@@ -6437,7 +6437,7 @@ static int ipw_net_hard_start_xmit(struct ieee80211_txb *txb,
6437static struct net_device_stats *ipw_net_get_stats(struct net_device *dev) 6437static struct net_device_stats *ipw_net_get_stats(struct net_device *dev)
6438{ 6438{
6439 struct ipw_priv *priv = ieee80211_priv(dev); 6439 struct ipw_priv *priv = ieee80211_priv(dev);
6440 6440
6441 priv->ieee->stats.tx_packets = priv->tx_packets; 6441 priv->ieee->stats.tx_packets = priv->tx_packets;
6442 priv->ieee->stats.rx_packets = priv->rx_packets; 6442 priv->ieee->stats.rx_packets = priv->rx_packets;
6443 return &priv->ieee->stats; 6443 return &priv->ieee->stats;
@@ -6462,7 +6462,7 @@ static int ipw_net_set_mac_address(struct net_device *dev, void *p)
6462 return 0; 6462 return 0;
6463} 6463}
6464 6464
6465static void ipw_ethtool_get_drvinfo(struct net_device *dev, 6465static void ipw_ethtool_get_drvinfo(struct net_device *dev,
6466 struct ethtool_drvinfo *info) 6466 struct ethtool_drvinfo *info)
6467{ 6467{
6468 struct ipw_priv *p = ieee80211_priv(dev); 6468 struct ipw_priv *p = ieee80211_priv(dev);
@@ -6478,7 +6478,7 @@ static void ipw_ethtool_get_drvinfo(struct net_device *dev,
6478 len = sizeof(date); 6478 len = sizeof(date);
6479 ipw_get_ordinal(p, IPW_ORD_STAT_FW_DATE, date, &len); 6479 ipw_get_ordinal(p, IPW_ORD_STAT_FW_DATE, date, &len);
6480 6480
6481 snprintf(info->fw_version, sizeof(info->fw_version),"%s (%s)", 6481 snprintf(info->fw_version, sizeof(info->fw_version),"%s (%s)",
6482 vers, date); 6482 vers, date);
6483 strcpy(info->bus_info, pci_name(p->pci_dev)); 6483 strcpy(info->bus_info, pci_name(p->pci_dev));
6484 info->eedump_len = CX2_EEPROM_IMAGE_SIZE; 6484 info->eedump_len = CX2_EEPROM_IMAGE_SIZE;
@@ -6502,7 +6502,7 @@ static int ipw_ethtool_get_eeprom(struct net_device *dev,
6502 6502
6503 if (eeprom->offset + eeprom->len > CX2_EEPROM_IMAGE_SIZE) 6503 if (eeprom->offset + eeprom->len > CX2_EEPROM_IMAGE_SIZE)
6504 return -EINVAL; 6504 return -EINVAL;
6505 6505
6506 memcpy(bytes, &((u8 *)p->eeprom)[eeprom->offset], eeprom->len); 6506 memcpy(bytes, &((u8 *)p->eeprom)[eeprom->offset], eeprom->len);
6507 return 0; 6507 return 0;
6508} 6508}
@@ -6517,8 +6517,8 @@ static int ipw_ethtool_set_eeprom(struct net_device *dev,
6517 return -EINVAL; 6517 return -EINVAL;
6518 6518
6519 memcpy(&((u8 *)p->eeprom)[eeprom->offset], bytes, eeprom->len); 6519 memcpy(&((u8 *)p->eeprom)[eeprom->offset], bytes, eeprom->len);
6520 for (i = IPW_EEPROM_DATA; 6520 for (i = IPW_EEPROM_DATA;
6521 i < IPW_EEPROM_DATA + CX2_EEPROM_IMAGE_SIZE; 6521 i < IPW_EEPROM_DATA + CX2_EEPROM_IMAGE_SIZE;
6522 i++) 6522 i++)
6523 ipw_write8(p, i, p->eeprom[i]); 6523 ipw_write8(p, i, p->eeprom[i]);
6524 6524
@@ -6537,7 +6537,7 @@ static irqreturn_t ipw_isr(int irq, void *data, struct pt_regs *regs)
6537{ 6537{
6538 struct ipw_priv *priv = data; 6538 struct ipw_priv *priv = data;
6539 u32 inta, inta_mask; 6539 u32 inta, inta_mask;
6540 6540
6541 if (!priv) 6541 if (!priv)
6542 return IRQ_NONE; 6542 return IRQ_NONE;
6543 6543
@@ -6550,7 +6550,7 @@ static irqreturn_t ipw_isr(int irq, void *data, struct pt_regs *regs)
6550 6550
6551 inta = ipw_read32(priv, CX2_INTA_RW); 6551 inta = ipw_read32(priv, CX2_INTA_RW);
6552 inta_mask = ipw_read32(priv, CX2_INTA_MASK_R); 6552 inta_mask = ipw_read32(priv, CX2_INTA_MASK_R);
6553 6553
6554 if (inta == 0xFFFFFFFF) { 6554 if (inta == 0xFFFFFFFF) {
6555 /* Hardware disappeared */ 6555 /* Hardware disappeared */
6556 IPW_WARNING("IRQ INTA == 0xFFFFFFFF\n"); 6556 IPW_WARNING("IRQ INTA == 0xFFFFFFFF\n");
@@ -6564,11 +6564,11 @@ static irqreturn_t ipw_isr(int irq, void *data, struct pt_regs *regs)
6564 6564
6565 /* tell the device to stop sending interrupts */ 6565 /* tell the device to stop sending interrupts */
6566 ipw_disable_interrupts(priv); 6566 ipw_disable_interrupts(priv);
6567 6567
6568 /* ack current interrupts */ 6568 /* ack current interrupts */
6569 inta &= (CX2_INTA_MASK_ALL & inta_mask); 6569 inta &= (CX2_INTA_MASK_ALL & inta_mask);
6570 ipw_write32(priv, CX2_INTA_RW, inta); 6570 ipw_write32(priv, CX2_INTA_RW, inta);
6571 6571
6572 /* Cache INTA value for our tasklet */ 6572 /* Cache INTA value for our tasklet */
6573 priv->isr_inta = inta; 6573 priv->isr_inta = inta;
6574 6574
@@ -6586,7 +6586,7 @@ static void ipw_rf_kill(void *adapter)
6586{ 6586{
6587 struct ipw_priv *priv = adapter; 6587 struct ipw_priv *priv = adapter;
6588 unsigned long flags; 6588 unsigned long flags;
6589 6589
6590 spin_lock_irqsave(&priv->lock, flags); 6590 spin_lock_irqsave(&priv->lock, flags);
6591 6591
6592 if (rf_kill_active(priv)) { 6592 if (rf_kill_active(priv)) {
@@ -6605,7 +6605,7 @@ static void ipw_rf_kill(void *adapter)
6605 6605
6606 /* we can not do an adapter restart while inside an irq lock */ 6606 /* we can not do an adapter restart while inside an irq lock */
6607 queue_work(priv->workqueue, &priv->adapter_restart); 6607 queue_work(priv->workqueue, &priv->adapter_restart);
6608 } else 6608 } else
6609 IPW_DEBUG_RF_KILL("HW RF Kill deactivated. SW RF Kill still " 6609 IPW_DEBUG_RF_KILL("HW RF Kill deactivated. SW RF Kill still "
6610 "enabled\n"); 6610 "enabled\n");
6611 6611
@@ -6621,7 +6621,7 @@ static int ipw_setup_deferred_work(struct ipw_priv *priv)
6621 priv->workqueue = create_workqueue(DRV_NAME, 0); 6621 priv->workqueue = create_workqueue(DRV_NAME, 0);
6622#else 6622#else
6623 priv->workqueue = create_workqueue(DRV_NAME); 6623 priv->workqueue = create_workqueue(DRV_NAME);
6624#endif 6624#endif
6625 init_waitqueue_head(&priv->wait_command_queue); 6625 init_waitqueue_head(&priv->wait_command_queue);
6626 6626
6627 INIT_WORK(&priv->adhoc_check, ipw_adhoc_check, priv); 6627 INIT_WORK(&priv->adhoc_check, ipw_adhoc_check, priv);
@@ -6632,9 +6632,9 @@ static int ipw_setup_deferred_work(struct ipw_priv *priv)
6632 INIT_WORK(&priv->rf_kill, ipw_rf_kill, priv); 6632 INIT_WORK(&priv->rf_kill, ipw_rf_kill, priv);
6633 INIT_WORK(&priv->up, (void (*)(void *))ipw_up, priv); 6633 INIT_WORK(&priv->up, (void (*)(void *))ipw_up, priv);
6634 INIT_WORK(&priv->down, (void (*)(void *))ipw_down, priv); 6634 INIT_WORK(&priv->down, (void (*)(void *))ipw_down, priv);
6635 INIT_WORK(&priv->request_scan, 6635 INIT_WORK(&priv->request_scan,
6636 (void (*)(void *))ipw_request_scan, priv); 6636 (void (*)(void *))ipw_request_scan, priv);
6637 INIT_WORK(&priv->gather_stats, 6637 INIT_WORK(&priv->gather_stats,
6638 (void (*)(void *))ipw_gather_stats, priv); 6638 (void (*)(void *))ipw_gather_stats, priv);
6639 INIT_WORK(&priv->abort_scan, (void (*)(void *))ipw_abort_scan, priv); 6639 INIT_WORK(&priv->abort_scan, (void (*)(void *))ipw_abort_scan, priv);
6640 INIT_WORK(&priv->roam, ipw_roam, priv); 6640 INIT_WORK(&priv->roam, ipw_roam, priv);
@@ -6653,17 +6653,17 @@ static void shim__set_security(struct net_device *dev,
6653 struct ipw_priv *priv = ieee80211_priv(dev); 6653 struct ipw_priv *priv = ieee80211_priv(dev);
6654 int i; 6654 int i;
6655 6655
6656 for (i = 0; i < 4; i++) { 6656 for (i = 0; i < 4; i++) {
6657 if (sec->flags & (1 << i)) { 6657 if (sec->flags & (1 << i)) {
6658 priv->sec.key_sizes[i] = sec->key_sizes[i]; 6658 priv->sec.key_sizes[i] = sec->key_sizes[i];
6659 if (sec->key_sizes[i] == 0) 6659 if (sec->key_sizes[i] == 0)
6660 priv->sec.flags &= ~(1 << i); 6660 priv->sec.flags &= ~(1 << i);
6661 else 6661 else
6662 memcpy(priv->sec.keys[i], sec->keys[i], 6662 memcpy(priv->sec.keys[i], sec->keys[i],
6663 sec->key_sizes[i]); 6663 sec->key_sizes[i]);
6664 priv->sec.flags |= (1 << i); 6664 priv->sec.flags |= (1 << i);
6665 priv->status |= STATUS_SECURITY_UPDATED; 6665 priv->status |= STATUS_SECURITY_UPDATED;
6666 } 6666 }
6667 } 6667 }
6668 6668
6669 if ((sec->flags & SEC_ACTIVE_KEY) && 6669 if ((sec->flags & SEC_ACTIVE_KEY) &&
@@ -6671,7 +6671,7 @@ static void shim__set_security(struct net_device *dev,
6671 if (sec->active_key <= 3) { 6671 if (sec->active_key <= 3) {
6672 priv->sec.active_key = sec->active_key; 6672 priv->sec.active_key = sec->active_key;
6673 priv->sec.flags |= SEC_ACTIVE_KEY; 6673 priv->sec.flags |= SEC_ACTIVE_KEY;
6674 } else 6674 } else
6675 priv->sec.flags &= ~SEC_ACTIVE_KEY; 6675 priv->sec.flags &= ~SEC_ACTIVE_KEY;
6676 priv->status |= STATUS_SECURITY_UPDATED; 6676 priv->status |= STATUS_SECURITY_UPDATED;
6677 } 6677 }
@@ -6686,18 +6686,18 @@ static void shim__set_security(struct net_device *dev,
6686 priv->capability &= ~CAP_SHARED_KEY; 6686 priv->capability &= ~CAP_SHARED_KEY;
6687 priv->status |= STATUS_SECURITY_UPDATED; 6687 priv->status |= STATUS_SECURITY_UPDATED;
6688 } 6688 }
6689 6689
6690 if (sec->flags & SEC_ENABLED && 6690 if (sec->flags & SEC_ENABLED &&
6691 priv->sec.enabled != sec->enabled) { 6691 priv->sec.enabled != sec->enabled) {
6692 priv->sec.flags |= SEC_ENABLED; 6692 priv->sec.flags |= SEC_ENABLED;
6693 priv->sec.enabled = sec->enabled; 6693 priv->sec.enabled = sec->enabled;
6694 priv->status |= STATUS_SECURITY_UPDATED; 6694 priv->status |= STATUS_SECURITY_UPDATED;
6695 if (sec->enabled) 6695 if (sec->enabled)
6696 priv->capability |= CAP_PRIVACY_ON; 6696 priv->capability |= CAP_PRIVACY_ON;
6697 else 6697 else
6698 priv->capability &= ~CAP_PRIVACY_ON; 6698 priv->capability &= ~CAP_PRIVACY_ON;
6699 } 6699 }
6700 6700
6701 if (sec->flags & SEC_LEVEL && 6701 if (sec->flags & SEC_LEVEL &&
6702 priv->sec.level != sec->level) { 6702 priv->sec.level != sec->level) {
6703 priv->sec.level = sec->level; 6703 priv->sec.level = sec->level;
@@ -6705,14 +6705,14 @@ static void shim__set_security(struct net_device *dev,
6705 priv->status |= STATUS_SECURITY_UPDATED; 6705 priv->status |= STATUS_SECURITY_UPDATED;
6706 } 6706 }
6707 6707
6708 /* To match current functionality of ipw2100 (which works well w/ 6708 /* To match current functionality of ipw2100 (which works well w/
6709 * various supplicants, we don't force a disassociate if the 6709 * various supplicants, we don't force a disassociate if the
6710 * privacy capability changes ... */ 6710 * privacy capability changes ... */
6711#if 0 6711#if 0
6712 if ((priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) && 6712 if ((priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) &&
6713 (((priv->assoc_request.capability & 6713 (((priv->assoc_request.capability &
6714 WLAN_CAPABILITY_PRIVACY) && !sec->enabled) || 6714 WLAN_CAPABILITY_PRIVACY) && !sec->enabled) ||
6715 (!(priv->assoc_request.capability & 6715 (!(priv->assoc_request.capability &
6716 WLAN_CAPABILITY_PRIVACY) && sec->enabled))) { 6716 WLAN_CAPABILITY_PRIVACY) && sec->enabled))) {
6717 IPW_DEBUG_ASSOC("Disassociating due to capability " 6717 IPW_DEBUG_ASSOC("Disassociating due to capability "
6718 "change.\n"); 6718 "change.\n");
@@ -6721,7 +6721,7 @@ static void shim__set_security(struct net_device *dev,
6721#endif 6721#endif
6722} 6722}
6723 6723
6724static int init_supported_rates(struct ipw_priv *priv, 6724static int init_supported_rates(struct ipw_priv *priv,
6725 struct ipw_supported_rates *rates) 6725 struct ipw_supported_rates *rates)
6726{ 6726{
6727 /* TODO: Mask out rates based on priv->rates_mask */ 6727 /* TODO: Mask out rates based on priv->rates_mask */
@@ -6751,7 +6751,7 @@ static int init_supported_rates(struct ipw_priv *priv,
6751 return 0; 6751 return 0;
6752} 6752}
6753 6753
6754static int ipw_config(struct ipw_priv *priv) 6754static int ipw_config(struct ipw_priv *priv)
6755{ 6755{
6756 int i; 6756 int i;
6757 struct ipw_tx_power tx_power; 6757 struct ipw_tx_power tx_power;
@@ -6799,7 +6799,7 @@ static int ipw_config(struct ipw_priv *priv)
6799 6799
6800 if (ipw_set_random_seed(priv)) 6800 if (ipw_set_random_seed(priv))
6801 goto error; 6801 goto error;
6802 6802
6803 /* final state transition to the RUN state */ 6803 /* final state transition to the RUN state */
6804 if (ipw_send_host_complete(priv)) 6804 if (ipw_send_host_complete(priv))
6805 goto error; 6805 goto error;
@@ -6809,7 +6809,7 @@ static int ipw_config(struct ipw_priv *priv)
6809 goto error; 6809 goto error;
6810 6810
6811 return 0; 6811 return 0;
6812 6812
6813 error: 6813 error:
6814 return -EIO; 6814 return -EIO;
6815} 6815}
@@ -6823,7 +6823,7 @@ static int ipw_up(struct ipw_priv *priv)
6823 return -EIO; 6823 return -EIO;
6824 6824
6825 for (i = 0; i < MAX_HW_RESTARTS; i++ ) { 6825 for (i = 0; i < MAX_HW_RESTARTS; i++ ) {
6826 /* Load the microcode, firmware, and eeprom. 6826 /* Load the microcode, firmware, and eeprom.
6827 * Also start the clocks. */ 6827 * Also start the clocks. */
6828 rc = ipw_load(priv); 6828 rc = ipw_load(priv);
6829 if (rc) { 6829 if (rc) {
@@ -6850,7 +6850,7 @@ static int ipw_up(struct ipw_priv *priv)
6850 IPW_DEBUG_INFO("Device configuration failed: 0x%08X\n", 6850 IPW_DEBUG_INFO("Device configuration failed: 0x%08X\n",
6851 rc); 6851 rc);
6852 } 6852 }
6853 6853
6854 IPW_DEBUG_INFO("Failed to config device on retry %d of %d\n", 6854 IPW_DEBUG_INFO("Failed to config device on retry %d of %d\n",
6855 i, MAX_HW_RESTARTS); 6855 i, MAX_HW_RESTARTS);
6856 6856
@@ -6859,7 +6859,7 @@ static int ipw_up(struct ipw_priv *priv)
6859 ipw_down(priv); 6859 ipw_down(priv);
6860 } 6860 }
6861 6861
6862 /* tried to restart and config the device for as long as our 6862 /* tried to restart and config the device for as long as our
6863 * patience could withstand */ 6863 * patience could withstand */
6864 IPW_ERROR("Unable to initialize device after %d attempts.\n", 6864 IPW_ERROR("Unable to initialize device after %d attempts.\n",
6865 i); 6865 i);
@@ -6931,7 +6931,7 @@ static struct pci_device_id card_ids[] = {
6931 {PCI_VENDOR_ID_INTEL, 0x4221, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, /* 2225BG */ 6931 {PCI_VENDOR_ID_INTEL, 0x4221, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, /* 2225BG */
6932 {PCI_VENDOR_ID_INTEL, 0x4223, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, /* ABG */ 6932 {PCI_VENDOR_ID_INTEL, 0x4223, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, /* ABG */
6933 {PCI_VENDOR_ID_INTEL, 0x4224, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, /* ABG */ 6933 {PCI_VENDOR_ID_INTEL, 0x4224, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, /* ABG */
6934 6934
6935 /* required last entry */ 6935 /* required last entry */
6936 {0,} 6936 {0,}
6937}; 6937};
@@ -6994,7 +6994,7 @@ static int ipw_pci_probe(struct pci_dev *pdev,
6994 pci_set_master(pdev); 6994 pci_set_master(pdev);
6995 6995
6996 err = pci_set_dma_mask(pdev, DMA_32BIT_MASK); 6996 err = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
6997 if (!err) 6997 if (!err)
6998 err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); 6998 err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK);
6999 if (err) { 6999 if (err) {
7000 printk(KERN_WARNING DRV_NAME ": No suitable DMA available.\n"); 7000 printk(KERN_WARNING DRV_NAME ": No suitable DMA available.\n");
@@ -7004,18 +7004,18 @@ static int ipw_pci_probe(struct pci_dev *pdev,
7004 pci_set_drvdata(pdev, priv); 7004 pci_set_drvdata(pdev, priv);
7005 7005
7006 err = pci_request_regions(pdev, DRV_NAME); 7006 err = pci_request_regions(pdev, DRV_NAME);
7007 if (err) 7007 if (err)
7008 goto out_pci_disable_device; 7008 goto out_pci_disable_device;
7009 7009
7010 /* We disable the RETRY_TIMEOUT register (0x41) to keep 7010 /* We disable the RETRY_TIMEOUT register (0x41) to keep
7011 * PCI Tx retries from interfering with C3 CPU state */ 7011 * PCI Tx retries from interfering with C3 CPU state */
7012 pci_read_config_dword(pdev, 0x40, &val); 7012 pci_read_config_dword(pdev, 0x40, &val);
7013 if ((val & 0x0000ff00) != 0) 7013 if ((val & 0x0000ff00) != 0)
7014 pci_write_config_dword(pdev, 0x40, val & 0xffff00ff); 7014 pci_write_config_dword(pdev, 0x40, val & 0xffff00ff);
7015 7015
7016 length = pci_resource_len(pdev, 0); 7016 length = pci_resource_len(pdev, 0);
7017 priv->hw_len = length; 7017 priv->hw_len = length;
7018 7018
7019 base = ioremap_nocache(pci_resource_start(pdev, 0), length); 7019 base = ioremap_nocache(pci_resource_start(pdev, 0), length);
7020 if (!base) { 7020 if (!base) {
7021 err = -ENODEV; 7021 err = -ENODEV;
@@ -7036,16 +7036,16 @@ static int ipw_pci_probe(struct pci_dev *pdev,
7036 if (ifname) 7036 if (ifname)
7037 strncpy(net_dev->name, ifname, IFNAMSIZ); 7037 strncpy(net_dev->name, ifname, IFNAMSIZ);
7038 7038
7039 if (associate) 7039 if (associate)
7040 priv->config |= CFG_ASSOCIATE; 7040 priv->config |= CFG_ASSOCIATE;
7041 else 7041 else
7042 IPW_DEBUG_INFO("Auto associate disabled.\n"); 7042 IPW_DEBUG_INFO("Auto associate disabled.\n");
7043 7043
7044 if (auto_create) 7044 if (auto_create)
7045 priv->config |= CFG_ADHOC_CREATE; 7045 priv->config |= CFG_ADHOC_CREATE;
7046 else 7046 else
7047 IPW_DEBUG_INFO("Auto adhoc creation disabled.\n"); 7047 IPW_DEBUG_INFO("Auto adhoc creation disabled.\n");
7048 7048
7049 if (disable) { 7049 if (disable) {
7050 priv->status |= STATUS_RF_KILL_SW; 7050 priv->status |= STATUS_RF_KILL_SW;
7051 IPW_DEBUG_INFO("Radio disabled.\n"); 7051 IPW_DEBUG_INFO("Radio disabled.\n");
@@ -7063,7 +7063,7 @@ static int ipw_pci_probe(struct pci_dev *pdev,
7063 case 1: 7063 case 1:
7064 priv->ieee->iw_mode = IW_MODE_ADHOC; 7064 priv->ieee->iw_mode = IW_MODE_ADHOC;
7065 break; 7065 break;
7066#ifdef CONFIG_IPW_PROMISC 7066#ifdef CONFIG_IPW_PROMISC
7067 case 2: 7067 case 2:
7068 priv->ieee->iw_mode = IW_MODE_MONITOR; 7068 priv->ieee->iw_mode = IW_MODE_MONITOR;
7069 break; 7069 break;
@@ -7076,7 +7076,7 @@ static int ipw_pci_probe(struct pci_dev *pdev,
7076 7076
7077 if ((priv->pci_dev->device == 0x4223) || 7077 if ((priv->pci_dev->device == 0x4223) ||
7078 (priv->pci_dev->device == 0x4224)) { 7078 (priv->pci_dev->device == 0x4224)) {
7079 printk(KERN_INFO DRV_NAME 7079 printk(KERN_INFO DRV_NAME
7080 ": Detected Intel PRO/Wireless 2915ABG Network " 7080 ": Detected Intel PRO/Wireless 2915ABG Network "
7081 "Connection\n"); 7081 "Connection\n");
7082 priv->ieee->abg_ture = 1; 7082 priv->ieee->abg_ture = 1;
@@ -7086,15 +7086,15 @@ static int ipw_pci_probe(struct pci_dev *pdev,
7086 priv->adapter = IPW_2915ABG; 7086 priv->adapter = IPW_2915ABG;
7087 priv->ieee->mode = IEEE_A|IEEE_G|IEEE_B; 7087 priv->ieee->mode = IEEE_A|IEEE_G|IEEE_B;
7088 } else { 7088 } else {
7089 if (priv->pci_dev->device == 0x4221) 7089 if (priv->pci_dev->device == 0x4221)
7090 printk(KERN_INFO DRV_NAME 7090 printk(KERN_INFO DRV_NAME
7091 ": Detected Intel PRO/Wireless 2225BG Network " 7091 ": Detected Intel PRO/Wireless 2225BG Network "
7092 "Connection\n"); 7092 "Connection\n");
7093 else 7093 else
7094 printk(KERN_INFO DRV_NAME 7094 printk(KERN_INFO DRV_NAME
7095 ": Detected Intel PRO/Wireless 2200BG Network " 7095 ": Detected Intel PRO/Wireless 2200BG Network "
7096 "Connection\n"); 7096 "Connection\n");
7097 7097
7098 priv->ieee->abg_ture = 0; 7098 priv->ieee->abg_ture = 0;
7099 band = IEEE80211_24GHZ_BAND; 7099 band = IEEE80211_24GHZ_BAND;
7100 modulation = IEEE80211_OFDM_MODULATION | 7100 modulation = IEEE80211_OFDM_MODULATION |
@@ -7117,7 +7117,7 @@ static int ipw_pci_probe(struct pci_dev *pdev,
7117 priv->power_mode = IPW_POWER_AC; 7117 priv->power_mode = IPW_POWER_AC;
7118 priv->tx_power = IPW_DEFAULT_TX_POWER; 7118 priv->tx_power = IPW_DEFAULT_TX_POWER;
7119 7119
7120 err = request_irq(pdev->irq, ipw_isr, SA_SHIRQ, DRV_NAME, 7120 err = request_irq(pdev->irq, ipw_isr, SA_SHIRQ, DRV_NAME,
7121 priv); 7121 priv);
7122 if (err) { 7122 if (err) {
7123 IPW_ERROR("Error allocating IRQ %d\n", pdev->irq); 7123 IPW_ERROR("Error allocating IRQ %d\n", pdev->irq);
@@ -7200,7 +7200,7 @@ static void ipw_pci_remove(struct pci_dev *pdev)
7200 7200
7201 /* ipw_down will ensure that there is no more pending work 7201 /* ipw_down will ensure that there is no more pending work
7202 * in the workqueue's, so we can safely remove them now. */ 7202 * in the workqueue's, so we can safely remove them now. */
7203 if (priv->workqueue) { 7203 if (priv->workqueue) {
7204 cancel_delayed_work(&priv->adhoc_check); 7204 cancel_delayed_work(&priv->adhoc_check);
7205 cancel_delayed_work(&priv->gather_stats); 7205 cancel_delayed_work(&priv->gather_stats);
7206 cancel_delayed_work(&priv->request_scan); 7206 cancel_delayed_work(&priv->request_scan);
@@ -7249,7 +7249,7 @@ static int ipw_pci_suspend(struct pci_dev *pdev, u32 state)
7249#endif 7249#endif
7250 pci_disable_device(pdev); 7250 pci_disable_device(pdev);
7251 pci_set_power_state(pdev, state); 7251 pci_set_power_state(pdev, state);
7252 7252
7253 return 0; 7253 return 0;
7254} 7254}
7255 7255
@@ -7258,7 +7258,7 @@ static int ipw_pci_resume(struct pci_dev *pdev)
7258 struct ipw_priv *priv = pci_get_drvdata(pdev); 7258 struct ipw_priv *priv = pci_get_drvdata(pdev);
7259 struct net_device *dev = priv->net_dev; 7259 struct net_device *dev = priv->net_dev;
7260 u32 val; 7260 u32 val;
7261 7261
7262 printk(KERN_INFO "%s: Coming out of suspend...\n", dev->name); 7262 printk(KERN_INFO "%s: Coming out of suspend...\n", dev->name);
7263 7263
7264 pci_set_power_state(pdev, 0); 7264 pci_set_power_state(pdev, 0);
@@ -7274,8 +7274,8 @@ static int ipw_pci_resume(struct pci_dev *pdev)
7274 * from interfering with C3 CPU state. pci_restore_state won't help 7274 * from interfering with C3 CPU state. pci_restore_state won't help
7275 * here since it only restores the first 64 bytes pci config header. 7275 * here since it only restores the first 64 bytes pci config header.
7276 */ 7276 */
7277 pci_read_config_dword(pdev, 0x40, &val); 7277 pci_read_config_dword(pdev, 0x40, &val);
7278 if ((val & 0x0000ff00) != 0) 7278 if ((val & 0x0000ff00) != 0)
7279 pci_write_config_dword(pdev, 0x40, val & 0xffff00ff); 7279 pci_write_config_dword(pdev, 0x40, val & 0xffff00ff);
7280 7280
7281 /* Set the device back into the PRESENT state; this will also wake 7281 /* Set the device back into the PRESENT state; this will also wake
@@ -7284,7 +7284,7 @@ static int ipw_pci_resume(struct pci_dev *pdev)
7284 7284
7285 /* Bring the device back up */ 7285 /* Bring the device back up */
7286 queue_work(priv->workqueue, &priv->up); 7286 queue_work(priv->workqueue, &priv->up);
7287 7287
7288 return 0; 7288 return 0;
7289} 7289}
7290#endif 7290#endif
@@ -7314,7 +7314,7 @@ static int __init ipw_init(void)
7314 return ret; 7314 return ret;
7315 } 7315 }
7316 7316
7317 ret = driver_create_file(&ipw_driver.driver, 7317 ret = driver_create_file(&ipw_driver.driver,
7318 &driver_attr_debug_level); 7318 &driver_attr_debug_level);
7319 if (ret) { 7319 if (ret) {
7320 IPW_ERROR("Unable to create driver sysfs file\n"); 7320 IPW_ERROR("Unable to create driver sysfs file\n");
@@ -7344,12 +7344,12 @@ module_param(debug, int, 0444);
7344MODULE_PARM_DESC(debug, "debug output mask"); 7344MODULE_PARM_DESC(debug, "debug output mask");
7345 7345
7346module_param(channel, int, 0444); 7346module_param(channel, int, 0444);
7347MODULE_PARM_DESC(channel, "channel to limit associate to (default 0 [ANY])"); 7347MODULE_PARM_DESC(channel, "channel to limit associate to (default 0 [ANY])");
7348 7348
7349module_param(ifname, charp, 0444); 7349module_param(ifname, charp, 0444);
7350MODULE_PARM_DESC(ifname, "network device name (default eth%d)"); 7350MODULE_PARM_DESC(ifname, "network device name (default eth%d)");
7351 7351
7352#ifdef CONFIG_IPW_PROMISC 7352#ifdef CONFIG_IPW_PROMISC
7353module_param(mode, int, 0444); 7353module_param(mode, int, 0444);
7354MODULE_PARM_DESC(mode, "network mode (0=BSS,1=IBSS,2=Monitor)"); 7354MODULE_PARM_DESC(mode, "network mode (0=BSS,1=IBSS,2=Monitor)");
7355#else 7355#else
diff --git a/drivers/net/wireless/ipw2200.h b/drivers/net/wireless/ipw2200.h
index 4e8b75e7962a..78b5f444271d 100644
--- a/drivers/net/wireless/ipw2200.h
+++ b/drivers/net/wireless/ipw2200.h
@@ -1,23 +1,23 @@
1/****************************************************************************** 1/******************************************************************************
2 2
3 Copyright(c) 2003 - 2004 Intel Corporation. All rights reserved. 3 Copyright(c) 2003 - 2004 Intel Corporation. All rights reserved.
4 4
5 This program is free software; you can redistribute it and/or modify it 5 This program is free software; you can redistribute it and/or modify it
6 under the terms of version 2 of the GNU General Public License as 6 under the terms of version 2 of the GNU General Public License as
7 published by the Free Software Foundation. 7 published by the Free Software Foundation.
8 8
9 This program is distributed in the hope that it will be useful, but WITHOUT 9 This program is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 more details. 12 more details.
13 13
14 You should have received a copy of the GNU General Public License along with 14 You should have received a copy of the GNU General Public License along with
15 this program; if not, write to the Free Software Foundation, Inc., 59 15 this program; if not, write to the Free Software Foundation, Inc., 59
16 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 16 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 17
18 The full GNU General Public License is included in this distribution in the 18 The full GNU General Public License is included in this distribution in the
19 file called LICENSE. 19 file called LICENSE.
20 20
21 Contact Information: 21 Contact Information:
22 James P. Ketrenos <ipw2100-admin@linux.intel.com> 22 James P. Ketrenos <ipw2100-admin@linux.intel.com>
23 Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 23 Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
@@ -55,8 +55,8 @@
55 55
56#ifndef IRQ_NONE 56#ifndef IRQ_NONE
57typedef void irqreturn_t; 57typedef void irqreturn_t;
58#define IRQ_NONE 58#define IRQ_NONE
59#define IRQ_HANDLED 59#define IRQ_HANDLED
60#define IRQ_RETVAL(x) 60#define IRQ_RETVAL(x)
61#endif 61#endif
62 62
@@ -179,18 +179,18 @@ enum connection_manager_assoc_states
179#define IPW_B_MODE 1 179#define IPW_B_MODE 1
180#define IPW_G_MODE 2 180#define IPW_G_MODE 2
181 181
182/* 182/*
183 * TX Queue Flag Definitions 183 * TX Queue Flag Definitions
184 */ 184 */
185 185
186/* abort attempt if mgmt frame is rx'd */ 186/* abort attempt if mgmt frame is rx'd */
187#define DCT_FLAG_ABORT_MGMT 0x01 187#define DCT_FLAG_ABORT_MGMT 0x01
188 188
189/* require CTS */ 189/* require CTS */
190#define DCT_FLAG_CTS_REQUIRED 0x02 190#define DCT_FLAG_CTS_REQUIRED 0x02
191 191
192/* use short preamble */ 192/* use short preamble */
193#define DCT_FLAG_SHORT_PREMBL 0x04 193#define DCT_FLAG_SHORT_PREMBL 0x04
194 194
195/* RTS/CTS first */ 195/* RTS/CTS first */
196#define DCT_FLAG_RTS_REQD 0x08 196#define DCT_FLAG_RTS_REQD 0x08
@@ -205,7 +205,7 @@ enum connection_manager_assoc_states
205#define DCT_FLAG_TSF_REQD 0x40 205#define DCT_FLAG_TSF_REQD 0x40
206 206
207/* ACK rx is expected to follow */ 207/* ACK rx is expected to follow */
208#define DCT_FLAG_ACK_REQD 0x80 208#define DCT_FLAG_ACK_REQD 0x80
209 209
210#define DCT_FLAG_EXT_MODE_CCK 0x01 210#define DCT_FLAG_EXT_MODE_CCK 0x01
211#define DCT_FLAG_EXT_MODE_OFDM 0x00 211#define DCT_FLAG_EXT_MODE_OFDM 0x00
@@ -238,13 +238,13 @@ enum connection_manager_assoc_states
238#define HOST_NOTIFICATION_CHANNEL_SWITCHED 23 238#define HOST_NOTIFICATION_CHANNEL_SWITCHED 23
239#define HOST_NOTIFICATION_RX_DURING_QUIET_PERIOD 24 239#define HOST_NOTIFICATION_RX_DURING_QUIET_PERIOD 24
240#define HOST_NOTIFICATION_NOISE_STATS 25 240#define HOST_NOTIFICATION_NOISE_STATS 25
241#define HOST_NOTIFICATION_S36_MEASUREMENT_ACCEPTED 30 241#define HOST_NOTIFICATION_S36_MEASUREMENT_ACCEPTED 30
242#define HOST_NOTIFICATION_S36_MEASUREMENT_REFUSED 31 242#define HOST_NOTIFICATION_S36_MEASUREMENT_REFUSED 31
243 243
244#define HOST_NOTIFICATION_STATUS_BEACON_MISSING 1 244#define HOST_NOTIFICATION_STATUS_BEACON_MISSING 1
245#define IPW_MB_DISASSOCIATE_THRESHOLD_DEFAULT 24 245#define IPW_MB_DISASSOCIATE_THRESHOLD_DEFAULT 24
246#define IPW_MB_ROAMING_THRESHOLD_DEFAULT 8 246#define IPW_MB_ROAMING_THRESHOLD_DEFAULT 8
247#define IPW_REAL_RATE_RX_PACKET_THRESHOLD 300 247#define IPW_REAL_RATE_RX_PACKET_THRESHOLD 300
248 248
249#define MACADRR_BYTE_LEN 6 249#define MACADRR_BYTE_LEN 6
250 250
@@ -258,7 +258,7 @@ enum connection_manager_assoc_states
258 258
259/** 259/**
260 * Generic queue structure 260 * Generic queue structure
261 * 261 *
262 * Contains common data for Rx and Tx queues 262 * Contains common data for Rx and Tx queues
263 */ 263 */
264struct clx2_queue { 264struct clx2_queue {
@@ -318,7 +318,7 @@ struct machdr24
318 318
319// TX TFD with 32 byte MAC Header 319// TX TFD with 32 byte MAC Header
320struct tx_tfd_32 320struct tx_tfd_32
321{ 321{
322 struct machdr32 mchdr; // 32 322 struct machdr32 mchdr; // 32
323 u32 uivplaceholder[2]; // 8 323 u32 uivplaceholder[2]; // 8
324} __attribute__ ((packed)) ; 324} __attribute__ ((packed)) ;
@@ -368,8 +368,8 @@ struct tfd_data {
368 368
369 /* Tx Parameters */ 369 /* Tx Parameters */
370 u8 cmd_id; 370 u8 cmd_id;
371 u8 seq_num; 371 u8 seq_num;
372 u16 len; 372 u16 len;
373 u8 priority; 373 u8 priority;
374 u8 tx_flags; 374 u8 tx_flags;
375 u8 tx_flags_ext; 375 u8 tx_flags_ext;
@@ -378,10 +378,10 @@ struct tfd_data {
378 u8 rate; 378 u8 rate;
379 u8 antenna; 379 u8 antenna;
380 u16 next_packet_duration; 380 u16 next_packet_duration;
381 u16 next_frag_len; 381 u16 next_frag_len;
382 u16 back_off_counter; //////txop; 382 u16 back_off_counter; //////txop;
383 u8 retrylimit; 383 u8 retrylimit;
384 u16 cwcurrent; 384 u16 cwcurrent;
385 u8 reserved3; 385 u8 reserved3;
386 386
387 /* 802.11 MAC Header */ 387 /* 802.11 MAC Header */
@@ -457,29 +457,29 @@ struct rate_histogram
457 } failed; 457 } failed;
458} __attribute__ ((packed)); 458} __attribute__ ((packed));
459 459
460/* statistics command response */ 460/* statistics command response */
461struct ipw_cmd_stats { 461struct ipw_cmd_stats {
462 u8 cmd_id; 462 u8 cmd_id;
463 u8 seq_num; 463 u8 seq_num;
464 u16 good_sfd; 464 u16 good_sfd;
465 u16 bad_plcp; 465 u16 bad_plcp;
466 u16 wrong_bssid; 466 u16 wrong_bssid;
467 u16 valid_mpdu; 467 u16 valid_mpdu;
468 u16 bad_mac_header; 468 u16 bad_mac_header;
469 u16 reserved_frame_types; 469 u16 reserved_frame_types;
470 u16 rx_ina; 470 u16 rx_ina;
471 u16 bad_crc32; 471 u16 bad_crc32;
472 u16 invalid_cts; 472 u16 invalid_cts;
473 u16 invalid_acks; 473 u16 invalid_acks;
474 u16 long_distance_ina_fina; 474 u16 long_distance_ina_fina;
475 u16 dsp_silence_unreachable; 475 u16 dsp_silence_unreachable;
476 u16 accumulated_rssi; 476 u16 accumulated_rssi;
477 u16 rx_ovfl_frame_tossed; 477 u16 rx_ovfl_frame_tossed;
478 u16 rssi_silence_threshold; 478 u16 rssi_silence_threshold;
479 u16 rx_ovfl_frame_supplied; 479 u16 rx_ovfl_frame_supplied;
480 u16 last_rx_frame_signal; 480 u16 last_rx_frame_signal;
481 u16 last_rx_frame_noise; 481 u16 last_rx_frame_noise;
482 u16 rx_autodetec_no_ofdm; 482 u16 rx_autodetec_no_ofdm;
483 u16 rx_autodetec_no_barker; 483 u16 rx_autodetec_no_barker;
484 u16 reserved; 484 u16 reserved;
485} __attribute__ ((packed)); 485} __attribute__ ((packed));
@@ -568,11 +568,11 @@ struct ipw_rx_notification {
568} __attribute__ ((packed)); 568} __attribute__ ((packed));
569 569
570struct ipw_rx_frame { 570struct ipw_rx_frame {
571 u32 reserved1; 571 u32 reserved1;
572 u8 parent_tsf[4]; // fw_use[0] is boolean for OUR_TSF_IS_GREATER 572 u8 parent_tsf[4]; // fw_use[0] is boolean for OUR_TSF_IS_GREATER
573 u8 received_channel; // The channel that this frame was received on. 573 u8 received_channel; // The channel that this frame was received on.
574 // Note that for .11b this does not have to be 574 // Note that for .11b this does not have to be
575 // the same as the channel that it was sent. 575 // the same as the channel that it was sent.
576 // Filled by LMAC 576 // Filled by LMAC
577 u8 frameStatus; 577 u8 frameStatus;
578 u8 rate; 578 u8 rate;
@@ -583,13 +583,13 @@ struct ipw_rx_frame {
583 u16 noise; 583 u16 noise;
584 u8 antennaAndPhy; 584 u8 antennaAndPhy;
585 u8 control; // control bit should be on in bg 585 u8 control; // control bit should be on in bg
586 u8 rtscts_rate; // rate of rts or cts (in rts cts sequence rate 586 u8 rtscts_rate; // rate of rts or cts (in rts cts sequence rate
587 // is identical) 587 // is identical)
588 u8 rtscts_seen; // 0x1 RTS seen ; 0x2 CTS seen 588 u8 rtscts_seen; // 0x1 RTS seen ; 0x2 CTS seen
589 u16 length; 589 u16 length;
590 u8 data[0]; 590 u8 data[0];
591} __attribute__ ((packed)); 591} __attribute__ ((packed));
592 592
593struct ipw_rx_header { 593struct ipw_rx_header {
594 u8 message_type; 594 u8 message_type;
595 u8 rx_seq_num; 595 u8 rx_seq_num;
@@ -716,8 +716,8 @@ struct ipw_wep_key
716} __attribute__ ((packed)); 716} __attribute__ ((packed));
717 717
718struct ipw_tgi_tx_key 718struct ipw_tgi_tx_key
719{ 719{
720 u8 key_id; 720 u8 key_id;
721 u8 security_type; 721 u8 security_type;
722 u8 station_index; 722 u8 station_index;
723 u8 flags; 723 u8 flags;
@@ -727,7 +727,7 @@ struct ipw_tgi_tx_key
727 727
728#define IPW_SCAN_CHANNELS 54 728#define IPW_SCAN_CHANNELS 54
729 729
730struct ipw_scan_request 730struct ipw_scan_request
731{ 731{
732 u8 scan_type; 732 u8 scan_type;
733 u16 dwell_time; 733 u16 dwell_time;
@@ -753,7 +753,7 @@ struct ipw_scan_request_ext
753 u16 dwell_time[IPW_SCAN_TYPES]; 753 u16 dwell_time[IPW_SCAN_TYPES];
754} __attribute__ ((packed)); 754} __attribute__ ((packed));
755 755
756extern inline u8 ipw_get_scan_type(struct ipw_scan_request_ext *scan, u8 index) 756extern inline u8 ipw_get_scan_type(struct ipw_scan_request_ext *scan, u8 index)
757{ 757{
758 if (index % 2) 758 if (index % 2)
759 return scan->scan_type[index / 2] & 0x0F; 759 return scan->scan_type[index / 2] & 0x0F;
@@ -761,16 +761,16 @@ extern inline u8 ipw_get_scan_type(struct ipw_scan_request_ext *scan, u8 index)
761 return (scan->scan_type[index / 2] & 0xF0) >> 4; 761 return (scan->scan_type[index / 2] & 0xF0) >> 4;
762} 762}
763 763
764extern inline void ipw_set_scan_type(struct ipw_scan_request_ext *scan, 764extern inline void ipw_set_scan_type(struct ipw_scan_request_ext *scan,
765 u8 index, u8 scan_type) 765 u8 index, u8 scan_type)
766{ 766{
767 if (index % 2) 767 if (index % 2)
768 scan->scan_type[index / 2] = 768 scan->scan_type[index / 2] =
769 (scan->scan_type[index / 2] & 0xF0) | 769 (scan->scan_type[index / 2] & 0xF0) |
770 (scan_type & 0x0F); 770 (scan_type & 0x0F);
771 else 771 else
772 scan->scan_type[index / 2] = 772 scan->scan_type[index / 2] =
773 (scan->scan_type[index / 2] & 0x0F) | 773 (scan->scan_type[index / 2] & 0x0F) |
774 ((scan_type & 0x0F) << 4); 774 ((scan_type & 0x0F) << 4);
775} 775}
776 776
@@ -909,14 +909,14 @@ struct ipw_sensitivity_calib
909 909
910/** 910/**
911 * Host command structure. 911 * Host command structure.
912 * 912 *
913 * On input, the following fields should be filled: 913 * On input, the following fields should be filled:
914 * - cmd 914 * - cmd
915 * - len 915 * - len
916 * - status_len 916 * - status_len
917 * - param (if needed) 917 * - param (if needed)
918 * 918 *
919 * On output, 919 * On output,
920 * - \a status contains status; 920 * - \a status contains status;
921 * - \a param filled with status parameters. 921 * - \a param filled with status parameters.
922 */ 922 */
@@ -926,8 +926,8 @@ struct ipw_cmd {
926 u32 status_len; /**< How many 32 bit parameters in the status */ 926 u32 status_len; /**< How many 32 bit parameters in the status */
927 u32 len; /**< incoming parameters length, bytes */ 927 u32 len; /**< incoming parameters length, bytes */
928 /** 928 /**
929 * command parameters. 929 * command parameters.
930 * There should be enough space for incoming and 930 * There should be enough space for incoming and
931 * outcoming parameters. 931 * outcoming parameters.
932 * Incoming parameters listed 1-st, followed by outcoming params. 932 * Incoming parameters listed 1-st, followed by outcoming params.
933 * nParams=(len+3)/4+status_len 933 * nParams=(len+3)/4+status_len
@@ -955,8 +955,8 @@ struct ipw_cmd {
955#define STATUS_STATE_PENDING (1<<13) 955#define STATUS_STATE_PENDING (1<<13)
956 956
957#define STATUS_SCAN_PENDING (1<<20) 957#define STATUS_SCAN_PENDING (1<<20)
958#define STATUS_SCANNING (1<<21) 958#define STATUS_SCANNING (1<<21)
959#define STATUS_SCAN_ABORTING (1<<22) 959#define STATUS_SCAN_ABORTING (1<<22)
960 960
961#define STATUS_INDIRECT_BYTE (1<<28) /* sysfs entry configured for access */ 961#define STATUS_INDIRECT_BYTE (1<<28) /* sysfs entry configured for access */
962#define STATUS_INDIRECT_DWORD (1<<29) /* sysfs entry configured for access */ 962#define STATUS_INDIRECT_DWORD (1<<29) /* sysfs entry configured for access */
@@ -1009,7 +1009,7 @@ struct ipw_priv {
1009 /* pci hardware address support */ 1009 /* pci hardware address support */
1010 void __iomem *hw_base; 1010 void __iomem *hw_base;
1011 unsigned long hw_len; 1011 unsigned long hw_len;
1012 1012
1013 struct fw_image_desc sram_desc; 1013 struct fw_image_desc sram_desc;
1014 1014
1015 /* result of ucode download */ 1015 /* result of ucode download */
@@ -1036,7 +1036,7 @@ struct ipw_priv {
1036 int rx_pend_max; /**< maximum pending buffers for one IRQ */ 1036 int rx_pend_max; /**< maximum pending buffers for one IRQ */
1037 u32 hcmd_seq; /**< sequence number for hcmd */ 1037 u32 hcmd_seq; /**< sequence number for hcmd */
1038 u32 missed_beacon_threshold; 1038 u32 missed_beacon_threshold;
1039 u32 roaming_threshold; 1039 u32 roaming_threshold;
1040 1040
1041 struct ipw_associate assoc_request; 1041 struct ipw_associate assoc_request;
1042 struct ieee80211_network *assoc_network; 1042 struct ieee80211_network *assoc_network;
@@ -1071,11 +1071,11 @@ struct ipw_priv {
1071 u8 channel; 1071 u8 channel;
1072 struct ipw_sys_config sys_config; 1072 struct ipw_sys_config sys_config;
1073 u32 power_mode; 1073 u32 power_mode;
1074 u8 bssid[ETH_ALEN]; 1074 u8 bssid[ETH_ALEN];
1075 u16 rts_threshold; 1075 u16 rts_threshold;
1076 u8 mac_addr[ETH_ALEN]; 1076 u8 mac_addr[ETH_ALEN];
1077 u8 num_stations; 1077 u8 num_stations;
1078 u8 stations[MAX_STATIONS][ETH_ALEN]; 1078 u8 stations[MAX_STATIONS][ETH_ALEN];
1079 1079
1080 u32 notif_missed_beacons; 1080 u32 notif_missed_beacons;
1081 1081
@@ -1094,13 +1094,13 @@ struct ipw_priv {
1094 u32 quality; 1094 u32 quality;
1095 1095
1096 /* eeprom */ 1096 /* eeprom */
1097 u8 eeprom[0x100]; /* 256 bytes of eeprom */ 1097 u8 eeprom[0x100]; /* 256 bytes of eeprom */
1098 int eeprom_delay; 1098 int eeprom_delay;
1099 1099
1100 struct iw_statistics wstats; 1100 struct iw_statistics wstats;
1101 1101
1102 struct workqueue_struct *workqueue; 1102 struct workqueue_struct *workqueue;
1103 1103
1104 struct work_struct adhoc_check; 1104 struct work_struct adhoc_check;
1105 struct work_struct associate; 1105 struct work_struct associate;
1106 struct work_struct disassociate; 1106 struct work_struct disassociate;
@@ -1125,7 +1125,7 @@ struct ipw_priv {
1125#define IPW_DEFAULT_TX_POWER 0x14 1125#define IPW_DEFAULT_TX_POWER 0x14
1126 u8 tx_power; 1126 u8 tx_power;
1127 1127
1128#ifdef CONFIG_PM 1128#ifdef CONFIG_PM
1129 u32 pm_state[16]; 1129 u32 pm_state[16];
1130#endif 1130#endif
1131 1131
@@ -1159,7 +1159,7 @@ do { if (ipw_debug_level & (level)) \
1159 * list here in the form of: 1159 * list here in the form of:
1160 * 1160 *
1161 * #define IPW_DL_xxxx VALUE 1161 * #define IPW_DL_xxxx VALUE
1162 * 1162 *
1163 * shifting value to the left one bit from the previous entry. xxxx should be 1163 * shifting value to the left one bit from the previous entry. xxxx should be
1164 * the name of the classification (for example, WEP) 1164 * the name of the classification (for example, WEP)
1165 * 1165 *
@@ -1173,7 +1173,7 @@ do { if (ipw_debug_level & (level)) \
1173 * 1173 *
1174 * you simply need to add your entry to the ipw_debug_levels array. 1174 * you simply need to add your entry to the ipw_debug_levels array.
1175 * 1175 *
1176 * If you do not see debug_level in /proc/net/ipw then you do not have 1176 * If you do not see debug_level in /proc/net/ipw then you do not have
1177 * CONFIG_IPW_DEBUG defined in your kernel configuration 1177 * CONFIG_IPW_DEBUG defined in your kernel configuration
1178 * 1178 *
1179 */ 1179 */
@@ -1247,7 +1247,7 @@ do { if (ipw_debug_level & (level)) \
1247 1247
1248#define DINO_ENABLE_SYSTEM 0x80 1248#define DINO_ENABLE_SYSTEM 0x80
1249#define DINO_ENABLE_CS 0x40 1249#define DINO_ENABLE_CS 0x40
1250#define DINO_RXFIFO_DATA 0x01 1250#define DINO_RXFIFO_DATA 0x01
1251#define DINO_CONTROL_REG 0x00200000 1251#define DINO_CONTROL_REG 0x00200000
1252 1252
1253#define CX2_INTA_RW 0x00000008 1253#define CX2_INTA_RW 0x00000008
@@ -1320,7 +1320,7 @@ do { if (ipw_debug_level & (level)) \
1320 1320
1321#define DMA_CONTROL_SMALL_CB_CONST_VALUE 0x00540000 1321#define DMA_CONTROL_SMALL_CB_CONST_VALUE 0x00540000
1322#define DMA_CB_STOP_AND_ABORT 0x00000C00 1322#define DMA_CB_STOP_AND_ABORT 0x00000C00
1323#define DMA_CB_START 0x00000100 1323#define DMA_CB_START 0x00000100
1324 1324
1325 1325
1326#define CX2_SHARED_SRAM_SIZE 0x00030000 1326#define CX2_SHARED_SRAM_SIZE 0x00030000
@@ -1410,7 +1410,7 @@ do { if (ipw_debug_level & (level)) \
1410#define EEPROM_NIC_TYPE_HP 4 1410#define EEPROM_NIC_TYPE_HP 4
1411 1411
1412#define FW_MEM_REG_LOWER_BOUND 0x00300000 1412#define FW_MEM_REG_LOWER_BOUND 0x00300000
1413#define FW_MEM_REG_EEPROM_ACCESS (FW_MEM_REG_LOWER_BOUND + 0x40) 1413#define FW_MEM_REG_EEPROM_ACCESS (FW_MEM_REG_LOWER_BOUND + 0x40)
1414 1414
1415#define EEPROM_BIT_SK (1<<0) 1415#define EEPROM_BIT_SK (1<<0)
1416#define EEPROM_BIT_CS (1<<1) 1416#define EEPROM_BIT_CS (1<<1)
@@ -1506,15 +1506,15 @@ enum {
1506#define IPW_RATE_CONNECT 0 1506#define IPW_RATE_CONNECT 0
1507 1507
1508 1508
1509/* 1509/*
1510 * Rate values and masks 1510 * Rate values and masks
1511 */ 1511 */
1512#define IPW_TX_RATE_1MB 0x0A 1512#define IPW_TX_RATE_1MB 0x0A
1513#define IPW_TX_RATE_2MB 0x14 1513#define IPW_TX_RATE_2MB 0x14
1514#define IPW_TX_RATE_5MB 0x37 1514#define IPW_TX_RATE_5MB 0x37
1515#define IPW_TX_RATE_6MB 0x0D 1515#define IPW_TX_RATE_6MB 0x0D
1516#define IPW_TX_RATE_9MB 0x0F 1516#define IPW_TX_RATE_9MB 0x0F
1517#define IPW_TX_RATE_11MB 0x6E 1517#define IPW_TX_RATE_11MB 0x6E
1518#define IPW_TX_RATE_12MB 0x05 1518#define IPW_TX_RATE_12MB 0x05
1519#define IPW_TX_RATE_18MB 0x07 1519#define IPW_TX_RATE_18MB 0x07
1520#define IPW_TX_RATE_24MB 0x09 1520#define IPW_TX_RATE_24MB 0x09
@@ -1525,25 +1525,25 @@ enum {
1525#define IPW_ORD_TABLE_ID_MASK 0x0000FF00 1525#define IPW_ORD_TABLE_ID_MASK 0x0000FF00
1526#define IPW_ORD_TABLE_VALUE_MASK 0x000000FF 1526#define IPW_ORD_TABLE_VALUE_MASK 0x000000FF
1527 1527
1528#define IPW_ORD_TABLE_0_MASK 0x0000F000 1528#define IPW_ORD_TABLE_0_MASK 0x0000F000
1529#define IPW_ORD_TABLE_1_MASK 0x0000F100 1529#define IPW_ORD_TABLE_1_MASK 0x0000F100
1530#define IPW_ORD_TABLE_2_MASK 0x0000F200 1530#define IPW_ORD_TABLE_2_MASK 0x0000F200
1531#define IPW_ORD_TABLE_3_MASK 0x0000F300 1531#define IPW_ORD_TABLE_3_MASK 0x0000F300
1532#define IPW_ORD_TABLE_4_MASK 0x0000F400 1532#define IPW_ORD_TABLE_4_MASK 0x0000F400
1533#define IPW_ORD_TABLE_5_MASK 0x0000F500 1533#define IPW_ORD_TABLE_5_MASK 0x0000F500
1534#define IPW_ORD_TABLE_6_MASK 0x0000F600 1534#define IPW_ORD_TABLE_6_MASK 0x0000F600
1535#define IPW_ORD_TABLE_7_MASK 0x0000F700 1535#define IPW_ORD_TABLE_7_MASK 0x0000F700
1536 1536
1537/* 1537/*
1538 * Table 0 Entries (all entries are 32 bits) 1538 * Table 0 Entries (all entries are 32 bits)
1539 */ 1539 */
1540enum { 1540enum {
1541 IPW_ORD_STAT_TX_CURR_RATE = IPW_ORD_TABLE_0_MASK + 1, 1541 IPW_ORD_STAT_TX_CURR_RATE = IPW_ORD_TABLE_0_MASK + 1,
1542 IPW_ORD_STAT_FRAG_TRESHOLD, 1542 IPW_ORD_STAT_FRAG_TRESHOLD,
1543 IPW_ORD_STAT_RTS_THRESHOLD, 1543 IPW_ORD_STAT_RTS_THRESHOLD,
1544 IPW_ORD_STAT_TX_HOST_REQUESTS, 1544 IPW_ORD_STAT_TX_HOST_REQUESTS,
1545 IPW_ORD_STAT_TX_HOST_COMPLETE, 1545 IPW_ORD_STAT_TX_HOST_COMPLETE,
1546 IPW_ORD_STAT_TX_DIR_DATA, 1546 IPW_ORD_STAT_TX_DIR_DATA,
1547 IPW_ORD_STAT_TX_DIR_DATA_B_1, 1547 IPW_ORD_STAT_TX_DIR_DATA_B_1,
1548 IPW_ORD_STAT_TX_DIR_DATA_B_2, 1548 IPW_ORD_STAT_TX_DIR_DATA_B_2,
1549 IPW_ORD_STAT_TX_DIR_DATA_B_5_5, 1549 IPW_ORD_STAT_TX_DIR_DATA_B_5_5,
@@ -1561,18 +1561,18 @@ enum {
1561 IPW_ORD_STAT_TX_DIR_DATA_G_5_5, 1561 IPW_ORD_STAT_TX_DIR_DATA_G_5_5,
1562 IPW_ORD_STAT_TX_DIR_DATA_G_6, 1562 IPW_ORD_STAT_TX_DIR_DATA_G_6,
1563 IPW_ORD_STAT_TX_DIR_DATA_G_9, 1563 IPW_ORD_STAT_TX_DIR_DATA_G_9,
1564 IPW_ORD_STAT_TX_DIR_DATA_G_11, 1564 IPW_ORD_STAT_TX_DIR_DATA_G_11,
1565 IPW_ORD_STAT_TX_DIR_DATA_G_12, 1565 IPW_ORD_STAT_TX_DIR_DATA_G_12,
1566 IPW_ORD_STAT_TX_DIR_DATA_G_18, 1566 IPW_ORD_STAT_TX_DIR_DATA_G_18,
1567 IPW_ORD_STAT_TX_DIR_DATA_G_24, 1567 IPW_ORD_STAT_TX_DIR_DATA_G_24,
1568 IPW_ORD_STAT_TX_DIR_DATA_G_36, 1568 IPW_ORD_STAT_TX_DIR_DATA_G_36,
1569 IPW_ORD_STAT_TX_DIR_DATA_G_48, 1569 IPW_ORD_STAT_TX_DIR_DATA_G_48,
1570 IPW_ORD_STAT_TX_DIR_DATA_G_54, 1570 IPW_ORD_STAT_TX_DIR_DATA_G_54,
1571 IPW_ORD_STAT_TX_NON_DIR_DATA, 1571 IPW_ORD_STAT_TX_NON_DIR_DATA,
1572 IPW_ORD_STAT_TX_NON_DIR_DATA_B_1, 1572 IPW_ORD_STAT_TX_NON_DIR_DATA_B_1,
1573 IPW_ORD_STAT_TX_NON_DIR_DATA_B_2, 1573 IPW_ORD_STAT_TX_NON_DIR_DATA_B_2,
1574 IPW_ORD_STAT_TX_NON_DIR_DATA_B_5_5, 1574 IPW_ORD_STAT_TX_NON_DIR_DATA_B_5_5,
1575 IPW_ORD_STAT_TX_NON_DIR_DATA_B_11, 1575 IPW_ORD_STAT_TX_NON_DIR_DATA_B_11,
1576 /* Hole */ 1576 /* Hole */
1577 1577
1578 1578
@@ -1586,7 +1586,7 @@ enum {
1586 IPW_ORD_STAT_TX_NON_DIR_DATA_G_5_5, 1586 IPW_ORD_STAT_TX_NON_DIR_DATA_G_5_5,
1587 IPW_ORD_STAT_TX_NON_DIR_DATA_G_6, 1587 IPW_ORD_STAT_TX_NON_DIR_DATA_G_6,
1588 IPW_ORD_STAT_TX_NON_DIR_DATA_G_9, 1588 IPW_ORD_STAT_TX_NON_DIR_DATA_G_9,
1589 IPW_ORD_STAT_TX_NON_DIR_DATA_G_11, 1589 IPW_ORD_STAT_TX_NON_DIR_DATA_G_11,
1590 IPW_ORD_STAT_TX_NON_DIR_DATA_G_12, 1590 IPW_ORD_STAT_TX_NON_DIR_DATA_G_12,
1591 IPW_ORD_STAT_TX_NON_DIR_DATA_G_18, 1591 IPW_ORD_STAT_TX_NON_DIR_DATA_G_18,
1592 IPW_ORD_STAT_TX_NON_DIR_DATA_G_24, 1592 IPW_ORD_STAT_TX_NON_DIR_DATA_G_24,
@@ -1601,12 +1601,12 @@ enum {
1601 IPW_ORD_STAT_FULL_SCANS, 1601 IPW_ORD_STAT_FULL_SCANS,
1602 IPW_ORD_STAT_PARTIAL_SCANS, 1602 IPW_ORD_STAT_PARTIAL_SCANS,
1603 IPW_ORD_STAT_TGH_ABORTED_SCANS, 1603 IPW_ORD_STAT_TGH_ABORTED_SCANS,
1604 IPW_ORD_STAT_TX_TOTAL_BYTES, 1604 IPW_ORD_STAT_TX_TOTAL_BYTES,
1605 IPW_ORD_STAT_CURR_RSSI_RAW, 1605 IPW_ORD_STAT_CURR_RSSI_RAW,
1606 IPW_ORD_STAT_RX_BEACON, 1606 IPW_ORD_STAT_RX_BEACON,
1607 IPW_ORD_STAT_MISSED_BEACONS, 1607 IPW_ORD_STAT_MISSED_BEACONS,
1608 IPW_ORD_TABLE_0_LAST 1608 IPW_ORD_TABLE_0_LAST
1609}; 1609};
1610 1610
1611#define IPW_RSSI_TO_DBM 112 1611#define IPW_RSSI_TO_DBM 112
1612 1612
@@ -1626,15 +1626,15 @@ enum {
1626 * ADDAPTER_MAC: 6 byte MAC address 1626 * ADDAPTER_MAC: 6 byte MAC address
1627 * RTC: 4 byte clock 1627 * RTC: 4 byte clock
1628 */ 1628 */
1629enum { 1629enum {
1630 IPW_ORD_STAT_FW_VERSION = IPW_ORD_TABLE_2_MASK | 1, 1630 IPW_ORD_STAT_FW_VERSION = IPW_ORD_TABLE_2_MASK | 1,
1631 IPW_ORD_STAT_FW_DATE, 1631 IPW_ORD_STAT_FW_DATE,
1632 IPW_ORD_STAT_UCODE_VERSION, 1632 IPW_ORD_STAT_UCODE_VERSION,
1633 IPW_ORD_STAT_UCODE_DATE, 1633 IPW_ORD_STAT_UCODE_DATE,
1634 IPW_ORD_STAT_ADAPTER_MAC, 1634 IPW_ORD_STAT_ADAPTER_MAC,
1635 IPW_ORD_STAT_RTC, 1635 IPW_ORD_STAT_RTC,
1636 IPW_ORD_TABLE_2_LAST 1636 IPW_ORD_TABLE_2_LAST
1637}; 1637};
1638 1638
1639/* Table 3 */ 1639/* Table 3 */
1640enum { 1640enum {
@@ -1711,7 +1711,7 @@ struct host_cmd {
1711#define CFG_BT_COEXISTENCE_WME_OVER_BT 0x08 1711#define CFG_BT_COEXISTENCE_WME_OVER_BT 0x08
1712#define CFG_BT_COEXISTENCE_OOB 0x10 1712#define CFG_BT_COEXISTENCE_OOB 0x10
1713#define CFG_BT_COEXISTENCE_MAX 0xFF 1713#define CFG_BT_COEXISTENCE_MAX 0xFF
1714#define CFG_BT_COEXISTENCE_DEF 0x80 /* read Bt from EEPROM*/ 1714#define CFG_BT_COEXISTENCE_DEF 0x80 /* read Bt from EEPROM*/
1715 1715
1716#define CFG_CTS_TO_ITSELF_ENABLED_MIN 0x0 1716#define CFG_CTS_TO_ITSELF_ENABLED_MIN 0x0
1717#define CFG_CTS_TO_ITSELF_ENABLED_MAX 0x1 1717#define CFG_CTS_TO_ITSELF_ENABLED_MAX 0x1
@@ -1722,9 +1722,9 @@ struct host_cmd {
1722#define CFG_SYS_ANTENNA_B 0x003 1722#define CFG_SYS_ANTENNA_B 0x003
1723 1723
1724/* 1724/*
1725 * The definitions below were lifted off the ipw2100 driver, which only 1725 * The definitions below were lifted off the ipw2100 driver, which only
1726 * supports 'b' mode, so I'm sure these are not exactly correct. 1726 * supports 'b' mode, so I'm sure these are not exactly correct.
1727 * 1727 *
1728 * Somebody fix these!! 1728 * Somebody fix these!!
1729 */ 1729 */
1730#define REG_MIN_CHANNEL 0 1730#define REG_MIN_CHANNEL 0
@@ -1733,11 +1733,11 @@ struct host_cmd {
1733#define REG_CHANNEL_MASK 0x00003FFF 1733#define REG_CHANNEL_MASK 0x00003FFF
1734#define IPW_IBSS_11B_DEFAULT_MASK 0x87ff 1734#define IPW_IBSS_11B_DEFAULT_MASK 0x87ff
1735 1735
1736static const long ipw_frequencies[] = { 1736static const long ipw_frequencies[] = {
1737 2412, 2417, 2422, 2427, 1737 2412, 2417, 2422, 2427,
1738 2432, 2437, 2442, 2447, 1738 2432, 2437, 2442, 2447,
1739 2452, 2457, 2462, 2467, 1739 2452, 2457, 2462, 2467,
1740 2472, 2484 1740 2472, 2484
1741}; 1741};
1742 1742
1743#define FREQ_COUNT ARRAY_SIZE(ipw_frequencies) 1743#define FREQ_COUNT ARRAY_SIZE(ipw_frequencies)