Lines Matching refs:priv

80 void iwl_update_chain_flags(struct iwl_priv *priv)
84 for_each_context(priv, ctx) {
85 iwlagn_set_rxon_chain(priv, ctx);
87 iwlagn_commit_rxon(priv, ctx);
92 static void iwl_set_beacon_tim(struct iwl_priv *priv,
115 IWL_WARN(priv, "Unable to find TIM Element in beacon\n");
118 int iwlagn_send_beacon_cmd(struct iwl_priv *priv)
135 lockdep_assert_held(&priv->mutex);
137 if (!priv->beacon_ctx) {
138 IWL_ERR(priv, "trying to build beacon w/o beacon context!\n");
142 if (WARN_ON(!priv->beacon_skb))
146 if (!priv->beacon_cmd)
147 priv->beacon_cmd = kzalloc(sizeof(*tx_beacon_cmd), GFP_KERNEL);
148 tx_beacon_cmd = priv->beacon_cmd;
152 frame_size = priv->beacon_skb->len;
156 tx_beacon_cmd->tx.sta_id = priv->beacon_ctx->bcast_sta_id;
162 iwl_set_beacon_tim(priv, tx_beacon_cmd, priv->beacon_skb->data,
166 info = IEEE80211_SKB_CB(priv->beacon_skb);
179 priv->mgmt_tx_ant = iwl_toggle_tx_ant(priv, priv->mgmt_tx_ant,
180 hw_params(priv).valid_tx_ant);
181 rate_flags = iwl_ant_idx_to_flags(priv->mgmt_tx_ant);
197 cmd.data[1] = priv->beacon_skb->data;
200 return iwl_dvm_send_cmd(priv, &cmd);
205 struct iwl_priv *priv =
209 mutex_lock(&priv->mutex);
210 if (!priv->beacon_ctx) {
211 IWL_ERR(priv, "updating beacon w/o beacon context!\n");
215 if (priv->beacon_ctx->vif->type != NL80211_IFTYPE_AP) {
226 beacon = ieee80211_beacon_get(priv->hw, priv->beacon_ctx->vif);
228 IWL_ERR(priv, "update beacon failed -- keeping old\n");
233 dev_kfree_skb(priv->beacon_skb);
235 priv->beacon_skb = beacon;
237 iwlagn_send_beacon_cmd(priv);
239 mutex_unlock(&priv->mutex);
244 struct iwl_priv *priv =
247 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
251 if (!iwl_is_ready_rf(priv))
253 iwlagn_send_advance_bt_config(priv);
258 struct iwl_priv *priv =
262 mutex_lock(&priv->mutex);
264 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
268 if (!iwl_is_ready_rf(priv))
271 IWL_DEBUG_INFO(priv, "BT coex in %s mode\n",
272 priv->bt_full_concurrent ?
279 for_each_context(priv, ctx) {
280 iwlagn_set_rxon_chain(priv, ctx);
281 iwlagn_commit_rxon(priv, ctx);
284 iwlagn_send_advance_bt_config(priv);
286 mutex_unlock(&priv->mutex);
301 struct iwl_priv *priv = (struct iwl_priv *)data;
303 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
307 if (!iwl_is_ready_rf(priv))
310 iwl_send_statistics_request(priv, CMD_ASYNC, false);
314 static void iwl_print_cont_event_trace(struct iwl_priv *priv, u32 base,
329 spin_lock_irqsave(&trans(priv)->reg_lock, reg_flags);
330 if (unlikely(!iwl_grab_nic_access(trans(priv)))) {
331 spin_unlock_irqrestore(&trans(priv)->reg_lock, reg_flags);
336 iwl_write32(trans(priv), HBUS_TARG_MEM_RADDR, ptr);
352 ev = iwl_read32(trans(priv), HBUS_TARG_MEM_RDAT);
353 time = iwl_read32(trans(priv), HBUS_TARG_MEM_RDAT);
356 trans(priv)->dev, 0, time, ev);
358 data = iwl_read32(trans(priv), HBUS_TARG_MEM_RDAT);
360 trans(priv)->dev, time, data, ev);
364 iwl_release_nic_access(trans(priv));
365 spin_unlock_irqrestore(&trans(priv)->reg_lock, reg_flags);
368 static void iwl_continuous_event_trace(struct iwl_priv *priv)
382 base = priv->shrd->device_pointers.log_event_table;
384 iwl_read_targ_mem_words(trans(priv), base, &read, sizeof(read));
408 if (unlikely(next_entry < priv->event_log.next_entry &&
409 num_wraps == priv->event_log.num_wraps))
412 if (num_wraps == priv->event_log.num_wraps) {
414 priv, base, priv->event_log.next_entry,
415 next_entry - priv->event_log.next_entry,
418 priv->event_log.non_wraps_count++;
420 if (num_wraps - priv->event_log.num_wraps > 1)
421 priv->event_log.wraps_more_count++;
423 priv->event_log.wraps_once_count++;
425 trace_iwlwifi_dev_ucode_wrap_event(trans(priv)->dev,
426 num_wraps - priv->event_log.num_wraps,
427 next_entry, priv->event_log.next_entry);
429 if (next_entry < priv->event_log.next_entry) {
431 priv, base, priv->event_log.next_entry,
432 capacity - priv->event_log.next_entry,
436 priv, base, 0, next_entry, capacity, mode);
439 priv, base, next_entry,
444 priv, base, 0, next_entry, capacity, mode);
448 priv->event_log.num_wraps = num_wraps;
449 priv->event_log.next_entry = next_entry;
462 struct iwl_priv *priv = (struct iwl_priv *)data;
464 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
467 if (priv->event_log.ucode_trace) {
468 iwl_continuous_event_trace(priv);
470 mod_timer(&priv->ucode_trace,
477 struct iwl_priv *priv =
480 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
484 if (!iwl_is_ready_rf(priv))
487 IWL_DEBUG_INFO(priv, "device request: flush all tx frames\n");
488 iwlagn_dev_txfifo_flush(priv, IWL_DROP_ALL);
491 static void iwl_init_context(struct iwl_priv *priv, u32 ucode_flags)
499 priv->shrd->valid_contexts = BIT(IWL_RXON_CTX_BSS);
501 priv->shrd->valid_contexts |= BIT(IWL_RXON_CTX_PAN);
504 priv->contexts[i].ctxid = i;
506 priv->contexts[IWL_RXON_CTX_BSS].always_active = true;
507 priv->contexts[IWL_RXON_CTX_BSS].is_active = true;
508 priv->contexts[IWL_RXON_CTX_BSS].rxon_cmd = REPLY_RXON;
509 priv->contexts[IWL_RXON_CTX_BSS].rxon_timing_cmd = REPLY_RXON_TIMING;
510 priv->contexts[IWL_RXON_CTX_BSS].rxon_assoc_cmd = REPLY_RXON_ASSOC;
511 priv->contexts[IWL_RXON_CTX_BSS].qos_cmd = REPLY_QOS_PARAM;
512 priv->contexts[IWL_RXON_CTX_BSS].ap_sta_id = IWL_AP_ID;
513 priv->contexts[IWL_RXON_CTX_BSS].wep_key_cmd = REPLY_WEPKEY;
514 priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id = IWLAGN_BROADCAST_ID;
515 priv->contexts[IWL_RXON_CTX_BSS].exclusive_interface_modes =
517 priv->contexts[IWL_RXON_CTX_BSS].interface_modes =
519 priv->contexts[IWL_RXON_CTX_BSS].ap_devtype = RXON_DEV_TYPE_AP;
520 priv->contexts[IWL_RXON_CTX_BSS].ibss_devtype = RXON_DEV_TYPE_IBSS;
521 priv->contexts[IWL_RXON_CTX_BSS].station_devtype = RXON_DEV_TYPE_ESS;
522 priv->contexts[IWL_RXON_CTX_BSS].unused_devtype = RXON_DEV_TYPE_ESS;
524 priv->contexts[IWL_RXON_CTX_PAN].rxon_cmd = REPLY_WIPAN_RXON;
525 priv->contexts[IWL_RXON_CTX_PAN].rxon_timing_cmd =
527 priv->contexts[IWL_RXON_CTX_PAN].rxon_assoc_cmd =
529 priv->contexts[IWL_RXON_CTX_PAN].qos_cmd = REPLY_WIPAN_QOS_PARAM;
530 priv->contexts[IWL_RXON_CTX_PAN].ap_sta_id = IWL_AP_ID_PAN;
531 priv->contexts[IWL_RXON_CTX_PAN].wep_key_cmd = REPLY_WIPAN_WEPKEY;
532 priv->contexts[IWL_RXON_CTX_PAN].bcast_sta_id = IWLAGN_PAN_BCAST_ID;
533 priv->contexts[IWL_RXON_CTX_PAN].station_flags = STA_FLG_PAN_STATION;
534 priv->contexts[IWL_RXON_CTX_PAN].interface_modes =
538 priv->contexts[IWL_RXON_CTX_PAN].interface_modes |=
542 priv->contexts[IWL_RXON_CTX_PAN].ap_devtype = RXON_DEV_TYPE_CP;
543 priv->contexts[IWL_RXON_CTX_PAN].station_devtype = RXON_DEV_TYPE_2STA;
544 priv->contexts[IWL_RXON_CTX_PAN].unused_devtype = RXON_DEV_TYPE_P2P;
549 static void iwl_rf_kill_ct_config(struct iwl_priv *priv)
555 iwl_write32(trans(priv), CSR_UCODE_DRV_GP1_CLR,
558 priv->thermal_throttle.ct_kill_toggle = false;
560 if (cfg(priv)->base_params->support_ct_kill_exit) {
562 cpu_to_le32(hw_params(priv).ct_kill_threshold);
564 cpu_to_le32(hw_params(priv).ct_kill_exit_threshold);
566 ret = iwl_dvm_send_cmd_pdu(priv,
570 IWL_ERR(priv, "REPLY_CT_KILL_CONFIG_CMD failed\n");
572 IWL_DEBUG_INFO(priv, "REPLY_CT_KILL_CONFIG_CMD "
575 hw_params(priv).ct_kill_threshold,
576 hw_params(priv).ct_kill_exit_threshold);
579 cpu_to_le32(hw_params(priv).ct_kill_threshold);
581 ret = iwl_dvm_send_cmd_pdu(priv,
585 IWL_ERR(priv, "REPLY_CT_KILL_CONFIG_CMD failed\n");
587 IWL_DEBUG_INFO(priv, "REPLY_CT_KILL_CONFIG_CMD "
590 hw_params(priv).ct_kill_threshold);
594 static int iwlagn_send_calib_cfg_rt(struct iwl_priv *priv, u32 cfg)
607 return iwl_dvm_send_cmd(priv, &cmd);
611 static int iwlagn_send_tx_ant_config(struct iwl_priv *priv, u8 valid_tx_ant)
617 if (IWL_UCODE_API(priv->fw->ucode_ver) > 1) {
618 IWL_DEBUG_HC(priv, "select valid tx ant: %u\n", valid_tx_ant);
619 return iwl_dvm_send_cmd_pdu(priv,
625 IWL_DEBUG_HC(priv, "TX_ANT_CONFIGURATION_CMD not supported\n");
635 int iwl_alive_start(struct iwl_priv *priv)
638 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
640 IWL_DEBUG_INFO(priv, "Runtime Alive received.\n");
643 set_bit(STATUS_ALIVE, &priv->status);
646 iwl_setup_watchdog(priv);
648 if (iwl_is_rfkill(priv))
651 if (priv->event_log.ucode_trace) {
653 mod_timer(&priv->ucode_trace, jiffies);
657 if (cfg(priv)->bt_params &&
658 cfg(priv)->bt_params->advanced_bt_coexist) {
660 if (cfg(priv)->bt_params->bt_sco_disable)
661 priv->bt_enable_pspoll = false;
663 priv->bt_enable_pspoll = true;
665 priv->bt_valid = IWLAGN_BT_ALL_VALID_MSK;
666 priv->kill_ack_mask = IWLAGN_BT_KILL_ACK_MASK_DEFAULT;
667 priv->kill_cts_mask = IWLAGN_BT_KILL_CTS_MASK_DEFAULT;
668 iwlagn_send_advance_bt_config(priv);
669 priv->bt_valid = IWLAGN_BT_VALID_ENABLE_FLAGS;
670 priv->cur_rssi_ctx = NULL;
672 iwl_send_prio_tbl(priv);
675 ret = iwl_send_bt_env(priv, IWL_BT_COEX_ENV_OPEN,
679 ret = iwl_send_bt_env(priv, IWL_BT_COEX_ENV_CLOSE,
687 iwl_send_bt_config(priv);
693 iwlagn_send_calib_cfg_rt(priv, IWL_CALIB_CFG_DC_IDX);
695 ieee80211_wake_queues(priv->hw);
697 priv->active_rate = IWL_RATES_MASK;
700 iwlagn_send_tx_ant_config(priv, hw_params(priv).valid_tx_ant);
702 if (iwl_is_associated_ctx(ctx) && !priv->wowlan) {
711 for_each_context(priv, tmp)
712 iwl_connection_init_rx_config(priv, tmp);
714 iwlagn_set_rxon_chain(priv, ctx);
717 if (!priv->wowlan) {
719 iwl_reset_run_time_calib(priv);
722 set_bit(STATUS_READY, &priv->status);
725 ret = iwlagn_commit_rxon(priv, ctx);
730 iwl_rf_kill_ct_config(priv);
732 IWL_DEBUG_INFO(priv, "ALIVE processing complete.\n");
734 return iwl_power_update_mode(priv, true);
739 * @priv: iwl priv struct
746 static void iwl_clear_driver_stations(struct iwl_priv *priv)
750 spin_lock_bh(&priv->sta_lock);
751 memset(priv->stations, 0, sizeof(priv->stations));
752 priv->num_stations = 0;
754 priv->ucode_key_table = 0;
756 for_each_context(priv, ctx) {
768 spin_unlock_bh(&priv->sta_lock);
771 void iwl_down(struct iwl_priv *priv)
775 IWL_DEBUG_INFO(priv, DRV_NAME " is going down\n");
777 lockdep_assert_held(&priv->mutex);
779 iwl_scan_cancel_timeout(priv, 200);
786 ieee80211_remain_on_channel_expired(priv->hw);
789 test_and_set_bit(STATUS_EXIT_PENDING, &priv->status);
793 del_timer_sync(&priv->watchdog);
795 iwl_clear_ucode_stations(priv, NULL);
796 iwl_dealloc_bcast_stations(priv);
797 iwl_clear_driver_stations(priv);
800 priv->bt_status = 0;
801 priv->cur_rssi_ctx = NULL;
802 priv->bt_is_sco = 0;
803 if (cfg(priv)->bt_params)
804 priv->bt_traffic_load =
805 cfg(priv)->bt_params->bt_init_traffic_load;
807 priv->bt_traffic_load = 0;
808 priv->bt_full_concurrent = false;
809 priv->bt_ci_compliance = 0;
814 clear_bit(STATUS_EXIT_PENDING, &priv->status);
816 if (priv->mac80211_registered)
817 ieee80211_stop_queues(priv->hw);
819 priv->ucode_loaded = false;
820 iwl_trans_stop_device(trans(priv));
823 priv->status &= test_bit(STATUS_RF_KILL_HW, &priv->status) <<
825 test_bit(STATUS_GEO_CONFIGURED, &priv->status) <<
827 test_bit(STATUS_EXIT_PENDING, &priv->status) <<
829 priv->shrd->status &=
830 test_bit(STATUS_FW_ERROR, &priv->shrd->status) <<
833 dev_kfree_skb(priv->beacon_skb);
834 priv->beacon_skb = NULL;
845 struct iwl_priv *priv = container_of(work, struct iwl_priv,
848 mutex_lock(&priv->mutex);
850 if (test_bit(STATUS_EXIT_PENDING, &priv->status) ||
851 test_bit(STATUS_SCANNING, &priv->status)) {
852 mutex_unlock(&priv->mutex);
856 if (priv->start_calib) {
857 iwl_chain_noise_calibration(priv);
858 iwl_sensitivity_calibration(priv);
861 mutex_unlock(&priv->mutex);
864 void iwlagn_prepare_restart(struct iwl_priv *priv)
872 lockdep_assert_held(&priv->mutex);
874 priv->is_open = 0;
885 bt_full_concurrent = priv->bt_full_concurrent;
886 bt_ci_compliance = priv->bt_ci_compliance;
887 bt_load = priv->bt_traffic_load;
888 bt_status = priv->bt_status;
889 bt_is_sco = priv->bt_is_sco;
891 iwl_down(priv);
893 priv->bt_full_concurrent = bt_full_concurrent;
894 priv->bt_ci_compliance = bt_ci_compliance;
895 priv->bt_traffic_load = bt_load;
896 priv->bt_status = bt_status;
897 priv->bt_is_sco = bt_is_sco;
902 struct iwl_priv *priv = container_of(data, struct iwl_priv, restart);
904 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
907 if (test_and_clear_bit(STATUS_FW_ERROR, &priv->shrd->status)) {
908 mutex_lock(&priv->mutex);
909 iwlagn_prepare_restart(priv);
910 mutex_unlock(&priv->mutex);
911 iwl_cancel_deferred_work(priv);
912 ieee80211_restart_hw(priv->hw);
921 void iwlagn_disable_roc(struct iwl_priv *priv)
923 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_PAN];
925 lockdep_assert_held(&priv->mutex);
927 if (!priv->hw_roc_setup)
933 priv->hw_roc_channel = NULL;
937 iwlagn_commit_rxon(priv, ctx);
940 priv->hw_roc_setup = false;
945 struct iwl_priv *priv = container_of(work, struct iwl_priv,
948 mutex_lock(&priv->mutex);
949 iwlagn_disable_roc(priv);
950 mutex_unlock(&priv->mutex);
959 static void iwl_setup_deferred_work(struct iwl_priv *priv)
961 priv->workqueue = create_singlethread_workqueue(DRV_NAME);
963 INIT_WORK(&priv->restart, iwl_bg_restart);
964 INIT_WORK(&priv->beacon_update, iwl_bg_beacon_update);
965 INIT_WORK(&priv->run_time_calib_work, iwl_bg_run_time_calib_work);
966 INIT_WORK(&priv->tx_flush, iwl_bg_tx_flush);
967 INIT_WORK(&priv->bt_full_concurrency, iwl_bg_bt_full_concurrency);
968 INIT_WORK(&priv->bt_runtime_config, iwl_bg_bt_runtime_config);
969 INIT_DELAYED_WORK(&priv->hw_roc_disable_work,
972 iwl_setup_scan_deferred_work(priv);
974 if (cfg(priv)->bt_params)
975 iwlagn_bt_setup_deferred_work(priv);
977 init_timer(&priv->statistics_periodic);
978 priv->statistics_periodic.data = (unsigned long)priv;
979 priv->statistics_periodic.function = iwl_bg_statistics_periodic;
981 init_timer(&priv->ucode_trace);
982 priv->ucode_trace.data = (unsigned long)priv;
983 priv->ucode_trace.function = iwl_bg_ucode_trace;
985 init_timer(&priv->watchdog);
986 priv->watchdog.data = (unsigned long)priv;
987 priv->watchdog.function = iwl_bg_watchdog;
990 void iwl_cancel_deferred_work(struct iwl_priv *priv)
992 if (cfg(priv)->bt_params)
993 iwlagn_bt_cancel_deferred_work(priv);
995 cancel_work_sync(&priv->run_time_calib_work);
996 cancel_work_sync(&priv->beacon_update);
998 iwl_cancel_scan_deferred_work(priv);
1000 cancel_work_sync(&priv->bt_full_concurrency);
1001 cancel_work_sync(&priv->bt_runtime_config);
1002 cancel_delayed_work_sync(&priv->hw_roc_disable_work);
1004 del_timer_sync(&priv->statistics_periodic);
1005 del_timer_sync(&priv->ucode_trace);
1028 static int iwl_init_drv(struct iwl_priv *priv)
1032 spin_lock_init(&priv->sta_lock);
1034 mutex_init(&priv->mutex);
1036 INIT_LIST_HEAD(&priv->calib_results);
1038 priv->ieee_channels = NULL;
1039 priv->ieee_rates = NULL;
1040 priv->band = IEEE80211_BAND_2GHZ;
1042 priv->plcp_delta_threshold =
1043 cfg(priv)->base_params->plcp_delta_threshold;
1045 priv->iw_mode = NL80211_IFTYPE_STATION;
1046 priv->current_ht_config.smps = IEEE80211_SMPS_STATIC;
1047 priv->missed_beacon_threshold = IWL_MISSED_BEACON_THRESHOLD_DEF;
1048 priv->agg_tids_count = 0;
1050 priv->ucode_owner = IWL_OWNERSHIP_DRIVER;
1053 priv->force_reset[IWL_RF_RESET].reset_duration =
1055 priv->force_reset[IWL_FW_RESET].reset_duration =
1058 priv->rx_statistics_jiffies = jiffies;
1061 iwlagn_set_rxon_chain(priv, &priv->contexts[IWL_RXON_CTX_BSS]);
1063 iwl_init_scan_params(priv);
1066 if (cfg(priv)->bt_params &&
1067 cfg(priv)->bt_params->advanced_bt_coexist) {
1068 priv->kill_ack_mask = IWLAGN_BT_KILL_ACK_MASK_DEFAULT;
1069 priv->kill_cts_mask = IWLAGN_BT_KILL_CTS_MASK_DEFAULT;
1070 priv->bt_valid = IWLAGN_BT_ALL_VALID_MSK;
1071 priv->bt_on_thresh = BT_ON_THRESHOLD_DEF;
1072 priv->bt_duration = BT_DURATION_LIMIT_DEF;
1073 priv->dynamic_frag_thresh = BT_FRAG_THRESHOLD_DEF;
1076 ret = iwl_init_channel_map(priv);
1078 IWL_ERR(priv, "initializing regulatory failed: %d\n", ret);
1082 ret = iwl_init_geos(priv);
1084 IWL_ERR(priv, "initializing geos failed: %d\n", ret);
1087 iwl_init_hw_rates(priv->ieee_rates);
1092 iwl_free_channel_map(priv);
1097 static void iwl_uninit_drv(struct iwl_priv *priv)
1099 iwl_free_geos(priv);
1100 iwl_free_channel_map(priv);
1101 kfree(priv->scan_cmd);
1102 kfree(priv->beacon_cmd);
1103 kfree(rcu_dereference_raw(priv->noa_data));
1104 iwl_calib_free_results(priv);
1106 kfree(priv->wowlan_sram);
1114 static void iwl_set_hw_params(struct iwl_priv *priv)
1116 if (cfg(priv)->ht_params)
1117 hw_params(priv).use_rts_for_aggregation =
1118 cfg(priv)->ht_params->use_rts_for_aggregation;
1121 hw_params(priv).rx_page_order =
1124 hw_params(priv).rx_page_order =
1128 hw_params(priv).sku &= ~EEPROM_SKU_CAP_11N_ENABLE;
1130 hw_params(priv).num_ampdu_queues =
1131 cfg(priv)->base_params->num_of_ampdu_queues;
1132 hw_params(priv).wd_timeout = cfg(priv)->base_params->wd_timeout;
1135 cfg(priv)->lib->set_hw_params(priv);
1140 static void iwl_debug_config(struct iwl_priv *priv)
1142 dev_printk(KERN_INFO, trans(priv)->dev, "CONFIG_IWLWIFI_DEBUG "
1148 dev_printk(KERN_INFO, trans(priv)->dev, "CONFIG_IWLWIFI_DEBUGFS "
1154 dev_printk(KERN_INFO, trans(priv)->dev, "CONFIG_IWLWIFI_DEVICE_TRACING "
1161 dev_printk(KERN_INFO, trans(priv)->dev, "CONFIG_IWLWIFI_DEVICE_TESTMODE "
1167 dev_printk(KERN_INFO, trans(priv)->dev, "CONFIG_IWLWIFI_P2P "
1179 struct iwl_priv *priv;
1205 op_mode = hw->priv;
1207 priv = IWL_OP_MODE_GET_DVM(op_mode);
1208 priv->shrd = trans->shrd;
1209 priv->fw = fw;
1211 priv->shrd->fw = fw;
1228 priv->sta_key_max_num = STA_KEY_MAX_NUM_PAN;
1231 priv->sta_key_max_num = STA_KEY_MAX_NUM;
1236 iwl_trans_configure(trans(priv), &trans_cfg);
1238 /* At this point both hw and priv are allocated. */
1240 SET_IEEE80211_DEV(priv->hw, trans(priv)->dev);
1243 iwl_debug_config(priv);
1245 IWL_DEBUG_INFO(priv, "*** LOAD DRIVER ***\n");
1248 priv->bt_ant_couple_ok =
1254 priv->bt_ch_announce = iwlagn_mod_params.bt_ch_announce;
1255 IWL_DEBUG_INFO(priv, "BT channel inhibition is %s\n",
1256 (priv->bt_ch_announce) ? "On" : "Off");
1258 if (iwl_alloc_traffic_mem(priv))
1259 IWL_ERR(priv, "Not enough memory to generate traffic log\n");
1264 spin_lock_init(&trans(priv)->reg_lock);
1265 spin_lock_init(&priv->statistics.lock);
1270 IWL_INFO(priv, "Detected %s, REV=0x%X\n",
1271 cfg(priv)->name, trans(priv)->hw_rev);
1273 err = iwl_trans_start_hw(trans(priv));
1280 err = iwl_eeprom_init(trans(priv), trans(priv)->hw_rev);
1282 iwl_trans_stop_hw(trans(priv));
1284 IWL_ERR(priv, "Unable to init EEPROM\n");
1287 err = iwl_eeprom_check_version(priv);
1291 err = iwl_eeprom_init_hw_params(priv);
1296 iwl_eeprom_get_mac(priv->shrd, priv->addresses[0].addr);
1297 IWL_DEBUG_INFO(priv, "MAC address: %pM\n", priv->addresses[0].addr);
1298 priv->hw->wiphy->addresses = priv->addresses;
1299 priv->hw->wiphy->n_addresses = 1;
1300 num_mac = iwl_eeprom_query16(priv->shrd, EEPROM_NUM_MAC_ADDRESS);
1302 memcpy(priv->addresses[1].addr, priv->addresses[0].addr,
1304 priv->addresses[1].addr[5]++;
1305 priv->hw->wiphy->n_addresses++;
1311 iwl_set_hw_params(priv);
1313 if (!(hw_params(priv).sku & EEPROM_SKU_CAP_IPAN_ENABLE)) {
1314 IWL_DEBUG_INFO(priv, "Your EEPROM disabled PAN");
1321 priv->sta_key_max_num = STA_KEY_MAX_NUM;
1325 iwl_trans_configure(trans(priv), &trans_cfg);
1329 * 5. Setup priv
1332 err = iwl_init_drv(priv);
1335 /* At this point both hw and priv are initialized. */
1340 iwl_setup_deferred_work(priv);
1341 iwl_setup_rx_handlers(priv);
1342 iwl_testmode_init(priv);
1344 iwl_power_initialize(priv);
1345 iwl_tt_initialize(priv);
1347 snprintf(priv->hw->wiphy->fw_version,
1348 sizeof(priv->hw->wiphy->fw_version),
1351 priv->new_scan_threshold_behaviour =
1354 priv->phy_calib_chain_noise_reset_cmd =
1356 priv->phy_calib_chain_noise_gain_cmd =
1360 iwl_init_context(priv, ucode_flags);
1367 err = iwlagn_mac_setup_register(priv, &fw->ucode_capa);
1371 err = iwl_dbgfs_register(priv, DRV_NAME);
1373 IWL_ERR(priv,
1380 destroy_workqueue(priv->workqueue);
1381 priv->workqueue = NULL;
1382 iwl_uninit_drv(priv);
1384 iwl_eeprom_free(priv->shrd);
1386 iwl_free_traffic_mem(priv);
1387 ieee80211_free_hw(priv->hw);
1395 struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode);
1397 IWL_DEBUG_INFO(priv, "*** UNLOAD DRIVER ***\n");
1399 iwl_dbgfs_unregister(priv);
1401 iwl_testmode_cleanup(priv);
1402 iwlagn_mac_unregister(priv);
1404 iwl_tt_exit(priv);
1407 priv->ucode_loaded = false;
1408 iwl_trans_stop_device(trans(priv));
1410 iwl_eeprom_free(priv->shrd);
1413 flush_workqueue(priv->workqueue);
1416 * priv->workqueue... so we can't take down the workqueue
1418 destroy_workqueue(priv->workqueue);
1419 priv->workqueue = NULL;
1420 iwl_free_traffic_mem(priv);
1422 iwl_uninit_drv(priv);
1424 dev_kfree_skb(priv->beacon_skb);
1426 ieee80211_free_hw(priv->hw);
1431 struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode);
1433 if (!iwl_check_for_ct_kill(priv)) {
1434 IWL_ERR(priv, "Restarting adapter queue is full\n");
1441 struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode);
1443 cfg(priv)->lib->nic_config(priv);
1448 struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode);
1450 set_bit(ac, &priv->transport_queue_stop);
1451 ieee80211_stop_queue(priv->hw, ac);
1456 struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode);
1458 clear_bit(ac, &priv->transport_queue_stop);
1460 if (!priv->passive_no_rx)
1461 ieee80211_wake_queue(priv->hw, ac);
1464 void iwlagn_lift_passive_no_rx(struct iwl_priv *priv)
1468 if (!priv->passive_no_rx)
1472 if (!test_bit(ac, &priv->transport_queue_stop)) {
1473 IWL_DEBUG_TX_QUEUES(priv, "Wake queue %d");
1474 ieee80211_wake_queue(priv->hw, ac);
1476 IWL_DEBUG_TX_QUEUES(priv, "Don't wake queue %d");
1480 priv->passive_no_rx = false;