Lines Matching +full:assoc +full:- +full:select
1 // SPDX-License-Identifier: GPL-2.0-only
4 * Copyright(c) 2003 - 2011 Intel Corporation. All rights reserved.
11 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
22 #include <linux/dma-mapping.h>
41 #include "iwl-spectrum.h"
62 #define DRV_COPYRIGHT "Copyright(c) 2003-2011 Intel Corporation"
79 * il3945_get_antenna_flags - Get antenna flags for RXON command
82 * il->eeprom39 is used to determine if antenna AUX/MAIN are reversed
85 * IL_ANTENNA_DIVERSITY - NIC selects best antenna by itself
86 * IL_ANTENNA_MAIN - Force MAIN antenna
87 * IL_ANTENNA_AUX - Force AUX antenna
92 struct il3945_eeprom *eeprom = (struct il3945_eeprom *)il->eeprom; in il3945_get_antenna_flags()
99 if (eeprom->antenna_switch_type) in il3945_get_antenna_flags()
104 if (eeprom->antenna_switch_type) in il3945_get_antenna_flags()
125 key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS); in il3945_set_ccmp_dynamic_key_info()
127 if (sta_id == il->hw_params.bcast_id) in il3945_set_ccmp_dynamic_key_info()
130 keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; in il3945_set_ccmp_dynamic_key_info()
131 keyconf->hw_key_idx = keyconf->keyidx; in il3945_set_ccmp_dynamic_key_info()
134 spin_lock_irqsave(&il->sta_lock, flags); in il3945_set_ccmp_dynamic_key_info()
135 il->stations[sta_id].keyinfo.cipher = keyconf->cipher; in il3945_set_ccmp_dynamic_key_info()
136 il->stations[sta_id].keyinfo.keylen = keyconf->keylen; in il3945_set_ccmp_dynamic_key_info()
137 memcpy(il->stations[sta_id].keyinfo.key, keyconf->key, keyconf->keylen); in il3945_set_ccmp_dynamic_key_info()
139 memcpy(il->stations[sta_id].sta.key.key, keyconf->key, keyconf->keylen); in il3945_set_ccmp_dynamic_key_info()
141 if ((il->stations[sta_id].sta.key. in il3945_set_ccmp_dynamic_key_info()
143 il->stations[sta_id].sta.key.key_offset = in il3945_set_ccmp_dynamic_key_info()
148 WARN(il->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET, in il3945_set_ccmp_dynamic_key_info()
151 il->stations[sta_id].sta.key.key_flags = key_flags; in il3945_set_ccmp_dynamic_key_info()
152 il->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; in il3945_set_ccmp_dynamic_key_info()
153 il->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; in il3945_set_ccmp_dynamic_key_info()
157 ret = il_send_add_sta(il, &il->stations[sta_id].sta, CMD_ASYNC); in il3945_set_ccmp_dynamic_key_info()
159 spin_unlock_irqrestore(&il->sta_lock, flags); in il3945_set_ccmp_dynamic_key_info()
168 return -EOPNOTSUPP; in il3945_set_tkip_dynamic_key_info()
175 return -EOPNOTSUPP; in il3945_set_wep_dynamic_key_info()
184 spin_lock_irqsave(&il->sta_lock, flags); in il3945_clear_sta_key_info()
185 memset(&il->stations[sta_id].keyinfo, 0, sizeof(struct il_hw_key)); in il3945_clear_sta_key_info()
186 memset(&il->stations[sta_id].sta.key, 0, sizeof(struct il4965_keyinfo)); in il3945_clear_sta_key_info()
187 il->stations[sta_id].sta.key.key_flags = STA_KEY_FLG_NO_ENC; in il3945_clear_sta_key_info()
188 il->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; in il3945_clear_sta_key_info()
189 il->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; in il3945_clear_sta_key_info()
190 memcpy(&sta_cmd, &il->stations[sta_id].sta, in il3945_clear_sta_key_info()
192 spin_unlock_irqrestore(&il->sta_lock, flags); in il3945_clear_sta_key_info()
204 keyconf->hw_key_idx = HW_KEY_DYNAMIC; in il3945_set_dynamic_key()
206 switch (keyconf->cipher) { in il3945_set_dynamic_key()
218 IL_ERR("Unknown alg: %s alg=%x\n", __func__, keyconf->cipher); in il3945_set_dynamic_key()
219 ret = -EINVAL; in il3945_set_dynamic_key()
223 keyconf->cipher, keyconf->keylen, keyconf->keyidx, sta_id, ret); in il3945_set_dynamic_key()
231 return -EOPNOTSUPP; in il3945_remove_static_key()
237 if (key->cipher == WLAN_CIPHER_SUITE_WEP40 || in il3945_set_static_key()
238 key->cipher == WLAN_CIPHER_SUITE_WEP104) in il3945_set_static_key()
239 return -EOPNOTSUPP; in il3945_set_static_key()
241 IL_ERR("Static key invalid: cipher %x\n", key->cipher); in il3945_set_static_key()
242 return -EINVAL; in il3945_set_static_key()
250 D_INFO("%d frames on pre-allocated heap on clear.\n", il->frames_count); in il3945_clear_free_frames()
252 while (!list_empty(&il->free_frames)) { in il3945_clear_free_frames()
253 element = il->free_frames.next; in il3945_clear_free_frames()
256 il->frames_count--; in il3945_clear_free_frames()
259 if (il->frames_count) { in il3945_clear_free_frames()
261 il->frames_count); in il3945_clear_free_frames()
262 il->frames_count = 0; in il3945_clear_free_frames()
271 if (list_empty(&il->free_frames)) { in il3945_get_free_frame()
278 il->frames_count++; in il3945_get_free_frame()
282 element = il->free_frames.next; in il3945_get_free_frame()
291 list_add(&frame->list, &il->free_frames); in il3945_free_frame()
299 if (!il_is_associated(il) || !il->beacon_skb) in il3945_fill_beacon_frame()
302 if (il->beacon_skb->len > left) in il3945_fill_beacon_frame()
305 memcpy(hdr, il->beacon_skb->data, il->beacon_skb->len); in il3945_fill_beacon_frame()
307 return il->beacon_skb->len; in il3945_fill_beacon_frame()
323 return -ENOMEM; in il3945_send_beacon_cmd()
330 rc = il_send_cmd_pdu(il, C_TX_BEACON, frame_size, &frame->u.cmd[0]); in il3945_send_beacon_cmd()
340 if (il->_3945.shared_virt) in il3945_unset_hw_params()
341 dma_free_coherent(&il->pci_dev->dev, in il3945_unset_hw_params()
343 il->_3945.shared_virt, il->_3945.shared_phys); in il3945_unset_hw_params()
351 struct il3945_tx_cmd *tx_cmd = (struct il3945_tx_cmd *)cmd->cmd.payload; in il3945_build_tx_cmd_hwcrypto()
352 struct il_hw_key *keyinfo = &il->stations[sta_id].keyinfo; in il3945_build_tx_cmd_hwcrypto()
354 tx_cmd->sec_ctl = 0; in il3945_build_tx_cmd_hwcrypto()
356 switch (keyinfo->cipher) { in il3945_build_tx_cmd_hwcrypto()
358 tx_cmd->sec_ctl = TX_CMD_SEC_CCM; in il3945_build_tx_cmd_hwcrypto()
359 memcpy(tx_cmd->key, keyinfo->key, keyinfo->keylen); in il3945_build_tx_cmd_hwcrypto()
367 tx_cmd->sec_ctl |= TX_CMD_SEC_KEY128; in il3945_build_tx_cmd_hwcrypto()
370 tx_cmd->sec_ctl |= in il3945_build_tx_cmd_hwcrypto()
371 TX_CMD_SEC_WEP | (info->control.hw_key-> in il3945_build_tx_cmd_hwcrypto()
375 memcpy(&tx_cmd->key[3], keyinfo->key, keyinfo->keylen); in il3945_build_tx_cmd_hwcrypto()
378 info->control.hw_key->hw_key_idx); in il3945_build_tx_cmd_hwcrypto()
382 IL_ERR("Unknown encode cipher %x\n", keyinfo->cipher); in il3945_build_tx_cmd_hwcrypto()
395 struct il3945_tx_cmd *tx_cmd = (struct il3945_tx_cmd *)cmd->cmd.payload; in il3945_build_tx_cmd_basic()
396 __le32 tx_flags = tx_cmd->tx_flags; in il3945_build_tx_cmd_basic()
397 __le16 fc = hdr->frame_control; in il3945_build_tx_cmd_basic()
399 tx_cmd->stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; in il3945_build_tx_cmd_basic()
400 if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) { in il3945_build_tx_cmd_basic()
405 !(le16_to_cpu(hdr->seq_ctrl) & 0xf)) in il3945_build_tx_cmd_basic()
412 tx_cmd->sta_id = std_id; in il3945_build_tx_cmd_basic()
418 tx_cmd->tid_tspec = qc[0] & 0xf; in il3945_build_tx_cmd_basic()
429 tx_cmd->timeout.pm_frame_timeout = cpu_to_le16(3); in il3945_build_tx_cmd_basic()
431 tx_cmd->timeout.pm_frame_timeout = cpu_to_le16(2); in il3945_build_tx_cmd_basic()
433 tx_cmd->timeout.pm_frame_timeout = 0; in il3945_build_tx_cmd_basic()
436 tx_cmd->driver_txop = 0; in il3945_build_tx_cmd_basic()
437 tx_cmd->tx_flags = tx_flags; in il3945_build_tx_cmd_basic()
438 tx_cmd->next_frame_len = 0; in il3945_build_tx_cmd_basic()
449 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; in il3945_tx_skb()
467 spin_lock_irqsave(&il->lock, flags); in il3945_tx_skb()
469 D_DROP("Dropping - RF KILL\n"); in il3945_tx_skb()
473 if ((ieee80211_get_tx_rate(il->hw, info)->hw_value & 0xFF) == in il3945_tx_skb()
479 fc = hdr->frame_control; in il3945_tx_skb()
485 D_TX("Sending ASSOC frame\n"); in il3945_tx_skb()
490 spin_unlock_irqrestore(&il->lock, flags); in il3945_tx_skb()
497 D_DROP("Dropping - INVALID STATION: %pM\n", hdr->addr1); in il3945_tx_skb()
511 txq = &il->txq[txq_id]; in il3945_tx_skb()
512 q = &txq->q; in il3945_tx_skb()
514 if ((il_queue_space(q) < q->high_mark)) in il3945_tx_skb()
517 spin_lock_irqsave(&il->lock, flags); in il3945_tx_skb()
519 idx = il_get_cmd_idx(q, q->write_ptr, 0); in il3945_tx_skb()
521 txq->skbs[q->write_ptr] = skb; in il3945_tx_skb()
524 out_cmd = txq->cmd[idx]; in il3945_tx_skb()
525 out_meta = &txq->meta[idx]; in il3945_tx_skb()
526 tx_cmd = (struct il3945_tx_cmd *)out_cmd->cmd.payload; in il3945_tx_skb()
527 memset(&out_cmd->hdr, 0, sizeof(out_cmd->hdr)); in il3945_tx_skb()
531 * Set up the Tx-command (not MAC!) header. in il3945_tx_skb()
534 * locate the frame within the tx queue and do post-tx processing. in il3945_tx_skb()
536 out_cmd->hdr.cmd = C_TX; in il3945_tx_skb()
537 out_cmd->hdr.sequence = in il3945_tx_skb()
539 (QUEUE_TO_SEQ(txq_id) | IDX_TO_SEQ(q->write_ptr))); in il3945_tx_skb()
542 memcpy(tx_cmd->hdr, hdr, hdr_len); in il3945_tx_skb()
544 if (info->control.hw_key) in il3945_tx_skb()
553 tx_cmd->len = cpu_to_le16((u16) skb->len); in il3945_tx_skb()
555 tx_cmd->tx_flags &= ~TX_CMD_FLG_ANT_A_MSK; in il3945_tx_skb()
556 tx_cmd->tx_flags &= ~TX_CMD_FLG_ANT_B_MSK; in il3945_tx_skb()
575 pci_map_single(il->pci_dev, &out_cmd->hdr, firstlen, in il3945_tx_skb()
577 if (unlikely(pci_dma_mapping_error(il->pci_dev, txcmd_phys))) in il3945_tx_skb()
582 secondlen = skb->len - hdr_len; in il3945_tx_skb()
585 pci_map_single(il->pci_dev, skb->data + hdr_len, secondlen, in il3945_tx_skb()
587 if (unlikely(pci_dma_mapping_error(il->pci_dev, phys_addr))) in il3945_tx_skb()
593 il->ops->txq_attach_buf_to_tfd(il, txq, txcmd_phys, firstlen, 1, 0); in il3945_tx_skb()
597 il->ops->txq_attach_buf_to_tfd(il, txq, phys_addr, secondlen, 0, in il3945_tx_skb()
600 if (!ieee80211_has_morefrags(hdr->frame_control)) { in il3945_tx_skb()
601 txq->need_update = 1; in il3945_tx_skb()
604 txq->need_update = 0; in il3945_tx_skb()
607 il_update_stats(il, true, fc, skb->len); in il3945_tx_skb()
609 D_TX("sequence nr = 0X%x\n", le16_to_cpu(out_cmd->hdr.sequence)); in il3945_tx_skb()
610 D_TX("tx_flags = 0X%x\n", le32_to_cpu(tx_cmd->tx_flags)); in il3945_tx_skb()
612 il_print_hex_dump(il, IL_DL_TX, (u8 *) tx_cmd->hdr, in il3945_tx_skb()
616 q->write_ptr = il_queue_inc_wrap(q->write_ptr, q->n_bd); in il3945_tx_skb()
618 spin_unlock_irqrestore(&il->lock, flags); in il3945_tx_skb()
620 if (il_queue_space(q) < q->high_mark && il->mac80211_registered) { in il3945_tx_skb()
622 spin_lock_irqsave(&il->lock, flags); in il3945_tx_skb()
623 txq->need_update = 1; in il3945_tx_skb()
625 spin_unlock_irqrestore(&il->lock, flags); in il3945_tx_skb()
634 spin_unlock_irqrestore(&il->lock, flags); in il3945_tx_skb()
636 return -1; in il3945_tx_skb()
650 u32 add_time = le64_to_cpu(params->start_time); in il3945_get_measurement()
653 int duration = le16_to_cpu(params->duration); in il3945_get_measurement()
658 le64_to_cpu(params->start_time) - in il3945_get_measurement()
659 il->_3945.last_tsf, in il3945_get_measurement()
660 le16_to_cpu(il->timing.beacon_interval)); in il3945_get_measurement()
669 spectrum.len = cpu_to_le16(cmd.len - sizeof(spectrum.len)); in il3945_get_measurement()
673 il_add_beacon_time(il, il->_3945.last_beacon_time, add_time, in il3945_get_measurement()
674 le16_to_cpu(il->timing.beacon_interval)); in il3945_get_measurement()
679 spectrum.channels[0].channel = params->channel; in il3945_get_measurement()
681 if (il->active.flags & RXON_FLG_BAND_24G_MSK) in il3945_get_measurement()
691 if (pkt->hdr.flags & IL_CMD_FAILED_MSK) { in il3945_get_measurement()
693 rc = -EIO; in il3945_get_measurement()
696 spectrum_resp_status = le16_to_cpu(pkt->u.spectrum.status); in il3945_get_measurement()
699 if (pkt->u.spectrum.id != 0xff) { in il3945_get_measurement()
701 pkt->u.spectrum.id); in il3945_get_measurement()
702 il->measurement_status &= ~MEASUREMENT_READY; in il3945_get_measurement()
704 il->measurement_status |= MEASUREMENT_ACTIVE; in il3945_get_measurement()
709 rc = -EAGAIN; in il3945_get_measurement()
725 palive = &pkt->u.alive_frame; in il3945_hdl_alive()
728 palive->is_valid, palive->ver_type, palive->ver_subtype); in il3945_hdl_alive()
730 if (palive->ver_subtype == INITIALIZE_SUBTYPE) { in il3945_hdl_alive()
732 memcpy(&il->card_alive_init, &pkt->u.alive_frame, in il3945_hdl_alive()
734 pwork = &il->init_alive_start; in il3945_hdl_alive()
737 memcpy(&il->card_alive, &pkt->u.alive_frame, in il3945_hdl_alive()
739 pwork = &il->alive_start; in il3945_hdl_alive()
745 if (palive->is_valid == UCODE_VALID_OK) in il3945_hdl_alive()
746 queue_delayed_work(il->workqueue, pwork, msecs_to_jiffies(5)); in il3945_hdl_alive()
758 D_RX("Received C_ADD_STA: 0x%02X\n", pkt->u.status); in il3945_hdl_add_sta()
765 struct il3945_beacon_notif *beacon = &(pkt->u.beacon_status); in il3945_hdl_beacon()
767 u8 rate = beacon->beacon_notify_hdr.rate; in il3945_hdl_beacon()
770 le32_to_cpu(beacon->beacon_notify_hdr.status) & TX_STATUS_MSK, in il3945_hdl_beacon()
771 beacon->beacon_notify_hdr.failure_frame, in il3945_hdl_beacon()
772 le32_to_cpu(beacon->ibss_mgr_status), in il3945_hdl_beacon()
773 le32_to_cpu(beacon->high_tsf), le32_to_cpu(beacon->low_tsf), rate); in il3945_hdl_beacon()
776 il->ibss_manager = le32_to_cpu(beacon->ibss_mgr_status); in il3945_hdl_beacon()
786 u32 flags = le32_to_cpu(pkt->u.card_state_notif.flags); in il3945_hdl_card_state()
787 unsigned long status = il->status; in il3945_hdl_card_state()
796 set_bit(S_RFKILL, &il->status); in il3945_hdl_card_state()
798 clear_bit(S_RFKILL, &il->status); in il3945_hdl_card_state()
803 test_bit(S_RFKILL, &il->status))) in il3945_hdl_card_state()
804 wiphy_rfkill_set_hw_state(il->hw->wiphy, in il3945_hdl_card_state()
805 test_bit(S_RFKILL, &il->status)); in il3945_hdl_card_state()
807 wake_up(&il->wait_command_queue); in il3945_hdl_card_state()
811 * il3945_setup_handlers - Initialize Rx handler callbacks
822 il->handlers[N_ALIVE] = il3945_hdl_alive; in il3945_setup_handlers()
823 il->handlers[C_ADD_STA] = il3945_hdl_add_sta; in il3945_setup_handlers()
824 il->handlers[N_ERROR] = il_hdl_error; in il3945_setup_handlers()
825 il->handlers[N_CHANNEL_SWITCH] = il_hdl_csa; in il3945_setup_handlers()
826 il->handlers[N_SPECTRUM_MEASUREMENT] = il_hdl_spectrum_measurement; in il3945_setup_handlers()
827 il->handlers[N_PM_SLEEP] = il_hdl_pm_sleep; in il3945_setup_handlers()
828 il->handlers[N_PM_DEBUG_STATS] = il_hdl_pm_debug_stats; in il3945_setup_handlers()
829 il->handlers[N_BEACON] = il3945_hdl_beacon; in il3945_setup_handlers()
836 il->handlers[C_STATS] = il3945_hdl_c_stats; in il3945_setup_handlers()
837 il->handlers[N_STATS] = il3945_hdl_stats; in il3945_setup_handlers()
840 il->handlers[N_CARD_STATE] = il3945_hdl_card_state; in il3945_setup_handlers()
846 /************************** RX-FUNCTIONS ****************************/
858 * to -- the driver can read up to (but not including) this position and get
862 * The WRITE idx maps to the last position the driver has read from -- the
865 * The queue is empty (no good data) if WRITE = READ - 1, and is full if
869 * IDX position, and WRITE to the last (READ - 1 wrapped)
877 * + A list of pre-allocated SKBs is stored in iwl->rxq->rx_free. When
878 * iwl->rxq->free_count drops to or below RX_LOW_WATERMARK, work is scheduled
879 * to replenish the iwl->rxq->rx_free.
881 * iwl->rxq is replenished and the READ IDX is updated (updating the
884 * detached from the iwl->rxq. The driver 'processed' idx is updated.
885 * + The Host/Firmware iwl->rxq is replenished at tasklet time from the rx_free
886 * list. If there are no allocated buffers in iwl->rxq->rx_free, the READ
887 * IDX is not incremented and iwl->status(RX_STALLED) is set. If there
900 * -- enable interrupts --
901 * ISR - il3945_rx() Detach il_rx_bufs from pool up to the
911 * il3945_dma_addr2rbd_ptr - convert a DMA address to a uCode read buffer ptr
920 * il3945_rx_queue_restock - refill RX queue from pre-allocated pool
923 * and we have free pre-allocated buffers, fill the ranks as much
933 struct il_rx_queue *rxq = &il->rxq; in il3945_rx_queue_restock()
938 spin_lock_irqsave(&rxq->lock, flags); in il3945_rx_queue_restock()
939 while (il_rx_queue_space(rxq) > 0 && rxq->free_count) { in il3945_rx_queue_restock()
941 element = rxq->rx_free.next; in il3945_rx_queue_restock()
946 rxq->bd[rxq->write] = in il3945_rx_queue_restock()
947 il3945_dma_addr2rbd_ptr(il, rxb->page_dma); in il3945_rx_queue_restock()
948 rxq->queue[rxq->write] = rxb; in il3945_rx_queue_restock()
949 rxq->write = (rxq->write + 1) & RX_QUEUE_MASK; in il3945_rx_queue_restock()
950 rxq->free_count--; in il3945_rx_queue_restock()
952 spin_unlock_irqrestore(&rxq->lock, flags); in il3945_rx_queue_restock()
953 /* If the pre-allocated buffer pool is dropping low, schedule to in il3945_rx_queue_restock()
955 if (rxq->free_count <= RX_LOW_WATERMARK) in il3945_rx_queue_restock()
956 queue_work(il->workqueue, &il->rx_replenish); in il3945_rx_queue_restock()
960 if (rxq->write_actual != (rxq->write & ~0x7) || in il3945_rx_queue_restock()
961 abs(rxq->write - rxq->read) > 7) { in il3945_rx_queue_restock()
962 spin_lock_irqsave(&rxq->lock, flags); in il3945_rx_queue_restock()
963 rxq->need_update = 1; in il3945_rx_queue_restock()
964 spin_unlock_irqrestore(&rxq->lock, flags); in il3945_rx_queue_restock()
970 * il3945_rx_replenish - Move all used packet from rx_used to rx_free
980 struct il_rx_queue *rxq = &il->rxq; in il3945_rx_allocate()
989 spin_lock_irqsave(&rxq->lock, flags); in il3945_rx_allocate()
990 if (list_empty(&rxq->rx_used)) { in il3945_rx_allocate()
991 spin_unlock_irqrestore(&rxq->lock, flags); in il3945_rx_allocate()
994 spin_unlock_irqrestore(&rxq->lock, flags); in il3945_rx_allocate()
996 if (rxq->free_count > RX_LOW_WATERMARK) in il3945_rx_allocate()
999 if (il->hw_params.rx_page_order > 0) in il3945_rx_allocate()
1003 page = alloc_pages(gfp_mask, il->hw_params.rx_page_order); in il3945_rx_allocate()
1007 if (rxq->free_count <= RX_LOW_WATERMARK && in il3945_rx_allocate()
1011 priority, rxq->free_count); in il3945_rx_allocate()
1012 /* We don't reschedule replenish work here -- we will in il3945_rx_allocate()
1020 pci_map_page(il->pci_dev, page, 0, in il3945_rx_allocate()
1021 PAGE_SIZE << il->hw_params.rx_page_order, in il3945_rx_allocate()
1024 if (unlikely(pci_dma_mapping_error(il->pci_dev, page_dma))) { in il3945_rx_allocate()
1025 __free_pages(page, il->hw_params.rx_page_order); in il3945_rx_allocate()
1029 spin_lock_irqsave(&rxq->lock, flags); in il3945_rx_allocate()
1031 if (list_empty(&rxq->rx_used)) { in il3945_rx_allocate()
1032 spin_unlock_irqrestore(&rxq->lock, flags); in il3945_rx_allocate()
1033 pci_unmap_page(il->pci_dev, page_dma, in il3945_rx_allocate()
1034 PAGE_SIZE << il->hw_params.rx_page_order, in il3945_rx_allocate()
1036 __free_pages(page, il->hw_params.rx_page_order); in il3945_rx_allocate()
1040 element = rxq->rx_used.next; in il3945_rx_allocate()
1044 rxb->page = page; in il3945_rx_allocate()
1045 rxb->page_dma = page_dma; in il3945_rx_allocate()
1046 list_add_tail(&rxb->list, &rxq->rx_free); in il3945_rx_allocate()
1047 rxq->free_count++; in il3945_rx_allocate()
1048 il->alloc_rxb_page++; in il3945_rx_allocate()
1050 spin_unlock_irqrestore(&rxq->lock, flags); in il3945_rx_allocate()
1059 spin_lock_irqsave(&rxq->lock, flags); in il3945_rx_queue_reset()
1060 INIT_LIST_HEAD(&rxq->rx_free); in il3945_rx_queue_reset()
1061 INIT_LIST_HEAD(&rxq->rx_used); in il3945_rx_queue_reset()
1066 if (rxq->pool[i].page != NULL) { in il3945_rx_queue_reset()
1067 pci_unmap_page(il->pci_dev, rxq->pool[i].page_dma, in il3945_rx_queue_reset()
1068 PAGE_SIZE << il->hw_params.rx_page_order, in il3945_rx_queue_reset()
1070 __il_free_pages(il, rxq->pool[i].page); in il3945_rx_queue_reset()
1071 rxq->pool[i].page = NULL; in il3945_rx_queue_reset()
1073 list_add_tail(&rxq->pool[i].list, &rxq->rx_used); in il3945_rx_queue_reset()
1078 rxq->read = rxq->write = 0; in il3945_rx_queue_reset()
1079 rxq->write_actual = 0; in il3945_rx_queue_reset()
1080 rxq->free_count = 0; in il3945_rx_queue_reset()
1081 spin_unlock_irqrestore(&rxq->lock, flags); in il3945_rx_queue_reset()
1092 spin_lock_irqsave(&il->lock, flags); in il3945_rx_replenish()
1094 spin_unlock_irqrestore(&il->lock, flags); in il3945_rx_replenish()
1115 if (rxq->pool[i].page != NULL) { in il3945_rx_queue_free()
1116 pci_unmap_page(il->pci_dev, rxq->pool[i].page_dma, in il3945_rx_queue_free()
1117 PAGE_SIZE << il->hw_params.rx_page_order, in il3945_rx_queue_free()
1119 __il_free_pages(il, rxq->pool[i].page); in il3945_rx_queue_free()
1120 rxq->pool[i].page = NULL; in il3945_rx_queue_free()
1124 dma_free_coherent(&il->pci_dev->dev, 4 * RX_QUEUE_SIZE, rxq->bd, in il3945_rx_queue_free()
1125 rxq->bd_dma); in il3945_rx_queue_free()
1126 dma_free_coherent(&il->pci_dev->dev, sizeof(struct il_rb_status), in il3945_rx_queue_free()
1127 rxq->rb_stts, rxq->rb_stts_dma); in il3945_rx_queue_free()
1128 rxq->bd = NULL; in il3945_rx_queue_free()
1129 rxq->rb_stts = NULL; in il3945_rx_queue_free()
1132 /* Convert linear signal-to-noise ratio into dB */
1135 0, 0, 6, 10, 12, 14, 16, 17, 18, 19, /* 00 - 09 */
1136 20, 21, 22, 22, 23, 23, 24, 25, 26, 26, /* 10 - 19 */
1137 26, 26, 26, 27, 27, 28, 28, 28, 29, 29, /* 20 - 29 */
1138 29, 30, 30, 30, 31, 31, 31, 31, 32, 32, /* 30 - 39 */
1139 32, 32, 32, 33, 33, 33, 33, 33, 34, 34, /* 40 - 49 */
1140 34, 34, 34, 34, 35, 35, 35, 35, 35, 35, /* 50 - 59 */
1141 36, 36, 36, 36, 36, 36, 36, 37, 37, 37, /* 60 - 69 */
1142 37, 37, 37, 37, 37, 38, 38, 38, 38, 38, /* 70 - 79 */
1143 38, 38, 38, 38, 38, 39, 39, 39, 39, 39, /* 80 - 89 */
1144 39, 39, 39, 39, 39, 40, 40, 40, 40, 40 /* 90 - 99 */
1166 /* Use table for ratios 1:1 - 99:1 */ in il3945_calc_db_from_ratio()
1171 * il3945_rx_handle - Main entry function for receiving responses from uCode
1173 * Uses the il->handlers callback function array to invoke
1175 * frame-received notifications, and other notifications.
1182 struct il_rx_queue *rxq = &il->rxq; in il3945_rx_handle()
1192 r = le16_to_cpu(rxq->rb_stts->closed_rb_num) & 0x0FFF; in il3945_rx_handle()
1193 i = rxq->read; in il3945_rx_handle()
1196 total_empty = r - rxq->write_actual; in il3945_rx_handle()
1209 rxb = rxq->queue[i]; in il3945_rx_handle()
1213 * routines -- catch it here */ in il3945_rx_handle()
1216 rxq->queue[i] = NULL; in il3945_rx_handle()
1218 pci_unmap_page(il->pci_dev, rxb->page_dma, in il3945_rx_handle()
1219 PAGE_SIZE << il->hw_params.rx_page_order, in il3945_rx_handle()
1223 len = le32_to_cpu(pkt->len_n_flags) & IL_RX_FRAME_SIZE_MSK; in il3945_rx_handle()
1231 if (il->handlers[pkt->hdr.cmd]) { in il3945_rx_handle()
1233 il_get_cmd_string(pkt->hdr.cmd), pkt->hdr.cmd); in il3945_rx_handle()
1234 il->isr_stats.handlers[pkt->hdr.cmd]++; in il3945_rx_handle()
1235 il->handlers[pkt->hdr.cmd] (il, rxb); in il3945_rx_handle()
1239 i, il_get_cmd_string(pkt->hdr.cmd), pkt->hdr.cmd); in il3945_rx_handle()
1243 * XXX: After here, we should always check rxb->page in il3945_rx_handle()
1253 if (rxb->page) in il3945_rx_handle()
1262 spin_lock_irqsave(&rxq->lock, flags); in il3945_rx_handle()
1263 if (rxb->page != NULL) { in il3945_rx_handle()
1264 rxb->page_dma = in il3945_rx_handle()
1265 pci_map_page(il->pci_dev, rxb->page, 0, in il3945_rx_handle()
1266 PAGE_SIZE << il->hw_params. in il3945_rx_handle()
1268 if (unlikely(pci_dma_mapping_error(il->pci_dev, in il3945_rx_handle()
1269 rxb->page_dma))) { in il3945_rx_handle()
1270 __il_free_pages(il, rxb->page); in il3945_rx_handle()
1271 rxb->page = NULL; in il3945_rx_handle()
1272 list_add_tail(&rxb->list, &rxq->rx_used); in il3945_rx_handle()
1274 list_add_tail(&rxb->list, &rxq->rx_free); in il3945_rx_handle()
1275 rxq->free_count++; in il3945_rx_handle()
1278 list_add_tail(&rxb->list, &rxq->rx_used); in il3945_rx_handle()
1280 spin_unlock_irqrestore(&rxq->lock, flags); in il3945_rx_handle()
1288 rxq->read = i; in il3945_rx_handle()
1296 rxq->read = i; in il3945_rx_handle()
1308 synchronize_irq(il->pci_dev->irq); in il3945_synchronize_irq()
1309 tasklet_kill(&il->irq_tasklet); in il3945_synchronize_irq()
1343 base = le32_to_cpu(il->card_alive.error_event_table_ptr); in il3945_dump_nic_error_log()
1354 IL_ERR("Status: 0x%08lX, count: %d\n", il->status, count); in il3945_dump_nic_error_log()
1370 IL_ERR("%-13s (0x%X) %010u 0x%05X 0x%05X 0x%05X 0x%05X %u\n\n", in il3945_dump_nic_error_log()
1387 spin_lock_irqsave(&il->lock, flags); in il3945_irq_tasklet()
1395 /* Ack/clear/reset pending flow-handler (DMA) interrupts. in il3945_irq_tasklet()
1410 spin_unlock_irqrestore(&il->lock, flags); in il3945_irq_tasklet()
1428 il->isr_stats.hw++; in il3945_irq_tasklet()
1441 il->isr_stats.sch++; in il3945_irq_tasklet()
1447 il->isr_stats.alive++; in il3945_irq_tasklet()
1458 il->isr_stats.sw++; in il3945_irq_tasklet()
1463 /* uCode wakes up after power-down sleep */ in il3945_irq_tasklet()
1466 il_rx_queue_update_write_ptr(il, &il->rxq); in il3945_irq_tasklet()
1468 spin_lock_irqsave(&il->lock, flags); in il3945_irq_tasklet()
1469 il_txq_update_write_ptr(il, &il->txq[0]); in il3945_irq_tasklet()
1470 il_txq_update_write_ptr(il, &il->txq[1]); in il3945_irq_tasklet()
1471 il_txq_update_write_ptr(il, &il->txq[2]); in il3945_irq_tasklet()
1472 il_txq_update_write_ptr(il, &il->txq[3]); in il3945_irq_tasklet()
1473 il_txq_update_write_ptr(il, &il->txq[4]); in il3945_irq_tasklet()
1474 spin_unlock_irqrestore(&il->lock, flags); in il3945_irq_tasklet()
1476 il->isr_stats.wakeup++; in il3945_irq_tasklet()
1481 * Rx "responses" (frame-received notification), and other in il3945_irq_tasklet()
1485 il->isr_stats.rx++; in il3945_irq_tasklet()
1491 il->isr_stats.tx++; in il3945_irq_tasklet()
1500 il->isr_stats.unhandled++; in il3945_irq_tasklet()
1503 if (inta & ~il->inta_mask) { in il3945_irq_tasklet()
1505 inta & ~il->inta_mask); in il3945_irq_tasklet()
1509 /* Re-enable all interrupts */ in il3945_irq_tasklet()
1510 /* only Re-enable if disabled by irq */ in il3945_irq_tasklet()
1511 if (test_bit(S_INT_ENABLED, &il->status)) in il3945_irq_tasklet()
1548 for (i = 0, added = 0; i < il->scan_request->n_channels; i++) { in il3945_get_channels_for_scan()
1549 chan = il->scan_request->channels[i]; in il3945_get_channels_for_scan()
1551 if (chan->band != band) in il3945_get_channels_for_scan()
1554 scan_ch->channel = chan->hw_value; in il3945_get_channels_for_scan()
1556 ch_info = il_get_channel_info(il, band, scan_ch->channel); in il3945_get_channels_for_scan()
1559 scan_ch->channel); in il3945_get_channels_for_scan()
1563 scan_ch->active_dwell = cpu_to_le16(active_dwell); in il3945_get_channels_for_scan()
1564 scan_ch->passive_dwell = cpu_to_le16(passive_dwell); in il3945_get_channels_for_scan()
1565 /* If passive , set up for auto-switch in il3945_get_channels_for_scan()
1569 (chan->flags & IEEE80211_CHAN_NO_IR)) { in il3945_get_channels_for_scan()
1570 scan_ch->type = 0; /* passive */ in il3945_get_channels_for_scan()
1571 if (IL_UCODE_API(il->ucode_ver) == 1) in il3945_get_channels_for_scan()
1572 scan_ch->active_dwell = in il3945_get_channels_for_scan()
1573 cpu_to_le16(passive_dwell - 1); in il3945_get_channels_for_scan()
1575 scan_ch->type = 1; /* active */ in il3945_get_channels_for_scan()
1582 if (IL_UCODE_API(il->ucode_ver) >= 2) { in il3945_get_channels_for_scan()
1584 scan_ch->type |= IL39_SCAN_PROBE_MASK(n_probes); in il3945_get_channels_for_scan()
1588 if ((scan_ch->type & 1) && n_probes) in il3945_get_channels_for_scan()
1589 scan_ch->type |= IL39_SCAN_PROBE_MASK(n_probes); in il3945_get_channels_for_scan()
1593 scan_ch->tpc.dsp_atten = 110; in il3945_get_channels_for_scan()
1594 /* scan_pwr_info->tpc.dsp_atten; */ in il3945_get_channels_for_scan()
1596 /*scan_pwr_info->tpc.tx_gain; */ in il3945_get_channels_for_scan()
1598 scan_ch->tpc.tx_gain = ((1 << 5) | (3 << 3)) | 3; in il3945_get_channels_for_scan()
1600 scan_ch->tpc.tx_gain = ((1 << 5) | (5 << 3)); in il3945_get_channels_for_scan()
1603 * scan_ch->tpc.tx_gain = ((1 << 5) | (2 << 3)) | 3; in il3945_get_channels_for_scan()
1607 D_SCAN("Scanning %d [%s %d]\n", scan_ch->channel, in il3945_get_channels_for_scan()
1608 (scan_ch->type & 1) ? "ACTIVE" : "PASSIVE", in il3945_get_channels_for_scan()
1609 (scan_ch->type & 1) ? active_dwell : passive_dwell); in il3945_get_channels_for_scan()
1649 il_free_fw_desc(il->pci_dev, &il->ucode_code); in il3945_dealloc_ucode_pci()
1650 il_free_fw_desc(il->pci_dev, &il->ucode_data); in il3945_dealloc_ucode_pci()
1651 il_free_fw_desc(il->pci_dev, &il->ucode_data_backup); in il3945_dealloc_ucode_pci()
1652 il_free_fw_desc(il->pci_dev, &il->ucode_init); in il3945_dealloc_ucode_pci()
1653 il_free_fw_desc(il->pci_dev, &il->ucode_init_data); in il3945_dealloc_ucode_pci()
1654 il_free_fw_desc(il->pci_dev, &il->ucode_boot); in il3945_dealloc_ucode_pci()
1658 * il3945_verify_inst_full - verify runtime uCode image in card vs. host,
1674 for (; len > 0; len -= sizeof(u32), image++) { in il3945_verify_inst_full()
1675 /* read data comes through single port, auto-incr addr */ in il3945_verify_inst_full()
1682 save_len - len, val, le32_to_cpu(*image)); in il3945_verify_inst_full()
1683 rc = -EIO; in il3945_verify_inst_full()
1697 * il3945_verify_inst_sparse - verify runtime uCode image in card vs. host,
1712 /* read data comes through single port, auto-incr addr */ in il3945_verify_inst_sparse()
1723 rc = -EIO; in il3945_verify_inst_sparse()
1734 * il3945_verify_ucode - determine which instruction image is in SRAM,
1745 image = (__le32 *) il->ucode_boot.v_addr; in il3945_verify_ucode()
1746 len = il->ucode_boot.len; in il3945_verify_ucode()
1754 image = (__le32 *) il->ucode_init.v_addr; in il3945_verify_ucode()
1755 len = il->ucode_init.len; in il3945_verify_ucode()
1763 image = (__le32 *) il->ucode_code.v_addr; in il3945_verify_ucode()
1764 len = il->ucode_code.len; in il3945_verify_ucode()
1776 image = (__le32 *) il->ucode_boot.v_addr; in il3945_verify_ucode()
1777 len = il->ucode_boot.len; in il3945_verify_ucode()
1793 return le32_to_cpu(ucode->v1.item); \
1805 return (u8 *) ucode->v1.data; in il3945_ucode_get_data()
1815 * il3945_read_ucode - Read uCode images from disk file.
1817 * Copy into buffers for card to fetch via bus-mastering
1823 int ret = -EINVAL, idx; in il3945_read_ucode()
1826 const char *name_pre = il->cfg->fw_name_pre; in il3945_read_ucode()
1827 const unsigned int api_max = il->cfg->ucode_api_max; in il3945_read_ucode()
1828 const unsigned int api_min = il->cfg->ucode_api_min; in il3945_read_ucode()
1836 for (idx = api_max; idx >= api_min; idx--) { in il3945_read_ucode()
1838 ret = request_firmware(&ucode_raw, buf, &il->pci_dev->dev); in il3945_read_ucode()
1841 if (ret == -ENOENT) in il3945_read_ucode()
1852 "(%zd bytes) from disk\n", buf, ucode_raw->size); in il3945_read_ucode()
1861 if (ucode_raw->size < il3945_ucode_get_header_size(1)) { in il3945_read_ucode()
1863 ret = -EINVAL; in il3945_read_ucode()
1868 ucode = (struct il_ucode_header *)ucode_raw->data; in il3945_read_ucode()
1870 il->ucode_ver = le32_to_cpu(ucode->ver); in il3945_read_ucode()
1871 api_ver = IL_UCODE_API(il->ucode_ver); in il3945_read_ucode()
1887 il->ucode_ver = 0; in il3945_read_ucode()
1888 ret = -EINVAL; in il3945_read_ucode()
1898 IL_UCODE_MAJOR(il->ucode_ver), IL_UCODE_MINOR(il->ucode_ver), in il3945_read_ucode()
1899 IL_UCODE_API(il->ucode_ver), IL_UCODE_SERIAL(il->ucode_ver)); in il3945_read_ucode()
1901 snprintf(il->hw->wiphy->fw_version, sizeof(il->hw->wiphy->fw_version), in il3945_read_ucode()
1902 "%u.%u.%u.%u", IL_UCODE_MAJOR(il->ucode_ver), in il3945_read_ucode()
1903 IL_UCODE_MINOR(il->ucode_ver), IL_UCODE_API(il->ucode_ver), in il3945_read_ucode()
1904 IL_UCODE_SERIAL(il->ucode_ver)); in il3945_read_ucode()
1906 D_INFO("f/w package hdr ucode version raw = 0x%x\n", il->ucode_ver); in il3945_read_ucode()
1914 if (ucode_raw->size != in il3945_read_ucode()
1919 ucode_raw->size); in il3945_read_ucode()
1920 ret = -EINVAL; in il3945_read_ucode()
1927 ret = -EINVAL; in il3945_read_ucode()
1933 ret = -EINVAL; in il3945_read_ucode()
1939 ret = -EINVAL; in il3945_read_ucode()
1945 ret = -EINVAL; in il3945_read_ucode()
1951 ret = -EINVAL; in il3945_read_ucode()
1955 /* Allocate ucode buffers for card's bus-master loading ... */ in il3945_read_ucode()
1959 * 2) backup cache for save/restore during power-downs */ in il3945_read_ucode()
1960 il->ucode_code.len = inst_size; in il3945_read_ucode()
1961 il_alloc_fw_desc(il->pci_dev, &il->ucode_code); in il3945_read_ucode()
1963 il->ucode_data.len = data_size; in il3945_read_ucode()
1964 il_alloc_fw_desc(il->pci_dev, &il->ucode_data); in il3945_read_ucode()
1966 il->ucode_data_backup.len = data_size; in il3945_read_ucode()
1967 il_alloc_fw_desc(il->pci_dev, &il->ucode_data_backup); in il3945_read_ucode()
1969 if (!il->ucode_code.v_addr || !il->ucode_data.v_addr || in il3945_read_ucode()
1970 !il->ucode_data_backup.v_addr) in il3945_read_ucode()
1975 il->ucode_init.len = init_size; in il3945_read_ucode()
1976 il_alloc_fw_desc(il->pci_dev, &il->ucode_init); in il3945_read_ucode()
1978 il->ucode_init_data.len = init_data_size; in il3945_read_ucode()
1979 il_alloc_fw_desc(il->pci_dev, &il->ucode_init_data); in il3945_read_ucode()
1981 if (!il->ucode_init.v_addr || !il->ucode_init_data.v_addr) in il3945_read_ucode()
1987 il->ucode_boot.len = boot_size; in il3945_read_ucode()
1988 il_alloc_fw_desc(il->pci_dev, &il->ucode_boot); in il3945_read_ucode()
1990 if (!il->ucode_boot.v_addr) in il3945_read_ucode()
1994 /* Copy images into buffers for card's bus-master reads ... */ in il3945_read_ucode()
1999 memcpy(il->ucode_code.v_addr, src, len); in il3945_read_ucode()
2003 il->ucode_code.v_addr, (u32) il->ucode_code.p_addr); in il3945_read_ucode()
2009 memcpy(il->ucode_data.v_addr, src, len); in il3945_read_ucode()
2010 memcpy(il->ucode_data_backup.v_addr, src, len); in il3945_read_ucode()
2017 memcpy(il->ucode_init.v_addr, src, len); in il3945_read_ucode()
2025 memcpy(il->ucode_init_data.v_addr, src, len); in il3945_read_ucode()
2032 memcpy(il->ucode_boot.v_addr, src, len); in il3945_read_ucode()
2040 ret = -ENOMEM; in il3945_read_ucode()
2051 * il3945_set_ucode_ptrs - Set uCode address location
2066 pinst = il->ucode_code.p_addr; in il3945_set_ucode_ptrs()
2067 pdata = il->ucode_data_backup.p_addr; in il3945_set_ucode_ptrs()
2072 il_wr_prph(il, BSM_DRAM_DATA_BYTECOUNT_REG, il->ucode_data.len); in il3945_set_ucode_ptrs()
2077 il->ucode_code.len | BSM_DRAM_INST_LOAD); in il3945_set_ucode_ptrs()
2085 * il3945_init_alive_start - Called after N_ALIVE notification received
2095 if (il->card_alive_init.is_valid != UCODE_VALID_OK) { in il3945_init_alive_start()
2125 queue_work(il->workqueue, &il->restart); in il3945_init_alive_start()
2129 * il3945_alive_start - called after N_ALIVE notification received
2141 if (il->card_alive.is_valid != UCODE_VALID_OK) { in il3945_alive_start()
2162 clear_bit(S_RFKILL, &il->status); in il3945_alive_start()
2174 set_bit(S_RFKILL, &il->status); in il3945_alive_start()
2177 set_bit(S_ALIVE, &il->status); in il3945_alive_start()
2185 ieee80211_wake_queues(il->hw); in il3945_alive_start()
2187 il->active_rate = RATES_MASK_3945; in il3945_alive_start()
2193 (struct il3945_rxon_cmd *)(&il->active); in il3945_alive_start()
2195 il->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; in il3945_alive_start()
2196 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; in il3945_alive_start()
2205 set_bit(S_READY, &il->status); in il3945_alive_start()
2213 wake_up(&il->wait_command_queue); in il3945_alive_start()
2218 queue_work(il->workqueue, &il->restart); in il3945_alive_start()
2233 exit_pending = test_and_set_bit(S_EXIT_PENDING, &il->status); in __il3945_down()
2237 del_timer_sync(&il->watchdog); in __il3945_down()
2245 wake_up_all(&il->wait_command_queue); in __il3945_down()
2250 clear_bit(S_EXIT_PENDING, &il->status); in __il3945_down()
2252 /* stop and reset the on-board processor */ in __il3945_down()
2256 spin_lock_irqsave(&il->lock, flags); in __il3945_down()
2258 spin_unlock_irqrestore(&il->lock, flags); in __il3945_down()
2261 if (il->mac80211_registered) in __il3945_down()
2262 ieee80211_stop_queues(il->hw); in __il3945_down()
2267 il->status = in __il3945_down()
2268 test_bit(S_RFKILL, &il->status) << S_RFKILL | in __il3945_down()
2269 test_bit(S_GEO_CONFIGURED, &il->status) << S_GEO_CONFIGURED | in __il3945_down()
2270 test_bit(S_EXIT_PENDING, &il->status) << S_EXIT_PENDING; in __il3945_down()
2276 il->status &= in __il3945_down()
2277 test_bit(S_RFKILL, &il->status) << S_RFKILL | in __il3945_down()
2278 test_bit(S_GEO_CONFIGURED, &il->status) << S_GEO_CONFIGURED | in __il3945_down()
2279 test_bit(S_FW_ERROR, &il->status) << S_FW_ERROR | in __il3945_down()
2280 test_bit(S_EXIT_PENDING, &il->status) << S_EXIT_PENDING; in __il3945_down()
2283 * We disabled and synchronized interrupt, and priv->mutex is taken, so in __il3945_down()
2287 spin_lock_irq(&il->reg_lock); in __il3945_down()
2292 /* Power-down device's busmaster DMA clocks */ in __il3945_down()
2298 spin_unlock_irq(&il->reg_lock); in __il3945_down()
2302 memset(&il->card_alive, 0, sizeof(struct il_alive_resp)); in __il3945_down()
2303 dev_kfree_skb(il->beacon_skb); in __il3945_down()
2304 il->beacon_skb = NULL; in __il3945_down()
2313 mutex_lock(&il->mutex); in il3945_down()
2315 mutex_unlock(&il->mutex); in il3945_down()
2328 spin_lock_irqsave(&il->sta_lock, flags); in il3945_alloc_bcast_station()
2332 spin_unlock_irqrestore(&il->sta_lock, flags); in il3945_alloc_bcast_station()
2334 return -EINVAL; in il3945_alloc_bcast_station()
2337 il->stations[sta_id].used |= IL_STA_DRIVER_ACTIVE; in il3945_alloc_bcast_station()
2338 il->stations[sta_id].used |= IL_STA_BCAST; in il3945_alloc_bcast_station()
2339 spin_unlock_irqrestore(&il->sta_lock, flags); in il3945_alloc_bcast_station()
2353 if (test_bit(S_EXIT_PENDING, &il->status)) { in __il3945_up()
2355 return -EIO; in __il3945_up()
2358 if (!il->ucode_data_backup.v_addr || !il->ucode_data.v_addr) { in __il3945_up()
2360 return -EIO; in __il3945_up()
2365 clear_bit(S_RFKILL, &il->status); in __il3945_up()
2367 set_bit(S_RFKILL, &il->status); in __il3945_up()
2368 return -ERFKILL; in __il3945_up()
2392 * This will be used to initialize the on-board processor's in __il3945_up()
2394 memcpy(il->ucode_data_backup.v_addr, il->ucode_data.v_addr, in __il3945_up()
2395 il->ucode_data.len); in __il3945_up()
2398 if (test_bit(S_RFKILL, &il->status)) in __il3945_up()
2406 rc = il->ops->load_ucode(il); in __il3945_up()
2421 set_bit(S_EXIT_PENDING, &il->status); in __il3945_up()
2423 clear_bit(S_EXIT_PENDING, &il->status); in __il3945_up()
2428 return -EIO; in __il3945_up()
2443 mutex_lock(&il->mutex); in il3945_bg_init_alive_start()
2444 if (test_bit(S_EXIT_PENDING, &il->status)) in il3945_bg_init_alive_start()
2449 mutex_unlock(&il->mutex); in il3945_bg_init_alive_start()
2458 mutex_lock(&il->mutex); in il3945_bg_alive_start()
2459 if (test_bit(S_EXIT_PENDING, &il->status) || il->txq == NULL) in il3945_bg_alive_start()
2464 mutex_unlock(&il->mutex); in il3945_bg_alive_start()
2478 bool old_rfkill = test_bit(S_RFKILL, &il->status); in il3945_rfkill_poll()
2484 set_bit(S_RFKILL, &il->status); in il3945_rfkill_poll()
2486 clear_bit(S_RFKILL, &il->status); in il3945_rfkill_poll()
2488 wiphy_rfkill_set_hw_state(il->hw->wiphy, new_rfkill); in il3945_rfkill_poll()
2496 queue_delayed_work(il->workqueue, &il->_3945.rfkill_poll, in il3945_rfkill_poll()
2516 lockdep_assert_held(&il->mutex); in il3945_request_scan()
2518 if (!il->scan_cmd) { in il3945_request_scan()
2519 il->scan_cmd = in il3945_request_scan()
2522 if (!il->scan_cmd) { in il3945_request_scan()
2524 return -ENOMEM; in il3945_request_scan()
2527 scan = il->scan_cmd; in il3945_request_scan()
2530 scan->quiet_plcp_th = IL_PLCP_QUIET_THRESH; in il3945_request_scan()
2531 scan->quiet_time = IL_ACTIVE_QUIET_TIME; in il3945_request_scan()
2541 interval = vif->bss_conf.beacon_int; in il3945_request_scan()
2543 scan->suspend_time = 0; in il3945_request_scan()
2544 scan->max_out_time = cpu_to_le32(200 * 1024); in il3945_request_scan()
2549 * 0-19: beacon interval in usec (time before exec.) in il3945_request_scan()
2550 * 20-23: 0 in il3945_request_scan()
2551 * 24-31: number of beacons (suspend between channels) in il3945_request_scan()
2558 scan->suspend_time = cpu_to_le32(scan_suspend_time); in il3945_request_scan()
2563 if (il->scan_request->n_ssids) { in il3945_request_scan()
2566 for (i = 0; i < il->scan_request->n_ssids; i++) { in il3945_request_scan()
2568 if (!il->scan_request->ssids[i].ssid_len) in il3945_request_scan()
2570 scan->direct_scan[p].id = WLAN_EID_SSID; in il3945_request_scan()
2571 scan->direct_scan[p].len = in il3945_request_scan()
2572 il->scan_request->ssids[i].ssid_len; in il3945_request_scan()
2573 memcpy(scan->direct_scan[p].ssid, in il3945_request_scan()
2574 il->scan_request->ssids[i].ssid, in il3945_request_scan()
2575 il->scan_request->ssids[i].ssid_len); in il3945_request_scan()
2585 scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK; in il3945_request_scan()
2586 scan->tx_cmd.sta_id = il->hw_params.bcast_id; in il3945_request_scan()
2587 scan->tx_cmd.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; in il3945_request_scan()
2591 switch (il->scan_band) { in il3945_request_scan()
2593 scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK; in il3945_request_scan()
2594 scan->tx_cmd.rate = RATE_1M_PLCP; in il3945_request_scan()
2598 scan->tx_cmd.rate = RATE_6M_PLCP; in il3945_request_scan()
2603 return -EIO; in il3945_request_scan()
2611 scan->good_CRC_th = in il3945_request_scan()
2615 il_fill_probe_req(il, (struct ieee80211_mgmt *)scan->data, in il3945_request_scan()
2616 vif->addr, il->scan_request->ie, in il3945_request_scan()
2617 il->scan_request->ie_len, in il3945_request_scan()
2618 IL_MAX_SCAN_SIZE - sizeof(*scan)); in il3945_request_scan()
2619 scan->tx_cmd.len = cpu_to_le16(len); in il3945_request_scan()
2621 /* select Rx antennas */ in il3945_request_scan()
2622 scan->flags |= il3945_get_antenna_flags(il); in il3945_request_scan()
2624 scan->channel_count = in il3945_request_scan()
2626 (void *)&scan->data[len], vif); in il3945_request_scan()
2627 if (scan->channel_count == 0) { in il3945_request_scan()
2628 D_SCAN("channel count %d\n", scan->channel_count); in il3945_request_scan()
2629 return -EIO; in il3945_request_scan()
2633 le16_to_cpu(scan->tx_cmd.len) + in il3945_request_scan()
2634 scan->channel_count * sizeof(struct il3945_scan_channel); in il3945_request_scan()
2636 scan->len = cpu_to_le16(cmd.len); in il3945_request_scan()
2638 set_bit(S_SCAN_HW, &il->status); in il3945_request_scan()
2641 clear_bit(S_SCAN_HW, &il->status); in il3945_request_scan()
2652 if (memcmp(&il->staging, &il->active, sizeof(il->staging))) in il3945_post_scan()
2661 if (test_bit(S_EXIT_PENDING, &il->status)) in il3945_bg_restart()
2664 if (test_and_clear_bit(S_FW_ERROR, &il->status)) { in il3945_bg_restart()
2665 mutex_lock(&il->mutex); in il3945_bg_restart()
2666 il->is_open = 0; in il3945_bg_restart()
2667 mutex_unlock(&il->mutex); in il3945_bg_restart()
2669 ieee80211_restart_hw(il->hw); in il3945_bg_restart()
2673 mutex_lock(&il->mutex); in il3945_bg_restart()
2674 if (test_bit(S_EXIT_PENDING, &il->status)) { in il3945_bg_restart()
2675 mutex_unlock(&il->mutex); in il3945_bg_restart()
2680 mutex_unlock(&il->mutex); in il3945_bg_restart()
2689 mutex_lock(&il->mutex); in il3945_bg_rx_replenish()
2690 if (test_bit(S_EXIT_PENDING, &il->status)) in il3945_bg_rx_replenish()
2695 mutex_unlock(&il->mutex); in il3945_bg_rx_replenish()
2703 if (!il->vif || !il->is_open) in il3945_post_associate()
2706 D_ASSOC("Associated as %d to: %pM\n", il->vif->bss_conf.aid, in il3945_post_associate()
2707 il->active.bssid_addr); in il3945_post_associate()
2709 if (test_bit(S_EXIT_PENDING, &il->status)) in il3945_post_associate()
2714 il->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; in il3945_post_associate()
2719 IL_WARN("C_RXON_TIMING failed - " "Attempting to continue.\n"); in il3945_post_associate()
2721 il->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; in il3945_post_associate()
2723 il->staging.assoc_id = cpu_to_le16(il->vif->bss_conf.aid); in il3945_post_associate()
2725 D_ASSOC("assoc id %d beacon interval %d\n", il->vif->bss_conf.aid, in il3945_post_associate()
2726 il->vif->bss_conf.beacon_int); in il3945_post_associate()
2728 if (il->vif->bss_conf.use_short_preamble) in il3945_post_associate()
2729 il->staging.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; in il3945_post_associate()
2731 il->staging.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK; in il3945_post_associate()
2733 if (il->staging.flags & RXON_FLG_BAND_24G_MSK) { in il3945_post_associate()
2734 if (il->vif->bss_conf.use_short_slot) in il3945_post_associate()
2735 il->staging.flags |= RXON_FLG_SHORT_SLOT_MSK; in il3945_post_associate()
2737 il->staging.flags &= ~RXON_FLG_SHORT_SLOT_MSK; in il3945_post_associate()
2742 switch (il->vif->type) { in il3945_post_associate()
2744 il3945_rate_scale_init(il->hw, IL_AP_ID); in il3945_post_associate()
2751 il->vif->type); in il3945_post_associate()
2767 struct il_priv *il = hw->priv; in il3945_mac_start()
2771 mutex_lock(&il->mutex); in il3945_mac_start()
2774 /* fetch ucode file from disk, alloc and copy to bus-master buffers ... in il3945_mac_start()
2775 * ucode filename and max sizes are card-specific. */ in il3945_mac_start()
2777 if (!il->ucode_code.len) { in il3945_mac_start()
2781 mutex_unlock(&il->mutex); in il3945_mac_start()
2788 mutex_unlock(&il->mutex); in il3945_mac_start()
2797 ret = wait_event_timeout(il->wait_command_queue, in il3945_mac_start()
2798 test_bit(S_READY, &il->status), in il3945_mac_start()
2801 if (!test_bit(S_READY, &il->status)) { in il3945_mac_start()
2804 ret = -ETIMEDOUT; in il3945_mac_start()
2811 cancel_delayed_work(&il->_3945.rfkill_poll); in il3945_mac_start()
2813 il->is_open = 1; in il3945_mac_start()
2818 il->is_open = 0; in il3945_mac_start()
2819 D_MAC80211("leave - failed\n"); in il3945_mac_start()
2826 struct il_priv *il = hw->priv; in il3945_mac_stop()
2830 if (!il->is_open) { in il3945_mac_stop()
2831 D_MAC80211("leave - skip\n"); in il3945_mac_stop()
2835 il->is_open = 0; in il3945_mac_stop()
2839 flush_workqueue(il->workqueue); in il3945_mac_stop()
2842 queue_delayed_work(il->workqueue, &il->_3945.rfkill_poll, in il3945_mac_stop()
2853 struct il_priv *il = hw->priv; in il3945_mac_tx()
2857 D_TX("dev->xmit(%d bytes) at rate 0x%02x\n", skb->len, in il3945_mac_tx()
2858 ieee80211_get_tx_rate(hw, IEEE80211_SKB_CB(skb))->bitrate); in il3945_mac_tx()
2860 if (il3945_tx_skb(il, control->sta, skb)) in il3945_mac_tx()
2869 struct ieee80211_vif *vif = il->vif; in il3945_config_ap()
2872 if (test_bit(S_EXIT_PENDING, &il->status)) in il3945_config_ap()
2878 /* RXON - unassoc (to set timing command) */ in il3945_config_ap()
2879 il->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; in il3945_config_ap()
2885 IL_WARN("C_RXON_TIMING failed - " in il3945_config_ap()
2888 il->staging.assoc_id = 0; in il3945_config_ap()
2890 if (vif->bss_conf.use_short_preamble) in il3945_config_ap()
2891 il->staging.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; in il3945_config_ap()
2893 il->staging.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK; in il3945_config_ap()
2895 if (il->staging.flags & RXON_FLG_BAND_24G_MSK) { in il3945_config_ap()
2896 if (vif->bss_conf.use_short_slot) in il3945_config_ap()
2897 il->staging.flags |= RXON_FLG_SHORT_SLOT_MSK; in il3945_config_ap()
2899 il->staging.flags &= ~RXON_FLG_SHORT_SLOT_MSK; in il3945_config_ap()
2901 /* restore RXON assoc */ in il3945_config_ap()
2902 il->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; in il3945_config_ap()
2913 struct il_priv *il = hw->priv; in il3945_mac_set_key()
2921 D_MAC80211("leave - hwcrypto disabled\n"); in il3945_mac_set_key()
2922 return -EOPNOTSUPP; in il3945_mac_set_key()
2929 if (vif->type == NL80211_IFTYPE_ADHOC && in il3945_mac_set_key()
2930 !(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)) { in il3945_mac_set_key()
2931 D_MAC80211("leave - IBSS RSN\n"); in il3945_mac_set_key()
2932 return -EOPNOTSUPP; in il3945_mac_set_key()
2940 D_MAC80211("leave - station not found\n"); in il3945_mac_set_key()
2941 return -EINVAL; in il3945_mac_set_key()
2945 mutex_lock(&il->mutex); in il3945_mac_set_key()
2964 ret = -EINVAL; in il3945_mac_set_key()
2968 mutex_unlock(&il->mutex); in il3945_mac_set_key()
2977 struct il_priv *il = hw->priv; in il3945_mac_sta_add()
2978 struct il3945_sta_priv *sta_priv = (void *)sta->drv_priv; in il3945_mac_sta_add()
2980 bool is_ap = vif->type == NL80211_IFTYPE_STATION; in il3945_mac_sta_add()
2983 mutex_lock(&il->mutex); in il3945_mac_sta_add()
2984 D_INFO("station %pM\n", sta->addr); in il3945_mac_sta_add()
2985 sta_priv->common.sta_id = IL_INVALID_STATION; in il3945_mac_sta_add()
2987 ret = il_add_station_common(il, sta->addr, is_ap, sta, &sta_id); in il3945_mac_sta_add()
2989 IL_ERR("Unable to add station %pM (%d)\n", sta->addr, ret); in il3945_mac_sta_add()
2991 mutex_unlock(&il->mutex); in il3945_mac_sta_add()
2995 sta_priv->common.sta_id = sta_id; in il3945_mac_sta_add()
2998 D_INFO("Initializing rate scaling for station %pM\n", sta->addr); in il3945_mac_sta_add()
3000 mutex_unlock(&il->mutex); in il3945_mac_sta_add()
3009 struct il_priv *il = hw->priv; in il3945_configure_filter()
3028 mutex_lock(&il->mutex); in il3945_configure_filter()
3030 il->staging.filter_flags &= ~filter_nand; in il3945_configure_filter()
3031 il->staging.filter_flags |= filter_or; in il3945_configure_filter()
3039 mutex_unlock(&il->mutex); in il3945_configure_filter()
3091 il->debug_level = val; in il3945_store_debug_level()
3108 return -EAGAIN; in il3945_show_temperature()
3119 return sprintf(buf, "%d\n", il->tx_power_user_lmt); in il3945_show_tx_power()
3146 return sprintf(buf, "0x%04X\n", il->active.flags); in il3945_show_flags()
3156 mutex_lock(&il->mutex); in il3945_store_flags()
3157 if (le32_to_cpu(il->staging.flags) != flags) { in il3945_store_flags()
3163 il->staging.flags = cpu_to_le32(flags); in il3945_store_flags()
3167 mutex_unlock(&il->mutex); in il3945_store_flags()
3180 return sprintf(buf, "0x%04X\n", le32_to_cpu(il->active.filter_flags)); in il3945_show_filter_flags()
3190 mutex_lock(&il->mutex); in il3945_store_filter_flags()
3191 if (le32_to_cpu(il->staging.filter_flags) != filter_flags) { in il3945_store_filter_flags()
3198 il->staging.filter_flags = cpu_to_le32(filter_flags); in il3945_store_filter_flags()
3202 mutex_unlock(&il->mutex); in il3945_store_filter_flags()
3220 spin_lock_irqsave(&il->lock, flags); in il3945_show_measurement()
3221 if (!(il->measurement_status & MEASUREMENT_READY)) { in il3945_show_measurement()
3222 spin_unlock_irqrestore(&il->lock, flags); in il3945_show_measurement()
3225 memcpy(&measure_report, &il->measure_report, size); in il3945_show_measurement()
3226 il->measurement_status = 0; in il3945_show_measurement()
3227 spin_unlock_irqrestore(&il->lock, flags); in il3945_show_measurement()
3229 while (size && PAGE_SIZE - len) { in il3945_show_measurement()
3231 PAGE_SIZE - len, true); in il3945_show_measurement()
3233 if (PAGE_SIZE - len) in il3945_show_measurement()
3237 size -= min(size, 16U); in il3945_show_measurement()
3249 .channel = le16_to_cpu(il->active.channel), in il3945_store_measurement()
3250 .start_time = cpu_to_le64(il->_3945.last_tsf), in il3945_store_measurement()
3287 il->retry_rate = simple_strtoul(buf, NULL, 0); in il3945_store_retry_rate()
3288 if (il->retry_rate <= 0) in il3945_store_retry_rate()
3289 il->retry_rate = 1; in il3945_store_retry_rate()
3299 return sprintf(buf, "%d", il->retry_rate); in il3945_show_retry_rate()
3320 return -EAGAIN; in il3945_show_antenna()
3341 D_INFO("Setting antenna select to %d.\n", ant); in il3945_store_antenna()
3344 D_INFO("Bad antenna select value %d.\n", ant); in il3945_store_antenna()
3356 return -EAGAIN; in il3945_show_status()
3357 return sprintf(buf, "0x%08x\n", (int)il->status); in il3945_show_status()
3386 il->workqueue = create_singlethread_workqueue(DRV_NAME); in il3945_setup_deferred_work()
3388 init_waitqueue_head(&il->wait_command_queue); in il3945_setup_deferred_work()
3390 INIT_WORK(&il->restart, il3945_bg_restart); in il3945_setup_deferred_work()
3391 INIT_WORK(&il->rx_replenish, il3945_bg_rx_replenish); in il3945_setup_deferred_work()
3392 INIT_DELAYED_WORK(&il->init_alive_start, il3945_bg_init_alive_start); in il3945_setup_deferred_work()
3393 INIT_DELAYED_WORK(&il->alive_start, il3945_bg_alive_start); in il3945_setup_deferred_work()
3394 INIT_DELAYED_WORK(&il->_3945.rfkill_poll, il3945_rfkill_poll); in il3945_setup_deferred_work()
3400 timer_setup(&il->watchdog, il_bg_watchdog, 0); in il3945_setup_deferred_work()
3402 tasklet_setup(&il->irq_tasklet, il3945_irq_tasklet); in il3945_setup_deferred_work()
3410 cancel_delayed_work_sync(&il->init_alive_start); in il3945_cancel_deferred_work()
3411 cancel_delayed_work(&il->alive_start); in il3945_cancel_deferred_work()
3462 struct il3945_eeprom *eeprom = (struct il3945_eeprom *)il->eeprom; in il3945_init_drv()
3464 il->retry_rate = 1; in il3945_init_drv()
3465 il->beacon_skb = NULL; in il3945_init_drv()
3467 spin_lock_init(&il->sta_lock); in il3945_init_drv()
3468 spin_lock_init(&il->hcmd_lock); in il3945_init_drv()
3470 INIT_LIST_HEAD(&il->free_frames); in il3945_init_drv()
3472 mutex_init(&il->mutex); in il3945_init_drv()
3474 il->ieee_channels = NULL; in il3945_init_drv()
3475 il->ieee_rates = NULL; in il3945_init_drv()
3476 il->band = NL80211_BAND_2GHZ; in il3945_init_drv()
3478 il->iw_mode = NL80211_IFTYPE_STATION; in il3945_init_drv()
3479 il->missed_beacon_threshold = IL_MISSED_BEACON_THRESHOLD_DEF; in il3945_init_drv()
3482 il->force_reset.reset_duration = IL_DELAY_NEXT_FORCE_FW_RELOAD; in il3945_init_drv()
3484 if (eeprom->version < EEPROM_3945_EEPROM_VERSION) { in il3945_init_drv()
3486 eeprom->version); in il3945_init_drv()
3487 ret = -EINVAL; in il3945_init_drv()
3498 ret = -EIO; in il3945_init_drv()
3507 il3945_init_hw_rates(il, il->ieee_rates); in il3945_init_drv()
3523 struct ieee80211_hw *hw = il->hw; in il3945_setup_mac()
3525 hw->rate_control_algorithm = "iwl-3945-rs"; in il3945_setup_mac()
3526 hw->sta_data_size = sizeof(struct il3945_sta_priv); in il3945_setup_mac()
3527 hw->vif_data_size = sizeof(struct il_vif_priv); in il3945_setup_mac()
3535 hw->wiphy->interface_modes = in il3945_setup_mac()
3538 hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; in il3945_setup_mac()
3539 hw->wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG | in il3945_setup_mac()
3542 hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; in il3945_setup_mac()
3544 hw->wiphy->max_scan_ssids = PROBE_OPTION_MAX_3945; in il3945_setup_mac()
3545 /* we create the 802.11 header and a zero-length SSID element */ in il3945_setup_mac()
3546 hw->wiphy->max_scan_ie_len = IL3945_MAX_PROBE_REQUEST - 24 - 2; in il3945_setup_mac()
3549 hw->queues = 4; in il3945_setup_mac()
3551 if (il->bands[NL80211_BAND_2GHZ].n_channels) in il3945_setup_mac()
3552 il->hw->wiphy->bands[NL80211_BAND_2GHZ] = in il3945_setup_mac()
3553 &il->bands[NL80211_BAND_2GHZ]; in il3945_setup_mac()
3555 if (il->bands[NL80211_BAND_5GHZ].n_channels) in il3945_setup_mac()
3556 il->hw->wiphy->bands[NL80211_BAND_5GHZ] = in il3945_setup_mac()
3557 &il->bands[NL80211_BAND_5GHZ]; in il3945_setup_mac()
3561 wiphy_ext_feature_set(il->hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST); in il3945_setup_mac()
3563 ret = ieee80211_register_hw(il->hw); in il3945_setup_mac()
3568 il->mac80211_registered = 1; in il3945_setup_mac()
3579 struct il_cfg *cfg = (struct il_cfg *)(ent->driver_data); in il3945_pci_probe()
3589 err = -ENOMEM; in il3945_pci_probe()
3592 il = hw->priv; in il3945_pci_probe()
3593 il->hw = hw; in il3945_pci_probe()
3594 SET_IEEE80211_DEV(hw, &pdev->dev); in il3945_pci_probe()
3596 il->cmd_queue = IL39_CMD_QUEUE_NUM; in il3945_pci_probe()
3599 il->cfg = cfg; in il3945_pci_probe()
3600 il->ops = &il3945_ops; in il3945_pci_probe()
3602 il->debugfs_ops = &il3945_debugfs_ops; in il3945_pci_probe()
3604 il->pci_dev = pdev; in il3945_pci_probe()
3605 il->inta_mask = CSR_INI_SET_MASK; in il3945_pci_probe()
3615 err = -ENODEV; in il3945_pci_probe()
3637 il->hw_base = pci_ioremap_bar(pdev, 0); in il3945_pci_probe()
3638 if (!il->hw_base) { in il3945_pci_probe()
3639 err = -ENODEV; in il3945_pci_probe()
3645 D_INFO("pci_resource_base = %p\n", il->hw_base); in il3945_pci_probe()
3654 spin_lock_init(&il->reg_lock); in il3945_pci_probe()
3655 spin_lock_init(&il->lock); in il3945_pci_probe()
3658 * stop and reset the on-board processor just in case it is in a in il3945_pci_probe()
3675 eeprom = (struct il3945_eeprom *)il->eeprom; in il3945_pci_probe()
3676 D_INFO("MAC address: %pM\n", eeprom->mac_address); in il3945_pci_probe()
3677 SET_IEEE80211_PERM_ADDR(il->hw, eeprom->mac_address); in il3945_pci_probe()
3682 /* Device-specific setup */ in il3945_pci_probe()
3699 IL_INFO("Detected Intel Wireless WiFi Link %s\n", il->cfg->name); in il3945_pci_probe()
3705 spin_lock_irqsave(&il->lock, flags); in il3945_pci_probe()
3707 spin_unlock_irqrestore(&il->lock, flags); in il3945_pci_probe()
3709 pci_enable_msi(il->pci_dev); in il3945_pci_probe()
3711 err = request_irq(il->pci_dev->irq, il_isr, IRQF_SHARED, DRV_NAME, il); in il3945_pci_probe()
3713 IL_ERR("Error allocating IRQ %d\n", il->pci_dev->irq); in il3945_pci_probe()
3717 err = sysfs_create_group(&pdev->dev.kobj, &il3945_attribute_group); in il3945_pci_probe()
3723 il_set_rxon_channel(il, &il->bands[NL80211_BAND_2GHZ].channels[5]); in il3945_pci_probe()
3741 queue_delayed_work(il->workqueue, &il->_3945.rfkill_poll, 2 * HZ); in il3945_pci_probe()
3746 destroy_workqueue(il->workqueue); in il3945_pci_probe()
3747 il->workqueue = NULL; in il3945_pci_probe()
3748 sysfs_remove_group(&pdev->dev.kobj, &il3945_attribute_group); in il3945_pci_probe()
3750 free_irq(il->pci_dev->irq, il); in il3945_pci_probe()
3752 pci_disable_msi(il->pci_dev); in il3945_pci_probe()
3760 iounmap(il->hw_base); in il3945_pci_probe()
3766 ieee80211_free_hw(il->hw); in il3945_pci_probe()
3784 set_bit(S_EXIT_PENDING, &il->status); in il3945_pci_remove()
3788 if (il->mac80211_registered) { in il3945_pci_remove()
3789 ieee80211_unregister_hw(il->hw); in il3945_pci_remove()
3790 il->mac80211_registered = 0; in il3945_pci_remove()
3807 spin_lock_irqsave(&il->lock, flags); in il3945_pci_remove()
3809 spin_unlock_irqrestore(&il->lock, flags); in il3945_pci_remove()
3813 sysfs_remove_group(&pdev->dev.kobj, &il3945_attribute_group); in il3945_pci_remove()
3815 cancel_delayed_work_sync(&il->_3945.rfkill_poll); in il3945_pci_remove()
3819 if (il->rxq.bd) in il3945_pci_remove()
3820 il3945_rx_queue_free(il, &il->rxq); in il3945_pci_remove()
3826 flush_workqueue(il->workqueue); in il3945_pci_remove()
3829 * il->workqueue... so we can't take down the workqueue in il3945_pci_remove()
3831 destroy_workqueue(il->workqueue); in il3945_pci_remove()
3832 il->workqueue = NULL; in il3945_pci_remove()
3834 free_irq(pdev->irq, il); in il3945_pci_remove()
3837 iounmap(il->hw_base); in il3945_pci_remove()
3843 kfree(il->scan_cmd); in il3945_pci_remove()
3844 dev_kfree_skb(il->beacon_skb); in il3945_pci_remove()
3845 ieee80211_free_hw(il->hw); in il3945_pci_remove()
3908 MODULE_PARM_DESC(antenna, "select antenna (1=Main, 2=Aux, default 0 [both])");