Lines Matching +full:disable +full:- +full:key +full:- +full:power
1 // SPDX-License-Identifier: GPL-2.0-only
4 * Copyright(c) 2008 - 2014, 2022 Intel Corporation. All rights reserved.
12 #include "iwl-io.h"
13 #include "iwl-agn-hw.h"
14 #include "iwl-trans.h"
15 #include "iwl-modparams.h"
31 if (WARN_ONCE(test_bit(STATUS_SCAN_HW, &priv->status), in iwlagn_send_tx_power()
32 "TX Power requested while scanning!\n")) in iwlagn_send_tx_power()
33 return -EAGAIN; in iwlagn_send_tx_power()
36 tx_power_cmd.global_lmt = (s8)(2 * priv->tx_power_user_lmt); in iwlagn_send_tx_power()
38 if (tx_power_cmd.global_lmt > priv->nvm_data->max_tx_pwr_half_dbm) { in iwlagn_send_tx_power()
40 * For the newer devices which using enhanced/extend tx power in iwlagn_send_tx_power()
44 * lost. driver will perform "round-up" operation before in iwlagn_send_tx_power()
45 * reporting, but it will cause 1/2 dBm tx power over the in iwlagn_send_tx_power()
48 * half-dBm format), lower the tx power based on EEPROM in iwlagn_send_tx_power()
51 priv->nvm_data->max_tx_pwr_half_dbm; in iwlagn_send_tx_power()
56 if (IWL_UCODE_API(priv->fw->ucode_ver) == 1) in iwlagn_send_tx_power()
67 lockdep_assert_held(&priv->statistics.lock); in iwlagn_temperature()
70 priv->temperature = le32_to_cpu(priv->statistics.common.temperature); in iwlagn_temperature()
89 return idx - band_offset; in iwlagn_hwrate_to_mac80211_idx()
92 return -1; in iwlagn_hwrate_to_mac80211_idx()
98 struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; in iwlagn_manage_ibss_station()
101 return iwlagn_add_bssid_station(priv, vif_priv->ctx, in iwlagn_manage_ibss_station()
102 vif->bss_conf.bssid, in iwlagn_manage_ibss_station()
103 &vif_priv->ibss_bssid_sta_id); in iwlagn_manage_ibss_station()
104 return iwl_remove_station(priv, vif_priv->ibss_bssid_sta_id, in iwlagn_manage_ibss_station()
105 vif->bss_conf.bssid); in iwlagn_manage_ibss_station()
111 * pre-requirements:
127 if ((priv->valid_contexts != BIT(IWL_RXON_CTX_BSS))) in iwlagn_txfifo_flush()
133 if (priv->nvm_data->sku_cap_11n_enable) in iwlagn_txfifo_flush()
143 if (IWL_UCODE_API(priv->fw->ucode_ver) > 2) in iwlagn_txfifo_flush()
153 mutex_lock(&priv->mutex); in iwlagn_dev_txfifo_flush()
154 ieee80211_stop_queues(priv->hw); in iwlagn_dev_txfifo_flush()
160 iwl_trans_wait_tx_queues_empty(priv->trans, 0xffffffff); in iwlagn_dev_txfifo_flush()
162 ieee80211_wake_queues(priv->hw); in iwlagn_dev_txfifo_flush()
163 mutex_unlock(&priv->mutex); in iwlagn_dev_txfifo_flush()
216 if (priv->lib->bt_params) { in iwlagn_send_advance_bt_config()
223 if (priv->lib->bt_params->bt_session_2) { in iwlagn_send_advance_bt_config()
225 priv->lib->bt_params->bt_prio_boost); in iwlagn_send_advance_bt_config()
230 WARN_ON(priv->lib->bt_params->bt_prio_boost & ~0xFF); in iwlagn_send_advance_bt_config()
232 priv->lib->bt_params->bt_prio_boost; in iwlagn_send_advance_bt_config()
244 * reduce the tx power of the required response frames, by that, in iwlagn_send_advance_bt_config()
246 * (BT - ANT A, WiFi -ANT B), without interference to one another in iwlagn_send_advance_bt_config()
248 * Reduced tx power apply to control frames only (ACK/Back/CTS) in iwlagn_send_advance_bt_config()
251 basic.kill_ack_mask = priv->kill_ack_mask; in iwlagn_send_advance_bt_config()
252 basic.kill_cts_mask = priv->kill_cts_mask; in iwlagn_send_advance_bt_config()
253 if (priv->reduced_txpower) in iwlagn_send_advance_bt_config()
255 basic.valid = priv->bt_valid; in iwlagn_send_advance_bt_config()
264 priv->iw_mode == NL80211_IFTYPE_ADHOC) { in iwlagn_send_advance_bt_config()
270 if (!priv->bt_enable_pspoll) in iwlagn_send_advance_bt_config()
275 if (priv->bt_ch_announce) in iwlagn_send_advance_bt_config()
279 priv->bt_enable_flag = basic.flags; in iwlagn_send_advance_bt_config()
280 if (priv->bt_full_concurrent) in iwlagn_send_advance_bt_config()
289 priv->bt_full_concurrent ? in iwlagn_send_advance_bt_config()
290 "full concurrency" : "3-wire"); in iwlagn_send_advance_bt_config()
292 if (priv->lib->bt_params->bt_session_2) { in iwlagn_send_advance_bt_config()
313 lockdep_assert_held(&priv->mutex); in iwlagn_bt_adjust_rssi_monitor()
318 if (ctx->vif && ctx->vif->type == NL80211_IFTYPE_AP && in iwlagn_bt_adjust_rssi_monitor()
327 * If disable was received or If GO/AP mode, disable RSSI in iwlagn_bt_adjust_rssi_monitor()
331 if (priv->cur_rssi_ctx) { in iwlagn_bt_adjust_rssi_monitor()
332 ctx = priv->cur_rssi_ctx; in iwlagn_bt_adjust_rssi_monitor()
333 ieee80211_disable_rssi_reports(ctx->vif); in iwlagn_bt_adjust_rssi_monitor()
334 priv->cur_rssi_ctx = NULL; in iwlagn_bt_adjust_rssi_monitor()
344 if (ctx->vif && ctx->vif->type == NL80211_IFTYPE_STATION && in iwlagn_bt_adjust_rssi_monitor()
355 if (found_ctx == priv->cur_rssi_ctx) in iwlagn_bt_adjust_rssi_monitor()
360 * to be changed. If rssi monitor is already enabled, disable in iwlagn_bt_adjust_rssi_monitor()
364 if (priv->cur_rssi_ctx) { in iwlagn_bt_adjust_rssi_monitor()
365 ctx = priv->cur_rssi_ctx; in iwlagn_bt_adjust_rssi_monitor()
366 if (ctx->vif) in iwlagn_bt_adjust_rssi_monitor()
367 ieee80211_disable_rssi_reports(ctx->vif); in iwlagn_bt_adjust_rssi_monitor()
370 priv->cur_rssi_ctx = found_ctx; in iwlagn_bt_adjust_rssi_monitor()
375 ieee80211_enable_rssi_reports(found_ctx->vif, in iwlagn_bt_adjust_rssi_monitor()
382 return (BT_UART_MSG_FRAME3SCOESCO_MSK & uart_msg->frame3) >> in iwlagn_bt_traffic_is_sco()
391 int smps_request = -1; in iwlagn_bt_traffic_change_work()
393 if (priv->bt_enable_flag == IWLAGN_BT_FLAG_COEX_MODE_DISABLED) { in iwlagn_bt_traffic_change_work()
404 priv->bt_traffic_load); in iwlagn_bt_traffic_change_work()
406 switch (priv->bt_traffic_load) { in iwlagn_bt_traffic_change_work()
408 if (priv->bt_status) in iwlagn_bt_traffic_change_work()
422 priv->bt_traffic_load); in iwlagn_bt_traffic_change_work()
426 mutex_lock(&priv->mutex); in iwlagn_bt_traffic_change_work()
435 if (test_bit(STATUS_SCAN_HW, &priv->status)) in iwlagn_bt_traffic_change_work()
440 if (smps_request != -1) { in iwlagn_bt_traffic_change_work()
441 priv->current_ht_config.smps = smps_request; in iwlagn_bt_traffic_change_work()
443 if (ctx->vif && ctx->vif->type == NL80211_IFTYPE_STATION) in iwlagn_bt_traffic_change_work()
444 ieee80211_request_smps(ctx->vif, 0, smps_request); in iwlagn_bt_traffic_change_work()
454 mutex_unlock(&priv->mutex); in iwlagn_bt_traffic_change_work()
459 * correct interface or disable it if this is the last interface to be
464 if (priv->bt_is_sco && in iwlagn_bt_coex_rssi_monitor()
465 priv->bt_traffic_load == IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS) in iwlagn_bt_coex_rssi_monitor()
476 (BT_UART_MSG_FRAME1MSGTYPE_MSK & uart_msg->frame1) >> in iwlagn_print_uartmsg()
478 (BT_UART_MSG_FRAME1SSN_MSK & uart_msg->frame1) >> in iwlagn_print_uartmsg()
480 (BT_UART_MSG_FRAME1UPDATEREQ_MSK & uart_msg->frame1) >> in iwlagn_print_uartmsg()
485 (BT_UART_MSG_FRAME2OPENCONNECTIONS_MSK & uart_msg->frame2) >> in iwlagn_print_uartmsg()
487 (BT_UART_MSG_FRAME2TRAFFICLOAD_MSK & uart_msg->frame2) >> in iwlagn_print_uartmsg()
489 (BT_UART_MSG_FRAME2CHLSEQN_MSK & uart_msg->frame2) >> in iwlagn_print_uartmsg()
491 (BT_UART_MSG_FRAME2INBAND_MSK & uart_msg->frame2) >> in iwlagn_print_uartmsg()
496 (BT_UART_MSG_FRAME3SCOESCO_MSK & uart_msg->frame3) >> in iwlagn_print_uartmsg()
498 (BT_UART_MSG_FRAME3SNIFF_MSK & uart_msg->frame3) >> in iwlagn_print_uartmsg()
500 (BT_UART_MSG_FRAME3A2DP_MSK & uart_msg->frame3) >> in iwlagn_print_uartmsg()
502 (BT_UART_MSG_FRAME3ACL_MSK & uart_msg->frame3) >> in iwlagn_print_uartmsg()
504 (BT_UART_MSG_FRAME3MASTER_MSK & uart_msg->frame3) >> in iwlagn_print_uartmsg()
506 (BT_UART_MSG_FRAME3OBEX_MSK & uart_msg->frame3) >> in iwlagn_print_uartmsg()
510 (BT_UART_MSG_FRAME4IDLEDURATION_MSK & uart_msg->frame4) >> in iwlagn_print_uartmsg()
515 (BT_UART_MSG_FRAME5TXACTIVITY_MSK & uart_msg->frame5) >> in iwlagn_print_uartmsg()
517 (BT_UART_MSG_FRAME5RXACTIVITY_MSK & uart_msg->frame5) >> in iwlagn_print_uartmsg()
519 (BT_UART_MSG_FRAME5ESCORETRANSMIT_MSK & uart_msg->frame5) >> in iwlagn_print_uartmsg()
523 (BT_UART_MSG_FRAME6SNIFFINTERVAL_MSK & uart_msg->frame6) >> in iwlagn_print_uartmsg()
525 (BT_UART_MSG_FRAME6DISCOVERABLE_MSK & uart_msg->frame6) >> in iwlagn_print_uartmsg()
530 (BT_UART_MSG_FRAME7SNIFFACTIVITY_MSK & uart_msg->frame7) >> in iwlagn_print_uartmsg()
532 (BT_UART_MSG_FRAME7PAGE_MSK & uart_msg->frame7) >> in iwlagn_print_uartmsg()
534 (BT_UART_MSG_FRAME7INQUIRY_MSK & uart_msg->frame7) >> in iwlagn_print_uartmsg()
536 (BT_UART_MSG_FRAME7CONNECTABLE_MSK & uart_msg->frame7) >> in iwlagn_print_uartmsg()
554 if (!priv->reduced_txpower) in iwlagn_set_kill_msk()
555 kill_msk = (BT_UART_MSG_FRAME3SCOESCO_MSK & uart_msg->frame3) in iwlagn_set_kill_msk()
557 if (priv->kill_ack_mask != bt_kill_ack_msg[kill_msk] || in iwlagn_set_kill_msk()
558 priv->kill_cts_mask != bt_kill_cts_msg[kill_msk]) { in iwlagn_set_kill_msk()
559 priv->bt_valid |= IWLAGN_BT_VALID_KILL_ACK_MASK; in iwlagn_set_kill_msk()
560 priv->kill_ack_mask = bt_kill_ack_msg[kill_msk]; in iwlagn_set_kill_msk()
561 priv->bt_valid |= IWLAGN_BT_VALID_KILL_CTS_MASK; in iwlagn_set_kill_msk()
562 priv->kill_cts_mask = bt_kill_cts_msg[kill_msk]; in iwlagn_set_kill_msk()
570 * 1. enable/disable "reduced control frames tx power
573 * If "reduced tx power" is enabled, uCode shall
581 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; in iwlagn_fill_txpower_mode()
584 if (!ctx->vif || (ctx->vif->type != NL80211_IFTYPE_STATION)) { in iwlagn_fill_txpower_mode()
589 ave_rssi = ieee80211_ave_rssi(ctx->vif); in iwlagn_fill_txpower_mode()
591 /* no rssi data, no changes to reduce tx power */ in iwlagn_fill_txpower_mode()
595 if (!priv->reduced_txpower && in iwlagn_fill_txpower_mode()
598 (uart_msg->frame3 & (BT_UART_MSG_FRAME3ACL_MSK | in iwlagn_fill_txpower_mode()
600 !(uart_msg->frame3 & (BT_UART_MSG_FRAME3SCOESCO_MSK | in iwlagn_fill_txpower_mode()
602 /* enabling reduced tx power */ in iwlagn_fill_txpower_mode()
603 priv->reduced_txpower = true; in iwlagn_fill_txpower_mode()
604 priv->bt_valid |= IWLAGN_BT_VALID_REDUCED_TX_PWR; in iwlagn_fill_txpower_mode()
606 } else if (priv->reduced_txpower && in iwlagn_fill_txpower_mode()
609 (uart_msg->frame3 & (BT_UART_MSG_FRAME3SCOESCO_MSK | in iwlagn_fill_txpower_mode()
611 !(uart_msg->frame3 & (BT_UART_MSG_FRAME3ACL_MSK | in iwlagn_fill_txpower_mode()
613 /* disable reduced tx power */ in iwlagn_fill_txpower_mode()
614 priv->reduced_txpower = false; in iwlagn_fill_txpower_mode()
615 priv->bt_valid |= IWLAGN_BT_VALID_REDUCED_TX_PWR; in iwlagn_fill_txpower_mode()
626 struct iwl_bt_coex_profile_notif *coex = (void *)pkt->data; in iwlagn_bt_coex_profile_notif()
627 struct iwl_bt_uart_msg *uart_msg = &coex->last_bt_uart_msg; in iwlagn_bt_coex_profile_notif()
629 if (priv->bt_enable_flag == IWLAGN_BT_FLAG_COEX_MODE_DISABLED) { in iwlagn_bt_coex_profile_notif()
635 IWL_DEBUG_COEX(priv, " status: %d\n", coex->bt_status); in iwlagn_bt_coex_profile_notif()
636 IWL_DEBUG_COEX(priv, " traffic load: %d\n", coex->bt_traffic_load); in iwlagn_bt_coex_profile_notif()
638 coex->bt_ci_compliance); in iwlagn_bt_coex_profile_notif()
641 priv->last_bt_traffic_load = priv->bt_traffic_load; in iwlagn_bt_coex_profile_notif()
642 priv->bt_is_sco = iwlagn_bt_traffic_is_sco(uart_msg); in iwlagn_bt_coex_profile_notif()
644 if (priv->iw_mode != NL80211_IFTYPE_ADHOC) { in iwlagn_bt_coex_profile_notif()
645 if (priv->bt_status != coex->bt_status || in iwlagn_bt_coex_profile_notif()
646 priv->last_bt_traffic_load != coex->bt_traffic_load) { in iwlagn_bt_coex_profile_notif()
647 if (coex->bt_status) { in iwlagn_bt_coex_profile_notif()
649 if (!priv->bt_ch_announce) in iwlagn_bt_coex_profile_notif()
650 priv->bt_traffic_load = in iwlagn_bt_coex_profile_notif()
653 priv->bt_traffic_load = in iwlagn_bt_coex_profile_notif()
654 coex->bt_traffic_load; in iwlagn_bt_coex_profile_notif()
657 priv->bt_traffic_load = in iwlagn_bt_coex_profile_notif()
660 priv->bt_status = coex->bt_status; in iwlagn_bt_coex_profile_notif()
661 queue_work(priv->workqueue, in iwlagn_bt_coex_profile_notif()
662 &priv->bt_traffic_change_work); in iwlagn_bt_coex_profile_notif()
667 /* check reduce power before change ack/cts kill mask */ in iwlagn_bt_coex_profile_notif()
670 queue_work(priv->workqueue, &priv->bt_runtime_config); in iwlagn_bt_coex_profile_notif()
675 priv->bt_ci_compliance = coex->bt_ci_compliance; in iwlagn_bt_coex_profile_notif()
680 priv->rx_handlers[REPLY_BT_COEX_PROFILE_NOTIF] = in iwlagn_bt_rx_handler_setup()
686 INIT_WORK(&priv->bt_traffic_change_work, in iwlagn_bt_setup_deferred_work()
692 cancel_work_sync(&priv->bt_traffic_change_work); in iwlagn_bt_cancel_deferred_work()
697 return priv->current_ht_config.smps == IEEE80211_SMPS_STATIC || in is_single_rx_stream()
698 priv->current_ht_config.single_chain_sufficient; in is_single_rx_stream()
709 * More provides better reception via diversity. Fewer saves power
718 if (priv->lib->bt_params && in iwl_get_active_rx_chain_count()
719 priv->lib->bt_params->advanced_bt_coexist && in iwl_get_active_rx_chain_count()
720 (priv->bt_full_concurrent || in iwl_get_active_rx_chain_count()
721 priv->bt_traffic_load >= IWL_BT_COEX_TRAFFIC_LOAD_HIGH)) { in iwl_get_active_rx_chain_count()
736 * When we are in power saving mode, unless device support spatial
737 * multiplexing power save, use the active count for rx chain count.
742 switch (priv->current_ht_config.smps) { in iwl_get_idle_rx_chain_count()
751 priv->current_ht_config.smps); in iwl_get_idle_rx_chain_count()
768 * iwlagn_set_rxon_chain - Set up Rx chain usage in "staging" RXON image
776 bool is_cam = !test_bit(STATUS_POWER_PMI, &priv->status); in iwlagn_set_rxon_chain()
785 if (priv->chain_noise_data.active_chains) in iwlagn_set_rxon_chain()
786 active_chains = priv->chain_noise_data.active_chains; in iwlagn_set_rxon_chain()
788 active_chains = priv->nvm_data->valid_rx_ant; in iwlagn_set_rxon_chain()
790 if (priv->lib->bt_params && in iwlagn_set_rxon_chain()
791 priv->lib->bt_params->advanced_bt_coexist && in iwlagn_set_rxon_chain()
792 (priv->bt_full_concurrent || in iwlagn_set_rxon_chain()
793 priv->bt_traffic_load >= IWL_BT_COEX_TRAFFIC_LOAD_HIGH)) { in iwlagn_set_rxon_chain()
821 ctx->staging.rx_chain = cpu_to_le16(rx_chain); in iwlagn_set_rxon_chain()
824 ctx->staging.rx_chain |= RXON_RX_CHAIN_MIMO_FORCE_MSK; in iwlagn_set_rxon_chain()
826 ctx->staging.rx_chain &= ~RXON_RX_CHAIN_MIMO_FORCE_MSK; in iwlagn_set_rxon_chain()
829 ctx->staging.rx_chain, in iwlagn_set_rxon_chain()
841 if (priv->band == NL80211_BAND_2GHZ && in iwl_toggle_tx_ant()
842 priv->bt_traffic_load >= IWL_BT_COEX_TRAFFIC_LOAD_HIGH) in iwl_toggle_tx_ant()
845 for (i = 0; i < RATE_ANT_NUM - 1; i++) { in iwl_toggle_tx_ant()
874 struct ieee80211_key_conf *key, in iwlagn_wowlan_program_keys() argument
879 struct iwl_rxon_context *ctx = data->ctx; in iwlagn_wowlan_program_keys()
889 mutex_lock(&priv->mutex); in iwlagn_wowlan_program_keys()
891 if ((key->cipher == WLAN_CIPHER_SUITE_WEP40 || in iwlagn_wowlan_program_keys()
892 key->cipher == WLAN_CIPHER_SUITE_WEP104) && in iwlagn_wowlan_program_keys()
893 !sta && !ctx->key_mapping_keys) in iwlagn_wowlan_program_keys()
894 ret = iwl_set_default_wep_key(priv, ctx, key); in iwlagn_wowlan_program_keys()
896 ret = iwl_set_dynamic_key(priv, ctx, key, sta); in iwlagn_wowlan_program_keys()
899 IWL_ERR(priv, "Error setting key during suspend!\n"); in iwlagn_wowlan_program_keys()
900 data->error = true; in iwlagn_wowlan_program_keys()
903 switch (key->cipher) { in iwlagn_wowlan_program_keys()
908 tkip_sc = data->rsc_tsc->all_tsc_rsc.tkip.unicast_rsc; in iwlagn_wowlan_program_keys()
909 tkip_tx_sc = &data->rsc_tsc->all_tsc_rsc.tkip.tsc; in iwlagn_wowlan_program_keys()
911 rx_p1ks = data->tkip->rx_uni; in iwlagn_wowlan_program_keys()
913 pn64 = atomic64_read(&key->tx_pn); in iwlagn_wowlan_program_keys()
914 tkip_tx_sc->iv16 = cpu_to_le16(TKIP_PN_TO_IV16(pn64)); in iwlagn_wowlan_program_keys()
915 tkip_tx_sc->iv32 = cpu_to_le32(TKIP_PN_TO_IV32(pn64)); in iwlagn_wowlan_program_keys()
917 ieee80211_get_tkip_p1k_iv(key, seq.tkip.iv32, p1k); in iwlagn_wowlan_program_keys()
918 iwlagn_convert_p1k(p1k, data->tkip->tx.p1k); in iwlagn_wowlan_program_keys()
920 memcpy(data->tkip->mic_keys.tx, in iwlagn_wowlan_program_keys()
921 &key->key[NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY], in iwlagn_wowlan_program_keys()
924 rx_mic_key = data->tkip->mic_keys.rx_unicast; in iwlagn_wowlan_program_keys()
927 data->rsc_tsc->all_tsc_rsc.tkip.multicast_rsc; in iwlagn_wowlan_program_keys()
928 rx_p1ks = data->tkip->rx_multi; in iwlagn_wowlan_program_keys()
929 rx_mic_key = data->tkip->mic_keys.rx_mcast; in iwlagn_wowlan_program_keys()
933 * For non-QoS this relies on the fact that both the uCode and in iwlagn_wowlan_program_keys()
938 ieee80211_get_key_rx_seq(key, i, &seq); in iwlagn_wowlan_program_keys()
946 ieee80211_get_tkip_rx_p1k(key, data->bssid, cur_rx_iv32, p1k); in iwlagn_wowlan_program_keys()
948 ieee80211_get_tkip_rx_p1k(key, data->bssid, in iwlagn_wowlan_program_keys()
953 &key->key[NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY], in iwlagn_wowlan_program_keys()
956 data->use_tkip = true; in iwlagn_wowlan_program_keys()
957 data->use_rsc_tsc = true; in iwlagn_wowlan_program_keys()
963 aes_sc = data->rsc_tsc->all_tsc_rsc.aes.unicast_rsc; in iwlagn_wowlan_program_keys()
964 aes_tx_sc = &data->rsc_tsc->all_tsc_rsc.aes.tsc; in iwlagn_wowlan_program_keys()
966 pn64 = atomic64_read(&key->tx_pn); in iwlagn_wowlan_program_keys()
967 aes_tx_sc->pn = cpu_to_le64(pn64); in iwlagn_wowlan_program_keys()
969 aes_sc = data->rsc_tsc->all_tsc_rsc.aes.multicast_rsc; in iwlagn_wowlan_program_keys()
972 * For non-QoS this relies on the fact that both the uCode and in iwlagn_wowlan_program_keys()
978 ieee80211_get_key_rx_seq(key, i, &seq); in iwlagn_wowlan_program_keys()
987 data->use_rsc_tsc = true; in iwlagn_wowlan_program_keys()
991 mutex_unlock(&priv->mutex); in iwlagn_wowlan_program_keys()
1004 if (!wowlan->n_patterns) in iwlagn_send_patterns()
1007 cmd.len[0] = struct_size(pattern_cmd, patterns, wowlan->n_patterns); in iwlagn_send_patterns()
1011 return -ENOMEM; in iwlagn_send_patterns()
1013 pattern_cmd->n_patterns = cpu_to_le32(wowlan->n_patterns); in iwlagn_send_patterns()
1015 for (i = 0; i < wowlan->n_patterns; i++) { in iwlagn_send_patterns()
1016 int mask_len = DIV_ROUND_UP(wowlan->patterns[i].pattern_len, 8); in iwlagn_send_patterns()
1018 memcpy(&pattern_cmd->patterns[i].mask, in iwlagn_send_patterns()
1019 wowlan->patterns[i].mask, mask_len); in iwlagn_send_patterns()
1020 memcpy(&pattern_cmd->patterns[i].pattern, in iwlagn_send_patterns()
1021 wowlan->patterns[i].pattern, in iwlagn_send_patterns()
1022 wowlan->patterns[i].pattern_len); in iwlagn_send_patterns()
1023 pattern_cmd->patterns[i].mask_size = mask_len; in iwlagn_send_patterns()
1024 pattern_cmd->patterns[i].pattern_size = in iwlagn_send_patterns()
1025 wowlan->patterns[i].pattern_len; in iwlagn_send_patterns()
1038 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; in iwlagn_suspend()
1051 .bssid = ctx->active.bssid_addr, in iwlagn_suspend()
1061 return -ENOMEM; in iwlagn_suspend()
1069 seq = le16_to_cpu(priv->last_seq_ctl) & IEEE80211_SCTL_SEQ; in iwlagn_suspend()
1077 seq = priv->tid_data[IWL_AP_ID][i].seq_number; in iwlagn_suspend()
1078 seq -= 0x10; in iwlagn_suspend()
1082 if (wowlan->disconnect) in iwlagn_suspend()
1086 if (wowlan->magic_pkt) in iwlagn_suspend()
1089 if (wowlan->gtk_rekey_failure) in iwlagn_suspend()
1092 if (wowlan->eap_identity_req) in iwlagn_suspend()
1095 if (wowlan->four_way_handshake) in iwlagn_suspend()
1098 if (wowlan->n_patterns) in iwlagn_suspend()
1102 if (wowlan->rfkill_release) in iwlagn_suspend()
1108 memcpy(&rxon, &ctx->active, sizeof(rxon)); in iwlagn_suspend()
1110 priv->ucode_loaded = false; in iwlagn_suspend()
1111 iwl_trans_stop_device(priv->trans); in iwlagn_suspend()
1112 ret = iwl_trans_start_hw(priv->trans); in iwlagn_suspend()
1116 priv->wowlan = true; in iwlagn_suspend()
1127 memcpy(&ctx->staging, &rxon, sizeof(rxon)); in iwlagn_suspend()
1138 priv->ucode_key_table = 0; in iwlagn_suspend()
1139 ctx->key_mapping_keys = 0; in iwlagn_suspend()
1146 mutex_unlock(&priv->mutex); in iwlagn_suspend()
1147 ieee80211_iter_keys(priv->hw, ctx->vif, in iwlagn_suspend()
1150 mutex_lock(&priv->mutex); in iwlagn_suspend()
1152 ret = -EIO; in iwlagn_suspend()
1178 if (priv->have_rekey_data) { in iwlagn_suspend()
1180 memcpy(kek_kck_cmd.kck, priv->kck, NL80211_KCK_LEN); in iwlagn_suspend()
1182 memcpy(kek_kck_cmd.kek, priv->kek, NL80211_KEK_LEN); in iwlagn_suspend()
1184 kek_kck_cmd.replay_ctr = priv->replay_ctr; in iwlagn_suspend()
1216 IWL_WARN(priv, "Not sending command - %s KILL\n", in iwl_dvm_send_cmd()
1218 return -EIO; in iwl_dvm_send_cmd()
1221 if (test_bit(STATUS_FW_ERROR, &priv->status)) { in iwl_dvm_send_cmd()
1223 iwl_get_cmd_string(priv->trans, cmd->id)); in iwl_dvm_send_cmd()
1224 return -EIO; in iwl_dvm_send_cmd()
1231 if (!priv->ucode_loaded) { in iwl_dvm_send_cmd()
1232 IWL_ERR(priv, "Fw not loaded - dropping CMD: %x\n", cmd->id); in iwl_dvm_send_cmd()
1233 return -EIO; in iwl_dvm_send_cmd()
1237 * Synchronous commands from this op-mode must hold in iwl_dvm_send_cmd()
1241 if (!(cmd->flags & CMD_ASYNC)) in iwl_dvm_send_cmd()
1242 lockdep_assert_held(&priv->mutex); in iwl_dvm_send_cmd()
1244 return iwl_trans_send_cmd(priv->trans, cmd); in iwl_dvm_send_cmd()