Lines Matching defs:mvm

13 #include "mvm.h"
46 struct iwl_mvm *mvm;
184 void iwl_mvm_mac_ctxt_recalc_tsf_id(struct iwl_mvm *mvm,
189 .mvm = mvm,
197 mvm->hw, IEEE80211_IFACE_ITER_RESUME_ALL,
207 int iwl_mvm_mac_ctxt_init(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
211 .mvm = mvm,
221 lockdep_assert_held(&mvm->mutex);
242 if (!mvm->mld_api_is_used) {
256 mvm->hw, IEEE80211_IFACE_ITER_RESUME_ALL,
273 if (WARN_ON_ONCE(test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)))
279 IWL_ERR(mvm, "Failed to init MAC context - no free ID!\n");
290 IWL_ERR(mvm, "Failed to init MAC context - no free TSF!\n");
329 static void iwl_mvm_ack_rates(struct iwl_mvm *mvm,
342 sband = mvm->hw->wiphy->bands[band];
415 void iwl_mvm_set_fw_basic_rates(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
424 iwl_mvm_ack_rates(mvm, vif, chanctx ? chanctx->def.chan->band
434 void iwl_mvm_set_fw_protection_flags(struct iwl_mvm *mvm,
449 IWL_DEBUG_RATE(mvm, "use_cts_prot %d, ht_operation_mode %d\n",
456 IWL_DEBUG_RATE(mvm, "protection mode set to %d\n", protection_mode);
474 IWL_ERR(mvm, "Illegal protection mode %d\n",
480 void iwl_mvm_set_fw_qos_params(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
493 u8 txf = iwl_mvm_mac_ac_to_tx_fifo(mvm, i);
542 static void iwl_mvm_mac_ctxt_cmd_common(struct iwl_mvm *mvm,
566 iwl_mvm_set_fw_basic_rates(mvm, vif, &vif->bss_conf, &cmd->cck_rates,
578 iwl_mvm_set_fw_qos_params(mvm, vif, &vif->bss_conf, cmd->ac,
583 iwl_mvm_set_fw_protection_flags(mvm, vif, &vif->bss_conf,
588 static int iwl_mvm_mac_ctxt_send_cmd(struct iwl_mvm *mvm,
591 int ret = iwl_mvm_send_cmd_pdu(mvm, MAC_CONTEXT_CMD, 0,
594 IWL_ERR(mvm, "Failed to send MAC_CONTEXT_CMD (action:%d): %d\n",
599 void iwl_mvm_set_fw_dtim_tbtt(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
633 IWL_DEBUG_INFO(mvm, "DTIM TBTT is 0x%llx/0x%x, offset %d\n",
639 __le32 iwl_mvm_mac_ctxt_cmd_p2p_sta_get_oppps_ctwin(struct iwl_mvm *mvm,
649 u32 iwl_mvm_mac_ctxt_cmd_sta_get_twt_policy(struct iwl_mvm *mvm,
664 static int iwl_mvm_mac_ctxt_cmd_sta(struct iwl_mvm *mvm,
675 iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, bssid_override, action);
685 iwl_mvm_mac_ctxt_cmd_p2p_sta_get_oppps_ctwin(mvm, vif);
697 iwl_mvm_set_fw_dtim_tbtt(mvm, vif, &vif->bss_conf,
705 fw_has_capa(&mvm->fw->ucode_capa,
722 ctxt_sta->listen_interval = cpu_to_le32(mvm->hw->conf.listen_interval);
731 cpu_to_le32(iwl_mvm_mac_ctxt_cmd_sta_get_twt_policy(mvm, vif));
735 return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd);
738 static int iwl_mvm_mac_ctxt_cmd_listener(struct iwl_mvm *mvm,
748 iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, NULL, action);
756 ieee80211_hw_set(mvm->hw, RX_INCLUDES_FCS);
760 * mvm->snif_queue isn't set here (it's still set to
763 if (!iwl_mvm_has_new_tx_api(mvm))
764 tfd_queue_msk = BIT(mvm->snif_queue);
767 ret = iwl_mvm_allocate_int_sta(mvm, &mvm->snif_sta, tfd_queue_msk,
772 return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd);
775 static int iwl_mvm_mac_ctxt_cmd_ibss(struct iwl_mvm *mvm,
784 iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, NULL, action);
796 return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd);
813 __le32 iwl_mac_ctxt_p2p_dev_has_extended_disc(struct iwl_mvm *mvm,
827 mvm->hw, IEEE80211_IFACE_ITER_RESUME_ALL,
833 static int iwl_mvm_mac_ctxt_cmd_p2p_device(struct iwl_mvm *mvm,
841 iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, NULL, action);
844 iwl_mac_ctxt_p2p_dev_has_extended_disc(mvm, vif);
849 return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd);
852 void iwl_mvm_mac_ctxt_set_tim(struct iwl_mvm *mvm,
873 IWL_WARN(mvm, "Unable to find TIM Element in beacon\n");
894 u8 iwl_mvm_mac_ctxt_get_lowest_rate(struct iwl_mvm *mvm,
931 sband = mvm->hw->wiphy->bands[band];
973 u8 iwl_mvm_mac_ctxt_get_beacon_rate(struct iwl_mvm *mvm,
978 mvm->hw->wiphy->bands[info->band];
988 return iwl_mvm_mac_ctxt_get_lowest_rate(mvm, info, vif);
991 static void iwl_mvm_mac_ctxt_set_tx(struct iwl_mvm *mvm,
1009 iwl_mvm_bt_coex_tx_prio(mvm, (void *)beacon->data, info, 0) <<
1013 if (!fw_has_capa(&mvm->fw->ucode_capa,
1015 iwl_mvm_toggle_tx_ant(mvm, &mvm->mgmt_last_antenna_idx);
1018 cpu_to_le32(BIT(mvm->mgmt_last_antenna_idx) <<
1022 rate = iwl_mvm_mac_ctxt_get_beacon_rate(mvm, info, vif);
1025 cpu_to_le32(iwl_mvm_mac80211_idx_to_hwrate(mvm->fw, rate));
1031 int iwl_mvm_mac_ctxt_send_beacon_cmd(struct iwl_mvm *mvm,
1047 return iwl_mvm_send_cmd(mvm, &cmd);
1050 static int iwl_mvm_mac_ctxt_send_beacon_v6(struct iwl_mvm *mvm,
1057 iwl_mvm_mac_ctxt_set_tx(mvm, vif, beacon, &beacon_cmd.tx);
1062 iwl_mvm_mac_ctxt_set_tim(mvm, &beacon_cmd.tim_idx,
1066 return iwl_mvm_mac_ctxt_send_beacon_cmd(mvm, beacon, &beacon_cmd,
1070 static int iwl_mvm_mac_ctxt_send_beacon_v7(struct iwl_mvm *mvm,
1077 iwl_mvm_mac_ctxt_set_tx(mvm, vif, beacon, &beacon_cmd.tx);
1082 iwl_mvm_mac_ctxt_set_tim(mvm, &beacon_cmd.tim_idx,
1095 return iwl_mvm_mac_ctxt_send_beacon_cmd(mvm, beacon, &beacon_cmd,
1099 bool iwl_mvm_enable_fils(struct iwl_mvm *mvm,
1112 static int iwl_mvm_mac_ctxt_send_beacon_v9(struct iwl_mvm *mvm,
1120 u8 rate = iwl_mvm_mac_ctxt_get_beacon_rate(mvm, info, vif);
1124 flags = iwl_mvm_mac_ctxt_get_beacon_flags(mvm->fw, rate);
1131 if (iwl_mvm_enable_fils(mvm, ctx)) {
1132 flags |= iwl_fw_lookup_cmd_ver(mvm->fw, BEACON_TEMPLATE_CMD,
1148 if (iwl_fw_lookup_cmd_ver(mvm->fw, BEACON_TEMPLATE_CMD, 0) > 12)
1155 iwl_mvm_mac_ctxt_set_tim(mvm, &beacon_cmd.tim_idx,
1169 iwl_fw_lookup_cmd_ver(mvm->fw, BEACON_TEMPLATE_CMD, 0) >= 14)
1175 return iwl_mvm_mac_ctxt_send_beacon_cmd(mvm, beacon, &beacon_cmd,
1179 static int iwl_mvm_mac_ctxt_send_beacon(struct iwl_mvm *mvm,
1190 if (!fw_has_capa(&mvm->fw->ucode_capa,
1192 return iwl_mvm_mac_ctxt_send_beacon_v6(mvm, vif, beacon);
1194 if (fw_has_api(&mvm->fw->ucode_capa,
1196 return iwl_mvm_mac_ctxt_send_beacon_v9(mvm, vif, beacon,
1199 return iwl_mvm_mac_ctxt_send_beacon_v7(mvm, vif, beacon);
1203 int iwl_mvm_mac_ctxt_beacon_changed(struct iwl_mvm *mvm,
1213 beacon = ieee80211_beacon_get_template(mvm->hw, vif, NULL,
1219 if (mvm->beacon_inject_active) {
1225 ret = iwl_mvm_mac_ctxt_send_beacon(mvm, vif, beacon, link_conf);
1231 struct iwl_mvm *mvm;
1257 void iwl_mvm_mac_ctxt_cmd_ap_set_filter_flags(struct iwl_mvm *mvm,
1270 if (mvmvif->ap_assoc_sta_count || !mvm->drop_bcn_ap_mode) {
1272 IWL_DEBUG_HC(mvm, "Asking FW to pass beacons\n");
1274 IWL_DEBUG_HC(mvm, "No need to receive beacons\n");
1281 static void iwl_mvm_mac_ctxt_cmd_fill_ap(struct iwl_mvm *mvm,
1289 .mvm = mvm,
1297 iwl_mvm_mac_ctxt_cmd_ap_set_filter_flags(mvm, mvmvif,
1306 if (!fw_has_api(&mvm->fw->ucode_capa,
1322 mvm->hw, IEEE80211_IFACE_ITER_RESUME_ALL,
1331 mvmvif->ap_beacon_time = iwl_mvm_get_systime(mvm);
1342 static int iwl_mvm_mac_ctxt_cmd_ap(struct iwl_mvm *mvm,
1351 iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, NULL, action);
1354 iwl_mvm_mac_ctxt_cmd_fill_ap(mvm, vif, &cmd, &cmd.ap,
1357 return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd);
1360 static int iwl_mvm_mac_ctxt_cmd_go(struct iwl_mvm *mvm,
1370 iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, NULL, action);
1373 iwl_mvm_mac_ctxt_cmd_fill_ap(mvm, vif, &cmd, &cmd.go.ap,
1382 return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd);
1385 static int iwl_mvm_mac_ctx_send(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
1391 return iwl_mvm_mac_ctxt_cmd_sta(mvm, vif, action,
1396 return iwl_mvm_mac_ctxt_cmd_ap(mvm, vif, action);
1398 return iwl_mvm_mac_ctxt_cmd_go(mvm, vif, action);
1400 return iwl_mvm_mac_ctxt_cmd_listener(mvm, vif, action);
1402 return iwl_mvm_mac_ctxt_cmd_p2p_device(mvm, vif, action);
1404 return iwl_mvm_mac_ctxt_cmd_ibss(mvm, vif, action);
1412 int iwl_mvm_mac_ctxt_add(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
1421 ret = iwl_mvm_mac_ctx_send(mvm, vif, FW_CTXT_ACTION_ADD,
1427 iwl_mvm_set_last_nonqos_seq(mvm, vif);
1433 int iwl_mvm_mac_ctxt_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
1442 return iwl_mvm_mac_ctx_send(mvm, vif, FW_CTXT_ACTION_MODIFY,
1446 int iwl_mvm_mac_ctxt_remove(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
1462 ret = iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd);
1469 __clear_bit(IEEE80211_HW_RX_INCLUDES_FCS, mvm->hw->flags);
1470 iwl_mvm_dealloc_snif_sta(mvm);
1476 static void iwl_mvm_csa_count_down(struct iwl_mvm *mvm,
1492 iwl_mvm_mac_ctxt_beacon_changed(mvm, csa_vif,
1502 iwl_mvm_schedule_csa_period(mvm, csa_vif,
1510 RCU_INIT_POINTER(mvm->csa_vif, NULL);
1514 void iwl_mvm_rx_beacon_notif(struct iwl_mvm *mvm,
1526 lockdep_assert_held(&mvm->mutex);
1528 mvm->ap_last_beacon_gp2 = le32_to_cpu(beacon->gp2);
1530 if (!iwl_mvm_is_short_beacon_notif_supported(mvm)) {
1537 mvm->ibss_manager = beacon_v5->ibss_mgr_status != 0;
1538 agg_status = iwl_mvm_get_agg_status(mvm, beacon_notify_hdr);
1540 IWL_DEBUG_RX(mvm,
1544 mvm->ap_last_beacon_gp2,
1550 mvm->ibss_manager = beacon->ibss_mgr_status != 0;
1552 IWL_DEBUG_RX(mvm,
1555 mvm->ap_last_beacon_gp2);
1558 csa_vif = rcu_dereference_protected(mvm->csa_vif,
1559 lockdep_is_held(&mvm->mutex));
1561 iwl_mvm_csa_count_down(mvm, csa_vif, mvm->ap_last_beacon_gp2,
1564 tx_blocked_vif = rcu_dereference_protected(mvm->csa_tx_blocked_vif,
1565 lockdep_is_held(&mvm->mutex));
1575 if (!mvm->csa_tx_block_bcn_timeout)
1576 mvm->csa_tx_block_bcn_timeout =
1579 mvm->csa_tx_block_bcn_timeout--;
1582 if (mvm->csa_tx_block_bcn_timeout == 0) {
1583 iwl_mvm_modify_all_sta_disable_tx(mvm, mvmvif, false);
1584 RCU_INIT_POINTER(mvm->csa_tx_blocked_vif, NULL);
1589 void iwl_mvm_rx_missed_beacons_notif(struct iwl_mvm *mvm,
1604 u8 notif_ver = iwl_fw_lookup_notif_ver(mvm->fw, LEGACY_GROUP,
1610 vif = iwl_mvm_rcu_dereference_vif_id(mvm, id, false);
1613 iwl_mvm_rcu_fw_link_id_to_link_conf(mvm, id, false);
1622 IWL_DEBUG_INFO(mvm,
1636 IWL_DEBUG_INFO(mvm, "missed beacon mac_type=%u,\n", mac_type);
1638 mvm->trans->dbg.dump_file_name_ext_valid = true;
1639 snprintf(mvm->trans->dbg.dump_file_name_ext, IWL_FW_INI_MAX_NAME,
1651 iwl_mvm_connection_loss(mvm, vif, "missed beacons");
1653 IWL_WARN(mvm,
1655 IWL_WARN(mvm,
1661 iwl_mvm_exit_esr(mvm, vif, IWL_MVM_ESR_EXIT_MISSED_BEACON,
1664 if (!iwl_mvm_has_new_tx_api(mvm))
1670 iwl_dbg_tlv_time_point(&mvm->fwrt,
1673 trigger = iwl_fw_dbg_trigger_on(&mvm->fwrt, ieee80211_vif_to_wdev(vif),
1688 iwl_fw_dbg_collect_trig(&mvm->fwrt, trigger, NULL);
1690 iwl_fw_dbg_collect_trig(&mvm->fwrt, trigger, "");
1694 void iwl_mvm_rx_stored_beacon_notif(struct iwl_mvm *mvm,
1704 int ver = iwl_fw_lookup_cmd_ver(mvm->fw,
1730 IWL_ERR(mvm, "alloc_skb failed\n");
1752 ieee80211_rx_napi(mvm->hw, NULL, skb, NULL);
1755 void iwl_mvm_probe_resp_data_notif(struct iwl_mvm *mvm,
1765 IWL_DEBUG_INFO(mvm, "Probe response data notif: noa %d, csa %d\n",
1768 vif = iwl_mvm_rcu_dereference_vif_id(mvm, id, false);
1793 lockdep_is_held(&mvmvif->mvm->mutex));
1804 void iwl_mvm_channel_switch_start_notif(struct iwl_mvm *mvm,
1814 u8 notif_ver = iwl_fw_lookup_notif_ver(mvm->fw, MAC_CONF_GROUP,
1827 vif = iwl_mvm_rcu_dereference_vif_id(mvm, mac_id, true);
1837 iwl_mvm_rcu_fw_link_id_to_link_conf(mvm, link_id, true);
1854 csa_vif = rcu_dereference(mvm->csa_vif);
1866 IWL_DEBUG_INFO(mvm, "Channel Switch Started Notification\n");
1868 schedule_delayed_work(&mvm->cs_tx_unblock_dwork,
1876 RCU_INIT_POINTER(mvm->csa_vif, NULL);
1883 if (iwl_fw_lookup_notif_ver(mvm->fw, MAC_CONF_GROUP,
1886 IWL_DEBUG_INFO(mvm, "Channel Switch was canceled\n");
1887 iwl_mvm_cancel_channel_switch(mvm, vif, id);
1891 iwl_mvm_csa_client_absent(mvm, vif);
1904 void iwl_mvm_channel_switch_error_notif(struct iwl_mvm *mvm,
1914 vif = iwl_mvm_rcu_dereference_vif_id(mvm, id, true);
1920 IWL_DEBUG_INFO(mvm, "FW reports CSA error: id=%u, csa_err_mask=%u\n",
1929 void iwl_mvm_rx_missed_vap_notif(struct iwl_mvm *mvm,
1937 IWL_DEBUG_INFO(mvm,
1945 vif = iwl_mvm_rcu_dereference_vif_id(mvm, id, true);
1947 iwl_mvm_connection_loss(mvm, vif, "missed vap beacon");