Lines Matching +full:stand +full:- +full:alone

1 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
3 * Copyright (C) 2012-2014, 2018-2019, 2021-2024 Intel Corporation
4 * Copyright (C) 2013-2014 Intel Mobile Communications GmbH
5 * Copyright (C) 2015-2017 Intel Deutschland GmbH
14 #include "iwl-debug.h"
16 #include "iwl-modparams.h"
28 le32_to_cpu(cmd->ba_enable_beacon_abort));
30 le32_to_cpu(cmd->ba_escape_timer));
32 le32_to_cpu(cmd->bf_debug_flag));
34 le32_to_cpu(cmd->bf_enable_beacon_filter));
36 le32_to_cpu(cmd->bf_energy_delta));
38 le32_to_cpu(cmd->bf_escape_timer));
40 le32_to_cpu(cmd->bf_roaming_energy_delta));
42 le32_to_cpu(cmd->bf_roaming_state));
44 le32_to_cpu(cmd->bf_temp_threshold));
46 le32_to_cpu(cmd->bf_temp_fast_filter));
48 le32_to_cpu(cmd->bf_temp_slow_filter));
50 le32_to_cpu(cmd->bf_threshold_absolute_low[0]),
51 le32_to_cpu(cmd->bf_threshold_absolute_low[1]));
54 le32_to_cpu(cmd->bf_threshold_absolute_high[0]),
55 le32_to_cpu(cmd->bf_threshold_absolute_high[1]));
57 if (fw_has_api(&mvm->fw->ucode_capa,
75 if (vif->bss_conf.cqm_rssi_thold) {
76 cmd->bf_energy_delta =
77 cpu_to_le32(vif->bss_conf.cqm_rssi_hyst);
79 cmd->bf_roaming_state =
80 cpu_to_le32(-vif->bss_conf.cqm_rssi_thold);
82 cmd->ba_enable_beacon_abort = cpu_to_le32(mvmvif->ba_enabled);
90 cmd->id_and_color, iwlmvm_mod_params.power_scheme,
91 le16_to_cpu(cmd->flags));
93 le16_to_cpu(cmd->keep_alive_seconds));
95 if (!(cmd->flags & cpu_to_le16(POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK))) {
101 le32_to_cpu(cmd->rx_data_timeout));
103 le32_to_cpu(cmd->tx_data_timeout));
104 if (cmd->flags & cpu_to_le16(POWER_FLAGS_SKIP_OVER_DTIM_MSK))
106 cmd->skip_dtim_periods);
107 if (cmd->flags & cpu_to_le16(POWER_FLAGS_LPRX_ENA_MSK))
109 cmd->lprx_rssi_threshold);
110 if (cmd->flags & cpu_to_le16(POWER_FLAGS_ADVANCE_PM_ENA_MSK)) {
113 le32_to_cpu(cmd->rx_data_timeout_uapsd));
115 le32_to_cpu(cmd->tx_data_timeout_uapsd));
116 IWL_DEBUG_POWER(mvm, "QNDP TID = %d\n", cmd->qndp_tid);
117 IWL_DEBUG_POWER(mvm, "ACs flags = 0x%x\n", cmd->uapsd_ac_flags);
118 IWL_DEBUG_POWER(mvm, "Max SP = %d\n", cmd->uapsd_max_sp);
130 if (test_bit(IWL_MVM_STATUS_IN_D3, &mvm->status) ||
131 cmd->flags & cpu_to_le16(POWER_FLAGS_SNOOZE_ENA_MSK)) {
132 cmd->rx_data_timeout_uapsd =
134 cmd->tx_data_timeout_uapsd =
137 cmd->rx_data_timeout_uapsd =
139 cmd->tx_data_timeout_uapsd =
144 /* set advanced pm flag with no uapsd ACs to enable ps-poll */
145 if (mvmvif->dbgfs_pm.use_ps_poll) {
146 cmd->flags |= cpu_to_le16(POWER_FLAGS_ADVANCE_PM_ENA_MSK);
152 if (!mvmvif->deflink.queue_params[ac].uapsd)
155 if (!test_bit(IWL_MVM_STATUS_IN_D3, &mvm->status))
156 cmd->flags |=
159 cmd->uapsd_ac_flags |= BIT(ac);
161 /* QNDP TID - the highest TID with no admission control */
162 if (!tid_found && !mvmvif->deflink.queue_params[ac].acm) {
166 cmd->qndp_tid = 6;
169 cmd->qndp_tid = 5;
172 cmd->qndp_tid = 0;
175 cmd->qndp_tid = 1;
181 cmd->flags |= cpu_to_le16(POWER_FLAGS_UAPSD_MISBEHAVING_ENA_MSK);
183 if (cmd->uapsd_ac_flags == (BIT(IEEE80211_AC_VO) |
187 cmd->flags |= cpu_to_le16(POWER_FLAGS_SNOOZE_ENA_MSK);
188 cmd->snooze_interval = cpu_to_le16(IWL_MVM_PS_SNOOZE_INTERVAL);
189 cmd->snooze_window =
190 test_bit(IWL_MVM_STATUS_IN_D3, &mvm->status) ?
195 cmd->uapsd_max_sp = mvm->hw->uapsd_max_sp_len;
197 if (cmd->flags & cpu_to_le16(POWER_FLAGS_SNOOZE_ENA_MSK)) {
198 cmd->heavy_tx_thld_packets =
200 cmd->heavy_rx_thld_packets =
203 cmd->heavy_tx_thld_packets =
205 cmd->heavy_rx_thld_packets =
208 cmd->heavy_tx_thld_percentage =
210 cmd->heavy_rx_thld_percentage =
225 iwl_mvm_vif_from_mac80211(data->current_vif);
228 if (vif == data->current_vif)
231 switch (vif->type) {
235 data->allow_uapsd = false;
241 if (vif->cfg.assoc && other_mvmvif->deflink.phy_ctxt &&
242 curr_mvmvif->deflink.phy_ctxt &&
243 other_mvmvif->deflink.phy_ctxt->id != curr_mvmvif->deflink.phy_ctxt->id)
244 data->allow_uapsd = false;
261 if (ether_addr_equal(mvmvif->uapsd_misbehaving_ap_addr,
262 vif->cfg.ap_addr))
269 if (vif->p2p &&
270 (vif->bss_conf.p2p_noa_attr.oppps_ctwindow &
274 if (vif->p2p && !iwl_mvm_is_p2p_scm_uapsd_supported(mvm))
277 ieee80211_iterate_active_interfaces_atomic(mvm->hw,
289 chanctx_conf = rcu_dereference(link_conf->chanctx_conf);
295 return chanctx_conf->def.chan->flags & IEEE80211_CHAN_RADAR;
307 cmd->skip_dtim_periods = 0;
308 cmd->flags &= ~cpu_to_le16(POWER_FLAGS_SKIP_OVER_DTIM_MSK);
310 if (!test_bit(IWL_MVM_STATUS_IN_D3, &mvm->status)) {
313 cmd->skip_dtim_periods = 2;
314 cmd->flags |= cpu_to_le16(POWER_FLAGS_SKIP_OVER_DTIM_MSK);
320 unsigned int dtimper = link_conf->dtim_period ?: 1;
321 unsigned int dtimper_tu = dtimper * link_conf->beacon_int;
342 cmd->skip_dtim_periods = min_link_skip;
343 cmd->flags |= cpu_to_le16(POWER_FLAGS_SKIP_OVER_DTIM_MSK);
355 cmd->id_and_color = cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id,
356 mvmvif->color));
357 dtimper = vif->bss_conf.dtim_period;
358 bi = vif->bss_conf.beacon_int;
369 cmd->keep_alive_seconds = cpu_to_le16(keep_alive);
371 if (mvm->ps_disabled)
374 cmd->flags |= cpu_to_le16(POWER_FLAGS_POWER_SAVE_ENA_MSK);
376 if (!vif->cfg.ps || !mvmvif->pm_enabled)
379 if (iwl_mvm_vif_low_latency(mvmvif) && vif->p2p &&
380 (!fw_has_capa(&mvm->fw->ucode_capa,
385 cmd->flags |= cpu_to_le16(POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK);
387 if (vif->bss_conf.beacon_rate &&
388 (vif->bss_conf.beacon_rate->bitrate == 10 ||
389 vif->bss_conf.beacon_rate->bitrate == 60)) {
390 cmd->flags |= cpu_to_le16(POWER_FLAGS_LPRX_ENA_MSK);
391 cmd->lprx_rssi_threshold = POWER_LPRX_RSSI_THRESHOLD;
396 if (test_bit(IWL_MVM_STATUS_IN_D3, &mvm->status)) {
397 cmd->rx_data_timeout =
399 cmd->tx_data_timeout =
401 } else if (iwl_mvm_vif_low_latency(mvmvif) && vif->p2p &&
402 fw_has_capa(&mvm->fw->ucode_capa,
404 cmd->tx_data_timeout =
406 cmd->rx_data_timeout =
409 cmd->rx_data_timeout =
411 cmd->tx_data_timeout =
419 if (mvmvif->dbgfs_pm.mask & MVM_DEBUGFS_PM_KEEP_ALIVE)
420 cmd->keep_alive_seconds =
421 cpu_to_le16(mvmvif->dbgfs_pm.keep_alive_seconds);
422 if (mvmvif->dbgfs_pm.mask & MVM_DEBUGFS_PM_SKIP_OVER_DTIM) {
423 if (mvmvif->dbgfs_pm.skip_over_dtim)
424 cmd->flags |=
427 cmd->flags &=
430 if (mvmvif->dbgfs_pm.mask & MVM_DEBUGFS_PM_RX_DATA_TIMEOUT)
431 cmd->rx_data_timeout =
432 cpu_to_le32(mvmvif->dbgfs_pm.rx_data_timeout);
433 if (mvmvif->dbgfs_pm.mask & MVM_DEBUGFS_PM_TX_DATA_TIMEOUT)
434 cmd->tx_data_timeout =
435 cpu_to_le32(mvmvif->dbgfs_pm.tx_data_timeout);
436 if (mvmvif->dbgfs_pm.mask & MVM_DEBUGFS_PM_SKIP_DTIM_PERIODS)
437 cmd->skip_dtim_periods = mvmvif->dbgfs_pm.skip_dtim_periods;
438 if (mvmvif->dbgfs_pm.mask & MVM_DEBUGFS_PM_LPRX_ENA) {
439 if (mvmvif->dbgfs_pm.lprx_ena)
440 cmd->flags |= cpu_to_le16(POWER_FLAGS_LPRX_ENA_MSK);
442 cmd->flags &= cpu_to_le16(~POWER_FLAGS_LPRX_ENA_MSK);
444 if (mvmvif->dbgfs_pm.mask & MVM_DEBUGFS_PM_LPRX_RSSI_THRESHOLD)
445 cmd->lprx_rssi_threshold = mvmvif->dbgfs_pm.lprx_rssi_threshold;
446 if (mvmvif->dbgfs_pm.mask & MVM_DEBUGFS_PM_SNOOZE_ENABLE) {
447 if (mvmvif->dbgfs_pm.snooze_ena)
448 cmd->flags |=
451 cmd->flags &=
454 if (mvmvif->dbgfs_pm.mask & MVM_DEBUGFS_PM_UAPSD_MISBEHAVING) {
456 if (mvmvif->dbgfs_pm.uapsd_misbehaving)
457 cmd->flags |= cpu_to_le16(flag);
459 cmd->flags &= cpu_to_le16(flag);
472 memcpy(&iwl_mvm_vif_from_mac80211(vif)->mac_pwr_cmd, &cmd, sizeof(cmd));
486 mvm->ps_disabled = true;
488 if (!mvm->ps_disabled)
492 if (test_bit(IWL_MVM_STATUS_IN_D3, &mvm->status) ?
493 mvm->disable_power_off_d3 : mvm->disable_power_off)
497 if (mvm->ext_clock_valid)
500 if (iwl_fw_lookup_cmd_ver(mvm->fw, POWER_TABLE_CMD, 0) >= 7 &&
501 test_bit(IWL_MVM_STATUS_IN_D3, &mvm->status))
517 if (!ether_addr_equal(mvmvif->uapsd_misbehaving_ap_addr,
518 vif->cfg.ap_addr))
519 eth_zero_addr(mvmvif->uapsd_misbehaving_ap_addr);
532 struct iwl_mvm_vif_link_info *link_info = mvmvif->link[link_id];
537 if (link_info->ap_sta_id == *ap_sta_id) {
538 ether_addr_copy(mvmvif->uapsd_misbehaving_ap_addr,
539 vif->cfg.ap_addr);
550 struct iwl_uapsd_misbehaving_ap_notif *notif = (void *)pkt->data;
551 u8 ap_sta_id = le32_to_cpu(notif->sta_id);
554 mvm->hw, IEEE80211_IFACE_ITER_NORMAL,
575 mvmvif->pm_enabled = false;
585 *disable_ps |= mvmvif->ps_disabled;
595 if (!mvmvif->uploaded)
607 WARN_ON(power_iterator->ap_vif);
608 power_iterator->ap_vif = vif;
610 power_iterator->ap_active = true;
615 WARN_ON(power_iterator->monitor_vif);
616 power_iterator->monitor_vif = vif;
618 power_iterator->monitor_active = true;
623 WARN_ON(power_iterator->p2p_vif);
624 power_iterator->p2p_vif = vif;
626 power_iterator->p2p_active = true;
630 power_iterator->bss_vif = vif;
632 power_iterator->bss_active = true;
649 lockdep_assert_held(&mvm->mutex);
652 ieee80211_iterate_active_interfaces_atomic(mvm->hw,
657 if (vifs->bss_vif)
658 bss_mvmvif = iwl_mvm_vif_from_mac80211(vifs->bss_vif);
660 if (vifs->p2p_vif)
661 p2p_mvmvif = iwl_mvm_vif_from_mac80211(vifs->p2p_vif);
663 if (vifs->ap_vif)
664 ap_mvmvif = iwl_mvm_vif_from_mac80211(vifs->ap_vif);
670 /* enable PM on bss if bss stand alone */
671 if (bss_mvmvif && vifs->bss_active && !vifs->p2p_active &&
672 !vifs->ap_active) {
673 bss_mvmvif->pm_enabled = true;
677 /* enable PM on p2p if p2p stand alone */
678 if (p2p_mvmvif && vifs->p2p_active && !vifs->bss_active &&
679 !vifs->ap_active) {
680 p2p_mvmvif->pm_enabled = true;
684 if (p2p_mvmvif && bss_mvmvif && vifs->bss_active && vifs->p2p_active)
688 if (bss_mvmvif && ap_mvmvif && vifs->bss_active && vifs->ap_active)
692 /* clients are not stand alone: enable PM if DCM */
694 if (bss_mvmvif && vifs->bss_active)
695 bss_mvmvif->pm_enabled = true;
696 if (p2p_mvmvif && vifs->p2p_active)
697 p2p_mvmvif->pm_enabled = true;
705 if (client_same_channel && !vifs->ap_active) {
707 bss_mvmvif->pm_enabled = true;
708 p2p_mvmvif->pm_enabled = true;
721 mutex_lock(&mvm->mutex);
722 memcpy(&cmd, &mvmvif->mac_pwr_cmd, sizeof(cmd));
723 mutex_unlock(&mvm->mutex);
725 pos += scnprintf(buf+pos, bufsz-pos, "power_scheme = %d\n",
727 pos += scnprintf(buf+pos, bufsz-pos, "flags = 0x%x\n",
729 pos += scnprintf(buf+pos, bufsz-pos, "keep_alive = %d\n",
735 pos += scnprintf(buf+pos, bufsz-pos, "skip_over_dtim = %d\n",
738 pos += scnprintf(buf+pos, bufsz-pos, "skip_dtim_periods = %d\n",
741 pos += scnprintf(buf+pos, bufsz-pos, "rx_data_timeout = %d\n",
743 pos += scnprintf(buf+pos, bufsz-pos, "tx_data_timeout = %d\n",
747 pos += scnprintf(buf+pos, bufsz-pos,
754 pos += scnprintf(buf+pos, bufsz-pos, "rx_data_timeout_uapsd = %d\n",
756 pos += scnprintf(buf+pos, bufsz-pos, "tx_data_timeout_uapsd = %d\n",
758 pos += scnprintf(buf+pos, bufsz-pos, "qndp_tid = %d\n", cmd.qndp_tid);
759 pos += scnprintf(buf+pos, bufsz-pos, "uapsd_ac_flags = 0x%x\n",
761 pos += scnprintf(buf+pos, bufsz-pos, "uapsd_max_sp = %d\n",
763 pos += scnprintf(buf+pos, bufsz-pos, "heavy_tx_thld_packets = %d\n",
765 pos += scnprintf(buf+pos, bufsz-pos, "heavy_rx_thld_packets = %d\n",
767 pos += scnprintf(buf+pos, bufsz-pos, "heavy_tx_thld_percentage = %d\n",
769 pos += scnprintf(buf+pos, bufsz-pos, "heavy_rx_thld_percentage = %d\n",
771 pos += scnprintf(buf+pos, bufsz-pos, "uapsd_misbehaving_enable = %d\n",
779 pos += scnprintf(buf+pos, bufsz-pos, "snooze_interval = %d\n",
781 pos += scnprintf(buf+pos, bufsz-pos, "snooze_window = %d\n",
792 struct iwl_dbgfs_bf *dbgfs_bf = &mvmvif->dbgfs_bf;
794 if (dbgfs_bf->mask & MVM_DEBUGFS_BF_ENERGY_DELTA)
795 cmd->bf_energy_delta = cpu_to_le32(dbgfs_bf->bf_energy_delta);
796 if (dbgfs_bf->mask & MVM_DEBUGFS_BF_ROAMING_ENERGY_DELTA)
797 cmd->bf_roaming_energy_delta =
798 cpu_to_le32(dbgfs_bf->bf_roaming_energy_delta);
799 if (dbgfs_bf->mask & MVM_DEBUGFS_BF_ROAMING_STATE)
800 cmd->bf_roaming_state = cpu_to_le32(dbgfs_bf->bf_roaming_state);
801 if (dbgfs_bf->mask & MVM_DEBUGFS_BF_TEMP_THRESHOLD)
802 cmd->bf_temp_threshold =
803 cpu_to_le32(dbgfs_bf->bf_temp_threshold);
804 if (dbgfs_bf->mask & MVM_DEBUGFS_BF_TEMP_FAST_FILTER)
805 cmd->bf_temp_fast_filter =
806 cpu_to_le32(dbgfs_bf->bf_temp_fast_filter);
807 if (dbgfs_bf->mask & MVM_DEBUGFS_BF_TEMP_SLOW_FILTER)
808 cmd->bf_temp_slow_filter =
809 cpu_to_le32(dbgfs_bf->bf_temp_slow_filter);
810 if (dbgfs_bf->mask & MVM_DEBUGFS_BF_DEBUG_FLAG)
811 cmd->bf_debug_flag = cpu_to_le32(dbgfs_bf->bf_debug_flag);
812 if (dbgfs_bf->mask & MVM_DEBUGFS_BF_ESCAPE_TIMER)
813 cmd->bf_escape_timer = cpu_to_le32(dbgfs_bf->bf_escape_timer);
814 if (dbgfs_bf->mask & MVM_DEBUGFS_BA_ESCAPE_TIMER)
815 cmd->ba_escape_timer = cpu_to_le32(dbgfs_bf->ba_escape_timer);
816 if (dbgfs_bf->mask & MVM_DEBUGFS_BA_ENABLE_BEACON_ABORT)
817 cmd->ba_enable_beacon_abort =
818 cpu_to_le32(dbgfs_bf->ba_enable_beacon_abort);
829 if (mvmvif != mvm->bf_allowed_vif || !vif->bss_conf.dtim_period ||
830 vif->type != NL80211_IFTYPE_STATION || vif->p2p)
838 mvmvif->bf_enabled = true;
861 if (vif->type != NL80211_IFTYPE_STATION || vif->p2p)
867 mvmvif->bf_enabled = false;
886 ieee80211_iterate_active_interfaces_atomic(mvm->hw,
892 if (mvm->ps_disabled != disable_ps) {
893 bool old_ps_disabled = mvm->ps_disabled;
895 mvm->ps_disabled = disable_ps;
898 mvm->ps_disabled = old_ps_disabled;
915 if (!mvmvif->bf_enabled)
918 if (test_bit(IWL_MVM_STATUS_IN_D3, &mvm->status))
921 mvmvif->ba_enabled = !(!mvmvif->pm_enabled ||
922 mvm->ps_disabled ||
923 !vif->cfg.ps ||
936 lockdep_assert_held(&mvm->mutex);
939 ieee80211_iterate_active_interfaces_atomic(mvm->hw,
960 lockdep_assert_held(&mvm->mutex);
963 ieee80211_iterate_active_interfaces_atomic(mvm->hw,