Lines Matching refs:mvm
35 struct iwl_mvm *mvm; member
173 void iwl_mvm_mac_ctxt_recalc_tsf_id(struct iwl_mvm *mvm, in iwl_mvm_mac_ctxt_recalc_tsf_id() argument
178 .mvm = mvm, in iwl_mvm_mac_ctxt_recalc_tsf_id()
186 mvm->hw, IEEE80211_IFACE_ITER_RESUME_ALL, in iwl_mvm_mac_ctxt_recalc_tsf_id()
196 int iwl_mvm_mac_ctxt_init(struct iwl_mvm *mvm, struct ieee80211_vif *vif) in iwl_mvm_mac_ctxt_init() argument
200 .mvm = mvm, in iwl_mvm_mac_ctxt_init()
210 lockdep_assert_held(&mvm->mutex); in iwl_mvm_mac_ctxt_init()
241 mvm->hw, IEEE80211_IFACE_ITER_RESUME_ALL, in iwl_mvm_mac_ctxt_init()
258 if (WARN_ON_ONCE(test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status))) in iwl_mvm_mac_ctxt_init()
264 IWL_ERR(mvm, "Failed to init MAC context - no free ID!\n"); in iwl_mvm_mac_ctxt_init()
275 IWL_ERR(mvm, "Failed to init MAC context - no free TSF!\n"); in iwl_mvm_mac_ctxt_init()
313 static void iwl_mvm_ack_rates(struct iwl_mvm *mvm, in iwl_mvm_ack_rates() argument
326 sband = mvm->hw->wiphy->bands[band]; in iwl_mvm_ack_rates()
399 static void iwl_mvm_mac_ctxt_set_ht_flags(struct iwl_mvm *mvm, in iwl_mvm_mac_ctxt_set_ht_flags() argument
409 IWL_DEBUG_RATE(mvm, "protection mode set to %d\n", protection_mode); in iwl_mvm_mac_ctxt_set_ht_flags()
427 IWL_ERR(mvm, "Illegal protection mode %d\n", in iwl_mvm_mac_ctxt_set_ht_flags()
433 static void iwl_mvm_mac_ctxt_cmd_common(struct iwl_mvm *mvm, in iwl_mvm_mac_ctxt_cmd_common() argument
485 iwl_mvm_ack_rates(mvm, vif, chanctx ? chanctx->def.chan->band in iwl_mvm_mac_ctxt_cmd_common()
503 u8 txf = iwl_mvm_mac_ac_to_tx_fifo(mvm, i); in iwl_mvm_mac_ctxt_cmd_common()
522 IWL_DEBUG_RATE(mvm, "use_cts_prot %d, ht_operation_mode %d\n", in iwl_mvm_mac_ctxt_cmd_common()
528 iwl_mvm_mac_ctxt_set_ht_flags(mvm, vif, cmd); in iwl_mvm_mac_ctxt_cmd_common()
531 static int iwl_mvm_mac_ctxt_send_cmd(struct iwl_mvm *mvm, in iwl_mvm_mac_ctxt_send_cmd() argument
534 int ret = iwl_mvm_send_cmd_pdu(mvm, MAC_CONTEXT_CMD, 0, in iwl_mvm_mac_ctxt_send_cmd()
537 IWL_ERR(mvm, "Failed to send MAC context (action:%d): %d\n", in iwl_mvm_mac_ctxt_send_cmd()
542 static int iwl_mvm_mac_ctxt_cmd_sta(struct iwl_mvm *mvm, in iwl_mvm_mac_ctxt_cmd_sta() argument
553 iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, bssid_override, action); in iwl_mvm_mac_ctxt_cmd_sta()
605 IWL_DEBUG_INFO(mvm, "DTIM TBTT is 0x%llx/0x%x, offset %d\n", in iwl_mvm_mac_ctxt_cmd_sta()
613 fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_ctxt_cmd_sta()
630 ctxt_sta->listen_interval = cpu_to_le32(mvm->hw->conf.listen_interval); in iwl_mvm_mac_ctxt_cmd_sta()
649 return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd); in iwl_mvm_mac_ctxt_cmd_sta()
652 static int iwl_mvm_mac_ctxt_cmd_listener(struct iwl_mvm *mvm, in iwl_mvm_mac_ctxt_cmd_listener() argument
657 u32 tfd_queue_msk = BIT(mvm->snif_queue); in iwl_mvm_mac_ctxt_cmd_listener()
662 iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, NULL, action); in iwl_mvm_mac_ctxt_cmd_listener()
670 ieee80211_hw_set(mvm->hw, RX_INCLUDES_FCS); in iwl_mvm_mac_ctxt_cmd_listener()
673 ret = iwl_mvm_allocate_int_sta(mvm, &mvm->snif_sta, tfd_queue_msk, in iwl_mvm_mac_ctxt_cmd_listener()
678 return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd); in iwl_mvm_mac_ctxt_cmd_listener()
681 static int iwl_mvm_mac_ctxt_cmd_ibss(struct iwl_mvm *mvm, in iwl_mvm_mac_ctxt_cmd_ibss() argument
690 iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, NULL, action); in iwl_mvm_mac_ctxt_cmd_ibss()
702 return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd); in iwl_mvm_mac_ctxt_cmd_ibss()
719 static int iwl_mvm_mac_ctxt_cmd_p2p_device(struct iwl_mvm *mvm, in iwl_mvm_mac_ctxt_cmd_p2p_device() argument
728 iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, NULL, action); in iwl_mvm_mac_ctxt_cmd_p2p_device()
742 mvm->hw, IEEE80211_IFACE_ITER_RESUME_ALL, in iwl_mvm_mac_ctxt_cmd_p2p_device()
746 return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd); in iwl_mvm_mac_ctxt_cmd_p2p_device()
749 void iwl_mvm_mac_ctxt_set_tim(struct iwl_mvm *mvm, in iwl_mvm_mac_ctxt_set_tim() argument
770 IWL_WARN(mvm, "Unable to find TIM Element in beacon\n"); in iwl_mvm_mac_ctxt_set_tim()
815 static void iwl_mvm_mac_ctxt_set_tx(struct iwl_mvm *mvm, in iwl_mvm_mac_ctxt_set_tx() argument
833 iwl_mvm_bt_coex_tx_prio(mvm, (void *)beacon->data, info, 0) << in iwl_mvm_mac_ctxt_set_tx()
837 if (!fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_ctxt_set_tx()
839 iwl_mvm_toggle_tx_ant(mvm, &mvm->mgmt_last_antenna_idx); in iwl_mvm_mac_ctxt_set_tx()
842 cpu_to_le32(BIT(mvm->mgmt_last_antenna_idx) << in iwl_mvm_mac_ctxt_set_tx()
848 cpu_to_le32(iwl_mvm_mac80211_idx_to_hwrate(mvm->fw, rate)); in iwl_mvm_mac_ctxt_set_tx()
854 int iwl_mvm_mac_ctxt_send_beacon_cmd(struct iwl_mvm *mvm, in iwl_mvm_mac_ctxt_send_beacon_cmd() argument
870 return iwl_mvm_send_cmd(mvm, &cmd); in iwl_mvm_mac_ctxt_send_beacon_cmd()
873 static int iwl_mvm_mac_ctxt_send_beacon_v6(struct iwl_mvm *mvm, in iwl_mvm_mac_ctxt_send_beacon_v6() argument
880 iwl_mvm_mac_ctxt_set_tx(mvm, vif, beacon, &beacon_cmd.tx); in iwl_mvm_mac_ctxt_send_beacon_v6()
885 iwl_mvm_mac_ctxt_set_tim(mvm, &beacon_cmd.tim_idx, in iwl_mvm_mac_ctxt_send_beacon_v6()
889 return iwl_mvm_mac_ctxt_send_beacon_cmd(mvm, beacon, &beacon_cmd, in iwl_mvm_mac_ctxt_send_beacon_v6()
893 static int iwl_mvm_mac_ctxt_send_beacon_v7(struct iwl_mvm *mvm, in iwl_mvm_mac_ctxt_send_beacon_v7() argument
900 iwl_mvm_mac_ctxt_set_tx(mvm, vif, beacon, &beacon_cmd.tx); in iwl_mvm_mac_ctxt_send_beacon_v7()
905 iwl_mvm_mac_ctxt_set_tim(mvm, &beacon_cmd.tim_idx, in iwl_mvm_mac_ctxt_send_beacon_v7()
918 return iwl_mvm_mac_ctxt_send_beacon_cmd(mvm, beacon, &beacon_cmd, in iwl_mvm_mac_ctxt_send_beacon_v7()
922 static int iwl_mvm_mac_ctxt_send_beacon_v9(struct iwl_mvm *mvm, in iwl_mvm_mac_ctxt_send_beacon_v9() argument
933 flags = iwl_mvm_mac_ctxt_get_beacon_flags(mvm->fw, rate); in iwl_mvm_mac_ctxt_send_beacon_v9()
942 flags |= iwl_fw_lookup_cmd_ver(mvm->fw, BEACON_TEMPLATE_CMD, in iwl_mvm_mac_ctxt_send_beacon_v9()
957 iwl_mvm_mac_ctxt_set_tim(mvm, &beacon_cmd.tim_idx, in iwl_mvm_mac_ctxt_send_beacon_v9()
970 return iwl_mvm_mac_ctxt_send_beacon_cmd(mvm, beacon, &beacon_cmd, in iwl_mvm_mac_ctxt_send_beacon_v9()
974 int iwl_mvm_mac_ctxt_send_beacon(struct iwl_mvm *mvm, in iwl_mvm_mac_ctxt_send_beacon() argument
984 if (!fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_ctxt_send_beacon()
986 return iwl_mvm_mac_ctxt_send_beacon_v6(mvm, vif, beacon); in iwl_mvm_mac_ctxt_send_beacon()
988 if (fw_has_api(&mvm->fw->ucode_capa, in iwl_mvm_mac_ctxt_send_beacon()
990 return iwl_mvm_mac_ctxt_send_beacon_v9(mvm, vif, beacon); in iwl_mvm_mac_ctxt_send_beacon()
992 return iwl_mvm_mac_ctxt_send_beacon_v7(mvm, vif, beacon); in iwl_mvm_mac_ctxt_send_beacon()
996 int iwl_mvm_mac_ctxt_beacon_changed(struct iwl_mvm *mvm, in iwl_mvm_mac_ctxt_beacon_changed() argument
1005 beacon = ieee80211_beacon_get_template(mvm->hw, vif, NULL); in iwl_mvm_mac_ctxt_beacon_changed()
1010 if (mvm->beacon_inject_active) { in iwl_mvm_mac_ctxt_beacon_changed()
1016 ret = iwl_mvm_mac_ctxt_send_beacon(mvm, vif, beacon); in iwl_mvm_mac_ctxt_beacon_changed()
1022 struct iwl_mvm *mvm; member
1048 static void iwl_mvm_mac_ctxt_cmd_fill_ap(struct iwl_mvm *mvm, in iwl_mvm_mac_ctxt_cmd_fill_ap() argument
1056 .mvm = mvm, in iwl_mvm_mac_ctxt_cmd_fill_ap()
1071 if (mvmvif->ap_assoc_sta_count || !mvm->drop_bcn_ap_mode) { in iwl_mvm_mac_ctxt_cmd_fill_ap()
1073 IWL_DEBUG_HC(mvm, "Asking FW to pass beacons\n"); in iwl_mvm_mac_ctxt_cmd_fill_ap()
1075 IWL_DEBUG_HC(mvm, "No need to receive beacons\n"); in iwl_mvm_mac_ctxt_cmd_fill_ap()
1082 if (!fw_has_api(&mvm->fw->ucode_capa, in iwl_mvm_mac_ctxt_cmd_fill_ap()
1098 mvm->hw, IEEE80211_IFACE_ITER_RESUME_ALL, in iwl_mvm_mac_ctxt_cmd_fill_ap()
1107 mvmvif->ap_beacon_time = iwl_mvm_get_systime(mvm); in iwl_mvm_mac_ctxt_cmd_fill_ap()
1118 static int iwl_mvm_mac_ctxt_cmd_ap(struct iwl_mvm *mvm, in iwl_mvm_mac_ctxt_cmd_ap() argument
1127 iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, NULL, action); in iwl_mvm_mac_ctxt_cmd_ap()
1130 iwl_mvm_mac_ctxt_cmd_fill_ap(mvm, vif, &cmd, &cmd.ap, in iwl_mvm_mac_ctxt_cmd_ap()
1133 return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd); in iwl_mvm_mac_ctxt_cmd_ap()
1136 static int iwl_mvm_mac_ctxt_cmd_go(struct iwl_mvm *mvm, in iwl_mvm_mac_ctxt_cmd_go() argument
1146 iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, NULL, action); in iwl_mvm_mac_ctxt_cmd_go()
1149 iwl_mvm_mac_ctxt_cmd_fill_ap(mvm, vif, &cmd, &cmd.go.ap, in iwl_mvm_mac_ctxt_cmd_go()
1158 return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd); in iwl_mvm_mac_ctxt_cmd_go()
1161 static int iwl_mvm_mac_ctx_send(struct iwl_mvm *mvm, struct ieee80211_vif *vif, in iwl_mvm_mac_ctx_send() argument
1167 return iwl_mvm_mac_ctxt_cmd_sta(mvm, vif, action, in iwl_mvm_mac_ctx_send()
1172 return iwl_mvm_mac_ctxt_cmd_ap(mvm, vif, action); in iwl_mvm_mac_ctx_send()
1174 return iwl_mvm_mac_ctxt_cmd_go(mvm, vif, action); in iwl_mvm_mac_ctx_send()
1176 return iwl_mvm_mac_ctxt_cmd_listener(mvm, vif, action); in iwl_mvm_mac_ctx_send()
1178 return iwl_mvm_mac_ctxt_cmd_p2p_device(mvm, vif, action); in iwl_mvm_mac_ctx_send()
1180 return iwl_mvm_mac_ctxt_cmd_ibss(mvm, vif, action); in iwl_mvm_mac_ctx_send()
1188 int iwl_mvm_mac_ctxt_add(struct iwl_mvm *mvm, struct ieee80211_vif *vif) in iwl_mvm_mac_ctxt_add() argument
1197 ret = iwl_mvm_mac_ctx_send(mvm, vif, FW_CTXT_ACTION_ADD, in iwl_mvm_mac_ctxt_add()
1203 iwl_mvm_set_last_nonqos_seq(mvm, vif); in iwl_mvm_mac_ctxt_add()
1209 int iwl_mvm_mac_ctxt_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif, in iwl_mvm_mac_ctxt_changed() argument
1218 return iwl_mvm_mac_ctx_send(mvm, vif, FW_CTXT_ACTION_MODIFY, in iwl_mvm_mac_ctxt_changed()
1222 int iwl_mvm_mac_ctxt_remove(struct iwl_mvm *mvm, struct ieee80211_vif *vif) in iwl_mvm_mac_ctxt_remove() argument
1238 ret = iwl_mvm_send_cmd_pdu(mvm, MAC_CONTEXT_CMD, 0, in iwl_mvm_mac_ctxt_remove()
1241 IWL_ERR(mvm, "Failed to remove MAC context: %d\n", ret); in iwl_mvm_mac_ctxt_remove()
1248 __clear_bit(IEEE80211_HW_RX_INCLUDES_FCS, mvm->hw->flags); in iwl_mvm_mac_ctxt_remove()
1249 iwl_mvm_dealloc_snif_sta(mvm); in iwl_mvm_mac_ctxt_remove()
1255 static void iwl_mvm_csa_count_down(struct iwl_mvm *mvm, in iwl_mvm_csa_count_down() argument
1271 iwl_mvm_mac_ctxt_beacon_changed(mvm, csa_vif); in iwl_mvm_csa_count_down()
1280 iwl_mvm_schedule_csa_period(mvm, csa_vif, in iwl_mvm_csa_count_down()
1288 RCU_INIT_POINTER(mvm->csa_vif, NULL); in iwl_mvm_csa_count_down()
1292 void iwl_mvm_rx_beacon_notif(struct iwl_mvm *mvm, in iwl_mvm_rx_beacon_notif() argument
1304 lockdep_assert_held(&mvm->mutex); in iwl_mvm_rx_beacon_notif()
1306 mvm->ap_last_beacon_gp2 = le32_to_cpu(beacon->gp2); in iwl_mvm_rx_beacon_notif()
1308 if (!iwl_mvm_is_short_beacon_notif_supported(mvm)) { in iwl_mvm_rx_beacon_notif()
1315 mvm->ibss_manager = beacon_v5->ibss_mgr_status != 0; in iwl_mvm_rx_beacon_notif()
1316 agg_status = iwl_mvm_get_agg_status(mvm, beacon_notify_hdr); in iwl_mvm_rx_beacon_notif()
1318 IWL_DEBUG_RX(mvm, in iwl_mvm_rx_beacon_notif()
1322 mvm->ap_last_beacon_gp2, in iwl_mvm_rx_beacon_notif()
1328 mvm->ibss_manager = beacon->ibss_mgr_status != 0; in iwl_mvm_rx_beacon_notif()
1330 IWL_DEBUG_RX(mvm, in iwl_mvm_rx_beacon_notif()
1333 mvm->ap_last_beacon_gp2); in iwl_mvm_rx_beacon_notif()
1336 csa_vif = rcu_dereference_protected(mvm->csa_vif, in iwl_mvm_rx_beacon_notif()
1337 lockdep_is_held(&mvm->mutex)); in iwl_mvm_rx_beacon_notif()
1339 iwl_mvm_csa_count_down(mvm, csa_vif, mvm->ap_last_beacon_gp2, in iwl_mvm_rx_beacon_notif()
1342 tx_blocked_vif = rcu_dereference_protected(mvm->csa_tx_blocked_vif, in iwl_mvm_rx_beacon_notif()
1343 lockdep_is_held(&mvm->mutex)); in iwl_mvm_rx_beacon_notif()
1353 if (!mvm->csa_tx_block_bcn_timeout) in iwl_mvm_rx_beacon_notif()
1354 mvm->csa_tx_block_bcn_timeout = in iwl_mvm_rx_beacon_notif()
1357 mvm->csa_tx_block_bcn_timeout--; in iwl_mvm_rx_beacon_notif()
1360 if (mvm->csa_tx_block_bcn_timeout == 0) { in iwl_mvm_rx_beacon_notif()
1361 iwl_mvm_modify_all_sta_disable_tx(mvm, mvmvif, false); in iwl_mvm_rx_beacon_notif()
1362 RCU_INIT_POINTER(mvm->csa_tx_blocked_vif, NULL); in iwl_mvm_rx_beacon_notif()
1367 void iwl_mvm_rx_missed_beacons_notif(struct iwl_mvm *mvm, in iwl_mvm_rx_missed_beacons_notif() argument
1380 IWL_DEBUG_INFO(mvm, in iwl_mvm_rx_missed_beacons_notif()
1390 vif = iwl_mvm_rcu_dereference_vif_id(mvm, id, true); in iwl_mvm_rx_missed_beacons_notif()
1402 iwl_mvm_connection_loss(mvm, vif, "missed beacons"); in iwl_mvm_rx_missed_beacons_notif()
1406 iwl_dbg_tlv_time_point(&mvm->fwrt, in iwl_mvm_rx_missed_beacons_notif()
1409 trigger = iwl_fw_dbg_trigger_on(&mvm->fwrt, ieee80211_vif_to_wdev(vif), in iwl_mvm_rx_missed_beacons_notif()
1423 iwl_fw_dbg_collect_trig(&mvm->fwrt, trigger, NULL); in iwl_mvm_rx_missed_beacons_notif()
1429 void iwl_mvm_rx_stored_beacon_notif(struct iwl_mvm *mvm, in iwl_mvm_rx_stored_beacon_notif() argument
1439 int ver = iwl_fw_lookup_cmd_ver(mvm->fw, in iwl_mvm_rx_stored_beacon_notif()
1465 IWL_ERR(mvm, "alloc_skb failed\n"); in iwl_mvm_rx_stored_beacon_notif()
1487 ieee80211_rx_napi(mvm->hw, NULL, skb, NULL); in iwl_mvm_rx_stored_beacon_notif()
1490 void iwl_mvm_probe_resp_data_notif(struct iwl_mvm *mvm, in iwl_mvm_probe_resp_data_notif() argument
1500 IWL_DEBUG_INFO(mvm, "Probe response data notif: noa %d, csa %d\n", in iwl_mvm_probe_resp_data_notif()
1503 vif = iwl_mvm_rcu_dereference_vif_id(mvm, id, false); in iwl_mvm_probe_resp_data_notif()
1528 lockdep_is_held(&mvmvif->mvm->mutex)); in iwl_mvm_probe_resp_data_notif()
1539 void iwl_mvm_channel_switch_start_notif(struct iwl_mvm *mvm, in iwl_mvm_channel_switch_start_notif() argument
1555 vif = rcu_dereference(mvm->vif_id_to_mac[mac_id]); in iwl_mvm_channel_switch_start_notif()
1560 csa_vif = rcu_dereference(mvm->csa_vif); in iwl_mvm_channel_switch_start_notif()
1571 IWL_DEBUG_INFO(mvm, "Channel Switch Started Notification\n"); in iwl_mvm_channel_switch_start_notif()
1573 schedule_delayed_work(&mvm->cs_tx_unblock_dwork, in iwl_mvm_channel_switch_start_notif()
1581 RCU_INIT_POINTER(mvm->csa_vif, NULL); in iwl_mvm_channel_switch_start_notif()
1588 if (iwl_fw_lookup_notif_ver(mvm->fw, MAC_CONF_GROUP, in iwl_mvm_channel_switch_start_notif()
1591 IWL_DEBUG_INFO(mvm, "Channel Switch was canceled\n"); in iwl_mvm_channel_switch_start_notif()
1592 iwl_mvm_cancel_channel_switch(mvm, vif, mac_id); in iwl_mvm_channel_switch_start_notif()
1596 iwl_mvm_csa_client_absent(mvm, vif); in iwl_mvm_channel_switch_start_notif()
1609 void iwl_mvm_channel_switch_error_notif(struct iwl_mvm *mvm, in iwl_mvm_channel_switch_error_notif() argument
1619 vif = iwl_mvm_rcu_dereference_vif_id(mvm, id, true); in iwl_mvm_channel_switch_error_notif()
1625 IWL_DEBUG_INFO(mvm, "FW reports CSA error: mac_id=%u, csa_err_mask=%u\n", in iwl_mvm_channel_switch_error_notif()
1634 void iwl_mvm_rx_missed_vap_notif(struct iwl_mvm *mvm, in iwl_mvm_rx_missed_vap_notif() argument
1642 IWL_DEBUG_INFO(mvm, in iwl_mvm_rx_missed_vap_notif()
1650 vif = iwl_mvm_rcu_dereference_vif_id(mvm, id, true); in iwl_mvm_rx_missed_vap_notif()
1652 iwl_mvm_connection_loss(mvm, vif, "missed vap beacon"); in iwl_mvm_rx_missed_vap_notif()