Lines Matching +full:tx +full:- +full:sec

1 // SPDX-License-Identifier: GPL-2.0-only
4 Copyright(c) 2003 - 2006 Intel Corporation. All rights reserved.
9 Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
12 Extensions 0.26 package and copyright (c) 1997-2003 Jean Tourrilhes
16 Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen
18 Copyright (c) 2002-2003, Jouni Malinen <j@w1.fi>
34 Tx - Commands and Data
54 The Tx flow cycle is as follows:
68 8) For each Tx interrupt received from the firmware, the READ index is checked
84 There are two locks utilized. The first is the low level lock (priv->low_lock)
87 - Access to the Tx/Rx queue lists via priv->low_lock. The lists are as follows:
89 tx_free_list : Holds pre-allocated Tx buffers.
93 tx_pend_list : Holds used Tx buffers waiting to go into the TBD ring
97 msg_free_list : Holds pre-allocated Msg (Command) buffers
105 The flow of data on the TX side is as follows:
110 The methods that work on the TBD ring are protected via priv->low_lock.
112 - The internal data state of the device itself
113 - Access to the firmware read/write indexes for the BD queues
116 All external entry functions are locked with the priv->action_lock to ensure
134 #include <linux/dma-mapping.h>
157 #define IPW2100_VERSION "git-1.2.2"
162 #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation"
305 /* Pre-decl until we get the code solid and then we can clean it up */
332 *val = ioread32(priv->ioaddr + reg); in read_register()
340 iowrite32(val, priv->ioaddr + reg); in write_register()
349 *val = ioread16(priv->ioaddr + reg); in read_register_word()
357 *val = ioread8(priv->ioaddr + reg); in read_register_byte()
365 iowrite16(val, priv->ioaddr + reg); in write_register_word()
373 iowrite8(val, priv->ioaddr + reg); in write_register_byte()
429 dif_len = addr - aligned_addr; in write_nic_memory()
439 len -= dif_len; in write_nic_memory()
450 dif_len = len - aligned_len; in write_nic_memory()
467 dif_len = addr - aligned_addr; in read_nic_memory()
477 len -= dif_len; in read_nic_memory()
488 dif_len = len - aligned_len; in read_nic_memory()
506 struct ipw2100_ordinals *ordinals = &priv->ordinals; in ipw2100_get_ordinal()
513 if (ordinals->table1_addr == 0) { in ipw2100_get_ordinal()
516 return -EINVAL; in ipw2100_get_ordinal()
527 return -EINVAL; in ipw2100_get_ordinal()
530 read_nic_dword(priv->net_dev, in ipw2100_get_ordinal()
531 ordinals->table1_addr + (ord << 2), &addr); in ipw2100_get_ordinal()
532 read_nic_dword(priv->net_dev, addr, val); in ipw2100_get_ordinal()
541 ord -= IPW_START_ORD_TAB_2; in ipw2100_get_ordinal()
544 read_nic_dword(priv->net_dev, in ipw2100_get_ordinal()
545 ordinals->table2_addr + (ord << 3), &addr); in ipw2100_get_ordinal()
548 * two 16-bit words - first is length, second is count */ in ipw2100_get_ordinal()
549 read_nic_dword(priv->net_dev, in ipw2100_get_ordinal()
550 ordinals->table2_addr + (ord << 3) + sizeof(u32), in ipw2100_get_ordinal()
563 return -EINVAL; in ipw2100_get_ordinal()
571 read_nic_memory(priv->net_dev, addr, total_length, val); in ipw2100_get_ordinal()
579 return -EINVAL; in ipw2100_get_ordinal()
585 struct ipw2100_ordinals *ordinals = &priv->ordinals; in ipw2100_set_ordinal()
592 return -EINVAL; in ipw2100_set_ordinal()
595 read_nic_dword(priv->net_dev, in ipw2100_set_ordinal()
596 ordinals->table1_addr + (ord << 2), &addr); in ipw2100_set_ordinal()
598 write_nic_dword(priv->net_dev, addr, *val); in ipw2100_set_ordinal()
607 return -EINVAL; in ipw2100_set_ordinal()
609 return -EINVAL; in ipw2100_set_ordinal()
621 out += scnprintf(buf + out, count - out, " "); in snprint_line()
623 out += scnprintf(buf + out, count - out, "%02X ", in snprint_line()
626 out += scnprintf(buf + out, count - out, " "); in snprint_line()
629 out += scnprintf(buf + out, count - out, " "); in snprint_line()
631 out += scnprintf(buf + out, count - out, " "); in snprint_line()
637 out += scnprintf(buf + out, count - out, "%c", c); in snprint_line()
641 out += scnprintf(buf + out, count - out, " "); in snprint_line()
659 len -= min(len, 16U); in printk_buf()
672 if (priv->reset_backoff && in schedule_reset()
673 (now - priv->last_reset > priv->reset_backoff)) in schedule_reset()
674 priv->reset_backoff = 0; in schedule_reset()
676 priv->last_reset = now; in schedule_reset()
678 if (!(priv->status & STATUS_RESET_PENDING)) { in schedule_reset()
680 priv->net_dev->name, priv->reset_backoff); in schedule_reset()
681 netif_carrier_off(priv->net_dev); in schedule_reset()
682 netif_stop_queue(priv->net_dev); in schedule_reset()
683 priv->status |= STATUS_RESET_PENDING; in schedule_reset()
684 if (priv->reset_backoff) in schedule_reset()
685 schedule_delayed_work(&priv->reset_work, in schedule_reset()
686 priv->reset_backoff * HZ); in schedule_reset()
688 schedule_delayed_work(&priv->reset_work, 0); in schedule_reset()
690 if (priv->reset_backoff < MAX_RESET_BACKOFF) in schedule_reset()
691 priv->reset_backoff++; in schedule_reset()
693 wake_up_interruptible(&priv->wait_command_queue); in schedule_reset()
696 priv->net_dev->name); in schedule_reset()
710 command_types[cmd->host_command], cmd->host_command, in ipw2100_hw_send_command()
711 cmd->host_command_length); in ipw2100_hw_send_command()
712 printk_buf(IPW_DL_HC, (u8 *) cmd->host_command_parameters, in ipw2100_hw_send_command()
713 cmd->host_command_length); in ipw2100_hw_send_command()
715 spin_lock_irqsave(&priv->low_lock, flags); in ipw2100_hw_send_command()
717 if (priv->fatal_error) { in ipw2100_hw_send_command()
720 err = -EIO; in ipw2100_hw_send_command()
724 if (!(priv->status & STATUS_RUNNING)) { in ipw2100_hw_send_command()
727 err = -EIO; in ipw2100_hw_send_command()
731 if (priv->status & STATUS_CMD_ACTIVE) { in ipw2100_hw_send_command()
734 err = -EBUSY; in ipw2100_hw_send_command()
738 if (list_empty(&priv->msg_free_list)) { in ipw2100_hw_send_command()
743 priv->status |= STATUS_CMD_ACTIVE; in ipw2100_hw_send_command()
744 priv->messages_sent++; in ipw2100_hw_send_command()
746 element = priv->msg_free_list.next; in ipw2100_hw_send_command()
749 packet->jiffy_start = jiffies; in ipw2100_hw_send_command()
752 packet->info.c_struct.cmd->host_command_reg = cmd->host_command; in ipw2100_hw_send_command()
753 packet->info.c_struct.cmd->host_command_reg1 = cmd->host_command1; in ipw2100_hw_send_command()
754 packet->info.c_struct.cmd->host_command_len_reg = in ipw2100_hw_send_command()
755 cmd->host_command_length; in ipw2100_hw_send_command()
756 packet->info.c_struct.cmd->sequence = cmd->host_command_sequence; in ipw2100_hw_send_command()
758 memcpy(packet->info.c_struct.cmd->host_command_params_reg, in ipw2100_hw_send_command()
759 cmd->host_command_parameters, in ipw2100_hw_send_command()
760 sizeof(packet->info.c_struct.cmd->host_command_params_reg)); in ipw2100_hw_send_command()
763 DEC_STAT(&priv->msg_free_stat); in ipw2100_hw_send_command()
765 list_add_tail(element, &priv->msg_pend_list); in ipw2100_hw_send_command()
766 INC_STAT(&priv->msg_pend_stat); in ipw2100_hw_send_command()
771 spin_unlock_irqrestore(&priv->low_lock, flags); in ipw2100_hw_send_command()
780 wait_event_interruptible_timeout(priv->wait_command_queue, in ipw2100_hw_send_command()
781 !(priv-> in ipw2100_hw_send_command()
788 priv->fatal_error = IPW2100_ERR_MSG_TIMEOUT; in ipw2100_hw_send_command()
789 priv->status &= ~STATUS_CMD_ACTIVE; in ipw2100_hw_send_command()
791 return -EIO; in ipw2100_hw_send_command()
794 if (priv->fatal_error) { in ipw2100_hw_send_command()
796 priv->net_dev->name); in ipw2100_hw_send_command()
797 return -EIO; in ipw2100_hw_send_command()
810 spin_unlock_irqrestore(&priv->low_lock, flags); in ipw2100_hw_send_command()
827 /* Domain 0 check - all values should be DOA_DEBUG */ in ipw2100_verify()
830 read_register(priv->net_dev, address, &data1); in ipw2100_verify()
832 return -EIO; in ipw2100_verify()
835 /* Domain 1 check - use arbitrary read/write compare */ in ipw2100_verify()
838 write_register(priv->net_dev, IPW_REG_DOMAIN_1_OFFSET + 0x32, in ipw2100_verify()
840 write_register(priv->net_dev, IPW_REG_DOMAIN_1_OFFSET + 0x36, in ipw2100_verify()
842 read_register(priv->net_dev, IPW_REG_DOMAIN_1_OFFSET + 0x32, in ipw2100_verify()
844 read_register(priv->net_dev, IPW_REG_DOMAIN_1_OFFSET + 0x36, in ipw2100_verify()
850 return -EIO; in ipw2100_verify()
883 ((priv->status & STATUS_ENABLED) ? in ipw2100_wait_for_card_state()
886 priv->status |= STATUS_ENABLED; in ipw2100_wait_for_card_state()
888 priv->status &= ~STATUS_ENABLED; in ipw2100_wait_for_card_state()
898 return -EIO; in ipw2100_wait_for_card_state()
912 write_register(priv->net_dev, IPW_REG_RESET_REG, in sw_reset_and_clock()
920 read_register(priv->net_dev, IPW_REG_RESET_REG, &r); in sw_reset_and_clock()
926 return -EIO; // TODO: better error value in sw_reset_and_clock()
930 write_register(priv->net_dev, IPW_REG_GP_CNTRL, in sw_reset_and_clock()
938 read_register(priv->net_dev, IPW_REG_GP_CNTRL, &r); in sw_reset_and_clock()
944 return -EIO; /* TODO: better error value */ in sw_reset_and_clock()
947 read_register(priv->net_dev, IPW_REG_GP_CNTRL, &r); in sw_reset_and_clock()
948 write_register(priv->net_dev, IPW_REG_GP_CNTRL, in sw_reset_and_clock()
962 5. zero-out shared mem
975 if (priv->fatal_error) { in ipw2100_download_firmware()
978 priv->net_dev->name, priv->fatal_error); in ipw2100_download_firmware()
979 return -EINVAL; in ipw2100_download_firmware()
986 priv->net_dev->name, err); in ipw2100_download_firmware()
987 priv->fatal_error = IPW2100_ERR_FW_LOAD; in ipw2100_download_firmware()
995 priv->net_dev->name, err); in ipw2100_download_firmware()
996 priv->fatal_error = IPW2100_ERR_FW_LOAD; in ipw2100_download_firmware()
1000 priv->firmware_version = ipw2100_firmware.version; in ipw2100_download_firmware()
1006 priv->net_dev->name, err); in ipw2100_download_firmware()
1013 priv->net_dev->name, err); in ipw2100_download_firmware()
1018 write_nic_dword(priv->net_dev, in ipw2100_download_firmware()
1022 write_register(priv->net_dev, IPW_REG_RESET_REG, 0); in ipw2100_download_firmware()
1028 priv->net_dev->name, err); in ipw2100_download_firmware()
1033 write_nic_dword(priv->net_dev, in ipw2100_download_firmware()
1041 priv->net_dev->name, err); in ipw2100_download_firmware()
1049 priv->net_dev->name, err); in ipw2100_download_firmware()
1057 * from the disk. --YZ in ipw2100_download_firmware()
1067 write_nic_dword(priv->net_dev, address, 0); in ipw2100_download_firmware()
1070 write_nic_dword(priv->net_dev, address, 0); in ipw2100_download_firmware()
1073 write_nic_dword(priv->net_dev, address, 0); in ipw2100_download_firmware()
1076 write_nic_dword(priv->net_dev, address, 0); in ipw2100_download_firmware()
1079 write_nic_dword(priv->net_dev, address, 0); in ipw2100_download_firmware()
1090 if (priv->status & STATUS_INT_ENABLED) in ipw2100_enable_interrupts()
1092 priv->status |= STATUS_INT_ENABLED; in ipw2100_enable_interrupts()
1093 write_register(priv->net_dev, IPW_REG_INTA_MASK, IPW_INTERRUPT_MASK); in ipw2100_enable_interrupts()
1098 if (!(priv->status & STATUS_INT_ENABLED)) in ipw2100_disable_interrupts()
1100 priv->status &= ~STATUS_INT_ENABLED; in ipw2100_disable_interrupts()
1101 write_register(priv->net_dev, IPW_REG_INTA_MASK, 0x0); in ipw2100_disable_interrupts()
1106 struct ipw2100_ordinals *ord = &priv->ordinals; in ipw2100_initialize_ordinals()
1110 read_register(priv->net_dev, IPW_MEM_HOST_SHARED_ORDINALS_TABLE_1, in ipw2100_initialize_ordinals()
1111 &ord->table1_addr); in ipw2100_initialize_ordinals()
1113 read_register(priv->net_dev, IPW_MEM_HOST_SHARED_ORDINALS_TABLE_2, in ipw2100_initialize_ordinals()
1114 &ord->table2_addr); in ipw2100_initialize_ordinals()
1116 read_nic_dword(priv->net_dev, ord->table1_addr, &ord->table1_size); in ipw2100_initialize_ordinals()
1117 read_nic_dword(priv->net_dev, ord->table2_addr, &ord->table2_size); in ipw2100_initialize_ordinals()
1119 ord->table2_size &= 0x0000FFFF; in ipw2100_initialize_ordinals()
1121 IPW_DEBUG_INFO("table 1 size: %d\n", ord->table1_size); in ipw2100_initialize_ordinals()
1122 IPW_DEBUG_INFO("table 2 size: %d\n", ord->table2_size); in ipw2100_initialize_ordinals()
1135 write_register(priv->net_dev, IPW_REG_GPIO, reg); in ipw2100_hw_set_gpio()
1147 if (!(priv->hw_features & HW_FEATURE_RFKILL)) { in rf_kill_active()
1148 wiphy_rfkill_set_hw_state(priv->ieee->wdev.wiphy, false); in rf_kill_active()
1149 priv->status &= ~STATUS_RF_KILL_HW; in rf_kill_active()
1155 read_register(priv->net_dev, IPW_REG_GPIO, &reg); in rf_kill_active()
1160 wiphy_rfkill_set_hw_state(priv->ieee->wdev.wiphy, true); in rf_kill_active()
1161 priv->status |= STATUS_RF_KILL_HW; in rf_kill_active()
1163 wiphy_rfkill_set_hw_state(priv->ieee->wdev.wiphy, false); in rf_kill_active()
1164 priv->status &= ~STATUS_RF_KILL_HW; in rf_kill_active()
1183 return -EIO; in ipw2100_get_hw_features()
1191 read_nic_dword(priv->net_dev, addr + 0xFC, &val); in ipw2100_get_hw_features()
1192 priv->eeprom_version = (val >> 24) & 0xFF; in ipw2100_get_hw_features()
1193 IPW_DEBUG_INFO("EEPROM version: %d\n", priv->eeprom_version); in ipw2100_get_hw_features()
1202 read_nic_dword(priv->net_dev, addr + 0x20, &val); in ipw2100_get_hw_features()
1204 priv->hw_features |= HW_FEATURE_RFKILL; in ipw2100_get_hw_features()
1207 (priv->hw_features & HW_FEATURE_RFKILL) ? "" : "not "); in ipw2100_get_hw_features()
1225 if (priv->status & STATUS_RUNNING) in ipw2100_start_adapter()
1229 * Initialize the hw - drive adapter to DO state by setting in ipw2100_start_adapter()
1236 priv->net_dev->name); in ipw2100_start_adapter()
1237 return -EIO; in ipw2100_start_adapter()
1240 /* Clear the Tx, Rx and Msg queues and the r/w indexes in ipw2100_start_adapter()
1246 /* TODO -- Look at disabling interrupts here to make sure none in ipw2100_start_adapter()
1249 /* Release ARC - clear reset bit */ in ipw2100_start_adapter()
1250 write_register(priv->net_dev, IPW_REG_RESET_REG, 0); in ipw2100_start_adapter()
1259 read_register(priv->net_dev, IPW_REG_INTA, &inta); in ipw2100_start_adapter()
1264 write_register(priv->net_dev, IPW_REG_INTA, in ipw2100_start_adapter()
1275 write_register(priv->net_dev, IPW_REG_INTA, in ipw2100_start_adapter()
1279 } while (--i); in ipw2100_start_adapter()
1283 read_register(priv->net_dev, IPW_REG_INTA, &inta); in ipw2100_start_adapter()
1284 read_register(priv->net_dev, IPW_REG_INTA_MASK, &inta_mask); in ipw2100_start_adapter()
1288 write_register(priv->net_dev, IPW_REG_INTA, inta); in ipw2100_start_adapter()
1296 priv->net_dev->name); in ipw2100_start_adapter()
1297 return -EIO; in ipw2100_start_adapter()
1301 read_register(priv->net_dev, IPW_REG_GPIO, &gpio); in ipw2100_start_adapter()
1305 write_register(priv->net_dev, IPW_REG_GPIO, gpio); in ipw2100_start_adapter()
1308 priv->status |= STATUS_RUNNING; in ipw2100_start_adapter()
1311 priv->status &= ~(STATUS_ASSOCIATING | STATUS_ASSOCIATED); in ipw2100_start_adapter()
1320 if (!priv->fatal_error) in ipw2100_reset_fatalerror()
1323 priv->fatal_errors[priv->fatal_index++] = priv->fatal_error; in ipw2100_reset_fatalerror()
1324 priv->fatal_index %= IPW2100_ERROR_QUEUE; in ipw2100_reset_fatalerror()
1325 priv->fatal_error = 0; in ipw2100_reset_fatalerror()
1339 write_register(priv->net_dev, IPW_REG_RESET_REG, in ipw2100_power_cycle_adapter()
1347 read_register(priv->net_dev, IPW_REG_RESET_REG, &reg); in ipw2100_power_cycle_adapter()
1351 } while (--i); in ipw2100_power_cycle_adapter()
1353 priv->status &= ~STATUS_RESET_PENDING; in ipw2100_power_cycle_adapter()
1357 ("exit - waited too long for master assert stop\n"); in ipw2100_power_cycle_adapter()
1358 return -EIO; in ipw2100_power_cycle_adapter()
1361 write_register(priv->net_dev, IPW_REG_RESET_REG, in ipw2100_power_cycle_adapter()
1368 priv->status &= ~(STATUS_RUNNING | STATUS_ASSOCIATING | in ipw2100_power_cycle_adapter()
1403 read_nic_dword(priv->net_dev, IPW2100_CONTROL_REG, &val1); in ipw2100_hw_phy_off()
1404 read_nic_dword(priv->net_dev, IPW2100_COMMAND, &val2); in ipw2100_hw_phy_off()
1413 return -EIO; in ipw2100_hw_phy_off()
1427 if (priv->status & STATUS_ENABLED) in ipw2100_enable_adapter()
1430 mutex_lock(&priv->adapter_mutex); in ipw2100_enable_adapter()
1446 priv->net_dev->name); in ipw2100_enable_adapter()
1450 if (priv->stop_hang_check) { in ipw2100_enable_adapter()
1451 priv->stop_hang_check = 0; in ipw2100_enable_adapter()
1452 schedule_delayed_work(&priv->hang_check, HZ / 2); in ipw2100_enable_adapter()
1456 mutex_unlock(&priv->adapter_mutex); in ipw2100_enable_adapter()
1472 if (!(priv->status & STATUS_RUNNING)) in ipw2100_hw_stop_adapter()
1475 priv->status |= STATUS_STOPPING; in ipw2100_hw_stop_adapter()
1480 if (!priv->fatal_error) { in ipw2100_hw_stop_adapter()
1491 * If in D0-standby mode going directly to D3 may cause a in ipw2100_hw_stop_adapter()
1497 * out of D0-standby if it is already in that state. in ipw2100_hw_stop_adapter()
1504 * take HW out of D0-standby and prepare it for D3 state. in ipw2100_hw_stop_adapter()
1516 priv->net_dev->name, err); in ipw2100_hw_stop_adapter()
1521 priv->status &= ~STATUS_ENABLED; in ipw2100_hw_stop_adapter()
1537 write_register(priv->net_dev, IPW_REG_RESET_REG, in ipw2100_hw_stop_adapter()
1542 for (i = 5; i > 0; i--) { in ipw2100_hw_stop_adapter()
1546 read_register(priv->net_dev, IPW_REG_RESET_REG, &reg); in ipw2100_hw_stop_adapter()
1555 priv->net_dev->name); in ipw2100_hw_stop_adapter()
1558 write_register(priv->net_dev, IPW_REG_RESET_REG, in ipw2100_hw_stop_adapter()
1561 priv->status &= ~(STATUS_RUNNING | STATUS_STOPPING); in ipw2100_hw_stop_adapter()
1577 if (!(priv->status & STATUS_ENABLED)) in ipw2100_disable_adapter()
1581 priv->status &= ~(STATUS_ASSOCIATED | STATUS_ASSOCIATING); in ipw2100_disable_adapter()
1583 if (!priv->stop_hang_check) { in ipw2100_disable_adapter()
1584 priv->stop_hang_check = 1; in ipw2100_disable_adapter()
1585 cancel_delayed_work(&priv->hang_check); in ipw2100_disable_adapter()
1588 mutex_lock(&priv->adapter_mutex); in ipw2100_disable_adapter()
1593 ": exit - failed to send CARD_DISABLE command\n"); in ipw2100_disable_adapter()
1600 ": exit - card failed to change to DISABLED\n"); in ipw2100_disable_adapter()
1607 mutex_unlock(&priv->adapter_mutex); in ipw2100_disable_adapter()
1626 if (!(priv->config & CFG_ASSOCIATE)) in ipw2100_set_scan_options()
1628 if ((priv->ieee->sec.flags & SEC_ENABLED) && priv->ieee->sec.enabled) in ipw2100_set_scan_options()
1630 if (priv->config & CFG_PASSIVE_SCAN) in ipw2100_set_scan_options()
1633 cmd.host_command_parameters[1] = priv->channel_mask; in ipw2100_set_scan_options()
1657 if (priv->ieee->iw_mode == IW_MODE_MONITOR) in ipw2100_start_scan()
1660 if (priv->status & STATUS_SCANNING) { in ipw2100_start_scan()
1674 priv->status |= STATUS_SCANNING; in ipw2100_start_scan()
1677 priv->status &= ~STATUS_SCANNING; in ipw2100_start_scan()
1686 "---",
1704 if (priv->suspend_time) { in ipw2100_up()
1705 libipw_networks_age(priv->ieee, priv->suspend_time); in ipw2100_up()
1706 priv->suspend_time = 0; in ipw2100_up()
1710 if (priv->status & STATUS_RF_KILL_SW) { in ipw2100_up()
1712 "switch\n", priv->net_dev->name); in ipw2100_up()
1722 spin_lock_irqsave(&priv->low_lock, flags); in ipw2100_up()
1727 spin_unlock_irqrestore(&priv->low_lock, flags); in ipw2100_up()
1729 if (priv->status & STATUS_POWERED || in ipw2100_up()
1730 (priv->status & STATUS_RESET_PENDING)) { in ipw2100_up()
1736 priv->net_dev->name); in ipw2100_up()
1740 priv->status |= STATUS_POWERED; in ipw2100_up()
1747 priv->net_dev->name); in ipw2100_up()
1758 priv->net_dev->name); in ipw2100_up()
1763 libipw_set_geo(priv->ieee, &ipw_geos[0]); in ipw2100_up()
1764 priv->ieee->freq_band = LIBIPW_24GHZ_BAND; in ipw2100_up()
1771 priv->net_dev->name); in ipw2100_up()
1775 priv->status &= ~STATUS_SCANNING; in ipw2100_up()
1779 priv->net_dev->name); in ipw2100_up()
1781 if (priv->stop_rf_kill) { in ipw2100_up()
1782 priv->stop_rf_kill = 0; in ipw2100_up()
1783 schedule_delayed_work(&priv->rf_kill, in ipw2100_up()
1798 priv->net_dev->name); in ipw2100_up()
1803 /* Enable the adapter - sends HOST_COMPLETE */ in ipw2100_up()
1808 priv->net_dev->name); in ipw2100_up()
1829 int associated = priv->status & STATUS_ASSOCIATED; in ipw2100_down()
1832 if (!priv->stop_rf_kill) { in ipw2100_down()
1833 priv->stop_rf_kill = 1; in ipw2100_down()
1834 cancel_delayed_work(&priv->rf_kill); in ipw2100_down()
1838 if (!priv->stop_hang_check) { in ipw2100_down()
1839 priv->stop_hang_check = 1; in ipw2100_down()
1840 cancel_delayed_work(&priv->hang_check); in ipw2100_down()
1844 if (priv->status & STATUS_RESET_PENDING) in ipw2100_down()
1845 cancel_delayed_work(&priv->reset_work); in ipw2100_down()
1849 spin_lock_irqsave(&priv->low_lock, flags); in ipw2100_down()
1851 spin_unlock_irqrestore(&priv->low_lock, flags); in ipw2100_down()
1855 priv->net_dev->name); in ipw2100_down()
1860 spin_lock_irqsave(&priv->low_lock, flags); in ipw2100_down()
1862 spin_unlock_irqrestore(&priv->low_lock, flags); in ipw2100_down()
1869 wireless_send_event(priv->net_dev, SIOCGIWAP, &wrqu, NULL); in ipw2100_down()
1871 priv->status &= ~(STATUS_ASSOCIATED | STATUS_ASSOCIATING); in ipw2100_down()
1872 netif_carrier_off(priv->net_dev); in ipw2100_down()
1873 netif_stop_queue(priv->net_dev); in ipw2100_down()
1879 const struct libipw_geo *geo = libipw_get_geo(priv->ieee); in ipw2100_wdev_init()
1880 struct wireless_dev *wdev = &priv->ieee->wdev; in ipw2100_wdev_init()
1883 memcpy(wdev->wiphy->perm_addr, priv->mac_addr, ETH_ALEN); in ipw2100_wdev_init()
1885 /* fill-out priv->ieee->bg_band */ in ipw2100_wdev_init()
1886 if (geo->bg_channels) { in ipw2100_wdev_init()
1887 struct ieee80211_supported_band *bg_band = &priv->ieee->bg_band; in ipw2100_wdev_init()
1889 bg_band->band = NL80211_BAND_2GHZ; in ipw2100_wdev_init()
1890 bg_band->n_channels = geo->bg_channels; in ipw2100_wdev_init()
1891 bg_band->channels = kcalloc(geo->bg_channels, in ipw2100_wdev_init()
1894 if (!bg_band->channels) { in ipw2100_wdev_init()
1896 return -ENOMEM; in ipw2100_wdev_init()
1898 /* translate geo->bg to bg_band.channels */ in ipw2100_wdev_init()
1899 for (i = 0; i < geo->bg_channels; i++) { in ipw2100_wdev_init()
1900 bg_band->channels[i].band = NL80211_BAND_2GHZ; in ipw2100_wdev_init()
1901 bg_band->channels[i].center_freq = geo->bg[i].freq; in ipw2100_wdev_init()
1902 bg_band->channels[i].hw_value = geo->bg[i].channel; in ipw2100_wdev_init()
1903 bg_band->channels[i].max_power = geo->bg[i].max_power; in ipw2100_wdev_init()
1904 if (geo->bg[i].flags & LIBIPW_CH_PASSIVE_ONLY) in ipw2100_wdev_init()
1905 bg_band->channels[i].flags |= in ipw2100_wdev_init()
1907 if (geo->bg[i].flags & LIBIPW_CH_NO_IBSS) in ipw2100_wdev_init()
1908 bg_band->channels[i].flags |= in ipw2100_wdev_init()
1910 if (geo->bg[i].flags & LIBIPW_CH_RADAR_DETECT) in ipw2100_wdev_init()
1911 bg_band->channels[i].flags |= in ipw2100_wdev_init()
1918 bg_band->bitrates = ipw2100_bg_rates; in ipw2100_wdev_init()
1919 bg_band->n_bitrates = RATE_COUNT; in ipw2100_wdev_init()
1921 wdev->wiphy->bands[NL80211_BAND_2GHZ] = bg_band; in ipw2100_wdev_init()
1924 wdev->wiphy->cipher_suites = ipw_cipher_suites; in ipw2100_wdev_init()
1925 wdev->wiphy->n_cipher_suites = ARRAY_SIZE(ipw_cipher_suites); in ipw2100_wdev_init()
1927 set_wiphy_dev(wdev->wiphy, &priv->pci_dev->dev); in ipw2100_wdev_init()
1928 if (wiphy_register(wdev->wiphy)) in ipw2100_wdev_init()
1929 return -EIO; in ipw2100_wdev_init()
1942 int associated = priv->status & STATUS_ASSOCIATED; in ipw2100_reset_adapter()
1944 spin_lock_irqsave(&priv->low_lock, flags); in ipw2100_reset_adapter()
1945 IPW_DEBUG_INFO(": %s: Restarting adapter.\n", priv->net_dev->name); in ipw2100_reset_adapter()
1946 priv->resets++; in ipw2100_reset_adapter()
1947 priv->status &= ~(STATUS_ASSOCIATED | STATUS_ASSOCIATING); in ipw2100_reset_adapter()
1948 priv->status |= STATUS_SECURITY_UPDATED; in ipw2100_reset_adapter()
1952 cancel_delayed_work(&priv->reset_work); in ipw2100_reset_adapter()
1953 priv->status |= STATUS_RESET_PENDING; in ipw2100_reset_adapter()
1954 spin_unlock_irqrestore(&priv->low_lock, flags); in ipw2100_reset_adapter()
1956 mutex_lock(&priv->action_mutex); in ipw2100_reset_adapter()
1958 priv->stop_hang_check = 1; in ipw2100_reset_adapter()
1959 cancel_delayed_work(&priv->hang_check); in ipw2100_reset_adapter()
1963 wireless_send_event(priv->net_dev, SIOCGIWAP, &wrqu, NULL); in ipw2100_reset_adapter()
1966 mutex_unlock(&priv->action_mutex); in ipw2100_reset_adapter()
2021 memcpy(priv->ieee->bssid, bssid, ETH_ALEN); in isr_indicate_associated()
2043 priv->net_dev->name, essid_len, essid, in isr_indicate_associated()
2047 if (!(priv->config & CFG_STATIC_ESSID)) { in isr_indicate_associated()
2048 priv->essid_len = min((u8) essid_len, (u8) IW_ESSID_MAX_SIZE); in isr_indicate_associated()
2049 memcpy(priv->essid, essid, priv->essid_len); in isr_indicate_associated()
2051 priv->channel = chan; in isr_indicate_associated()
2052 memcpy(priv->bssid, bssid, ETH_ALEN); in isr_indicate_associated()
2054 priv->status |= STATUS_ASSOCIATING; in isr_indicate_associated()
2055 priv->connect_start = ktime_get_boottime_seconds(); in isr_indicate_associated()
2057 schedule_delayed_work(&priv->wx_event_work, HZ / 10); in isr_indicate_associated()
2083 * disable auto association -- so we cheat by setting a bogus SSID */ in ipw2100_set_essid()
2084 if (!ssid_len && !(priv->config & CFG_ASSOCIATE)) { in ipw2100_set_essid()
2097 memset(priv->essid + ssid_len, 0, IW_ESSID_MAX_SIZE - ssid_len); in ipw2100_set_essid()
2098 memcpy(priv->essid, essid, ssid_len); in ipw2100_set_essid()
2099 priv->essid_len = ssid_len; in ipw2100_set_essid()
2104 err = -EIO; in ipw2100_set_essid()
2113 "disassociated: '%*pE' %pM\n", priv->essid_len, priv->essid, in isr_indicate_association_lost()
2114 priv->bssid); in isr_indicate_association_lost()
2116 priv->status &= ~(STATUS_ASSOCIATED | STATUS_ASSOCIATING); in isr_indicate_association_lost()
2118 if (priv->status & STATUS_STOPPING) { in isr_indicate_association_lost()
2123 eth_zero_addr(priv->bssid); in isr_indicate_association_lost()
2124 eth_zero_addr(priv->ieee->bssid); in isr_indicate_association_lost()
2126 netif_carrier_off(priv->net_dev); in isr_indicate_association_lost()
2127 netif_stop_queue(priv->net_dev); in isr_indicate_association_lost()
2129 if (!(priv->status & STATUS_RUNNING)) in isr_indicate_association_lost()
2132 if (priv->status & STATUS_SECURITY_UPDATED) in isr_indicate_association_lost()
2133 schedule_delayed_work(&priv->security_work, 0); in isr_indicate_association_lost()
2135 schedule_delayed_work(&priv->wx_event_work, 0); in isr_indicate_association_lost()
2141 priv->net_dev->name); in isr_indicate_rf_kill()
2144 wiphy_rfkill_set_hw_state(priv->ieee->wdev.wiphy, true); in isr_indicate_rf_kill()
2145 priv->status |= STATUS_RF_KILL_HW; in isr_indicate_rf_kill()
2148 priv->stop_rf_kill = 0; in isr_indicate_rf_kill()
2149 mod_delayed_work(system_wq, &priv->rf_kill, round_jiffies_relative(HZ)); in isr_indicate_rf_kill()
2160 wireless_send_event(priv->net_dev, SIOCGIWSCAN, &wrqu, NULL); in ipw2100_scan_event()
2167 priv->ieee->scans++; in isr_scan_complete()
2168 priv->status &= ~STATUS_SCANNING; in isr_scan_complete()
2170 /* Only userspace-requested scan completion events go out immediately */ in isr_scan_complete()
2171 if (!priv->user_requested_scan) { in isr_scan_complete()
2172 schedule_delayed_work(&priv->scan_event, in isr_scan_complete()
2175 priv->user_requested_scan = 0; in isr_scan_complete()
2176 mod_delayed_work(system_wq, &priv->scan_event, 0); in isr_scan_complete()
2198 priv->status |= STATUS_SCANNING; in isr_indicate_scanning()
2214 IPW2100_HANDLER(-1, NULL)
2222 priv->status & STATUS_ASSOCIATED && in isr_status_change()
2223 !(priv->status & STATUS_SCANNING)) { in isr_status_change()
2231 for (i = 0; status_handlers[i].status != -1; i++) { in isr_status_change()
2237 priv->wstats.status = status; in isr_status_change()
2249 if (cmd->host_command_reg < ARRAY_SIZE(command_types)) { in isr_rx_complete_command()
2251 command_types[cmd->host_command_reg], in isr_rx_complete_command()
2252 cmd->host_command_reg); in isr_rx_complete_command()
2255 if (cmd->host_command_reg == HOST_COMPLETE) in isr_rx_complete_command()
2256 priv->status |= STATUS_ENABLED; in isr_rx_complete_command()
2258 if (cmd->host_command_reg == CARD_DISABLE) in isr_rx_complete_command()
2259 priv->status &= ~STATUS_ENABLED; in isr_rx_complete_command()
2261 priv->status &= ~STATUS_CMD_ACTIVE; in isr_rx_complete_command()
2263 wake_up_interruptible(&priv->wait_command_queue); in isr_rx_complete_command()
2279 packet->skb = dev_alloc_skb(sizeof(struct ipw2100_rx)); in ipw2100_alloc_skb()
2280 if (!packet->skb) in ipw2100_alloc_skb()
2281 return -ENOMEM; in ipw2100_alloc_skb()
2283 packet->rxp = (struct ipw2100_rx *)packet->skb->data; in ipw2100_alloc_skb()
2284 packet->dma_addr = dma_map_single(&priv->pci_dev->dev, in ipw2100_alloc_skb()
2285 packet->skb->data, in ipw2100_alloc_skb()
2288 if (dma_mapping_error(&priv->pci_dev->dev, packet->dma_addr)) { in ipw2100_alloc_skb()
2289 dev_kfree_skb(packet->skb); in ipw2100_alloc_skb()
2290 return -ENOMEM; in ipw2100_alloc_skb()
2302 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff))
2306 if (!priv->snapshot[0]) in ipw2100_snapshot_free()
2309 kfree(priv->snapshot[i]); in ipw2100_snapshot_free()
2310 priv->snapshot[0] = NULL; in ipw2100_snapshot_free()
2317 if (priv->snapshot[0]) in ipw2100_snapshot_alloc()
2320 priv->snapshot[i] = kmalloc(0x1000, GFP_ATOMIC); in ipw2100_snapshot_alloc()
2321 if (!priv->snapshot[i]) { in ipw2100_snapshot_alloc()
2323 "buffer %d\n", priv->net_dev->name, i); in ipw2100_snapshot_alloc()
2325 kfree(priv->snapshot[--i]); in ipw2100_snapshot_alloc()
2326 priv->snapshot[0] = NULL; in ipw2100_snapshot_alloc()
2349 read_nic_dword(priv->net_dev, i, &tmp); in ipw2100_match_buf()
2363 if ((s - in_buf) == len) in ipw2100_match_buf()
2364 ret = (i + j) - len + 1; in ipw2100_match_buf()
2395 struct ipw2100_status *status = &priv->status_queue.drv[i]; in ipw2100_corruption_detected()
2405 write_register(priv->net_dev, IPW_REG_RESET_REG, in ipw2100_corruption_detected()
2410 read_register(priv->net_dev, IPW_REG_RESET_REG, &reg); in ipw2100_corruption_detected()
2414 } while (j--); in ipw2100_corruption_detected()
2422 priv->net_dev->name, match, in ipw2100_corruption_detected()
2426 "Firmware.\n", priv->net_dev->name); in ipw2100_corruption_detected()
2428 printk_buf((u8 *) priv->status_queue.drv, in ipw2100_corruption_detected()
2432 priv->fatal_error = IPW2100_ERR_C3_CORRUPTION; in ipw2100_corruption_detected()
2433 priv->net_dev->stats.rx_errors++; in ipw2100_corruption_detected()
2440 struct net_device *dev = priv->net_dev; in isr_rx()
2441 struct ipw2100_status *status = &priv->status_queue.drv[i]; in isr_rx()
2442 struct ipw2100_rx_packet *packet = &priv->rx_buffers[i]; in isr_rx()
2446 if (unlikely(status->frame_size > skb_tailroom(packet->skb))) { in isr_rx()
2449 dev->name, in isr_rx()
2450 status->frame_size, skb_tailroom(packet->skb)); in isr_rx()
2451 dev->stats.rx_errors++; in isr_rx()
2456 dev->stats.rx_errors++; in isr_rx()
2457 priv->wstats.discard.misc++; in isr_rx()
2462 if (unlikely(priv->ieee->iw_mode != IW_MODE_MONITOR && in isr_rx()
2463 !(priv->status & STATUS_ASSOCIATED))) { in isr_rx()
2465 priv->wstats.discard.misc++; in isr_rx()
2469 dma_unmap_single(&priv->pci_dev->dev, packet->dma_addr, in isr_rx()
2472 skb_put(packet->skb, status->frame_size); in isr_rx()
2477 skb_copy_from_linear_data(packet->skb, packet_data, in isr_rx()
2478 min_t(u32, status->frame_size, in isr_rx()
2482 if (!libipw_rx(priv->ieee, packet->skb, stats)) { in isr_rx()
2485 dev->name); in isr_rx()
2486 printk_buf(IPW_DL_DROP, packet_data, status->frame_size); in isr_rx()
2488 dev->stats.rx_errors++; in isr_rx()
2491 dev_kfree_skb_any(packet->skb); in isr_rx()
2492 packet->skb = NULL; in isr_rx()
2498 "%s: Unable to allocate SKB onto RBD ring - disabling " in isr_rx()
2499 "adapter.\n", dev->name); in isr_rx()
2505 priv->rx_queue.drv[i].host_addr = packet->dma_addr; in isr_rx()
2513 struct net_device *dev = priv->net_dev; in isr_rx_monitor()
2514 struct ipw2100_status *status = &priv->status_queue.drv[i]; in isr_rx_monitor()
2515 struct ipw2100_rx_packet *packet = &priv->rx_buffers[i]; in isr_rx_monitor()
2517 /* Magic struct that slots into the radiotap header -- no reason in isr_rx_monitor()
2527 if (unlikely(status->frame_size > skb_tailroom(packet->skb) - in isr_rx_monitor()
2531 dev->name, in isr_rx_monitor()
2532 status->frame_size, in isr_rx_monitor()
2533 skb_tailroom(packet->skb)); in isr_rx_monitor()
2534 dev->stats.rx_errors++; in isr_rx_monitor()
2539 dev->stats.rx_errors++; in isr_rx_monitor()
2540 priv->wstats.discard.misc++; in isr_rx_monitor()
2545 if (unlikely(priv->config & CFG_CRC_CHECK && in isr_rx_monitor()
2546 status->flags & IPW_STATUS_FLAG_CRC_ERROR)) { in isr_rx_monitor()
2548 dev->stats.rx_errors++; in isr_rx_monitor()
2552 dma_unmap_single(&priv->pci_dev->dev, packet->dma_addr, in isr_rx_monitor()
2554 memmove(packet->skb->data + sizeof(struct ipw_rt_hdr), in isr_rx_monitor()
2555 packet->skb->data, status->frame_size); in isr_rx_monitor()
2557 ipw_rt = (struct ipw_rt_hdr *) packet->skb->data; in isr_rx_monitor()
2559 ipw_rt->rt_hdr.it_version = PKTHDR_RADIOTAP_VERSION; in isr_rx_monitor()
2560 ipw_rt->rt_hdr.it_pad = 0; /* always good to zero */ in isr_rx_monitor()
2561 ipw_rt->rt_hdr.it_len = cpu_to_le16(sizeof(struct ipw_rt_hdr)); /* total hdr+data */ in isr_rx_monitor()
2563 ipw_rt->rt_hdr.it_present = cpu_to_le32(1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL); in isr_rx_monitor()
2565 ipw_rt->rt_dbmsignal = status->rssi + IPW2100_RSSI_TO_DBM; in isr_rx_monitor()
2567 skb_put(packet->skb, status->frame_size + sizeof(struct ipw_rt_hdr)); in isr_rx_monitor()
2569 if (!libipw_rx(priv->ieee, packet->skb, stats)) { in isr_rx_monitor()
2570 dev->stats.rx_errors++; in isr_rx_monitor()
2573 dev_kfree_skb_any(packet->skb); in isr_rx_monitor()
2574 packet->skb = NULL; in isr_rx_monitor()
2580 "%s: Unable to allocate SKB onto RBD ring - disabling " in isr_rx_monitor()
2581 "adapter.\n", dev->name); in isr_rx_monitor()
2587 priv->rx_queue.drv[i].host_addr = packet->dma_addr; in isr_rx_monitor()
2594 struct ipw2100_status *status = &priv->status_queue.drv[i]; in ipw2100_corruption_check()
2595 struct ipw2100_rx *u = priv->rx_buffers[i].rxp; in ipw2100_corruption_check()
2596 u16 frame_type = status->status_fields & STATUS_TYPE_MASK; in ipw2100_corruption_check()
2600 return (status->frame_size != sizeof(u->rx_data.command)); in ipw2100_corruption_check()
2602 return (status->frame_size != sizeof(u->rx_data.status)); in ipw2100_corruption_check()
2604 return (status->frame_size < sizeof(u->rx_data.notification)); in ipw2100_corruption_check()
2610 switch (WLAN_FC_GET_TYPE(le16_to_cpu(u->rx_data.header.frame_ctl))) { in ipw2100_corruption_check()
2615 return (status->frame_size > in ipw2100_corruption_check()
2631 * Read index - firmware places packet in entry identified by the
2634 * be filled--but not yet valid.
2636 * Write index - driver fills this entry with an unused RBD entry.
2645 * The WRITE index is cached in the variable 'priv->rx_queue.next'.
2650 struct ipw2100_bd_queue *rxq = &priv->rx_queue; in __ipw2100_rx_process()
2651 struct ipw2100_status_queue *sq = &priv->status_queue; in __ipw2100_rx_process()
2660 read_register(priv->net_dev, IPW_MEM_HOST_SHARED_RX_READ_INDEX, &r); in __ipw2100_rx_process()
2661 read_register(priv->net_dev, IPW_MEM_HOST_SHARED_RX_WRITE_INDEX, &w); in __ipw2100_rx_process()
2663 if (r >= rxq->entries) { in __ipw2100_rx_process()
2664 IPW_DEBUG_RX("exit - bad read index\n"); in __ipw2100_rx_process()
2668 i = (rxq->next + 1) % rxq->entries; in __ipw2100_rx_process()
2672 r, rxq->next, i); */ in __ipw2100_rx_process()
2674 packet = &priv->rx_buffers[i]; in __ipw2100_rx_process()
2678 dma_sync_single_for_cpu(&priv->pci_dev->dev, packet->dma_addr, in __ipw2100_rx_process()
2687 u = packet->rxp; in __ipw2100_rx_process()
2688 frame_type = sq->drv[i].status_fields & STATUS_TYPE_MASK; in __ipw2100_rx_process()
2689 stats.rssi = sq->drv[i].rssi + IPW2100_RSSI_TO_DBM; in __ipw2100_rx_process()
2690 stats.len = sq->drv[i].frame_size; in __ipw2100_rx_process()
2698 priv->net_dev->name, frame_types[frame_type], in __ipw2100_rx_process()
2704 isr_rx_complete_command(priv, &u->rx_data.command); in __ipw2100_rx_process()
2708 isr_status_change(priv, u->rx_data.status); in __ipw2100_rx_process()
2714 if (priv->ieee->iw_mode == IW_MODE_MONITOR) { in __ipw2100_rx_process()
2721 switch (WLAN_FC_GET_TYPE(le16_to_cpu(u->rx_data.header.frame_ctl))) { in __ipw2100_rx_process()
2723 libipw_rx_mgt(priv->ieee, in __ipw2100_rx_process()
2724 &u->rx_data.header, &stats); in __ipw2100_rx_process()
2740 rxq->drv[i].status.info.field = 0; in __ipw2100_rx_process()
2742 i = (i + 1) % rxq->entries; in __ipw2100_rx_process()
2747 rxq->next = (i ? i : rxq->entries) - 1; in __ipw2100_rx_process()
2749 write_register(priv->net_dev, in __ipw2100_rx_process()
2750 IPW_MEM_HOST_SHARED_RX_WRITE_INDEX, rxq->next); in __ipw2100_rx_process()
2766 * TX Queue works as follows:
2768 * Read index - points to the next TBD that the firmware will
2772 * Write index - driver fills this entry with an constructed TBD
2785 * The OLDEST index is cached in the variable 'priv->tx_queue.oldest'
2795 struct ipw2100_bd_queue *txq = &priv->tx_queue; in __ipw2100_tx_process()
2803 if (list_empty(&priv->fw_pend_list)) in __ipw2100_tx_process()
2806 element = priv->fw_pend_list.next; in __ipw2100_tx_process()
2809 tbd = &txq->drv[packet->index]; in __ipw2100_tx_process()
2812 switch (packet->type) { in __ipw2100_tx_process()
2816 e = txq->oldest; in __ipw2100_tx_process()
2821 descriptors_used = tbd->num_fragments; in __ipw2100_tx_process()
2822 frag_num = tbd->num_fragments - 1; in __ipw2100_tx_process()
2823 e = txq->oldest + frag_num; in __ipw2100_tx_process()
2824 e %= txq->entries; in __ipw2100_tx_process()
2829 priv->net_dev->name); in __ipw2100_tx_process()
2837 read_register(priv->net_dev, IPW_MEM_HOST_SHARED_TX_QUEUE_READ_INDEX, in __ipw2100_tx_process()
2839 read_register(priv->net_dev, IPW_MEM_HOST_SHARED_TX_QUEUE_WRITE_INDEX, in __ipw2100_tx_process()
2841 if (w != txq->next) in __ipw2100_tx_process()
2843 priv->net_dev->name); in __ipw2100_tx_process()
2846 * txq->next is the index of the last packet written txq->oldest is in __ipw2100_tx_process()
2855 * ===>| s---->|=============== in __ipw2100_tx_process()
2858 * r---->| in __ipw2100_tx_process()
2861 * w - updated by driver in __ipw2100_tx_process()
2862 * r - updated by firmware in __ipw2100_tx_process()
2863 * s - start of oldest BD entry (txq->oldest) in __ipw2100_tx_process()
2864 * e - end of oldest BD entry in __ipw2100_tx_process()
2868 IPW_DEBUG_TX("exit - no processed packets ready to release.\n"); in __ipw2100_tx_process()
2873 DEC_STAT(&priv->fw_pend_stat); in __ipw2100_tx_process()
2877 i = txq->oldest; in __ipw2100_tx_process()
2878 IPW_DEBUG_TX("TX%d V=%p P=%04X T=%04X L=%d\n", i, in __ipw2100_tx_process()
2879 &txq->drv[i], in __ipw2100_tx_process()
2880 (u32) (txq->nic + i * sizeof(struct ipw2100_bd)), in __ipw2100_tx_process()
2881 txq->drv[i].host_addr, txq->drv[i].buf_length); in __ipw2100_tx_process()
2883 if (packet->type == DATA) { in __ipw2100_tx_process()
2884 i = (i + 1) % txq->entries; in __ipw2100_tx_process()
2886 IPW_DEBUG_TX("TX%d V=%p P=%04X T=%04X L=%d\n", i, in __ipw2100_tx_process()
2887 &txq->drv[i], in __ipw2100_tx_process()
2888 (u32) (txq->nic + i * in __ipw2100_tx_process()
2890 (u32) txq->drv[i].host_addr, in __ipw2100_tx_process()
2891 txq->drv[i].buf_length); in __ipw2100_tx_process()
2896 switch (packet->type) { in __ipw2100_tx_process()
2898 if (txq->drv[txq->oldest].status.info.fields.txType != 0) in __ipw2100_tx_process()
2902 priv->net_dev->name, txq->oldest, packet->index); in __ipw2100_tx_process()
2906 tbd = &txq->drv[(packet->index + 1 + i) % txq->entries]; in __ipw2100_tx_process()
2908 IPW_DEBUG_TX("TX%d P=%08x L=%d\n", in __ipw2100_tx_process()
2909 (packet->index + 1 + i) % txq->entries, in __ipw2100_tx_process()
2910 tbd->host_addr, tbd->buf_length); in __ipw2100_tx_process()
2912 dma_unmap_single(&priv->pci_dev->dev, tbd->host_addr, in __ipw2100_tx_process()
2913 tbd->buf_length, DMA_TO_DEVICE); in __ipw2100_tx_process()
2916 libipw_txb_free(packet->info.d_struct.txb); in __ipw2100_tx_process()
2917 packet->info.d_struct.txb = NULL; in __ipw2100_tx_process()
2919 list_add_tail(element, &priv->tx_free_list); in __ipw2100_tx_process()
2920 INC_STAT(&priv->tx_free_stat); in __ipw2100_tx_process()
2922 /* We have a free slot in the Tx queue, so wake up the in __ipw2100_tx_process()
2924 if (priv->status & STATUS_ASSOCIATED) in __ipw2100_tx_process()
2925 netif_wake_queue(priv->net_dev); in __ipw2100_tx_process()
2929 netif_trans_update(priv->net_dev); in __ipw2100_tx_process()
2934 if (txq->drv[txq->oldest].status.info.fields.txType != 1) in __ipw2100_tx_process()
2938 priv->net_dev->name, txq->oldest, packet->index); in __ipw2100_tx_process()
2941 if (packet->info.c_struct.cmd->host_command_reg < in __ipw2100_tx_process()
2944 command_types[packet->info.c_struct.cmd-> in __ipw2100_tx_process()
2946 packet->info.c_struct.cmd-> in __ipw2100_tx_process()
2948 packet->info.c_struct.cmd->cmd_status_reg); in __ipw2100_tx_process()
2951 list_add_tail(element, &priv->msg_free_list); in __ipw2100_tx_process()
2952 INC_STAT(&priv->msg_free_stat); in __ipw2100_tx_process()
2957 txq->oldest = (e + 1) % txq->entries; in __ipw2100_tx_process()
2959 txq->available += descriptors_used; in __ipw2100_tx_process()
2960 SET_STAT(&priv->txq_stat, txq->available); in __ipw2100_tx_process()
2963 jiffies - packet->jiffy_start); in __ipw2100_tx_process()
2965 return (!list_empty(&priv->fw_pend_list)); in __ipw2100_tx_process()
2978 priv->net_dev->name, i); in __ipw2100_tx_complete()
2986 struct ipw2100_bd_queue *txq = &priv->tx_queue; in ipw2100_tx_send_commands()
2988 int next = txq->next; in ipw2100_tx_send_commands()
2990 while (!list_empty(&priv->msg_pend_list)) { in ipw2100_tx_send_commands()
2997 if (txq->available <= 3) { in ipw2100_tx_send_commands()
3002 element = priv->msg_pend_list.next; in ipw2100_tx_send_commands()
3004 DEC_STAT(&priv->msg_pend_stat); in ipw2100_tx_send_commands()
3009 &txq->drv[txq->next], in ipw2100_tx_send_commands()
3010 (u32) (txq->nic + txq->next * in ipw2100_tx_send_commands()
3013 packet->index = txq->next; in ipw2100_tx_send_commands()
3015 tbd = &txq->drv[txq->next]; in ipw2100_tx_send_commands()
3018 tbd->host_addr = packet->info.c_struct.cmd_phys; in ipw2100_tx_send_commands()
3019 tbd->buf_length = sizeof(struct ipw2100_cmd_header); in ipw2100_tx_send_commands()
3022 tbd->num_fragments = 1; in ipw2100_tx_send_commands()
3023 tbd->status.info.field = in ipw2100_tx_send_commands()
3028 txq->next++; in ipw2100_tx_send_commands()
3029 txq->next %= txq->entries; in ipw2100_tx_send_commands()
3030 txq->available--; in ipw2100_tx_send_commands()
3031 DEC_STAT(&priv->txq_stat); in ipw2100_tx_send_commands()
3033 list_add_tail(element, &priv->fw_pend_list); in ipw2100_tx_send_commands()
3034 INC_STAT(&priv->fw_pend_stat); in ipw2100_tx_send_commands()
3037 if (txq->next != next) { in ipw2100_tx_send_commands()
3041 write_register(priv->net_dev, in ipw2100_tx_send_commands()
3043 txq->next); in ipw2100_tx_send_commands()
3055 struct ipw2100_bd_queue *txq = &priv->tx_queue; in ipw2100_tx_send_data()
3057 int next = txq->next; in ipw2100_tx_send_data()
3062 while (!list_empty(&priv->tx_pend_list)) { in ipw2100_tx_send_data()
3069 element = priv->tx_pend_list.next; in ipw2100_tx_send_data()
3072 if (unlikely(1 + packet->info.d_struct.txb->nr_frags > in ipw2100_tx_send_data()
3078 priv->net_dev->name); in ipw2100_tx_send_data()
3081 if (txq->available <= 3 + packet->info.d_struct.txb->nr_frags) { in ipw2100_tx_send_data()
3087 DEC_STAT(&priv->tx_pend_stat); in ipw2100_tx_send_data()
3089 tbd = &txq->drv[txq->next]; in ipw2100_tx_send_data()
3091 packet->index = txq->next; in ipw2100_tx_send_data()
3093 ipw_hdr = packet->info.d_struct.data; in ipw2100_tx_send_data()
3094 hdr = (struct libipw_hdr_3addr *)packet->info.d_struct.txb-> in ipw2100_tx_send_data()
3095 fragments[0]->data; in ipw2100_tx_send_data()
3097 if (priv->ieee->iw_mode == IW_MODE_INFRA) { in ipw2100_tx_send_data()
3100 memcpy(ipw_hdr->src_addr, hdr->addr2, ETH_ALEN); in ipw2100_tx_send_data()
3101 memcpy(ipw_hdr->dst_addr, hdr->addr3, ETH_ALEN); in ipw2100_tx_send_data()
3102 } else if (priv->ieee->iw_mode == IW_MODE_ADHOC) { in ipw2100_tx_send_data()
3105 memcpy(ipw_hdr->src_addr, hdr->addr2, ETH_ALEN); in ipw2100_tx_send_data()
3106 memcpy(ipw_hdr->dst_addr, hdr->addr1, ETH_ALEN); in ipw2100_tx_send_data()
3109 ipw_hdr->host_command_reg = SEND; in ipw2100_tx_send_data()
3110 ipw_hdr->host_command_reg1 = 0; in ipw2100_tx_send_data()
3113 ipw_hdr->needs_encryption = 0; in ipw2100_tx_send_data()
3114 ipw_hdr->encrypted = packet->info.d_struct.txb->encrypted; in ipw2100_tx_send_data()
3115 if (packet->info.d_struct.txb->nr_frags > 1) in ipw2100_tx_send_data()
3116 ipw_hdr->fragment_size = in ipw2100_tx_send_data()
3117 packet->info.d_struct.txb->frag_size - in ipw2100_tx_send_data()
3120 ipw_hdr->fragment_size = 0; in ipw2100_tx_send_data()
3122 tbd->host_addr = packet->info.d_struct.data_phys; in ipw2100_tx_send_data()
3123 tbd->buf_length = sizeof(struct ipw2100_data_header); in ipw2100_tx_send_data()
3124 tbd->num_fragments = 1 + packet->info.d_struct.txb->nr_frags; in ipw2100_tx_send_data()
3125 tbd->status.info.field = in ipw2100_tx_send_data()
3128 txq->next++; in ipw2100_tx_send_data()
3129 txq->next %= txq->entries; in ipw2100_tx_send_data()
3131 IPW_DEBUG_TX("data header tbd TX%d P=%08x L=%d\n", in ipw2100_tx_send_data()
3132 packet->index, tbd->host_addr, tbd->buf_length); in ipw2100_tx_send_data()
3134 if (packet->info.d_struct.txb->nr_frags > 1) in ipw2100_tx_send_data()
3135 IPW_DEBUG_FRAG("fragment Tx: %d frames\n", in ipw2100_tx_send_data()
3136 packet->info.d_struct.txb->nr_frags); in ipw2100_tx_send_data()
3139 for (i = 0; i < packet->info.d_struct.txb->nr_frags; i++) { in ipw2100_tx_send_data()
3140 tbd = &txq->drv[txq->next]; in ipw2100_tx_send_data()
3141 if (i == packet->info.d_struct.txb->nr_frags - 1) in ipw2100_tx_send_data()
3142 tbd->status.info.field = in ipw2100_tx_send_data()
3146 tbd->status.info.field = in ipw2100_tx_send_data()
3150 tbd->buf_length = packet->info.d_struct.txb-> in ipw2100_tx_send_data()
3151 fragments[i]->len - LIBIPW_3ADDR_LEN; in ipw2100_tx_send_data()
3153 tbd->host_addr = dma_map_single(&priv->pci_dev->dev, in ipw2100_tx_send_data()
3154 packet->info.d_struct. in ipw2100_tx_send_data()
3155 txb->fragments[i]->data + in ipw2100_tx_send_data()
3157 tbd->buf_length, in ipw2100_tx_send_data()
3159 if (dma_mapping_error(&priv->pci_dev->dev, tbd->host_addr)) { in ipw2100_tx_send_data()
3164 IPW_DEBUG_TX("data frag tbd TX%d P=%08x L=%d\n", in ipw2100_tx_send_data()
3165 txq->next, tbd->host_addr, in ipw2100_tx_send_data()
3166 tbd->buf_length); in ipw2100_tx_send_data()
3168 dma_sync_single_for_device(&priv->pci_dev->dev, in ipw2100_tx_send_data()
3169 tbd->host_addr, in ipw2100_tx_send_data()
3170 tbd->buf_length, in ipw2100_tx_send_data()
3173 txq->next++; in ipw2100_tx_send_data()
3174 txq->next %= txq->entries; in ipw2100_tx_send_data()
3177 txq->available -= 1 + packet->info.d_struct.txb->nr_frags; in ipw2100_tx_send_data()
3178 SET_STAT(&priv->txq_stat, txq->available); in ipw2100_tx_send_data()
3180 list_add_tail(element, &priv->fw_pend_list); in ipw2100_tx_send_data()
3181 INC_STAT(&priv->fw_pend_stat); in ipw2100_tx_send_data()
3184 if (txq->next != next) { in ipw2100_tx_send_data()
3187 write_register(priv->net_dev, in ipw2100_tx_send_data()
3189 txq->next); in ipw2100_tx_send_data()
3196 struct net_device *dev = priv->net_dev; in ipw2100_irq_tasklet()
3200 spin_lock_irqsave(&priv->low_lock, flags); in ipw2100_irq_tasklet()
3205 IPW_DEBUG_ISR("enter - INTA: 0x%08lX\n", in ipw2100_irq_tasklet()
3208 priv->in_isr++; in ipw2100_irq_tasklet()
3209 priv->interrupts++; in ipw2100_irq_tasklet()
3220 priv->inta_other++; in ipw2100_irq_tasklet()
3223 read_nic_dword(dev, IPW_NIC_FATAL_ERROR, &priv->fatal_error); in ipw2100_irq_tasklet()
3225 priv->net_dev->name, priv->fatal_error); in ipw2100_irq_tasklet()
3227 read_nic_dword(dev, IPW_ERROR_ADDR(priv->fatal_error), &tmp); in ipw2100_irq_tasklet()
3229 priv->net_dev->name, tmp); in ipw2100_irq_tasklet()
3238 priv->inta_other++; in ipw2100_irq_tasklet()
3245 priv->rx_interrupts++; in ipw2100_irq_tasklet()
3254 IPW_DEBUG_ISR("TX interrupt\n"); in ipw2100_irq_tasklet()
3256 priv->tx_interrupts++; in ipw2100_irq_tasklet()
3266 IPW_DEBUG_ISR("TX complete\n"); in ipw2100_irq_tasklet()
3267 priv->inta_other++; in ipw2100_irq_tasklet()
3275 priv->inta_other++; in ipw2100_irq_tasklet()
3281 priv->inta_other++; in ipw2100_irq_tasklet()
3296 priv->inta_other++; in ipw2100_irq_tasklet()
3302 priv->inta_other++; in ipw2100_irq_tasklet()
3307 priv->in_isr--; in ipw2100_irq_tasklet()
3310 spin_unlock_irqrestore(&priv->low_lock, flags); in ipw2100_irq_tasklet()
3323 spin_lock(&priv->low_lock); in ipw2100_interrupt()
3329 if (!(priv->status & STATUS_INT_ENABLED)) { in ipw2100_interrupt()
3334 read_register(priv->net_dev, IPW_REG_INTA_MASK, &inta_mask); in ipw2100_interrupt()
3335 read_register(priv->net_dev, IPW_REG_INTA, &inta); in ipw2100_interrupt()
3352 * work tasklet, so if another part of the code re-enables the in ipw2100_interrupt()
3356 tasklet_schedule(&priv->irq_tasklet); in ipw2100_interrupt()
3357 spin_unlock(&priv->low_lock); in ipw2100_interrupt()
3361 spin_unlock(&priv->low_lock); in ipw2100_interrupt()
3373 spin_lock_irqsave(&priv->low_lock, flags); in ipw2100_tx()
3375 if (!(priv->status & STATUS_ASSOCIATED)) { in ipw2100_tx()
3377 priv->net_dev->stats.tx_carrier_errors++; in ipw2100_tx()
3382 if (list_empty(&priv->tx_free_list)) in ipw2100_tx()
3385 element = priv->tx_free_list.next; in ipw2100_tx()
3388 packet->info.d_struct.txb = txb; in ipw2100_tx()
3390 IPW_DEBUG_TX("Sending fragment (%d bytes):\n", txb->fragments[0]->len); in ipw2100_tx()
3391 printk_buf(IPW_DL_TX, txb->fragments[0]->data, txb->fragments[0]->len); in ipw2100_tx()
3393 packet->jiffy_start = jiffies; in ipw2100_tx()
3396 DEC_STAT(&priv->tx_free_stat); in ipw2100_tx()
3398 list_add_tail(element, &priv->tx_pend_list); in ipw2100_tx()
3399 INC_STAT(&priv->tx_pend_stat); in ipw2100_tx()
3403 spin_unlock_irqrestore(&priv->low_lock, flags); in ipw2100_tx()
3408 spin_unlock_irqrestore(&priv->low_lock, flags); in ipw2100_tx()
3414 int i, j, err = -EINVAL; in ipw2100_msg_allocate()
3418 priv->msg_buffers = in ipw2100_msg_allocate()
3422 if (!priv->msg_buffers) in ipw2100_msg_allocate()
3423 return -ENOMEM; in ipw2100_msg_allocate()
3426 v = dma_alloc_coherent(&priv->pci_dev->dev, in ipw2100_msg_allocate()
3432 "buffers.\n", priv->net_dev->name); in ipw2100_msg_allocate()
3433 err = -ENOMEM; in ipw2100_msg_allocate()
3437 priv->msg_buffers[i].type = COMMAND; in ipw2100_msg_allocate()
3438 priv->msg_buffers[i].info.c_struct.cmd = in ipw2100_msg_allocate()
3440 priv->msg_buffers[i].info.c_struct.cmd_phys = p; in ipw2100_msg_allocate()
3447 dma_free_coherent(&priv->pci_dev->dev, in ipw2100_msg_allocate()
3449 priv->msg_buffers[j].info.c_struct.cmd, in ipw2100_msg_allocate()
3450 priv->msg_buffers[j].info.c_struct.cmd_phys); in ipw2100_msg_allocate()
3453 kfree(priv->msg_buffers); in ipw2100_msg_allocate()
3454 priv->msg_buffers = NULL; in ipw2100_msg_allocate()
3463 INIT_LIST_HEAD(&priv->msg_free_list); in ipw2100_msg_initialize()
3464 INIT_LIST_HEAD(&priv->msg_pend_list); in ipw2100_msg_initialize()
3467 list_add_tail(&priv->msg_buffers[i].list, &priv->msg_free_list); in ipw2100_msg_initialize()
3468 SET_STAT(&priv->msg_free_stat, i); in ipw2100_msg_initialize()
3477 if (!priv->msg_buffers) in ipw2100_msg_free()
3481 dma_free_coherent(&priv->pci_dev->dev, in ipw2100_msg_free()
3483 priv->msg_buffers[i].info.c_struct.cmd, in ipw2100_msg_free()
3484 priv->msg_buffers[i].info.c_struct.cmd_phys); in ipw2100_msg_free()
3487 kfree(priv->msg_buffers); in ipw2100_msg_free()
3488 priv->msg_buffers = NULL; in ipw2100_msg_free()
3508 return out - buf; in pci_show()
3517 return sprintf(buf, "0x%08x\n", (int)p->config); in cfg_show()
3526 return sprintf(buf, "0x%08x\n", (int)p->status); in status_show()
3535 return sprintf(buf, "0x%08x\n", (int)p->capability); in capability_show()
3563 IPW2100_ORD(STAT_TX_HOST_REQUESTS, "requested Host Tx's (MSDU)"),
3565 "successful Host Tx's (MSDU)"),
3567 "successful Directed Tx's (MSDU)"),
3569 "successful Directed Tx's (MSDU) @ 1MB"),
3571 "successful Directed Tx's (MSDU) @ 2MB"),
3573 "successful Directed Tx's (MSDU) @ 5_5MB"),
3575 "successful Directed Tx's (MSDU) @ 11MB"),
3577 "successful Non_Directed Tx's (MSDU) @ 1MB"),
3579 "successful Non_Directed Tx's (MSDU) @ 2MB"),
3581 "successful Non_Directed Tx's (MSDU) @ 5.5MB"),
3583 "successful Non_Directed Tx's (MSDU) @ 11MB"),
3584 IPW2100_ORD(STAT_NULL_DATA, "successful NULL data Tx's"),
3585 IPW2100_ORD(STAT_TX_RTS, "successful Tx RTS"),
3586 IPW2100_ORD(STAT_TX_CTS, "successful Tx CTS"),
3587 IPW2100_ORD(STAT_TX_ACK, "successful Tx ACK"),
3588 IPW2100_ORD(STAT_TX_ASSN, "successful Association Tx's"),
3590 "successful Association response Tx's"),
3592 "successful Reassociation Tx's"),
3594 "successful Reassociation response Tx's"),
3599 IPW2100_ORD(STAT_TX_BEACON, "tx beacon"),
3600 IPW2100_ORD(STAT_TX_ATIM, "Tx ATIM"),
3602 "successful Disassociation TX"),
3603 IPW2100_ORD(STAT_TX_AUTH, "successful Authentication Tx"),
3605 "successful Deauthentication TX"),
3607 "Total successful Tx data bytes"),
3608 IPW2100_ORD(STAT_TX_RETRIES, "Tx retries"),
3609 IPW2100_ORD(STAT_TX_RETRY1, "Tx retries at 1MBPS"),
3610 IPW2100_ORD(STAT_TX_RETRY2, "Tx retries at 2MBPS"),
3611 IPW2100_ORD(STAT_TX_RETRY5_5, "Tx retries at 5.5MBPS"),
3612 IPW2100_ORD(STAT_TX_RETRY11, "Tx retries at 11MBPS"),
3613 IPW2100_ORD(STAT_TX_FAILURES, "Tx Failures"),
3619 IPW2100_ORD(STAT_TX_ERR_ACK, "tx err due to acks"),
3681 "rx frames dropped due to non-sequential fragment"),
3701 "current calculation of % missed tx retries"),
3718 "reassociation: no probe response or TX on hop"),
3720 "reassociation: poor tx/rx quality"),
3722 "reassociation: tx/rx quality (excessive AP load"),
3733 IPW2100_ORD(POWER_MGMT_MODE, "Power mode - 0=CAM, 1=PSP"),
3744 "current radio freq lower digits - channel ID"),
3747 IPW2100_ORD(CURRENT_TX_RATE, "current tx rate"),
3748 IPW2100_ORD(SUPPORTED_RATES, "supported tx rates"),
3750 IPW2100_ORD(BASIC_RATES, "basic tx rates"),
3751 IPW2100_ORD(NIC_HIGHEST_RATE, "NIC highest tx rate"),
3752 IPW2100_ORD(AP_HIGHEST_RATE, "AP highest tx rate"),
3780 struct net_device *dev = priv->net_dev; in registers_show()
3792 return out - buf; in registers_show()
3801 struct net_device *dev = priv->net_dev; in hardware_show()
3833 return out - buf; in hardware_show()
3842 struct net_device *dev = priv->net_dev; in memory_show()
3853 while (len < PAGE_SIZE - 128 && loop < 0x30000) { in memory_show()
3855 if (priv->snapshot[0]) in memory_show()
3863 if (priv->dump_raw) in memory_show()
3899 struct net_device *dev = priv->net_dev; in memory_store()
3902 (void)dev; /* kill unused-var warning for debug-only code */ in memory_store()
3910 dev->name); in memory_store()
3911 priv->dump_raw = 1; in memory_store()
3916 dev->name); in memory_store()
3917 priv->dump_raw = 0; in memory_store()
3920 IPW_DEBUG_INFO("%s: Resetting firmware snapshot.\n", dev->name); in memory_store()
3925 "reset = clear memory snapshot\n", dev->name); in memory_store()
3941 if (priv->status & STATUS_RF_KILL_MASK) in ordinals_show()
3948 while (len < PAGE_SIZE - 128 && loop < ARRAY_SIZE(ord_data)) { in ordinals_show()
3974 out += sprintf(out, "interrupts: %d {tx: %d, rx: %d, other: %d}\n", in stats_show()
3975 priv->interrupts, priv->tx_interrupts, in stats_show()
3976 priv->rx_interrupts, priv->inta_other); in stats_show()
3977 out += sprintf(out, "firmware resets: %d\n", priv->resets); in stats_show()
3978 out += sprintf(out, "firmware hangs: %d\n", priv->hangs); in stats_show()
3981 priv->snapshot[0] ? "YES" : "NO"); in stats_show()
3984 return out - buf; in stats_show()
3993 if (mode == priv->ieee->iw_mode) in ipw2100_switch_mode()
3999 priv->net_dev->name, err); in ipw2100_switch_mode()
4005 priv->net_dev->type = ARPHRD_ETHER; in ipw2100_switch_mode()
4008 priv->net_dev->type = ARPHRD_ETHER; in ipw2100_switch_mode()
4012 priv->last_mode = priv->ieee->iw_mode; in ipw2100_switch_mode()
4013 priv->net_dev->type = ARPHRD_IEEE80211_RADIOTAP; in ipw2100_switch_mode()
4018 priv->ieee->iw_mode = mode; in ipw2100_switch_mode()
4026 printk(KERN_INFO "%s: Resetting on mode change.\n", priv->net_dev->name); in ipw2100_switch_mode()
4027 priv->reset_backoff = 0; in ipw2100_switch_mode()
4039 #define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) in internals_show()
4041 if (priv->status & STATUS_ASSOCIATED) in internals_show()
4043 ktime_get_boottime_seconds() - priv->connect_start); in internals_show()
4047 DUMP_VAR(ieee->crypt_info.crypt[priv->ieee->crypt_info.tx_keyidx], "p"); in internals_show()
4054 (unsigned long)priv->last_rtc); in internals_show()
4079 DUMP_VAR(ieee->scans, "d"); in internals_show()
4098 if (priv->status & STATUS_RF_KILL_MASK) in bssinfo_show()
4127 return out - buf; in bssinfo_show()
4162 if (priv->fatal_error) in fatal_error_show()
4163 out += sprintf(out, "0x%08X\n", priv->fatal_error); in fatal_error_show()
4168 if (!priv->fatal_errors[(priv->fatal_index - i) % in fatal_error_show()
4173 priv->fatal_errors[(priv->fatal_index - i) % in fatal_error_show()
4177 return out - buf; in fatal_error_show()
4195 return sprintf(buf, "%d\n", priv->ieee->scan_age); in scan_age_show()
4202 struct net_device *dev = priv->net_dev; in scan_age_store()
4206 (void)dev; /* kill unused-var warning for debug-only code */ in scan_age_store()
4212 IPW_DEBUG_INFO("%s: user supplied invalid value.\n", dev->name); in scan_age_store()
4214 priv->ieee->scan_age = val; in scan_age_store()
4215 IPW_DEBUG_INFO("set scan_age = %u\n", priv->ieee->scan_age); in scan_age_store()
4227 /* 0 - RF kill not enabled in rf_kill_show()
4228 1 - SW based RF kill active (sysfs) in rf_kill_show()
4229 2 - HW based RF kill active in rf_kill_show()
4230 3 - Both HW and SW baed RF kill active */ in rf_kill_show()
4232 int val = ((priv->status & STATUS_RF_KILL_SW) ? 0x1 : 0x0) | in rf_kill_show()
4240 (priv->status & STATUS_RF_KILL_SW ? 1 : 0)) in ipw_radio_kill_sw()
4246 mutex_lock(&priv->action_mutex); in ipw_radio_kill_sw()
4249 priv->status |= STATUS_RF_KILL_SW; in ipw_radio_kill_sw()
4252 priv->status &= ~STATUS_RF_KILL_SW; in ipw_radio_kill_sw()
4254 IPW_DEBUG_RF_KILL("Can not turn radio back on - " in ipw_radio_kill_sw()
4257 priv->stop_rf_kill = 0; in ipw_radio_kill_sw()
4258 mod_delayed_work(system_wq, &priv->rf_kill, in ipw_radio_kill_sw()
4264 mutex_unlock(&priv->action_mutex); in ipw_radio_kill_sw()
4302 struct ipw2100_status_queue *q = &priv->status_queue; in status_queue_allocate()
4306 q->size = entries * sizeof(struct ipw2100_status); in status_queue_allocate()
4307 q->drv = dma_alloc_coherent(&priv->pci_dev->dev, q->size, &q->nic, in status_queue_allocate()
4309 if (!q->drv) { in status_queue_allocate()
4311 return -ENOMEM; in status_queue_allocate()
4323 if (priv->status_queue.drv) { in status_queue_free()
4324 dma_free_coherent(&priv->pci_dev->dev, in status_queue_free()
4325 priv->status_queue.size, in status_queue_free()
4326 priv->status_queue.drv, in status_queue_free()
4327 priv->status_queue.nic); in status_queue_free()
4328 priv->status_queue.drv = NULL; in status_queue_free()
4341 q->entries = entries; in bd_queue_allocate()
4342 q->size = entries * sizeof(struct ipw2100_bd); in bd_queue_allocate()
4343 q->drv = dma_alloc_coherent(&priv->pci_dev->dev, q->size, &q->nic, in bd_queue_allocate()
4345 if (!q->drv) { in bd_queue_allocate()
4348 return -ENOMEM; in bd_queue_allocate()
4363 if (q->drv) { in bd_queue_free()
4364 dma_free_coherent(&priv->pci_dev->dev, q->size, q->drv, in bd_queue_free()
4365 q->nic); in bd_queue_free()
4366 q->drv = NULL; in bd_queue_free()
4378 IPW_DEBUG_INFO("initializing bd queue at virt=%p, phys=%08x\n", q->drv, in bd_queue_initialize()
4379 (u32) q->nic); in bd_queue_initialize()
4381 write_register(priv->net_dev, base, q->nic); in bd_queue_initialize()
4382 write_register(priv->net_dev, size, q->entries); in bd_queue_initialize()
4383 write_register(priv->net_dev, r, q->oldest); in bd_queue_initialize()
4384 write_register(priv->net_dev, w, q->next); in bd_queue_initialize()
4391 priv->stop_rf_kill = 1; in ipw2100_kill_works()
4392 priv->stop_hang_check = 1; in ipw2100_kill_works()
4393 cancel_delayed_work_sync(&priv->reset_work); in ipw2100_kill_works()
4394 cancel_delayed_work_sync(&priv->security_work); in ipw2100_kill_works()
4395 cancel_delayed_work_sync(&priv->wx_event_work); in ipw2100_kill_works()
4396 cancel_delayed_work_sync(&priv->hang_check); in ipw2100_kill_works()
4397 cancel_delayed_work_sync(&priv->rf_kill); in ipw2100_kill_works()
4398 cancel_delayed_work_sync(&priv->scan_event); in ipw2100_kill_works()
4409 err = bd_queue_allocate(priv, &priv->tx_queue, TX_QUEUE_LENGTH); in ipw2100_tx_allocate()
4412 priv->net_dev->name); in ipw2100_tx_allocate()
4416 priv->tx_buffers = kmalloc_array(TX_PENDED_QUEUE_LENGTH, in ipw2100_tx_allocate()
4419 if (!priv->tx_buffers) { in ipw2100_tx_allocate()
4420 bd_queue_free(priv, &priv->tx_queue); in ipw2100_tx_allocate()
4421 return -ENOMEM; in ipw2100_tx_allocate()
4425 v = dma_alloc_coherent(&priv->pci_dev->dev, in ipw2100_tx_allocate()
4430 ": %s: PCI alloc failed for tx " "buffers.\n", in ipw2100_tx_allocate()
4431 priv->net_dev->name); in ipw2100_tx_allocate()
4432 err = -ENOMEM; in ipw2100_tx_allocate()
4436 priv->tx_buffers[i].type = DATA; in ipw2100_tx_allocate()
4437 priv->tx_buffers[i].info.d_struct.data = in ipw2100_tx_allocate()
4439 priv->tx_buffers[i].info.d_struct.data_phys = p; in ipw2100_tx_allocate()
4440 priv->tx_buffers[i].info.d_struct.txb = NULL; in ipw2100_tx_allocate()
4447 dma_free_coherent(&priv->pci_dev->dev, in ipw2100_tx_allocate()
4449 priv->tx_buffers[j].info.d_struct.data, in ipw2100_tx_allocate()
4450 priv->tx_buffers[j].info.d_struct.data_phys); in ipw2100_tx_allocate()
4453 kfree(priv->tx_buffers); in ipw2100_tx_allocate()
4454 priv->tx_buffers = NULL; in ipw2100_tx_allocate()
4468 INIT_LIST_HEAD(&priv->fw_pend_list); in ipw2100_tx_initialize()
4469 INIT_STAT(&priv->fw_pend_stat); in ipw2100_tx_initialize()
4474 INIT_LIST_HEAD(&priv->tx_pend_list); in ipw2100_tx_initialize()
4475 INIT_LIST_HEAD(&priv->tx_free_list); in ipw2100_tx_initialize()
4476 INIT_STAT(&priv->tx_pend_stat); in ipw2100_tx_initialize()
4477 INIT_STAT(&priv->tx_free_stat); in ipw2100_tx_initialize()
4482 if (priv->tx_buffers[i].info.d_struct.txb) { in ipw2100_tx_initialize()
4483 libipw_txb_free(priv->tx_buffers[i].info.d_struct. in ipw2100_tx_initialize()
4485 priv->tx_buffers[i].info.d_struct.txb = NULL; in ipw2100_tx_initialize()
4488 list_add_tail(&priv->tx_buffers[i].list, &priv->tx_free_list); in ipw2100_tx_initialize()
4491 SET_STAT(&priv->tx_free_stat, i); in ipw2100_tx_initialize()
4493 priv->tx_queue.oldest = 0; in ipw2100_tx_initialize()
4494 priv->tx_queue.available = priv->tx_queue.entries; in ipw2100_tx_initialize()
4495 priv->tx_queue.next = 0; in ipw2100_tx_initialize()
4496 INIT_STAT(&priv->txq_stat); in ipw2100_tx_initialize()
4497 SET_STAT(&priv->txq_stat, priv->tx_queue.available); in ipw2100_tx_initialize()
4499 bd_queue_initialize(priv, &priv->tx_queue, in ipw2100_tx_initialize()
4515 bd_queue_free(priv, &priv->tx_queue); in ipw2100_tx_free()
4517 if (!priv->tx_buffers) in ipw2100_tx_free()
4521 if (priv->tx_buffers[i].info.d_struct.txb) { in ipw2100_tx_free()
4522 libipw_txb_free(priv->tx_buffers[i].info.d_struct. in ipw2100_tx_free()
4524 priv->tx_buffers[i].info.d_struct.txb = NULL; in ipw2100_tx_free()
4526 if (priv->tx_buffers[i].info.d_struct.data) in ipw2100_tx_free()
4527 dma_free_coherent(&priv->pci_dev->dev, in ipw2100_tx_free()
4529 priv->tx_buffers[i].info.d_struct.data, in ipw2100_tx_free()
4530 priv->tx_buffers[i].info.d_struct.data_phys); in ipw2100_tx_free()
4533 kfree(priv->tx_buffers); in ipw2100_tx_free()
4534 priv->tx_buffers = NULL; in ipw2100_tx_free()
4541 int i, j, err = -EINVAL; in ipw2100_rx_allocate()
4545 err = bd_queue_allocate(priv, &priv->rx_queue, RX_QUEUE_LENGTH); in ipw2100_rx_allocate()
4554 bd_queue_free(priv, &priv->rx_queue); in ipw2100_rx_allocate()
4561 priv->rx_buffers = kmalloc_array(RX_QUEUE_LENGTH, in ipw2100_rx_allocate()
4564 if (!priv->rx_buffers) { in ipw2100_rx_allocate()
4567 bd_queue_free(priv, &priv->rx_queue); in ipw2100_rx_allocate()
4571 return -ENOMEM; in ipw2100_rx_allocate()
4575 struct ipw2100_rx_packet *packet = &priv->rx_buffers[i]; in ipw2100_rx_allocate()
4579 err = -ENOMEM; in ipw2100_rx_allocate()
4584 priv->rx_queue.drv[i].host_addr = packet->dma_addr; in ipw2100_rx_allocate()
4585 priv->rx_queue.drv[i].buf_length = IPW_RX_NIC_BUFFER_LENGTH; in ipw2100_rx_allocate()
4586 priv->status_queue.drv[i].status_fields = 0; in ipw2100_rx_allocate()
4593 dma_unmap_single(&priv->pci_dev->dev, in ipw2100_rx_allocate()
4594 priv->rx_buffers[j].dma_addr, in ipw2100_rx_allocate()
4597 dev_kfree_skb(priv->rx_buffers[j].skb); in ipw2100_rx_allocate()
4600 kfree(priv->rx_buffers); in ipw2100_rx_allocate()
4601 priv->rx_buffers = NULL; in ipw2100_rx_allocate()
4603 bd_queue_free(priv, &priv->rx_queue); in ipw2100_rx_allocate()
4614 priv->rx_queue.oldest = 0; in ipw2100_rx_initialize()
4615 priv->rx_queue.available = priv->rx_queue.entries - 1; in ipw2100_rx_initialize()
4616 priv->rx_queue.next = priv->rx_queue.entries - 1; in ipw2100_rx_initialize()
4618 INIT_STAT(&priv->rxq_stat); in ipw2100_rx_initialize()
4619 SET_STAT(&priv->rxq_stat, priv->rx_queue.available); in ipw2100_rx_initialize()
4621 bd_queue_initialize(priv, &priv->rx_queue, in ipw2100_rx_initialize()
4628 write_register(priv->net_dev, IPW_MEM_HOST_SHARED_RX_STATUS_BASE, in ipw2100_rx_initialize()
4629 priv->status_queue.nic); in ipw2100_rx_initialize()
4640 bd_queue_free(priv, &priv->rx_queue); in ipw2100_rx_free()
4643 if (!priv->rx_buffers) in ipw2100_rx_free()
4647 if (priv->rx_buffers[i].rxp) { in ipw2100_rx_free()
4648 dma_unmap_single(&priv->pci_dev->dev, in ipw2100_rx_free()
4649 priv->rx_buffers[i].dma_addr, in ipw2100_rx_free()
4652 dev_kfree_skb(priv->rx_buffers[i].skb); in ipw2100_rx_free()
4656 kfree(priv->rx_buffers); in ipw2100_rx_free()
4657 priv->rx_buffers = NULL; in ipw2100_rx_free()
4672 return -EIO; in ipw2100_read_mac_address()
4675 eth_hw_addr_set(priv->net_dev, addr); in ipw2100_read_mac_address()
4676 IPW_DEBUG_INFO("card MAC is %pM\n", priv->net_dev->dev_addr); in ipw2100_read_mac_address()
4700 if (priv->config & CFG_CUSTOM_MAC) { in ipw2100_set_mac_address()
4701 memcpy(cmd.host_command_parameters, priv->mac_addr, ETH_ALEN); in ipw2100_set_mac_address()
4702 eth_hw_addr_set(priv->net_dev, priv->mac_addr); in ipw2100_set_mac_address()
4704 memcpy(cmd.host_command_parameters, priv->net_dev->dev_addr, in ipw2100_set_mac_address()
4733 port_type == IPW_IBSS ? "Ad-Hoc" : "Managed"); in ipw2100_set_port_type()
4740 priv->net_dev->name, err); in ipw2100_set_port_type()
4769 if (priv->ieee->iw_mode == IW_MODE_INFRA) in ipw2100_set_channel()
4774 return -EINVAL; in ipw2100_set_channel()
4789 priv->config |= CFG_STATIC_CHANNEL; in ipw2100_set_channel()
4791 priv->config &= ~CFG_STATIC_CHANNEL; in ipw2100_set_channel()
4793 priv->channel = channel; in ipw2100_set_channel()
4822 if (priv->ieee->iw_mode == IW_MODE_ADHOC) in ipw2100_system_config()
4828 if (!(priv->config & CFG_LONG_PREAMBLE)) in ipw2100_system_config()
4883 /* Set BASIC TX Rate first */ in ipw2100_set_tx_rates()
4886 /* Set TX Rate */ in ipw2100_set_tx_rates()
4890 /* Set MSDU TX Rate */ in ipw2100_set_tx_rates()
4900 priv->tx_rates = rate; in ipw2100_set_tx_rates()
4921 priv->power_mode = IPW_POWER_LEVEL(priv->power_mode); in ipw2100_set_power_mode()
4923 priv->power_mode = IPW_POWER_ENABLED | power_level; in ipw2100_set_power_mode()
4926 if (priv->port_type == IBSS && priv->adhoc_power != DFTL_IBSS_TX_POWER) { in ipw2100_set_power_mode()
4929 cmd.host_command_parameters[0] = (u32) priv->adhoc_power; in ipw2100_set_power_mode()
4958 priv->rts_threshold = threshold; in ipw2100_set_rts_threshold()
4998 priv->frag_threshold = threshold;
5019 priv->short_retry_limit = retry; in ipw2100_set_short_retry()
5039 priv->long_retry_limit = retry; in ipw2100_set_long_retry()
5090 * the currently associated AP -- but in the off chance that a future in ipw2100_disassociate_bssid()
5093 memcpy(cmd.host_command_parameters, priv->bssid, ETH_ALEN); in ipw2100_disassociate_bssid()
5130 err = -EIO; in ipw2100_set_wpa_ie()
5164 security->auth_mode = auth_mode; in ipw2100_set_security_information()
5165 security->unicast_using_group = unicast_using_group; in ipw2100_set_security_information()
5170 security->allowed_ciphers = IPW_NONE_CIPHER; in ipw2100_set_security_information()
5173 security->allowed_ciphers = IPW_WEP40_CIPHER | in ipw2100_set_security_information()
5177 security->allowed_ciphers = IPW_WEP40_CIPHER | in ipw2100_set_security_information()
5181 security->allowed_ciphers = IPW_WEP40_CIPHER | in ipw2100_set_security_information()
5185 security->allowed_ciphers = IPW_WEP40_CIPHER | in ipw2100_set_security_information()
5192 security->auth_mode, security->allowed_ciphers, security_level); in ipw2100_set_security_information()
5194 security->replay_counters_number = 0; in ipw2100_set_security_information()
5221 tmp = (tx_power - IPW_TX_POWER_MIN_DBM) * 16 / in ipw2100_set_tx_power()
5222 (IPW_TX_POWER_MAX_DBM - IPW_TX_POWER_MIN_DBM); in ipw2100_set_tx_power()
5226 if (priv->ieee->iw_mode == IW_MODE_ADHOC) in ipw2100_set_tx_power()
5229 priv->tx_power = tx_power; in ipw2100_set_tx_power()
5248 if (priv->ieee->iw_mode == IW_MODE_ADHOC) { in ipw2100_set_ibss_beacon_interval()
5295 return -ENOMEM; in ipw2100_queues_allocate()
5319 priv->net_dev->name, err); in ipw2100_set_wep_flags()
5340 #define WEP_FMT_64 "%02X%02X%02X%02X-%02X"
5341 #define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X"
5346 * ipw2100_set_key() - Set a the wep key
5379 wep_key->idx = idx; in ipw2100_set_key()
5380 wep_key->len = keylen; in ipw2100_set_key()
5383 memcpy(wep_key->key, key, len); in ipw2100_set_key()
5384 memset(wep_key->key + len, 0, keylen - len); in ipw2100_set_key()
5390 priv->net_dev->name, wep_key->idx); in ipw2100_set_key()
5393 priv->net_dev->name, wep_key->idx, wep_key->len, in ipw2100_set_key()
5394 WEP_STR_64(wep_key->key)); in ipw2100_set_key()
5398 priv->net_dev->name, wep_key->idx, wep_key->len, in ipw2100_set_key()
5399 WEP_STR_128(wep_key->key)); in ipw2100_set_key()
5407 priv->net_dev->name, err); in ipw2100_set_key()
5437 return -EINVAL; in ipw2100_set_key_index()
5444 priv->net_dev->name, err); in ipw2100_set_key_index()
5462 if (!(priv->status & STATUS_RUNNING)) in ipw2100_configure_security()
5471 if (!priv->ieee->sec.enabled) { in ipw2100_configure_security()
5477 if (priv->ieee->sec.flags & SEC_AUTH_MODE) { in ipw2100_configure_security()
5478 if (priv->ieee->sec.auth_mode == WLAN_AUTH_SHARED_KEY) in ipw2100_configure_security()
5480 else if (priv->ieee->sec.auth_mode == WLAN_AUTH_LEAP) in ipw2100_configure_security()
5485 if (priv->ieee->sec.flags & SEC_LEVEL) in ipw2100_configure_security()
5486 sec_level = priv->ieee->sec.level; in ipw2100_configure_security()
5489 if (priv->ieee->sec.flags & SEC_UNICAST_GROUP) in ipw2100_configure_security()
5490 use_group = priv->ieee->sec.unicast_uses_group; in ipw2100_configure_security()
5500 if (priv->ieee->sec.enabled) { in ipw2100_configure_security()
5502 if (!(priv->ieee->sec.flags & (1 << i))) { in ipw2100_configure_security()
5503 memset(priv->ieee->sec.keys[i], 0, WEP_KEY_LEN); in ipw2100_configure_security()
5504 priv->ieee->sec.key_sizes[i] = 0; in ipw2100_configure_security()
5507 priv->ieee->sec.keys[i], in ipw2100_configure_security()
5508 priv->ieee->sec. in ipw2100_configure_security()
5515 ipw2100_set_key_index(priv, priv->ieee->crypt_info.tx_keyidx, 1); in ipw2100_configure_security()
5522 priv->ieee->sec. in ipw2100_configure_security()
5527 priv->status &= ~STATUS_SECURITY_UPDATED; in ipw2100_configure_security()
5542 * process this, then update the security settings--which causes in ipw2100_security_work()
5544 if (!(priv->status & STATUS_ASSOCIATED) && in ipw2100_security_work()
5545 priv->status & STATUS_SECURITY_UPDATED) in ipw2100_security_work()
5550 struct libipw_security *sec) in shim__set_security() argument
5555 mutex_lock(&priv->action_mutex); in shim__set_security()
5556 if (!(priv->status & STATUS_INITIALIZED)) in shim__set_security()
5560 if (sec->flags & (1 << i)) { in shim__set_security()
5561 priv->ieee->sec.key_sizes[i] = sec->key_sizes[i]; in shim__set_security()
5562 if (sec->key_sizes[i] == 0) in shim__set_security()
5563 priv->ieee->sec.flags &= ~(1 << i); in shim__set_security()
5565 memcpy(priv->ieee->sec.keys[i], sec->keys[i], in shim__set_security()
5566 sec->key_sizes[i]); in shim__set_security()
5567 if (sec->level == SEC_LEVEL_1) { in shim__set_security()
5568 priv->ieee->sec.flags |= (1 << i); in shim__set_security()
5569 priv->status |= STATUS_SECURITY_UPDATED; in shim__set_security()
5571 priv->ieee->sec.flags &= ~(1 << i); in shim__set_security()
5575 if ((sec->flags & SEC_ACTIVE_KEY) && in shim__set_security()
5576 priv->ieee->sec.active_key != sec->active_key) { in shim__set_security()
5577 priv->ieee->sec.active_key = sec->active_key; in shim__set_security()
5578 priv->ieee->sec.flags |= SEC_ACTIVE_KEY; in shim__set_security()
5579 priv->status |= STATUS_SECURITY_UPDATED; in shim__set_security()
5582 if ((sec->flags & SEC_AUTH_MODE) && in shim__set_security()
5583 (priv->ieee->sec.auth_mode != sec->auth_mode)) { in shim__set_security()
5584 priv->ieee->sec.auth_mode = sec->auth_mode; in shim__set_security()
5585 priv->ieee->sec.flags |= SEC_AUTH_MODE; in shim__set_security()
5586 priv->status |= STATUS_SECURITY_UPDATED; in shim__set_security()
5589 if (sec->flags & SEC_ENABLED && priv->ieee->sec.enabled != sec->enabled) { in shim__set_security()
5590 priv->ieee->sec.flags |= SEC_ENABLED; in shim__set_security()
5591 priv->ieee->sec.enabled = sec->enabled; in shim__set_security()
5592 priv->status |= STATUS_SECURITY_UPDATED; in shim__set_security()
5595 if (sec->flags & SEC_ENCRYPT) in shim__set_security()
5596 priv->ieee->sec.encrypt = sec->encrypt; in shim__set_security()
5598 if (sec->flags & SEC_LEVEL && priv->ieee->sec.level != sec->level) { in shim__set_security()
5599 priv->ieee->sec.level = sec->level; in shim__set_security()
5600 priv->ieee->sec.flags |= SEC_LEVEL; in shim__set_security()
5601 priv->status |= STATUS_SECURITY_UPDATED; in shim__set_security()
5605 priv->ieee->sec.flags & (1 << 8) ? '1' : '0', in shim__set_security()
5606 priv->ieee->sec.flags & (1 << 7) ? '1' : '0', in shim__set_security()
5607 priv->ieee->sec.flags & (1 << 6) ? '1' : '0', in shim__set_security()
5608 priv->ieee->sec.flags & (1 << 5) ? '1' : '0', in shim__set_security()
5609 priv->ieee->sec.flags & (1 << 4) ? '1' : '0', in shim__set_security()
5610 priv->ieee->sec.flags & (1 << 3) ? '1' : '0', in shim__set_security()
5611 priv->ieee->sec.flags & (1 << 2) ? '1' : '0', in shim__set_security()
5612 priv->ieee->sec.flags & (1 << 1) ? '1' : '0', in shim__set_security()
5613 priv->ieee->sec.flags & (1 << 0) ? '1' : '0'); in shim__set_security()
5619 * if (force_update || !(priv->status & STATUS_ASSOCIATED))*/ in shim__set_security()
5620 if (!(priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING))) in shim__set_security()
5623 mutex_unlock(&priv->action_mutex); in shim__set_security()
5638 if (priv->ieee->iw_mode == IW_MODE_MONITOR) { in ipw2100_adapter_setup()
5639 err = ipw2100_set_channel(priv, priv->channel, batch_mode); in ipw2100_adapter_setup()
5651 return -EIO; in ipw2100_adapter_setup()
5657 err = ipw2100_set_port_type(priv, priv->ieee->iw_mode, batch_mode); in ipw2100_adapter_setup()
5661 if (priv->ieee->iw_mode == IW_MODE_ADHOC) { in ipw2100_adapter_setup()
5662 err = ipw2100_set_channel(priv, priv->channel, batch_mode); in ipw2100_adapter_setup()
5671 err = ipw2100_set_tx_rates(priv, priv->tx_rates, batch_mode); in ipw2100_adapter_setup()
5680 err = ipw2100_set_rts_threshold(priv, priv->rts_threshold); in ipw2100_adapter_setup()
5684 if (priv->config & CFG_STATIC_BSSID) in ipw2100_adapter_setup()
5685 bssid = priv->bssid; in ipw2100_adapter_setup()
5692 if (priv->config & CFG_STATIC_ESSID) in ipw2100_adapter_setup()
5693 err = ipw2100_set_essid(priv, priv->essid, priv->essid_len, in ipw2100_adapter_setup()
5704 if (priv->ieee->iw_mode == IW_MODE_ADHOC) { in ipw2100_adapter_setup()
5707 priv->beacon_interval, in ipw2100_adapter_setup()
5712 err = ipw2100_set_tx_power(priv, priv->tx_power); in ipw2100_adapter_setup()
5719 priv, priv->frag_threshold, batch_mode); in ipw2100_adapter_setup()
5735 /* This method is called by the network layer -- not to be confused with
5744 if (!is_valid_ether_addr(addr->sa_data)) in ipw2100_set_address()
5745 return -EADDRNOTAVAIL; in ipw2100_set_address()
5747 mutex_lock(&priv->action_mutex); in ipw2100_set_address()
5749 priv->config |= CFG_CUSTOM_MAC; in ipw2100_set_address()
5750 memcpy(priv->mac_addr, addr->sa_data, ETH_ALEN); in ipw2100_set_address()
5756 priv->reset_backoff = 0; in ipw2100_set_address()
5757 mutex_unlock(&priv->action_mutex); in ipw2100_set_address()
5758 ipw2100_reset_adapter(&priv->reset_work.work); in ipw2100_set_address()
5762 mutex_unlock(&priv->action_mutex); in ipw2100_set_address()
5770 IPW_DEBUG_INFO("dev->open\n"); in ipw2100_open()
5772 spin_lock_irqsave(&priv->low_lock, flags); in ipw2100_open()
5773 if (priv->status & STATUS_ASSOCIATED) { in ipw2100_open()
5777 spin_unlock_irqrestore(&priv->low_lock, flags); in ipw2100_open()
5791 spin_lock_irqsave(&priv->low_lock, flags); in ipw2100_close()
5793 if (priv->status & STATUS_ASSOCIATED) in ipw2100_close()
5797 /* Flush the TX queue ... */ in ipw2100_close()
5798 while (!list_empty(&priv->tx_pend_list)) { in ipw2100_close()
5799 element = priv->tx_pend_list.next; in ipw2100_close()
5803 DEC_STAT(&priv->tx_pend_stat); in ipw2100_close()
5805 libipw_txb_free(packet->info.d_struct.txb); in ipw2100_close()
5806 packet->info.d_struct.txb = NULL; in ipw2100_close()
5808 list_add_tail(element, &priv->tx_free_list); in ipw2100_close()
5809 INC_STAT(&priv->tx_free_stat); in ipw2100_close()
5811 spin_unlock_irqrestore(&priv->low_lock, flags); in ipw2100_close()
5825 dev->stats.tx_errors++; in ipw2100_tx_timeout()
5828 if (priv->ieee->iw_mode == IW_MODE_MONITOR) in ipw2100_tx_timeout()
5832 IPW_DEBUG_INFO("%s: TX timed out. Scheduling firmware restart.\n", in ipw2100_tx_timeout()
5833 dev->name); in ipw2100_tx_timeout()
5841 priv->ieee->wpa_enabled = value; in ipw2100_wpa_enable()
5848 struct libipw_device *ieee = priv->ieee; in ipw2100_wpa_set_auth_algs()
5849 struct libipw_security sec = { in ipw2100_wpa_set_auth_algs() local
5855 sec.auth_mode = WLAN_AUTH_SHARED_KEY; in ipw2100_wpa_set_auth_algs()
5856 ieee->open_wep = 0; in ipw2100_wpa_set_auth_algs()
5858 sec.auth_mode = WLAN_AUTH_OPEN; in ipw2100_wpa_set_auth_algs()
5859 ieee->open_wep = 1; in ipw2100_wpa_set_auth_algs()
5861 sec.auth_mode = WLAN_AUTH_LEAP; in ipw2100_wpa_set_auth_algs()
5862 ieee->open_wep = 1; in ipw2100_wpa_set_auth_algs()
5864 return -EINVAL; in ipw2100_wpa_set_auth_algs()
5866 if (ieee->set_security) in ipw2100_wpa_set_auth_algs()
5867 ieee->set_security(ieee->dev, &sec); in ipw2100_wpa_set_auth_algs()
5869 ret = -EOPNOTSUPP; in ipw2100_wpa_set_auth_algs()
5897 strscpy(info->driver, DRV_NAME, sizeof(info->driver)); in ipw_ethtool_get_drvinfo()
5898 strscpy(info->version, DRV_VERSION, sizeof(info->version)); in ipw_ethtool_get_drvinfo()
5902 strscpy(info->fw_version, fw_ver, sizeof(info->fw_version)); in ipw_ethtool_get_drvinfo()
5903 strscpy(info->bus_info, pci_name(priv->pci_dev), in ipw_ethtool_get_drvinfo()
5904 sizeof(info->bus_info)); in ipw_ethtool_get_drvinfo()
5910 return (priv->status & STATUS_ASSOCIATED) ? 1 : 0; in ipw2100_ethtool_get_link()
5927 spin_lock_irqsave(&priv->low_lock, flags); in ipw2100_hang_check()
5929 if (priv->fatal_error != 0) { in ipw2100_hang_check()
5932 priv->net_dev->name); in ipw2100_hang_check()
5936 (rtc == priv->last_rtc)) { in ipw2100_hang_check()
5939 priv->net_dev->name); in ipw2100_hang_check()
5946 priv->stop_hang_check = 1; in ipw2100_hang_check()
5947 priv->hangs++; in ipw2100_hang_check()
5953 priv->last_rtc = rtc; in ipw2100_hang_check()
5955 if (!priv->stop_hang_check) in ipw2100_hang_check()
5956 schedule_delayed_work(&priv->hang_check, HZ / 2); in ipw2100_hang_check()
5958 spin_unlock_irqrestore(&priv->low_lock, flags); in ipw2100_hang_check()
5967 spin_lock_irqsave(&priv->low_lock, flags); in ipw2100_rf_kill()
5971 if (!priv->stop_rf_kill) in ipw2100_rf_kill()
5972 schedule_delayed_work(&priv->rf_kill, in ipw2100_rf_kill()
5979 if (!(priv->status & STATUS_RF_KILL_MASK)) { in ipw2100_rf_kill()
5988 spin_unlock_irqrestore(&priv->low_lock, flags); in ipw2100_rf_kill()
6014 priv->ieee = netdev_priv(dev); in ipw2100_alloc_device()
6015 priv->pci_dev = pci_dev; in ipw2100_alloc_device()
6016 priv->net_dev = dev; in ipw2100_alloc_device()
6017 priv->ioaddr = ioaddr; in ipw2100_alloc_device()
6019 priv->ieee->hard_start_xmit = ipw2100_tx; in ipw2100_alloc_device()
6020 priv->ieee->set_security = shim__set_security; in ipw2100_alloc_device()
6022 priv->ieee->perfect_rssi = -20; in ipw2100_alloc_device()
6023 priv->ieee->worst_rssi = -85; in ipw2100_alloc_device()
6025 dev->netdev_ops = &ipw2100_netdev_ops; in ipw2100_alloc_device()
6026 dev->ethtool_ops = &ipw2100_ethtool_ops; in ipw2100_alloc_device()
6027 dev->wireless_handlers = &ipw2100_wx_handler_def; in ipw2100_alloc_device()
6028 priv->wireless_data.libipw = priv->ieee; in ipw2100_alloc_device()
6029 dev->wireless_data = &priv->wireless_data; in ipw2100_alloc_device()
6030 dev->watchdog_timeo = 3 * HZ; in ipw2100_alloc_device()
6031 dev->irq = 0; in ipw2100_alloc_device()
6032 dev->min_mtu = 68; in ipw2100_alloc_device()
6033 dev->max_mtu = LIBIPW_DATA_LEN; in ipw2100_alloc_device()
6045 priv->power_mode = IPW_POWER_AUTO; in ipw2100_alloc_device()
6048 priv->config |= CFG_CRC_CHECK; in ipw2100_alloc_device()
6050 priv->ieee->wpa_enabled = 0; in ipw2100_alloc_device()
6051 priv->ieee->drop_unencrypted = 0; in ipw2100_alloc_device()
6052 priv->ieee->privacy_invoked = 0; in ipw2100_alloc_device()
6053 priv->ieee->ieee802_1x = 1; in ipw2100_alloc_device()
6058 priv->ieee->iw_mode = IW_MODE_ADHOC; in ipw2100_alloc_device()
6062 priv->ieee->iw_mode = IW_MODE_MONITOR; in ipw2100_alloc_device()
6067 priv->ieee->iw_mode = IW_MODE_INFRA; in ipw2100_alloc_device()
6072 priv->status |= STATUS_RF_KILL_SW; in ipw2100_alloc_device()
6076 priv->config |= CFG_STATIC_CHANNEL; in ipw2100_alloc_device()
6077 priv->channel = channel; in ipw2100_alloc_device()
6081 priv->config |= CFG_ASSOCIATE; in ipw2100_alloc_device()
6083 priv->beacon_interval = DEFAULT_BEACON_INTERVAL; in ipw2100_alloc_device()
6084 priv->short_retry_limit = DEFAULT_SHORT_RETRY_LIMIT; in ipw2100_alloc_device()
6085 priv->long_retry_limit = DEFAULT_LONG_RETRY_LIMIT; in ipw2100_alloc_device()
6086 priv->rts_threshold = DEFAULT_RTS_THRESHOLD | RTS_DISABLED; in ipw2100_alloc_device()
6087 priv->frag_threshold = DEFAULT_FTS | FRAG_DISABLED; in ipw2100_alloc_device()
6088 priv->tx_power = IPW_TX_POWER_DEFAULT; in ipw2100_alloc_device()
6089 priv->tx_rates = DEFAULT_TX_RATES; in ipw2100_alloc_device()
6091 strcpy(priv->nick, "ipw2100"); in ipw2100_alloc_device()
6093 spin_lock_init(&priv->low_lock); in ipw2100_alloc_device()
6094 mutex_init(&priv->action_mutex); in ipw2100_alloc_device()
6095 mutex_init(&priv->adapter_mutex); in ipw2100_alloc_device()
6097 init_waitqueue_head(&priv->wait_command_queue); in ipw2100_alloc_device()
6101 INIT_LIST_HEAD(&priv->msg_free_list); in ipw2100_alloc_device()
6102 INIT_LIST_HEAD(&priv->msg_pend_list); in ipw2100_alloc_device()
6103 INIT_STAT(&priv->msg_free_stat); in ipw2100_alloc_device()
6104 INIT_STAT(&priv->msg_pend_stat); in ipw2100_alloc_device()
6106 INIT_LIST_HEAD(&priv->tx_free_list); in ipw2100_alloc_device()
6107 INIT_LIST_HEAD(&priv->tx_pend_list); in ipw2100_alloc_device()
6108 INIT_STAT(&priv->tx_free_stat); in ipw2100_alloc_device()
6109 INIT_STAT(&priv->tx_pend_stat); in ipw2100_alloc_device()
6111 INIT_LIST_HEAD(&priv->fw_pend_list); in ipw2100_alloc_device()
6112 INIT_STAT(&priv->fw_pend_stat); in ipw2100_alloc_device()
6114 INIT_DELAYED_WORK(&priv->reset_work, ipw2100_reset_adapter); in ipw2100_alloc_device()
6115 INIT_DELAYED_WORK(&priv->security_work, ipw2100_security_work); in ipw2100_alloc_device()
6116 INIT_DELAYED_WORK(&priv->wx_event_work, ipw2100_wx_event_work); in ipw2100_alloc_device()
6117 INIT_DELAYED_WORK(&priv->hang_check, ipw2100_hang_check); in ipw2100_alloc_device()
6118 INIT_DELAYED_WORK(&priv->rf_kill, ipw2100_rf_kill); in ipw2100_alloc_device()
6119 INIT_DELAYED_WORK(&priv->scan_event, ipw2100_scan_event); in ipw2100_alloc_device()
6121 tasklet_setup(&priv->irq_tasklet, ipw2100_irq_tasklet); in ipw2100_alloc_device()
6124 priv->stop_rf_kill = 1; in ipw2100_alloc_device()
6125 priv->stop_hang_check = 1; in ipw2100_alloc_device()
6143 IPW_DEBUG_INFO("weird - resource type is not memory\n"); in ipw2100_pci_init_one()
6144 err = -ENODEV; in ipw2100_pci_init_one()
6152 err = -EIO; in ipw2100_pci_init_one()
6161 err = -ENOMEM; in ipw2100_pci_init_one()
6178 err = dma_set_mask(&pci_dev->dev, DMA_BIT_MASK(32)); in ipw2100_pci_init_one()
6195 * PCI Tx retries from interfering with C3 CPU state */ in ipw2100_pci_init_one()
6203 err = -ENODEV; in ipw2100_pci_init_one()
6207 SET_NETDEV_DEV(dev, &pci_dev->dev); in ipw2100_pci_init_one()
6210 priv->status |= STATUS_INT_ENABLED; in ipw2100_pci_init_one()
6213 /* Allocate and initialize the Tx/Rx queues and lists */ in ipw2100_pci_init_one()
6217 err = -ENOMEM; in ipw2100_pci_init_one()
6222 err = request_irq(pci_dev->irq, in ipw2100_pci_init_one()
6223 ipw2100_interrupt, IRQF_SHARED, dev->name, priv); in ipw2100_pci_init_one()
6226 "Error calling request_irq: %d.\n", pci_dev->irq); in ipw2100_pci_init_one()
6229 dev->irq = pci_dev->irq; in ipw2100_pci_init_one()
6258 mutex_lock(&priv->action_mutex); in ipw2100_pci_init_one()
6260 IPW_DEBUG_INFO("%s: Bound to %s\n", dev->name, pci_name(pci_dev)); in ipw2100_pci_init_one()
6262 /* perform this after register_netdev so that dev->name is set */ in ipw2100_pci_init_one()
6263 err = sysfs_create_group(&pci_dev->dev.kobj, &ipw2100_attribute_group); in ipw2100_pci_init_one()
6269 if (!(priv->status & STATUS_RF_KILL_MASK)) { in ipw2100_pci_init_one()
6270 /* Enable the adapter - sends HOST_COMPLETE */ in ipw2100_pci_init_one()
6274 priv->net_dev->name); in ipw2100_pci_init_one()
6276 err = -EIO; in ipw2100_pci_init_one()
6287 priv->status |= STATUS_INITIALIZED; in ipw2100_pci_init_one()
6289 mutex_unlock(&priv->action_mutex); in ipw2100_pci_init_one()
6294 mutex_unlock(&priv->action_mutex); in ipw2100_pci_init_one()
6301 wiphy_unregister(priv->ieee->wdev.wiphy); in ipw2100_pci_init_one()
6302 kfree(priv->ieee->bg_band.channels); in ipw2100_pci_init_one()
6309 if (dev->irq) in ipw2100_pci_init_one()
6310 free_irq(dev->irq, priv); in ipw2100_pci_init_one()
6316 sysfs_remove_group(&pci_dev->dev.kobj, in ipw2100_pci_init_one()
6332 struct net_device *dev = priv->net_dev; in ipw2100_pci_remove_one()
6334 mutex_lock(&priv->action_mutex); in ipw2100_pci_remove_one()
6336 priv->status &= ~STATUS_INITIALIZED; in ipw2100_pci_remove_one()
6338 sysfs_remove_group(&pci_dev->dev.kobj, &ipw2100_attribute_group); in ipw2100_pci_remove_one()
6349 mutex_unlock(&priv->action_mutex); in ipw2100_pci_remove_one()
6351 /* Unregister the device first - this results in close() in ipw2100_pci_remove_one()
6364 free_irq(dev->irq, priv); in ipw2100_pci_remove_one()
6366 pci_iounmap(pci_dev, priv->ioaddr); in ipw2100_pci_remove_one()
6369 wiphy_unregister(priv->ieee->wdev.wiphy); in ipw2100_pci_remove_one()
6370 kfree(priv->ieee->bg_band.channels); in ipw2100_pci_remove_one()
6382 struct net_device *dev = priv->net_dev; in ipw2100_suspend()
6384 IPW_DEBUG_INFO("%s: Going into suspend...\n", dev->name); in ipw2100_suspend()
6386 mutex_lock(&priv->action_mutex); in ipw2100_suspend()
6387 if (priv->status & STATUS_INITIALIZED) { in ipw2100_suspend()
6395 priv->suspend_at = ktime_get_boottime_seconds(); in ipw2100_suspend()
6397 mutex_unlock(&priv->action_mutex); in ipw2100_suspend()
6406 struct net_device *dev = priv->net_dev; in ipw2100_resume()
6412 mutex_lock(&priv->action_mutex); in ipw2100_resume()
6414 IPW_DEBUG_INFO("%s: Coming out of suspend...\n", dev->name); in ipw2100_resume()
6418 * re-disable the RETRY_TIMEOUT register (0x41) to keep PCI Tx retries in ipw2100_resume()
6430 priv->suspend_time = ktime_get_boottime_seconds() - priv->suspend_at; in ipw2100_resume()
6433 if (!(priv->status & STATUS_RF_KILL_SW)) in ipw2100_resume()
6436 mutex_unlock(&priv->action_mutex); in ipw2100_resume()
6574 if (!(priv->status & STATUS_ASSOCIATED)) in ipw2100_wx_get_name()
6575 strcpy(wrqu->name, "unassociated"); in ipw2100_wx_get_name()
6577 snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11b"); in ipw2100_wx_get_name()
6579 IPW_DEBUG_WX("Name: %s\n", wrqu->name); in ipw2100_wx_get_name()
6588 struct iw_freq *fwrq = &wrqu->freq; in ipw2100_wx_set_freq()
6591 if (priv->ieee->iw_mode == IW_MODE_INFRA) in ipw2100_wx_set_freq()
6592 return -EOPNOTSUPP; in ipw2100_wx_set_freq()
6594 mutex_lock(&priv->action_mutex); in ipw2100_wx_set_freq()
6595 if (!(priv->status & STATUS_INITIALIZED)) { in ipw2100_wx_set_freq()
6596 err = -EIO; in ipw2100_wx_set_freq()
6601 if (fwrq->e == 1) { in ipw2100_wx_set_freq()
6602 if ((fwrq->m >= (int)2.412e8 && fwrq->m <= (int)2.487e8)) { in ipw2100_wx_set_freq()
6603 int f = fwrq->m / 100000; in ipw2100_wx_set_freq()
6611 fwrq->e = 0; in ipw2100_wx_set_freq()
6612 fwrq->m = c + 1; in ipw2100_wx_set_freq()
6616 if (fwrq->e > 0 || fwrq->m > 1000) { in ipw2100_wx_set_freq()
6617 err = -EOPNOTSUPP; in ipw2100_wx_set_freq()
6620 IPW_DEBUG_WX("SET Freq/Channel -> %d\n", fwrq->m); in ipw2100_wx_set_freq()
6621 err = ipw2100_set_channel(priv, fwrq->m, 0); in ipw2100_wx_set_freq()
6625 mutex_unlock(&priv->action_mutex); in ipw2100_wx_set_freq()
6639 wrqu->freq.e = 0; in ipw2100_wx_get_freq()
6643 if (priv->config & CFG_STATIC_CHANNEL || in ipw2100_wx_get_freq()
6644 priv->status & STATUS_ASSOCIATED) in ipw2100_wx_get_freq()
6645 wrqu->freq.m = priv->channel; in ipw2100_wx_get_freq()
6647 wrqu->freq.m = 0; in ipw2100_wx_get_freq()
6649 IPW_DEBUG_WX("GET Freq/Channel -> %d\n", priv->channel); in ipw2100_wx_get_freq()
6661 IPW_DEBUG_WX("SET Mode -> %d\n", wrqu->mode); in ipw2100_wx_set_mode()
6663 if (wrqu->mode == priv->ieee->iw_mode) in ipw2100_wx_set_mode()
6666 mutex_lock(&priv->action_mutex); in ipw2100_wx_set_mode()
6667 if (!(priv->status & STATUS_INITIALIZED)) { in ipw2100_wx_set_mode()
6668 err = -EIO; in ipw2100_wx_set_mode()
6672 switch (wrqu->mode) { in ipw2100_wx_set_mode()
6689 mutex_unlock(&priv->action_mutex); in ipw2100_wx_set_mode()
6703 wrqu->mode = priv->ieee->iw_mode; in ipw2100_wx_get_mode()
6704 IPW_DEBUG_WX("GET Mode -> %d\n", wrqu->mode); in ipw2100_wx_get_mode()
6741 wrqu->data.length = sizeof(*range); in ipw2100_wx_get_range()
6753 range->throughput = 5 * 1000 * 1000; in ipw2100_wx_get_range()
6755 // range->sensitivity; /* signal level threshold range */ in ipw2100_wx_get_range()
6757 range->max_qual.qual = 100; in ipw2100_wx_get_range()
6759 range->max_qual.level = 0; in ipw2100_wx_get_range()
6760 range->max_qual.noise = 0; in ipw2100_wx_get_range()
6761 range->max_qual.updated = 7; /* Updated all three */ in ipw2100_wx_get_range()
6763 range->avg_qual.qual = 70; /* > 8% missed beacons is 'bad' */ in ipw2100_wx_get_range()
6765 range->avg_qual.level = 20 + IPW2100_RSSI_TO_DBM; in ipw2100_wx_get_range()
6766 range->avg_qual.noise = 0; in ipw2100_wx_get_range()
6767 range->avg_qual.updated = 7; /* Updated all three */ in ipw2100_wx_get_range()
6769 range->num_bitrates = RATE_COUNT; in ipw2100_wx_get_range()
6772 range->bitrate[i] = ipw2100_bg_rates[i].bitrate * 100 * 1000; in ipw2100_wx_get_range()
6775 range->min_rts = MIN_RTS_THRESHOLD; in ipw2100_wx_get_range()
6776 range->max_rts = MAX_RTS_THRESHOLD; in ipw2100_wx_get_range()
6777 range->min_frag = MIN_FRAG_THRESHOLD; in ipw2100_wx_get_range()
6778 range->max_frag = MAX_FRAG_THRESHOLD; in ipw2100_wx_get_range()
6780 range->min_pmp = period_duration[0]; /* Minimal PM period */ in ipw2100_wx_get_range()
6781 range->max_pmp = period_duration[POWER_MODES - 1]; /* Maximal PM period */ in ipw2100_wx_get_range()
6782 range->min_pmt = timeout_duration[POWER_MODES - 1]; /* Minimal PM timeout */ in ipw2100_wx_get_range()
6783 range->max_pmt = timeout_duration[0]; /* Maximal PM timeout */ in ipw2100_wx_get_range()
6786 range->pmp_flags = IW_POWER_PERIOD; in ipw2100_wx_get_range()
6788 range->pmt_flags = IW_POWER_TIMEOUT; in ipw2100_wx_get_range()
6790 range->pm_capa = IW_POWER_TIMEOUT | IW_POWER_PERIOD; in ipw2100_wx_get_range()
6792 range->encoding_size[0] = 5; in ipw2100_wx_get_range()
6793 range->encoding_size[1] = 13; /* Different token sizes */ in ipw2100_wx_get_range()
6794 range->num_encoding_sizes = 2; /* Number of entry in the list */ in ipw2100_wx_get_range()
6795 range->max_encoding_tokens = WEP_KEYS; /* Max number of tokens */ in ipw2100_wx_get_range()
6796 // range->encoding_login_index; /* token index for login token */ in ipw2100_wx_get_range()
6798 if (priv->ieee->iw_mode == IW_MODE_ADHOC) { in ipw2100_wx_get_range()
6799 range->txpower_capa = IW_TXPOW_DBM; in ipw2100_wx_get_range()
6800 range->num_txpower = IW_MAX_TXPOWER; in ipw2100_wx_get_range()
6803 i++, level -= in ipw2100_wx_get_range()
6804 ((IPW_TX_POWER_MAX_DBM - in ipw2100_wx_get_range()
6805 IPW_TX_POWER_MIN_DBM) * 16) / (IW_MAX_TXPOWER - 1)) in ipw2100_wx_get_range()
6806 range->txpower[i] = level / 16; in ipw2100_wx_get_range()
6808 range->txpower_capa = 0; in ipw2100_wx_get_range()
6809 range->num_txpower = 0; in ipw2100_wx_get_range()
6813 range->we_version_compiled = WIRELESS_EXT; in ipw2100_wx_get_range()
6814 range->we_version_source = 18; in ipw2100_wx_get_range()
6816 // range->retry_capa; /* What retry options are supported */ in ipw2100_wx_get_range()
6817 // range->retry_flags; /* How to decode max/min retry limit */ in ipw2100_wx_get_range()
6818 // range->r_time_flags; /* How to decode max/min retry life */ in ipw2100_wx_get_range()
6819 // range->min_retry; /* Minimal number of retries */ in ipw2100_wx_get_range()
6820 // range->max_retry; /* Maximal number of retries */ in ipw2100_wx_get_range()
6821 // range->min_r_time; /* Minimal retry lifetime */ in ipw2100_wx_get_range()
6822 // range->max_r_time; /* Maximal retry lifetime */ in ipw2100_wx_get_range()
6824 range->num_channels = FREQ_COUNT; in ipw2100_wx_get_range()
6829 // if (local->channel_mask & (1 << i)) { in ipw2100_wx_get_range()
6830 range->freq[val].i = i + 1; in ipw2100_wx_get_range()
6831 range->freq[val].m = ipw2100_frequencies[i] * 100000; in ipw2100_wx_get_range()
6832 range->freq[val].e = 1; in ipw2100_wx_get_range()
6838 range->num_frequency = val; in ipw2100_wx_get_range()
6841 range->event_capa[0] = (IW_EVENT_CAPA_K_0 | in ipw2100_wx_get_range()
6843 range->event_capa[1] = IW_EVENT_CAPA_K_1; in ipw2100_wx_get_range()
6845 range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 | in ipw2100_wx_get_range()
6861 if (wrqu->ap_addr.sa_family != ARPHRD_ETHER) in ipw2100_wx_set_wap()
6862 return -EINVAL; in ipw2100_wx_set_wap()
6864 mutex_lock(&priv->action_mutex); in ipw2100_wx_set_wap()
6865 if (!(priv->status & STATUS_INITIALIZED)) { in ipw2100_wx_set_wap()
6866 err = -EIO; in ipw2100_wx_set_wap()
6870 if (is_broadcast_ether_addr(wrqu->ap_addr.sa_data) || in ipw2100_wx_set_wap()
6871 is_zero_ether_addr(wrqu->ap_addr.sa_data)) { in ipw2100_wx_set_wap()
6873 IPW_DEBUG_WX("exit - disable mandatory BSSID\n"); in ipw2100_wx_set_wap()
6874 priv->config &= ~CFG_STATIC_BSSID; in ipw2100_wx_set_wap()
6879 priv->config |= CFG_STATIC_BSSID; in ipw2100_wx_set_wap()
6880 memcpy(priv->mandatory_bssid_mac, wrqu->ap_addr.sa_data, ETH_ALEN); in ipw2100_wx_set_wap()
6882 err = ipw2100_set_mandatory_bssid(priv, wrqu->ap_addr.sa_data, 0); in ipw2100_wx_set_wap()
6884 IPW_DEBUG_WX("SET BSSID -> %pM\n", wrqu->ap_addr.sa_data); in ipw2100_wx_set_wap()
6887 mutex_unlock(&priv->action_mutex); in ipw2100_wx_set_wap()
6903 if (priv->config & CFG_STATIC_BSSID || priv->status & STATUS_ASSOCIATED) { in ipw2100_wx_get_wap()
6904 wrqu->ap_addr.sa_family = ARPHRD_ETHER; in ipw2100_wx_get_wap()
6905 memcpy(wrqu->ap_addr.sa_data, priv->bssid, ETH_ALEN); in ipw2100_wx_get_wap()
6907 eth_zero_addr(wrqu->ap_addr.sa_data); in ipw2100_wx_get_wap()
6909 IPW_DEBUG_WX("Getting WAP BSSID: %pM\n", wrqu->ap_addr.sa_data); in ipw2100_wx_get_wap()
6922 mutex_lock(&priv->action_mutex); in ipw2100_wx_set_essid()
6923 if (!(priv->status & STATUS_INITIALIZED)) { in ipw2100_wx_set_essid()
6924 err = -EIO; in ipw2100_wx_set_essid()
6928 if (wrqu->essid.flags && wrqu->essid.length) { in ipw2100_wx_set_essid()
6929 length = wrqu->essid.length; in ipw2100_wx_set_essid()
6935 priv->config &= ~CFG_STATIC_ESSID; in ipw2100_wx_set_essid()
6942 priv->config |= CFG_STATIC_ESSID; in ipw2100_wx_set_essid()
6944 if (priv->essid_len == length && !memcmp(priv->essid, extra, length)) { in ipw2100_wx_set_essid()
6952 priv->essid_len = length; in ipw2100_wx_set_essid()
6953 memcpy(priv->essid, essid, priv->essid_len); in ipw2100_wx_set_essid()
6958 mutex_unlock(&priv->action_mutex); in ipw2100_wx_set_essid()
6974 if (priv->config & CFG_STATIC_ESSID || priv->status & STATUS_ASSOCIATED) { in ipw2100_wx_get_essid()
6976 priv->essid_len, priv->essid); in ipw2100_wx_get_essid()
6977 memcpy(extra, priv->essid, priv->essid_len); in ipw2100_wx_get_essid()
6978 wrqu->essid.length = priv->essid_len; in ipw2100_wx_get_essid()
6979 wrqu->essid.flags = 1; /* active */ in ipw2100_wx_get_essid()
6982 wrqu->essid.length = 0; in ipw2100_wx_get_essid()
6983 wrqu->essid.flags = 0; /* active */ in ipw2100_wx_get_essid()
6999 if (wrqu->data.length > IW_ESSID_MAX_SIZE) in ipw2100_wx_set_nick()
7000 return -E2BIG; in ipw2100_wx_set_nick()
7002 wrqu->data.length = min_t(size_t, wrqu->data.length, sizeof(priv->nick)); in ipw2100_wx_set_nick()
7003 memset(priv->nick, 0, sizeof(priv->nick)); in ipw2100_wx_set_nick()
7004 memcpy(priv->nick, extra, wrqu->data.length); in ipw2100_wx_set_nick()
7006 IPW_DEBUG_WX("SET Nickname -> %s\n", priv->nick); in ipw2100_wx_set_nick()
7021 wrqu->data.length = strlen(priv->nick); in ipw2100_wx_get_nick()
7022 memcpy(extra, priv->nick, wrqu->data.length); in ipw2100_wx_get_nick()
7023 wrqu->data.flags = 1; /* active */ in ipw2100_wx_get_nick()
7025 IPW_DEBUG_WX("GET Nickname -> %s\n", extra); in ipw2100_wx_get_nick()
7035 u32 target_rate = wrqu->bitrate.value; in ipw2100_wx_set_rate()
7039 mutex_lock(&priv->action_mutex); in ipw2100_wx_set_rate()
7040 if (!(priv->status & STATUS_INITIALIZED)) { in ipw2100_wx_set_rate()
7041 err = -EIO; in ipw2100_wx_set_rate()
7048 (!wrqu->bitrate.fixed && target_rate > 1000000)) in ipw2100_wx_set_rate()
7051 (!wrqu->bitrate.fixed && target_rate > 2000000)) in ipw2100_wx_set_rate()
7054 (!wrqu->bitrate.fixed && target_rate > 5500000)) in ipw2100_wx_set_rate()
7057 (!wrqu->bitrate.fixed && target_rate > 11000000)) in ipw2100_wx_set_rate()
7064 IPW_DEBUG_WX("SET Rate -> %04X\n", rate); in ipw2100_wx_set_rate()
7066 mutex_unlock(&priv->action_mutex); in ipw2100_wx_set_rate()
7079 if (!(priv->status & STATUS_ENABLED) || in ipw2100_wx_get_rate()
7080 priv->status & STATUS_RF_KILL_MASK || in ipw2100_wx_get_rate()
7081 !(priv->status & STATUS_ASSOCIATED)) { in ipw2100_wx_get_rate()
7082 wrqu->bitrate.value = 0; in ipw2100_wx_get_rate()
7086 mutex_lock(&priv->action_mutex); in ipw2100_wx_get_rate()
7087 if (!(priv->status & STATUS_INITIALIZED)) { in ipw2100_wx_get_rate()
7088 err = -EIO; in ipw2100_wx_get_rate()
7100 wrqu->bitrate.value = 1000000; in ipw2100_wx_get_rate()
7103 wrqu->bitrate.value = 2000000; in ipw2100_wx_get_rate()
7106 wrqu->bitrate.value = 5500000; in ipw2100_wx_get_rate()
7109 wrqu->bitrate.value = 11000000; in ipw2100_wx_get_rate()
7112 wrqu->bitrate.value = 0; in ipw2100_wx_get_rate()
7115 IPW_DEBUG_WX("GET Rate -> %d\n", wrqu->bitrate.value); in ipw2100_wx_get_rate()
7118 mutex_unlock(&priv->action_mutex); in ipw2100_wx_get_rate()
7130 if (wrqu->rts.fixed == 0) in ipw2100_wx_set_rts()
7131 return -EINVAL; in ipw2100_wx_set_rts()
7133 mutex_lock(&priv->action_mutex); in ipw2100_wx_set_rts()
7134 if (!(priv->status & STATUS_INITIALIZED)) { in ipw2100_wx_set_rts()
7135 err = -EIO; in ipw2100_wx_set_rts()
7139 if (wrqu->rts.disabled) in ipw2100_wx_set_rts()
7140 value = priv->rts_threshold | RTS_DISABLED; in ipw2100_wx_set_rts()
7142 if (wrqu->rts.value < 1 || wrqu->rts.value > 2304) { in ipw2100_wx_set_rts()
7143 err = -EINVAL; in ipw2100_wx_set_rts()
7146 value = wrqu->rts.value; in ipw2100_wx_set_rts()
7151 IPW_DEBUG_WX("SET RTS Threshold -> 0x%08X\n", value); in ipw2100_wx_set_rts()
7153 mutex_unlock(&priv->action_mutex); in ipw2100_wx_set_rts()
7167 wrqu->rts.value = priv->rts_threshold & ~RTS_DISABLED; in ipw2100_wx_get_rts()
7168 wrqu->rts.fixed = 1; /* no auto select */ in ipw2100_wx_get_rts()
7171 wrqu->rts.disabled = (priv->rts_threshold & RTS_DISABLED) ? 1 : 0; in ipw2100_wx_get_rts()
7173 IPW_DEBUG_WX("GET RTS Threshold -> 0x%08X\n", wrqu->rts.value); in ipw2100_wx_get_rts()
7185 if (ipw_radio_kill_sw(priv, wrqu->txpower.disabled)) in ipw2100_wx_set_txpow()
7186 return -EINPROGRESS; in ipw2100_wx_set_txpow()
7188 if (priv->ieee->iw_mode != IW_MODE_ADHOC) in ipw2100_wx_set_txpow()
7191 if ((wrqu->txpower.flags & IW_TXPOW_TYPE) != IW_TXPOW_DBM) in ipw2100_wx_set_txpow()
7192 return -EINVAL; in ipw2100_wx_set_txpow()
7194 if (wrqu->txpower.fixed == 0) in ipw2100_wx_set_txpow()
7197 if (wrqu->txpower.value < IPW_TX_POWER_MIN_DBM || in ipw2100_wx_set_txpow()
7198 wrqu->txpower.value > IPW_TX_POWER_MAX_DBM) in ipw2100_wx_set_txpow()
7199 return -EINVAL; in ipw2100_wx_set_txpow()
7201 value = wrqu->txpower.value; in ipw2100_wx_set_txpow()
7204 mutex_lock(&priv->action_mutex); in ipw2100_wx_set_txpow()
7205 if (!(priv->status & STATUS_INITIALIZED)) { in ipw2100_wx_set_txpow()
7206 err = -EIO; in ipw2100_wx_set_txpow()
7212 IPW_DEBUG_WX("SET TX Power -> %d\n", value); in ipw2100_wx_set_txpow()
7215 mutex_unlock(&priv->action_mutex); in ipw2100_wx_set_txpow()
7229 wrqu->txpower.disabled = (priv->status & STATUS_RF_KILL_MASK) ? 1 : 0; in ipw2100_wx_get_txpow()
7231 if (priv->tx_power == IPW_TX_POWER_DEFAULT) { in ipw2100_wx_get_txpow()
7232 wrqu->txpower.fixed = 0; in ipw2100_wx_get_txpow()
7233 wrqu->txpower.value = IPW_TX_POWER_MAX_DBM; in ipw2100_wx_get_txpow()
7235 wrqu->txpower.fixed = 1; in ipw2100_wx_get_txpow()
7236 wrqu->txpower.value = priv->tx_power; in ipw2100_wx_get_txpow()
7239 wrqu->txpower.flags = IW_TXPOW_DBM; in ipw2100_wx_get_txpow()
7241 IPW_DEBUG_WX("GET TX Power -> %d\n", wrqu->txpower.value); in ipw2100_wx_get_txpow()
7256 if (!wrqu->frag.fixed) in ipw2100_wx_set_frag()
7257 return -EINVAL; in ipw2100_wx_set_frag()
7259 if (wrqu->frag.disabled) { in ipw2100_wx_set_frag()
7260 priv->frag_threshold |= FRAG_DISABLED; in ipw2100_wx_set_frag()
7261 priv->ieee->fts = DEFAULT_FTS; in ipw2100_wx_set_frag()
7263 if (wrqu->frag.value < MIN_FRAG_THRESHOLD || in ipw2100_wx_set_frag()
7264 wrqu->frag.value > MAX_FRAG_THRESHOLD) in ipw2100_wx_set_frag()
7265 return -EINVAL; in ipw2100_wx_set_frag()
7267 priv->ieee->fts = wrqu->frag.value & ~0x1; in ipw2100_wx_set_frag()
7268 priv->frag_threshold = priv->ieee->fts; in ipw2100_wx_set_frag()
7271 IPW_DEBUG_WX("SET Frag Threshold -> %d\n", priv->ieee->fts); in ipw2100_wx_set_frag()
7285 wrqu->frag.value = priv->frag_threshold & ~FRAG_DISABLED; in ipw2100_wx_get_frag()
7286 wrqu->frag.fixed = 0; /* no auto select */ in ipw2100_wx_get_frag()
7287 wrqu->frag.disabled = (priv->frag_threshold & FRAG_DISABLED) ? 1 : 0; in ipw2100_wx_get_frag()
7289 IPW_DEBUG_WX("GET Frag Threshold -> %d\n", wrqu->frag.value); in ipw2100_wx_get_frag()
7301 if (wrqu->retry.flags & IW_RETRY_LIFETIME || wrqu->retry.disabled) in ipw2100_wx_set_retry()
7302 return -EINVAL; in ipw2100_wx_set_retry()
7304 if (!(wrqu->retry.flags & IW_RETRY_LIMIT)) in ipw2100_wx_set_retry()
7307 mutex_lock(&priv->action_mutex); in ipw2100_wx_set_retry()
7308 if (!(priv->status & STATUS_INITIALIZED)) { in ipw2100_wx_set_retry()
7309 err = -EIO; in ipw2100_wx_set_retry()
7313 if (wrqu->retry.flags & IW_RETRY_SHORT) { in ipw2100_wx_set_retry()
7314 err = ipw2100_set_short_retry(priv, wrqu->retry.value); in ipw2100_wx_set_retry()
7315 IPW_DEBUG_WX("SET Short Retry Limit -> %d\n", in ipw2100_wx_set_retry()
7316 wrqu->retry.value); in ipw2100_wx_set_retry()
7320 if (wrqu->retry.flags & IW_RETRY_LONG) { in ipw2100_wx_set_retry()
7321 err = ipw2100_set_long_retry(priv, wrqu->retry.value); in ipw2100_wx_set_retry()
7322 IPW_DEBUG_WX("SET Long Retry Limit -> %d\n", in ipw2100_wx_set_retry()
7323 wrqu->retry.value); in ipw2100_wx_set_retry()
7327 err = ipw2100_set_short_retry(priv, wrqu->retry.value); in ipw2100_wx_set_retry()
7329 err = ipw2100_set_long_retry(priv, wrqu->retry.value); in ipw2100_wx_set_retry()
7331 IPW_DEBUG_WX("SET Both Retry Limits -> %d\n", wrqu->retry.value); in ipw2100_wx_set_retry()
7334 mutex_unlock(&priv->action_mutex); in ipw2100_wx_set_retry()
7348 wrqu->retry.disabled = 0; /* can't be disabled */ in ipw2100_wx_get_retry()
7350 if ((wrqu->retry.flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) in ipw2100_wx_get_retry()
7351 return -EINVAL; in ipw2100_wx_get_retry()
7353 if (wrqu->retry.flags & IW_RETRY_LONG) { in ipw2100_wx_get_retry()
7354 wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_LONG; in ipw2100_wx_get_retry()
7355 wrqu->retry.value = priv->long_retry_limit; in ipw2100_wx_get_retry()
7357 wrqu->retry.flags = in ipw2100_wx_get_retry()
7358 (priv->short_retry_limit != in ipw2100_wx_get_retry()
7359 priv->long_retry_limit) ? in ipw2100_wx_get_retry()
7362 wrqu->retry.value = priv->short_retry_limit; in ipw2100_wx_get_retry()
7365 IPW_DEBUG_WX("GET Retry -> %d\n", wrqu->retry.value); in ipw2100_wx_get_retry()
7377 mutex_lock(&priv->action_mutex); in ipw2100_wx_set_scan()
7378 if (!(priv->status & STATUS_INITIALIZED)) { in ipw2100_wx_set_scan()
7379 err = -EIO; in ipw2100_wx_set_scan()
7385 priv->user_requested_scan = 1; in ipw2100_wx_set_scan()
7394 mutex_unlock(&priv->action_mutex); in ipw2100_wx_set_scan()
7407 return libipw_wx_get_scan(priv->ieee, info, wrqu, extra); in ipw2100_wx_get_scan()
7411 * Implementation based on code in hostap-driver v0.1.3 hostap_ioctl.c
7422 return libipw_wx_set_encode(priv->ieee, info, wrqu, key); in ipw2100_wx_set_encode()
7434 return libipw_wx_get_encode(priv->ieee, info, wrqu, key); in ipw2100_wx_get_encode()
7444 mutex_lock(&priv->action_mutex); in ipw2100_wx_set_power()
7445 if (!(priv->status & STATUS_INITIALIZED)) { in ipw2100_wx_set_power()
7446 err = -EIO; in ipw2100_wx_set_power()
7450 if (wrqu->power.disabled) { in ipw2100_wx_set_power()
7451 priv->power_mode = IPW_POWER_LEVEL(priv->power_mode); in ipw2100_wx_set_power()
7453 IPW_DEBUG_WX("SET Power Management Mode -> off\n"); in ipw2100_wx_set_power()
7457 switch (wrqu->power.flags & IW_POWER_MODE) { in ipw2100_wx_set_power()
7464 wrqu->power.flags); in ipw2100_wx_set_power()
7465 err = -EOPNOTSUPP; in ipw2100_wx_set_power()
7471 priv->power_mode = IPW_POWER_ENABLED | priv->power_mode; in ipw2100_wx_set_power()
7472 err = ipw2100_set_power_mode(priv, IPW_POWER_LEVEL(priv->power_mode)); in ipw2100_wx_set_power()
7474 IPW_DEBUG_WX("SET Power Management Mode -> 0x%02X\n", priv->power_mode); in ipw2100_wx_set_power()
7477 mutex_unlock(&priv->action_mutex); in ipw2100_wx_set_power()
7492 if (!(priv->power_mode & IPW_POWER_ENABLED)) in ipw2100_wx_get_power()
7493 wrqu->power.disabled = 1; in ipw2100_wx_get_power()
7495 wrqu->power.disabled = 0; in ipw2100_wx_get_power()
7496 wrqu->power.flags = 0; in ipw2100_wx_get_power()
7499 IPW_DEBUG_WX("GET Power Management Mode -> %02X\n", priv->power_mode); in ipw2100_wx_get_power()
7505 * WE-18 WPA support
7515 struct libipw_device *ieee = priv->ieee; in ipw2100_wx_set_genie()
7518 if (!ieee->wpa_enabled) in ipw2100_wx_set_genie()
7519 return -EOPNOTSUPP; in ipw2100_wx_set_genie()
7521 if (wrqu->data.length > MAX_WPA_IE_LEN || in ipw2100_wx_set_genie()
7522 (wrqu->data.length && extra == NULL)) in ipw2100_wx_set_genie()
7523 return -EINVAL; in ipw2100_wx_set_genie()
7525 if (wrqu->data.length) { in ipw2100_wx_set_genie()
7526 buf = kmemdup(extra, wrqu->data.length, GFP_KERNEL); in ipw2100_wx_set_genie()
7528 return -ENOMEM; in ipw2100_wx_set_genie()
7530 kfree(ieee->wpa_ie); in ipw2100_wx_set_genie()
7531 ieee->wpa_ie = buf; in ipw2100_wx_set_genie()
7532 ieee->wpa_ie_len = wrqu->data.length; in ipw2100_wx_set_genie()
7534 kfree(ieee->wpa_ie); in ipw2100_wx_set_genie()
7535 ieee->wpa_ie = NULL; in ipw2100_wx_set_genie()
7536 ieee->wpa_ie_len = 0; in ipw2100_wx_set_genie()
7539 ipw2100_wpa_assoc_frame(priv, ieee->wpa_ie, ieee->wpa_ie_len); in ipw2100_wx_set_genie()
7550 struct libipw_device *ieee = priv->ieee; in ipw2100_wx_get_genie()
7552 if (ieee->wpa_ie_len == 0 || ieee->wpa_ie == NULL) { in ipw2100_wx_get_genie()
7553 wrqu->data.length = 0; in ipw2100_wx_get_genie()
7557 if (wrqu->data.length < ieee->wpa_ie_len) in ipw2100_wx_get_genie()
7558 return -E2BIG; in ipw2100_wx_get_genie()
7560 wrqu->data.length = ieee->wpa_ie_len; in ipw2100_wx_get_genie()
7561 memcpy(extra, ieee->wpa_ie, ieee->wpa_ie_len); in ipw2100_wx_get_genie()
7572 struct libipw_device *ieee = priv->ieee; in ipw2100_wx_set_auth()
7573 struct iw_param *param = &wrqu->param; in ipw2100_wx_set_auth()
7578 switch (param->flags & IW_AUTH_INDEX) { in ipw2100_wx_set_auth()
7589 crypt = priv->ieee->crypt_info.crypt[priv->ieee->crypt_info.tx_keyidx]; in ipw2100_wx_set_auth()
7590 if (!crypt || !crypt->ops->set_flags || !crypt->ops->get_flags) in ipw2100_wx_set_auth()
7593 flags = crypt->ops->get_flags(crypt->priv); in ipw2100_wx_set_auth()
7595 if (param->value) in ipw2100_wx_set_auth()
7600 crypt->ops->set_flags(flags, crypt->priv); in ipw2100_wx_set_auth()
7612 * used, drop_unencrypted is set to false, else true -- we in ipw2100_wx_set_auth()
7616 struct libipw_security sec = { in ipw2100_wx_set_auth() local
7618 .enabled = param->value, in ipw2100_wx_set_auth()
7620 priv->ieee->drop_unencrypted = param->value; in ipw2100_wx_set_auth()
7624 if (!param->value) { in ipw2100_wx_set_auth()
7625 sec.flags |= SEC_LEVEL; in ipw2100_wx_set_auth()
7626 sec.level = SEC_LEVEL_0; in ipw2100_wx_set_auth()
7628 sec.flags |= SEC_LEVEL; in ipw2100_wx_set_auth()
7629 sec.level = SEC_LEVEL_1; in ipw2100_wx_set_auth()
7631 if (priv->ieee->set_security) in ipw2100_wx_set_auth()
7632 priv->ieee->set_security(priv->ieee->dev, &sec); in ipw2100_wx_set_auth()
7637 ret = ipw2100_wpa_set_auth_algs(priv, param->value); in ipw2100_wx_set_auth()
7641 ret = ipw2100_wpa_enable(priv, param->value); in ipw2100_wx_set_auth()
7645 ieee->ieee802_1x = param->value; in ipw2100_wx_set_auth()
7650 ieee->privacy_invoked = param->value; in ipw2100_wx_set_auth()
7654 return -EOPNOTSUPP; in ipw2100_wx_set_auth()
7665 struct libipw_device *ieee = priv->ieee; in ipw2100_wx_get_auth()
7667 struct iw_param *param = &wrqu->param; in ipw2100_wx_get_auth()
7669 switch (param->flags & IW_AUTH_INDEX) { in ipw2100_wx_get_auth()
7680 crypt = priv->ieee->crypt_info.crypt[priv->ieee->crypt_info.tx_keyidx]; in ipw2100_wx_get_auth()
7681 if (!crypt || !crypt->ops->get_flags) { in ipw2100_wx_get_auth()
7687 param->value = (crypt->ops->get_flags(crypt->priv) & in ipw2100_wx_get_auth()
7693 param->value = ieee->drop_unencrypted; in ipw2100_wx_get_auth()
7697 param->value = priv->ieee->sec.auth_mode; in ipw2100_wx_get_auth()
7701 param->value = ieee->wpa_enabled; in ipw2100_wx_get_auth()
7705 param->value = ieee->ieee802_1x; in ipw2100_wx_get_auth()
7710 param->value = ieee->privacy_invoked; in ipw2100_wx_get_auth()
7714 return -EOPNOTSUPP; in ipw2100_wx_get_auth()
7725 return libipw_wx_set_encodeext(priv->ieee, info, wrqu, extra); in ipw2100_wx_set_encodeext()
7734 return libipw_wx_get_encodeext(priv->ieee, info, wrqu, extra); in ipw2100_wx_get_encodeext()
7745 switch (mlme->cmd) { in ipw2100_wx_set_mlme()
7755 return -EOPNOTSUPP; in ipw2100_wx_set_mlme()
7775 mutex_lock(&priv->action_mutex); in ipw2100_wx_set_promisc()
7776 if (!(priv->status & STATUS_INITIALIZED)) { in ipw2100_wx_set_promisc()
7777 err = -EIO; in ipw2100_wx_set_promisc()
7782 if (priv->ieee->iw_mode == IW_MODE_MONITOR) { in ipw2100_wx_set_promisc()
7786 priv->channel = parms[1]; in ipw2100_wx_set_promisc()
7789 if (priv->ieee->iw_mode == IW_MODE_MONITOR) in ipw2100_wx_set_promisc()
7790 err = ipw2100_switch_mode(priv, priv->last_mode); in ipw2100_wx_set_promisc()
7793 mutex_unlock(&priv->action_mutex); in ipw2100_wx_set_promisc()
7802 if (priv->status & STATUS_INITIALIZED) in ipw2100_wx_reset()
7816 mutex_lock(&priv->action_mutex); in ipw2100_wx_set_powermode()
7817 if (!(priv->status & STATUS_INITIALIZED)) { in ipw2100_wx_set_powermode()
7818 err = -EIO; in ipw2100_wx_set_powermode()
7825 if (IPW_POWER_LEVEL(priv->power_mode) != mode) in ipw2100_wx_set_powermode()
7828 mutex_unlock(&priv->action_mutex); in ipw2100_wx_set_powermode()
7842 int level = IPW_POWER_LEVEL(priv->power_mode); in ipw2100_wx_get_powermode()
7845 if (!(priv->power_mode & IPW_POWER_ENABLED)) { in ipw2100_wx_get_powermode()
7859 timeout = timeout_duration[level - 1] / 1000; in ipw2100_wx_get_powermode()
7860 period = period_duration[level - 1] / 1000; in ipw2100_wx_get_powermode()
7868 wrqu->data.length = strlen(extra) + 1; in ipw2100_wx_get_powermode()
7880 mutex_lock(&priv->action_mutex); in ipw2100_wx_set_preamble()
7881 if (!(priv->status & STATUS_INITIALIZED)) { in ipw2100_wx_set_preamble()
7882 err = -EIO; in ipw2100_wx_set_preamble()
7887 priv->config |= CFG_LONG_PREAMBLE; in ipw2100_wx_set_preamble()
7889 priv->config &= ~CFG_LONG_PREAMBLE; in ipw2100_wx_set_preamble()
7891 err = -EINVAL; in ipw2100_wx_set_preamble()
7898 mutex_unlock(&priv->action_mutex); in ipw2100_wx_set_preamble()
7912 if (priv->config & CFG_LONG_PREAMBLE) in ipw2100_wx_get_preamble()
7913 snprintf(wrqu->name, IFNAMSIZ, "long (1)"); in ipw2100_wx_get_preamble()
7915 snprintf(wrqu->name, IFNAMSIZ, "auto (0)"); in ipw2100_wx_get_preamble()
7928 mutex_lock(&priv->action_mutex); in ipw2100_wx_set_crc_check()
7929 if (!(priv->status & STATUS_INITIALIZED)) { in ipw2100_wx_set_crc_check()
7930 err = -EIO; in ipw2100_wx_set_crc_check()
7935 priv->config |= CFG_CRC_CHECK; in ipw2100_wx_set_crc_check()
7937 priv->config &= ~CFG_CRC_CHECK; in ipw2100_wx_set_crc_check()
7939 err = -EINVAL; in ipw2100_wx_set_crc_check()
7945 mutex_unlock(&priv->action_mutex); in ipw2100_wx_set_crc_check()
7959 if (priv->config & CFG_CRC_CHECK) in ipw2100_wx_get_crc_check()
7960 snprintf(wrqu->name, IFNAMSIZ, "CRC checked (1)"); in ipw2100_wx_get_crc_check()
7962 snprintf(wrqu->name, IFNAMSIZ, "CRC ignored (0)"); in ipw2100_wx_get_crc_check()
8098 wstats = &priv->wstats; in ipw2100_wx_wireless_stats()
8105 if (!(priv->status & STATUS_ASSOCIATED)) { in ipw2100_wx_wireless_stats()
8106 wstats->miss.beacon = 0; in ipw2100_wx_wireless_stats()
8107 wstats->discard.retries = 0; in ipw2100_wx_wireless_stats()
8108 wstats->qual.qual = 0; in ipw2100_wx_wireless_stats()
8109 wstats->qual.level = 0; in ipw2100_wx_wireless_stats()
8110 wstats->qual.noise = 0; in ipw2100_wx_wireless_stats()
8111 wstats->qual.updated = 7; in ipw2100_wx_wireless_stats()
8112 wstats->qual.updated |= IW_QUAL_NOISE_INVALID | in ipw2100_wx_wireless_stats()
8122 if (!(priv->status & STATUS_ASSOCIATED)) { in ipw2100_wx_wireless_stats()
8123 wstats->qual.qual = 0; in ipw2100_wx_wireless_stats()
8124 wstats->qual.level = 0; in ipw2100_wx_wireless_stats()
8129 wstats->qual.level = rssi + IPW2100_RSSI_TO_DBM; in ipw2100_wx_wireless_stats()
8133 rssi_qual = (rssi - 10) * (FAIR - POOR) / 5 + POOR; in ipw2100_wx_wireless_stats()
8135 rssi_qual = (rssi - 15) * (GOOD - FAIR) / 5 + FAIR; in ipw2100_wx_wireless_stats()
8137 rssi_qual = (rssi - 20) * (VERY_GOOD - GOOD) / in ipw2100_wx_wireless_stats()
8140 rssi_qual = (rssi - 30) * (PERFECT - VERY_GOOD) / in ipw2100_wx_wireless_stats()
8148 tx_qual = (90 - tx_retries) * POOR / 15; in ipw2100_wx_wireless_stats()
8150 tx_qual = (75 - tx_retries) * (FAIR - POOR) / 5 + POOR; in ipw2100_wx_wireless_stats()
8152 tx_qual = (70 - tx_retries) * (GOOD - FAIR) / 5 + FAIR; in ipw2100_wx_wireless_stats()
8154 tx_qual = (65 - tx_retries) * (VERY_GOOD - GOOD) / in ipw2100_wx_wireless_stats()
8157 tx_qual = (50 - tx_retries) * in ipw2100_wx_wireless_stats()
8158 (PERFECT - VERY_GOOD) / 50 + VERY_GOOD; in ipw2100_wx_wireless_stats()
8161 beacon_qual = (60 - missed_beacons) * POOR / 10; in ipw2100_wx_wireless_stats()
8163 beacon_qual = (50 - missed_beacons) * (FAIR - POOR) / in ipw2100_wx_wireless_stats()
8166 beacon_qual = (40 - missed_beacons) * (GOOD - FAIR) / in ipw2100_wx_wireless_stats()
8169 beacon_qual = (32 - missed_beacons) * in ipw2100_wx_wireless_stats()
8170 (VERY_GOOD - GOOD) / 20 + GOOD; in ipw2100_wx_wireless_stats()
8172 beacon_qual = (20 - missed_beacons) * in ipw2100_wx_wireless_stats()
8173 (PERFECT - VERY_GOOD) / 20 + VERY_GOOD; in ipw2100_wx_wireless_stats()
8182 IPW_DEBUG_WX("Quality clamped by Tx Retries\n"); in ipw2100_wx_wireless_stats()
8189 wstats->qual.qual = quality; in ipw2100_wx_wireless_stats()
8190 wstats->qual.level = rssi + IPW2100_RSSI_TO_DBM; in ipw2100_wx_wireless_stats()
8193 wstats->qual.noise = 0; in ipw2100_wx_wireless_stats()
8194 wstats->qual.updated = 7; in ipw2100_wx_wireless_stats()
8195 wstats->qual.updated |= IW_QUAL_NOISE_INVALID; in ipw2100_wx_wireless_stats()
8198 wstats->miss.beacon = missed_beacons; in ipw2100_wx_wireless_stats()
8203 wstats->discard.retries = tx_failures; in ipw2100_wx_wireless_stats()
8230 if (priv->status & STATUS_STOPPING) in ipw2100_wx_event_work()
8233 mutex_lock(&priv->action_mutex); in ipw2100_wx_event_work()
8237 mutex_unlock(&priv->action_mutex); in ipw2100_wx_event_work()
8242 if (!(priv->status & (STATUS_ASSOCIATING | STATUS_ASSOCIATED)) || in ipw2100_wx_event_work()
8243 priv->status & STATUS_RF_KILL_MASK || in ipw2100_wx_event_work()
8245 &priv->bssid, &len)) { in ipw2100_wx_event_work()
8250 memcpy(wrqu.ap_addr.sa_data, priv->bssid, ETH_ALEN); in ipw2100_wx_event_work()
8251 memcpy(priv->ieee->bssid, priv->bssid, ETH_ALEN); in ipw2100_wx_event_work()
8252 priv->status &= ~STATUS_ASSOCIATING; in ipw2100_wx_event_work()
8253 priv->status |= STATUS_ASSOCIATED; in ipw2100_wx_event_work()
8254 netif_carrier_on(priv->net_dev); in ipw2100_wx_event_work()
8255 netif_wake_queue(priv->net_dev); in ipw2100_wx_event_work()
8258 if (!(priv->status & STATUS_ASSOCIATED)) { in ipw2100_wx_event_work()
8260 mutex_lock(&priv->action_mutex); in ipw2100_wx_event_work()
8263 if (priv->config & CFG_STATIC_ESSID) in ipw2100_wx_event_work()
8264 ipw2100_set_essid(priv, priv->essid, priv->essid_len, in ipw2100_wx_event_work()
8268 mutex_unlock(&priv->action_mutex); in ipw2100_wx_event_work()
8271 wireless_send_event(priv->net_dev, SIOCGIWAP, &wrqu, NULL); in ipw2100_wx_event_work()
8283 #define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \
8312 (struct ipw2100_fw_header *)fw->fw_entry->data; in ipw2100_mod_firmware_load()
8314 if (IPW2100_FW_MAJOR(h->version) != IPW2100_FW_MAJOR_VERSION) { in ipw2100_mod_firmware_load()
8318 h->version); in ipw2100_mod_firmware_load()
8322 fw->version = h->version; in ipw2100_mod_firmware_load()
8323 fw->fw.data = fw->fw_entry->data + sizeof(struct ipw2100_fw_header); in ipw2100_mod_firmware_load()
8324 fw->fw.size = h->fw_size; in ipw2100_mod_firmware_load()
8325 fw->uc.data = fw->fw.data + h->fw_size; in ipw2100_mod_firmware_load()
8326 fw->uc.size = h->uc_size; in ipw2100_mod_firmware_load()
8338 priv->net_dev->name); in ipw2100_get_firmware()
8340 switch (priv->ieee->iw_mode) { in ipw2100_get_firmware()
8342 fw_name = IPW2100_FW_NAME("-i"); in ipw2100_get_firmware()
8346 fw_name = IPW2100_FW_NAME("-p"); in ipw2100_get_firmware()
8355 rc = request_firmware(&fw->fw_entry, fw_name, &priv->pci_dev->dev); in ipw2100_get_firmware()
8360 priv->net_dev->name, fw_name); in ipw2100_get_firmware()
8363 IPW_DEBUG_INFO("firmware data %p size %zd\n", fw->fw_entry->data, in ipw2100_get_firmware()
8364 fw->fw_entry->size); in ipw2100_get_firmware()
8371 MODULE_FIRMWARE(IPW2100_FW_NAME("-i"));
8373 MODULE_FIRMWARE(IPW2100_FW_NAME("-p"));
8380 fw->version = 0; in ipw2100_release_firmware()
8381 release_firmware(fw->fw_entry); in ipw2100_release_firmware()
8382 fw->fw_entry = NULL; in ipw2100_release_firmware()
8394 return -EIO; in ipw2100_get_fwversion()
8397 len = max - 1; in ipw2100_get_fwversion()
8420 const unsigned char *firmware_data = fw->fw.data; in ipw2100_fw_download()
8421 unsigned int firmware_data_left = fw->fw.size; in ipw2100_fw_download()
8426 firmware_data_left -= 4; in ipw2100_fw_download()
8430 firmware_data_left -= 2; in ipw2100_fw_download()
8434 "Invalid firmware run-length of %d bytes\n", in ipw2100_fw_download()
8436 return -EINVAL; in ipw2100_fw_download()
8439 write_nic_memory(priv->net_dev, addr, len, firmware_data); in ipw2100_fw_download()
8441 firmware_data_left -= len; in ipw2100_fw_download()
8467 struct net_device *dev = priv->net_dev; in ipw2100_ucode_download()
8468 const unsigned char *microcode_data = fw->uc.data; in ipw2100_ucode_download()
8469 unsigned int microcode_data_left = fw->uc.size; in ipw2100_ucode_download()
8470 void __iomem *reg = priv->ioaddr; in ipw2100_ucode_download()
8501 microcode_data_left -= 2; in ipw2100_ucode_download()
8533 /* check Symbol is enabled - upped this from 5 as it wasn't always in ipw2100_ucode_download()
8546 dev->name); in ipw2100_ucode_download()
8547 return -EIO; in ipw2100_ucode_download()
8564 ": %s: No response from Symbol - hw not alive\n", in ipw2100_ucode_download()
8565 dev->name); in ipw2100_ucode_download()
8567 return -EIO; in ipw2100_ucode_download()