aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ipw2100.c
diff options
context:
space:
mode:
authorJames Ketrenos <jketreno@linux.intel.com>2005-09-14 10:47:29 -0400
committerJames Ketrenos <jketreno@linux.intel.com>2005-11-07 18:49:45 -0500
commitee8e365aa6395e721399127ccf3d28d269136f0e (patch)
treef069489a0d07c643bdc9caf12cfd7a9cfcadfbf1 /drivers/net/wireless/ipw2100.c
parentd7e02edbc52bc689279154b117b90fe6635fc14b (diff)
Ran scripts/Lindent on drivers/net/wireless/ipw2{1,2}00.{c,h}
No other changes. Signed-off-by: James Ketrenos <jketreno@linux.intel.com>
Diffstat (limited to 'drivers/net/wireless/ipw2100.c')
-rw-r--r--drivers/net/wireless/ipw2100.c2217
1 files changed, 1085 insertions, 1132 deletions
diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c
index ad7f8cd76db9..a15eef1c2a62 100644
--- a/drivers/net/wireless/ipw2100.c
+++ b/drivers/net/wireless/ipw2100.c
@@ -174,10 +174,9 @@ that only one external action is invoked at a time.
174#define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" 174#define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver"
175#define DRV_COPYRIGHT "Copyright(c) 2003-2004 Intel Corporation" 175#define DRV_COPYRIGHT "Copyright(c) 2003-2004 Intel Corporation"
176 176
177
178/* Debugging stuff */ 177/* Debugging stuff */
179#ifdef CONFIG_IPW_DEBUG 178#ifdef CONFIG_IPW_DEBUG
180#define CONFIG_IPW2100_RX_DEBUG /* Reception debugging */ 179#define CONFIG_IPW2100_RX_DEBUG /* Reception debugging */
181#endif 180#endif
182 181
183MODULE_DESCRIPTION(DRV_DESCRIPTION); 182MODULE_DESCRIPTION(DRV_DESCRIPTION);
@@ -220,18 +219,18 @@ do { \
220} while (0) 219} while (0)
221#else 220#else
222#define IPW_DEBUG(level, message...) do {} while (0) 221#define IPW_DEBUG(level, message...) do {} while (0)
223#endif /* CONFIG_IPW_DEBUG */ 222#endif /* CONFIG_IPW_DEBUG */
224 223
225#ifdef CONFIG_IPW_DEBUG 224#ifdef CONFIG_IPW_DEBUG
226static const char *command_types[] = { 225static const char *command_types[] = {
227 "undefined", 226 "undefined",
228 "unused", /* HOST_ATTENTION */ 227 "unused", /* HOST_ATTENTION */
229 "HOST_COMPLETE", 228 "HOST_COMPLETE",
230 "unused", /* SLEEP */ 229 "unused", /* SLEEP */
231 "unused", /* HOST_POWER_DOWN */ 230 "unused", /* HOST_POWER_DOWN */
232 "unused", 231 "unused",
233 "SYSTEM_CONFIG", 232 "SYSTEM_CONFIG",
234 "unused", /* SET_IMR */ 233 "unused", /* SET_IMR */
235 "SSID", 234 "SSID",
236 "MANDATORY_BSSID", 235 "MANDATORY_BSSID",
237 "AUTHENTICATION_TYPE", 236 "AUTHENTICATION_TYPE",
@@ -277,17 +276,16 @@ static const char *command_types[] = {
277 "GROUP_ORDINALS", 276 "GROUP_ORDINALS",
278 "SHORT_RETRY_LIMIT", 277 "SHORT_RETRY_LIMIT",
279 "LONG_RETRY_LIMIT", 278 "LONG_RETRY_LIMIT",
280 "unused", /* SAVE_CALIBRATION */ 279 "unused", /* SAVE_CALIBRATION */
281 "unused", /* RESTORE_CALIBRATION */ 280 "unused", /* RESTORE_CALIBRATION */
282 "undefined", 281 "undefined",
283 "undefined", 282 "undefined",
284 "undefined", 283 "undefined",
285 "HOST_PRE_POWER_DOWN", 284 "HOST_PRE_POWER_DOWN",
286 "unused", /* HOST_INTERRUPT_COALESCING */ 285 "unused", /* HOST_INTERRUPT_COALESCING */
287 "undefined", 286 "undefined",
288 "CARD_DISABLE_PHY_OFF", 287 "CARD_DISABLE_PHY_OFF",
289 "MSDU_TX_RATES" 288 "MSDU_TX_RATES" "undefined",
290 "undefined",
291 "undefined", 289 "undefined",
292 "SET_STATION_STAT_BITS", 290 "SET_STATION_STAT_BITS",
293 "CLEAR_STATIONS_STAT_BITS", 291 "CLEAR_STATIONS_STAT_BITS",
@@ -298,7 +296,6 @@ static const char *command_types[] = {
298}; 296};
299#endif 297#endif
300 298
301
302/* Pre-decl until we get the code solid and then we can clean it up */ 299/* Pre-decl until we get the code solid and then we can clean it up */
303static void ipw2100_tx_send_commands(struct ipw2100_priv *priv); 300static void ipw2100_tx_send_commands(struct ipw2100_priv *priv);
304static void ipw2100_tx_send_data(struct ipw2100_priv *priv); 301static void ipw2100_tx_send_data(struct ipw2100_priv *priv);
@@ -321,11 +318,10 @@ static void ipw2100_release_firmware(struct ipw2100_priv *priv,
321static int ipw2100_ucode_download(struct ipw2100_priv *priv, 318static int ipw2100_ucode_download(struct ipw2100_priv *priv,
322 struct ipw2100_fw *fw); 319 struct ipw2100_fw *fw);
323static void ipw2100_wx_event_work(struct ipw2100_priv *priv); 320static void ipw2100_wx_event_work(struct ipw2100_priv *priv);
324static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device * dev); 321static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device *dev);
325static struct iw_handler_def ipw2100_wx_handler_def; 322static struct iw_handler_def ipw2100_wx_handler_def;
326 323
327 324static inline void read_register(struct net_device *dev, u32 reg, u32 * val)
328static inline void read_register(struct net_device *dev, u32 reg, u32 *val)
329{ 325{
330 *val = readl((void __iomem *)(dev->base_addr + reg)); 326 *val = readl((void __iomem *)(dev->base_addr + reg));
331 IPW_DEBUG_IO("r: 0x%08X => 0x%08X\n", reg, *val); 327 IPW_DEBUG_IO("r: 0x%08X => 0x%08X\n", reg, *val);
@@ -337,13 +333,14 @@ static inline void write_register(struct net_device *dev, u32 reg, u32 val)
337 IPW_DEBUG_IO("w: 0x%08X <= 0x%08X\n", reg, val); 333 IPW_DEBUG_IO("w: 0x%08X <= 0x%08X\n", reg, val);
338} 334}
339 335
340static inline void read_register_word(struct net_device *dev, u32 reg, u16 *val) 336static inline void read_register_word(struct net_device *dev, u32 reg,
337 u16 * val)
341{ 338{
342 *val = readw((void __iomem *)(dev->base_addr + reg)); 339 *val = readw((void __iomem *)(dev->base_addr + reg));
343 IPW_DEBUG_IO("r: 0x%08X => %04X\n", reg, *val); 340 IPW_DEBUG_IO("r: 0x%08X => %04X\n", reg, *val);
344} 341}
345 342
346static inline void read_register_byte(struct net_device *dev, u32 reg, u8 *val) 343static inline void read_register_byte(struct net_device *dev, u32 reg, u8 * val)
347{ 344{
348 *val = readb((void __iomem *)(dev->base_addr + reg)); 345 *val = readb((void __iomem *)(dev->base_addr + reg));
349 IPW_DEBUG_IO("r: 0x%08X => %02X\n", reg, *val); 346 IPW_DEBUG_IO("r: 0x%08X => %02X\n", reg, *val);
@@ -355,14 +352,13 @@ static inline void write_register_word(struct net_device *dev, u32 reg, u16 val)
355 IPW_DEBUG_IO("w: 0x%08X <= %04X\n", reg, val); 352 IPW_DEBUG_IO("w: 0x%08X <= %04X\n", reg, val);
356} 353}
357 354
358
359static inline void write_register_byte(struct net_device *dev, u32 reg, u8 val) 355static inline void write_register_byte(struct net_device *dev, u32 reg, u8 val)
360{ 356{
361 writeb(val, (void __iomem *)(dev->base_addr + reg)); 357 writeb(val, (void __iomem *)(dev->base_addr + reg));
362 IPW_DEBUG_IO("w: 0x%08X =< %02X\n", reg, val); 358 IPW_DEBUG_IO("w: 0x%08X =< %02X\n", reg, val);
363} 359}
364 360
365static inline void read_nic_dword(struct net_device *dev, u32 addr, u32 *val) 361static inline void read_nic_dword(struct net_device *dev, u32 addr, u32 * val)
366{ 362{
367 write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, 363 write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS,
368 addr & IPW_REG_INDIRECT_ADDR_MASK); 364 addr & IPW_REG_INDIRECT_ADDR_MASK);
@@ -376,7 +372,7 @@ static inline void write_nic_dword(struct net_device *dev, u32 addr, u32 val)
376 write_register(dev, IPW_REG_INDIRECT_ACCESS_DATA, val); 372 write_register(dev, IPW_REG_INDIRECT_ACCESS_DATA, val);
377} 373}
378 374
379static inline void read_nic_word(struct net_device *dev, u32 addr, u16 *val) 375static inline void read_nic_word(struct net_device *dev, u32 addr, u16 * val)
380{ 376{
381 write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, 377 write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS,
382 addr & IPW_REG_INDIRECT_ADDR_MASK); 378 addr & IPW_REG_INDIRECT_ADDR_MASK);
@@ -390,7 +386,7 @@ static inline void write_nic_word(struct net_device *dev, u32 addr, u16 val)
390 write_register_word(dev, IPW_REG_INDIRECT_ACCESS_DATA, val); 386 write_register_word(dev, IPW_REG_INDIRECT_ACCESS_DATA, val);
391} 387}
392 388
393static inline void read_nic_byte(struct net_device *dev, u32 addr, u8 *val) 389static inline void read_nic_byte(struct net_device *dev, u32 addr, u8 * val)
394{ 390{
395 write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, 391 write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS,
396 addr & IPW_REG_INDIRECT_ADDR_MASK); 392 addr & IPW_REG_INDIRECT_ADDR_MASK);
@@ -416,7 +412,7 @@ static inline void write_nic_dword_auto_inc(struct net_device *dev, u32 val)
416} 412}
417 413
418static inline void write_nic_memory(struct net_device *dev, u32 addr, u32 len, 414static inline void write_nic_memory(struct net_device *dev, u32 addr, u32 len,
419 const u8 *buf) 415 const u8 * buf)
420{ 416{
421 u32 aligned_addr; 417 u32 aligned_addr;
422 u32 aligned_len; 418 u32 aligned_len;
@@ -431,32 +427,30 @@ static inline void write_nic_memory(struct net_device *dev, u32 addr, u32 len,
431 write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, 427 write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS,
432 aligned_addr); 428 aligned_addr);
433 for (i = dif_len; i < 4; i++, buf++) 429 for (i = dif_len; i < 4; i++, buf++)
434 write_register_byte( 430 write_register_byte(dev,
435 dev, IPW_REG_INDIRECT_ACCESS_DATA + i, 431 IPW_REG_INDIRECT_ACCESS_DATA + i,
436 *buf); 432 *buf);
437 433
438 len -= dif_len; 434 len -= dif_len;
439 aligned_addr += 4; 435 aligned_addr += 4;
440 } 436 }
441 437
442 /* read DWs through autoincrement registers */ 438 /* read DWs through autoincrement registers */
443 write_register(dev, IPW_REG_AUTOINCREMENT_ADDRESS, 439 write_register(dev, IPW_REG_AUTOINCREMENT_ADDRESS, aligned_addr);
444 aligned_addr);
445 aligned_len = len & (~0x3); 440 aligned_len = len & (~0x3);
446 for (i = 0; i < aligned_len; i += 4, buf += 4, aligned_addr += 4) 441 for (i = 0; i < aligned_len; i += 4, buf += 4, aligned_addr += 4)
447 write_register( 442 write_register(dev, IPW_REG_AUTOINCREMENT_DATA, *(u32 *) buf);
448 dev, IPW_REG_AUTOINCREMENT_DATA, *(u32 *)buf);
449 443
450 /* copy the last nibble */ 444 /* copy the last nibble */
451 dif_len = len - aligned_len; 445 dif_len = len - aligned_len;
452 write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, aligned_addr); 446 write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, aligned_addr);
453 for (i = 0; i < dif_len; i++, buf++) 447 for (i = 0; i < dif_len; i++, buf++)
454 write_register_byte( 448 write_register_byte(dev, IPW_REG_INDIRECT_ACCESS_DATA + i,
455 dev, IPW_REG_INDIRECT_ACCESS_DATA + i, *buf); 449 *buf);
456} 450}
457 451
458static inline void read_nic_memory(struct net_device *dev, u32 addr, u32 len, 452static inline void read_nic_memory(struct net_device *dev, u32 addr, u32 len,
459 u8 *buf) 453 u8 * buf)
460{ 454{
461 u32 aligned_addr; 455 u32 aligned_addr;
462 u32 aligned_len; 456 u32 aligned_len;
@@ -471,39 +465,38 @@ static inline void read_nic_memory(struct net_device *dev, u32 addr, u32 len,
471 write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, 465 write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS,
472 aligned_addr); 466 aligned_addr);
473 for (i = dif_len; i < 4; i++, buf++) 467 for (i = dif_len; i < 4; i++, buf++)
474 read_register_byte( 468 read_register_byte(dev,
475 dev, IPW_REG_INDIRECT_ACCESS_DATA + i, buf); 469 IPW_REG_INDIRECT_ACCESS_DATA + i,
470 buf);
476 471
477 len -= dif_len; 472 len -= dif_len;
478 aligned_addr += 4; 473 aligned_addr += 4;
479 } 474 }
480 475
481 /* read DWs through autoincrement registers */ 476 /* read DWs through autoincrement registers */
482 write_register(dev, IPW_REG_AUTOINCREMENT_ADDRESS, 477 write_register(dev, IPW_REG_AUTOINCREMENT_ADDRESS, aligned_addr);
483 aligned_addr);
484 aligned_len = len & (~0x3); 478 aligned_len = len & (~0x3);
485 for (i = 0; i < aligned_len; i += 4, buf += 4, aligned_addr += 4) 479 for (i = 0; i < aligned_len; i += 4, buf += 4, aligned_addr += 4)
486 read_register(dev, IPW_REG_AUTOINCREMENT_DATA, 480 read_register(dev, IPW_REG_AUTOINCREMENT_DATA, (u32 *) buf);
487 (u32 *)buf);
488 481
489 /* copy the last nibble */ 482 /* copy the last nibble */
490 dif_len = len - aligned_len; 483 dif_len = len - aligned_len;
491 write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, 484 write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, aligned_addr);
492 aligned_addr);
493 for (i = 0; i < dif_len; i++, buf++) 485 for (i = 0; i < dif_len; i++, buf++)
494 read_register_byte(dev, IPW_REG_INDIRECT_ACCESS_DATA + 486 read_register_byte(dev, IPW_REG_INDIRECT_ACCESS_DATA + i, buf);
495 i, buf);
496} 487}
497 488
498static inline int ipw2100_hw_is_adapter_in_system(struct net_device *dev) 489static inline int ipw2100_hw_is_adapter_in_system(struct net_device *dev)
499{ 490{
500 return (dev->base_addr && 491 return (dev->base_addr &&
501 (readl((void __iomem *)(dev->base_addr + IPW_REG_DOA_DEBUG_AREA_START)) 492 (readl
493 ((void __iomem *)(dev->base_addr +
494 IPW_REG_DOA_DEBUG_AREA_START))
502 == IPW_DATA_DOA_DEBUG_VALUE)); 495 == IPW_DATA_DOA_DEBUG_VALUE));
503} 496}
504 497
505static int ipw2100_get_ordinal(struct ipw2100_priv *priv, u32 ord, 498static int ipw2100_get_ordinal(struct ipw2100_priv *priv, u32 ord,
506 void *val, u32 *len) 499 void *val, u32 * len)
507{ 500{
508 struct ipw2100_ordinals *ordinals = &priv->ordinals; 501 struct ipw2100_ordinals *ordinals = &priv->ordinals;
509 u32 addr; 502 u32 addr;
@@ -529,8 +522,8 @@ static int ipw2100_get_ordinal(struct ipw2100_priv *priv, u32 ord,
529 return -EINVAL; 522 return -EINVAL;
530 } 523 }
531 524
532 read_nic_dword(priv->net_dev, ordinals->table1_addr + (ord << 2), 525 read_nic_dword(priv->net_dev,
533 &addr); 526 ordinals->table1_addr + (ord << 2), &addr);
534 read_nic_dword(priv->net_dev, addr, val); 527 read_nic_dword(priv->net_dev, addr, val);
535 528
536 *len = IPW_ORD_TAB_1_ENTRY_SIZE; 529 *len = IPW_ORD_TAB_1_ENTRY_SIZE;
@@ -543,8 +536,8 @@ static int ipw2100_get_ordinal(struct ipw2100_priv *priv, u32 ord,
543 ord -= IPW_START_ORD_TAB_2; 536 ord -= IPW_START_ORD_TAB_2;
544 537
545 /* get the address of statistic */ 538 /* get the address of statistic */
546 read_nic_dword(priv->net_dev, ordinals->table2_addr + (ord << 3), 539 read_nic_dword(priv->net_dev,
547 &addr); 540 ordinals->table2_addr + (ord << 3), &addr);
548 541
549 /* get the second DW of statistics ; 542 /* get the second DW of statistics ;
550 * two 16-bit words - first is length, second is count */ 543 * two 16-bit words - first is length, second is count */
@@ -553,10 +546,10 @@ static int ipw2100_get_ordinal(struct ipw2100_priv *priv, u32 ord,
553 &field_info); 546 &field_info);
554 547
555 /* get each entry length */ 548 /* get each entry length */
556 field_len = *((u16 *)&field_info); 549 field_len = *((u16 *) & field_info);
557 550
558 /* get number of entries */ 551 /* get number of entries */
559 field_count = *(((u16 *)&field_info) + 1); 552 field_count = *(((u16 *) & field_info) + 1);
560 553
561 /* abort if no enought memory */ 554 /* abort if no enought memory */
562 total_length = field_len * field_count; 555 total_length = field_len * field_count;
@@ -581,8 +574,8 @@ static int ipw2100_get_ordinal(struct ipw2100_priv *priv, u32 ord,
581 return -EINVAL; 574 return -EINVAL;
582} 575}
583 576
584static int ipw2100_set_ordinal(struct ipw2100_priv *priv, u32 ord, u32 *val, 577static int ipw2100_set_ordinal(struct ipw2100_priv *priv, u32 ord, u32 * val,
585 u32 *len) 578 u32 * len)
586{ 579{
587 struct ipw2100_ordinals *ordinals = &priv->ordinals; 580 struct ipw2100_ordinals *ordinals = &priv->ordinals;
588 u32 addr; 581 u32 addr;
@@ -594,8 +587,8 @@ static int ipw2100_set_ordinal(struct ipw2100_priv *priv, u32 ord, u32 *val,
594 return -EINVAL; 587 return -EINVAL;
595 } 588 }
596 589
597 read_nic_dword(priv->net_dev, ordinals->table1_addr + (ord << 2), 590 read_nic_dword(priv->net_dev,
598 &addr); 591 ordinals->table1_addr + (ord << 2), &addr);
599 592
600 write_nic_dword(priv->net_dev, addr, *val); 593 write_nic_dword(priv->net_dev, addr, *val);
601 594
@@ -612,7 +605,7 @@ static int ipw2100_set_ordinal(struct ipw2100_priv *priv, u32 ord, u32 *val,
612} 605}
613 606
614static char *snprint_line(char *buf, size_t count, 607static char *snprint_line(char *buf, size_t count,
615 const u8 *data, u32 len, u32 ofs) 608 const u8 * data, u32 len, u32 ofs)
616{ 609{
617 int out, i, j, l; 610 int out, i, j, l;
618 char c; 611 char c;
@@ -646,7 +639,7 @@ static char *snprint_line(char *buf, size_t count,
646 return buf; 639 return buf;
647} 640}
648 641
649static void printk_buf(int level, const u8 *data, u32 len) 642static void printk_buf(int level, const u8 * data, u32 len)
650{ 643{
651 char line[81]; 644 char line[81];
652 u32 ofs = 0; 645 u32 ofs = 0;
@@ -662,8 +655,6 @@ static void printk_buf(int level, const u8 *data, u32 len)
662 } 655 }
663} 656}
664 657
665
666
667#define MAX_RESET_BACKOFF 10 658#define MAX_RESET_BACKOFF 10
668 659
669static inline void schedule_reset(struct ipw2100_priv *priv) 660static inline void schedule_reset(struct ipw2100_priv *priv)
@@ -703,7 +694,7 @@ static inline void schedule_reset(struct ipw2100_priv *priv)
703 694
704#define HOST_COMPLETE_TIMEOUT (2 * HZ) 695#define HOST_COMPLETE_TIMEOUT (2 * HZ)
705static int ipw2100_hw_send_command(struct ipw2100_priv *priv, 696static int ipw2100_hw_send_command(struct ipw2100_priv *priv,
706 struct host_command * cmd) 697 struct host_command *cmd)
707{ 698{
708 struct list_head *element; 699 struct list_head *element;
709 struct ipw2100_tx_packet *packet; 700 struct ipw2100_tx_packet *packet;
@@ -713,25 +704,28 @@ static int ipw2100_hw_send_command(struct ipw2100_priv *priv,
713 IPW_DEBUG_HC("Sending %s command (#%d), %d bytes\n", 704 IPW_DEBUG_HC("Sending %s command (#%d), %d bytes\n",
714 command_types[cmd->host_command], cmd->host_command, 705 command_types[cmd->host_command], cmd->host_command,
715 cmd->host_command_length); 706 cmd->host_command_length);
716 printk_buf(IPW_DL_HC, (u8*)cmd->host_command_parameters, 707 printk_buf(IPW_DL_HC, (u8 *) cmd->host_command_parameters,
717 cmd->host_command_length); 708 cmd->host_command_length);
718 709
719 spin_lock_irqsave(&priv->low_lock, flags); 710 spin_lock_irqsave(&priv->low_lock, flags);
720 711
721 if (priv->fatal_error) { 712 if (priv->fatal_error) {
722 IPW_DEBUG_INFO("Attempt to send command while hardware in fatal error condition.\n"); 713 IPW_DEBUG_INFO
714 ("Attempt to send command while hardware in fatal error condition.\n");
723 err = -EIO; 715 err = -EIO;
724 goto fail_unlock; 716 goto fail_unlock;
725 } 717 }
726 718
727 if (!(priv->status & STATUS_RUNNING)) { 719 if (!(priv->status & STATUS_RUNNING)) {
728 IPW_DEBUG_INFO("Attempt to send command while hardware is not running.\n"); 720 IPW_DEBUG_INFO
721 ("Attempt to send command while hardware is not running.\n");
729 err = -EIO; 722 err = -EIO;
730 goto fail_unlock; 723 goto fail_unlock;
731 } 724 }
732 725
733 if (priv->status & STATUS_CMD_ACTIVE) { 726 if (priv->status & STATUS_CMD_ACTIVE) {
734 IPW_DEBUG_INFO("Attempt to send command while another command is pending.\n"); 727 IPW_DEBUG_INFO
728 ("Attempt to send command while another command is pending.\n");
735 err = -EBUSY; 729 err = -EBUSY;
736 goto fail_unlock; 730 goto fail_unlock;
737 } 731 }
@@ -752,7 +746,8 @@ static int ipw2100_hw_send_command(struct ipw2100_priv *priv,
752 /* initialize the firmware command packet */ 746 /* initialize the firmware command packet */
753 packet->info.c_struct.cmd->host_command_reg = cmd->host_command; 747 packet->info.c_struct.cmd->host_command_reg = cmd->host_command;
754 packet->info.c_struct.cmd->host_command_reg1 = cmd->host_command1; 748 packet->info.c_struct.cmd->host_command_reg1 = cmd->host_command1;
755 packet->info.c_struct.cmd->host_command_len_reg = cmd->host_command_length; 749 packet->info.c_struct.cmd->host_command_len_reg =
750 cmd->host_command_length;
756 packet->info.c_struct.cmd->sequence = cmd->host_command_sequence; 751 packet->info.c_struct.cmd->sequence = cmd->host_command_sequence;
757 752
758 memcpy(packet->info.c_struct.cmd->host_command_params_reg, 753 memcpy(packet->info.c_struct.cmd->host_command_params_reg,
@@ -776,9 +771,11 @@ static int ipw2100_hw_send_command(struct ipw2100_priv *priv,
776 * then there is a problem. 771 * then there is a problem.
777 */ 772 */
778 773
779 err = wait_event_interruptible_timeout( 774 err =
780 priv->wait_command_queue, !(priv->status & STATUS_CMD_ACTIVE), 775 wait_event_interruptible_timeout(priv->wait_command_queue,
781 HOST_COMPLETE_TIMEOUT); 776 !(priv->
777 status & STATUS_CMD_ACTIVE),
778 HOST_COMPLETE_TIMEOUT);
782 779
783 if (err == 0) { 780 if (err == 0) {
784 IPW_DEBUG_INFO("Command completion failed out after %dms.\n", 781 IPW_DEBUG_INFO("Command completion failed out after %dms.\n",
@@ -804,13 +801,12 @@ static int ipw2100_hw_send_command(struct ipw2100_priv *priv,
804 801
805 return 0; 802 return 0;
806 803
807 fail_unlock: 804 fail_unlock:
808 spin_unlock_irqrestore(&priv->low_lock, flags); 805 spin_unlock_irqrestore(&priv->low_lock, flags);
809 806
810 return err; 807 return err;
811} 808}
812 809
813
814/* 810/*
815 * Verify the values and data access of the hardware 811 * Verify the values and data access of the hardware
816 * No locks needed or used. No functions called. 812 * No locks needed or used. No functions called.
@@ -825,8 +821,7 @@ static int ipw2100_verify(struct ipw2100_priv *priv)
825 821
826 /* Domain 0 check - all values should be DOA_DEBUG */ 822 /* Domain 0 check - all values should be DOA_DEBUG */
827 for (address = IPW_REG_DOA_DEBUG_AREA_START; 823 for (address = IPW_REG_DOA_DEBUG_AREA_START;
828 address < IPW_REG_DOA_DEBUG_AREA_END; 824 address < IPW_REG_DOA_DEBUG_AREA_END; address += sizeof(u32)) {
829 address += sizeof(u32)) {
830 read_register(priv->net_dev, address, &data1); 825 read_register(priv->net_dev, address, &data1);
831 if (data1 != IPW_DATA_DOA_DEBUG_VALUE) 826 if (data1 != IPW_DATA_DOA_DEBUG_VALUE)
832 return -EIO; 827 return -EIO;
@@ -898,7 +893,6 @@ static int ipw2100_wait_for_card_state(struct ipw2100_priv *priv, int state)
898 return -EIO; 893 return -EIO;
899} 894}
900 895
901
902/********************************************************************* 896/*********************************************************************
903 Procedure : sw_reset_and_clock 897 Procedure : sw_reset_and_clock
904 Purpose : Asserts s/w reset, asserts clock initialization 898 Purpose : Asserts s/w reset, asserts clock initialization
@@ -975,17 +969,16 @@ static int ipw2100_download_firmware(struct ipw2100_priv *priv)
975 969
976 if (priv->fatal_error) { 970 if (priv->fatal_error) {
977 IPW_DEBUG_ERROR("%s: ipw2100_download_firmware called after " 971 IPW_DEBUG_ERROR("%s: ipw2100_download_firmware called after "
978 "fatal error %d. Interface must be brought down.\n", 972 "fatal error %d. Interface must be brought down.\n",
979 priv->net_dev->name, priv->fatal_error); 973 priv->net_dev->name, priv->fatal_error);
980 return -EINVAL; 974 return -EINVAL;
981 } 975 }
982
983#ifdef CONFIG_PM 976#ifdef CONFIG_PM
984 if (!ipw2100_firmware.version) { 977 if (!ipw2100_firmware.version) {
985 err = ipw2100_get_firmware(priv, &ipw2100_firmware); 978 err = ipw2100_get_firmware(priv, &ipw2100_firmware);
986 if (err) { 979 if (err) {
987 IPW_DEBUG_ERROR("%s: ipw2100_get_firmware failed: %d\n", 980 IPW_DEBUG_ERROR("%s: ipw2100_get_firmware failed: %d\n",
988 priv->net_dev->name, err); 981 priv->net_dev->name, err);
989 priv->fatal_error = IPW2100_ERR_FW_LOAD; 982 priv->fatal_error = IPW2100_ERR_FW_LOAD;
990 goto fail; 983 goto fail;
991 } 984 }
@@ -994,7 +987,7 @@ static int ipw2100_download_firmware(struct ipw2100_priv *priv)
994 err = ipw2100_get_firmware(priv, &ipw2100_firmware); 987 err = ipw2100_get_firmware(priv, &ipw2100_firmware);
995 if (err) { 988 if (err) {
996 IPW_DEBUG_ERROR("%s: ipw2100_get_firmware failed: %d\n", 989 IPW_DEBUG_ERROR("%s: ipw2100_get_firmware failed: %d\n",
997 priv->net_dev->name, err); 990 priv->net_dev->name, err);
998 priv->fatal_error = IPW2100_ERR_FW_LOAD; 991 priv->fatal_error = IPW2100_ERR_FW_LOAD;
999 goto fail; 992 goto fail;
1000 } 993 }
@@ -1005,21 +998,20 @@ static int ipw2100_download_firmware(struct ipw2100_priv *priv)
1005 err = sw_reset_and_clock(priv); 998 err = sw_reset_and_clock(priv);
1006 if (err) { 999 if (err) {
1007 IPW_DEBUG_ERROR("%s: sw_reset_and_clock failed: %d\n", 1000 IPW_DEBUG_ERROR("%s: sw_reset_and_clock failed: %d\n",
1008 priv->net_dev->name, err); 1001 priv->net_dev->name, err);
1009 goto fail; 1002 goto fail;
1010 } 1003 }
1011 1004
1012 err = ipw2100_verify(priv); 1005 err = ipw2100_verify(priv);
1013 if (err) { 1006 if (err) {
1014 IPW_DEBUG_ERROR("%s: ipw2100_verify failed: %d\n", 1007 IPW_DEBUG_ERROR("%s: ipw2100_verify failed: %d\n",
1015 priv->net_dev->name, err); 1008 priv->net_dev->name, err);
1016 goto fail; 1009 goto fail;
1017 } 1010 }
1018 1011
1019 /* Hold ARC */ 1012 /* Hold ARC */
1020 write_nic_dword(priv->net_dev, 1013 write_nic_dword(priv->net_dev,
1021 IPW_INTERNAL_REGISTER_HALT_AND_RESET, 1014 IPW_INTERNAL_REGISTER_HALT_AND_RESET, 0x80000000);
1022 0x80000000);
1023 1015
1024 /* allow ARC to run */ 1016 /* allow ARC to run */
1025 write_register(priv->net_dev, IPW_REG_RESET_REG, 0); 1017 write_register(priv->net_dev, IPW_REG_RESET_REG, 0);
@@ -1034,13 +1026,13 @@ static int ipw2100_download_firmware(struct ipw2100_priv *priv)
1034 1026
1035 /* release ARC */ 1027 /* release ARC */
1036 write_nic_dword(priv->net_dev, 1028 write_nic_dword(priv->net_dev,
1037 IPW_INTERNAL_REGISTER_HALT_AND_RESET, 1029 IPW_INTERNAL_REGISTER_HALT_AND_RESET, 0x00000000);
1038 0x00000000);
1039 1030
1040 /* s/w reset and clock stabilization (again!!!) */ 1031 /* s/w reset and clock stabilization (again!!!) */
1041 err = sw_reset_and_clock(priv); 1032 err = sw_reset_and_clock(priv);
1042 if (err) { 1033 if (err) {
1043 printk(KERN_ERR DRV_NAME ": %s: sw_reset_and_clock failed: %d\n", 1034 printk(KERN_ERR DRV_NAME
1035 ": %s: sw_reset_and_clock failed: %d\n",
1044 priv->net_dev->name, err); 1036 priv->net_dev->name, err);
1045 goto fail; 1037 goto fail;
1046 } 1038 }
@@ -1049,10 +1041,9 @@ static int ipw2100_download_firmware(struct ipw2100_priv *priv)
1049 err = ipw2100_fw_download(priv, &ipw2100_firmware); 1041 err = ipw2100_fw_download(priv, &ipw2100_firmware);
1050 if (err) { 1042 if (err) {
1051 IPW_DEBUG_ERROR("%s: Error loading firmware: %d\n", 1043 IPW_DEBUG_ERROR("%s: Error loading firmware: %d\n",
1052 priv->net_dev->name, err); 1044 priv->net_dev->name, err);
1053 goto fail; 1045 goto fail;
1054 } 1046 }
1055
1056#ifndef CONFIG_PM 1047#ifndef CONFIG_PM
1057 /* 1048 /*
1058 * When the .resume method of the driver is called, the other 1049 * When the .resume method of the driver is called, the other
@@ -1084,7 +1075,7 @@ static int ipw2100_download_firmware(struct ipw2100_priv *priv)
1084 1075
1085 return 0; 1076 return 0;
1086 1077
1087 fail: 1078 fail:
1088 ipw2100_release_firmware(priv, &ipw2100_firmware); 1079 ipw2100_release_firmware(priv, &ipw2100_firmware);
1089 return err; 1080 return err;
1090} 1081}
@@ -1105,7 +1096,6 @@ static inline void ipw2100_disable_interrupts(struct ipw2100_priv *priv)
1105 write_register(priv->net_dev, IPW_REG_INTA_MASK, 0x0); 1096 write_register(priv->net_dev, IPW_REG_INTA_MASK, 0x0);
1106} 1097}
1107 1098
1108
1109static void ipw2100_initialize_ordinals(struct ipw2100_priv *priv) 1099static void ipw2100_initialize_ordinals(struct ipw2100_priv *priv)
1110{ 1100{
1111 struct ipw2100_ordinals *ord = &priv->ordinals; 1101 struct ipw2100_ordinals *ord = &priv->ordinals;
@@ -1177,11 +1167,10 @@ static int ipw2100_get_hw_features(struct ipw2100_priv *priv)
1177 * EEPROM_SRAM_DB_START_ADDRESS using ordinal in ordinal table 1 1167 * EEPROM_SRAM_DB_START_ADDRESS using ordinal in ordinal table 1
1178 */ 1168 */
1179 len = sizeof(addr); 1169 len = sizeof(addr);
1180 if (ipw2100_get_ordinal( 1170 if (ipw2100_get_ordinal
1181 priv, IPW_ORD_EEPROM_SRAM_DB_BLOCK_START_ADDRESS, 1171 (priv, IPW_ORD_EEPROM_SRAM_DB_BLOCK_START_ADDRESS, &addr, &len)) {
1182 &addr, &len)) {
1183 IPW_DEBUG_INFO("failed querying ordinals at line %d\n", 1172 IPW_DEBUG_INFO("failed querying ordinals at line %d\n",
1184 __LINE__); 1173 __LINE__);
1185 return -EIO; 1174 return -EIO;
1186 } 1175 }
1187 1176
@@ -1194,7 +1183,7 @@ static int ipw2100_get_hw_features(struct ipw2100_priv *priv)
1194 priv->eeprom_version = (val >> 24) & 0xFF; 1183 priv->eeprom_version = (val >> 24) & 0xFF;
1195 IPW_DEBUG_INFO("EEPROM version: %d\n", priv->eeprom_version); 1184 IPW_DEBUG_INFO("EEPROM version: %d\n", priv->eeprom_version);
1196 1185
1197 /* 1186 /*
1198 * HW RF Kill enable is bit 0 in byte at offset 0x21 in firmware 1187 * HW RF Kill enable is bit 0 in byte at offset 0x21 in firmware
1199 * 1188 *
1200 * notice that the EEPROM bit is reverse polarity, i.e. 1189 * notice that the EEPROM bit is reverse polarity, i.e.
@@ -1206,8 +1195,7 @@ static int ipw2100_get_hw_features(struct ipw2100_priv *priv)
1206 priv->hw_features |= HW_FEATURE_RFKILL; 1195 priv->hw_features |= HW_FEATURE_RFKILL;
1207 1196
1208 IPW_DEBUG_INFO("HW RF Kill: %ssupported.\n", 1197 IPW_DEBUG_INFO("HW RF Kill: %ssupported.\n",
1209 (priv->hw_features & HW_FEATURE_RFKILL) ? 1198 (priv->hw_features & HW_FEATURE_RFKILL) ? "" : "not ");
1210 "" : "not ");
1211 1199
1212 return 0; 1200 return 0;
1213} 1201}
@@ -1234,7 +1222,8 @@ static int ipw2100_start_adapter(struct ipw2100_priv *priv)
1234 * fw & dino ucode 1222 * fw & dino ucode
1235 */ 1223 */
1236 if (ipw2100_download_firmware(priv)) { 1224 if (ipw2100_download_firmware(priv)) {
1237 printk(KERN_ERR DRV_NAME ": %s: Failed to power on the adapter.\n", 1225 printk(KERN_ERR DRV_NAME
1226 ": %s: Failed to power on the adapter.\n",
1238 priv->net_dev->name); 1227 priv->net_dev->name);
1239 return -EIO; 1228 return -EIO;
1240 } 1229 }
@@ -1293,7 +1282,8 @@ static int ipw2100_start_adapter(struct ipw2100_priv *priv)
1293 i ? "SUCCESS" : "FAILED"); 1282 i ? "SUCCESS" : "FAILED");
1294 1283
1295 if (!i) { 1284 if (!i) {
1296 printk(KERN_WARNING DRV_NAME ": %s: Firmware did not initialize.\n", 1285 printk(KERN_WARNING DRV_NAME
1286 ": %s: Firmware did not initialize.\n",
1297 priv->net_dev->name); 1287 priv->net_dev->name);
1298 return -EIO; 1288 return -EIO;
1299 } 1289 }
@@ -1326,7 +1316,6 @@ static inline void ipw2100_reset_fatalerror(struct ipw2100_priv *priv)
1326 priv->fatal_error = 0; 1316 priv->fatal_error = 0;
1327} 1317}
1328 1318
1329
1330/* NOTE: Our interrupt is disabled when this method is called */ 1319/* NOTE: Our interrupt is disabled when this method is called */
1331static int ipw2100_power_cycle_adapter(struct ipw2100_priv *priv) 1320static int ipw2100_power_cycle_adapter(struct ipw2100_priv *priv)
1332{ 1321{
@@ -1350,19 +1339,19 @@ static int ipw2100_power_cycle_adapter(struct ipw2100_priv *priv)
1350 1339
1351 if (reg & IPW_AUX_HOST_RESET_REG_MASTER_DISABLED) 1340 if (reg & IPW_AUX_HOST_RESET_REG_MASTER_DISABLED)
1352 break; 1341 break;
1353 } while(i--); 1342 } while (i--);
1354 1343
1355 priv->status &= ~STATUS_RESET_PENDING; 1344 priv->status &= ~STATUS_RESET_PENDING;
1356 1345
1357 if (!i) { 1346 if (!i) {
1358 IPW_DEBUG_INFO("exit - waited too long for master assert stop\n"); 1347 IPW_DEBUG_INFO
1348 ("exit - waited too long for master assert stop\n");
1359 return -EIO; 1349 return -EIO;
1360 } 1350 }
1361 1351
1362 write_register(priv->net_dev, IPW_REG_RESET_REG, 1352 write_register(priv->net_dev, IPW_REG_RESET_REG,
1363 IPW_AUX_HOST_RESET_REG_SW_RESET); 1353 IPW_AUX_HOST_RESET_REG_SW_RESET);
1364 1354
1365
1366 /* Reset any fatal_error conditions */ 1355 /* Reset any fatal_error conditions */
1367 ipw2100_reset_fatalerror(priv); 1356 ipw2100_reset_fatalerror(priv);
1368 1357
@@ -1415,7 +1404,6 @@ static int ipw2100_hw_phy_off(struct ipw2100_priv *priv)
1415 return -EIO; 1404 return -EIO;
1416} 1405}
1417 1406
1418
1419static int ipw2100_enable_adapter(struct ipw2100_priv *priv) 1407static int ipw2100_enable_adapter(struct ipw2100_priv *priv)
1420{ 1408{
1421 struct host_command cmd = { 1409 struct host_command cmd = {
@@ -1445,9 +1433,8 @@ static int ipw2100_enable_adapter(struct ipw2100_priv *priv)
1445 1433
1446 err = ipw2100_wait_for_card_state(priv, IPW_HW_STATE_ENABLED); 1434 err = ipw2100_wait_for_card_state(priv, IPW_HW_STATE_ENABLED);
1447 if (err) { 1435 if (err) {
1448 IPW_DEBUG_INFO( 1436 IPW_DEBUG_INFO("%s: card not responding to init command.\n",
1449 "%s: card not responding to init command.\n", 1437 priv->net_dev->name);
1450 priv->net_dev->name);
1451 goto fail_up; 1438 goto fail_up;
1452 } 1439 }
1453 1440
@@ -1456,7 +1443,7 @@ static int ipw2100_enable_adapter(struct ipw2100_priv *priv)
1456 queue_delayed_work(priv->workqueue, &priv->hang_check, HZ / 2); 1443 queue_delayed_work(priv->workqueue, &priv->hang_check, HZ / 2);
1457 } 1444 }
1458 1445
1459fail_up: 1446 fail_up:
1460 up(&priv->adapter_sem); 1447 up(&priv->adapter_sem);
1461 return err; 1448 return err;
1462} 1449}
@@ -1488,7 +1475,8 @@ static int ipw2100_hw_stop_adapter(struct ipw2100_priv *priv)
1488 1475
1489 err = ipw2100_hw_phy_off(priv); 1476 err = ipw2100_hw_phy_off(priv);
1490 if (err) 1477 if (err)
1491 printk(KERN_WARNING DRV_NAME ": Error disabling radio %d\n", err); 1478 printk(KERN_WARNING DRV_NAME
1479 ": Error disabling radio %d\n", err);
1492 1480
1493 /* 1481 /*
1494 * If in D0-standby mode going directly to D3 may cause a 1482 * If in D0-standby mode going directly to D3 may cause a
@@ -1566,7 +1554,6 @@ static int ipw2100_hw_stop_adapter(struct ipw2100_priv *priv)
1566 return 0; 1554 return 0;
1567} 1555}
1568 1556
1569
1570static int ipw2100_disable_adapter(struct ipw2100_priv *priv) 1557static int ipw2100_disable_adapter(struct ipw2100_priv *priv)
1571{ 1558{
1572 struct host_command cmd = { 1559 struct host_command cmd = {
@@ -1593,19 +1580,21 @@ static int ipw2100_disable_adapter(struct ipw2100_priv *priv)
1593 1580
1594 err = ipw2100_hw_send_command(priv, &cmd); 1581 err = ipw2100_hw_send_command(priv, &cmd);
1595 if (err) { 1582 if (err) {
1596 printk(KERN_WARNING DRV_NAME ": exit - failed to send CARD_DISABLE command\n"); 1583 printk(KERN_WARNING DRV_NAME
1584 ": exit - failed to send CARD_DISABLE command\n");
1597 goto fail_up; 1585 goto fail_up;
1598 } 1586 }
1599 1587
1600 err = ipw2100_wait_for_card_state(priv, IPW_HW_STATE_DISABLED); 1588 err = ipw2100_wait_for_card_state(priv, IPW_HW_STATE_DISABLED);
1601 if (err) { 1589 if (err) {
1602 printk(KERN_WARNING DRV_NAME ": exit - card failed to change to DISABLED\n"); 1590 printk(KERN_WARNING DRV_NAME
1591 ": exit - card failed to change to DISABLED\n");
1603 goto fail_up; 1592 goto fail_up;
1604 } 1593 }
1605 1594
1606 IPW_DEBUG_INFO("TODO: implement scan state machine\n"); 1595 IPW_DEBUG_INFO("TODO: implement scan state machine\n");
1607 1596
1608fail_up: 1597 fail_up:
1609 up(&priv->adapter_sem); 1598 up(&priv->adapter_sem);
1610 return err; 1599 return err;
1611} 1600}
@@ -1709,8 +1698,9 @@ static int ipw2100_up(struct ipw2100_priv *priv, int deferred)
1709 (priv->status & STATUS_RESET_PENDING)) { 1698 (priv->status & STATUS_RESET_PENDING)) {
1710 /* Power cycle the card ... */ 1699 /* Power cycle the card ... */
1711 if (ipw2100_power_cycle_adapter(priv)) { 1700 if (ipw2100_power_cycle_adapter(priv)) {
1712 printk(KERN_WARNING DRV_NAME ": %s: Could not cycle adapter.\n", 1701 printk(KERN_WARNING DRV_NAME
1713 priv->net_dev->name); 1702 ": %s: Could not cycle adapter.\n",
1703 priv->net_dev->name);
1714 rc = 1; 1704 rc = 1;
1715 goto exit; 1705 goto exit;
1716 } 1706 }
@@ -1719,8 +1709,9 @@ static int ipw2100_up(struct ipw2100_priv *priv, int deferred)
1719 1709
1720 /* Load the firmware, start the clocks, etc. */ 1710 /* Load the firmware, start the clocks, etc. */
1721 if (ipw2100_start_adapter(priv)) { 1711 if (ipw2100_start_adapter(priv)) {
1722 printk(KERN_ERR DRV_NAME ": %s: Failed to start the firmware.\n", 1712 printk(KERN_ERR DRV_NAME
1723 priv->net_dev->name); 1713 ": %s: Failed to start the firmware.\n",
1714 priv->net_dev->name);
1724 rc = 1; 1715 rc = 1;
1725 goto exit; 1716 goto exit;
1726 } 1717 }
@@ -1729,16 +1720,18 @@ static int ipw2100_up(struct ipw2100_priv *priv, int deferred)
1729 1720
1730 /* Determine capabilities of this particular HW configuration */ 1721 /* Determine capabilities of this particular HW configuration */
1731 if (ipw2100_get_hw_features(priv)) { 1722 if (ipw2100_get_hw_features(priv)) {
1732 printk(KERN_ERR DRV_NAME ": %s: Failed to determine HW features.\n", 1723 printk(KERN_ERR DRV_NAME
1733 priv->net_dev->name); 1724 ": %s: Failed to determine HW features.\n",
1725 priv->net_dev->name);
1734 rc = 1; 1726 rc = 1;
1735 goto exit; 1727 goto exit;
1736 } 1728 }
1737 1729
1738 lock = LOCK_NONE; 1730 lock = LOCK_NONE;
1739 if (ipw2100_set_ordinal(priv, IPW_ORD_PERS_DB_LOCK, &lock, &ord_len)) { 1731 if (ipw2100_set_ordinal(priv, IPW_ORD_PERS_DB_LOCK, &lock, &ord_len)) {
1740 printk(KERN_ERR DRV_NAME ": %s: Failed to clear ordinal lock.\n", 1732 printk(KERN_ERR DRV_NAME
1741 priv->net_dev->name); 1733 ": %s: Failed to clear ordinal lock.\n",
1734 priv->net_dev->name);
1742 rc = 1; 1735 rc = 1;
1743 goto exit; 1736 goto exit;
1744 } 1737 }
@@ -1764,7 +1757,7 @@ static int ipw2100_up(struct ipw2100_priv *priv, int deferred)
1764 * HOST_COMPLETE */ 1757 * HOST_COMPLETE */
1765 if (ipw2100_adapter_setup(priv)) { 1758 if (ipw2100_adapter_setup(priv)) {
1766 printk(KERN_ERR DRV_NAME ": %s: Failed to start the card.\n", 1759 printk(KERN_ERR DRV_NAME ": %s: Failed to start the card.\n",
1767 priv->net_dev->name); 1760 priv->net_dev->name);
1768 rc = 1; 1761 rc = 1;
1769 goto exit; 1762 goto exit;
1770 } 1763 }
@@ -1773,20 +1766,19 @@ static int ipw2100_up(struct ipw2100_priv *priv, int deferred)
1773 /* Enable the adapter - sends HOST_COMPLETE */ 1766 /* Enable the adapter - sends HOST_COMPLETE */
1774 if (ipw2100_enable_adapter(priv)) { 1767 if (ipw2100_enable_adapter(priv)) {
1775 printk(KERN_ERR DRV_NAME ": " 1768 printk(KERN_ERR DRV_NAME ": "
1776 "%s: failed in call to enable adapter.\n", 1769 "%s: failed in call to enable adapter.\n",
1777 priv->net_dev->name); 1770 priv->net_dev->name);
1778 ipw2100_hw_stop_adapter(priv); 1771 ipw2100_hw_stop_adapter(priv);
1779 rc = 1; 1772 rc = 1;
1780 goto exit; 1773 goto exit;
1781 } 1774 }
1782 1775
1783
1784 /* Start a scan . . . */ 1776 /* Start a scan . . . */
1785 ipw2100_set_scan_options(priv); 1777 ipw2100_set_scan_options(priv);
1786 ipw2100_start_scan(priv); 1778 ipw2100_start_scan(priv);
1787 } 1779 }
1788 1780
1789 exit: 1781 exit:
1790 return rc; 1782 return rc;
1791} 1783}
1792 1784
@@ -1802,8 +1794,7 @@ static void ipw2100_down(struct ipw2100_priv *priv)
1802 unsigned long flags; 1794 unsigned long flags;
1803 union iwreq_data wrqu = { 1795 union iwreq_data wrqu = {
1804 .ap_addr = { 1796 .ap_addr = {
1805 .sa_family = ARPHRD_ETHER 1797 .sa_family = ARPHRD_ETHER}
1806 }
1807 }; 1798 };
1808 int associated = priv->status & STATUS_ASSOCIATED; 1799 int associated = priv->status & STATUS_ASSOCIATED;
1809 1800
@@ -1862,8 +1853,7 @@ static void ipw2100_reset_adapter(struct ipw2100_priv *priv)
1862 unsigned long flags; 1853 unsigned long flags;
1863 union iwreq_data wrqu = { 1854 union iwreq_data wrqu = {
1864 .ap_addr = { 1855 .ap_addr = {
1865 .sa_family = ARPHRD_ETHER 1856 .sa_family = ARPHRD_ETHER}
1866 }
1867 }; 1857 };
1868 int associated = priv->status & STATUS_ASSOCIATED; 1858 int associated = priv->status & STATUS_ASSOCIATED;
1869 1859
@@ -1894,7 +1884,6 @@ static void ipw2100_reset_adapter(struct ipw2100_priv *priv)
1894 1884
1895} 1885}
1896 1886
1897
1898static void isr_indicate_associated(struct ipw2100_priv *priv, u32 status) 1887static void isr_indicate_associated(struct ipw2100_priv *priv, u32 status)
1899{ 1888{
1900 1889
@@ -1904,7 +1893,7 @@ static void isr_indicate_associated(struct ipw2100_priv *priv, u32 status)
1904 u32 txrate; 1893 u32 txrate;
1905 u32 chan; 1894 u32 chan;
1906 char *txratename; 1895 char *txratename;
1907 u8 bssid[ETH_ALEN]; 1896 u8 bssid[ETH_ALEN];
1908 1897
1909 /* 1898 /*
1910 * TBD: BSSID is usually 00:00:00:00:00:00 here and not 1899 * TBD: BSSID is usually 00:00:00:00:00:00 here and not
@@ -1918,16 +1907,15 @@ static void isr_indicate_associated(struct ipw2100_priv *priv, u32 status)
1918 essid, &essid_len); 1907 essid, &essid_len);
1919 if (ret) { 1908 if (ret) {
1920 IPW_DEBUG_INFO("failed querying ordinals at line %d\n", 1909 IPW_DEBUG_INFO("failed querying ordinals at line %d\n",
1921 __LINE__); 1910 __LINE__);
1922 return; 1911 return;
1923 } 1912 }
1924 1913
1925 len = sizeof(u32); 1914 len = sizeof(u32);
1926 ret = ipw2100_get_ordinal(priv, IPW_ORD_CURRENT_TX_RATE, 1915 ret = ipw2100_get_ordinal(priv, IPW_ORD_CURRENT_TX_RATE, &txrate, &len);
1927 &txrate, &len);
1928 if (ret) { 1916 if (ret) {
1929 IPW_DEBUG_INFO("failed querying ordinals at line %d\n", 1917 IPW_DEBUG_INFO("failed querying ordinals at line %d\n",
1930 __LINE__); 1918 __LINE__);
1931 return; 1919 return;
1932 } 1920 }
1933 1921
@@ -1935,19 +1923,18 @@ static void isr_indicate_associated(struct ipw2100_priv *priv, u32 status)
1935 ret = ipw2100_get_ordinal(priv, IPW_ORD_OUR_FREQ, &chan, &len); 1923 ret = ipw2100_get_ordinal(priv, IPW_ORD_OUR_FREQ, &chan, &len);
1936 if (ret) { 1924 if (ret) {
1937 IPW_DEBUG_INFO("failed querying ordinals at line %d\n", 1925 IPW_DEBUG_INFO("failed querying ordinals at line %d\n",
1938 __LINE__); 1926 __LINE__);
1939 return; 1927 return;
1940 } 1928 }
1941 len = ETH_ALEN; 1929 len = ETH_ALEN;
1942 ipw2100_get_ordinal(priv, IPW_ORD_STAT_ASSN_AP_BSSID, &bssid, &len); 1930 ipw2100_get_ordinal(priv, IPW_ORD_STAT_ASSN_AP_BSSID, &bssid, &len);
1943 if (ret) { 1931 if (ret) {
1944 IPW_DEBUG_INFO("failed querying ordinals at line %d\n", 1932 IPW_DEBUG_INFO("failed querying ordinals at line %d\n",
1945 __LINE__); 1933 __LINE__);
1946 return; 1934 return;
1947 } 1935 }
1948 memcpy(priv->ieee->bssid, bssid, ETH_ALEN); 1936 memcpy(priv->ieee->bssid, bssid, ETH_ALEN);
1949 1937
1950
1951 switch (txrate) { 1938 switch (txrate) {
1952 case TX_RATE_1_MBIT: 1939 case TX_RATE_1_MBIT:
1953 txratename = "1Mbps"; 1940 txratename = "1Mbps";
@@ -1974,7 +1961,7 @@ static void isr_indicate_associated(struct ipw2100_priv *priv, u32 status)
1974 1961
1975 /* now we copy read ssid into dev */ 1962 /* now we copy read ssid into dev */
1976 if (!(priv->config & CFG_STATIC_ESSID)) { 1963 if (!(priv->config & CFG_STATIC_ESSID)) {
1977 priv->essid_len = min((u8)essid_len, (u8)IW_ESSID_MAX_SIZE); 1964 priv->essid_len = min((u8) essid_len, (u8) IW_ESSID_MAX_SIZE);
1978 memcpy(priv->essid, essid, priv->essid_len); 1965 memcpy(priv->essid, essid, priv->essid_len);
1979 } 1966 }
1980 priv->channel = chan; 1967 priv->channel = chan;
@@ -1986,7 +1973,6 @@ static void isr_indicate_associated(struct ipw2100_priv *priv, u32 status)
1986 queue_delayed_work(priv->workqueue, &priv->wx_event_work, HZ / 10); 1973 queue_delayed_work(priv->workqueue, &priv->wx_event_work, HZ / 10);
1987} 1974}
1988 1975
1989
1990static int ipw2100_set_essid(struct ipw2100_priv *priv, char *essid, 1976static int ipw2100_set_essid(struct ipw2100_priv *priv, char *essid,
1991 int length, int batch_mode) 1977 int length, int batch_mode)
1992{ 1978{
@@ -2001,8 +1987,7 @@ static int ipw2100_set_essid(struct ipw2100_priv *priv, char *essid,
2001 IPW_DEBUG_HC("SSID: '%s'\n", escape_essid(essid, ssid_len)); 1987 IPW_DEBUG_HC("SSID: '%s'\n", escape_essid(essid, ssid_len));
2002 1988
2003 if (ssid_len) 1989 if (ssid_len)
2004 memcpy((char*)cmd.host_command_parameters, 1990 memcpy((char *)cmd.host_command_parameters, essid, ssid_len);
2005 essid, ssid_len);
2006 1991
2007 if (!batch_mode) { 1992 if (!batch_mode) {
2008 err = ipw2100_disable_adapter(priv); 1993 err = ipw2100_disable_adapter(priv);
@@ -2014,7 +1999,7 @@ static int ipw2100_set_essid(struct ipw2100_priv *priv, char *essid,
2014 * disable auto association -- so we cheat by setting a bogus SSID */ 1999 * disable auto association -- so we cheat by setting a bogus SSID */
2015 if (!ssid_len && !(priv->config & CFG_ASSOCIATE)) { 2000 if (!ssid_len && !(priv->config & CFG_ASSOCIATE)) {
2016 int i; 2001 int i;
2017 u8 *bogus = (u8*)cmd.host_command_parameters; 2002 u8 *bogus = (u8 *) cmd.host_command_parameters;
2018 for (i = 0; i < IW_ESSID_MAX_SIZE; i++) 2003 for (i = 0; i < IW_ESSID_MAX_SIZE; i++)
2019 bogus[i] = 0x18 + i; 2004 bogus[i] = 0x18 + i;
2020 cmd.host_command_length = IW_ESSID_MAX_SIZE; 2005 cmd.host_command_length = IW_ESSID_MAX_SIZE;
@@ -2025,8 +2010,7 @@ static int ipw2100_set_essid(struct ipw2100_priv *priv, char *essid,
2025 2010
2026 err = ipw2100_hw_send_command(priv, &cmd); 2011 err = ipw2100_hw_send_command(priv, &cmd);
2027 if (!err) { 2012 if (!err) {
2028 memset(priv->essid + ssid_len, 0, 2013 memset(priv->essid + ssid_len, 0, IW_ESSID_MAX_SIZE - ssid_len);
2029 IW_ESSID_MAX_SIZE - ssid_len);
2030 memcpy(priv->essid, essid, ssid_len); 2014 memcpy(priv->essid, essid, ssid_len);
2031 priv->essid_len = ssid_len; 2015 priv->essid_len = ssid_len;
2032 } 2016 }
@@ -2071,7 +2055,7 @@ static void isr_indicate_association_lost(struct ipw2100_priv *priv, u32 status)
2071static void isr_indicate_rf_kill(struct ipw2100_priv *priv, u32 status) 2055static void isr_indicate_rf_kill(struct ipw2100_priv *priv, u32 status)
2072{ 2056{
2073 IPW_DEBUG_INFO("%s: RF Kill state changed to radio OFF.\n", 2057 IPW_DEBUG_INFO("%s: RF Kill state changed to radio OFF.\n",
2074 priv->net_dev->name); 2058 priv->net_dev->name);
2075 2059
2076 /* RF_KILL is now enabled (else we wouldn't be here) */ 2060 /* RF_KILL is now enabled (else we wouldn't be here) */
2077 priv->status |= STATUS_RF_KILL_HW; 2061 priv->status |= STATUS_RF_KILL_HW;
@@ -2102,16 +2086,16 @@ static void isr_scan_complete(struct ipw2100_priv *priv, u32 status)
2102#define IPW2100_HANDLER(v, f) { v, f, # v } 2086#define IPW2100_HANDLER(v, f) { v, f, # v }
2103struct ipw2100_status_indicator { 2087struct ipw2100_status_indicator {
2104 int status; 2088 int status;
2105 void (*cb)(struct ipw2100_priv *priv, u32 status); 2089 void (*cb) (struct ipw2100_priv * priv, u32 status);
2106 char *name; 2090 char *name;
2107}; 2091};
2108#else 2092#else
2109#define IPW2100_HANDLER(v, f) { v, f } 2093#define IPW2100_HANDLER(v, f) { v, f }
2110struct ipw2100_status_indicator { 2094struct ipw2100_status_indicator {
2111 int status; 2095 int status;
2112 void (*cb)(struct ipw2100_priv *priv, u32 status); 2096 void (*cb) (struct ipw2100_priv * priv, u32 status);
2113}; 2097};
2114#endif /* CONFIG_IPW_DEBUG */ 2098#endif /* CONFIG_IPW_DEBUG */
2115 2099
2116static void isr_indicate_scanning(struct ipw2100_priv *priv, u32 status) 2100static void isr_indicate_scanning(struct ipw2100_priv *priv, u32 status)
2117{ 2101{
@@ -2135,7 +2119,6 @@ static const struct ipw2100_status_indicator status_handlers[] = {
2135 IPW2100_HANDLER(-1, NULL) 2119 IPW2100_HANDLER(-1, NULL)
2136}; 2120};
2137 2121
2138
2139static void isr_status_change(struct ipw2100_priv *priv, int status) 2122static void isr_status_change(struct ipw2100_priv *priv, int status)
2140{ 2123{
2141 int i; 2124 int i;
@@ -2153,7 +2136,7 @@ static void isr_status_change(struct ipw2100_priv *priv, int status)
2153 for (i = 0; status_handlers[i].status != -1; i++) { 2136 for (i = 0; status_handlers[i].status != -1; i++) {
2154 if (status == status_handlers[i].status) { 2137 if (status == status_handlers[i].status) {
2155 IPW_DEBUG_NOTIF("Status change: %s\n", 2138 IPW_DEBUG_NOTIF("Status change: %s\n",
2156 status_handlers[i].name); 2139 status_handlers[i].name);
2157 if (status_handlers[i].cb) 2140 if (status_handlers[i].cb)
2158 status_handlers[i].cb(priv, status); 2141 status_handlers[i].cb(priv, status);
2159 priv->wstats.status = status; 2142 priv->wstats.status = status;
@@ -2164,9 +2147,8 @@ static void isr_status_change(struct ipw2100_priv *priv, int status)
2164 IPW_DEBUG_NOTIF("unknown status received: %04x\n", status); 2147 IPW_DEBUG_NOTIF("unknown status received: %04x\n", status);
2165} 2148}
2166 2149
2167static void isr_rx_complete_command( 2150static void isr_rx_complete_command(struct ipw2100_priv *priv,
2168 struct ipw2100_priv *priv, 2151 struct ipw2100_cmd_header *cmd)
2169 struct ipw2100_cmd_header *cmd)
2170{ 2152{
2171#ifdef CONFIG_IPW_DEBUG 2153#ifdef CONFIG_IPW_DEBUG
2172 if (cmd->host_command_reg < ARRAY_SIZE(command_types)) { 2154 if (cmd->host_command_reg < ARRAY_SIZE(command_types)) {
@@ -2196,10 +2178,8 @@ static const char *frame_types[] = {
2196}; 2178};
2197#endif 2179#endif
2198 2180
2199 2181static inline int ipw2100_alloc_skb(struct ipw2100_priv *priv,
2200static inline int ipw2100_alloc_skb( 2182 struct ipw2100_rx_packet *packet)
2201 struct ipw2100_priv *priv,
2202 struct ipw2100_rx_packet *packet)
2203{ 2183{
2204 packet->skb = dev_alloc_skb(sizeof(struct ipw2100_rx)); 2184 packet->skb = dev_alloc_skb(sizeof(struct ipw2100_rx));
2205 if (!packet->skb) 2185 if (!packet->skb)
@@ -2215,7 +2195,6 @@ static inline int ipw2100_alloc_skb(
2215 return 0; 2195 return 0;
2216} 2196}
2217 2197
2218
2219#define SEARCH_ERROR 0xffffffff 2198#define SEARCH_ERROR 0xffffffff
2220#define SEARCH_FAIL 0xfffffffe 2199#define SEARCH_FAIL 0xfffffffe
2221#define SEARCH_SUCCESS 0xfffffff0 2200#define SEARCH_SUCCESS 0xfffffff0
@@ -2229,10 +2208,10 @@ static inline int ipw2100_snapshot_alloc(struct ipw2100_priv *priv)
2229 if (priv->snapshot[0]) 2208 if (priv->snapshot[0])
2230 return 1; 2209 return 1;
2231 for (i = 0; i < 0x30; i++) { 2210 for (i = 0; i < 0x30; i++) {
2232 priv->snapshot[i] = (u8*)kmalloc(0x1000, GFP_ATOMIC); 2211 priv->snapshot[i] = (u8 *) kmalloc(0x1000, GFP_ATOMIC);
2233 if (!priv->snapshot[i]) { 2212 if (!priv->snapshot[i]) {
2234 IPW_DEBUG_INFO("%s: Error allocating snapshot " 2213 IPW_DEBUG_INFO("%s: Error allocating snapshot "
2235 "buffer %d\n", priv->net_dev->name, i); 2214 "buffer %d\n", priv->net_dev->name, i);
2236 while (i > 0) 2215 while (i > 0)
2237 kfree(priv->snapshot[--i]); 2216 kfree(priv->snapshot[--i]);
2238 priv->snapshot[0] = NULL; 2217 priv->snapshot[0] = NULL;
@@ -2253,7 +2232,7 @@ static inline void ipw2100_snapshot_free(struct ipw2100_priv *priv)
2253 priv->snapshot[0] = NULL; 2232 priv->snapshot[0] = NULL;
2254} 2233}
2255 2234
2256static inline u32 ipw2100_match_buf(struct ipw2100_priv *priv, u8 *in_buf, 2235static inline u32 ipw2100_match_buf(struct ipw2100_priv *priv, u8 * in_buf,
2257 size_t len, int mode) 2236 size_t len, int mode)
2258{ 2237{
2259 u32 i, j; 2238 u32 i, j;
@@ -2270,9 +2249,9 @@ static inline u32 ipw2100_match_buf(struct ipw2100_priv *priv, u8 *in_buf,
2270 for (ret = SEARCH_FAIL, i = 0; i < 0x30000; i += 4) { 2249 for (ret = SEARCH_FAIL, i = 0; i < 0x30000; i += 4) {
2271 read_nic_dword(priv->net_dev, i, &tmp); 2250 read_nic_dword(priv->net_dev, i, &tmp);
2272 if (mode == SEARCH_SNAPSHOT) 2251 if (mode == SEARCH_SNAPSHOT)
2273 *(u32 *)SNAPSHOT_ADDR(i) = tmp; 2252 *(u32 *) SNAPSHOT_ADDR(i) = tmp;
2274 if (ret == SEARCH_FAIL) { 2253 if (ret == SEARCH_FAIL) {
2275 d = (u8*)&tmp; 2254 d = (u8 *) & tmp;
2276 for (j = 0; j < 4; j++) { 2255 for (j = 0; j < 4; j++) {
2277 if (*s != *d) { 2256 if (*s != *d) {
2278 s = in_buf; 2257 s = in_buf;
@@ -2310,8 +2289,7 @@ static inline u32 ipw2100_match_buf(struct ipw2100_priv *priv, u8 *in_buf,
2310static u8 packet_data[IPW_RX_NIC_BUFFER_LENGTH]; 2289static u8 packet_data[IPW_RX_NIC_BUFFER_LENGTH];
2311#endif 2290#endif
2312 2291
2313static inline void ipw2100_corruption_detected(struct ipw2100_priv *priv, 2292static inline void ipw2100_corruption_detected(struct ipw2100_priv *priv, int i)
2314 int i)
2315{ 2293{
2316#ifdef CONFIG_IPW_DEBUG_C3 2294#ifdef CONFIG_IPW_DEBUG_C3
2317 struct ipw2100_status *status = &priv->status_queue.drv[i]; 2295 struct ipw2100_status *status = &priv->status_queue.drv[i];
@@ -2346,9 +2324,9 @@ static inline void ipw2100_corruption_detected(struct ipw2100_priv *priv,
2346 2324
2347 if (reg & IPW_AUX_HOST_RESET_REG_MASTER_DISABLED) 2325 if (reg & IPW_AUX_HOST_RESET_REG_MASTER_DISABLED)
2348 break; 2326 break;
2349 } while (j--); 2327 } while (j--);
2350 2328
2351 match = ipw2100_match_buf(priv, (u8*)status, 2329 match = ipw2100_match_buf(priv, (u8 *) status,
2352 sizeof(struct ipw2100_status), 2330 sizeof(struct ipw2100_status),
2353 SEARCH_SNAPSHOT); 2331 SEARCH_SNAPSHOT);
2354 if (match < SEARCH_SUCCESS) 2332 if (match < SEARCH_SUCCESS)
@@ -2360,7 +2338,7 @@ static inline void ipw2100_corruption_detected(struct ipw2100_priv *priv,
2360 IPW_DEBUG_INFO("%s: No DMA status match in " 2338 IPW_DEBUG_INFO("%s: No DMA status match in "
2361 "Firmware.\n", priv->net_dev->name); 2339 "Firmware.\n", priv->net_dev->name);
2362 2340
2363 printk_buf((u8*)priv->status_queue.drv, 2341 printk_buf((u8 *) priv->status_queue.drv,
2364 sizeof(struct ipw2100_status) * RX_QUEUE_LENGTH); 2342 sizeof(struct ipw2100_status) * RX_QUEUE_LENGTH);
2365#endif 2343#endif
2366 2344
@@ -2401,17 +2379,15 @@ static inline void isr_rx(struct ipw2100_priv *priv, int i,
2401 } 2379 }
2402 2380
2403 if (unlikely(priv->ieee->iw_mode != IW_MODE_MONITOR && 2381 if (unlikely(priv->ieee->iw_mode != IW_MODE_MONITOR &&
2404 !(priv->status & STATUS_ASSOCIATED))) { 2382 !(priv->status & STATUS_ASSOCIATED))) {
2405 IPW_DEBUG_DROP("Dropping packet while not associated.\n"); 2383 IPW_DEBUG_DROP("Dropping packet while not associated.\n");
2406 priv->wstats.discard.misc++; 2384 priv->wstats.discard.misc++;
2407 return; 2385 return;
2408 } 2386 }
2409 2387
2410
2411 pci_unmap_single(priv->pci_dev, 2388 pci_unmap_single(priv->pci_dev,
2412 packet->dma_addr, 2389 packet->dma_addr,
2413 sizeof(struct ipw2100_rx), 2390 sizeof(struct ipw2100_rx), PCI_DMA_FROMDEVICE);
2414 PCI_DMA_FROMDEVICE);
2415 2391
2416 skb_put(packet->skb, status->frame_size); 2392 skb_put(packet->skb, status->frame_size);
2417 2393
@@ -2438,8 +2414,8 @@ static inline void isr_rx(struct ipw2100_priv *priv, int i,
2438 /* We need to allocate a new SKB and attach it to the RDB. */ 2414 /* We need to allocate a new SKB and attach it to the RDB. */
2439 if (unlikely(ipw2100_alloc_skb(priv, packet))) { 2415 if (unlikely(ipw2100_alloc_skb(priv, packet))) {
2440 printk(KERN_WARNING DRV_NAME ": " 2416 printk(KERN_WARNING DRV_NAME ": "
2441 "%s: Unable to allocate SKB onto RBD ring - disabling " 2417 "%s: Unable to allocate SKB onto RBD ring - disabling "
2442 "adapter.\n", priv->net_dev->name); 2418 "adapter.\n", priv->net_dev->name);
2443 /* TODO: schedule adapter shutdown */ 2419 /* TODO: schedule adapter shutdown */
2444 IPW_DEBUG_INFO("TODO: Shutdown adapter...\n"); 2420 IPW_DEBUG_INFO("TODO: Shutdown adapter...\n");
2445 } 2421 }
@@ -2534,11 +2510,11 @@ static inline void __ipw2100_rx_process(struct ipw2100_priv *priv)
2534 2510
2535 /* Sync the DMA for the STATUS buffer so CPU is sure to get 2511 /* Sync the DMA for the STATUS buffer so CPU is sure to get
2536 * the correct values */ 2512 * the correct values */
2537 pci_dma_sync_single_for_cpu( 2513 pci_dma_sync_single_for_cpu(priv->pci_dev,
2538 priv->pci_dev, 2514 sq->nic +
2539 sq->nic + sizeof(struct ipw2100_status) * i, 2515 sizeof(struct ipw2100_status) * i,
2540 sizeof(struct ipw2100_status), 2516 sizeof(struct ipw2100_status),
2541 PCI_DMA_FROMDEVICE); 2517 PCI_DMA_FROMDEVICE);
2542 2518
2543 /* Sync the DMA for the RX buffer so CPU is sure to get 2519 /* Sync the DMA for the RX buffer so CPU is sure to get
2544 * the correct values */ 2520 * the correct values */
@@ -2552,8 +2528,7 @@ static inline void __ipw2100_rx_process(struct ipw2100_priv *priv)
2552 } 2528 }
2553 2529
2554 u = packet->rxp; 2530 u = packet->rxp;
2555 frame_type = sq->drv[i].status_fields & 2531 frame_type = sq->drv[i].status_fields & STATUS_TYPE_MASK;
2556 STATUS_TYPE_MASK;
2557 stats.rssi = sq->drv[i].rssi + IPW2100_RSSI_TO_DBM; 2532 stats.rssi = sq->drv[i].rssi + IPW2100_RSSI_TO_DBM;
2558 stats.len = sq->drv[i].frame_size; 2533 stats.len = sq->drv[i].frame_size;
2559 2534
@@ -2562,16 +2537,14 @@ static inline void __ipw2100_rx_process(struct ipw2100_priv *priv)
2562 stats.mask |= IEEE80211_STATMASK_RSSI; 2537 stats.mask |= IEEE80211_STATMASK_RSSI;
2563 stats.freq = IEEE80211_24GHZ_BAND; 2538 stats.freq = IEEE80211_24GHZ_BAND;
2564 2539
2565 IPW_DEBUG_RX( 2540 IPW_DEBUG_RX("%s: '%s' frame type received (%d).\n",
2566 "%s: '%s' frame type received (%d).\n", 2541 priv->net_dev->name, frame_types[frame_type],
2567 priv->net_dev->name, frame_types[frame_type], 2542 stats.len);
2568 stats.len);
2569 2543
2570 switch (frame_type) { 2544 switch (frame_type) {
2571 case COMMAND_STATUS_VAL: 2545 case COMMAND_STATUS_VAL:
2572 /* Reset Rx watchdog */ 2546 /* Reset Rx watchdog */
2573 isr_rx_complete_command( 2547 isr_rx_complete_command(priv, &u->rx_data.command);
2574 priv, &u->rx_data.command);
2575 break; 2548 break;
2576 2549
2577 case STATUS_CHANGE_VAL: 2550 case STATUS_CHANGE_VAL:
@@ -2588,12 +2561,10 @@ static inline void __ipw2100_rx_process(struct ipw2100_priv *priv)
2588#endif 2561#endif
2589 if (stats.len < sizeof(u->rx_data.header)) 2562 if (stats.len < sizeof(u->rx_data.header))
2590 break; 2563 break;
2591 switch (WLAN_FC_GET_TYPE(u->rx_data.header. 2564 switch (WLAN_FC_GET_TYPE(u->rx_data.header.frame_ctl)) {
2592 frame_ctl)) {
2593 case IEEE80211_FTYPE_MGMT: 2565 case IEEE80211_FTYPE_MGMT:
2594 ieee80211_rx_mgt(priv->ieee, 2566 ieee80211_rx_mgt(priv->ieee,
2595 &u->rx_data.header, 2567 &u->rx_data.header, &stats);
2596 &stats);
2597 break; 2568 break;
2598 2569
2599 case IEEE80211_FTYPE_CTL: 2570 case IEEE80211_FTYPE_CTL:
@@ -2607,7 +2578,7 @@ static inline void __ipw2100_rx_process(struct ipw2100_priv *priv)
2607 break; 2578 break;
2608 } 2579 }
2609 2580
2610 increment: 2581 increment:
2611 /* clear status field associated with this RBD */ 2582 /* clear status field associated with this RBD */
2612 rxq->drv[i].status.info.field = 0; 2583 rxq->drv[i].status.info.field = 0;
2613 2584
@@ -2619,12 +2590,10 @@ static inline void __ipw2100_rx_process(struct ipw2100_priv *priv)
2619 rxq->next = (i ? i : rxq->entries) - 1; 2590 rxq->next = (i ? i : rxq->entries) - 1;
2620 2591
2621 write_register(priv->net_dev, 2592 write_register(priv->net_dev,
2622 IPW_MEM_HOST_SHARED_RX_WRITE_INDEX, 2593 IPW_MEM_HOST_SHARED_RX_WRITE_INDEX, rxq->next);
2623 rxq->next);
2624 } 2594 }
2625} 2595}
2626 2596
2627
2628/* 2597/*
2629 * __ipw2100_tx_process 2598 * __ipw2100_tx_process
2630 * 2599 *
@@ -2667,7 +2636,7 @@ static inline void __ipw2100_rx_process(struct ipw2100_priv *priv)
2667static inline int __ipw2100_tx_process(struct ipw2100_priv *priv) 2636static inline int __ipw2100_tx_process(struct ipw2100_priv *priv)
2668{ 2637{
2669 struct ipw2100_bd_queue *txq = &priv->tx_queue; 2638 struct ipw2100_bd_queue *txq = &priv->tx_queue;
2670 struct ipw2100_bd *tbd; 2639 struct ipw2100_bd *tbd;
2671 struct list_head *element; 2640 struct list_head *element;
2672 struct ipw2100_tx_packet *packet; 2641 struct ipw2100_tx_packet *packet;
2673 int descriptors_used; 2642 int descriptors_used;
@@ -2680,7 +2649,7 @@ static inline int __ipw2100_tx_process(struct ipw2100_priv *priv)
2680 element = priv->fw_pend_list.next; 2649 element = priv->fw_pend_list.next;
2681 2650
2682 packet = list_entry(element, struct ipw2100_tx_packet, list); 2651 packet = list_entry(element, struct ipw2100_tx_packet, list);
2683 tbd = &txq->drv[packet->index]; 2652 tbd = &txq->drv[packet->index];
2684 2653
2685 /* Determine how many TBD entries must be finished... */ 2654 /* Determine how many TBD entries must be finished... */
2686 switch (packet->type) { 2655 switch (packet->type) {
@@ -2693,14 +2662,14 @@ static inline int __ipw2100_tx_process(struct ipw2100_priv *priv)
2693 case DATA: 2662 case DATA:
2694 /* DATA uses two slots; advance and loop position. */ 2663 /* DATA uses two slots; advance and loop position. */
2695 descriptors_used = tbd->num_fragments; 2664 descriptors_used = tbd->num_fragments;
2696 frag_num = tbd->num_fragments - 1; 2665 frag_num = tbd->num_fragments - 1;
2697 e = txq->oldest + frag_num; 2666 e = txq->oldest + frag_num;
2698 e %= txq->entries; 2667 e %= txq->entries;
2699 break; 2668 break;
2700 2669
2701 default: 2670 default:
2702 printk(KERN_WARNING DRV_NAME ": %s: Bad fw_pend_list entry!\n", 2671 printk(KERN_WARNING DRV_NAME ": %s: Bad fw_pend_list entry!\n",
2703 priv->net_dev->name); 2672 priv->net_dev->name);
2704 return 0; 2673 return 0;
2705 } 2674 }
2706 2675
@@ -2716,13 +2685,12 @@ static inline int __ipw2100_tx_process(struct ipw2100_priv *priv)
2716 printk(KERN_WARNING DRV_NAME ": %s: write index mismatch\n", 2685 printk(KERN_WARNING DRV_NAME ": %s: write index mismatch\n",
2717 priv->net_dev->name); 2686 priv->net_dev->name);
2718 2687
2719 /* 2688 /*
2720 * txq->next is the index of the last packet written txq->oldest is 2689 * txq->next is the index of the last packet written txq->oldest is
2721 * the index of the r is the index of the next packet to be read by 2690 * the index of the r is the index of the next packet to be read by
2722 * firmware 2691 * firmware
2723 */ 2692 */
2724 2693
2725
2726 /* 2694 /*
2727 * Quick graphic to help you visualize the following 2695 * Quick graphic to help you visualize the following
2728 * if / else statement 2696 * if / else statement
@@ -2750,23 +2718,20 @@ static inline int __ipw2100_tx_process(struct ipw2100_priv *priv)
2750#ifdef CONFIG_IPW_DEBUG 2718#ifdef CONFIG_IPW_DEBUG
2751 { 2719 {
2752 int i = txq->oldest; 2720 int i = txq->oldest;
2753 IPW_DEBUG_TX( 2721 IPW_DEBUG_TX("TX%d V=%p P=%04X T=%04X L=%d\n", i,
2754 "TX%d V=%p P=%04X T=%04X L=%d\n", i, 2722 &txq->drv[i],
2755 &txq->drv[i], 2723 (u32) (txq->nic + i * sizeof(struct ipw2100_bd)),
2756 (u32)(txq->nic + i * sizeof(struct ipw2100_bd)), 2724 txq->drv[i].host_addr, txq->drv[i].buf_length);
2757 txq->drv[i].host_addr,
2758 txq->drv[i].buf_length);
2759 2725
2760 if (packet->type == DATA) { 2726 if (packet->type == DATA) {
2761 i = (i + 1) % txq->entries; 2727 i = (i + 1) % txq->entries;
2762 2728
2763 IPW_DEBUG_TX( 2729 IPW_DEBUG_TX("TX%d V=%p P=%04X T=%04X L=%d\n", i,
2764 "TX%d V=%p P=%04X T=%04X L=%d\n", i, 2730 &txq->drv[i],
2765 &txq->drv[i], 2731 (u32) (txq->nic + i *
2766 (u32)(txq->nic + i * 2732 sizeof(struct ipw2100_bd)),
2767 sizeof(struct ipw2100_bd)), 2733 (u32) txq->drv[i].host_addr,
2768 (u32)txq->drv[i].host_addr, 2734 txq->drv[i].buf_length);
2769 txq->drv[i].buf_length);
2770 } 2735 }
2771 } 2736 }
2772#endif 2737#endif
@@ -2782,21 +2747,19 @@ static inline int __ipw2100_tx_process(struct ipw2100_priv *priv)
2782 /* DATA packet; we have to unmap and free the SKB */ 2747 /* DATA packet; we have to unmap and free the SKB */
2783 priv->ieee->stats.tx_packets++; 2748 priv->ieee->stats.tx_packets++;
2784 for (i = 0; i < frag_num; i++) { 2749 for (i = 0; i < frag_num; i++) {
2785 tbd = &txq->drv[(packet->index + 1 + i) % 2750 tbd = &txq->drv[(packet->index + 1 + i) % txq->entries];
2786 txq->entries];
2787 2751
2788 IPW_DEBUG_TX( 2752 IPW_DEBUG_TX("TX%d P=%08x L=%d\n",
2789 "TX%d P=%08x L=%d\n", 2753 (packet->index + 1 + i) % txq->entries,
2790 (packet->index + 1 + i) % txq->entries, 2754 tbd->host_addr, tbd->buf_length);
2791 tbd->host_addr, tbd->buf_length);
2792 2755
2793 pci_unmap_single(priv->pci_dev, 2756 pci_unmap_single(priv->pci_dev,
2794 tbd->host_addr, 2757 tbd->host_addr,
2795 tbd->buf_length, 2758 tbd->buf_length, PCI_DMA_TODEVICE);
2796 PCI_DMA_TODEVICE);
2797 } 2759 }
2798 2760
2799 priv->ieee->stats.tx_bytes += packet->info.d_struct.txb->payload_size; 2761 priv->ieee->stats.tx_bytes +=
2762 packet->info.d_struct.txb->payload_size;
2800 ieee80211_txb_free(packet->info.d_struct.txb); 2763 ieee80211_txb_free(packet->info.d_struct.txb);
2801 packet->info.d_struct.txb = NULL; 2764 packet->info.d_struct.txb = NULL;
2802 2765
@@ -2808,8 +2771,8 @@ static inline int __ipw2100_tx_process(struct ipw2100_priv *priv)
2808 if (priv->status & STATUS_ASSOCIATED && 2771 if (priv->status & STATUS_ASSOCIATED &&
2809 netif_queue_stopped(priv->net_dev)) { 2772 netif_queue_stopped(priv->net_dev)) {
2810 IPW_DEBUG_INFO(KERN_INFO 2773 IPW_DEBUG_INFO(KERN_INFO
2811 "%s: Waking net queue.\n", 2774 "%s: Waking net queue.\n",
2812 priv->net_dev->name); 2775 priv->net_dev->name);
2813 netif_wake_queue(priv->net_dev); 2776 netif_wake_queue(priv->net_dev);
2814 } 2777 }
2815 2778
@@ -2829,11 +2792,12 @@ static inline int __ipw2100_tx_process(struct ipw2100_priv *priv)
2829#ifdef CONFIG_IPW_DEBUG 2792#ifdef CONFIG_IPW_DEBUG
2830 if (packet->info.c_struct.cmd->host_command_reg < 2793 if (packet->info.c_struct.cmd->host_command_reg <
2831 sizeof(command_types) / sizeof(*command_types)) 2794 sizeof(command_types) / sizeof(*command_types))
2832 IPW_DEBUG_TX( 2795 IPW_DEBUG_TX("Command '%s (%d)' processed: %d.\n",
2833 "Command '%s (%d)' processed: %d.\n", 2796 command_types[packet->info.c_struct.cmd->
2834 command_types[packet->info.c_struct.cmd->host_command_reg], 2797 host_command_reg],
2835 packet->info.c_struct.cmd->host_command_reg, 2798 packet->info.c_struct.cmd->
2836 packet->info.c_struct.cmd->cmd_status_reg); 2799 host_command_reg,
2800 packet->info.c_struct.cmd->cmd_status_reg);
2837#endif 2801#endif
2838 2802
2839 list_add_tail(element, &priv->msg_free_list); 2803 list_add_tail(element, &priv->msg_free_list);
@@ -2848,17 +2812,17 @@ static inline int __ipw2100_tx_process(struct ipw2100_priv *priv)
2848 SET_STAT(&priv->txq_stat, txq->available); 2812 SET_STAT(&priv->txq_stat, txq->available);
2849 2813
2850 IPW_DEBUG_TX("packet latency (send to process) %ld jiffies\n", 2814 IPW_DEBUG_TX("packet latency (send to process) %ld jiffies\n",
2851 jiffies - packet->jiffy_start); 2815 jiffies - packet->jiffy_start);
2852 2816
2853 return (!list_empty(&priv->fw_pend_list)); 2817 return (!list_empty(&priv->fw_pend_list));
2854} 2818}
2855 2819
2856
2857static inline void __ipw2100_tx_complete(struct ipw2100_priv *priv) 2820static inline void __ipw2100_tx_complete(struct ipw2100_priv *priv)
2858{ 2821{
2859 int i = 0; 2822 int i = 0;
2860 2823
2861 while (__ipw2100_tx_process(priv) && i < 200) i++; 2824 while (__ipw2100_tx_process(priv) && i < 200)
2825 i++;
2862 2826
2863 if (i == 200) { 2827 if (i == 200) {
2864 printk(KERN_WARNING DRV_NAME ": " 2828 printk(KERN_WARNING DRV_NAME ": "
@@ -2867,7 +2831,6 @@ static inline void __ipw2100_tx_complete(struct ipw2100_priv *priv)
2867 } 2831 }
2868} 2832}
2869 2833
2870
2871static void ipw2100_tx_send_commands(struct ipw2100_priv *priv) 2834static void ipw2100_tx_send_commands(struct ipw2100_priv *priv)
2872{ 2835{
2873 struct list_head *element; 2836 struct list_head *element;
@@ -2892,13 +2855,12 @@ static void ipw2100_tx_send_commands(struct ipw2100_priv *priv)
2892 list_del(element); 2855 list_del(element);
2893 DEC_STAT(&priv->msg_pend_stat); 2856 DEC_STAT(&priv->msg_pend_stat);
2894 2857
2895 packet = list_entry(element, 2858 packet = list_entry(element, struct ipw2100_tx_packet, list);
2896 struct ipw2100_tx_packet, list);
2897 2859
2898 IPW_DEBUG_TX("using TBD at virt=%p, phys=%p\n", 2860 IPW_DEBUG_TX("using TBD at virt=%p, phys=%p\n",
2899 &txq->drv[txq->next], 2861 &txq->drv[txq->next],
2900 (void*)(txq->nic + txq->next * 2862 (void *)(txq->nic + txq->next *
2901 sizeof(struct ipw2100_bd))); 2863 sizeof(struct ipw2100_bd)));
2902 2864
2903 packet->index = txq->next; 2865 packet->index = txq->next;
2904 2866
@@ -2911,8 +2873,8 @@ static void ipw2100_tx_send_commands(struct ipw2100_priv *priv)
2911 * with f/w debug version */ 2873 * with f/w debug version */
2912 tbd->num_fragments = 1; 2874 tbd->num_fragments = 1;
2913 tbd->status.info.field = 2875 tbd->status.info.field =
2914 IPW_BD_STATUS_TX_FRAME_COMMAND | 2876 IPW_BD_STATUS_TX_FRAME_COMMAND |
2915 IPW_BD_STATUS_TX_INTERRUPT_ENABLE; 2877 IPW_BD_STATUS_TX_INTERRUPT_ENABLE;
2916 2878
2917 /* update TBD queue counters */ 2879 /* update TBD queue counters */
2918 txq->next++; 2880 txq->next++;
@@ -2934,7 +2896,6 @@ static void ipw2100_tx_send_commands(struct ipw2100_priv *priv)
2934 } 2896 }
2935} 2897}
2936 2898
2937
2938/* 2899/*
2939 * ipw2100_tx_send_data 2900 * ipw2100_tx_send_data
2940 * 2901 *
@@ -2946,7 +2907,7 @@ static void ipw2100_tx_send_data(struct ipw2100_priv *priv)
2946 struct ipw2100_bd_queue *txq = &priv->tx_queue; 2907 struct ipw2100_bd_queue *txq = &priv->tx_queue;
2947 struct ipw2100_bd *tbd; 2908 struct ipw2100_bd *tbd;
2948 int next = txq->next; 2909 int next = txq->next;
2949 int i = 0; 2910 int i = 0;
2950 struct ipw2100_data_header *ipw_hdr; 2911 struct ipw2100_data_header *ipw_hdr;
2951 struct ieee80211_hdr_3addr *hdr; 2912 struct ieee80211_hdr_3addr *hdr;
2952 2913
@@ -2958,20 +2919,18 @@ static void ipw2100_tx_send_data(struct ipw2100_priv *priv)
2958 * maintained between the r and w indexes 2919 * maintained between the r and w indexes
2959 */ 2920 */
2960 element = priv->tx_pend_list.next; 2921 element = priv->tx_pend_list.next;
2961 packet = list_entry(element, struct ipw2100_tx_packet, list); 2922 packet = list_entry(element, struct ipw2100_tx_packet, list);
2962 2923
2963 if (unlikely(1 + packet->info.d_struct.txb->nr_frags > 2924 if (unlikely(1 + packet->info.d_struct.txb->nr_frags >
2964 IPW_MAX_BDS)) { 2925 IPW_MAX_BDS)) {
2965 /* TODO: Support merging buffers if more than 2926 /* TODO: Support merging buffers if more than
2966 * IPW_MAX_BDS are used */ 2927 * IPW_MAX_BDS are used */
2967 IPW_DEBUG_INFO( 2928 IPW_DEBUG_INFO("%s: Maximum BD theshold exceeded. "
2968 "%s: Maximum BD theshold exceeded. " 2929 "Increase fragmentation level.\n",
2969 "Increase fragmentation level.\n", 2930 priv->net_dev->name);
2970 priv->net_dev->name);
2971 } 2931 }
2972 2932
2973 if (txq->available <= 3 + 2933 if (txq->available <= 3 + packet->info.d_struct.txb->nr_frags) {
2974 packet->info.d_struct.txb->nr_frags) {
2975 IPW_DEBUG_TX("no room in tx_queue\n"); 2934 IPW_DEBUG_TX("no room in tx_queue\n");
2976 break; 2935 break;
2977 } 2936 }
@@ -2985,7 +2944,7 @@ static void ipw2100_tx_send_data(struct ipw2100_priv *priv)
2985 2944
2986 ipw_hdr = packet->info.d_struct.data; 2945 ipw_hdr = packet->info.d_struct.data;
2987 hdr = (struct ieee80211_hdr_3addr *)packet->info.d_struct.txb-> 2946 hdr = (struct ieee80211_hdr_3addr *)packet->info.d_struct.txb->
2988 fragments[0]->data; 2947 fragments[0]->data;
2989 2948
2990 if (priv->ieee->iw_mode == IW_MODE_INFRA) { 2949 if (priv->ieee->iw_mode == IW_MODE_INFRA) {
2991 /* To DS: Addr1 = BSSID, Addr2 = SA, 2950 /* To DS: Addr1 = BSSID, Addr2 = SA,
@@ -3007,7 +2966,8 @@ static void ipw2100_tx_send_data(struct ipw2100_priv *priv)
3007 ipw_hdr->encrypted = packet->info.d_struct.txb->encrypted; 2966 ipw_hdr->encrypted = packet->info.d_struct.txb->encrypted;
3008 if (packet->info.d_struct.txb->nr_frags > 1) 2967 if (packet->info.d_struct.txb->nr_frags > 1)
3009 ipw_hdr->fragment_size = 2968 ipw_hdr->fragment_size =
3010 packet->info.d_struct.txb->frag_size - IEEE80211_3ADDR_LEN; 2969 packet->info.d_struct.txb->frag_size -
2970 IEEE80211_3ADDR_LEN;
3011 else 2971 else
3012 ipw_hdr->fragment_size = 0; 2972 ipw_hdr->fragment_size = 0;
3013 2973
@@ -3015,54 +2975,53 @@ static void ipw2100_tx_send_data(struct ipw2100_priv *priv)
3015 tbd->buf_length = sizeof(struct ipw2100_data_header); 2975 tbd->buf_length = sizeof(struct ipw2100_data_header);
3016 tbd->num_fragments = 1 + packet->info.d_struct.txb->nr_frags; 2976 tbd->num_fragments = 1 + packet->info.d_struct.txb->nr_frags;
3017 tbd->status.info.field = 2977 tbd->status.info.field =
3018 IPW_BD_STATUS_TX_FRAME_802_3 | 2978 IPW_BD_STATUS_TX_FRAME_802_3 |
3019 IPW_BD_STATUS_TX_FRAME_NOT_LAST_FRAGMENT; 2979 IPW_BD_STATUS_TX_FRAME_NOT_LAST_FRAGMENT;
3020 txq->next++; 2980 txq->next++;
3021 txq->next %= txq->entries; 2981 txq->next %= txq->entries;
3022 2982
3023 IPW_DEBUG_TX( 2983 IPW_DEBUG_TX("data header tbd TX%d P=%08x L=%d\n",
3024 "data header tbd TX%d P=%08x L=%d\n", 2984 packet->index, tbd->host_addr, tbd->buf_length);
3025 packet->index, tbd->host_addr,
3026 tbd->buf_length);
3027#ifdef CONFIG_IPW_DEBUG 2985#ifdef CONFIG_IPW_DEBUG
3028 if (packet->info.d_struct.txb->nr_frags > 1) 2986 if (packet->info.d_struct.txb->nr_frags > 1)
3029 IPW_DEBUG_FRAG("fragment Tx: %d frames\n", 2987 IPW_DEBUG_FRAG("fragment Tx: %d frames\n",
3030 packet->info.d_struct.txb->nr_frags); 2988 packet->info.d_struct.txb->nr_frags);
3031#endif 2989#endif
3032 2990
3033 for (i = 0; i < packet->info.d_struct.txb->nr_frags; i++) { 2991 for (i = 0; i < packet->info.d_struct.txb->nr_frags; i++) {
3034 tbd = &txq->drv[txq->next]; 2992 tbd = &txq->drv[txq->next];
3035 if (i == packet->info.d_struct.txb->nr_frags - 1) 2993 if (i == packet->info.d_struct.txb->nr_frags - 1)
3036 tbd->status.info.field = 2994 tbd->status.info.field =
3037 IPW_BD_STATUS_TX_FRAME_802_3 | 2995 IPW_BD_STATUS_TX_FRAME_802_3 |
3038 IPW_BD_STATUS_TX_INTERRUPT_ENABLE; 2996 IPW_BD_STATUS_TX_INTERRUPT_ENABLE;
3039 else 2997 else
3040 tbd->status.info.field = 2998 tbd->status.info.field =
3041 IPW_BD_STATUS_TX_FRAME_802_3 | 2999 IPW_BD_STATUS_TX_FRAME_802_3 |
3042 IPW_BD_STATUS_TX_FRAME_NOT_LAST_FRAGMENT; 3000 IPW_BD_STATUS_TX_FRAME_NOT_LAST_FRAGMENT;
3043 3001
3044 tbd->buf_length = packet->info.d_struct.txb-> 3002 tbd->buf_length = packet->info.d_struct.txb->
3045 fragments[i]->len - IEEE80211_3ADDR_LEN; 3003 fragments[i]->len - IEEE80211_3ADDR_LEN;
3046 3004
3047 tbd->host_addr = pci_map_single( 3005 tbd->host_addr = pci_map_single(priv->pci_dev,
3048 priv->pci_dev, 3006 packet->info.d_struct.
3049 packet->info.d_struct.txb->fragments[i]->data + 3007 txb->fragments[i]->
3050 IEEE80211_3ADDR_LEN, 3008 data +
3051 tbd->buf_length, 3009 IEEE80211_3ADDR_LEN,
3052 PCI_DMA_TODEVICE); 3010 tbd->buf_length,
3011 PCI_DMA_TODEVICE);
3053 3012
3054 IPW_DEBUG_TX( 3013 IPW_DEBUG_TX("data frag tbd TX%d P=%08x L=%d\n",
3055 "data frag tbd TX%d P=%08x L=%d\n", 3014 txq->next, tbd->host_addr,
3056 txq->next, tbd->host_addr, tbd->buf_length); 3015 tbd->buf_length);
3057 3016
3058 pci_dma_sync_single_for_device( 3017 pci_dma_sync_single_for_device(priv->pci_dev,
3059 priv->pci_dev, tbd->host_addr, 3018 tbd->host_addr,
3060 tbd->buf_length, 3019 tbd->buf_length,
3061 PCI_DMA_TODEVICE); 3020 PCI_DMA_TODEVICE);
3062 3021
3063 txq->next++; 3022 txq->next++;
3064 txq->next %= txq->entries; 3023 txq->next %= txq->entries;
3065 } 3024 }
3066 3025
3067 txq->available -= 1 + packet->info.d_struct.txb->nr_frags; 3026 txq->available -= 1 + packet->info.d_struct.txb->nr_frags;
3068 SET_STAT(&priv->txq_stat, txq->available); 3027 SET_STAT(&priv->txq_stat, txq->available);
@@ -3078,7 +3037,7 @@ static void ipw2100_tx_send_data(struct ipw2100_priv *priv)
3078 IPW_MEM_HOST_SHARED_TX_QUEUE_WRITE_INDEX, 3037 IPW_MEM_HOST_SHARED_TX_QUEUE_WRITE_INDEX,
3079 txq->next); 3038 txq->next);
3080 } 3039 }
3081 return; 3040 return;
3082} 3041}
3083 3042
3084static void ipw2100_irq_tasklet(struct ipw2100_priv *priv) 3043static void ipw2100_irq_tasklet(struct ipw2100_priv *priv)
@@ -3106,11 +3065,9 @@ static void ipw2100_irq_tasklet(struct ipw2100_priv *priv)
3106 3065
3107 if (inta & IPW2100_INTA_FATAL_ERROR) { 3066 if (inta & IPW2100_INTA_FATAL_ERROR) {
3108 printk(KERN_WARNING DRV_NAME 3067 printk(KERN_WARNING DRV_NAME
3109 ": Fatal interrupt. Scheduling firmware restart.\n"); 3068 ": Fatal interrupt. Scheduling firmware restart.\n");
3110 priv->inta_other++; 3069 priv->inta_other++;
3111 write_register( 3070 write_register(dev, IPW_REG_INTA, IPW2100_INTA_FATAL_ERROR);
3112 dev, IPW_REG_INTA,
3113 IPW2100_INTA_FATAL_ERROR);
3114 3071
3115 read_nic_dword(dev, IPW_NIC_FATAL_ERROR, &priv->fatal_error); 3072 read_nic_dword(dev, IPW_NIC_FATAL_ERROR, &priv->fatal_error);
3116 IPW_DEBUG_INFO("%s: Fatal error value: 0x%08X\n", 3073 IPW_DEBUG_INFO("%s: Fatal error value: 0x%08X\n",
@@ -3125,11 +3082,10 @@ static void ipw2100_irq_tasklet(struct ipw2100_priv *priv)
3125 } 3082 }
3126 3083
3127 if (inta & IPW2100_INTA_PARITY_ERROR) { 3084 if (inta & IPW2100_INTA_PARITY_ERROR) {
3128 printk(KERN_ERR DRV_NAME ": ***** PARITY ERROR INTERRUPT !!!! \n"); 3085 printk(KERN_ERR DRV_NAME
3086 ": ***** PARITY ERROR INTERRUPT !!!! \n");
3129 priv->inta_other++; 3087 priv->inta_other++;
3130 write_register( 3088 write_register(dev, IPW_REG_INTA, IPW2100_INTA_PARITY_ERROR);
3131 dev, IPW_REG_INTA,
3132 IPW2100_INTA_PARITY_ERROR);
3133 } 3089 }
3134 3090
3135 if (inta & IPW2100_INTA_RX_TRANSFER) { 3091 if (inta & IPW2100_INTA_RX_TRANSFER) {
@@ -3137,9 +3093,7 @@ static void ipw2100_irq_tasklet(struct ipw2100_priv *priv)
3137 3093
3138 priv->rx_interrupts++; 3094 priv->rx_interrupts++;
3139 3095
3140 write_register( 3096 write_register(dev, IPW_REG_INTA, IPW2100_INTA_RX_TRANSFER);
3141 dev, IPW_REG_INTA,
3142 IPW2100_INTA_RX_TRANSFER);
3143 3097
3144 __ipw2100_rx_process(priv); 3098 __ipw2100_rx_process(priv);
3145 __ipw2100_tx_complete(priv); 3099 __ipw2100_tx_complete(priv);
@@ -3150,8 +3104,7 @@ static void ipw2100_irq_tasklet(struct ipw2100_priv *priv)
3150 3104
3151 priv->tx_interrupts++; 3105 priv->tx_interrupts++;
3152 3106
3153 write_register(dev, IPW_REG_INTA, 3107 write_register(dev, IPW_REG_INTA, IPW2100_INTA_TX_TRANSFER);
3154 IPW2100_INTA_TX_TRANSFER);
3155 3108
3156 __ipw2100_tx_complete(priv); 3109 __ipw2100_tx_complete(priv);
3157 ipw2100_tx_send_commands(priv); 3110 ipw2100_tx_send_commands(priv);
@@ -3161,9 +3114,7 @@ static void ipw2100_irq_tasklet(struct ipw2100_priv *priv)
3161 if (inta & IPW2100_INTA_TX_COMPLETE) { 3114 if (inta & IPW2100_INTA_TX_COMPLETE) {
3162 IPW_DEBUG_ISR("TX complete\n"); 3115 IPW_DEBUG_ISR("TX complete\n");
3163 priv->inta_other++; 3116 priv->inta_other++;
3164 write_register( 3117 write_register(dev, IPW_REG_INTA, IPW2100_INTA_TX_COMPLETE);
3165 dev, IPW_REG_INTA,
3166 IPW2100_INTA_TX_COMPLETE);
3167 3118
3168 __ipw2100_tx_complete(priv); 3119 __ipw2100_tx_complete(priv);
3169 } 3120 }
@@ -3171,9 +3122,7 @@ static void ipw2100_irq_tasklet(struct ipw2100_priv *priv)
3171 if (inta & IPW2100_INTA_EVENT_INTERRUPT) { 3122 if (inta & IPW2100_INTA_EVENT_INTERRUPT) {
3172 /* ipw2100_handle_event(dev); */ 3123 /* ipw2100_handle_event(dev); */
3173 priv->inta_other++; 3124 priv->inta_other++;
3174 write_register( 3125 write_register(dev, IPW_REG_INTA, IPW2100_INTA_EVENT_INTERRUPT);
3175 dev, IPW_REG_INTA,
3176 IPW2100_INTA_EVENT_INTERRUPT);
3177 } 3126 }
3178 3127
3179 if (inta & IPW2100_INTA_FW_INIT_DONE) { 3128 if (inta & IPW2100_INTA_FW_INIT_DONE) {
@@ -3183,30 +3132,25 @@ static void ipw2100_irq_tasklet(struct ipw2100_priv *priv)
3183 read_register(dev, IPW_REG_INTA, &tmp); 3132 read_register(dev, IPW_REG_INTA, &tmp);
3184 if (tmp & (IPW2100_INTA_FATAL_ERROR | 3133 if (tmp & (IPW2100_INTA_FATAL_ERROR |
3185 IPW2100_INTA_PARITY_ERROR)) { 3134 IPW2100_INTA_PARITY_ERROR)) {
3186 write_register( 3135 write_register(dev, IPW_REG_INTA,
3187 dev, IPW_REG_INTA, 3136 IPW2100_INTA_FATAL_ERROR |
3188 IPW2100_INTA_FATAL_ERROR | 3137 IPW2100_INTA_PARITY_ERROR);
3189 IPW2100_INTA_PARITY_ERROR);
3190 } 3138 }
3191 3139
3192 write_register(dev, IPW_REG_INTA, 3140 write_register(dev, IPW_REG_INTA, IPW2100_INTA_FW_INIT_DONE);
3193 IPW2100_INTA_FW_INIT_DONE);
3194 } 3141 }
3195 3142
3196 if (inta & IPW2100_INTA_STATUS_CHANGE) { 3143 if (inta & IPW2100_INTA_STATUS_CHANGE) {
3197 IPW_DEBUG_ISR("Status change interrupt\n"); 3144 IPW_DEBUG_ISR("Status change interrupt\n");
3198 priv->inta_other++; 3145 priv->inta_other++;
3199 write_register( 3146 write_register(dev, IPW_REG_INTA, IPW2100_INTA_STATUS_CHANGE);
3200 dev, IPW_REG_INTA,
3201 IPW2100_INTA_STATUS_CHANGE);
3202 } 3147 }
3203 3148
3204 if (inta & IPW2100_INTA_SLAVE_MODE_HOST_COMMAND_DONE) { 3149 if (inta & IPW2100_INTA_SLAVE_MODE_HOST_COMMAND_DONE) {
3205 IPW_DEBUG_ISR("slave host mode interrupt\n"); 3150 IPW_DEBUG_ISR("slave host mode interrupt\n");
3206 priv->inta_other++; 3151 priv->inta_other++;
3207 write_register( 3152 write_register(dev, IPW_REG_INTA,
3208 dev, IPW_REG_INTA, 3153 IPW2100_INTA_SLAVE_MODE_HOST_COMMAND_DONE);
3209 IPW2100_INTA_SLAVE_MODE_HOST_COMMAND_DONE);
3210 } 3154 }
3211 3155
3212 priv->in_isr--; 3156 priv->in_isr--;
@@ -3217,9 +3161,7 @@ static void ipw2100_irq_tasklet(struct ipw2100_priv *priv)
3217 IPW_DEBUG_ISR("exit\n"); 3161 IPW_DEBUG_ISR("exit\n");
3218} 3162}
3219 3163
3220 3164static irqreturn_t ipw2100_interrupt(int irq, void *data, struct pt_regs *regs)
3221static irqreturn_t ipw2100_interrupt(int irq, void *data,
3222 struct pt_regs *regs)
3223{ 3165{
3224 struct ipw2100_priv *priv = data; 3166 struct ipw2100_priv *priv = data;
3225 u32 inta, inta_mask; 3167 u32 inta, inta_mask;
@@ -3227,7 +3169,7 @@ static irqreturn_t ipw2100_interrupt(int irq, void *data,
3227 if (!data) 3169 if (!data)
3228 return IRQ_NONE; 3170 return IRQ_NONE;
3229 3171
3230 spin_lock(&priv->low_lock); 3172 spin_lock(&priv->low_lock);
3231 3173
3232 /* We check to see if we should be ignoring interrupts before 3174 /* We check to see if we should be ignoring interrupts before
3233 * we touch the hardware. During ucode load if we try and handle 3175 * we touch the hardware. During ucode load if we try and handle
@@ -3261,10 +3203,10 @@ static irqreturn_t ipw2100_interrupt(int irq, void *data,
3261 ipw2100_disable_interrupts(priv); 3203 ipw2100_disable_interrupts(priv);
3262 3204
3263 tasklet_schedule(&priv->irq_tasklet); 3205 tasklet_schedule(&priv->irq_tasklet);
3264 spin_unlock(&priv->low_lock); 3206 spin_unlock(&priv->low_lock);
3265 3207
3266 return IRQ_HANDLED; 3208 return IRQ_HANDLED;
3267 none: 3209 none:
3268 spin_unlock(&priv->low_lock); 3210 spin_unlock(&priv->low_lock);
3269 return IRQ_NONE; 3211 return IRQ_NONE;
3270} 3212}
@@ -3294,10 +3236,8 @@ static int ipw2100_tx(struct ieee80211_txb *txb, struct net_device *dev,
3294 3236
3295 packet->info.d_struct.txb = txb; 3237 packet->info.d_struct.txb = txb;
3296 3238
3297 IPW_DEBUG_TX("Sending fragment (%d bytes):\n", 3239 IPW_DEBUG_TX("Sending fragment (%d bytes):\n", txb->fragments[0]->len);
3298 txb->fragments[0]->len); 3240 printk_buf(IPW_DL_TX, txb->fragments[0]->data, txb->fragments[0]->len);
3299 printk_buf(IPW_DL_TX, txb->fragments[0]->data,
3300 txb->fragments[0]->len);
3301 3241
3302 packet->jiffy_start = jiffies; 3242 packet->jiffy_start = jiffies;
3303 3243
@@ -3312,22 +3252,23 @@ static int ipw2100_tx(struct ieee80211_txb *txb, struct net_device *dev,
3312 spin_unlock_irqrestore(&priv->low_lock, flags); 3252 spin_unlock_irqrestore(&priv->low_lock, flags);
3313 return 0; 3253 return 0;
3314 3254
3315 fail_unlock: 3255 fail_unlock:
3316 netif_stop_queue(dev); 3256 netif_stop_queue(dev);
3317 spin_unlock_irqrestore(&priv->low_lock, flags); 3257 spin_unlock_irqrestore(&priv->low_lock, flags);
3318 return 1; 3258 return 1;
3319} 3259}
3320 3260
3321
3322static int ipw2100_msg_allocate(struct ipw2100_priv *priv) 3261static int ipw2100_msg_allocate(struct ipw2100_priv *priv)
3323{ 3262{
3324 int i, j, err = -EINVAL; 3263 int i, j, err = -EINVAL;
3325 void *v; 3264 void *v;
3326 dma_addr_t p; 3265 dma_addr_t p;
3327 3266
3328 priv->msg_buffers = (struct ipw2100_tx_packet *)kmalloc( 3267 priv->msg_buffers =
3329 IPW_COMMAND_POOL_SIZE * sizeof(struct ipw2100_tx_packet), 3268 (struct ipw2100_tx_packet *)kmalloc(IPW_COMMAND_POOL_SIZE *
3330 GFP_KERNEL); 3269 sizeof(struct
3270 ipw2100_tx_packet),
3271 GFP_KERNEL);
3331 if (!priv->msg_buffers) { 3272 if (!priv->msg_buffers) {
3332 printk(KERN_ERR DRV_NAME ": %s: PCI alloc failed for msg " 3273 printk(KERN_ERR DRV_NAME ": %s: PCI alloc failed for msg "
3333 "buffers.\n", priv->net_dev->name); 3274 "buffers.\n", priv->net_dev->name);
@@ -3335,15 +3276,12 @@ static int ipw2100_msg_allocate(struct ipw2100_priv *priv)
3335 } 3276 }
3336 3277
3337 for (i = 0; i < IPW_COMMAND_POOL_SIZE; i++) { 3278 for (i = 0; i < IPW_COMMAND_POOL_SIZE; i++) {
3338 v = pci_alloc_consistent( 3279 v = pci_alloc_consistent(priv->pci_dev,
3339 priv->pci_dev, 3280 sizeof(struct ipw2100_cmd_header), &p);
3340 sizeof(struct ipw2100_cmd_header),
3341 &p);
3342 if (!v) { 3281 if (!v) {
3343 printk(KERN_ERR DRV_NAME ": " 3282 printk(KERN_ERR DRV_NAME ": "
3344 "%s: PCI alloc failed for msg " 3283 "%s: PCI alloc failed for msg "
3345 "buffers.\n", 3284 "buffers.\n", priv->net_dev->name);
3346 priv->net_dev->name);
3347 err = -ENOMEM; 3285 err = -ENOMEM;
3348 break; 3286 break;
3349 } 3287 }
@@ -3352,7 +3290,7 @@ static int ipw2100_msg_allocate(struct ipw2100_priv *priv)
3352 3290
3353 priv->msg_buffers[i].type = COMMAND; 3291 priv->msg_buffers[i].type = COMMAND;
3354 priv->msg_buffers[i].info.c_struct.cmd = 3292 priv->msg_buffers[i].info.c_struct.cmd =
3355 (struct ipw2100_cmd_header*)v; 3293 (struct ipw2100_cmd_header *)v;
3356 priv->msg_buffers[i].info.c_struct.cmd_phys = p; 3294 priv->msg_buffers[i].info.c_struct.cmd_phys = p;
3357 } 3295 }
3358 3296
@@ -3360,11 +3298,11 @@ static int ipw2100_msg_allocate(struct ipw2100_priv *priv)
3360 return 0; 3298 return 0;
3361 3299
3362 for (j = 0; j < i; j++) { 3300 for (j = 0; j < i; j++) {
3363 pci_free_consistent( 3301 pci_free_consistent(priv->pci_dev,
3364 priv->pci_dev, 3302 sizeof(struct ipw2100_cmd_header),
3365 sizeof(struct ipw2100_cmd_header), 3303 priv->msg_buffers[j].info.c_struct.cmd,
3366 priv->msg_buffers[j].info.c_struct.cmd, 3304 priv->msg_buffers[j].info.c_struct.
3367 priv->msg_buffers[j].info.c_struct.cmd_phys); 3305 cmd_phys);
3368 } 3306 }
3369 3307
3370 kfree(priv->msg_buffers); 3308 kfree(priv->msg_buffers);
@@ -3398,7 +3336,8 @@ static void ipw2100_msg_free(struct ipw2100_priv *priv)
3398 pci_free_consistent(priv->pci_dev, 3336 pci_free_consistent(priv->pci_dev,
3399 sizeof(struct ipw2100_cmd_header), 3337 sizeof(struct ipw2100_cmd_header),
3400 priv->msg_buffers[i].info.c_struct.cmd, 3338 priv->msg_buffers[i].info.c_struct.cmd,
3401 priv->msg_buffers[i].info.c_struct.cmd_phys); 3339 priv->msg_buffers[i].info.c_struct.
3340 cmd_phys);
3402 } 3341 }
3403 3342
3404 kfree(priv->msg_buffers); 3343 kfree(priv->msg_buffers);
@@ -3424,6 +3363,7 @@ static ssize_t show_pci(struct device *d, struct device_attribute *attr,
3424 3363
3425 return out - buf; 3364 return out - buf;
3426} 3365}
3366
3427static DEVICE_ATTR(pci, S_IRUGO, show_pci, NULL); 3367static DEVICE_ATTR(pci, S_IRUGO, show_pci, NULL);
3428 3368
3429static ssize_t show_cfg(struct device *d, struct device_attribute *attr, 3369static ssize_t show_cfg(struct device *d, struct device_attribute *attr,
@@ -3432,209 +3372,269 @@ static ssize_t show_cfg(struct device *d, struct device_attribute *attr,
3432 struct ipw2100_priv *p = d->driver_data; 3372 struct ipw2100_priv *p = d->driver_data;
3433 return sprintf(buf, "0x%08x\n", (int)p->config); 3373 return sprintf(buf, "0x%08x\n", (int)p->config);
3434} 3374}
3375
3435static DEVICE_ATTR(cfg, S_IRUGO, show_cfg, NULL); 3376static DEVICE_ATTR(cfg, S_IRUGO, show_cfg, NULL);
3436 3377
3437static ssize_t show_status(struct device *d, struct device_attribute *attr, 3378static ssize_t show_status(struct device *d, struct device_attribute *attr,
3438 char *buf) 3379 char *buf)
3439{ 3380{
3440 struct ipw2100_priv *p = d->driver_data; 3381 struct ipw2100_priv *p = d->driver_data;
3441 return sprintf(buf, "0x%08x\n", (int)p->status); 3382 return sprintf(buf, "0x%08x\n", (int)p->status);
3442} 3383}
3384
3443static DEVICE_ATTR(status, S_IRUGO, show_status, NULL); 3385static DEVICE_ATTR(status, S_IRUGO, show_status, NULL);
3444 3386
3445static ssize_t show_capability(struct device *d, struct device_attribute *attr, 3387static ssize_t show_capability(struct device *d, struct device_attribute *attr,
3446 char *buf) 3388 char *buf)
3447{ 3389{
3448 struct ipw2100_priv *p = d->driver_data; 3390 struct ipw2100_priv *p = d->driver_data;
3449 return sprintf(buf, "0x%08x\n", (int)p->capability); 3391 return sprintf(buf, "0x%08x\n", (int)p->capability);
3450} 3392}
3451static DEVICE_ATTR(capability, S_IRUGO, show_capability, NULL);
3452 3393
3394static DEVICE_ATTR(capability, S_IRUGO, show_capability, NULL);
3453 3395
3454#define IPW2100_REG(x) { IPW_ ##x, #x } 3396#define IPW2100_REG(x) { IPW_ ##x, #x }
3455static const struct { 3397static const struct {
3456 u32 addr; 3398 u32 addr;
3457 const char *name; 3399 const char *name;
3458} hw_data[] = { 3400} hw_data[] = {
3459 IPW2100_REG(REG_GP_CNTRL), 3401IPW2100_REG(REG_GP_CNTRL),
3460 IPW2100_REG(REG_GPIO), 3402 IPW2100_REG(REG_GPIO),
3461 IPW2100_REG(REG_INTA), 3403 IPW2100_REG(REG_INTA),
3462 IPW2100_REG(REG_INTA_MASK), 3404 IPW2100_REG(REG_INTA_MASK), IPW2100_REG(REG_RESET_REG),};
3463 IPW2100_REG(REG_RESET_REG),
3464};
3465#define IPW2100_NIC(x, s) { x, #x, s } 3405#define IPW2100_NIC(x, s) { x, #x, s }
3466static const struct { 3406static const struct {
3467 u32 addr; 3407 u32 addr;
3468 const char *name; 3408 const char *name;
3469 size_t size; 3409 size_t size;
3470} nic_data[] = { 3410} nic_data[] = {
3471 IPW2100_NIC(IPW2100_CONTROL_REG, 2), 3411IPW2100_NIC(IPW2100_CONTROL_REG, 2),
3472 IPW2100_NIC(0x210014, 1), 3412 IPW2100_NIC(0x210014, 1), IPW2100_NIC(0x210000, 1),};
3473 IPW2100_NIC(0x210000, 1),
3474};
3475#define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } 3413#define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d }
3476static const struct { 3414static const struct {
3477 u8 index; 3415 u8 index;
3478 const char *name; 3416 const char *name;
3479 const char *desc; 3417 const char *desc;
3480} ord_data[] = { 3418} ord_data[] = {
3481 IPW2100_ORD(STAT_TX_HOST_REQUESTS, "requested Host Tx's (MSDU)"), 3419IPW2100_ORD(STAT_TX_HOST_REQUESTS, "requested Host Tx's (MSDU)"),
3482 IPW2100_ORD(STAT_TX_HOST_COMPLETE, "successful Host Tx's (MSDU)"), 3420 IPW2100_ORD(STAT_TX_HOST_COMPLETE,
3483 IPW2100_ORD(STAT_TX_DIR_DATA, "successful Directed Tx's (MSDU)"), 3421 "successful Host Tx's (MSDU)"),
3484 IPW2100_ORD(STAT_TX_DIR_DATA1, "successful Directed Tx's (MSDU) @ 1MB"), 3422 IPW2100_ORD(STAT_TX_DIR_DATA,
3485 IPW2100_ORD(STAT_TX_DIR_DATA2, "successful Directed Tx's (MSDU) @ 2MB"), 3423 "successful Directed Tx's (MSDU)"),
3486 IPW2100_ORD(STAT_TX_DIR_DATA5_5, "successful Directed Tx's (MSDU) @ 5_5MB"), 3424 IPW2100_ORD(STAT_TX_DIR_DATA1,
3487 IPW2100_ORD(STAT_TX_DIR_DATA11, "successful Directed Tx's (MSDU) @ 11MB"), 3425 "successful Directed Tx's (MSDU) @ 1MB"),
3488 IPW2100_ORD(STAT_TX_NODIR_DATA1, "successful Non_Directed Tx's (MSDU) @ 1MB"), 3426 IPW2100_ORD(STAT_TX_DIR_DATA2,
3489 IPW2100_ORD(STAT_TX_NODIR_DATA2, "successful Non_Directed Tx's (MSDU) @ 2MB"), 3427 "successful Directed Tx's (MSDU) @ 2MB"),
3490 IPW2100_ORD(STAT_TX_NODIR_DATA5_5, "successful Non_Directed Tx's (MSDU) @ 5.5MB"), 3428 IPW2100_ORD(STAT_TX_DIR_DATA5_5,
3491 IPW2100_ORD(STAT_TX_NODIR_DATA11, "successful Non_Directed Tx's (MSDU) @ 11MB"), 3429 "successful Directed Tx's (MSDU) @ 5_5MB"),
3492 IPW2100_ORD(STAT_NULL_DATA, "successful NULL data Tx's"), 3430 IPW2100_ORD(STAT_TX_DIR_DATA11,
3493 IPW2100_ORD(STAT_TX_RTS, "successful Tx RTS"), 3431 "successful Directed Tx's (MSDU) @ 11MB"),
3494 IPW2100_ORD(STAT_TX_CTS, "successful Tx CTS"), 3432 IPW2100_ORD(STAT_TX_NODIR_DATA1,
3495 IPW2100_ORD(STAT_TX_ACK, "successful Tx ACK"), 3433 "successful Non_Directed Tx's (MSDU) @ 1MB"),
3496 IPW2100_ORD(STAT_TX_ASSN, "successful Association Tx's"), 3434 IPW2100_ORD(STAT_TX_NODIR_DATA2,
3497 IPW2100_ORD(STAT_TX_ASSN_RESP, "successful Association response Tx's"), 3435 "successful Non_Directed Tx's (MSDU) @ 2MB"),
3498 IPW2100_ORD(STAT_TX_REASSN, "successful Reassociation Tx's"), 3436 IPW2100_ORD(STAT_TX_NODIR_DATA5_5,
3499 IPW2100_ORD(STAT_TX_REASSN_RESP, "successful Reassociation response Tx's"), 3437 "successful Non_Directed Tx's (MSDU) @ 5.5MB"),
3500 IPW2100_ORD(STAT_TX_PROBE, "probes successfully transmitted"), 3438 IPW2100_ORD(STAT_TX_NODIR_DATA11,
3501 IPW2100_ORD(STAT_TX_PROBE_RESP, "probe responses successfully transmitted"), 3439 "successful Non_Directed Tx's (MSDU) @ 11MB"),
3502 IPW2100_ORD(STAT_TX_BEACON, "tx beacon"), 3440 IPW2100_ORD(STAT_NULL_DATA, "successful NULL data Tx's"),
3503 IPW2100_ORD(STAT_TX_ATIM, "Tx ATIM"), 3441 IPW2100_ORD(STAT_TX_RTS, "successful Tx RTS"),
3504 IPW2100_ORD(STAT_TX_DISASSN, "successful Disassociation TX"), 3442 IPW2100_ORD(STAT_TX_CTS, "successful Tx CTS"),
3505 IPW2100_ORD(STAT_TX_AUTH, "successful Authentication Tx"), 3443 IPW2100_ORD(STAT_TX_ACK, "successful Tx ACK"),
3506 IPW2100_ORD(STAT_TX_DEAUTH, "successful Deauthentication TX"), 3444 IPW2100_ORD(STAT_TX_ASSN, "successful Association Tx's"),
3507 IPW2100_ORD(STAT_TX_TOTAL_BYTES, "Total successful Tx data bytes"), 3445 IPW2100_ORD(STAT_TX_ASSN_RESP,
3508 IPW2100_ORD(STAT_TX_RETRIES, "Tx retries"), 3446 "successful Association response Tx's"),
3509 IPW2100_ORD(STAT_TX_RETRY1, "Tx retries at 1MBPS"), 3447 IPW2100_ORD(STAT_TX_REASSN,
3510 IPW2100_ORD(STAT_TX_RETRY2, "Tx retries at 2MBPS"), 3448 "successful Reassociation Tx's"),
3511 IPW2100_ORD(STAT_TX_RETRY5_5, "Tx retries at 5.5MBPS"), 3449 IPW2100_ORD(STAT_TX_REASSN_RESP,
3512 IPW2100_ORD(STAT_TX_RETRY11, "Tx retries at 11MBPS"), 3450 "successful Reassociation response Tx's"),
3513 IPW2100_ORD(STAT_TX_FAILURES, "Tx Failures"), 3451 IPW2100_ORD(STAT_TX_PROBE,
3514 IPW2100_ORD(STAT_TX_MAX_TRIES_IN_HOP,"times max tries in a hop failed"), 3452 "probes successfully transmitted"),
3515 IPW2100_ORD(STAT_TX_DISASSN_FAIL, "times disassociation failed"), 3453 IPW2100_ORD(STAT_TX_PROBE_RESP,
3516 IPW2100_ORD(STAT_TX_ERR_CTS, "missed/bad CTS frames"), 3454 "probe responses successfully transmitted"),
3517 IPW2100_ORD(STAT_TX_ERR_ACK, "tx err due to acks"), 3455 IPW2100_ORD(STAT_TX_BEACON, "tx beacon"),
3518 IPW2100_ORD(STAT_RX_HOST, "packets passed to host"), 3456 IPW2100_ORD(STAT_TX_ATIM, "Tx ATIM"),
3519 IPW2100_ORD(STAT_RX_DIR_DATA, "directed packets"), 3457 IPW2100_ORD(STAT_TX_DISASSN,
3520 IPW2100_ORD(STAT_RX_DIR_DATA1, "directed packets at 1MB"), 3458 "successful Disassociation TX"),
3521 IPW2100_ORD(STAT_RX_DIR_DATA2, "directed packets at 2MB"), 3459 IPW2100_ORD(STAT_TX_AUTH, "successful Authentication Tx"),
3522 IPW2100_ORD(STAT_RX_DIR_DATA5_5, "directed packets at 5.5MB"), 3460 IPW2100_ORD(STAT_TX_DEAUTH,
3523 IPW2100_ORD(STAT_RX_DIR_DATA11, "directed packets at 11MB"), 3461 "successful Deauthentication TX"),
3524 IPW2100_ORD(STAT_RX_NODIR_DATA,"nondirected packets"), 3462 IPW2100_ORD(STAT_TX_TOTAL_BYTES,
3525 IPW2100_ORD(STAT_RX_NODIR_DATA1, "nondirected packets at 1MB"), 3463 "Total successful Tx data bytes"),
3526 IPW2100_ORD(STAT_RX_NODIR_DATA2, "nondirected packets at 2MB"), 3464 IPW2100_ORD(STAT_TX_RETRIES, "Tx retries"),
3527 IPW2100_ORD(STAT_RX_NODIR_DATA5_5, "nondirected packets at 5.5MB"), 3465 IPW2100_ORD(STAT_TX_RETRY1, "Tx retries at 1MBPS"),
3528 IPW2100_ORD(STAT_RX_NODIR_DATA11, "nondirected packets at 11MB"), 3466 IPW2100_ORD(STAT_TX_RETRY2, "Tx retries at 2MBPS"),
3529 IPW2100_ORD(STAT_RX_NULL_DATA, "null data rx's"), 3467 IPW2100_ORD(STAT_TX_RETRY5_5, "Tx retries at 5.5MBPS"),
3530 IPW2100_ORD(STAT_RX_RTS, "Rx RTS"), 3468 IPW2100_ORD(STAT_TX_RETRY11, "Tx retries at 11MBPS"),
3531 IPW2100_ORD(STAT_RX_CTS, "Rx CTS"), 3469 IPW2100_ORD(STAT_TX_FAILURES, "Tx Failures"),
3532 IPW2100_ORD(STAT_RX_ACK, "Rx ACK"), 3470 IPW2100_ORD(STAT_TX_MAX_TRIES_IN_HOP,
3533 IPW2100_ORD(STAT_RX_CFEND, "Rx CF End"), 3471 "times max tries in a hop failed"),
3534 IPW2100_ORD(STAT_RX_CFEND_ACK, "Rx CF End + CF Ack"), 3472 IPW2100_ORD(STAT_TX_DISASSN_FAIL,
3535 IPW2100_ORD(STAT_RX_ASSN, "Association Rx's"), 3473 "times disassociation failed"),
3536 IPW2100_ORD(STAT_RX_ASSN_RESP, "Association response Rx's"), 3474 IPW2100_ORD(STAT_TX_ERR_CTS, "missed/bad CTS frames"),
3537 IPW2100_ORD(STAT_RX_REASSN, "Reassociation Rx's"), 3475 IPW2100_ORD(STAT_TX_ERR_ACK, "tx err due to acks"),
3538 IPW2100_ORD(STAT_RX_REASSN_RESP, "Reassociation response Rx's"), 3476 IPW2100_ORD(STAT_RX_HOST, "packets passed to host"),
3539 IPW2100_ORD(STAT_RX_PROBE, "probe Rx's"), 3477 IPW2100_ORD(STAT_RX_DIR_DATA, "directed packets"),
3540 IPW2100_ORD(STAT_RX_PROBE_RESP, "probe response Rx's"), 3478 IPW2100_ORD(STAT_RX_DIR_DATA1, "directed packets at 1MB"),
3541 IPW2100_ORD(STAT_RX_BEACON, "Rx beacon"), 3479 IPW2100_ORD(STAT_RX_DIR_DATA2, "directed packets at 2MB"),
3542 IPW2100_ORD(STAT_RX_ATIM, "Rx ATIM"), 3480 IPW2100_ORD(STAT_RX_DIR_DATA5_5,
3543 IPW2100_ORD(STAT_RX_DISASSN, "disassociation Rx"), 3481 "directed packets at 5.5MB"),
3544 IPW2100_ORD(STAT_RX_AUTH, "authentication Rx"), 3482 IPW2100_ORD(STAT_RX_DIR_DATA11, "directed packets at 11MB"),
3545 IPW2100_ORD(STAT_RX_DEAUTH, "deauthentication Rx"), 3483 IPW2100_ORD(STAT_RX_NODIR_DATA, "nondirected packets"),
3546 IPW2100_ORD(STAT_RX_TOTAL_BYTES,"Total rx data bytes received"), 3484 IPW2100_ORD(STAT_RX_NODIR_DATA1,
3547 IPW2100_ORD(STAT_RX_ERR_CRC, "packets with Rx CRC error"), 3485 "nondirected packets at 1MB"),
3548 IPW2100_ORD(STAT_RX_ERR_CRC1, "Rx CRC errors at 1MB"), 3486 IPW2100_ORD(STAT_RX_NODIR_DATA2,
3549 IPW2100_ORD(STAT_RX_ERR_CRC2, "Rx CRC errors at 2MB"), 3487 "nondirected packets at 2MB"),
3550 IPW2100_ORD(STAT_RX_ERR_CRC5_5, "Rx CRC errors at 5.5MB"), 3488 IPW2100_ORD(STAT_RX_NODIR_DATA5_5,
3551 IPW2100_ORD(STAT_RX_ERR_CRC11, "Rx CRC errors at 11MB"), 3489 "nondirected packets at 5.5MB"),
3552 IPW2100_ORD(STAT_RX_DUPLICATE1, "duplicate rx packets at 1MB"), 3490 IPW2100_ORD(STAT_RX_NODIR_DATA11,
3553 IPW2100_ORD(STAT_RX_DUPLICATE2, "duplicate rx packets at 2MB"), 3491 "nondirected packets at 11MB"),
3554 IPW2100_ORD(STAT_RX_DUPLICATE5_5, "duplicate rx packets at 5.5MB"), 3492 IPW2100_ORD(STAT_RX_NULL_DATA, "null data rx's"),
3555 IPW2100_ORD(STAT_RX_DUPLICATE11, "duplicate rx packets at 11MB"), 3493 IPW2100_ORD(STAT_RX_RTS, "Rx RTS"), IPW2100_ORD(STAT_RX_CTS,
3556 IPW2100_ORD(STAT_RX_DUPLICATE, "duplicate rx packets"), 3494 "Rx CTS"),
3557 IPW2100_ORD(PERS_DB_LOCK, "locking fw permanent db"), 3495 IPW2100_ORD(STAT_RX_ACK, "Rx ACK"),
3558 IPW2100_ORD(PERS_DB_SIZE, "size of fw permanent db"), 3496 IPW2100_ORD(STAT_RX_CFEND, "Rx CF End"),
3559 IPW2100_ORD(PERS_DB_ADDR, "address of fw permanent db"), 3497 IPW2100_ORD(STAT_RX_CFEND_ACK, "Rx CF End + CF Ack"),
3560 IPW2100_ORD(STAT_RX_INVALID_PROTOCOL, "rx frames with invalid protocol"), 3498 IPW2100_ORD(STAT_RX_ASSN, "Association Rx's"),
3561 IPW2100_ORD(SYS_BOOT_TIME, "Boot time"), 3499 IPW2100_ORD(STAT_RX_ASSN_RESP, "Association response Rx's"),
3562 IPW2100_ORD(STAT_RX_NO_BUFFER, "rx frames rejected due to no buffer"), 3500 IPW2100_ORD(STAT_RX_REASSN, "Reassociation Rx's"),
3563 IPW2100_ORD(STAT_RX_MISSING_FRAG, "rx frames dropped due to missing fragment"), 3501 IPW2100_ORD(STAT_RX_REASSN_RESP,
3564 IPW2100_ORD(STAT_RX_ORPHAN_FRAG, "rx frames dropped due to non-sequential fragment"), 3502 "Reassociation response Rx's"),
3565 IPW2100_ORD(STAT_RX_ORPHAN_FRAME, "rx frames dropped due to unmatched 1st frame"), 3503 IPW2100_ORD(STAT_RX_PROBE, "probe Rx's"),
3566 IPW2100_ORD(STAT_RX_FRAG_AGEOUT, "rx frames dropped due to uncompleted frame"), 3504 IPW2100_ORD(STAT_RX_PROBE_RESP, "probe response Rx's"),
3567 IPW2100_ORD(STAT_RX_ICV_ERRORS, "ICV errors during decryption"), 3505 IPW2100_ORD(STAT_RX_BEACON, "Rx beacon"),
3568 IPW2100_ORD(STAT_PSP_SUSPENSION,"times adapter suspended"), 3506 IPW2100_ORD(STAT_RX_ATIM, "Rx ATIM"),
3569 IPW2100_ORD(STAT_PSP_BCN_TIMEOUT, "beacon timeout"), 3507 IPW2100_ORD(STAT_RX_DISASSN, "disassociation Rx"),
3570 IPW2100_ORD(STAT_PSP_POLL_TIMEOUT, "poll response timeouts"), 3508 IPW2100_ORD(STAT_RX_AUTH, "authentication Rx"),
3571 IPW2100_ORD(STAT_PSP_NONDIR_TIMEOUT, "timeouts waiting for last {broad,multi}cast pkt"), 3509 IPW2100_ORD(STAT_RX_DEAUTH, "deauthentication Rx"),
3572 IPW2100_ORD(STAT_PSP_RX_DTIMS, "PSP DTIMs received"), 3510 IPW2100_ORD(STAT_RX_TOTAL_BYTES,
3573 IPW2100_ORD(STAT_PSP_RX_TIMS, "PSP TIMs received"), 3511 "Total rx data bytes received"),
3574 IPW2100_ORD(STAT_PSP_STATION_ID,"PSP Station ID"), 3512 IPW2100_ORD(STAT_RX_ERR_CRC, "packets with Rx CRC error"),
3575 IPW2100_ORD(LAST_ASSN_TIME, "RTC time of last association"), 3513 IPW2100_ORD(STAT_RX_ERR_CRC1, "Rx CRC errors at 1MB"),
3576 IPW2100_ORD(STAT_PERCENT_MISSED_BCNS,"current calculation of % missed beacons"), 3514 IPW2100_ORD(STAT_RX_ERR_CRC2, "Rx CRC errors at 2MB"),
3577 IPW2100_ORD(STAT_PERCENT_RETRIES,"current calculation of % missed tx retries"), 3515 IPW2100_ORD(STAT_RX_ERR_CRC5_5, "Rx CRC errors at 5.5MB"),
3578 IPW2100_ORD(ASSOCIATED_AP_PTR, "0 if not associated, else pointer to AP table entry"), 3516 IPW2100_ORD(STAT_RX_ERR_CRC11, "Rx CRC errors at 11MB"),
3579 IPW2100_ORD(AVAILABLE_AP_CNT, "AP's decsribed in the AP table"), 3517 IPW2100_ORD(STAT_RX_DUPLICATE1,
3580 IPW2100_ORD(AP_LIST_PTR, "Ptr to list of available APs"), 3518 "duplicate rx packets at 1MB"),
3581 IPW2100_ORD(STAT_AP_ASSNS, "associations"), 3519 IPW2100_ORD(STAT_RX_DUPLICATE2,
3582 IPW2100_ORD(STAT_ASSN_FAIL, "association failures"), 3520 "duplicate rx packets at 2MB"),
3583 IPW2100_ORD(STAT_ASSN_RESP_FAIL,"failures due to response fail"), 3521 IPW2100_ORD(STAT_RX_DUPLICATE5_5,
3584 IPW2100_ORD(STAT_FULL_SCANS, "full scans"), 3522 "duplicate rx packets at 5.5MB"),
3585 IPW2100_ORD(CARD_DISABLED, "Card Disabled"), 3523 IPW2100_ORD(STAT_RX_DUPLICATE11,
3586 IPW2100_ORD(STAT_ROAM_INHIBIT, "times roaming was inhibited due to activity"), 3524 "duplicate rx packets at 11MB"),
3587 IPW2100_ORD(RSSI_AT_ASSN, "RSSI of associated AP at time of association"), 3525 IPW2100_ORD(STAT_RX_DUPLICATE, "duplicate rx packets"),
3588 IPW2100_ORD(STAT_ASSN_CAUSE1, "reassociation: no probe response or TX on hop"), 3526 IPW2100_ORD(PERS_DB_LOCK, "locking fw permanent db"),
3589 IPW2100_ORD(STAT_ASSN_CAUSE2, "reassociation: poor tx/rx quality"), 3527 IPW2100_ORD(PERS_DB_SIZE, "size of fw permanent db"),
3590 IPW2100_ORD(STAT_ASSN_CAUSE3, "reassociation: tx/rx quality (excessive AP load"), 3528 IPW2100_ORD(PERS_DB_ADDR, "address of fw permanent db"),
3591 IPW2100_ORD(STAT_ASSN_CAUSE4, "reassociation: AP RSSI level"), 3529 IPW2100_ORD(STAT_RX_INVALID_PROTOCOL,
3592 IPW2100_ORD(STAT_ASSN_CAUSE5, "reassociations due to load leveling"), 3530 "rx frames with invalid protocol"),
3593 IPW2100_ORD(STAT_AUTH_FAIL, "times authentication failed"), 3531 IPW2100_ORD(SYS_BOOT_TIME, "Boot time"),
3594 IPW2100_ORD(STAT_AUTH_RESP_FAIL,"times authentication response failed"), 3532 IPW2100_ORD(STAT_RX_NO_BUFFER,
3595 IPW2100_ORD(STATION_TABLE_CNT, "entries in association table"), 3533 "rx frames rejected due to no buffer"),
3596 IPW2100_ORD(RSSI_AVG_CURR, "Current avg RSSI"), 3534 IPW2100_ORD(STAT_RX_MISSING_FRAG,
3597 IPW2100_ORD(POWER_MGMT_MODE, "Power mode - 0=CAM, 1=PSP"), 3535 "rx frames dropped due to missing fragment"),
3598 IPW2100_ORD(COUNTRY_CODE, "IEEE country code as recv'd from beacon"), 3536 IPW2100_ORD(STAT_RX_ORPHAN_FRAG,
3599 IPW2100_ORD(COUNTRY_CHANNELS, "channels suported by country"), 3537 "rx frames dropped due to non-sequential fragment"),
3600 IPW2100_ORD(RESET_CNT, "adapter resets (warm)"), 3538 IPW2100_ORD(STAT_RX_ORPHAN_FRAME,
3601 IPW2100_ORD(BEACON_INTERVAL, "Beacon interval"), 3539 "rx frames dropped due to unmatched 1st frame"),
3602 IPW2100_ORD(ANTENNA_DIVERSITY, "TRUE if antenna diversity is disabled"), 3540 IPW2100_ORD(STAT_RX_FRAG_AGEOUT,
3603 IPW2100_ORD(DTIM_PERIOD, "beacon intervals between DTIMs"), 3541 "rx frames dropped due to uncompleted frame"),
3604 IPW2100_ORD(OUR_FREQ, "current radio freq lower digits - channel ID"), 3542 IPW2100_ORD(STAT_RX_ICV_ERRORS,
3605 IPW2100_ORD(RTC_TIME, "current RTC time"), 3543 "ICV errors during decryption"),
3606 IPW2100_ORD(PORT_TYPE, "operating mode"), 3544 IPW2100_ORD(STAT_PSP_SUSPENSION, "times adapter suspended"),
3607 IPW2100_ORD(CURRENT_TX_RATE, "current tx rate"), 3545 IPW2100_ORD(STAT_PSP_BCN_TIMEOUT, "beacon timeout"),
3608 IPW2100_ORD(SUPPORTED_RATES, "supported tx rates"), 3546 IPW2100_ORD(STAT_PSP_POLL_TIMEOUT,
3609 IPW2100_ORD(ATIM_WINDOW, "current ATIM Window"), 3547 "poll response timeouts"),
3610 IPW2100_ORD(BASIC_RATES, "basic tx rates"), 3548 IPW2100_ORD(STAT_PSP_NONDIR_TIMEOUT,
3611 IPW2100_ORD(NIC_HIGHEST_RATE, "NIC highest tx rate"), 3549 "timeouts waiting for last {broad,multi}cast pkt"),
3612 IPW2100_ORD(AP_HIGHEST_RATE, "AP highest tx rate"), 3550 IPW2100_ORD(STAT_PSP_RX_DTIMS, "PSP DTIMs received"),
3613 IPW2100_ORD(CAPABILITIES, "Management frame capability field"), 3551 IPW2100_ORD(STAT_PSP_RX_TIMS, "PSP TIMs received"),
3614 IPW2100_ORD(AUTH_TYPE, "Type of authentication"), 3552 IPW2100_ORD(STAT_PSP_STATION_ID, "PSP Station ID"),
3615 IPW2100_ORD(RADIO_TYPE, "Adapter card platform type"), 3553 IPW2100_ORD(LAST_ASSN_TIME, "RTC time of last association"),
3616 IPW2100_ORD(RTS_THRESHOLD, "Min packet length for RTS handshaking"), 3554 IPW2100_ORD(STAT_PERCENT_MISSED_BCNS,
3617 IPW2100_ORD(INT_MODE, "International mode"), 3555 "current calculation of % missed beacons"),
3618 IPW2100_ORD(FRAGMENTATION_THRESHOLD, "protocol frag threshold"), 3556 IPW2100_ORD(STAT_PERCENT_RETRIES,
3619 IPW2100_ORD(EEPROM_SRAM_DB_BLOCK_START_ADDRESS, "EEPROM offset in SRAM"), 3557 "current calculation of % missed tx retries"),
3620 IPW2100_ORD(EEPROM_SRAM_DB_BLOCK_SIZE, "EEPROM size in SRAM"), 3558 IPW2100_ORD(ASSOCIATED_AP_PTR,
3621 IPW2100_ORD(EEPROM_SKU_CAPABILITY, "EEPROM SKU Capability"), 3559 "0 if not associated, else pointer to AP table entry"),
3622 IPW2100_ORD(EEPROM_IBSS_11B_CHANNELS, "EEPROM IBSS 11b channel set"), 3560 IPW2100_ORD(AVAILABLE_AP_CNT,
3623 IPW2100_ORD(MAC_VERSION, "MAC Version"), 3561 "AP's decsribed in the AP table"),
3624 IPW2100_ORD(MAC_REVISION, "MAC Revision"), 3562 IPW2100_ORD(AP_LIST_PTR, "Ptr to list of available APs"),
3625 IPW2100_ORD(RADIO_VERSION, "Radio Version"), 3563 IPW2100_ORD(STAT_AP_ASSNS, "associations"),
3626 IPW2100_ORD(NIC_MANF_DATE_TIME, "MANF Date/Time STAMP"), 3564 IPW2100_ORD(STAT_ASSN_FAIL, "association failures"),
3627 IPW2100_ORD(UCODE_VERSION, "Ucode Version"), 3565 IPW2100_ORD(STAT_ASSN_RESP_FAIL,
3628}; 3566 "failures due to response fail"),
3629 3567 IPW2100_ORD(STAT_FULL_SCANS, "full scans"),
3568 IPW2100_ORD(CARD_DISABLED, "Card Disabled"),
3569 IPW2100_ORD(STAT_ROAM_INHIBIT,
3570 "times roaming was inhibited due to activity"),
3571 IPW2100_ORD(RSSI_AT_ASSN,
3572 "RSSI of associated AP at time of association"),
3573 IPW2100_ORD(STAT_ASSN_CAUSE1,
3574 "reassociation: no probe response or TX on hop"),
3575 IPW2100_ORD(STAT_ASSN_CAUSE2,
3576 "reassociation: poor tx/rx quality"),
3577 IPW2100_ORD(STAT_ASSN_CAUSE3,
3578 "reassociation: tx/rx quality (excessive AP load"),
3579 IPW2100_ORD(STAT_ASSN_CAUSE4,
3580 "reassociation: AP RSSI level"),
3581 IPW2100_ORD(STAT_ASSN_CAUSE5,
3582 "reassociations due to load leveling"),
3583 IPW2100_ORD(STAT_AUTH_FAIL, "times authentication failed"),
3584 IPW2100_ORD(STAT_AUTH_RESP_FAIL,
3585 "times authentication response failed"),
3586 IPW2100_ORD(STATION_TABLE_CNT,
3587 "entries in association table"),
3588 IPW2100_ORD(RSSI_AVG_CURR, "Current avg RSSI"),
3589 IPW2100_ORD(POWER_MGMT_MODE, "Power mode - 0=CAM, 1=PSP"),
3590 IPW2100_ORD(COUNTRY_CODE,
3591 "IEEE country code as recv'd from beacon"),
3592 IPW2100_ORD(COUNTRY_CHANNELS,
3593 "channels suported by country"),
3594 IPW2100_ORD(RESET_CNT, "adapter resets (warm)"),
3595 IPW2100_ORD(BEACON_INTERVAL, "Beacon interval"),
3596 IPW2100_ORD(ANTENNA_DIVERSITY,
3597 "TRUE if antenna diversity is disabled"),
3598 IPW2100_ORD(DTIM_PERIOD, "beacon intervals between DTIMs"),
3599 IPW2100_ORD(OUR_FREQ,
3600 "current radio freq lower digits - channel ID"),
3601 IPW2100_ORD(RTC_TIME, "current RTC time"),
3602 IPW2100_ORD(PORT_TYPE, "operating mode"),
3603 IPW2100_ORD(CURRENT_TX_RATE, "current tx rate"),
3604 IPW2100_ORD(SUPPORTED_RATES, "supported tx rates"),
3605 IPW2100_ORD(ATIM_WINDOW, "current ATIM Window"),
3606 IPW2100_ORD(BASIC_RATES, "basic tx rates"),
3607 IPW2100_ORD(NIC_HIGHEST_RATE, "NIC highest tx rate"),
3608 IPW2100_ORD(AP_HIGHEST_RATE, "AP highest tx rate"),
3609 IPW2100_ORD(CAPABILITIES,
3610 "Management frame capability field"),
3611 IPW2100_ORD(AUTH_TYPE, "Type of authentication"),
3612 IPW2100_ORD(RADIO_TYPE, "Adapter card platform type"),
3613 IPW2100_ORD(RTS_THRESHOLD,
3614 "Min packet length for RTS handshaking"),
3615 IPW2100_ORD(INT_MODE, "International mode"),
3616 IPW2100_ORD(FRAGMENTATION_THRESHOLD,
3617 "protocol frag threshold"),
3618 IPW2100_ORD(EEPROM_SRAM_DB_BLOCK_START_ADDRESS,
3619 "EEPROM offset in SRAM"),
3620 IPW2100_ORD(EEPROM_SRAM_DB_BLOCK_SIZE,
3621 "EEPROM size in SRAM"),
3622 IPW2100_ORD(EEPROM_SKU_CAPABILITY, "EEPROM SKU Capability"),
3623 IPW2100_ORD(EEPROM_IBSS_11B_CHANNELS,
3624 "EEPROM IBSS 11b channel set"),
3625 IPW2100_ORD(MAC_VERSION, "MAC Version"),
3626 IPW2100_ORD(MAC_REVISION, "MAC Revision"),
3627 IPW2100_ORD(RADIO_VERSION, "Radio Version"),
3628 IPW2100_ORD(NIC_MANF_DATE_TIME, "MANF Date/Time STAMP"),
3629 IPW2100_ORD(UCODE_VERSION, "Ucode Version"),};
3630 3630
3631static ssize_t show_registers(struct device *d, struct device_attribute *attr, 3631static ssize_t show_registers(struct device *d, struct device_attribute *attr,
3632 char *buf) 3632 char *buf)
3633{ 3633{
3634 int i; 3634 int i;
3635 struct ipw2100_priv *priv = dev_get_drvdata(d); 3635 struct ipw2100_priv *priv = dev_get_drvdata(d);
3636 struct net_device *dev = priv->net_dev; 3636 struct net_device *dev = priv->net_dev;
3637 char * out = buf; 3637 char *out = buf;
3638 u32 val = 0; 3638 u32 val = 0;
3639 3639
3640 out += sprintf(out, "%30s [Address ] : Hex\n", "Register"); 3640 out += sprintf(out, "%30s [Address ] : Hex\n", "Register");
@@ -3647,15 +3647,15 @@ static ssize_t show_registers(struct device *d, struct device_attribute *attr,
3647 3647
3648 return out - buf; 3648 return out - buf;
3649} 3649}
3650static DEVICE_ATTR(registers, S_IRUGO, show_registers, NULL);
3651 3650
3651static DEVICE_ATTR(registers, S_IRUGO, show_registers, NULL);
3652 3652
3653static ssize_t show_hardware(struct device *d, struct device_attribute *attr, 3653static ssize_t show_hardware(struct device *d, struct device_attribute *attr,
3654 char *buf) 3654 char *buf)
3655{ 3655{
3656 struct ipw2100_priv *priv = dev_get_drvdata(d); 3656 struct ipw2100_priv *priv = dev_get_drvdata(d);
3657 struct net_device *dev = priv->net_dev; 3657 struct net_device *dev = priv->net_dev;
3658 char * out = buf; 3658 char *out = buf;
3659 int i; 3659 int i;
3660 3660
3661 out += sprintf(out, "%30s [Address ] : Hex\n", "NIC entry"); 3661 out += sprintf(out, "%30s [Address ] : Hex\n", "NIC entry");
@@ -3688,11 +3688,11 @@ static ssize_t show_hardware(struct device *d, struct device_attribute *attr,
3688 } 3688 }
3689 return out - buf; 3689 return out - buf;
3690} 3690}
3691static DEVICE_ATTR(hardware, S_IRUGO, show_hardware, NULL);
3692 3691
3692static DEVICE_ATTR(hardware, S_IRUGO, show_hardware, NULL);
3693 3693
3694static ssize_t show_memory(struct device *d, struct device_attribute *attr, 3694static ssize_t show_memory(struct device *d, struct device_attribute *attr,
3695 char *buf) 3695 char *buf)
3696{ 3696{
3697 struct ipw2100_priv *priv = dev_get_drvdata(d); 3697 struct ipw2100_priv *priv = dev_get_drvdata(d);
3698 struct net_device *dev = priv->net_dev; 3698 struct net_device *dev = priv->net_dev;
@@ -3708,10 +3708,13 @@ static ssize_t show_memory(struct device *d, struct device_attribute *attr,
3708 /* sysfs provides us PAGE_SIZE buffer */ 3708 /* sysfs provides us PAGE_SIZE buffer */
3709 while (len < PAGE_SIZE - 128 && loop < 0x30000) { 3709 while (len < PAGE_SIZE - 128 && loop < 0x30000) {
3710 3710
3711 if (priv->snapshot[0]) for (i = 0; i < 4; i++) 3711 if (priv->snapshot[0])
3712 buffer[i] = *(u32 *)SNAPSHOT_ADDR(loop + i * 4); 3712 for (i = 0; i < 4; i++)
3713 else for (i = 0; i < 4; i++) 3713 buffer[i] =
3714 read_nic_dword(dev, loop + i * 4, &buffer[i]); 3714 *(u32 *) SNAPSHOT_ADDR(loop + i * 4);
3715 else
3716 for (i = 0; i < 4; i++)
3717 read_nic_dword(dev, loop + i * 4, &buffer[i]);
3715 3718
3716 if (priv->dump_raw) 3719 if (priv->dump_raw)
3717 len += sprintf(buf + len, 3720 len += sprintf(buf + len,
@@ -3719,26 +3722,26 @@ static ssize_t show_memory(struct device *d, struct device_attribute *attr,
3719 "%c%c%c%c" 3722 "%c%c%c%c"
3720 "%c%c%c%c" 3723 "%c%c%c%c"
3721 "%c%c%c%c", 3724 "%c%c%c%c",
3722 ((u8*)buffer)[0x0], 3725 ((u8 *) buffer)[0x0],
3723 ((u8*)buffer)[0x1], 3726 ((u8 *) buffer)[0x1],
3724 ((u8*)buffer)[0x2], 3727 ((u8 *) buffer)[0x2],
3725 ((u8*)buffer)[0x3], 3728 ((u8 *) buffer)[0x3],
3726 ((u8*)buffer)[0x4], 3729 ((u8 *) buffer)[0x4],
3727 ((u8*)buffer)[0x5], 3730 ((u8 *) buffer)[0x5],
3728 ((u8*)buffer)[0x6], 3731 ((u8 *) buffer)[0x6],
3729 ((u8*)buffer)[0x7], 3732 ((u8 *) buffer)[0x7],
3730 ((u8*)buffer)[0x8], 3733 ((u8 *) buffer)[0x8],
3731 ((u8*)buffer)[0x9], 3734 ((u8 *) buffer)[0x9],
3732 ((u8*)buffer)[0xa], 3735 ((u8 *) buffer)[0xa],
3733 ((u8*)buffer)[0xb], 3736 ((u8 *) buffer)[0xb],
3734 ((u8*)buffer)[0xc], 3737 ((u8 *) buffer)[0xc],
3735 ((u8*)buffer)[0xd], 3738 ((u8 *) buffer)[0xd],
3736 ((u8*)buffer)[0xe], 3739 ((u8 *) buffer)[0xe],
3737 ((u8*)buffer)[0xf]); 3740 ((u8 *) buffer)[0xf]);
3738 else 3741 else
3739 len += sprintf(buf + len, "%s\n", 3742 len += sprintf(buf + len, "%s\n",
3740 snprint_line(line, sizeof(line), 3743 snprint_line(line, sizeof(line),
3741 (u8*)buffer, 16, loop)); 3744 (u8 *) buffer, 16, loop));
3742 loop += 16; 3745 loop += 16;
3743 } 3746 }
3744 3747
@@ -3746,7 +3749,7 @@ static ssize_t show_memory(struct device *d, struct device_attribute *attr,
3746} 3749}
3747 3750
3748static ssize_t store_memory(struct device *d, struct device_attribute *attr, 3751static ssize_t store_memory(struct device *d, struct device_attribute *attr,
3749 const char *buf, size_t count) 3752 const char *buf, size_t count)
3750{ 3753{
3751 struct ipw2100_priv *priv = dev_get_drvdata(d); 3754 struct ipw2100_priv *priv = dev_get_drvdata(d);
3752 struct net_device *dev = priv->net_dev; 3755 struct net_device *dev = priv->net_dev;
@@ -3758,32 +3761,30 @@ static ssize_t store_memory(struct device *d, struct device_attribute *attr,
3758 if (p[0] == '1' || 3761 if (p[0] == '1' ||
3759 (count >= 2 && tolower(p[0]) == 'o' && tolower(p[1]) == 'n')) { 3762 (count >= 2 && tolower(p[0]) == 'o' && tolower(p[1]) == 'n')) {
3760 IPW_DEBUG_INFO("%s: Setting memory dump to RAW mode.\n", 3763 IPW_DEBUG_INFO("%s: Setting memory dump to RAW mode.\n",
3761 dev->name); 3764 dev->name);
3762 priv->dump_raw = 1; 3765 priv->dump_raw = 1;
3763 3766
3764 } else if (p[0] == '0' || (count >= 2 && tolower(p[0]) == 'o' && 3767 } else if (p[0] == '0' || (count >= 2 && tolower(p[0]) == 'o' &&
3765 tolower(p[1]) == 'f')) { 3768 tolower(p[1]) == 'f')) {
3766 IPW_DEBUG_INFO("%s: Setting memory dump to HEX mode.\n", 3769 IPW_DEBUG_INFO("%s: Setting memory dump to HEX mode.\n",
3767 dev->name); 3770 dev->name);
3768 priv->dump_raw = 0; 3771 priv->dump_raw = 0;
3769 3772
3770 } else if (tolower(p[0]) == 'r') { 3773 } else if (tolower(p[0]) == 'r') {
3771 IPW_DEBUG_INFO("%s: Resetting firmware snapshot.\n", 3774 IPW_DEBUG_INFO("%s: Resetting firmware snapshot.\n", dev->name);
3772 dev->name);
3773 ipw2100_snapshot_free(priv); 3775 ipw2100_snapshot_free(priv);
3774 3776
3775 } else 3777 } else
3776 IPW_DEBUG_INFO("%s: Usage: 0|on = HEX, 1|off = RAW, " 3778 IPW_DEBUG_INFO("%s: Usage: 0|on = HEX, 1|off = RAW, "
3777 "reset = clear memory snapshot\n", 3779 "reset = clear memory snapshot\n", dev->name);
3778 dev->name);
3779 3780
3780 return count; 3781 return count;
3781} 3782}
3782static DEVICE_ATTR(memory, S_IWUSR|S_IRUGO, show_memory, store_memory);
3783 3783
3784static DEVICE_ATTR(memory, S_IWUSR | S_IRUGO, show_memory, store_memory);
3784 3785
3785static ssize_t show_ordinals(struct device *d, struct device_attribute *attr, 3786static ssize_t show_ordinals(struct device *d, struct device_attribute *attr,
3786 char *buf) 3787 char *buf)
3787{ 3788{
3788 struct ipw2100_priv *priv = dev_get_drvdata(d); 3789 struct ipw2100_priv *priv = dev_get_drvdata(d);
3789 u32 val = 0; 3790 u32 val = 0;
@@ -3814,14 +3815,14 @@ static ssize_t show_ordinals(struct device *d, struct device_attribute *attr,
3814 3815
3815 return len; 3816 return len;
3816} 3817}
3817static DEVICE_ATTR(ordinals, S_IRUGO, show_ordinals, NULL);
3818 3818
3819static DEVICE_ATTR(ordinals, S_IRUGO, show_ordinals, NULL);
3819 3820
3820static ssize_t show_stats(struct device *d, struct device_attribute *attr, 3821static ssize_t show_stats(struct device *d, struct device_attribute *attr,
3821 char *buf) 3822 char *buf)
3822{ 3823{
3823 struct ipw2100_priv *priv = dev_get_drvdata(d); 3824 struct ipw2100_priv *priv = dev_get_drvdata(d);
3824 char * out = buf; 3825 char *out = buf;
3825 3826
3826 out += sprintf(out, "interrupts: %d {tx: %d, rx: %d, other: %d}\n", 3827 out += sprintf(out, "interrupts: %d {tx: %d, rx: %d, other: %d}\n",
3827 priv->interrupts, priv->tx_interrupts, 3828 priv->interrupts, priv->tx_interrupts,
@@ -3835,8 +3836,8 @@ static ssize_t show_stats(struct device *d, struct device_attribute *attr,
3835 3836
3836 return out - buf; 3837 return out - buf;
3837} 3838}
3838static DEVICE_ATTR(stats, S_IRUGO, show_stats, NULL);
3839 3839
3840static DEVICE_ATTR(stats, S_IRUGO, show_stats, NULL);
3840 3841
3841static int ipw2100_switch_mode(struct ipw2100_priv *priv, u32 mode) 3842static int ipw2100_switch_mode(struct ipw2100_priv *priv, u32 mode)
3842{ 3843{
@@ -3864,19 +3865,18 @@ static int ipw2100_switch_mode(struct ipw2100_priv *priv, u32 mode)
3864 priv->last_mode = priv->ieee->iw_mode; 3865 priv->last_mode = priv->ieee->iw_mode;
3865 priv->net_dev->type = ARPHRD_IEEE80211; 3866 priv->net_dev->type = ARPHRD_IEEE80211;
3866 break; 3867 break;
3867#endif /* CONFIG_IPW2100_MONITOR */ 3868#endif /* CONFIG_IPW2100_MONITOR */
3868 } 3869 }
3869 3870
3870 priv->ieee->iw_mode = mode; 3871 priv->ieee->iw_mode = mode;
3871 3872
3872#ifdef CONFIG_PM 3873#ifdef CONFIG_PM
3873 /* Indicate ipw2100_download_firmware download firmware 3874 /* Indicate ipw2100_download_firmware download firmware
3874 * from disk instead of memory. */ 3875 * from disk instead of memory. */
3875 ipw2100_firmware.version = 0; 3876 ipw2100_firmware.version = 0;
3876#endif 3877#endif
3877 3878
3878 printk(KERN_INFO "%s: Reseting on mode change.\n", 3879 printk(KERN_INFO "%s: Reseting on mode change.\n", priv->net_dev->name);
3879 priv->net_dev->name);
3880 priv->reset_backoff = 0; 3880 priv->reset_backoff = 0;
3881 schedule_reset(priv); 3881 schedule_reset(priv);
3882 3882
@@ -3884,12 +3884,12 @@ static int ipw2100_switch_mode(struct ipw2100_priv *priv, u32 mode)
3884} 3884}
3885 3885
3886static ssize_t show_internals(struct device *d, struct device_attribute *attr, 3886static ssize_t show_internals(struct device *d, struct device_attribute *attr,
3887 char *buf) 3887 char *buf)
3888{ 3888{
3889 struct ipw2100_priv *priv = dev_get_drvdata(d); 3889 struct ipw2100_priv *priv = dev_get_drvdata(d);
3890 int len = 0; 3890 int len = 0;
3891 3891
3892#define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" # y "\n", priv-> x) 3892#define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x)
3893 3893
3894 if (priv->status & STATUS_ASSOCIATED) 3894 if (priv->status & STATUS_ASSOCIATED)
3895 len += sprintf(buf + len, "connected: %lu\n", 3895 len += sprintf(buf + len, "connected: %lu\n",
@@ -3897,52 +3897,54 @@ static ssize_t show_internals(struct device *d, struct device_attribute *attr,
3897 else 3897 else
3898 len += sprintf(buf + len, "not connected\n"); 3898 len += sprintf(buf + len, "not connected\n");
3899 3899
3900 DUMP_VAR(ieee->crypt[priv->ieee->tx_keyidx], p); 3900 DUMP_VAR(ieee->crypt[priv->ieee->tx_keyidx], "p");
3901 DUMP_VAR(status, 08lx); 3901 DUMP_VAR(status, "08lx");
3902 DUMP_VAR(config, 08lx); 3902 DUMP_VAR(config, "08lx");
3903 DUMP_VAR(capability, 08lx); 3903 DUMP_VAR(capability, "08lx");
3904 3904
3905 len += sprintf(buf + len, "last_rtc: %lu\n", (unsigned long)priv->last_rtc); 3905 len +=
3906 sprintf(buf + len, "last_rtc: %lu\n",
3907 (unsigned long)priv->last_rtc);
3906 3908
3907 DUMP_VAR(fatal_error, d); 3909 DUMP_VAR(fatal_error, "d");
3908 DUMP_VAR(stop_hang_check, d); 3910 DUMP_VAR(stop_hang_check, "d");
3909 DUMP_VAR(stop_rf_kill, d); 3911 DUMP_VAR(stop_rf_kill, "d");
3910 DUMP_VAR(messages_sent, d); 3912 DUMP_VAR(messages_sent, "d");
3911 3913
3912 DUMP_VAR(tx_pend_stat.value, d); 3914 DUMP_VAR(tx_pend_stat.value, "d");
3913 DUMP_VAR(tx_pend_stat.hi, d); 3915 DUMP_VAR(tx_pend_stat.hi, "d");
3914 3916
3915 DUMP_VAR(tx_free_stat.value, d); 3917 DUMP_VAR(tx_free_stat.value, "d");
3916 DUMP_VAR(tx_free_stat.lo, d); 3918 DUMP_VAR(tx_free_stat.lo, "d");
3917 3919
3918 DUMP_VAR(msg_free_stat.value, d); 3920 DUMP_VAR(msg_free_stat.value, "d");
3919 DUMP_VAR(msg_free_stat.lo, d); 3921 DUMP_VAR(msg_free_stat.lo, "d");
3920 3922
3921 DUMP_VAR(msg_pend_stat.value, d); 3923 DUMP_VAR(msg_pend_stat.value, "d");
3922 DUMP_VAR(msg_pend_stat.hi, d); 3924 DUMP_VAR(msg_pend_stat.hi, "d");
3923 3925
3924 DUMP_VAR(fw_pend_stat.value, d); 3926 DUMP_VAR(fw_pend_stat.value, "d");
3925 DUMP_VAR(fw_pend_stat.hi, d); 3927 DUMP_VAR(fw_pend_stat.hi, "d");
3926 3928
3927 DUMP_VAR(txq_stat.value, d); 3929 DUMP_VAR(txq_stat.value, "d");
3928 DUMP_VAR(txq_stat.lo, d); 3930 DUMP_VAR(txq_stat.lo, "d");
3929 3931
3930 DUMP_VAR(ieee->scans, d); 3932 DUMP_VAR(ieee->scans, "d");
3931 DUMP_VAR(reset_backoff, d); 3933 DUMP_VAR(reset_backoff, "d");
3932 3934
3933 return len; 3935 return len;
3934} 3936}
3935static DEVICE_ATTR(internals, S_IRUGO, show_internals, NULL);
3936 3937
3938static DEVICE_ATTR(internals, S_IRUGO, show_internals, NULL);
3937 3939
3938static ssize_t show_bssinfo(struct device *d, struct device_attribute *attr, 3940static ssize_t show_bssinfo(struct device *d, struct device_attribute *attr,
3939 char *buf) 3941 char *buf)
3940{ 3942{
3941 struct ipw2100_priv *priv = dev_get_drvdata(d); 3943 struct ipw2100_priv *priv = dev_get_drvdata(d);
3942 char essid[IW_ESSID_MAX_SIZE + 1]; 3944 char essid[IW_ESSID_MAX_SIZE + 1];
3943 u8 bssid[ETH_ALEN]; 3945 u8 bssid[ETH_ALEN];
3944 u32 chan = 0; 3946 u32 chan = 0;
3945 char * out = buf; 3947 char *out = buf;
3946 int length; 3948 int length;
3947 int ret; 3949 int ret;
3948 3950
@@ -3976,8 +3978,8 @@ static ssize_t show_bssinfo(struct device *d, struct device_attribute *attr,
3976 3978
3977 return out - buf; 3979 return out - buf;
3978} 3980}
3979static DEVICE_ATTR(bssinfo, S_IRUGO, show_bssinfo, NULL);
3980 3981
3982static DEVICE_ATTR(bssinfo, S_IRUGO, show_bssinfo, NULL);
3981 3983
3982#ifdef CONFIG_IPW_DEBUG 3984#ifdef CONFIG_IPW_DEBUG
3983static ssize_t show_debug_level(struct device_driver *d, char *buf) 3985static ssize_t show_debug_level(struct device_driver *d, char *buf)
@@ -4000,27 +4002,26 @@ static ssize_t store_debug_level(struct device_driver *d, const char *buf,
4000 val = simple_strtoul(p, &p, 10); 4002 val = simple_strtoul(p, &p, 10);
4001 if (p == buf) 4003 if (p == buf)
4002 IPW_DEBUG_INFO(DRV_NAME 4004 IPW_DEBUG_INFO(DRV_NAME
4003 ": %s is not in hex or decimal form.\n", buf); 4005 ": %s is not in hex or decimal form.\n", buf);
4004 else 4006 else
4005 ipw2100_debug_level = val; 4007 ipw2100_debug_level = val;
4006 4008
4007 return strnlen(buf, count); 4009 return strnlen(buf, count);
4008} 4010}
4011
4009static DRIVER_ATTR(debug_level, S_IWUSR | S_IRUGO, show_debug_level, 4012static DRIVER_ATTR(debug_level, S_IWUSR | S_IRUGO, show_debug_level,
4010 store_debug_level); 4013 store_debug_level);
4011#endif /* CONFIG_IPW_DEBUG */ 4014#endif /* CONFIG_IPW_DEBUG */
4012
4013 4015
4014static ssize_t show_fatal_error(struct device *d, 4016static ssize_t show_fatal_error(struct device *d,
4015 struct device_attribute *attr, char *buf) 4017 struct device_attribute *attr, char *buf)
4016{ 4018{
4017 struct ipw2100_priv *priv = dev_get_drvdata(d); 4019 struct ipw2100_priv *priv = dev_get_drvdata(d);
4018 char *out = buf; 4020 char *out = buf;
4019 int i; 4021 int i;
4020 4022
4021 if (priv->fatal_error) 4023 if (priv->fatal_error)
4022 out += sprintf(out, "0x%08X\n", 4024 out += sprintf(out, "0x%08X\n", priv->fatal_error);
4023 priv->fatal_error);
4024 else 4025 else
4025 out += sprintf(out, "0\n"); 4026 out += sprintf(out, "0\n");
4026 4027
@@ -4038,24 +4039,26 @@ static ssize_t show_fatal_error(struct device *d,
4038} 4039}
4039 4040
4040static ssize_t store_fatal_error(struct device *d, 4041static ssize_t store_fatal_error(struct device *d,
4041 struct device_attribute *attr, const char *buf, size_t count) 4042 struct device_attribute *attr, const char *buf,
4043 size_t count)
4042{ 4044{
4043 struct ipw2100_priv *priv = dev_get_drvdata(d); 4045 struct ipw2100_priv *priv = dev_get_drvdata(d);
4044 schedule_reset(priv); 4046 schedule_reset(priv);
4045 return count; 4047 return count;
4046} 4048}
4047static DEVICE_ATTR(fatal_error, S_IWUSR|S_IRUGO, show_fatal_error, store_fatal_error);
4048 4049
4050static DEVICE_ATTR(fatal_error, S_IWUSR | S_IRUGO, show_fatal_error,
4051 store_fatal_error);
4049 4052
4050static ssize_t show_scan_age(struct device *d, struct device_attribute *attr, 4053static ssize_t show_scan_age(struct device *d, struct device_attribute *attr,
4051 char *buf) 4054 char *buf)
4052{ 4055{
4053 struct ipw2100_priv *priv = dev_get_drvdata(d); 4056 struct ipw2100_priv *priv = dev_get_drvdata(d);
4054 return sprintf(buf, "%d\n", priv->ieee->scan_age); 4057 return sprintf(buf, "%d\n", priv->ieee->scan_age);
4055} 4058}
4056 4059
4057static ssize_t store_scan_age(struct device *d, struct device_attribute *attr, 4060static ssize_t store_scan_age(struct device *d, struct device_attribute *attr,
4058 const char *buf, size_t count) 4061 const char *buf, size_t count)
4059{ 4062{
4060 struct ipw2100_priv *priv = dev_get_drvdata(d); 4063 struct ipw2100_priv *priv = dev_get_drvdata(d);
4061 struct net_device *dev = priv->net_dev; 4064 struct net_device *dev = priv->net_dev;
@@ -4078,8 +4081,7 @@ static ssize_t store_scan_age(struct device *d, struct device_attribute *attr,
4078 } else 4081 } else
4079 val = simple_strtoul(p, &p, 10); 4082 val = simple_strtoul(p, &p, 10);
4080 if (p == buffer) { 4083 if (p == buffer) {
4081 IPW_DEBUG_INFO("%s: user supplied invalid value.\n", 4084 IPW_DEBUG_INFO("%s: user supplied invalid value.\n", dev->name);
4082 dev->name);
4083 } else { 4085 } else {
4084 priv->ieee->scan_age = val; 4086 priv->ieee->scan_age = val;
4085 IPW_DEBUG_INFO("set scan_age = %u\n", priv->ieee->scan_age); 4087 IPW_DEBUG_INFO("set scan_age = %u\n", priv->ieee->scan_age);
@@ -4088,11 +4090,11 @@ static ssize_t store_scan_age(struct device *d, struct device_attribute *attr,
4088 IPW_DEBUG_INFO("exit\n"); 4090 IPW_DEBUG_INFO("exit\n");
4089 return len; 4091 return len;
4090} 4092}
4091static DEVICE_ATTR(scan_age, S_IWUSR | S_IRUGO, show_scan_age, store_scan_age);
4092 4093
4094static DEVICE_ATTR(scan_age, S_IWUSR | S_IRUGO, show_scan_age, store_scan_age);
4093 4095
4094static ssize_t show_rf_kill(struct device *d, struct device_attribute *attr, 4096static ssize_t show_rf_kill(struct device *d, struct device_attribute *attr,
4095 char *buf) 4097 char *buf)
4096{ 4098{
4097 /* 0 - RF kill not enabled 4099 /* 0 - RF kill not enabled
4098 1 - SW based RF kill active (sysfs) 4100 1 - SW based RF kill active (sysfs)
@@ -4100,7 +4102,7 @@ static ssize_t show_rf_kill(struct device *d, struct device_attribute *attr,
4100 3 - Both HW and SW baed RF kill active */ 4102 3 - Both HW and SW baed RF kill active */
4101 struct ipw2100_priv *priv = (struct ipw2100_priv *)d->driver_data; 4103 struct ipw2100_priv *priv = (struct ipw2100_priv *)d->driver_data;
4102 int val = ((priv->status & STATUS_RF_KILL_SW) ? 0x1 : 0x0) | 4104 int val = ((priv->status & STATUS_RF_KILL_SW) ? 0x1 : 0x0) |
4103 (rf_kill_active(priv) ? 0x2 : 0x0); 4105 (rf_kill_active(priv) ? 0x2 : 0x0);
4104 return sprintf(buf, "%i\n", val); 4106 return sprintf(buf, "%i\n", val);
4105} 4107}
4106 4108
@@ -4108,7 +4110,7 @@ static int ipw_radio_kill_sw(struct ipw2100_priv *priv, int disable_radio)
4108{ 4110{
4109 if ((disable_radio ? 1 : 0) == 4111 if ((disable_radio ? 1 : 0) ==
4110 (priv->status & STATUS_RF_KILL_SW ? 1 : 0)) 4112 (priv->status & STATUS_RF_KILL_SW ? 1 : 0))
4111 return 0 ; 4113 return 0;
4112 4114
4113 IPW_DEBUG_RF_KILL("Manual SW RF Kill set to: RADIO %s\n", 4115 IPW_DEBUG_RF_KILL("Manual SW RF Kill set to: RADIO %s\n",
4114 disable_radio ? "OFF" : "ON"); 4116 disable_radio ? "OFF" : "ON");
@@ -4126,8 +4128,7 @@ static int ipw_radio_kill_sw(struct ipw2100_priv *priv, int disable_radio)
4126 /* Make sure the RF_KILL check timer is running */ 4128 /* Make sure the RF_KILL check timer is running */
4127 priv->stop_rf_kill = 0; 4129 priv->stop_rf_kill = 0;
4128 cancel_delayed_work(&priv->rf_kill); 4130 cancel_delayed_work(&priv->rf_kill);
4129 queue_delayed_work(priv->workqueue, &priv->rf_kill, 4131 queue_delayed_work(priv->workqueue, &priv->rf_kill, HZ);
4130 HZ);
4131 } else 4132 } else
4132 schedule_reset(priv); 4133 schedule_reset(priv);
4133 } 4134 }
@@ -4137,14 +4138,14 @@ static int ipw_radio_kill_sw(struct ipw2100_priv *priv, int disable_radio)
4137} 4138}
4138 4139
4139static ssize_t store_rf_kill(struct device *d, struct device_attribute *attr, 4140static ssize_t store_rf_kill(struct device *d, struct device_attribute *attr,
4140 const char *buf, size_t count) 4141 const char *buf, size_t count)
4141{ 4142{
4142 struct ipw2100_priv *priv = dev_get_drvdata(d); 4143 struct ipw2100_priv *priv = dev_get_drvdata(d);
4143 ipw_radio_kill_sw(priv, buf[0] == '1'); 4144 ipw_radio_kill_sw(priv, buf[0] == '1');
4144 return count; 4145 return count;
4145} 4146}
4146static DEVICE_ATTR(rf_kill, S_IWUSR|S_IRUGO, show_rf_kill, store_rf_kill);
4147 4147
4148static DEVICE_ATTR(rf_kill, S_IWUSR | S_IRUGO, show_rf_kill, store_rf_kill);
4148 4149
4149static struct attribute *ipw2100_sysfs_entries[] = { 4150static struct attribute *ipw2100_sysfs_entries[] = {
4150 &dev_attr_hardware.attr, 4151 &dev_attr_hardware.attr,
@@ -4168,7 +4169,6 @@ static struct attribute_group ipw2100_attribute_group = {
4168 .attrs = ipw2100_sysfs_entries, 4169 .attrs = ipw2100_sysfs_entries,
4169}; 4170};
4170 4171
4171
4172static int status_queue_allocate(struct ipw2100_priv *priv, int entries) 4172static int status_queue_allocate(struct ipw2100_priv *priv, int entries)
4173{ 4173{
4174 struct ipw2100_status_queue *q = &priv->status_queue; 4174 struct ipw2100_status_queue *q = &priv->status_queue;
@@ -4176,11 +4176,11 @@ static int status_queue_allocate(struct ipw2100_priv *priv, int entries)
4176 IPW_DEBUG_INFO("enter\n"); 4176 IPW_DEBUG_INFO("enter\n");
4177 4177
4178 q->size = entries * sizeof(struct ipw2100_status); 4178 q->size = entries * sizeof(struct ipw2100_status);
4179 q->drv = (struct ipw2100_status *)pci_alloc_consistent( 4179 q->drv =
4180 priv->pci_dev, q->size, &q->nic); 4180 (struct ipw2100_status *)pci_alloc_consistent(priv->pci_dev,
4181 q->size, &q->nic);
4181 if (!q->drv) { 4182 if (!q->drv) {
4182 IPW_DEBUG_WARNING( 4183 IPW_DEBUG_WARNING("Can not allocate status queue.\n");
4183 "Can not allocate status queue.\n");
4184 return -ENOMEM; 4184 return -ENOMEM;
4185 } 4185 }
4186 4186
@@ -4196,9 +4196,9 @@ static void status_queue_free(struct ipw2100_priv *priv)
4196 IPW_DEBUG_INFO("enter\n"); 4196 IPW_DEBUG_INFO("enter\n");
4197 4197
4198 if (priv->status_queue.drv) { 4198 if (priv->status_queue.drv) {
4199 pci_free_consistent( 4199 pci_free_consistent(priv->pci_dev, priv->status_queue.size,
4200 priv->pci_dev, priv->status_queue.size, 4200 priv->status_queue.drv,
4201 priv->status_queue.drv, priv->status_queue.nic); 4201 priv->status_queue.nic);
4202 priv->status_queue.drv = NULL; 4202 priv->status_queue.drv = NULL;
4203 } 4203 }
4204 4204
@@ -4216,7 +4216,8 @@ static int bd_queue_allocate(struct ipw2100_priv *priv,
4216 q->size = entries * sizeof(struct ipw2100_bd); 4216 q->size = entries * sizeof(struct ipw2100_bd);
4217 q->drv = pci_alloc_consistent(priv->pci_dev, q->size, &q->nic); 4217 q->drv = pci_alloc_consistent(priv->pci_dev, q->size, &q->nic);
4218 if (!q->drv) { 4218 if (!q->drv) {
4219 IPW_DEBUG_INFO("can't allocate shared memory for buffer descriptors\n"); 4219 IPW_DEBUG_INFO
4220 ("can't allocate shared memory for buffer descriptors\n");
4220 return -ENOMEM; 4221 return -ENOMEM;
4221 } 4222 }
4222 memset(q->drv, 0, q->size); 4223 memset(q->drv, 0, q->size);
@@ -4226,8 +4227,7 @@ static int bd_queue_allocate(struct ipw2100_priv *priv,
4226 return 0; 4227 return 0;
4227} 4228}
4228 4229
4229static void bd_queue_free(struct ipw2100_priv *priv, 4230static void bd_queue_free(struct ipw2100_priv *priv, struct ipw2100_bd_queue *q)
4230 struct ipw2100_bd_queue *q)
4231{ 4231{
4232 IPW_DEBUG_INFO("enter\n"); 4232 IPW_DEBUG_INFO("enter\n");
4233 4233
@@ -4235,21 +4235,21 @@ static void bd_queue_free(struct ipw2100_priv *priv,
4235 return; 4235 return;
4236 4236
4237 if (q->drv) { 4237 if (q->drv) {
4238 pci_free_consistent(priv->pci_dev, 4238 pci_free_consistent(priv->pci_dev, q->size, q->drv, q->nic);
4239 q->size, q->drv, q->nic);
4240 q->drv = NULL; 4239 q->drv = NULL;
4241 } 4240 }
4242 4241
4243 IPW_DEBUG_INFO("exit\n"); 4242 IPW_DEBUG_INFO("exit\n");
4244} 4243}
4245 4244
4246static void bd_queue_initialize( 4245static void bd_queue_initialize(struct ipw2100_priv *priv,
4247 struct ipw2100_priv *priv, struct ipw2100_bd_queue * q, 4246 struct ipw2100_bd_queue *q, u32 base, u32 size,
4248 u32 base, u32 size, u32 r, u32 w) 4247 u32 r, u32 w)
4249{ 4248{
4250 IPW_DEBUG_INFO("enter\n"); 4249 IPW_DEBUG_INFO("enter\n");
4251 4250
4252 IPW_DEBUG_INFO("initializing bd queue at virt=%p, phys=%08x\n", q->drv, (u32)q->nic); 4251 IPW_DEBUG_INFO("initializing bd queue at virt=%p, phys=%08x\n", q->drv,
4252 (u32) q->nic);
4253 4253
4254 write_register(priv->net_dev, base, q->nic); 4254 write_register(priv->net_dev, base, q->nic);
4255 write_register(priv->net_dev, size, q->entries); 4255 write_register(priv->net_dev, size, q->entries);
@@ -4285,32 +4285,38 @@ static int ipw2100_tx_allocate(struct ipw2100_priv *priv)
4285 err = bd_queue_allocate(priv, &priv->tx_queue, TX_QUEUE_LENGTH); 4285 err = bd_queue_allocate(priv, &priv->tx_queue, TX_QUEUE_LENGTH);
4286 if (err) { 4286 if (err) {
4287 IPW_DEBUG_ERROR("%s: failed bd_queue_allocate\n", 4287 IPW_DEBUG_ERROR("%s: failed bd_queue_allocate\n",
4288 priv->net_dev->name); 4288 priv->net_dev->name);
4289 return err; 4289 return err;
4290 } 4290 }
4291 4291
4292 priv->tx_buffers = (struct ipw2100_tx_packet *)kmalloc( 4292 priv->tx_buffers =
4293 TX_PENDED_QUEUE_LENGTH * sizeof(struct ipw2100_tx_packet), 4293 (struct ipw2100_tx_packet *)kmalloc(TX_PENDED_QUEUE_LENGTH *
4294 GFP_ATOMIC); 4294 sizeof(struct
4295 ipw2100_tx_packet),
4296 GFP_ATOMIC);
4295 if (!priv->tx_buffers) { 4297 if (!priv->tx_buffers) {
4296 printk(KERN_ERR DRV_NAME ": %s: alloc failed form tx buffers.\n", 4298 printk(KERN_ERR DRV_NAME
4299 ": %s: alloc failed form tx buffers.\n",
4297 priv->net_dev->name); 4300 priv->net_dev->name);
4298 bd_queue_free(priv, &priv->tx_queue); 4301 bd_queue_free(priv, &priv->tx_queue);
4299 return -ENOMEM; 4302 return -ENOMEM;
4300 } 4303 }
4301 4304
4302 for (i = 0; i < TX_PENDED_QUEUE_LENGTH; i++) { 4305 for (i = 0; i < TX_PENDED_QUEUE_LENGTH; i++) {
4303 v = pci_alloc_consistent( 4306 v = pci_alloc_consistent(priv->pci_dev,
4304 priv->pci_dev, sizeof(struct ipw2100_data_header), &p); 4307 sizeof(struct ipw2100_data_header),
4308 &p);
4305 if (!v) { 4309 if (!v) {
4306 printk(KERN_ERR DRV_NAME ": %s: PCI alloc failed for tx " 4310 printk(KERN_ERR DRV_NAME
4307 "buffers.\n", priv->net_dev->name); 4311 ": %s: PCI alloc failed for tx " "buffers.\n",
4312 priv->net_dev->name);
4308 err = -ENOMEM; 4313 err = -ENOMEM;
4309 break; 4314 break;
4310 } 4315 }
4311 4316
4312 priv->tx_buffers[i].type = DATA; 4317 priv->tx_buffers[i].type = DATA;
4313 priv->tx_buffers[i].info.d_struct.data = (struct ipw2100_data_header*)v; 4318 priv->tx_buffers[i].info.d_struct.data =
4319 (struct ipw2100_data_header *)v;
4314 priv->tx_buffers[i].info.d_struct.data_phys = p; 4320 priv->tx_buffers[i].info.d_struct.data_phys = p;
4315 priv->tx_buffers[i].info.d_struct.txb = NULL; 4321 priv->tx_buffers[i].info.d_struct.txb = NULL;
4316 } 4322 }
@@ -4319,11 +4325,11 @@ static int ipw2100_tx_allocate(struct ipw2100_priv *priv)
4319 return 0; 4325 return 0;
4320 4326
4321 for (j = 0; j < i; j++) { 4327 for (j = 0; j < i; j++) {
4322 pci_free_consistent( 4328 pci_free_consistent(priv->pci_dev,
4323 priv->pci_dev, 4329 sizeof(struct ipw2100_data_header),
4324 sizeof(struct ipw2100_data_header), 4330 priv->tx_buffers[j].info.d_struct.data,
4325 priv->tx_buffers[j].info.d_struct.data, 4331 priv->tx_buffers[j].info.d_struct.
4326 priv->tx_buffers[j].info.d_struct.data_phys); 4332 data_phys);
4327 } 4333 }
4328 4334
4329 kfree(priv->tx_buffers); 4335 kfree(priv->tx_buffers);
@@ -4356,7 +4362,8 @@ static void ipw2100_tx_initialize(struct ipw2100_priv *priv)
4356 /* We simply drop any SKBs that have been queued for 4362 /* We simply drop any SKBs that have been queued for
4357 * transmit */ 4363 * transmit */
4358 if (priv->tx_buffers[i].info.d_struct.txb) { 4364 if (priv->tx_buffers[i].info.d_struct.txb) {
4359 ieee80211_txb_free(priv->tx_buffers[i].info.d_struct.txb); 4365 ieee80211_txb_free(priv->tx_buffers[i].info.d_struct.
4366 txb);
4360 priv->tx_buffers[i].info.d_struct.txb = NULL; 4367 priv->tx_buffers[i].info.d_struct.txb = NULL;
4361 } 4368 }
4362 4369
@@ -4394,15 +4401,17 @@ static void ipw2100_tx_free(struct ipw2100_priv *priv)
4394 4401
4395 for (i = 0; i < TX_PENDED_QUEUE_LENGTH; i++) { 4402 for (i = 0; i < TX_PENDED_QUEUE_LENGTH; i++) {
4396 if (priv->tx_buffers[i].info.d_struct.txb) { 4403 if (priv->tx_buffers[i].info.d_struct.txb) {
4397 ieee80211_txb_free(priv->tx_buffers[i].info.d_struct.txb); 4404 ieee80211_txb_free(priv->tx_buffers[i].info.d_struct.
4405 txb);
4398 priv->tx_buffers[i].info.d_struct.txb = NULL; 4406 priv->tx_buffers[i].info.d_struct.txb = NULL;
4399 } 4407 }
4400 if (priv->tx_buffers[i].info.d_struct.data) 4408 if (priv->tx_buffers[i].info.d_struct.data)
4401 pci_free_consistent( 4409 pci_free_consistent(priv->pci_dev,
4402 priv->pci_dev, 4410 sizeof(struct ipw2100_data_header),
4403 sizeof(struct ipw2100_data_header), 4411 priv->tx_buffers[i].info.d_struct.
4404 priv->tx_buffers[i].info.d_struct.data, 4412 data,
4405 priv->tx_buffers[i].info.d_struct.data_phys); 4413 priv->tx_buffers[i].info.d_struct.
4414 data_phys);
4406 } 4415 }
4407 4416
4408 kfree(priv->tx_buffers); 4417 kfree(priv->tx_buffers);
@@ -4411,8 +4420,6 @@ static void ipw2100_tx_free(struct ipw2100_priv *priv)
4411 IPW_DEBUG_INFO("exit\n"); 4420 IPW_DEBUG_INFO("exit\n");
4412} 4421}
4413 4422
4414
4415
4416static int ipw2100_rx_allocate(struct ipw2100_priv *priv) 4423static int ipw2100_rx_allocate(struct ipw2100_priv *priv)
4417{ 4424{
4418 int i, j, err = -EINVAL; 4425 int i, j, err = -EINVAL;
@@ -4542,14 +4549,13 @@ static int ipw2100_read_mac_address(struct ipw2100_priv *priv)
4542 4549
4543 int err; 4550 int err;
4544 4551
4545 err = ipw2100_get_ordinal(priv, IPW_ORD_STAT_ADAPTER_MAC, 4552 err = ipw2100_get_ordinal(priv, IPW_ORD_STAT_ADAPTER_MAC, mac, &length);
4546 mac, &length);
4547 if (err) { 4553 if (err) {
4548 IPW_DEBUG_INFO("MAC address read failed\n"); 4554 IPW_DEBUG_INFO("MAC address read failed\n");
4549 return -EIO; 4555 return -EIO;
4550 } 4556 }
4551 IPW_DEBUG_INFO("card MAC is %02X:%02X:%02X:%02X:%02X:%02X\n", 4557 IPW_DEBUG_INFO("card MAC is %02X:%02X:%02X:%02X:%02X:%02X\n",
4552 mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); 4558 mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
4553 4559
4554 memcpy(priv->net_dev->dev_addr, mac, ETH_ALEN); 4560 memcpy(priv->net_dev->dev_addr, mac, ETH_ALEN);
4555 4561
@@ -4576,8 +4582,7 @@ static int ipw2100_set_mac_address(struct ipw2100_priv *priv, int batch_mode)
4576 IPW_DEBUG_INFO("enter\n"); 4582 IPW_DEBUG_INFO("enter\n");
4577 4583
4578 if (priv->config & CFG_CUSTOM_MAC) { 4584 if (priv->config & CFG_CUSTOM_MAC) {
4579 memcpy(cmd.host_command_parameters, priv->mac_addr, 4585 memcpy(cmd.host_command_parameters, priv->mac_addr, ETH_ALEN);
4580 ETH_ALEN);
4581 memcpy(priv->net_dev->dev_addr, priv->mac_addr, ETH_ALEN); 4586 memcpy(priv->net_dev->dev_addr, priv->mac_addr, ETH_ALEN);
4582 } else 4587 } else
4583 memcpy(cmd.host_command_parameters, priv->net_dev->dev_addr, 4588 memcpy(cmd.host_command_parameters, priv->net_dev->dev_addr,
@@ -4614,7 +4619,8 @@ static int ipw2100_set_port_type(struct ipw2100_priv *priv, u32 port_type,
4614 if (!batch_mode) { 4619 if (!batch_mode) {
4615 err = ipw2100_disable_adapter(priv); 4620 err = ipw2100_disable_adapter(priv);
4616 if (err) { 4621 if (err) {
4617 printk(KERN_ERR DRV_NAME ": %s: Could not disable adapter %d\n", 4622 printk(KERN_ERR DRV_NAME
4623 ": %s: Could not disable adapter %d\n",
4618 priv->net_dev->name, err); 4624 priv->net_dev->name, err);
4619 return err; 4625 return err;
4620 } 4626 }
@@ -4629,7 +4635,6 @@ static int ipw2100_set_port_type(struct ipw2100_priv *priv, u32 port_type,
4629 return err; 4635 return err;
4630} 4636}
4631 4637
4632
4633static int ipw2100_set_channel(struct ipw2100_priv *priv, u32 channel, 4638static int ipw2100_set_channel(struct ipw2100_priv *priv, u32 channel,
4634 int batch_mode) 4639 int batch_mode)
4635{ 4640{
@@ -4660,8 +4665,7 @@ static int ipw2100_set_channel(struct ipw2100_priv *priv, u32 channel,
4660 4665
4661 err = ipw2100_hw_send_command(priv, &cmd); 4666 err = ipw2100_hw_send_command(priv, &cmd);
4662 if (err) { 4667 if (err) {
4663 IPW_DEBUG_INFO("Failed to set channel to %d", 4668 IPW_DEBUG_INFO("Failed to set channel to %d", channel);
4664 channel);
4665 return err; 4669 return err;
4666 } 4670 }
4667 4671
@@ -4703,15 +4707,14 @@ static int ipw2100_system_config(struct ipw2100_priv *priv, int batch_mode)
4703 cmd.host_command_parameters[0] |= IPW_CFG_IBSS_AUTO_START; 4707 cmd.host_command_parameters[0] |= IPW_CFG_IBSS_AUTO_START;
4704 4708
4705 cmd.host_command_parameters[0] |= IPW_CFG_IBSS_MASK | 4709 cmd.host_command_parameters[0] |= IPW_CFG_IBSS_MASK |
4706 IPW_CFG_BSS_MASK | 4710 IPW_CFG_BSS_MASK | IPW_CFG_802_1x_ENABLE;
4707 IPW_CFG_802_1x_ENABLE;
4708 4711
4709 if (!(priv->config & CFG_LONG_PREAMBLE)) 4712 if (!(priv->config & CFG_LONG_PREAMBLE))
4710 cmd.host_command_parameters[0] |= IPW_CFG_PREAMBLE_AUTO; 4713 cmd.host_command_parameters[0] |= IPW_CFG_PREAMBLE_AUTO;
4711 4714
4712 err = ipw2100_get_ordinal(priv, 4715 err = ipw2100_get_ordinal(priv,
4713 IPW_ORD_EEPROM_IBSS_11B_CHANNELS, 4716 IPW_ORD_EEPROM_IBSS_11B_CHANNELS,
4714 &ibss_mask, &len); 4717 &ibss_mask, &len);
4715 if (err) 4718 if (err)
4716 ibss_mask = IPW_IBSS_11B_DEFAULT_MASK; 4719 ibss_mask = IPW_IBSS_11B_DEFAULT_MASK;
4717 4720
@@ -4719,7 +4722,7 @@ static int ipw2100_system_config(struct ipw2100_priv *priv, int batch_mode)
4719 cmd.host_command_parameters[2] = REG_CHANNEL_MASK & ibss_mask; 4722 cmd.host_command_parameters[2] = REG_CHANNEL_MASK & ibss_mask;
4720 4723
4721 /* 11b only */ 4724 /* 11b only */
4722 /*cmd.host_command_parameters[0] |= DIVERSITY_ANTENNA_A;*/ 4725 /*cmd.host_command_parameters[0] |= DIVERSITY_ANTENNA_A; */
4723 4726
4724 err = ipw2100_hw_send_command(priv, &cmd); 4727 err = ipw2100_hw_send_command(priv, &cmd);
4725 if (err) 4728 if (err)
@@ -4783,8 +4786,7 @@ static int ipw2100_set_tx_rates(struct ipw2100_priv *priv, u32 rate,
4783 return 0; 4786 return 0;
4784} 4787}
4785 4788
4786static int ipw2100_set_power_mode(struct ipw2100_priv *priv, 4789static int ipw2100_set_power_mode(struct ipw2100_priv *priv, int power_level)
4787 int power_level)
4788{ 4790{
4789 struct host_command cmd = { 4791 struct host_command cmd = {
4790 .host_command = POWER_MODE, 4792 .host_command = POWER_MODE,
@@ -4805,11 +4807,10 @@ static int ipw2100_set_power_mode(struct ipw2100_priv *priv,
4805 priv->power_mode = IPW_POWER_ENABLED | power_level; 4807 priv->power_mode = IPW_POWER_ENABLED | power_level;
4806 4808
4807#ifdef CONFIG_IPW2100_TX_POWER 4809#ifdef CONFIG_IPW2100_TX_POWER
4808 if (priv->port_type == IBSS && 4810 if (priv->port_type == IBSS && priv->adhoc_power != DFTL_IBSS_TX_POWER) {
4809 priv->adhoc_power != DFTL_IBSS_TX_POWER) {
4810 /* Set beacon interval */ 4811 /* Set beacon interval */
4811 cmd.host_command = TX_POWER_INDEX; 4812 cmd.host_command = TX_POWER_INDEX;
4812 cmd.host_command_parameters[0] = (u32)priv->adhoc_power; 4813 cmd.host_command_parameters[0] = (u32) priv->adhoc_power;
4813 4814
4814 err = ipw2100_hw_send_command(priv, &cmd); 4815 err = ipw2100_hw_send_command(priv, &cmd);
4815 if (err) 4816 if (err)
@@ -4820,7 +4821,6 @@ static int ipw2100_set_power_mode(struct ipw2100_priv *priv,
4820 return 0; 4821 return 0;
4821} 4822}
4822 4823
4823
4824static int ipw2100_set_rts_threshold(struct ipw2100_priv *priv, u32 threshold) 4824static int ipw2100_set_rts_threshold(struct ipw2100_priv *priv, u32 threshold)
4825{ 4825{
4826 struct host_command cmd = { 4826 struct host_command cmd = {
@@ -4925,8 +4925,7 @@ static int ipw2100_set_long_retry(struct ipw2100_priv *priv, u32 retry)
4925 return 0; 4925 return 0;
4926} 4926}
4927 4927
4928 4928static int ipw2100_set_mandatory_bssid(struct ipw2100_priv *priv, u8 * bssid,
4929static int ipw2100_set_mandatory_bssid(struct ipw2100_priv *priv, u8 *bssid,
4930 int batch_mode) 4929 int batch_mode)
4931{ 4930{
4932 struct host_command cmd = { 4931 struct host_command cmd = {
@@ -4938,16 +4937,15 @@ static int ipw2100_set_mandatory_bssid(struct ipw2100_priv *priv, u8 *bssid,
4938 4937
4939#ifdef CONFIG_IPW_DEBUG 4938#ifdef CONFIG_IPW_DEBUG
4940 if (bssid != NULL) 4939 if (bssid != NULL)
4941 IPW_DEBUG_HC( 4940 IPW_DEBUG_HC("MANDATORY_BSSID: %02X:%02X:%02X:%02X:%02X:%02X\n",
4942 "MANDATORY_BSSID: %02X:%02X:%02X:%02X:%02X:%02X\n", 4941 bssid[0], bssid[1], bssid[2], bssid[3], bssid[4],
4943 bssid[0], bssid[1], bssid[2], bssid[3], bssid[4], 4942 bssid[5]);
4944 bssid[5]);
4945 else 4943 else
4946 IPW_DEBUG_HC("MANDATORY_BSSID: <clear>\n"); 4944 IPW_DEBUG_HC("MANDATORY_BSSID: <clear>\n");
4947#endif 4945#endif
4948 /* if BSSID is empty then we disable mandatory bssid mode */ 4946 /* if BSSID is empty then we disable mandatory bssid mode */
4949 if (bssid != NULL) 4947 if (bssid != NULL)
4950 memcpy((u8 *)cmd.host_command_parameters, bssid, ETH_ALEN); 4948 memcpy((u8 *) cmd.host_command_parameters, bssid, ETH_ALEN);
4951 4949
4952 if (!batch_mode) { 4950 if (!batch_mode) {
4953 err = ipw2100_disable_adapter(priv); 4951 err = ipw2100_disable_adapter(priv);
@@ -4997,8 +4995,7 @@ void x(struct ieee80211_assoc_frame *wpa_assoc)
4997{ 4995{
4998 struct ipw2100_wpa_assoc_frame frame; 4996 struct ipw2100_wpa_assoc_frame frame;
4999 frame->fixed_ie_mask = IPW_WPA_CAPABILTIES | 4997 frame->fixed_ie_mask = IPW_WPA_CAPABILTIES |
5000 IPW_WPA_LISTENINTERVAL | 4998 IPW_WPA_LISTENINTERVAL | IPW_WPA_AP_ADDRESS;
5001 IPW_WPA_AP_ADDRESS;
5002 frame->capab_info = wpa_assoc->capab_info; 4999 frame->capab_info = wpa_assoc->capab_info;
5003 frame->lisen_interval = wpa_assoc->listent_interval; 5000 frame->lisen_interval = wpa_assoc->listent_interval;
5004 memcpy(frame->current_ap, wpa_assoc->current_ap, ETH_ALEN); 5001 memcpy(frame->current_ap, wpa_assoc->current_ap, ETH_ALEN);
@@ -5011,18 +5008,15 @@ void x(struct ieee80211_assoc_frame *wpa_assoc)
5011 * the IEs from wpa_frame into frame. 5008 * the IEs from wpa_frame into frame.
5012 */ 5009 */
5013 frame->var_ie_len = calculate_ie_len(wpa_assoc); 5010 frame->var_ie_len = calculate_ie_len(wpa_assoc);
5014 memcpy(frame->var_ie, wpa_assoc->variable, frame->var_ie_len); 5011 memcpy(frame->var_ie, wpa_assoc->variable, frame->var_ie_len);
5015 5012
5016 ipw2100_set_wpa_ie(priv, &frame, 0); 5013 ipw2100_set_wpa_ie(priv, &frame, 0);
5017} 5014}
5018#endif 5015#endif
5019 5016
5020
5021
5022
5023static int ipw2100_set_wpa_ie(struct ipw2100_priv *, 5017static int ipw2100_set_wpa_ie(struct ipw2100_priv *,
5024 struct ipw2100_wpa_assoc_frame *, int) 5018 struct ipw2100_wpa_assoc_frame *, int)
5025__attribute__ ((unused)); 5019 __attribute__ ((unused));
5026 5020
5027static int ipw2100_set_wpa_ie(struct ipw2100_priv *priv, 5021static int ipw2100_set_wpa_ie(struct ipw2100_priv *priv,
5028 struct ipw2100_wpa_assoc_frame *wpa_frame, 5022 struct ipw2100_wpa_assoc_frame *wpa_frame,
@@ -5076,7 +5070,7 @@ static int ipw2100_set_security_information(struct ipw2100_priv *priv,
5076 .host_command_length = sizeof(struct security_info_params) 5070 .host_command_length = sizeof(struct security_info_params)
5077 }; 5071 };
5078 struct security_info_params *security = 5072 struct security_info_params *security =
5079 (struct security_info_params *)&cmd.host_command_parameters; 5073 (struct security_info_params *)&cmd.host_command_parameters;
5080 int err; 5074 int err;
5081 memset(security, 0, sizeof(*security)); 5075 memset(security, 0, sizeof(*security));
5082 5076
@@ -5094,25 +5088,25 @@ static int ipw2100_set_security_information(struct ipw2100_priv *priv,
5094 break; 5088 break;
5095 case SEC_LEVEL_1: 5089 case SEC_LEVEL_1:
5096 security->allowed_ciphers = IPW_WEP40_CIPHER | 5090 security->allowed_ciphers = IPW_WEP40_CIPHER |
5097 IPW_WEP104_CIPHER; 5091 IPW_WEP104_CIPHER;
5098 break; 5092 break;
5099 case SEC_LEVEL_2: 5093 case SEC_LEVEL_2:
5100 security->allowed_ciphers = IPW_WEP40_CIPHER | 5094 security->allowed_ciphers = IPW_WEP40_CIPHER |
5101 IPW_WEP104_CIPHER | IPW_TKIP_CIPHER; 5095 IPW_WEP104_CIPHER | IPW_TKIP_CIPHER;
5102 break; 5096 break;
5103 case SEC_LEVEL_2_CKIP: 5097 case SEC_LEVEL_2_CKIP:
5104 security->allowed_ciphers = IPW_WEP40_CIPHER | 5098 security->allowed_ciphers = IPW_WEP40_CIPHER |
5105 IPW_WEP104_CIPHER | IPW_CKIP_CIPHER; 5099 IPW_WEP104_CIPHER | IPW_CKIP_CIPHER;
5106 break; 5100 break;
5107 case SEC_LEVEL_3: 5101 case SEC_LEVEL_3:
5108 security->allowed_ciphers = IPW_WEP40_CIPHER | 5102 security->allowed_ciphers = IPW_WEP40_CIPHER |
5109 IPW_WEP104_CIPHER | IPW_TKIP_CIPHER | IPW_CCMP_CIPHER; 5103 IPW_WEP104_CIPHER | IPW_TKIP_CIPHER | IPW_CCMP_CIPHER;
5110 break; 5104 break;
5111 } 5105 }
5112 5106
5113 IPW_DEBUG_HC( 5107 IPW_DEBUG_HC
5114 "SET_SECURITY_INFORMATION: auth:%d cipher:0x%02X (level %d)\n", 5108 ("SET_SECURITY_INFORMATION: auth:%d cipher:0x%02X (level %d)\n",
5115 security->auth_mode, security->allowed_ciphers, security_level); 5109 security->auth_mode, security->allowed_ciphers, security_level);
5116 5110
5117 security->replay_counters_number = 0; 5111 security->replay_counters_number = 0;
5118 5112
@@ -5130,8 +5124,7 @@ static int ipw2100_set_security_information(struct ipw2100_priv *priv,
5130 return err; 5124 return err;
5131} 5125}
5132 5126
5133static int ipw2100_set_tx_power(struct ipw2100_priv *priv, 5127static int ipw2100_set_tx_power(struct ipw2100_priv *priv, u32 tx_power)
5134 u32 tx_power)
5135{ 5128{
5136 struct host_command cmd = { 5129 struct host_command cmd = {
5137 .host_command = TX_POWER_INDEX, 5130 .host_command = TX_POWER_INDEX,
@@ -5185,7 +5178,6 @@ static int ipw2100_set_ibss_beacon_interval(struct ipw2100_priv *priv,
5185 return 0; 5178 return 0;
5186} 5179}
5187 5180
5188
5189void ipw2100_queues_initialize(struct ipw2100_priv *priv) 5181void ipw2100_queues_initialize(struct ipw2100_priv *priv)
5190{ 5182{
5191 ipw2100_tx_initialize(priv); 5183 ipw2100_tx_initialize(priv);
@@ -5203,13 +5195,12 @@ void ipw2100_queues_free(struct ipw2100_priv *priv)
5203int ipw2100_queues_allocate(struct ipw2100_priv *priv) 5195int ipw2100_queues_allocate(struct ipw2100_priv *priv)
5204{ 5196{
5205 if (ipw2100_tx_allocate(priv) || 5197 if (ipw2100_tx_allocate(priv) ||
5206 ipw2100_rx_allocate(priv) || 5198 ipw2100_rx_allocate(priv) || ipw2100_msg_allocate(priv))
5207 ipw2100_msg_allocate(priv))
5208 goto fail; 5199 goto fail;
5209 5200
5210 return 0; 5201 return 0;
5211 5202
5212 fail: 5203 fail:
5213 ipw2100_tx_free(priv); 5204 ipw2100_tx_free(priv);
5214 ipw2100_rx_free(priv); 5205 ipw2100_rx_free(priv);
5215 ipw2100_msg_free(priv); 5206 ipw2100_msg_free(priv);
@@ -5235,7 +5226,8 @@ static int ipw2100_set_wep_flags(struct ipw2100_priv *priv, u32 flags,
5235 if (!batch_mode) { 5226 if (!batch_mode) {
5236 err = ipw2100_disable_adapter(priv); 5227 err = ipw2100_disable_adapter(priv);
5237 if (err) { 5228 if (err) {
5238 printk(KERN_ERR DRV_NAME ": %s: Could not disable adapter %d\n", 5229 printk(KERN_ERR DRV_NAME
5230 ": %s: Could not disable adapter %d\n",
5239 priv->net_dev->name, err); 5231 priv->net_dev->name, err);
5240 return err; 5232 return err;
5241 } 5233 }
@@ -5262,7 +5254,6 @@ struct ipw2100_wep_key {
5262#define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] 5254#define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4]
5263#define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] 5255#define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10]
5264 5256
5265
5266/** 5257/**
5267 * Set a the wep key 5258 * Set a the wep key
5268 * 5259 *
@@ -5287,11 +5278,11 @@ static int ipw2100_set_key(struct ipw2100_priv *priv,
5287 .host_command_sequence = 0, 5278 .host_command_sequence = 0,
5288 .host_command_length = sizeof(struct ipw2100_wep_key), 5279 .host_command_length = sizeof(struct ipw2100_wep_key),
5289 }; 5280 };
5290 struct ipw2100_wep_key *wep_key = (void*)cmd.host_command_parameters; 5281 struct ipw2100_wep_key *wep_key = (void *)cmd.host_command_parameters;
5291 int err; 5282 int err;
5292 5283
5293 IPW_DEBUG_HC("WEP_KEY_INFO: index = %d, len = %d/%d\n", 5284 IPW_DEBUG_HC("WEP_KEY_INFO: index = %d, len = %d/%d\n",
5294 idx, keylen, len); 5285 idx, keylen, len);
5295 5286
5296 /* NOTE: We don't check cached values in case the firmware was reset 5287 /* NOTE: We don't check cached values in case the firmware was reset
5297 * or some other problem is occuring. If the user is setting the key, 5288 * or some other problem is occuring. If the user is setting the key,
@@ -5308,22 +5299,23 @@ static int ipw2100_set_key(struct ipw2100_priv *priv,
5308 /* Will be optimized out on debug not being configured in */ 5299 /* Will be optimized out on debug not being configured in */
5309 if (keylen == 0) 5300 if (keylen == 0)
5310 IPW_DEBUG_WEP("%s: Clearing key %d\n", 5301 IPW_DEBUG_WEP("%s: Clearing key %d\n",
5311 priv->net_dev->name, wep_key->idx); 5302 priv->net_dev->name, wep_key->idx);
5312 else if (keylen == 5) 5303 else if (keylen == 5)
5313 IPW_DEBUG_WEP("%s: idx: %d, len: %d key: " WEP_FMT_64 "\n", 5304 IPW_DEBUG_WEP("%s: idx: %d, len: %d key: " WEP_FMT_64 "\n",
5314 priv->net_dev->name, wep_key->idx, wep_key->len, 5305 priv->net_dev->name, wep_key->idx, wep_key->len,
5315 WEP_STR_64(wep_key->key)); 5306 WEP_STR_64(wep_key->key));
5316 else 5307 else
5317 IPW_DEBUG_WEP("%s: idx: %d, len: %d key: " WEP_FMT_128 5308 IPW_DEBUG_WEP("%s: idx: %d, len: %d key: " WEP_FMT_128
5318 "\n", 5309 "\n",
5319 priv->net_dev->name, wep_key->idx, wep_key->len, 5310 priv->net_dev->name, wep_key->idx, wep_key->len,
5320 WEP_STR_128(wep_key->key)); 5311 WEP_STR_128(wep_key->key));
5321 5312
5322 if (!batch_mode) { 5313 if (!batch_mode) {
5323 err = ipw2100_disable_adapter(priv); 5314 err = ipw2100_disable_adapter(priv);
5324 /* FIXME: IPG: shouldn't this prink be in _disable_adapter()? */ 5315 /* FIXME: IPG: shouldn't this prink be in _disable_adapter()? */
5325 if (err) { 5316 if (err) {
5326 printk(KERN_ERR DRV_NAME ": %s: Could not disable adapter %d\n", 5317 printk(KERN_ERR DRV_NAME
5318 ": %s: Could not disable adapter %d\n",
5327 priv->net_dev->name, err); 5319 priv->net_dev->name, err);
5328 return err; 5320 return err;
5329 } 5321 }
@@ -5347,7 +5339,7 @@ static int ipw2100_set_key_index(struct ipw2100_priv *priv,
5347 .host_command = WEP_KEY_INDEX, 5339 .host_command = WEP_KEY_INDEX,
5348 .host_command_sequence = 0, 5340 .host_command_sequence = 0,
5349 .host_command_length = 4, 5341 .host_command_length = 4,
5350 .host_command_parameters = { idx }, 5342 .host_command_parameters = {idx},
5351 }; 5343 };
5352 int err; 5344 int err;
5353 5345
@@ -5359,7 +5351,8 @@ static int ipw2100_set_key_index(struct ipw2100_priv *priv,
5359 if (!batch_mode) { 5351 if (!batch_mode) {
5360 err = ipw2100_disable_adapter(priv); 5352 err = ipw2100_disable_adapter(priv);
5361 if (err) { 5353 if (err) {
5362 printk(KERN_ERR DRV_NAME ": %s: Could not disable adapter %d\n", 5354 printk(KERN_ERR DRV_NAME
5355 ": %s: Could not disable adapter %d\n",
5363 priv->net_dev->name, err); 5356 priv->net_dev->name, err);
5364 return err; 5357 return err;
5365 } 5358 }
@@ -5374,9 +5367,7 @@ static int ipw2100_set_key_index(struct ipw2100_priv *priv,
5374 return err; 5367 return err;
5375} 5368}
5376 5369
5377 5370static int ipw2100_configure_security(struct ipw2100_priv *priv, int batch_mode)
5378static int ipw2100_configure_security(struct ipw2100_priv *priv,
5379 int batch_mode)
5380{ 5371{
5381 int i, err, auth_mode, sec_level, use_group; 5372 int i, err, auth_mode, sec_level, use_group;
5382 5373
@@ -5390,8 +5381,9 @@ static int ipw2100_configure_security(struct ipw2100_priv *priv,
5390 } 5381 }
5391 5382
5392 if (!priv->sec.enabled) { 5383 if (!priv->sec.enabled) {
5393 err = ipw2100_set_security_information( 5384 err =
5394 priv, IPW_AUTH_OPEN, SEC_LEVEL_0, 0, 1); 5385 ipw2100_set_security_information(priv, IPW_AUTH_OPEN,
5386 SEC_LEVEL_0, 0, 1);
5395 } else { 5387 } else {
5396 auth_mode = IPW_AUTH_OPEN; 5388 auth_mode = IPW_AUTH_OPEN;
5397 if ((priv->sec.flags & SEC_AUTH_MODE) && 5389 if ((priv->sec.flags & SEC_AUTH_MODE) &&
@@ -5406,8 +5398,9 @@ static int ipw2100_configure_security(struct ipw2100_priv *priv,
5406 if (priv->sec.flags & SEC_UNICAST_GROUP) 5398 if (priv->sec.flags & SEC_UNICAST_GROUP)
5407 use_group = priv->sec.unicast_uses_group; 5399 use_group = priv->sec.unicast_uses_group;
5408 5400
5409 err = ipw2100_set_security_information( 5401 err =
5410 priv, auth_mode, sec_level, use_group, 1); 5402 ipw2100_set_security_information(priv, auth_mode, sec_level,
5403 use_group, 1);
5411 } 5404 }
5412 5405
5413 if (err) 5406 if (err)
@@ -5433,14 +5426,16 @@ static int ipw2100_configure_security(struct ipw2100_priv *priv,
5433 5426
5434 /* Always enable privacy so the Host can filter WEP packets if 5427 /* Always enable privacy so the Host can filter WEP packets if
5435 * encrypted data is sent up */ 5428 * encrypted data is sent up */
5436 err = ipw2100_set_wep_flags( 5429 err =
5437 priv, priv->sec.enabled ? IPW_PRIVACY_CAPABLE : 0, 1); 5430 ipw2100_set_wep_flags(priv,
5431 priv->sec.enabled ? IPW_PRIVACY_CAPABLE : 0,
5432 1);
5438 if (err) 5433 if (err)
5439 goto exit; 5434 goto exit;
5440 5435
5441 priv->status &= ~STATUS_SECURITY_UPDATED; 5436 priv->status &= ~STATUS_SECURITY_UPDATED;
5442 5437
5443 exit: 5438 exit:
5444 if (!batch_mode) 5439 if (!batch_mode)
5445 ipw2100_enable_adapter(priv); 5440 ipw2100_enable_adapter(priv);
5446 5441
@@ -5498,31 +5493,29 @@ static void shim__set_security(struct net_device *dev,
5498 priv->status |= STATUS_SECURITY_UPDATED; 5493 priv->status |= STATUS_SECURITY_UPDATED;
5499 } 5494 }
5500 5495
5501 if (sec->flags & SEC_ENABLED && 5496 if (sec->flags & SEC_ENABLED && priv->sec.enabled != sec->enabled) {
5502 priv->sec.enabled != sec->enabled) {
5503 priv->sec.flags |= SEC_ENABLED; 5497 priv->sec.flags |= SEC_ENABLED;
5504 priv->sec.enabled = sec->enabled; 5498 priv->sec.enabled = sec->enabled;
5505 priv->status |= STATUS_SECURITY_UPDATED; 5499 priv->status |= STATUS_SECURITY_UPDATED;
5506 force_update = 1; 5500 force_update = 1;
5507 } 5501 }
5508 5502
5509 if (sec->flags & SEC_LEVEL && 5503 if (sec->flags & SEC_LEVEL && priv->sec.level != sec->level) {
5510 priv->sec.level != sec->level) {
5511 priv->sec.level = sec->level; 5504 priv->sec.level = sec->level;
5512 priv->sec.flags |= SEC_LEVEL; 5505 priv->sec.flags |= SEC_LEVEL;
5513 priv->status |= STATUS_SECURITY_UPDATED; 5506 priv->status |= STATUS_SECURITY_UPDATED;
5514 } 5507 }
5515 5508
5516 IPW_DEBUG_WEP("Security flags: %c %c%c%c%c %c%c%c%c\n", 5509 IPW_DEBUG_WEP("Security flags: %c %c%c%c%c %c%c%c%c\n",
5517 priv->sec.flags & (1<<8) ? '1' : '0', 5510 priv->sec.flags & (1 << 8) ? '1' : '0',
5518 priv->sec.flags & (1<<7) ? '1' : '0', 5511 priv->sec.flags & (1 << 7) ? '1' : '0',
5519 priv->sec.flags & (1<<6) ? '1' : '0', 5512 priv->sec.flags & (1 << 6) ? '1' : '0',
5520 priv->sec.flags & (1<<5) ? '1' : '0', 5513 priv->sec.flags & (1 << 5) ? '1' : '0',
5521 priv->sec.flags & (1<<4) ? '1' : '0', 5514 priv->sec.flags & (1 << 4) ? '1' : '0',
5522 priv->sec.flags & (1<<3) ? '1' : '0', 5515 priv->sec.flags & (1 << 3) ? '1' : '0',
5523 priv->sec.flags & (1<<2) ? '1' : '0', 5516 priv->sec.flags & (1 << 2) ? '1' : '0',
5524 priv->sec.flags & (1<<1) ? '1' : '0', 5517 priv->sec.flags & (1 << 1) ? '1' : '0',
5525 priv->sec.flags & (1<<0) ? '1' : '0'); 5518 priv->sec.flags & (1 << 0) ? '1' : '0');
5526 5519
5527/* As a temporary work around to enable WPA until we figure out why 5520/* As a temporary work around to enable WPA until we figure out why
5528 * wpa_supplicant toggles the security capability of the driver, which 5521 * wpa_supplicant toggles the security capability of the driver, which
@@ -5531,7 +5524,7 @@ static void shim__set_security(struct net_device *dev,
5531 * if (force_update || !(priv->status & STATUS_ASSOCIATED))*/ 5524 * if (force_update || !(priv->status & STATUS_ASSOCIATED))*/
5532 if (!(priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING))) 5525 if (!(priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)))
5533 ipw2100_configure_security(priv, 0); 5526 ipw2100_configure_security(priv, 0);
5534done: 5527 done:
5535 up(&priv->action_sem); 5528 up(&priv->action_sem);
5536} 5529}
5537 5530
@@ -5556,7 +5549,7 @@ static int ipw2100_adapter_setup(struct ipw2100_priv *priv)
5556 5549
5557 return 0; 5550 return 0;
5558 } 5551 }
5559#endif /* CONFIG_IPW2100_MONITOR */ 5552#endif /* CONFIG_IPW2100_MONITOR */
5560 5553
5561 err = ipw2100_read_mac_address(priv); 5554 err = ipw2100_read_mac_address(priv);
5562 if (err) 5555 if (err)
@@ -5576,7 +5569,7 @@ static int ipw2100_adapter_setup(struct ipw2100_priv *priv)
5576 return err; 5569 return err;
5577 } 5570 }
5578 5571
5579 err = ipw2100_system_config(priv, batch_mode); 5572 err = ipw2100_system_config(priv, batch_mode);
5580 if (err) 5573 if (err)
5581 return err; 5574 return err;
5582 5575
@@ -5614,8 +5607,10 @@ static int ipw2100_adapter_setup(struct ipw2100_priv *priv)
5614 return err; 5607 return err;
5615 5608
5616 if (priv->ieee->iw_mode == IW_MODE_ADHOC) { 5609 if (priv->ieee->iw_mode == IW_MODE_ADHOC) {
5617 err = ipw2100_set_ibss_beacon_interval( 5610 err =
5618 priv, priv->beacon_interval, batch_mode); 5611 ipw2100_set_ibss_beacon_interval(priv,
5612 priv->beacon_interval,
5613 batch_mode);
5619 if (err) 5614 if (err)
5620 return err; 5615 return err;
5621 5616
@@ -5625,18 +5620,17 @@ static int ipw2100_adapter_setup(struct ipw2100_priv *priv)
5625 } 5620 }
5626 5621
5627 /* 5622 /*
5628 err = ipw2100_set_fragmentation_threshold( 5623 err = ipw2100_set_fragmentation_threshold(
5629 priv, priv->frag_threshold, batch_mode); 5624 priv, priv->frag_threshold, batch_mode);
5630 if (err) 5625 if (err)
5631 return err; 5626 return err;
5632 */ 5627 */
5633 5628
5634 IPW_DEBUG_INFO("exit\n"); 5629 IPW_DEBUG_INFO("exit\n");
5635 5630
5636 return 0; 5631 return 0;
5637} 5632}
5638 5633
5639
5640/************************************************************************* 5634/*************************************************************************
5641 * 5635 *
5642 * EXTERNALLY CALLED METHODS 5636 * EXTERNALLY CALLED METHODS
@@ -5669,7 +5663,7 @@ static int ipw2100_set_address(struct net_device *dev, void *p)
5669 ipw2100_reset_adapter(priv); 5663 ipw2100_reset_adapter(priv);
5670 return 0; 5664 return 0;
5671 5665
5672 done: 5666 done:
5673 up(&priv->action_sem); 5667 up(&priv->action_sem);
5674 return err; 5668 return err;
5675} 5669}
@@ -5708,7 +5702,7 @@ static int ipw2100_close(struct net_device *dev)
5708 /* Flush the TX queue ... */ 5702 /* Flush the TX queue ... */
5709 while (!list_empty(&priv->tx_pend_list)) { 5703 while (!list_empty(&priv->tx_pend_list)) {
5710 element = priv->tx_pend_list.next; 5704 element = priv->tx_pend_list.next;
5711 packet = list_entry(element, struct ipw2100_tx_packet, list); 5705 packet = list_entry(element, struct ipw2100_tx_packet, list);
5712 5706
5713 list_del(element); 5707 list_del(element);
5714 DEC_STAT(&priv->tx_pend_stat); 5708 DEC_STAT(&priv->tx_pend_stat);
@@ -5726,8 +5720,6 @@ static int ipw2100_close(struct net_device *dev)
5726 return 0; 5720 return 0;
5727} 5721}
5728 5722
5729
5730
5731/* 5723/*
5732 * TODO: Fix this function... its just wrong 5724 * TODO: Fix this function... its just wrong
5733 */ 5725 */
@@ -5747,7 +5739,6 @@ static void ipw2100_tx_timeout(struct net_device *dev)
5747 schedule_reset(priv); 5739 schedule_reset(priv);
5748} 5740}
5749 5741
5750
5751/* 5742/*
5752 * TODO: reimplement it so that it reads statistics 5743 * TODO: reimplement it so that it reads statistics
5753 * from the adapter using ordinal tables 5744 * from the adapter using ordinal tables
@@ -5796,7 +5787,7 @@ static struct net_device_stats *ipw2100_stats(struct net_device *dev)
5796struct ipw2100_param { 5787struct ipw2100_param {
5797 u32 cmd; 5788 u32 cmd;
5798 u8 sta_addr[ETH_ALEN]; 5789 u8 sta_addr[ETH_ALEN];
5799 union { 5790 union {
5800 struct { 5791 struct {
5801 u8 name; 5792 u8 name;
5802 u32 value; 5793 u32 value;
@@ -5805,16 +5796,16 @@ struct ipw2100_param {
5805 u32 len; 5796 u32 len;
5806 u8 *data; 5797 u8 *data;
5807 } wpa_ie; 5798 } wpa_ie;
5808 struct{ 5799 struct {
5809 int command; 5800 int command;
5810 int reason_code; 5801 int reason_code;
5811 } mlme; 5802 } mlme;
5812 struct { 5803 struct {
5813 u8 alg[IPW2100_CRYPT_ALG_NAME_LEN]; 5804 u8 alg[IPW2100_CRYPT_ALG_NAME_LEN];
5814 u8 set_tx; 5805 u8 set_tx;
5815 u32 err; 5806 u32 err;
5816 u8 idx; 5807 u8 idx;
5817 u8 seq[8]; /* sequence counter (set: RX, get: TX) */ 5808 u8 seq[8]; /* sequence counter (set: RX, get: TX) */
5818 u16 key_len; 5809 u16 key_len;
5819 u8 key[0]; 5810 u8 key[0];
5820 } crypt; 5811 } crypt;
@@ -5824,7 +5815,8 @@ struct ipw2100_param {
5824 5815
5825/* end of driver_ipw2100.c code */ 5816/* end of driver_ipw2100.c code */
5826 5817
5827static int ipw2100_wpa_enable(struct ipw2100_priv *priv, int value){ 5818static int ipw2100_wpa_enable(struct ipw2100_priv *priv, int value)
5819{
5828 5820
5829 struct ieee80211_device *ieee = priv->ieee; 5821 struct ieee80211_device *ieee = priv->ieee;
5830 struct ieee80211_security sec = { 5822 struct ieee80211_security sec = {
@@ -5834,7 +5826,7 @@ static int ipw2100_wpa_enable(struct ipw2100_priv *priv, int value){
5834 5826
5835 ieee->wpa_enabled = value; 5827 ieee->wpa_enabled = value;
5836 5828
5837 if (value){ 5829 if (value) {
5838 sec.level = SEC_LEVEL_3; 5830 sec.level = SEC_LEVEL_3;
5839 sec.enabled = 1; 5831 sec.enabled = 1;
5840 } else { 5832 } else {
@@ -5853,7 +5845,8 @@ static int ipw2100_wpa_enable(struct ipw2100_priv *priv, int value){
5853#define AUTH_ALG_OPEN_SYSTEM 0x1 5845#define AUTH_ALG_OPEN_SYSTEM 0x1
5854#define AUTH_ALG_SHARED_KEY 0x2 5846#define AUTH_ALG_SHARED_KEY 0x2
5855 5847
5856static int ipw2100_wpa_set_auth_algs(struct ipw2100_priv *priv, int value){ 5848static int ipw2100_wpa_set_auth_algs(struct ipw2100_priv *priv, int value)
5849{
5857 5850
5858 struct ieee80211_device *ieee = priv->ieee; 5851 struct ieee80211_device *ieee = priv->ieee;
5859 struct ieee80211_security sec = { 5852 struct ieee80211_security sec = {
@@ -5861,7 +5854,7 @@ static int ipw2100_wpa_set_auth_algs(struct ipw2100_priv *priv, int value){
5861 }; 5854 };
5862 int ret = 0; 5855 int ret = 0;
5863 5856
5864 if (value & AUTH_ALG_SHARED_KEY){ 5857 if (value & AUTH_ALG_SHARED_KEY) {
5865 sec.auth_mode = WLAN_AUTH_SHARED_KEY; 5858 sec.auth_mode = WLAN_AUTH_SHARED_KEY;
5866 ieee->open_wep = 0; 5859 ieee->open_wep = 0;
5867 } else { 5860 } else {
@@ -5877,72 +5870,73 @@ static int ipw2100_wpa_set_auth_algs(struct ipw2100_priv *priv, int value){
5877 return ret; 5870 return ret;
5878} 5871}
5879 5872
5880 5873static int ipw2100_wpa_set_param(struct net_device *dev, u8 name, u32 value)
5881static int ipw2100_wpa_set_param(struct net_device *dev, u8 name, u32 value){ 5874{
5882 5875
5883 struct ipw2100_priv *priv = ieee80211_priv(dev); 5876 struct ipw2100_priv *priv = ieee80211_priv(dev);
5884 int ret=0; 5877 int ret = 0;
5885 5878
5886 switch(name){ 5879 switch (name) {
5887 case IPW2100_PARAM_WPA_ENABLED: 5880 case IPW2100_PARAM_WPA_ENABLED:
5888 ret = ipw2100_wpa_enable(priv, value); 5881 ret = ipw2100_wpa_enable(priv, value);
5889 break; 5882 break;
5890 5883
5891 case IPW2100_PARAM_TKIP_COUNTERMEASURES: 5884 case IPW2100_PARAM_TKIP_COUNTERMEASURES:
5892 priv->ieee->tkip_countermeasures=value; 5885 priv->ieee->tkip_countermeasures = value;
5893 break; 5886 break;
5894 5887
5895 case IPW2100_PARAM_DROP_UNENCRYPTED: 5888 case IPW2100_PARAM_DROP_UNENCRYPTED:
5896 priv->ieee->drop_unencrypted=value; 5889 priv->ieee->drop_unencrypted = value;
5897 break; 5890 break;
5898 5891
5899 case IPW2100_PARAM_PRIVACY_INVOKED: 5892 case IPW2100_PARAM_PRIVACY_INVOKED:
5900 priv->ieee->privacy_invoked=value; 5893 priv->ieee->privacy_invoked = value;
5901 break; 5894 break;
5902 5895
5903 case IPW2100_PARAM_AUTH_ALGS: 5896 case IPW2100_PARAM_AUTH_ALGS:
5904 ret = ipw2100_wpa_set_auth_algs(priv, value); 5897 ret = ipw2100_wpa_set_auth_algs(priv, value);
5905 break; 5898 break;
5906 5899
5907 case IPW2100_PARAM_IEEE_802_1X: 5900 case IPW2100_PARAM_IEEE_802_1X:
5908 priv->ieee->ieee802_1x=value; 5901 priv->ieee->ieee802_1x = value;
5909 break; 5902 break;
5910 5903
5911 default: 5904 default:
5912 printk(KERN_ERR DRV_NAME ": %s: Unknown WPA param: %d\n", 5905 printk(KERN_ERR DRV_NAME ": %s: Unknown WPA param: %d\n",
5913 dev->name, name); 5906 dev->name, name);
5914 ret = -EOPNOTSUPP; 5907 ret = -EOPNOTSUPP;
5915 } 5908 }
5916 5909
5917 return ret; 5910 return ret;
5918} 5911}
5919 5912
5920static int ipw2100_wpa_mlme(struct net_device *dev, int command, int reason){ 5913static int ipw2100_wpa_mlme(struct net_device *dev, int command, int reason)
5914{
5921 5915
5922 struct ipw2100_priv *priv = ieee80211_priv(dev); 5916 struct ipw2100_priv *priv = ieee80211_priv(dev);
5923 int ret=0; 5917 int ret = 0;
5924 5918
5925 switch(command){ 5919 switch (command) {
5926 case IPW2100_MLME_STA_DEAUTH: 5920 case IPW2100_MLME_STA_DEAUTH:
5927 // silently ignore 5921 // silently ignore
5928 break; 5922 break;
5929 5923
5930 case IPW2100_MLME_STA_DISASSOC: 5924 case IPW2100_MLME_STA_DISASSOC:
5931 ipw2100_disassociate_bssid(priv); 5925 ipw2100_disassociate_bssid(priv);
5932 break; 5926 break;
5933 5927
5934 default: 5928 default:
5935 printk(KERN_ERR DRV_NAME ": %s: Unknown MLME request: %d\n", 5929 printk(KERN_ERR DRV_NAME ": %s: Unknown MLME request: %d\n",
5936 dev->name, command); 5930 dev->name, command);
5937 ret = -EOPNOTSUPP; 5931 ret = -EOPNOTSUPP;
5938 } 5932 }
5939 5933
5940 return ret; 5934 return ret;
5941} 5935}
5942 5936
5943
5944void ipw2100_wpa_assoc_frame(struct ipw2100_priv *priv, 5937void ipw2100_wpa_assoc_frame(struct ipw2100_priv *priv,
5945 char *wpa_ie, int wpa_ie_len){ 5938 char *wpa_ie, int wpa_ie_len)
5939{
5946 5940
5947 struct ipw2100_wpa_assoc_frame frame; 5941 struct ipw2100_wpa_assoc_frame frame;
5948 5942
@@ -5957,23 +5951,22 @@ void ipw2100_wpa_assoc_frame(struct ipw2100_priv *priv,
5957 ipw2100_set_wpa_ie(priv, &frame, 0); 5951 ipw2100_set_wpa_ie(priv, &frame, 0);
5958} 5952}
5959 5953
5960
5961static int ipw2100_wpa_set_wpa_ie(struct net_device *dev, 5954static int ipw2100_wpa_set_wpa_ie(struct net_device *dev,
5962 struct ipw2100_param *param, int plen){ 5955 struct ipw2100_param *param, int plen)
5956{
5963 5957
5964 struct ipw2100_priv *priv = ieee80211_priv(dev); 5958 struct ipw2100_priv *priv = ieee80211_priv(dev);
5965 struct ieee80211_device *ieee = priv->ieee; 5959 struct ieee80211_device *ieee = priv->ieee;
5966 u8 *buf; 5960 u8 *buf;
5967 5961
5968 if (! ieee->wpa_enabled) 5962 if (!ieee->wpa_enabled)
5969 return -EOPNOTSUPP; 5963 return -EOPNOTSUPP;
5970 5964
5971 if (param->u.wpa_ie.len > MAX_WPA_IE_LEN || 5965 if (param->u.wpa_ie.len > MAX_WPA_IE_LEN ||
5972 (param->u.wpa_ie.len && 5966 (param->u.wpa_ie.len && param->u.wpa_ie.data == NULL))
5973 param->u.wpa_ie.data==NULL))
5974 return -EINVAL; 5967 return -EINVAL;
5975 5968
5976 if (param->u.wpa_ie.len){ 5969 if (param->u.wpa_ie.len) {
5977 buf = kmalloc(param->u.wpa_ie.len, GFP_KERNEL); 5970 buf = kmalloc(param->u.wpa_ie.len, GFP_KERNEL);
5978 if (buf == NULL) 5971 if (buf == NULL)
5979 return -ENOMEM; 5972 return -ENOMEM;
@@ -5998,7 +5991,9 @@ static int ipw2100_wpa_set_wpa_ie(struct net_device *dev,
5998/* implementation borrowed from hostap driver */ 5991/* implementation borrowed from hostap driver */
5999 5992
6000static int ipw2100_wpa_set_encryption(struct net_device *dev, 5993static int ipw2100_wpa_set_encryption(struct net_device *dev,
6001 struct ipw2100_param *param, int param_len){ 5994 struct ipw2100_param *param,
5995 int param_len)
5996{
6002 5997
6003 int ret = 0; 5998 int ret = 0;
6004 struct ipw2100_priv *priv = ieee80211_priv(dev); 5999 struct ipw2100_priv *priv = ieee80211_priv(dev);
@@ -6014,9 +6009,10 @@ static int ipw2100_wpa_set_encryption(struct net_device *dev,
6014 param->u.crypt.alg[IPW2100_CRYPT_ALG_NAME_LEN - 1] = '\0'; 6009 param->u.crypt.alg[IPW2100_CRYPT_ALG_NAME_LEN - 1] = '\0';
6015 6010
6016 if (param_len != 6011 if (param_len !=
6017 (int) ((char *) param->u.crypt.key - (char *) param) + 6012 (int)((char *)param->u.crypt.key - (char *)param) +
6018 param->u.crypt.key_len){ 6013 param->u.crypt.key_len) {
6019 IPW_DEBUG_INFO("Len mismatch %d, %d\n", param_len, param->u.crypt.key_len); 6014 IPW_DEBUG_INFO("Len mismatch %d, %d\n", param_len,
6015 param->u.crypt.key_len);
6020 return -EINVAL; 6016 return -EINVAL;
6021 } 6017 }
6022 if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && 6018 if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff &&
@@ -6030,7 +6026,7 @@ static int ipw2100_wpa_set_encryption(struct net_device *dev,
6030 } 6026 }
6031 6027
6032 if (strcmp(param->u.crypt.alg, "none") == 0) { 6028 if (strcmp(param->u.crypt.alg, "none") == 0) {
6033 if (crypt){ 6029 if (crypt) {
6034 sec.enabled = 0; 6030 sec.enabled = 0;
6035 sec.level = SEC_LEVEL_0; 6031 sec.level = SEC_LEVEL_0;
6036 sec.flags |= SEC_ENABLED | SEC_LEVEL; 6032 sec.flags |= SEC_ENABLED | SEC_LEVEL;
@@ -6054,7 +6050,7 @@ static int ipw2100_wpa_set_encryption(struct net_device *dev,
6054 } 6050 }
6055 if (ops == NULL) { 6051 if (ops == NULL) {
6056 IPW_DEBUG_INFO("%s: unknown crypto alg '%s'\n", 6052 IPW_DEBUG_INFO("%s: unknown crypto alg '%s'\n",
6057 dev->name, param->u.crypt.alg); 6053 dev->name, param->u.crypt.alg);
6058 param->u.crypt.err = IPW2100_CRYPT_ERR_UNKNOWN_ALG; 6054 param->u.crypt.err = IPW2100_CRYPT_ERR_UNKNOWN_ALG;
6059 ret = -EINVAL; 6055 ret = -EINVAL;
6060 goto done; 6056 goto done;
@@ -6066,7 +6062,7 @@ static int ipw2100_wpa_set_encryption(struct net_device *dev,
6066 ieee80211_crypt_delayed_deinit(ieee, crypt); 6062 ieee80211_crypt_delayed_deinit(ieee, crypt);
6067 6063
6068 new_crypt = (struct ieee80211_crypt_data *) 6064 new_crypt = (struct ieee80211_crypt_data *)
6069 kmalloc(sizeof(struct ieee80211_crypt_data), GFP_KERNEL); 6065 kmalloc(sizeof(struct ieee80211_crypt_data), GFP_KERNEL);
6070 if (new_crypt == NULL) { 6066 if (new_crypt == NULL) {
6071 ret = -ENOMEM; 6067 ret = -ENOMEM;
6072 goto done; 6068 goto done;
@@ -6074,12 +6070,13 @@ static int ipw2100_wpa_set_encryption(struct net_device *dev,
6074 memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data)); 6070 memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data));
6075 new_crypt->ops = ops; 6071 new_crypt->ops = ops;
6076 if (new_crypt->ops && try_module_get(new_crypt->ops->owner)) 6072 if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
6077 new_crypt->priv = new_crypt->ops->init(param->u.crypt.idx); 6073 new_crypt->priv =
6074 new_crypt->ops->init(param->u.crypt.idx);
6078 6075
6079 if (new_crypt->priv == NULL) { 6076 if (new_crypt->priv == NULL) {
6080 kfree(new_crypt); 6077 kfree(new_crypt);
6081 param->u.crypt.err = 6078 param->u.crypt.err =
6082 IPW2100_CRYPT_ERR_CRYPT_INIT_FAILED; 6079 IPW2100_CRYPT_ERR_CRYPT_INIT_FAILED;
6083 ret = -EINVAL; 6080 ret = -EINVAL;
6084 goto done; 6081 goto done;
6085 } 6082 }
@@ -6091,24 +6088,25 @@ static int ipw2100_wpa_set_encryption(struct net_device *dev,
6091 (*crypt)->ops->set_key(param->u.crypt.key, 6088 (*crypt)->ops->set_key(param->u.crypt.key,
6092 param->u.crypt.key_len, param->u.crypt.seq, 6089 param->u.crypt.key_len, param->u.crypt.seq,
6093 (*crypt)->priv) < 0) { 6090 (*crypt)->priv) < 0) {
6094 IPW_DEBUG_INFO("%s: key setting failed\n", 6091 IPW_DEBUG_INFO("%s: key setting failed\n", dev->name);
6095 dev->name);
6096 param->u.crypt.err = IPW2100_CRYPT_ERR_KEY_SET_FAILED; 6092 param->u.crypt.err = IPW2100_CRYPT_ERR_KEY_SET_FAILED;
6097 ret = -EINVAL; 6093 ret = -EINVAL;
6098 goto done; 6094 goto done;
6099 } 6095 }
6100 6096
6101 if (param->u.crypt.set_tx){ 6097 if (param->u.crypt.set_tx) {
6102 ieee->tx_keyidx = param->u.crypt.idx; 6098 ieee->tx_keyidx = param->u.crypt.idx;
6103 sec.active_key = param->u.crypt.idx; 6099 sec.active_key = param->u.crypt.idx;
6104 sec.flags |= SEC_ACTIVE_KEY; 6100 sec.flags |= SEC_ACTIVE_KEY;
6105 } 6101 }
6106 6102
6107 if (ops->name != NULL){ 6103 if (ops->name != NULL) {
6108 6104
6109 if (strcmp(ops->name, "WEP") == 0) { 6105 if (strcmp(ops->name, "WEP") == 0) {
6110 memcpy(sec.keys[param->u.crypt.idx], param->u.crypt.key, param->u.crypt.key_len); 6106 memcpy(sec.keys[param->u.crypt.idx], param->u.crypt.key,
6111 sec.key_sizes[param->u.crypt.idx] = param->u.crypt.key_len; 6107 param->u.crypt.key_len);
6108 sec.key_sizes[param->u.crypt.idx] =
6109 param->u.crypt.key_len;
6112 sec.flags |= (1 << param->u.crypt.idx); 6110 sec.flags |= (1 << param->u.crypt.idx);
6113 sec.flags |= SEC_LEVEL; 6111 sec.flags |= SEC_LEVEL;
6114 sec.level = SEC_LEVEL_1; 6112 sec.level = SEC_LEVEL_1;
@@ -6120,7 +6118,7 @@ static int ipw2100_wpa_set_encryption(struct net_device *dev,
6120 sec.level = SEC_LEVEL_3; 6118 sec.level = SEC_LEVEL_3;
6121 } 6119 }
6122 } 6120 }
6123 done: 6121 done:
6124 if (ieee->set_security) 6122 if (ieee->set_security)
6125 ieee->set_security(ieee->dev, &sec); 6123 ieee->set_security(ieee->dev, &sec);
6126 6124
@@ -6131,8 +6129,7 @@ static int ipw2100_wpa_set_encryption(struct net_device *dev,
6131 * the callbacks structures used to initialize the 802.11 stack. */ 6129 * the callbacks structures used to initialize the 802.11 stack. */
6132 if (ieee->reset_on_keychange && 6130 if (ieee->reset_on_keychange &&
6133 ieee->iw_mode != IW_MODE_INFRA && 6131 ieee->iw_mode != IW_MODE_INFRA &&
6134 ieee->reset_port && 6132 ieee->reset_port && ieee->reset_port(dev)) {
6135 ieee->reset_port(dev)) {
6136 IPW_DEBUG_INFO("%s: reset_port failed\n", dev->name); 6133 IPW_DEBUG_INFO("%s: reset_port failed\n", dev->name);
6137 param->u.crypt.err = IPW2100_CRYPT_ERR_CARD_CONF_FAILED; 6134 param->u.crypt.err = IPW2100_CRYPT_ERR_CARD_CONF_FAILED;
6138 return -EINVAL; 6135 return -EINVAL;
@@ -6141,11 +6138,11 @@ static int ipw2100_wpa_set_encryption(struct net_device *dev,
6141 return ret; 6138 return ret;
6142} 6139}
6143 6140
6144 6141static int ipw2100_wpa_supplicant(struct net_device *dev, struct iw_point *p)
6145static int ipw2100_wpa_supplicant(struct net_device *dev, struct iw_point *p){ 6142{
6146 6143
6147 struct ipw2100_param *param; 6144 struct ipw2100_param *param;
6148 int ret=0; 6145 int ret = 0;
6149 6146
6150 IPW_DEBUG_IOCTL("wpa_supplicant: len=%d\n", p->length); 6147 IPW_DEBUG_IOCTL("wpa_supplicant: len=%d\n", p->length);
6151 6148
@@ -6156,12 +6153,12 @@ static int ipw2100_wpa_supplicant(struct net_device *dev, struct iw_point *p){
6156 if (param == NULL) 6153 if (param == NULL)
6157 return -ENOMEM; 6154 return -ENOMEM;
6158 6155
6159 if (copy_from_user(param, p->pointer, p->length)){ 6156 if (copy_from_user(param, p->pointer, p->length)) {
6160 kfree(param); 6157 kfree(param);
6161 return -EFAULT; 6158 return -EFAULT;
6162 } 6159 }
6163 6160
6164 switch (param->cmd){ 6161 switch (param->cmd) {
6165 6162
6166 case IPW2100_CMD_SET_WPA_PARAM: 6163 case IPW2100_CMD_SET_WPA_PARAM:
6167 ret = ipw2100_wpa_set_param(dev, param->u.wpa_param.name, 6164 ret = ipw2100_wpa_set_param(dev, param->u.wpa_param.name,
@@ -6182,8 +6179,9 @@ static int ipw2100_wpa_supplicant(struct net_device *dev, struct iw_point *p){
6182 break; 6179 break;
6183 6180
6184 default: 6181 default:
6185 printk(KERN_ERR DRV_NAME ": %s: Unknown WPA supplicant request: %d\n", 6182 printk(KERN_ERR DRV_NAME
6186 dev->name, param->cmd); 6183 ": %s: Unknown WPA supplicant request: %d\n", dev->name,
6184 param->cmd);
6187 ret = -EOPNOTSUPP; 6185 ret = -EOPNOTSUPP;
6188 6186
6189 } 6187 }
@@ -6194,28 +6192,27 @@ static int ipw2100_wpa_supplicant(struct net_device *dev, struct iw_point *p){
6194 kfree(param); 6192 kfree(param);
6195 return ret; 6193 return ret;
6196} 6194}
6197#endif /* CONFIG_IEEE80211_WPA */ 6195#endif /* CONFIG_IEEE80211_WPA */
6198 6196
6199static int ipw2100_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) 6197static int ipw2100_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
6200{ 6198{
6201#ifdef CONFIG_IEEE80211_WPA 6199#ifdef CONFIG_IEEE80211_WPA
6202 struct iwreq *wrq = (struct iwreq *) rq; 6200 struct iwreq *wrq = (struct iwreq *)rq;
6203 int ret=-1; 6201 int ret = -1;
6204 switch (cmd){ 6202 switch (cmd) {
6205 case IPW2100_IOCTL_WPA_SUPPLICANT: 6203 case IPW2100_IOCTL_WPA_SUPPLICANT:
6206 ret = ipw2100_wpa_supplicant(dev, &wrq->u.data); 6204 ret = ipw2100_wpa_supplicant(dev, &wrq->u.data);
6207 return ret; 6205 return ret;
6208 6206
6209 default: 6207 default:
6210 return -EOPNOTSUPP; 6208 return -EOPNOTSUPP;
6211 } 6209 }
6212 6210
6213#endif /* CONFIG_IEEE80211_WPA */ 6211#endif /* CONFIG_IEEE80211_WPA */
6214 6212
6215 return -EOPNOTSUPP; 6213 return -EOPNOTSUPP;
6216} 6214}
6217 6215
6218
6219static void ipw_ethtool_get_drvinfo(struct net_device *dev, 6216static void ipw_ethtool_get_drvinfo(struct net_device *dev,
6220 struct ethtool_drvinfo *info) 6217 struct ethtool_drvinfo *info)
6221{ 6218{
@@ -6236,14 +6233,13 @@ static void ipw_ethtool_get_drvinfo(struct net_device *dev,
6236 6233
6237static u32 ipw2100_ethtool_get_link(struct net_device *dev) 6234static u32 ipw2100_ethtool_get_link(struct net_device *dev)
6238{ 6235{
6239 struct ipw2100_priv *priv = ieee80211_priv(dev); 6236 struct ipw2100_priv *priv = ieee80211_priv(dev);
6240 return (priv->status & STATUS_ASSOCIATED) ? 1 : 0; 6237 return (priv->status & STATUS_ASSOCIATED) ? 1 : 0;
6241} 6238}
6242 6239
6243
6244static struct ethtool_ops ipw2100_ethtool_ops = { 6240static struct ethtool_ops ipw2100_ethtool_ops = {
6245 .get_link = ipw2100_ethtool_get_link, 6241 .get_link = ipw2100_ethtool_get_link,
6246 .get_drvinfo = ipw_ethtool_get_drvinfo, 6242 .get_drvinfo = ipw_ethtool_get_drvinfo,
6247}; 6243};
6248 6244
6249static void ipw2100_hang_check(void *adapter) 6245static void ipw2100_hang_check(void *adapter)
@@ -6288,7 +6284,6 @@ static void ipw2100_hang_check(void *adapter)
6288 spin_unlock_irqrestore(&priv->low_lock, flags); 6284 spin_unlock_irqrestore(&priv->low_lock, flags);
6289} 6285}
6290 6286
6291
6292static void ipw2100_rf_kill(void *adapter) 6287static void ipw2100_rf_kill(void *adapter)
6293{ 6288{
6294 struct ipw2100_priv *priv = adapter; 6289 struct ipw2100_priv *priv = adapter;
@@ -6313,7 +6308,7 @@ static void ipw2100_rf_kill(void *adapter)
6313 IPW_DEBUG_RF_KILL("HW RF Kill deactivated. SW RF Kill still " 6308 IPW_DEBUG_RF_KILL("HW RF Kill deactivated. SW RF Kill still "
6314 "enabled\n"); 6309 "enabled\n");
6315 6310
6316 exit_unlock: 6311 exit_unlock:
6317 spin_unlock_irqrestore(&priv->low_lock, flags); 6312 spin_unlock_irqrestore(&priv->low_lock, flags);
6318} 6313}
6319 6314
@@ -6321,11 +6316,10 @@ static void ipw2100_irq_tasklet(struct ipw2100_priv *priv);
6321 6316
6322/* Look into using netdev destructor to shutdown ieee80211? */ 6317/* Look into using netdev destructor to shutdown ieee80211? */
6323 6318
6324static struct net_device *ipw2100_alloc_device( 6319static struct net_device *ipw2100_alloc_device(struct pci_dev *pci_dev,
6325 struct pci_dev *pci_dev, 6320 void __iomem * base_addr,
6326 void __iomem *base_addr, 6321 unsigned long mem_start,
6327 unsigned long mem_start, 6322 unsigned long mem_len)
6328 unsigned long mem_len)
6329{ 6323{
6330 struct ipw2100_priv *priv; 6324 struct ipw2100_priv *priv;
6331 struct net_device *dev; 6325 struct net_device *dev;
@@ -6351,7 +6345,7 @@ static struct net_device *ipw2100_alloc_device(
6351 dev->wireless_handlers = &ipw2100_wx_handler_def; 6345 dev->wireless_handlers = &ipw2100_wx_handler_def;
6352 dev->get_wireless_stats = ipw2100_wx_wireless_stats; 6346 dev->get_wireless_stats = ipw2100_wx_wireless_stats;
6353 dev->set_mac_address = ipw2100_set_address; 6347 dev->set_mac_address = ipw2100_set_address;
6354 dev->watchdog_timeo = 3*HZ; 6348 dev->watchdog_timeo = 3 * HZ;
6355 dev->irq = 0; 6349 dev->irq = 0;
6356 6350
6357 dev->base_addr = (unsigned long)base_addr; 6351 dev->base_addr = (unsigned long)base_addr;
@@ -6364,22 +6358,19 @@ static struct net_device *ipw2100_alloc_device(
6364 * ends up causing problems. So, we just handle 6358 * ends up causing problems. So, we just handle
6365 * the WX extensions through the ipw2100_ioctl interface */ 6359 * the WX extensions through the ipw2100_ioctl interface */
6366 6360
6367
6368 /* memset() puts everything to 0, so we only have explicitely set 6361 /* memset() puts everything to 0, so we only have explicitely set
6369 * those values that need to be something else */ 6362 * those values that need to be something else */
6370 6363
6371 /* If power management is turned on, default to AUTO mode */ 6364 /* If power management is turned on, default to AUTO mode */
6372 priv->power_mode = IPW_POWER_AUTO; 6365 priv->power_mode = IPW_POWER_AUTO;
6373 6366
6374
6375
6376#ifdef CONFIG_IEEE80211_WPA 6367#ifdef CONFIG_IEEE80211_WPA
6377 priv->ieee->wpa_enabled = 0; 6368 priv->ieee->wpa_enabled = 0;
6378 priv->ieee->tkip_countermeasures = 0; 6369 priv->ieee->tkip_countermeasures = 0;
6379 priv->ieee->drop_unencrypted = 0; 6370 priv->ieee->drop_unencrypted = 0;
6380 priv->ieee->privacy_invoked = 0; 6371 priv->ieee->privacy_invoked = 0;
6381 priv->ieee->ieee802_1x = 1; 6372 priv->ieee->ieee802_1x = 1;
6382#endif /* CONFIG_IEEE80211_WPA */ 6373#endif /* CONFIG_IEEE80211_WPA */
6383 6374
6384 /* Set module parameters */ 6375 /* Set module parameters */
6385 switch (mode) { 6376 switch (mode) {
@@ -6401,8 +6392,7 @@ static struct net_device *ipw2100_alloc_device(
6401 priv->status |= STATUS_RF_KILL_SW; 6392 priv->status |= STATUS_RF_KILL_SW;
6402 6393
6403 if (channel != 0 && 6394 if (channel != 0 &&
6404 ((channel >= REG_MIN_CHANNEL) && 6395 ((channel >= REG_MIN_CHANNEL) && (channel <= REG_MAX_CHANNEL))) {
6405 (channel <= REG_MAX_CHANNEL))) {
6406 priv->config |= CFG_STATIC_CHANNEL; 6396 priv->config |= CFG_STATIC_CHANNEL;
6407 priv->channel = channel; 6397 priv->channel = channel;
6408 } 6398 }
@@ -6441,7 +6431,6 @@ static struct net_device *ipw2100_alloc_device(
6441 INIT_LIST_HEAD(&priv->fw_pend_list); 6431 INIT_LIST_HEAD(&priv->fw_pend_list);
6442 INIT_STAT(&priv->fw_pend_stat); 6432 INIT_STAT(&priv->fw_pend_stat);
6443 6433
6444
6445#ifdef CONFIG_SOFTWARE_SUSPEND2 6434#ifdef CONFIG_SOFTWARE_SUSPEND2
6446 priv->workqueue = create_workqueue(DRV_NAME, 0); 6435 priv->workqueue = create_workqueue(DRV_NAME, 0);
6447#else 6436#else
@@ -6535,7 +6524,7 @@ static int ipw2100_pci_init_one(struct pci_dev *pci_dev,
6535 return err; 6524 return err;
6536 } 6525 }
6537 6526
6538 /* We disable the RETRY_TIMEOUT register (0x41) to keep 6527 /* We disable the RETRY_TIMEOUT register (0x41) to keep
6539 * PCI Tx retries from interfering with C3 CPU state */ 6528 * PCI Tx retries from interfering with C3 CPU state */
6540 pci_read_config_dword(pci_dev, 0x40, &val); 6529 pci_read_config_dword(pci_dev, 0x40, &val);
6541 if ((val & 0x0000ff00) != 0) 6530 if ((val & 0x0000ff00) != 0)
@@ -6566,12 +6555,10 @@ static int ipw2100_pci_init_one(struct pci_dev *pci_dev,
6566 ipw2100_queues_initialize(priv); 6555 ipw2100_queues_initialize(priv);
6567 6556
6568 err = request_irq(pci_dev->irq, 6557 err = request_irq(pci_dev->irq,
6569 ipw2100_interrupt, SA_SHIRQ, 6558 ipw2100_interrupt, SA_SHIRQ, dev->name, priv);
6570 dev->name, priv);
6571 if (err) { 6559 if (err) {
6572 printk(KERN_WARNING DRV_NAME 6560 printk(KERN_WARNING DRV_NAME
6573 "Error calling request_irq: %d.\n", 6561 "Error calling request_irq: %d.\n", pci_dev->irq);
6574 pci_dev->irq);
6575 goto fail; 6562 goto fail;
6576 } 6563 }
6577 dev->irq = pci_dev->irq; 6564 dev->irq = pci_dev->irq;
@@ -6634,10 +6621,10 @@ static int ipw2100_pci_init_one(struct pci_dev *pci_dev,
6634 6621
6635 return 0; 6622 return 0;
6636 6623
6637 fail_unlock: 6624 fail_unlock:
6638 up(&priv->action_sem); 6625 up(&priv->action_sem);
6639 6626
6640 fail: 6627 fail:
6641 if (dev) { 6628 if (dev) {
6642 if (registered) 6629 if (registered)
6643 unregister_netdev(dev); 6630 unregister_netdev(dev);
@@ -6653,7 +6640,8 @@ static int ipw2100_pci_init_one(struct pci_dev *pci_dev,
6653 6640
6654 /* These are safe to call even if they weren't allocated */ 6641 /* These are safe to call even if they weren't allocated */
6655 ipw2100_queues_free(priv); 6642 ipw2100_queues_free(priv);
6656 sysfs_remove_group(&pci_dev->dev.kobj, &ipw2100_attribute_group); 6643 sysfs_remove_group(&pci_dev->dev.kobj,
6644 &ipw2100_attribute_group);
6657 6645
6658 free_ieee80211(dev); 6646 free_ieee80211(dev);
6659 pci_set_drvdata(pci_dev, NULL); 6647 pci_set_drvdata(pci_dev, NULL);
@@ -6679,7 +6667,8 @@ static void __devexit ipw2100_pci_remove_one(struct pci_dev *pci_dev)
6679 priv->status &= ~STATUS_INITIALIZED; 6667 priv->status &= ~STATUS_INITIALIZED;
6680 6668
6681 dev = priv->net_dev; 6669 dev = priv->net_dev;
6682 sysfs_remove_group(&pci_dev->dev.kobj, &ipw2100_attribute_group); 6670 sysfs_remove_group(&pci_dev->dev.kobj,
6671 &ipw2100_attribute_group);
6683 6672
6684#ifdef CONFIG_PM 6673#ifdef CONFIG_PM
6685 if (ipw2100_firmware.version) 6674 if (ipw2100_firmware.version)
@@ -6721,7 +6710,6 @@ static void __devexit ipw2100_pci_remove_one(struct pci_dev *pci_dev)
6721 IPW_DEBUG_INFO("exit\n"); 6710 IPW_DEBUG_INFO("exit\n");
6722} 6711}
6723 6712
6724
6725#ifdef CONFIG_PM 6713#ifdef CONFIG_PM
6726#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11) 6714#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11)
6727static int ipw2100_suspend(struct pci_dev *pci_dev, u32 state) 6715static int ipw2100_suspend(struct pci_dev *pci_dev, u32 state)
@@ -6732,8 +6720,7 @@ static int ipw2100_suspend(struct pci_dev *pci_dev, pm_message_t state)
6732 struct ipw2100_priv *priv = pci_get_drvdata(pci_dev); 6720 struct ipw2100_priv *priv = pci_get_drvdata(pci_dev);
6733 struct net_device *dev = priv->net_dev; 6721 struct net_device *dev = priv->net_dev;
6734 6722
6735 IPW_DEBUG_INFO("%s: Going into suspend...\n", 6723 IPW_DEBUG_INFO("%s: Going into suspend...\n", dev->name);
6736 dev->name);
6737 6724
6738 down(&priv->action_sem); 6725 down(&priv->action_sem);
6739 if (priv->status & STATUS_INITIALIZED) { 6726 if (priv->status & STATUS_INITIALIZED) {
@@ -6745,7 +6732,7 @@ static int ipw2100_suspend(struct pci_dev *pci_dev, pm_message_t state)
6745 netif_device_detach(dev); 6732 netif_device_detach(dev);
6746 6733
6747 pci_save_state(pci_dev); 6734 pci_save_state(pci_dev);
6748 pci_disable_device (pci_dev); 6735 pci_disable_device(pci_dev);
6749 pci_set_power_state(pci_dev, PCI_D3hot); 6736 pci_set_power_state(pci_dev, PCI_D3hot);
6750 6737
6751 up(&priv->action_sem); 6738 up(&priv->action_sem);
@@ -6764,8 +6751,7 @@ static int ipw2100_resume(struct pci_dev *pci_dev)
6764 6751
6765 down(&priv->action_sem); 6752 down(&priv->action_sem);
6766 6753
6767 IPW_DEBUG_INFO("%s: Coming out of suspend...\n", 6754 IPW_DEBUG_INFO("%s: Coming out of suspend...\n", dev->name);
6768 dev->name);
6769 6755
6770 pci_set_power_state(pci_dev, PCI_D0); 6756 pci_set_power_state(pci_dev, PCI_D0);
6771 pci_enable_device(pci_dev); 6757 pci_enable_device(pci_dev);
@@ -6785,9 +6771,9 @@ static int ipw2100_resume(struct pci_dev *pci_dev)
6785 * the queue of needed */ 6771 * the queue of needed */
6786 netif_device_attach(dev); 6772 netif_device_attach(dev);
6787 6773
6788 /* Bring the device back up */ 6774 /* Bring the device back up */
6789 if (!(priv->status & STATUS_RF_KILL_SW)) 6775 if (!(priv->status & STATUS_RF_KILL_SW))
6790 ipw2100_up(priv, 0); 6776 ipw2100_up(priv, 0);
6791 6777
6792 up(&priv->action_sem); 6778 up(&priv->action_sem);
6793 6779
@@ -6795,56 +6781,55 @@ static int ipw2100_resume(struct pci_dev *pci_dev)
6795} 6781}
6796#endif 6782#endif
6797 6783
6798
6799#define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } 6784#define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x }
6800 6785
6801static struct pci_device_id ipw2100_pci_id_table[] __devinitdata = { 6786static struct pci_device_id ipw2100_pci_id_table[] __devinitdata = {
6802 IPW2100_DEV_ID(0x2520), /* IN 2100A mPCI 3A */ 6787 IPW2100_DEV_ID(0x2520), /* IN 2100A mPCI 3A */
6803 IPW2100_DEV_ID(0x2521), /* IN 2100A mPCI 3B */ 6788 IPW2100_DEV_ID(0x2521), /* IN 2100A mPCI 3B */
6804 IPW2100_DEV_ID(0x2524), /* IN 2100A mPCI 3B */ 6789 IPW2100_DEV_ID(0x2524), /* IN 2100A mPCI 3B */
6805 IPW2100_DEV_ID(0x2525), /* IN 2100A mPCI 3B */ 6790 IPW2100_DEV_ID(0x2525), /* IN 2100A mPCI 3B */
6806 IPW2100_DEV_ID(0x2526), /* IN 2100A mPCI Gen A3 */ 6791 IPW2100_DEV_ID(0x2526), /* IN 2100A mPCI Gen A3 */
6807 IPW2100_DEV_ID(0x2522), /* IN 2100 mPCI 3B */ 6792 IPW2100_DEV_ID(0x2522), /* IN 2100 mPCI 3B */
6808 IPW2100_DEV_ID(0x2523), /* IN 2100 mPCI 3A */ 6793 IPW2100_DEV_ID(0x2523), /* IN 2100 mPCI 3A */
6809 IPW2100_DEV_ID(0x2527), /* IN 2100 mPCI 3B */ 6794 IPW2100_DEV_ID(0x2527), /* IN 2100 mPCI 3B */
6810 IPW2100_DEV_ID(0x2528), /* IN 2100 mPCI 3B */ 6795 IPW2100_DEV_ID(0x2528), /* IN 2100 mPCI 3B */
6811 IPW2100_DEV_ID(0x2529), /* IN 2100 mPCI 3B */ 6796 IPW2100_DEV_ID(0x2529), /* IN 2100 mPCI 3B */
6812 IPW2100_DEV_ID(0x252B), /* IN 2100 mPCI 3A */ 6797 IPW2100_DEV_ID(0x252B), /* IN 2100 mPCI 3A */
6813 IPW2100_DEV_ID(0x252C), /* IN 2100 mPCI 3A */ 6798 IPW2100_DEV_ID(0x252C), /* IN 2100 mPCI 3A */
6814 IPW2100_DEV_ID(0x252D), /* IN 2100 mPCI 3A */ 6799 IPW2100_DEV_ID(0x252D), /* IN 2100 mPCI 3A */
6815 6800
6816 IPW2100_DEV_ID(0x2550), /* IB 2100A mPCI 3B */ 6801 IPW2100_DEV_ID(0x2550), /* IB 2100A mPCI 3B */
6817 IPW2100_DEV_ID(0x2551), /* IB 2100 mPCI 3B */ 6802 IPW2100_DEV_ID(0x2551), /* IB 2100 mPCI 3B */
6818 IPW2100_DEV_ID(0x2553), /* IB 2100 mPCI 3B */ 6803 IPW2100_DEV_ID(0x2553), /* IB 2100 mPCI 3B */
6819 IPW2100_DEV_ID(0x2554), /* IB 2100 mPCI 3B */ 6804 IPW2100_DEV_ID(0x2554), /* IB 2100 mPCI 3B */
6820 IPW2100_DEV_ID(0x2555), /* IB 2100 mPCI 3B */ 6805 IPW2100_DEV_ID(0x2555), /* IB 2100 mPCI 3B */
6821 6806
6822 IPW2100_DEV_ID(0x2560), /* DE 2100A mPCI 3A */ 6807 IPW2100_DEV_ID(0x2560), /* DE 2100A mPCI 3A */
6823 IPW2100_DEV_ID(0x2562), /* DE 2100A mPCI 3A */ 6808 IPW2100_DEV_ID(0x2562), /* DE 2100A mPCI 3A */
6824 IPW2100_DEV_ID(0x2563), /* DE 2100A mPCI 3A */ 6809 IPW2100_DEV_ID(0x2563), /* DE 2100A mPCI 3A */
6825 IPW2100_DEV_ID(0x2561), /* DE 2100 mPCI 3A */ 6810 IPW2100_DEV_ID(0x2561), /* DE 2100 mPCI 3A */
6826 IPW2100_DEV_ID(0x2565), /* DE 2100 mPCI 3A */ 6811 IPW2100_DEV_ID(0x2565), /* DE 2100 mPCI 3A */
6827 IPW2100_DEV_ID(0x2566), /* DE 2100 mPCI 3A */ 6812 IPW2100_DEV_ID(0x2566), /* DE 2100 mPCI 3A */
6828 IPW2100_DEV_ID(0x2567), /* DE 2100 mPCI 3A */ 6813 IPW2100_DEV_ID(0x2567), /* DE 2100 mPCI 3A */
6829 6814
6830 IPW2100_DEV_ID(0x2570), /* GA 2100 mPCI 3B */ 6815 IPW2100_DEV_ID(0x2570), /* GA 2100 mPCI 3B */
6831 6816
6832 IPW2100_DEV_ID(0x2580), /* TO 2100A mPCI 3B */ 6817 IPW2100_DEV_ID(0x2580), /* TO 2100A mPCI 3B */
6833 IPW2100_DEV_ID(0x2582), /* TO 2100A mPCI 3B */ 6818 IPW2100_DEV_ID(0x2582), /* TO 2100A mPCI 3B */
6834 IPW2100_DEV_ID(0x2583), /* TO 2100A mPCI 3B */ 6819 IPW2100_DEV_ID(0x2583), /* TO 2100A mPCI 3B */
6835 IPW2100_DEV_ID(0x2581), /* TO 2100 mPCI 3B */ 6820 IPW2100_DEV_ID(0x2581), /* TO 2100 mPCI 3B */
6836 IPW2100_DEV_ID(0x2585), /* TO 2100 mPCI 3B */ 6821 IPW2100_DEV_ID(0x2585), /* TO 2100 mPCI 3B */
6837 IPW2100_DEV_ID(0x2586), /* TO 2100 mPCI 3B */ 6822 IPW2100_DEV_ID(0x2586), /* TO 2100 mPCI 3B */
6838 IPW2100_DEV_ID(0x2587), /* TO 2100 mPCI 3B */ 6823 IPW2100_DEV_ID(0x2587), /* TO 2100 mPCI 3B */
6839 6824
6840 IPW2100_DEV_ID(0x2590), /* SO 2100A mPCI 3B */ 6825 IPW2100_DEV_ID(0x2590), /* SO 2100A mPCI 3B */
6841 IPW2100_DEV_ID(0x2592), /* SO 2100A mPCI 3B */ 6826 IPW2100_DEV_ID(0x2592), /* SO 2100A mPCI 3B */
6842 IPW2100_DEV_ID(0x2591), /* SO 2100 mPCI 3B */ 6827 IPW2100_DEV_ID(0x2591), /* SO 2100 mPCI 3B */
6843 IPW2100_DEV_ID(0x2593), /* SO 2100 mPCI 3B */ 6828 IPW2100_DEV_ID(0x2593), /* SO 2100 mPCI 3B */
6844 IPW2100_DEV_ID(0x2596), /* SO 2100 mPCI 3B */ 6829 IPW2100_DEV_ID(0x2596), /* SO 2100 mPCI 3B */
6845 IPW2100_DEV_ID(0x2598), /* SO 2100 mPCI 3B */ 6830 IPW2100_DEV_ID(0x2598), /* SO 2100 mPCI 3B */
6846 6831
6847 IPW2100_DEV_ID(0x25A0), /* HP 2100 mPCI 3B */ 6832 IPW2100_DEV_ID(0x25A0), /* HP 2100 mPCI 3B */
6848 {0,}, 6833 {0,},
6849}; 6834};
6850 6835
@@ -6861,7 +6846,6 @@ static struct pci_driver ipw2100_pci_driver = {
6861#endif 6846#endif
6862}; 6847};
6863 6848
6864
6865/** 6849/**
6866 * Initialize the ipw2100 driver/module 6850 * Initialize the ipw2100 driver/module
6867 * 6851 *
@@ -6893,7 +6877,6 @@ static int __init ipw2100_init(void)
6893 return ret; 6877 return ret;
6894} 6878}
6895 6879
6896
6897/** 6880/**
6898 * Cleanup ipw2100 driver registration 6881 * Cleanup ipw2100 driver registration
6899 */ 6882 */
@@ -6949,7 +6932,6 @@ static int ipw2100_wx_get_name(struct net_device *dev,
6949 return 0; 6932 return 0;
6950} 6933}
6951 6934
6952
6953static int ipw2100_wx_set_freq(struct net_device *dev, 6935static int ipw2100_wx_set_freq(struct net_device *dev,
6954 struct iw_request_info *info, 6936 struct iw_request_info *info,
6955 union iwreq_data *wrqu, char *extra) 6937 union iwreq_data *wrqu, char *extra)
@@ -6969,8 +6951,7 @@ static int ipw2100_wx_set_freq(struct net_device *dev,
6969 6951
6970 /* if setting by freq convert to channel */ 6952 /* if setting by freq convert to channel */
6971 if (fwrq->e == 1) { 6953 if (fwrq->e == 1) {
6972 if ((fwrq->m >= (int) 2.412e8 && 6954 if ((fwrq->m >= (int)2.412e8 && fwrq->m <= (int)2.487e8)) {
6973 fwrq->m <= (int) 2.487e8)) {
6974 int f = fwrq->m / 100000; 6955 int f = fwrq->m / 100000;
6975 int c = 0; 6956 int c = 0;
6976 6957
@@ -6986,17 +6967,16 @@ static int ipw2100_wx_set_freq(struct net_device *dev,
6986 6967
6987 if (fwrq->e > 0 || fwrq->m > 1000) 6968 if (fwrq->e > 0 || fwrq->m > 1000)
6988 return -EOPNOTSUPP; 6969 return -EOPNOTSUPP;
6989 else { /* Set the channel */ 6970 else { /* Set the channel */
6990 IPW_DEBUG_WX("SET Freq/Channel -> %d \n", fwrq->m); 6971 IPW_DEBUG_WX("SET Freq/Channel -> %d \n", fwrq->m);
6991 err = ipw2100_set_channel(priv, fwrq->m, 0); 6972 err = ipw2100_set_channel(priv, fwrq->m, 0);
6992 } 6973 }
6993 6974
6994 done: 6975 done:
6995 up(&priv->action_sem); 6976 up(&priv->action_sem);
6996 return err; 6977 return err;
6997} 6978}
6998 6979
6999
7000static int ipw2100_wx_get_freq(struct net_device *dev, 6980static int ipw2100_wx_get_freq(struct net_device *dev,
7001 struct iw_request_info *info, 6981 struct iw_request_info *info,
7002 union iwreq_data *wrqu, char *extra) 6982 union iwreq_data *wrqu, char *extra)
@@ -7045,7 +7025,7 @@ static int ipw2100_wx_set_mode(struct net_device *dev,
7045 case IW_MODE_MONITOR: 7025 case IW_MODE_MONITOR:
7046 err = ipw2100_switch_mode(priv, IW_MODE_MONITOR); 7026 err = ipw2100_switch_mode(priv, IW_MODE_MONITOR);
7047 break; 7027 break;
7048#endif /* CONFIG_IPW2100_MONITOR */ 7028#endif /* CONFIG_IPW2100_MONITOR */
7049 case IW_MODE_ADHOC: 7029 case IW_MODE_ADHOC:
7050 err = ipw2100_switch_mode(priv, IW_MODE_ADHOC); 7030 err = ipw2100_switch_mode(priv, IW_MODE_ADHOC);
7051 break; 7031 break;
@@ -7056,9 +7036,9 @@ static int ipw2100_wx_set_mode(struct net_device *dev,
7056 break; 7036 break;
7057 } 7037 }
7058 7038
7059done: 7039 done:
7060 up(&priv->action_sem); 7040 up(&priv->action_sem);
7061 return err; 7041 return err;
7062} 7042}
7063 7043
7064static int ipw2100_wx_get_mode(struct net_device *dev, 7044static int ipw2100_wx_get_mode(struct net_device *dev,
@@ -7077,7 +7057,6 @@ static int ipw2100_wx_get_mode(struct net_device *dev,
7077 return 0; 7057 return 0;
7078} 7058}
7079 7059
7080
7081#define POWER_MODES 5 7060#define POWER_MODES 5
7082 7061
7083/* Values are in microsecond */ 7062/* Values are in microsecond */
@@ -7124,19 +7103,19 @@ static int ipw2100_wx_get_range(struct net_device *dev,
7124 /* ~5 Mb/s real (802.11b) */ 7103 /* ~5 Mb/s real (802.11b) */
7125 range->throughput = 5 * 1000 * 1000; 7104 range->throughput = 5 * 1000 * 1000;
7126 7105
7127// range->sensitivity; /* signal level threshold range */ 7106// range->sensitivity; /* signal level threshold range */
7128 7107
7129 range->max_qual.qual = 100; 7108 range->max_qual.qual = 100;
7130 /* TODO: Find real max RSSI and stick here */ 7109 /* TODO: Find real max RSSI and stick here */
7131 range->max_qual.level = 0; 7110 range->max_qual.level = 0;
7132 range->max_qual.noise = 0; 7111 range->max_qual.noise = 0;
7133 range->max_qual.updated = 7; /* Updated all three */ 7112 range->max_qual.updated = 7; /* Updated all three */
7134 7113
7135 range->avg_qual.qual = 70; /* > 8% missed beacons is 'bad' */ 7114 range->avg_qual.qual = 70; /* > 8% missed beacons is 'bad' */
7136 /* TODO: Find real 'good' to 'bad' threshol value for RSSI */ 7115 /* TODO: Find real 'good' to 'bad' threshol value for RSSI */
7137 range->avg_qual.level = 20 + IPW2100_RSSI_TO_DBM; 7116 range->avg_qual.level = 20 + IPW2100_RSSI_TO_DBM;
7138 range->avg_qual.noise = 0; 7117 range->avg_qual.noise = 0;
7139 range->avg_qual.updated = 7; /* Updated all three */ 7118 range->avg_qual.updated = 7; /* Updated all three */
7140 7119
7141 range->num_bitrates = RATE_COUNT; 7120 range->num_bitrates = RATE_COUNT;
7142 7121
@@ -7150,61 +7129,62 @@ static int ipw2100_wx_get_range(struct net_device *dev,
7150 range->max_frag = MAX_FRAG_THRESHOLD; 7129 range->max_frag = MAX_FRAG_THRESHOLD;
7151 7130
7152 range->min_pmp = period_duration[0]; /* Minimal PM period */ 7131 range->min_pmp = period_duration[0]; /* Minimal PM period */
7153 range->max_pmp = period_duration[POWER_MODES-1];/* Maximal PM period */ 7132 range->max_pmp = period_duration[POWER_MODES - 1]; /* Maximal PM period */
7154 range->min_pmt = timeout_duration[POWER_MODES-1]; /* Minimal PM timeout */ 7133 range->min_pmt = timeout_duration[POWER_MODES - 1]; /* Minimal PM timeout */
7155 range->max_pmt = timeout_duration[0];/* Maximal PM timeout */ 7134 range->max_pmt = timeout_duration[0]; /* Maximal PM timeout */
7156 7135
7157 /* How to decode max/min PM period */ 7136 /* How to decode max/min PM period */
7158 range->pmp_flags = IW_POWER_PERIOD; 7137 range->pmp_flags = IW_POWER_PERIOD;
7159 /* How to decode max/min PM period */ 7138 /* How to decode max/min PM period */
7160 range->pmt_flags = IW_POWER_TIMEOUT; 7139 range->pmt_flags = IW_POWER_TIMEOUT;
7161 /* What PM options are supported */ 7140 /* What PM options are supported */
7162 range->pm_capa = IW_POWER_TIMEOUT | IW_POWER_PERIOD; 7141 range->pm_capa = IW_POWER_TIMEOUT | IW_POWER_PERIOD;
7163 7142
7164 range->encoding_size[0] = 5; 7143 range->encoding_size[0] = 5;
7165 range->encoding_size[1] = 13; /* Different token sizes */ 7144 range->encoding_size[1] = 13; /* Different token sizes */
7166 range->num_encoding_sizes = 2; /* Number of entry in the list */ 7145 range->num_encoding_sizes = 2; /* Number of entry in the list */
7167 range->max_encoding_tokens = WEP_KEYS; /* Max number of tokens */ 7146 range->max_encoding_tokens = WEP_KEYS; /* Max number of tokens */
7168// range->encoding_login_index; /* token index for login token */ 7147// range->encoding_login_index; /* token index for login token */
7169 7148
7170 if (priv->ieee->iw_mode == IW_MODE_ADHOC) { 7149 if (priv->ieee->iw_mode == IW_MODE_ADHOC) {
7171 range->txpower_capa = IW_TXPOW_DBM; 7150 range->txpower_capa = IW_TXPOW_DBM;
7172 range->num_txpower = IW_MAX_TXPOWER; 7151 range->num_txpower = IW_MAX_TXPOWER;
7173 for (i = 0, level = (IPW_TX_POWER_MAX_DBM * 16); i < IW_MAX_TXPOWER; 7152 for (i = 0, level = (IPW_TX_POWER_MAX_DBM * 16);
7174 i++, level -= ((IPW_TX_POWER_MAX_DBM - IPW_TX_POWER_MIN_DBM) * 16) / 7153 i < IW_MAX_TXPOWER;
7175 (IW_MAX_TXPOWER - 1)) 7154 i++, level -=
7155 ((IPW_TX_POWER_MAX_DBM -
7156 IPW_TX_POWER_MIN_DBM) * 16) / (IW_MAX_TXPOWER - 1))
7176 range->txpower[i] = level / 16; 7157 range->txpower[i] = level / 16;
7177 } else { 7158 } else {
7178 range->txpower_capa = 0; 7159 range->txpower_capa = 0;
7179 range->num_txpower = 0; 7160 range->num_txpower = 0;
7180 } 7161 }
7181 7162
7182
7183 /* Set the Wireless Extension versions */ 7163 /* Set the Wireless Extension versions */
7184 range->we_version_compiled = WIRELESS_EXT; 7164 range->we_version_compiled = WIRELESS_EXT;
7185 range->we_version_source = 16; 7165 range->we_version_source = 16;
7186 7166
7187// range->retry_capa; /* What retry options are supported */ 7167// range->retry_capa; /* What retry options are supported */
7188// range->retry_flags; /* How to decode max/min retry limit */ 7168// range->retry_flags; /* How to decode max/min retry limit */
7189// range->r_time_flags; /* How to decode max/min retry life */ 7169// range->r_time_flags; /* How to decode max/min retry life */
7190// range->min_retry; /* Minimal number of retries */ 7170// range->min_retry; /* Minimal number of retries */
7191// range->max_retry; /* Maximal number of retries */ 7171// range->max_retry; /* Maximal number of retries */
7192// range->min_r_time; /* Minimal retry lifetime */ 7172// range->min_r_time; /* Minimal retry lifetime */
7193// range->max_r_time; /* Maximal retry lifetime */ 7173// range->max_r_time; /* Maximal retry lifetime */
7194 7174
7195 range->num_channels = FREQ_COUNT; 7175 range->num_channels = FREQ_COUNT;
7196 7176
7197 val = 0; 7177 val = 0;
7198 for (i = 0; i < FREQ_COUNT; i++) { 7178 for (i = 0; i < FREQ_COUNT; i++) {
7199 // TODO: Include only legal frequencies for some countries 7179 // TODO: Include only legal frequencies for some countries
7200// if (local->channel_mask & (1 << i)) { 7180// if (local->channel_mask & (1 << i)) {
7201 range->freq[val].i = i + 1; 7181 range->freq[val].i = i + 1;
7202 range->freq[val].m = ipw2100_frequencies[i] * 100000; 7182 range->freq[val].m = ipw2100_frequencies[i] * 100000;
7203 range->freq[val].e = 1; 7183 range->freq[val].e = 1;
7204 val++; 7184 val++;
7205// } 7185// }
7206 if (val == IW_MAX_FREQUENCIES) 7186 if (val == IW_MAX_FREQUENCIES)
7207 break; 7187 break;
7208 } 7188 }
7209 range->num_frequency = val; 7189 range->num_frequency = val;
7210 7190
@@ -7259,7 +7239,7 @@ static int ipw2100_wx_set_wap(struct net_device *dev,
7259 wrqu->ap_addr.sa_data[4] & 0xff, 7239 wrqu->ap_addr.sa_data[4] & 0xff,
7260 wrqu->ap_addr.sa_data[5] & 0xff); 7240 wrqu->ap_addr.sa_data[5] & 0xff);
7261 7241
7262 done: 7242 done:
7263 up(&priv->action_sem); 7243 up(&priv->action_sem);
7264 return err; 7244 return err;
7265} 7245}
@@ -7276,8 +7256,7 @@ static int ipw2100_wx_get_wap(struct net_device *dev,
7276 7256
7277 /* If we are associated, trying to associate, or have a statically 7257 /* If we are associated, trying to associate, or have a statically
7278 * configured BSSID then return that; otherwise return ANY */ 7258 * configured BSSID then return that; otherwise return ANY */
7279 if (priv->config & CFG_STATIC_BSSID || 7259 if (priv->config & CFG_STATIC_BSSID || priv->status & STATUS_ASSOCIATED) {
7280 priv->status & STATUS_ASSOCIATED) {
7281 wrqu->ap_addr.sa_family = ARPHRD_ETHER; 7260 wrqu->ap_addr.sa_family = ARPHRD_ETHER;
7282 memcpy(wrqu->ap_addr.sa_data, &priv->bssid, ETH_ALEN); 7261 memcpy(wrqu->ap_addr.sa_data, &priv->bssid, ETH_ALEN);
7283 } else 7262 } else
@@ -7293,7 +7272,7 @@ static int ipw2100_wx_set_essid(struct net_device *dev,
7293 union iwreq_data *wrqu, char *extra) 7272 union iwreq_data *wrqu, char *extra)
7294{ 7273{
7295 struct ipw2100_priv *priv = ieee80211_priv(dev); 7274 struct ipw2100_priv *priv = ieee80211_priv(dev);
7296 char *essid = ""; /* ANY */ 7275 char *essid = ""; /* ANY */
7297 int length = 0; 7276 int length = 0;
7298 int err = 0; 7277 int err = 0;
7299 7278
@@ -7333,7 +7312,7 @@ static int ipw2100_wx_set_essid(struct net_device *dev,
7333 7312
7334 err = ipw2100_set_essid(priv, essid, length, 0); 7313 err = ipw2100_set_essid(priv, essid, length, 0);
7335 7314
7336 done: 7315 done:
7337 up(&priv->action_sem); 7316 up(&priv->action_sem);
7338 return err; 7317 return err;
7339} 7318}
@@ -7350,17 +7329,16 @@ static int ipw2100_wx_get_essid(struct net_device *dev,
7350 7329
7351 /* If we are associated, trying to associate, or have a statically 7330 /* If we are associated, trying to associate, or have a statically
7352 * configured ESSID then return that; otherwise return ANY */ 7331 * configured ESSID then return that; otherwise return ANY */
7353 if (priv->config & CFG_STATIC_ESSID || 7332 if (priv->config & CFG_STATIC_ESSID || priv->status & STATUS_ASSOCIATED) {
7354 priv->status & STATUS_ASSOCIATED) {
7355 IPW_DEBUG_WX("Getting essid: '%s'\n", 7333 IPW_DEBUG_WX("Getting essid: '%s'\n",
7356 escape_essid(priv->essid, priv->essid_len)); 7334 escape_essid(priv->essid, priv->essid_len));
7357 memcpy(extra, priv->essid, priv->essid_len); 7335 memcpy(extra, priv->essid, priv->essid_len);
7358 wrqu->essid.length = priv->essid_len; 7336 wrqu->essid.length = priv->essid_len;
7359 wrqu->essid.flags = 1; /* active */ 7337 wrqu->essid.flags = 1; /* active */
7360 } else { 7338 } else {
7361 IPW_DEBUG_WX("Getting essid: ANY\n"); 7339 IPW_DEBUG_WX("Getting essid: ANY\n");
7362 wrqu->essid.length = 0; 7340 wrqu->essid.length = 0;
7363 wrqu->essid.flags = 0; /* active */ 7341 wrqu->essid.flags = 0; /* active */
7364 } 7342 }
7365 7343
7366 return 0; 7344 return 0;
@@ -7379,9 +7357,9 @@ static int ipw2100_wx_set_nick(struct net_device *dev,
7379 if (wrqu->data.length > IW_ESSID_MAX_SIZE) 7357 if (wrqu->data.length > IW_ESSID_MAX_SIZE)
7380 return -E2BIG; 7358 return -E2BIG;
7381 7359
7382 wrqu->data.length = min((size_t)wrqu->data.length, sizeof(priv->nick)); 7360 wrqu->data.length = min((size_t) wrqu->data.length, sizeof(priv->nick));
7383 memset(priv->nick, 0, sizeof(priv->nick)); 7361 memset(priv->nick, 0, sizeof(priv->nick));
7384 memcpy(priv->nick, extra, wrqu->data.length); 7362 memcpy(priv->nick, extra, wrqu->data.length);
7385 7363
7386 IPW_DEBUG_WX("SET Nickname -> %s \n", priv->nick); 7364 IPW_DEBUG_WX("SET Nickname -> %s \n", priv->nick);
7387 7365
@@ -7400,7 +7378,7 @@ static int ipw2100_wx_get_nick(struct net_device *dev,
7400 7378
7401 wrqu->data.length = strlen(priv->nick) + 1; 7379 wrqu->data.length = strlen(priv->nick) + 1;
7402 memcpy(extra, priv->nick, wrqu->data.length); 7380 memcpy(extra, priv->nick, wrqu->data.length);
7403 wrqu->data.flags = 1; /* active */ 7381 wrqu->data.flags = 1; /* active */
7404 7382
7405 IPW_DEBUG_WX("GET Nickname -> %s \n", extra); 7383 IPW_DEBUG_WX("GET Nickname -> %s \n", extra);
7406 7384
@@ -7442,12 +7420,11 @@ static int ipw2100_wx_set_rate(struct net_device *dev,
7442 err = ipw2100_set_tx_rates(priv, rate, 0); 7420 err = ipw2100_set_tx_rates(priv, rate, 0);
7443 7421
7444 IPW_DEBUG_WX("SET Rate -> %04X \n", rate); 7422 IPW_DEBUG_WX("SET Rate -> %04X \n", rate);
7445 done: 7423 done:
7446 up(&priv->action_sem); 7424 up(&priv->action_sem);
7447 return err; 7425 return err;
7448} 7426}
7449 7427
7450
7451static int ipw2100_wx_get_rate(struct net_device *dev, 7428static int ipw2100_wx_get_rate(struct net_device *dev,
7452 struct iw_request_info *info, 7429 struct iw_request_info *info,
7453 union iwreq_data *wrqu, char *extra) 7430 union iwreq_data *wrqu, char *extra)
@@ -7495,7 +7472,7 @@ static int ipw2100_wx_get_rate(struct net_device *dev,
7495 7472
7496 IPW_DEBUG_WX("GET Rate -> %d \n", wrqu->bitrate.value); 7473 IPW_DEBUG_WX("GET Rate -> %d \n", wrqu->bitrate.value);
7497 7474
7498 done: 7475 done:
7499 up(&priv->action_sem); 7476 up(&priv->action_sem);
7500 return err; 7477 return err;
7501} 7478}
@@ -7520,8 +7497,7 @@ static int ipw2100_wx_set_rts(struct net_device *dev,
7520 if (wrqu->rts.disabled) 7497 if (wrqu->rts.disabled)
7521 value = priv->rts_threshold | RTS_DISABLED; 7498 value = priv->rts_threshold | RTS_DISABLED;
7522 else { 7499 else {
7523 if (wrqu->rts.value < 1 || 7500 if (wrqu->rts.value < 1 || wrqu->rts.value > 2304) {
7524 wrqu->rts.value > 2304) {
7525 err = -EINVAL; 7501 err = -EINVAL;
7526 goto done; 7502 goto done;
7527 } 7503 }
@@ -7531,7 +7507,7 @@ static int ipw2100_wx_set_rts(struct net_device *dev,
7531 err = ipw2100_set_rts_threshold(priv, value); 7507 err = ipw2100_set_rts_threshold(priv, value);
7532 7508
7533 IPW_DEBUG_WX("SET RTS Threshold -> 0x%08X \n", value); 7509 IPW_DEBUG_WX("SET RTS Threshold -> 0x%08X \n", value);
7534 done: 7510 done:
7535 up(&priv->action_sem); 7511 up(&priv->action_sem);
7536 return err; 7512 return err;
7537} 7513}
@@ -7547,7 +7523,7 @@ static int ipw2100_wx_get_rts(struct net_device *dev,
7547 struct ipw2100_priv *priv = ieee80211_priv(dev); 7523 struct ipw2100_priv *priv = ieee80211_priv(dev);
7548 7524
7549 wrqu->rts.value = priv->rts_threshold & ~RTS_DISABLED; 7525 wrqu->rts.value = priv->rts_threshold & ~RTS_DISABLED;
7550 wrqu->rts.fixed = 1; /* no auto select */ 7526 wrqu->rts.fixed = 1; /* no auto select */
7551 7527
7552 /* If RTS is set to the default value, then it is disabled */ 7528 /* If RTS is set to the default value, then it is disabled */
7553 wrqu->rts.disabled = (priv->rts_threshold & RTS_DISABLED) ? 1 : 0; 7529 wrqu->rts.disabled = (priv->rts_threshold & RTS_DISABLED) ? 1 : 0;
@@ -7575,7 +7551,7 @@ static int ipw2100_wx_set_txpow(struct net_device *dev,
7575 return -EINVAL; 7551 return -EINVAL;
7576 7552
7577 value = (wrqu->txpower.value - IPW_TX_POWER_MIN_DBM) * 16 / 7553 value = (wrqu->txpower.value - IPW_TX_POWER_MIN_DBM) * 16 /
7578 (IPW_TX_POWER_MAX_DBM - IPW_TX_POWER_MIN_DBM); 7554 (IPW_TX_POWER_MAX_DBM - IPW_TX_POWER_MIN_DBM);
7579 } 7555 }
7580 7556
7581 down(&priv->action_sem); 7557 down(&priv->action_sem);
@@ -7588,7 +7564,7 @@ static int ipw2100_wx_set_txpow(struct net_device *dev,
7588 7564
7589 IPW_DEBUG_WX("SET TX Power -> %d \n", value); 7565 IPW_DEBUG_WX("SET TX Power -> %d \n", value);
7590 7566
7591 done: 7567 done:
7592 up(&priv->action_sem); 7568 up(&priv->action_sem);
7593 return err; 7569 return err;
7594} 7570}
@@ -7616,10 +7592,10 @@ static int ipw2100_wx_get_txpow(struct net_device *dev,
7616 wrqu->power.disabled = 0; 7592 wrqu->power.disabled = 0;
7617 wrqu->power.fixed = 1; 7593 wrqu->power.fixed = 1;
7618 wrqu->power.value = 7594 wrqu->power.value =
7619 (priv->tx_power * 7595 (priv->tx_power *
7620 (IPW_TX_POWER_MAX_DBM - IPW_TX_POWER_MIN_DBM)) / 7596 (IPW_TX_POWER_MAX_DBM - IPW_TX_POWER_MIN_DBM)) /
7621 (IPW_TX_POWER_MAX - IPW_TX_POWER_MIN) + 7597 (IPW_TX_POWER_MAX - IPW_TX_POWER_MIN) +
7622 IPW_TX_POWER_MIN_DBM; 7598 IPW_TX_POWER_MIN_DBM;
7623 } 7599 }
7624 7600
7625 wrqu->power.flags = IW_TXPOW_DBM; 7601 wrqu->power.flags = IW_TXPOW_DBM;
@@ -7684,8 +7660,7 @@ static int ipw2100_wx_set_retry(struct net_device *dev,
7684 struct ipw2100_priv *priv = ieee80211_priv(dev); 7660 struct ipw2100_priv *priv = ieee80211_priv(dev);
7685 int err = 0; 7661 int err = 0;
7686 7662
7687 if (wrqu->retry.flags & IW_RETRY_LIFETIME || 7663 if (wrqu->retry.flags & IW_RETRY_LIFETIME || wrqu->retry.disabled)
7688 wrqu->retry.disabled)
7689 return -EINVAL; 7664 return -EINVAL;
7690 7665
7691 if (!(wrqu->retry.flags & IW_RETRY_LIMIT)) 7666 if (!(wrqu->retry.flags & IW_RETRY_LIMIT))
@@ -7700,14 +7675,14 @@ static int ipw2100_wx_set_retry(struct net_device *dev,
7700 if (wrqu->retry.flags & IW_RETRY_MIN) { 7675 if (wrqu->retry.flags & IW_RETRY_MIN) {
7701 err = ipw2100_set_short_retry(priv, wrqu->retry.value); 7676 err = ipw2100_set_short_retry(priv, wrqu->retry.value);
7702 IPW_DEBUG_WX("SET Short Retry Limit -> %d \n", 7677 IPW_DEBUG_WX("SET Short Retry Limit -> %d \n",
7703 wrqu->retry.value); 7678 wrqu->retry.value);
7704 goto done; 7679 goto done;
7705 } 7680 }
7706 7681
7707 if (wrqu->retry.flags & IW_RETRY_MAX) { 7682 if (wrqu->retry.flags & IW_RETRY_MAX) {
7708 err = ipw2100_set_long_retry(priv, wrqu->retry.value); 7683 err = ipw2100_set_long_retry(priv, wrqu->retry.value);
7709 IPW_DEBUG_WX("SET Long Retry Limit -> %d \n", 7684 IPW_DEBUG_WX("SET Long Retry Limit -> %d \n",
7710 wrqu->retry.value); 7685 wrqu->retry.value);
7711 goto done; 7686 goto done;
7712 } 7687 }
7713 7688
@@ -7717,7 +7692,7 @@ static int ipw2100_wx_set_retry(struct net_device *dev,
7717 7692
7718 IPW_DEBUG_WX("SET Both Retry Limits -> %d \n", wrqu->retry.value); 7693 IPW_DEBUG_WX("SET Both Retry Limits -> %d \n", wrqu->retry.value);
7719 7694
7720 done: 7695 done:
7721 up(&priv->action_sem); 7696 up(&priv->action_sem);
7722 return err; 7697 return err;
7723} 7698}
@@ -7732,10 +7707,9 @@ static int ipw2100_wx_get_retry(struct net_device *dev,
7732 7707
7733 struct ipw2100_priv *priv = ieee80211_priv(dev); 7708 struct ipw2100_priv *priv = ieee80211_priv(dev);
7734 7709
7735 wrqu->retry.disabled = 0; /* can't be disabled */ 7710 wrqu->retry.disabled = 0; /* can't be disabled */
7736 7711
7737 if ((wrqu->retry.flags & IW_RETRY_TYPE) == 7712 if ((wrqu->retry.flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME)
7738 IW_RETRY_LIFETIME)
7739 return -EINVAL; 7713 return -EINVAL;
7740 7714
7741 if (wrqu->retry.flags & IW_RETRY_MAX) { 7715 if (wrqu->retry.flags & IW_RETRY_MAX) {
@@ -7769,15 +7743,14 @@ static int ipw2100_wx_set_scan(struct net_device *dev,
7769 } 7743 }
7770 7744
7771 IPW_DEBUG_WX("Initiating scan...\n"); 7745 IPW_DEBUG_WX("Initiating scan...\n");
7772 if (ipw2100_set_scan_options(priv) || 7746 if (ipw2100_set_scan_options(priv) || ipw2100_start_scan(priv)) {
7773 ipw2100_start_scan(priv)) {
7774 IPW_DEBUG_WX("Start scan failed.\n"); 7747 IPW_DEBUG_WX("Start scan failed.\n");
7775 7748
7776 /* TODO: Mark a scan as pending so when hardware initialized 7749 /* TODO: Mark a scan as pending so when hardware initialized
7777 * a scan starts */ 7750 * a scan starts */
7778 } 7751 }
7779 7752
7780 done: 7753 done:
7781 up(&priv->action_sem); 7754 up(&priv->action_sem);
7782 return err; 7755 return err;
7783} 7756}
@@ -7794,7 +7767,6 @@ static int ipw2100_wx_get_scan(struct net_device *dev,
7794 return ieee80211_wx_get_scan(priv->ieee, info, wrqu, extra); 7767 return ieee80211_wx_get_scan(priv->ieee, info, wrqu, extra);
7795} 7768}
7796 7769
7797
7798/* 7770/*
7799 * Implementation based on code in hostap-driver v0.1.3 hostap_ioctl.c 7771 * Implementation based on code in hostap-driver v0.1.3 hostap_ioctl.c
7800 */ 7772 */
@@ -7823,8 +7795,8 @@ static int ipw2100_wx_get_encode(struct net_device *dev,
7823} 7795}
7824 7796
7825static int ipw2100_wx_set_power(struct net_device *dev, 7797static int ipw2100_wx_set_power(struct net_device *dev,
7826 struct iw_request_info *info, 7798 struct iw_request_info *info,
7827 union iwreq_data *wrqu, char *extra) 7799 union iwreq_data *wrqu, char *extra)
7828{ 7800{
7829 struct ipw2100_priv *priv = ieee80211_priv(dev); 7801 struct ipw2100_priv *priv = ieee80211_priv(dev);
7830 int err = 0; 7802 int err = 0;
@@ -7843,11 +7815,11 @@ static int ipw2100_wx_set_power(struct net_device *dev,
7843 } 7815 }
7844 7816
7845 switch (wrqu->power.flags & IW_POWER_MODE) { 7817 switch (wrqu->power.flags & IW_POWER_MODE) {
7846 case IW_POWER_ON: /* If not specified */ 7818 case IW_POWER_ON: /* If not specified */
7847 case IW_POWER_MODE: /* If set all mask */ 7819 case IW_POWER_MODE: /* If set all mask */
7848 case IW_POWER_ALL_R: /* If explicitely state all */ 7820 case IW_POWER_ALL_R: /* If explicitely state all */
7849 break; 7821 break;
7850 default: /* Otherwise we don't support it */ 7822 default: /* Otherwise we don't support it */
7851 IPW_DEBUG_WX("SET PM Mode: %X not supported.\n", 7823 IPW_DEBUG_WX("SET PM Mode: %X not supported.\n",
7852 wrqu->power.flags); 7824 wrqu->power.flags);
7853 err = -EOPNOTSUPP; 7825 err = -EOPNOTSUPP;
@@ -7859,18 +7831,17 @@ static int ipw2100_wx_set_power(struct net_device *dev,
7859 priv->power_mode = IPW_POWER_ENABLED | priv->power_mode; 7831 priv->power_mode = IPW_POWER_ENABLED | priv->power_mode;
7860 err = ipw2100_set_power_mode(priv, IPW_POWER_LEVEL(priv->power_mode)); 7832 err = ipw2100_set_power_mode(priv, IPW_POWER_LEVEL(priv->power_mode));
7861 7833
7862 IPW_DEBUG_WX("SET Power Management Mode -> 0x%02X\n", 7834 IPW_DEBUG_WX("SET Power Management Mode -> 0x%02X\n", priv->power_mode);
7863 priv->power_mode);
7864 7835
7865 done: 7836 done:
7866 up(&priv->action_sem); 7837 up(&priv->action_sem);
7867 return err; 7838 return err;
7868 7839
7869} 7840}
7870 7841
7871static int ipw2100_wx_get_power(struct net_device *dev, 7842static int ipw2100_wx_get_power(struct net_device *dev,
7872 struct iw_request_info *info, 7843 struct iw_request_info *info,
7873 union iwreq_data *wrqu, char *extra) 7844 union iwreq_data *wrqu, char *extra)
7874{ 7845{
7875 /* 7846 /*
7876 * This can be called at any time. No action lock required 7847 * This can be called at any time. No action lock required
@@ -7890,7 +7861,6 @@ static int ipw2100_wx_get_power(struct net_device *dev,
7890 return 0; 7861 return 0;
7891} 7862}
7892 7863
7893
7894/* 7864/*
7895 * 7865 *
7896 * IWPRIV handlers 7866 * IWPRIV handlers
@@ -7923,7 +7893,7 @@ static int ipw2100_wx_set_promisc(struct net_device *dev,
7923 if (priv->ieee->iw_mode == IW_MODE_MONITOR) 7893 if (priv->ieee->iw_mode == IW_MODE_MONITOR)
7924 err = ipw2100_switch_mode(priv, priv->last_mode); 7894 err = ipw2100_switch_mode(priv, priv->last_mode);
7925 } 7895 }
7926 done: 7896 done:
7927 up(&priv->action_sem); 7897 up(&priv->action_sem);
7928 return err; 7898 return err;
7929} 7899}
@@ -7958,7 +7928,7 @@ static int ipw2100_wx_set_powermode(struct net_device *dev,
7958 7928
7959 if (priv->power_mode != mode) 7929 if (priv->power_mode != mode)
7960 err = ipw2100_set_power_mode(priv, mode); 7930 err = ipw2100_set_power_mode(priv, mode);
7961 done: 7931 done:
7962 up(&priv->action_sem); 7932 up(&priv->action_sem);
7963 return err; 7933 return err;
7964} 7934}
@@ -7986,8 +7956,8 @@ static int ipw2100_wx_get_powermode(struct net_device *dev,
7986 "Power save level: %d (None)", level); 7956 "Power save level: %d (None)", level);
7987 break; 7957 break;
7988 case IPW_POWER_AUTO: 7958 case IPW_POWER_AUTO:
7989 snprintf(extra, MAX_POWER_STRING, 7959 snprintf(extra, MAX_POWER_STRING,
7990 "Power save level: %d (Auto)", 0); 7960 "Power save level: %d (Auto)", 0);
7991 break; 7961 break;
7992 default: 7962 default:
7993 timeout = timeout_duration[level - 1] / 1000; 7963 timeout = timeout_duration[level - 1] / 1000;
@@ -8004,7 +7974,6 @@ static int ipw2100_wx_get_powermode(struct net_device *dev,
8004 return 0; 7974 return 0;
8005} 7975}
8006 7976
8007
8008static int ipw2100_wx_set_preamble(struct net_device *dev, 7977static int ipw2100_wx_set_preamble(struct net_device *dev,
8009 struct iw_request_info *info, 7978 struct iw_request_info *info,
8010 union iwreq_data *wrqu, char *extra) 7979 union iwreq_data *wrqu, char *extra)
@@ -8029,14 +7998,14 @@ static int ipw2100_wx_set_preamble(struct net_device *dev,
8029 7998
8030 err = ipw2100_system_config(priv, 0); 7999 err = ipw2100_system_config(priv, 0);
8031 8000
8032done: 8001 done:
8033 up(&priv->action_sem); 8002 up(&priv->action_sem);
8034 return err; 8003 return err;
8035} 8004}
8036 8005
8037static int ipw2100_wx_get_preamble(struct net_device *dev, 8006static int ipw2100_wx_get_preamble(struct net_device *dev,
8038 struct iw_request_info *info, 8007 struct iw_request_info *info,
8039 union iwreq_data *wrqu, char *extra) 8008 union iwreq_data *wrqu, char *extra)
8040{ 8009{
8041 /* 8010 /*
8042 * This can be called at any time. No action lock required 8011 * This can be called at any time. No action lock required
@@ -8052,54 +8021,53 @@ static int ipw2100_wx_get_preamble(struct net_device *dev,
8052 return 0; 8021 return 0;
8053} 8022}
8054 8023
8055static iw_handler ipw2100_wx_handlers[] = 8024static iw_handler ipw2100_wx_handlers[] = {
8056{ 8025 NULL, /* SIOCSIWCOMMIT */
8057 NULL, /* SIOCSIWCOMMIT */ 8026 ipw2100_wx_get_name, /* SIOCGIWNAME */
8058 ipw2100_wx_get_name, /* SIOCGIWNAME */ 8027 NULL, /* SIOCSIWNWID */
8059 NULL, /* SIOCSIWNWID */ 8028 NULL, /* SIOCGIWNWID */
8060 NULL, /* SIOCGIWNWID */ 8029 ipw2100_wx_set_freq, /* SIOCSIWFREQ */
8061 ipw2100_wx_set_freq, /* SIOCSIWFREQ */ 8030 ipw2100_wx_get_freq, /* SIOCGIWFREQ */
8062 ipw2100_wx_get_freq, /* SIOCGIWFREQ */ 8031 ipw2100_wx_set_mode, /* SIOCSIWMODE */
8063 ipw2100_wx_set_mode, /* SIOCSIWMODE */ 8032 ipw2100_wx_get_mode, /* SIOCGIWMODE */
8064 ipw2100_wx_get_mode, /* SIOCGIWMODE */ 8033 NULL, /* SIOCSIWSENS */
8065 NULL, /* SIOCSIWSENS */ 8034 NULL, /* SIOCGIWSENS */
8066 NULL, /* SIOCGIWSENS */ 8035 NULL, /* SIOCSIWRANGE */
8067 NULL, /* SIOCSIWRANGE */ 8036 ipw2100_wx_get_range, /* SIOCGIWRANGE */
8068 ipw2100_wx_get_range, /* SIOCGIWRANGE */ 8037 NULL, /* SIOCSIWPRIV */
8069 NULL, /* SIOCSIWPRIV */ 8038 NULL, /* SIOCGIWPRIV */
8070 NULL, /* SIOCGIWPRIV */ 8039 NULL, /* SIOCSIWSTATS */
8071 NULL, /* SIOCSIWSTATS */ 8040 NULL, /* SIOCGIWSTATS */
8072 NULL, /* SIOCGIWSTATS */ 8041 NULL, /* SIOCSIWSPY */
8073 NULL, /* SIOCSIWSPY */ 8042 NULL, /* SIOCGIWSPY */
8074 NULL, /* SIOCGIWSPY */ 8043 NULL, /* SIOCGIWTHRSPY */
8075 NULL, /* SIOCGIWTHRSPY */ 8044 NULL, /* SIOCWIWTHRSPY */
8076 NULL, /* SIOCWIWTHRSPY */ 8045 ipw2100_wx_set_wap, /* SIOCSIWAP */
8077 ipw2100_wx_set_wap, /* SIOCSIWAP */ 8046 ipw2100_wx_get_wap, /* SIOCGIWAP */
8078 ipw2100_wx_get_wap, /* SIOCGIWAP */ 8047 NULL, /* -- hole -- */
8079 NULL, /* -- hole -- */ 8048 NULL, /* SIOCGIWAPLIST -- deprecated */
8080 NULL, /* SIOCGIWAPLIST -- deprecated */ 8049 ipw2100_wx_set_scan, /* SIOCSIWSCAN */
8081 ipw2100_wx_set_scan, /* SIOCSIWSCAN */ 8050 ipw2100_wx_get_scan, /* SIOCGIWSCAN */
8082 ipw2100_wx_get_scan, /* SIOCGIWSCAN */ 8051 ipw2100_wx_set_essid, /* SIOCSIWESSID */
8083 ipw2100_wx_set_essid, /* SIOCSIWESSID */ 8052 ipw2100_wx_get_essid, /* SIOCGIWESSID */
8084 ipw2100_wx_get_essid, /* SIOCGIWESSID */ 8053 ipw2100_wx_set_nick, /* SIOCSIWNICKN */
8085 ipw2100_wx_set_nick, /* SIOCSIWNICKN */ 8054 ipw2100_wx_get_nick, /* SIOCGIWNICKN */
8086 ipw2100_wx_get_nick, /* SIOCGIWNICKN */ 8055 NULL, /* -- hole -- */
8087 NULL, /* -- hole -- */ 8056 NULL, /* -- hole -- */
8088 NULL, /* -- hole -- */ 8057 ipw2100_wx_set_rate, /* SIOCSIWRATE */
8089 ipw2100_wx_set_rate, /* SIOCSIWRATE */ 8058 ipw2100_wx_get_rate, /* SIOCGIWRATE */
8090 ipw2100_wx_get_rate, /* SIOCGIWRATE */ 8059 ipw2100_wx_set_rts, /* SIOCSIWRTS */
8091 ipw2100_wx_set_rts, /* SIOCSIWRTS */ 8060 ipw2100_wx_get_rts, /* SIOCGIWRTS */
8092 ipw2100_wx_get_rts, /* SIOCGIWRTS */ 8061 ipw2100_wx_set_frag, /* SIOCSIWFRAG */
8093 ipw2100_wx_set_frag, /* SIOCSIWFRAG */ 8062 ipw2100_wx_get_frag, /* SIOCGIWFRAG */
8094 ipw2100_wx_get_frag, /* SIOCGIWFRAG */ 8063 ipw2100_wx_set_txpow, /* SIOCSIWTXPOW */
8095 ipw2100_wx_set_txpow, /* SIOCSIWTXPOW */ 8064 ipw2100_wx_get_txpow, /* SIOCGIWTXPOW */
8096 ipw2100_wx_get_txpow, /* SIOCGIWTXPOW */ 8065 ipw2100_wx_set_retry, /* SIOCSIWRETRY */
8097 ipw2100_wx_set_retry, /* SIOCSIWRETRY */ 8066 ipw2100_wx_get_retry, /* SIOCGIWRETRY */
8098 ipw2100_wx_get_retry, /* SIOCGIWRETRY */ 8067 ipw2100_wx_set_encode, /* SIOCSIWENCODE */
8099 ipw2100_wx_set_encode, /* SIOCSIWENCODE */ 8068 ipw2100_wx_get_encode, /* SIOCGIWENCODE */
8100 ipw2100_wx_get_encode, /* SIOCGIWENCODE */ 8069 ipw2100_wx_set_power, /* SIOCSIWPOWER */
8101 ipw2100_wx_set_power, /* SIOCSIWPOWER */ 8070 ipw2100_wx_get_power, /* SIOCGIWPOWER */
8102 ipw2100_wx_get_power, /* SIOCGIWPOWER */
8103}; 8071};
8104 8072
8105#define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV 8073#define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV
@@ -8113,55 +8081,49 @@ static const struct iw_priv_args ipw2100_private_args[] = {
8113 8081
8114#ifdef CONFIG_IPW2100_MONITOR 8082#ifdef CONFIG_IPW2100_MONITOR
8115 { 8083 {
8116 IPW2100_PRIV_SET_MONITOR, 8084 IPW2100_PRIV_SET_MONITOR,
8117 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, 0, "monitor" 8085 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, 0, "monitor"},
8118 },
8119 { 8086 {
8120 IPW2100_PRIV_RESET, 8087 IPW2100_PRIV_RESET,
8121 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 0, 0, "reset" 8088 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 0, 0, "reset"},
8122 }, 8089#endif /* CONFIG_IPW2100_MONITOR */
8123#endif /* CONFIG_IPW2100_MONITOR */
8124 8090
8125 { 8091 {
8126 IPW2100_PRIV_SET_POWER, 8092 IPW2100_PRIV_SET_POWER,
8127 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_power" 8093 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_power"},
8128 },
8129 { 8094 {
8130 IPW2100_PRIV_GET_POWER, 8095 IPW2100_PRIV_GET_POWER,
8131 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | MAX_POWER_STRING, "get_power" 8096 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | MAX_POWER_STRING,
8132 }, 8097 "get_power"},
8133 { 8098 {
8134 IPW2100_PRIV_SET_LONGPREAMBLE, 8099 IPW2100_PRIV_SET_LONGPREAMBLE,
8135 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_preamble" 8100 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_preamble"},
8136 },
8137 { 8101 {
8138 IPW2100_PRIV_GET_LONGPREAMBLE, 8102 IPW2100_PRIV_GET_LONGPREAMBLE,
8139 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | IFNAMSIZ, "get_preamble" 8103 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | IFNAMSIZ, "get_preamble"},
8140 },
8141}; 8104};
8142 8105
8143static iw_handler ipw2100_private_handler[] = { 8106static iw_handler ipw2100_private_handler[] = {
8144#ifdef CONFIG_IPW2100_MONITOR 8107#ifdef CONFIG_IPW2100_MONITOR
8145 ipw2100_wx_set_promisc, 8108 ipw2100_wx_set_promisc,
8146 ipw2100_wx_reset, 8109 ipw2100_wx_reset,
8147#else /* CONFIG_IPW2100_MONITOR */ 8110#else /* CONFIG_IPW2100_MONITOR */
8148 NULL, 8111 NULL,
8149 NULL, 8112 NULL,
8150#endif /* CONFIG_IPW2100_MONITOR */ 8113#endif /* CONFIG_IPW2100_MONITOR */
8151 ipw2100_wx_set_powermode, 8114 ipw2100_wx_set_powermode,
8152 ipw2100_wx_get_powermode, 8115 ipw2100_wx_get_powermode,
8153 ipw2100_wx_set_preamble, 8116 ipw2100_wx_set_preamble,
8154 ipw2100_wx_get_preamble, 8117 ipw2100_wx_get_preamble,
8155}; 8118};
8156 8119
8157static struct iw_handler_def ipw2100_wx_handler_def = 8120static struct iw_handler_def ipw2100_wx_handler_def = {
8158{
8159 .standard = ipw2100_wx_handlers, 8121 .standard = ipw2100_wx_handlers,
8160 .num_standard = sizeof(ipw2100_wx_handlers) / sizeof(iw_handler), 8122 .num_standard = sizeof(ipw2100_wx_handlers) / sizeof(iw_handler),
8161 .num_private = sizeof(ipw2100_private_handler) / sizeof(iw_handler), 8123 .num_private = sizeof(ipw2100_private_handler) / sizeof(iw_handler),
8162 .num_private_args = sizeof(ipw2100_private_args) / 8124 .num_private_args = sizeof(ipw2100_private_args) /
8163 sizeof(struct iw_priv_args), 8125 sizeof(struct iw_priv_args),
8164 .private = (iw_handler *)ipw2100_private_handler, 8126 .private = (iw_handler *) ipw2100_private_handler,
8165 .private_args = (struct iw_priv_args *)ipw2100_private_args, 8127 .private_args = (struct iw_priv_args *)ipw2100_private_args,
8166}; 8128};
8167 8129
@@ -8170,7 +8132,7 @@ static struct iw_handler_def ipw2100_wx_handler_def =
8170 * Called by /proc/net/wireless 8132 * Called by /proc/net/wireless
8171 * Also called by SIOCGIWSTATS 8133 * Also called by SIOCGIWSTATS
8172 */ 8134 */
8173static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device * dev) 8135static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device *dev)
8174{ 8136{
8175 enum { 8137 enum {
8176 POOR = 30, 8138 POOR = 30,
@@ -8190,7 +8152,7 @@ static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device * dev)
8190 u32 ord_len = sizeof(u32); 8152 u32 ord_len = sizeof(u32);
8191 8153
8192 if (!priv) 8154 if (!priv)
8193 return (struct iw_statistics *) NULL; 8155 return (struct iw_statistics *)NULL;
8194 8156
8195 wstats = &priv->wstats; 8157 wstats = &priv->wstats;
8196 8158
@@ -8207,7 +8169,7 @@ static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device * dev)
8207 wstats->qual.noise = 0; 8169 wstats->qual.noise = 0;
8208 wstats->qual.updated = 7; 8170 wstats->qual.updated = 7;
8209 wstats->qual.updated |= IW_QUAL_NOISE_INVALID | 8171 wstats->qual.updated |= IW_QUAL_NOISE_INVALID |
8210 IW_QUAL_QUAL_INVALID | IW_QUAL_LEVEL_INVALID; 8172 IW_QUAL_QUAL_INVALID | IW_QUAL_LEVEL_INVALID;
8211 return wstats; 8173 return wstats;
8212 } 8174 }
8213 8175
@@ -8215,7 +8177,7 @@ static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device * dev)
8215 &missed_beacons, &ord_len)) 8177 &missed_beacons, &ord_len))
8216 goto fail_get_ordinal; 8178 goto fail_get_ordinal;
8217 8179
8218 /* If we don't have a connection the quality and level is 0*/ 8180 /* If we don't have a connection the quality and level is 0 */
8219 if (!(priv->status & STATUS_ASSOCIATED)) { 8181 if (!(priv->status & STATUS_ASSOCIATED)) {
8220 wstats->qual.qual = 0; 8182 wstats->qual.qual = 0;
8221 wstats->qual.level = 0; 8183 wstats->qual.level = 0;
@@ -8232,10 +8194,10 @@ static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device * dev)
8232 rssi_qual = (rssi - 15) * (GOOD - FAIR) / 5 + FAIR; 8194 rssi_qual = (rssi - 15) * (GOOD - FAIR) / 5 + FAIR;
8233 else if (rssi < 30) 8195 else if (rssi < 30)
8234 rssi_qual = (rssi - 20) * (VERY_GOOD - GOOD) / 8196 rssi_qual = (rssi - 20) * (VERY_GOOD - GOOD) /
8235 10 + GOOD; 8197 10 + GOOD;
8236 else 8198 else
8237 rssi_qual = (rssi - 30) * (PERFECT - VERY_GOOD) / 8199 rssi_qual = (rssi - 30) * (PERFECT - VERY_GOOD) /
8238 10 + VERY_GOOD; 8200 10 + VERY_GOOD;
8239 8201
8240 if (ipw2100_get_ordinal(priv, IPW_ORD_STAT_PERCENT_RETRIES, 8202 if (ipw2100_get_ordinal(priv, IPW_ORD_STAT_PERCENT_RETRIES,
8241 &tx_retries, &ord_len)) 8203 &tx_retries, &ord_len))
@@ -8249,25 +8211,25 @@ static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device * dev)
8249 tx_qual = (70 - tx_retries) * (GOOD - FAIR) / 5 + FAIR; 8211 tx_qual = (70 - tx_retries) * (GOOD - FAIR) / 5 + FAIR;
8250 else if (tx_retries > 50) 8212 else if (tx_retries > 50)
8251 tx_qual = (65 - tx_retries) * (VERY_GOOD - GOOD) / 8213 tx_qual = (65 - tx_retries) * (VERY_GOOD - GOOD) /
8252 15 + GOOD; 8214 15 + GOOD;
8253 else 8215 else
8254 tx_qual = (50 - tx_retries) * 8216 tx_qual = (50 - tx_retries) *
8255 (PERFECT - VERY_GOOD) / 50 + VERY_GOOD; 8217 (PERFECT - VERY_GOOD) / 50 + VERY_GOOD;
8256 8218
8257 if (missed_beacons > 50) 8219 if (missed_beacons > 50)
8258 beacon_qual = (60 - missed_beacons) * POOR / 10; 8220 beacon_qual = (60 - missed_beacons) * POOR / 10;
8259 else if (missed_beacons > 40) 8221 else if (missed_beacons > 40)
8260 beacon_qual = (50 - missed_beacons) * (FAIR - POOR) / 8222 beacon_qual = (50 - missed_beacons) * (FAIR - POOR) /
8261 10 + POOR; 8223 10 + POOR;
8262 else if (missed_beacons > 32) 8224 else if (missed_beacons > 32)
8263 beacon_qual = (40 - missed_beacons) * (GOOD - FAIR) / 8225 beacon_qual = (40 - missed_beacons) * (GOOD - FAIR) /
8264 18 + FAIR; 8226 18 + FAIR;
8265 else if (missed_beacons > 20) 8227 else if (missed_beacons > 20)
8266 beacon_qual = (32 - missed_beacons) * 8228 beacon_qual = (32 - missed_beacons) *
8267 (VERY_GOOD - GOOD) / 20 + GOOD; 8229 (VERY_GOOD - GOOD) / 20 + GOOD;
8268 else 8230 else
8269 beacon_qual = (20 - missed_beacons) * 8231 beacon_qual = (20 - missed_beacons) *
8270 (PERFECT - VERY_GOOD) / 20 + VERY_GOOD; 8232 (PERFECT - VERY_GOOD) / 20 + VERY_GOOD;
8271 8233
8272 quality = min(beacon_qual, min(tx_qual, rssi_qual)); 8234 quality = min(beacon_qual, min(tx_qual, rssi_qual));
8273 8235
@@ -8290,7 +8252,7 @@ static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device * dev)
8290 wstats->qual.updated = 7; 8252 wstats->qual.updated = 7;
8291 wstats->qual.updated |= IW_QUAL_NOISE_INVALID; 8253 wstats->qual.updated |= IW_QUAL_NOISE_INVALID;
8292 8254
8293 /* FIXME: this is percent and not a # */ 8255 /* FIXME: this is percent and not a # */
8294 wstats->miss.beacon = missed_beacons; 8256 wstats->miss.beacon = missed_beacons;
8295 8257
8296 if (ipw2100_get_ordinal(priv, IPW_ORD_STAT_TX_FAILURES, 8258 if (ipw2100_get_ordinal(priv, IPW_ORD_STAT_TX_FAILURES,
@@ -8300,10 +8262,10 @@ static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device * dev)
8300 8262
8301 return wstats; 8263 return wstats;
8302 8264
8303 fail_get_ordinal: 8265 fail_get_ordinal:
8304 IPW_DEBUG_WX("failed querying ordinals.\n"); 8266 IPW_DEBUG_WX("failed querying ordinals.\n");
8305 8267
8306 return (struct iw_statistics *) NULL; 8268 return (struct iw_statistics *)NULL;
8307} 8269}
8308 8270
8309static void ipw2100_wx_event_work(struct ipw2100_priv *priv) 8271static void ipw2100_wx_event_work(struct ipw2100_priv *priv)
@@ -8326,7 +8288,7 @@ static void ipw2100_wx_event_work(struct ipw2100_priv *priv)
8326 if (!(priv->status & (STATUS_ASSOCIATING | STATUS_ASSOCIATED)) || 8288 if (!(priv->status & (STATUS_ASSOCIATING | STATUS_ASSOCIATED)) ||
8327 priv->status & STATUS_RF_KILL_MASK || 8289 priv->status & STATUS_RF_KILL_MASK ||
8328 ipw2100_get_ordinal(priv, IPW_ORD_STAT_ASSN_AP_BSSID, 8290 ipw2100_get_ordinal(priv, IPW_ORD_STAT_ASSN_AP_BSSID,
8329 &priv->bssid, &len)) { 8291 &priv->bssid, &len)) {
8330 memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN); 8292 memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN);
8331 } else { 8293 } else {
8332 /* We now have the BSSID, so can finish setting to the full 8294 /* We now have the BSSID, so can finish setting to the full
@@ -8351,7 +8313,8 @@ static void ipw2100_wx_event_work(struct ipw2100_priv *priv)
8351 /* This is a disassociation event, so kick the firmware to 8313 /* This is a disassociation event, so kick the firmware to
8352 * look for another AP */ 8314 * look for another AP */
8353 if (priv->config & CFG_STATIC_ESSID) 8315 if (priv->config & CFG_STATIC_ESSID)
8354 ipw2100_set_essid(priv, priv->essid, priv->essid_len, 0); 8316 ipw2100_set_essid(priv, priv->essid, priv->essid_len,
8317 0);
8355 else 8318 else
8356 ipw2100_set_essid(priv, NULL, 0, 0); 8319 ipw2100_set_essid(priv, NULL, 0, 0);
8357 up(&priv->action_sem); 8320 up(&priv->action_sem);
@@ -8374,7 +8337,6 @@ static void ipw2100_wx_event_work(struct ipw2100_priv *priv)
8374 8337
8375#define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" 8338#define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw"
8376 8339
8377
8378/* 8340/*
8379 8341
8380BINARY FIRMWARE HEADER FORMAT 8342BINARY FIRMWARE HEADER FORMAT
@@ -8396,12 +8358,10 @@ struct ipw2100_fw_header {
8396 unsigned int uc_size; 8358 unsigned int uc_size;
8397} __attribute__ ((packed)); 8359} __attribute__ ((packed));
8398 8360
8399
8400
8401static int ipw2100_mod_firmware_load(struct ipw2100_fw *fw) 8361static int ipw2100_mod_firmware_load(struct ipw2100_fw *fw)
8402{ 8362{
8403 struct ipw2100_fw_header *h = 8363 struct ipw2100_fw_header *h =
8404 (struct ipw2100_fw_header *)fw->fw_entry->data; 8364 (struct ipw2100_fw_header *)fw->fw_entry->data;
8405 8365
8406 if (IPW2100_FW_MAJOR(h->version) != IPW2100_FW_MAJOR_VERSION) { 8366 if (IPW2100_FW_MAJOR(h->version) != IPW2100_FW_MAJOR_VERSION) {
8407 printk(KERN_WARNING DRV_NAME ": Firmware image not compatible " 8367 printk(KERN_WARNING DRV_NAME ": Firmware image not compatible "
@@ -8420,7 +8380,6 @@ static int ipw2100_mod_firmware_load(struct ipw2100_fw *fw)
8420 return 0; 8380 return 0;
8421} 8381}
8422 8382
8423
8424static int ipw2100_get_firmware(struct ipw2100_priv *priv, 8383static int ipw2100_get_firmware(struct ipw2100_priv *priv,
8425 struct ipw2100_fw *fw) 8384 struct ipw2100_fw *fw)
8426{ 8385{
@@ -8428,7 +8387,7 @@ static int ipw2100_get_firmware(struct ipw2100_priv *priv,
8428 int rc; 8387 int rc;
8429 8388
8430 IPW_DEBUG_INFO("%s: Using hotplug firmware load.\n", 8389 IPW_DEBUG_INFO("%s: Using hotplug firmware load.\n",
8431 priv->net_dev->name); 8390 priv->net_dev->name);
8432 8391
8433 switch (priv->ieee->iw_mode) { 8392 switch (priv->ieee->iw_mode) {
8434 case IW_MODE_ADHOC: 8393 case IW_MODE_ADHOC:
@@ -8454,7 +8413,7 @@ static int ipw2100_get_firmware(struct ipw2100_priv *priv,
8454 return rc; 8413 return rc;
8455 } 8414 }
8456 IPW_DEBUG_INFO("firmware data %p size %zd\n", fw->fw_entry->data, 8415 IPW_DEBUG_INFO("firmware data %p size %zd\n", fw->fw_entry->data,
8457 fw->fw_entry->size); 8416 fw->fw_entry->size);
8458 8417
8459 ipw2100_mod_firmware_load(fw); 8418 ipw2100_mod_firmware_load(fw);
8460 8419
@@ -8470,7 +8429,6 @@ static void ipw2100_release_firmware(struct ipw2100_priv *priv,
8470 fw->fw_entry = NULL; 8429 fw->fw_entry = NULL;
8471} 8430}
8472 8431
8473
8474static int ipw2100_get_fwversion(struct ipw2100_priv *priv, char *buf, 8432static int ipw2100_get_fwversion(struct ipw2100_priv *priv, char *buf,
8475 size_t max) 8433 size_t max)
8476{ 8434{
@@ -8479,8 +8437,7 @@ static int ipw2100_get_fwversion(struct ipw2100_priv *priv, char *buf,
8479 u32 tmp; 8437 u32 tmp;
8480 int i; 8438 int i;
8481 /* firmware version is an ascii string (max len of 14) */ 8439 /* firmware version is an ascii string (max len of 14) */
8482 if (ipw2100_get_ordinal(priv, IPW_ORD_STAT_FW_VER_NUM, 8440 if (ipw2100_get_ordinal(priv, IPW_ORD_STAT_FW_VER_NUM, ver, &len))
8483 ver, &len))
8484 return -EIO; 8441 return -EIO;
8485 tmp = max; 8442 tmp = max;
8486 if (len >= max) 8443 if (len >= max)
@@ -8497,8 +8454,7 @@ static int ipw2100_get_ucodeversion(struct ipw2100_priv *priv, char *buf,
8497 u32 ver; 8454 u32 ver;
8498 u32 len = sizeof(ver); 8455 u32 len = sizeof(ver);
8499 /* microcode version is a 32 bit integer */ 8456 /* microcode version is a 32 bit integer */
8500 if (ipw2100_get_ordinal(priv, IPW_ORD_UCODE_VERSION, 8457 if (ipw2100_get_ordinal(priv, IPW_ORD_UCODE_VERSION, &ver, &len))
8501 &ver, &len))
8502 return -EIO; 8458 return -EIO;
8503 return snprintf(buf, max, "%08X", ver); 8459 return snprintf(buf, max, "%08X", ver);
8504} 8460}
@@ -8506,8 +8462,7 @@ static int ipw2100_get_ucodeversion(struct ipw2100_priv *priv, char *buf,
8506/* 8462/*
8507 * On exit, the firmware will have been freed from the fw list 8463 * On exit, the firmware will have been freed from the fw list
8508 */ 8464 */
8509static int ipw2100_fw_download(struct ipw2100_priv *priv, 8465static int ipw2100_fw_download(struct ipw2100_priv *priv, struct ipw2100_fw *fw)
8510 struct ipw2100_fw *fw)
8511{ 8466{
8512 /* firmware is constructed of N contiguous entries, each entry is 8467 /* firmware is constructed of N contiguous entries, each entry is
8513 * structured as: 8468 * structured as:
@@ -8515,7 +8470,7 @@ static int ipw2100_fw_download(struct ipw2100_priv *priv,
8515 * offset sie desc 8470 * offset sie desc
8516 * 0 4 address to write to 8471 * 0 4 address to write to
8517 * 4 2 length of data run 8472 * 4 2 length of data run
8518 * 6 length data 8473 * 6 length data
8519 */ 8474 */
8520 unsigned int addr; 8475 unsigned int addr;
8521 unsigned short len; 8476 unsigned short len;
@@ -8524,12 +8479,12 @@ static int ipw2100_fw_download(struct ipw2100_priv *priv,
8524 unsigned int firmware_data_left = fw->fw.size; 8479 unsigned int firmware_data_left = fw->fw.size;
8525 8480
8526 while (firmware_data_left > 0) { 8481 while (firmware_data_left > 0) {
8527 addr = *(u32 *)(firmware_data); 8482 addr = *(u32 *) (firmware_data);
8528 firmware_data += 4; 8483 firmware_data += 4;
8529 firmware_data_left -= 4; 8484 firmware_data_left -= 4;
8530 8485
8531 len = *(u16 *)(firmware_data); 8486 len = *(u16 *) (firmware_data);
8532 firmware_data += 2; 8487 firmware_data += 2;
8533 firmware_data_left -= 2; 8488 firmware_data_left -= 2;
8534 8489
8535 if (len > 32) { 8490 if (len > 32) {
@@ -8540,7 +8495,7 @@ static int ipw2100_fw_download(struct ipw2100_priv *priv,
8540 } 8495 }
8541 8496
8542 write_nic_memory(priv->net_dev, addr, len, firmware_data); 8497 write_nic_memory(priv->net_dev, addr, len, firmware_data);
8543 firmware_data += len; 8498 firmware_data += len;
8544 firmware_data_left -= len; 8499 firmware_data_left -= len;
8545 } 8500 }
8546 8501
@@ -8654,21 +8609,19 @@ static int ipw2100_ucode_download(struct ipw2100_priv *priv,
8654 for (i = 0; i < 30; i++) { 8609 for (i = 0; i < 30; i++) {
8655 /* Read alive response structure */ 8610 /* Read alive response structure */
8656 for (j = 0; 8611 for (j = 0;
8657 j < (sizeof(struct symbol_alive_response) >> 1); 8612 j < (sizeof(struct symbol_alive_response) >> 1); j++)
8658 j++) 8613 read_nic_word(dev, 0x210004, ((u16 *) & response) + j);
8659 read_nic_word(dev, 0x210004,
8660 ((u16 *)&response) + j);
8661 8614
8662 if ((response.cmd_id == 1) && 8615 if ((response.cmd_id == 1) && (response.ucode_valid == 0x1))
8663 (response.ucode_valid == 0x1))
8664 break; 8616 break;
8665 udelay(10); 8617 udelay(10);
8666 } 8618 }
8667 8619
8668 if (i == 30) { 8620 if (i == 30) {
8669 printk(KERN_ERR DRV_NAME ": %s: No response from Symbol - hw not alive\n", 8621 printk(KERN_ERR DRV_NAME
8622 ": %s: No response from Symbol - hw not alive\n",
8670 dev->name); 8623 dev->name);
8671 printk_buf(IPW_DL_ERROR, (u8*)&response, sizeof(response)); 8624 printk_buf(IPW_DL_ERROR, (u8 *) & response, sizeof(response));
8672 return -EIO; 8625 return -EIO;
8673 } 8626 }
8674 8627