Lines Matching refs:mvm
84 struct iwl_mvm *mvm; member
246 unsigned long iwl_mvm_get_used_hw_queues(struct iwl_mvm *mvm, in iwl_mvm_get_used_hw_queues() argument
254 BIT(mvm->aux_queue) | in iwl_mvm_get_used_hw_queues()
258 lockdep_assert_held(&mvm->mutex); in iwl_mvm_get_used_hw_queues()
262 mvm->hw, IEEE80211_IFACE_ITER_RESUME_ALL, in iwl_mvm_get_used_hw_queues()
266 ieee80211_iterate_stations_atomic(mvm->hw, in iwl_mvm_get_used_hw_queues()
274 for_each_set_bit(sta_id, mvm->sta_drained, IWL_MVM_STATION_COUNT) in iwl_mvm_get_used_hw_queues()
275 data.used_hw_queues |= mvm->tfd_drained[sta_id]; in iwl_mvm_get_used_hw_queues()
304 void iwl_mvm_mac_ctxt_recalc_tsf_id(struct iwl_mvm *mvm, in iwl_mvm_mac_ctxt_recalc_tsf_id() argument
309 .mvm = mvm, in iwl_mvm_mac_ctxt_recalc_tsf_id()
317 mvm->hw, IEEE80211_IFACE_ITER_RESUME_ALL, in iwl_mvm_mac_ctxt_recalc_tsf_id()
327 static int iwl_mvm_mac_ctxt_allocate_resources(struct iwl_mvm *mvm, in iwl_mvm_mac_ctxt_allocate_resources() argument
332 .mvm = mvm, in iwl_mvm_mac_ctxt_allocate_resources()
373 mvm->hw, IEEE80211_IFACE_ITER_RESUME_ALL, in iwl_mvm_mac_ctxt_allocate_resources()
376 used_hw_queues = iwl_mvm_get_used_hw_queues(mvm, vif); in iwl_mvm_mac_ctxt_allocate_resources()
392 if (WARN_ON_ONCE(test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status))) in iwl_mvm_mac_ctxt_allocate_resources()
398 IWL_ERR(mvm, "Failed to init MAC context - no free ID!\n"); in iwl_mvm_mac_ctxt_allocate_resources()
409 IWL_ERR(mvm, "Failed to init MAC context - no free TSF!\n"); in iwl_mvm_mac_ctxt_allocate_resources()
430 mvm->first_agg_queue); in iwl_mvm_mac_ctxt_allocate_resources()
432 if (queue >= mvm->first_agg_queue) { in iwl_mvm_mac_ctxt_allocate_resources()
433 IWL_ERR(mvm, "Failed to allocate queue\n"); in iwl_mvm_mac_ctxt_allocate_resources()
445 mvm->first_agg_queue); in iwl_mvm_mac_ctxt_allocate_resources()
447 if (queue >= mvm->first_agg_queue) { in iwl_mvm_mac_ctxt_allocate_resources()
448 IWL_ERR(mvm, "Failed to allocate cab queue\n"); in iwl_mvm_mac_ctxt_allocate_resources()
473 int iwl_mvm_mac_ctxt_init(struct iwl_mvm *mvm, struct ieee80211_vif *vif) in iwl_mvm_mac_ctxt_init() argument
476 iwl_mvm_get_wd_timeout(mvm, vif, false, false); in iwl_mvm_mac_ctxt_init()
480 lockdep_assert_held(&mvm->mutex); in iwl_mvm_mac_ctxt_init()
482 ret = iwl_mvm_mac_ctxt_allocate_resources(mvm, vif); in iwl_mvm_mac_ctxt_init()
488 iwl_mvm_enable_ac_txq(mvm, IWL_MVM_OFFCHANNEL_QUEUE, in iwl_mvm_mac_ctxt_init()
493 iwl_mvm_enable_ac_txq(mvm, vif->cab_queue, vif->cab_queue, in iwl_mvm_mac_ctxt_init()
498 iwl_mvm_enable_ac_txq(mvm, vif->hw_queue[ac], in iwl_mvm_mac_ctxt_init()
508 void iwl_mvm_mac_ctxt_release(struct iwl_mvm *mvm, struct ieee80211_vif *vif) in iwl_mvm_mac_ctxt_release() argument
512 lockdep_assert_held(&mvm->mutex); in iwl_mvm_mac_ctxt_release()
516 iwl_mvm_disable_txq(mvm, IWL_MVM_OFFCHANNEL_QUEUE, in iwl_mvm_mac_ctxt_release()
521 iwl_mvm_disable_txq(mvm, vif->cab_queue, vif->cab_queue, in iwl_mvm_mac_ctxt_release()
526 iwl_mvm_disable_txq(mvm, vif->hw_queue[ac], in iwl_mvm_mac_ctxt_release()
532 static void iwl_mvm_ack_rates(struct iwl_mvm *mvm, in iwl_mvm_ack_rates() argument
545 sband = mvm->hw->wiphy->bands[band]; in iwl_mvm_ack_rates()
618 static void iwl_mvm_mac_ctxt_set_ht_flags(struct iwl_mvm *mvm, in iwl_mvm_mac_ctxt_set_ht_flags() argument
628 IWL_DEBUG_RATE(mvm, "protection mode set to %d\n", protection_mode); in iwl_mvm_mac_ctxt_set_ht_flags()
646 IWL_ERR(mvm, "Illegal protection mode %d\n", in iwl_mvm_mac_ctxt_set_ht_flags()
652 static void iwl_mvm_mac_ctxt_cmd_common(struct iwl_mvm *mvm, in iwl_mvm_mac_ctxt_cmd_common() argument
704 iwl_mvm_ack_rates(mvm, vif, chanctx ? chanctx->def.chan->band in iwl_mvm_mac_ctxt_cmd_common()
743 IWL_DEBUG_RATE(mvm, "use_cts_prot %d, ht_operation_mode %d\n", in iwl_mvm_mac_ctxt_cmd_common()
749 iwl_mvm_mac_ctxt_set_ht_flags(mvm, vif, cmd); in iwl_mvm_mac_ctxt_cmd_common()
754 static int iwl_mvm_mac_ctxt_send_cmd(struct iwl_mvm *mvm, in iwl_mvm_mac_ctxt_send_cmd() argument
757 int ret = iwl_mvm_send_cmd_pdu(mvm, MAC_CONTEXT_CMD, 0, in iwl_mvm_mac_ctxt_send_cmd()
760 IWL_ERR(mvm, "Failed to send MAC context (action:%d): %d\n", in iwl_mvm_mac_ctxt_send_cmd()
765 static int iwl_mvm_mac_ctxt_cmd_sta(struct iwl_mvm *mvm, in iwl_mvm_mac_ctxt_cmd_sta() argument
776 iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, bssid_override, action); in iwl_mvm_mac_ctxt_cmd_sta()
819 IWL_DEBUG_INFO(mvm, "DTIM TBTT is 0x%llx/0x%x, offset %d\n", in iwl_mvm_mac_ctxt_cmd_sta()
843 ctxt_sta->listen_interval = cpu_to_le32(mvm->hw->conf.listen_interval); in iwl_mvm_mac_ctxt_cmd_sta()
849 return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd); in iwl_mvm_mac_ctxt_cmd_sta()
852 static int iwl_mvm_mac_ctxt_cmd_listener(struct iwl_mvm *mvm, in iwl_mvm_mac_ctxt_cmd_listener() argument
860 iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, NULL, action); in iwl_mvm_mac_ctxt_cmd_listener()
867 ieee80211_hw_set(mvm->hw, RX_INCLUDES_FCS); in iwl_mvm_mac_ctxt_cmd_listener()
869 return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd); in iwl_mvm_mac_ctxt_cmd_listener()
872 static int iwl_mvm_mac_ctxt_cmd_ibss(struct iwl_mvm *mvm, in iwl_mvm_mac_ctxt_cmd_ibss() argument
881 iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, NULL, action); in iwl_mvm_mac_ctxt_cmd_ibss()
894 return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd); in iwl_mvm_mac_ctxt_cmd_ibss()
911 static int iwl_mvm_mac_ctxt_cmd_p2p_device(struct iwl_mvm *mvm, in iwl_mvm_mac_ctxt_cmd_p2p_device() argument
920 iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, NULL, action); in iwl_mvm_mac_ctxt_cmd_p2p_device()
936 mvm->hw, IEEE80211_IFACE_ITER_RESUME_ALL, in iwl_mvm_mac_ctxt_cmd_p2p_device()
940 return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd); in iwl_mvm_mac_ctxt_cmd_p2p_device()
943 static void iwl_mvm_mac_ctxt_set_tim(struct iwl_mvm *mvm, in iwl_mvm_mac_ctxt_set_tim() argument
964 IWL_WARN(mvm, "Unable to find TIM Element in beacon\n"); in iwl_mvm_mac_ctxt_set_tim()
968 static int iwl_mvm_mac_ctxt_send_beacon(struct iwl_mvm *mvm, in iwl_mvm_mac_ctxt_send_beacon() argument
998 iwl_mvm_bt_coex_tx_prio(mvm, (void *)beacon->data, info, 0) << in iwl_mvm_mac_ctxt_send_beacon()
1002 mvm->mgmt_last_antenna_idx = in iwl_mvm_mac_ctxt_send_beacon()
1003 iwl_mvm_next_antenna(mvm, iwl_mvm_get_valid_tx_ant(mvm), in iwl_mvm_mac_ctxt_send_beacon()
1004 mvm->mgmt_last_antenna_idx); in iwl_mvm_mac_ctxt_send_beacon()
1007 cpu_to_le32(BIT(mvm->mgmt_last_antenna_idx) << in iwl_mvm_mac_ctxt_send_beacon()
1021 iwl_mvm_mac_ctxt_set_tim(mvm, &beacon_cmd, in iwl_mvm_mac_ctxt_send_beacon()
1033 return iwl_mvm_send_cmd(mvm, &cmd); in iwl_mvm_mac_ctxt_send_beacon()
1037 int iwl_mvm_mac_ctxt_beacon_changed(struct iwl_mvm *mvm, in iwl_mvm_mac_ctxt_beacon_changed() argument
1046 beacon = ieee80211_beacon_get_template(mvm->hw, vif, NULL); in iwl_mvm_mac_ctxt_beacon_changed()
1050 ret = iwl_mvm_mac_ctxt_send_beacon(mvm, vif, beacon); in iwl_mvm_mac_ctxt_beacon_changed()
1056 struct iwl_mvm *mvm; member
1082 static void iwl_mvm_mac_ctxt_cmd_fill_ap(struct iwl_mvm *mvm, in iwl_mvm_mac_ctxt_cmd_fill_ap() argument
1089 .mvm = mvm, in iwl_mvm_mac_ctxt_cmd_fill_ap()
1117 mvm->hw, IEEE80211_IFACE_ITER_RESUME_ALL, in iwl_mvm_mac_ctxt_cmd_fill_ap()
1127 iwl_read_prph(mvm->trans, in iwl_mvm_mac_ctxt_cmd_fill_ap()
1139 static int iwl_mvm_mac_ctxt_cmd_ap(struct iwl_mvm *mvm, in iwl_mvm_mac_ctxt_cmd_ap() argument
1149 iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, NULL, action); in iwl_mvm_mac_ctxt_cmd_ap()
1159 IWL_DEBUG_HC(mvm, "Asking FW to pass beacons\n"); in iwl_mvm_mac_ctxt_cmd_ap()
1161 IWL_DEBUG_HC(mvm, "No need to receive beacons\n"); in iwl_mvm_mac_ctxt_cmd_ap()
1165 iwl_mvm_mac_ctxt_cmd_fill_ap(mvm, vif, &cmd.ap, in iwl_mvm_mac_ctxt_cmd_ap()
1168 return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd); in iwl_mvm_mac_ctxt_cmd_ap()
1171 static int iwl_mvm_mac_ctxt_cmd_go(struct iwl_mvm *mvm, in iwl_mvm_mac_ctxt_cmd_go() argument
1181 iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, NULL, action); in iwl_mvm_mac_ctxt_cmd_go()
1191 iwl_mvm_mac_ctxt_cmd_fill_ap(mvm, vif, &cmd.go.ap, in iwl_mvm_mac_ctxt_cmd_go()
1200 return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd); in iwl_mvm_mac_ctxt_cmd_go()
1203 static int iwl_mvm_mac_ctx_send(struct iwl_mvm *mvm, struct ieee80211_vif *vif, in iwl_mvm_mac_ctx_send() argument
1209 return iwl_mvm_mac_ctxt_cmd_sta(mvm, vif, action, in iwl_mvm_mac_ctx_send()
1215 return iwl_mvm_mac_ctxt_cmd_ap(mvm, vif, action); in iwl_mvm_mac_ctx_send()
1217 return iwl_mvm_mac_ctxt_cmd_go(mvm, vif, action); in iwl_mvm_mac_ctx_send()
1220 return iwl_mvm_mac_ctxt_cmd_listener(mvm, vif, action); in iwl_mvm_mac_ctx_send()
1222 return iwl_mvm_mac_ctxt_cmd_p2p_device(mvm, vif, action); in iwl_mvm_mac_ctx_send()
1224 return iwl_mvm_mac_ctxt_cmd_ibss(mvm, vif, action); in iwl_mvm_mac_ctx_send()
1232 int iwl_mvm_mac_ctxt_add(struct iwl_mvm *mvm, struct ieee80211_vif *vif) in iwl_mvm_mac_ctxt_add() argument
1241 ret = iwl_mvm_mac_ctx_send(mvm, vif, FW_CTXT_ACTION_ADD, in iwl_mvm_mac_ctxt_add()
1247 iwl_mvm_set_last_nonqos_seq(mvm, vif); in iwl_mvm_mac_ctxt_add()
1253 int iwl_mvm_mac_ctxt_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif, in iwl_mvm_mac_ctxt_changed() argument
1262 return iwl_mvm_mac_ctx_send(mvm, vif, FW_CTXT_ACTION_MODIFY, in iwl_mvm_mac_ctxt_changed()
1266 int iwl_mvm_mac_ctxt_remove(struct iwl_mvm *mvm, struct ieee80211_vif *vif) in iwl_mvm_mac_ctxt_remove() argument
1282 ret = iwl_mvm_send_cmd_pdu(mvm, MAC_CONTEXT_CMD, 0, in iwl_mvm_mac_ctxt_remove()
1285 IWL_ERR(mvm, "Failed to remove MAC context: %d\n", ret); in iwl_mvm_mac_ctxt_remove()
1292 __clear_bit(IEEE80211_HW_RX_INCLUDES_FCS, mvm->hw->flags); in iwl_mvm_mac_ctxt_remove()
1297 static void iwl_mvm_csa_count_down(struct iwl_mvm *mvm, in iwl_mvm_csa_count_down() argument
1313 iwl_mvm_mac_ctxt_beacon_changed(mvm, csa_vif); in iwl_mvm_csa_count_down()
1322 iwl_mvm_schedule_csa_period(mvm, csa_vif, in iwl_mvm_csa_count_down()
1330 RCU_INIT_POINTER(mvm->csa_vif, NULL); in iwl_mvm_csa_count_down()
1334 void iwl_mvm_rx_beacon_notif(struct iwl_mvm *mvm, in iwl_mvm_rx_beacon_notif() argument
1344 lockdep_assert_held(&mvm->mutex); in iwl_mvm_rx_beacon_notif()
1347 mvm->ap_last_beacon_gp2 = le32_to_cpu(beacon->gp2); in iwl_mvm_rx_beacon_notif()
1350 IWL_DEBUG_RX(mvm, in iwl_mvm_rx_beacon_notif()
1354 mvm->ap_last_beacon_gp2, in iwl_mvm_rx_beacon_notif()
1357 csa_vif = rcu_dereference_protected(mvm->csa_vif, in iwl_mvm_rx_beacon_notif()
1358 lockdep_is_held(&mvm->mutex)); in iwl_mvm_rx_beacon_notif()
1360 iwl_mvm_csa_count_down(mvm, csa_vif, mvm->ap_last_beacon_gp2, in iwl_mvm_rx_beacon_notif()
1363 tx_blocked_vif = rcu_dereference_protected(mvm->csa_tx_blocked_vif, in iwl_mvm_rx_beacon_notif()
1364 lockdep_is_held(&mvm->mutex)); in iwl_mvm_rx_beacon_notif()
1374 if (!mvm->csa_tx_block_bcn_timeout) in iwl_mvm_rx_beacon_notif()
1375 mvm->csa_tx_block_bcn_timeout = in iwl_mvm_rx_beacon_notif()
1378 mvm->csa_tx_block_bcn_timeout--; in iwl_mvm_rx_beacon_notif()
1381 if (mvm->csa_tx_block_bcn_timeout == 0) { in iwl_mvm_rx_beacon_notif()
1382 iwl_mvm_modify_all_sta_disable_tx(mvm, mvmvif, false); in iwl_mvm_rx_beacon_notif()
1383 RCU_INIT_POINTER(mvm->csa_tx_blocked_vif, NULL); in iwl_mvm_rx_beacon_notif()
1393 struct iwl_mvm *mvm = mvmvif->mvm; in iwl_mvm_beacon_loss_iterator() local
1413 if (!iwl_fw_dbg_trigger_enabled(mvm->fw, in iwl_mvm_beacon_loss_iterator()
1417 trigger = iwl_fw_dbg_get_trigger(mvm->fw, in iwl_mvm_beacon_loss_iterator()
1426 if (!iwl_fw_dbg_trigger_check_stop(mvm, vif, trigger)) in iwl_mvm_beacon_loss_iterator()
1431 iwl_mvm_fw_dbg_collect_trig(mvm, trigger, NULL); in iwl_mvm_beacon_loss_iterator()
1434 void iwl_mvm_rx_missed_beacons_notif(struct iwl_mvm *mvm, in iwl_mvm_rx_missed_beacons_notif() argument
1440 IWL_DEBUG_INFO(mvm, in iwl_mvm_rx_missed_beacons_notif()
1448 ieee80211_iterate_active_interfaces_atomic(mvm->hw, in iwl_mvm_rx_missed_beacons_notif()