wifi: iwlwifi: mvm: get periodic statistics in EMLSR
authorMiri Korenblit <miriam.rachel.korenblit@intel.com>
Tue, 16 Apr 2024 10:54:09 +0000 (13:54 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Fri, 19 Apr 2024 08:16:34 +0000 (10:16 +0200)
In EMLSR we need to track the RSSI of both links, and exit if the RSSI of
one of the links got too low.
For that request the FW to send statistics every 5 seconds when in EMLSR.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240416134215.6e19d596d77f.Ica2a75a031b1bced0dc2e18c5d365b5eb0d3ec07@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
drivers/net/wireless/intel/iwlwifi/mvm/utils.c

index ddf27e6d2df2059c7ceb2fa9434fef33de64f671..c631de70253d13b1abf15595b1afb6f7969c2715 100644 (file)
@@ -3987,6 +3987,10 @@ iwl_mvm_sta_state_authorized_to_assoc(struct iwl_mvm *mvm,
 
                wiphy_delayed_work_cancel(mvm->hw->wiphy,
                                          &mvmvif->prevent_esr_done_wk);
+
+               /* No need for the periodic statistics anymore */
+               if (ieee80211_vif_is_mld(vif) && mvmvif->esr_active)
+                       iwl_mvm_request_periodic_system_statistics(mvm, false);
        }
 
        return 0;
index 4016aaf91e6ec14fa0015659d79ae9f5d2b20b5a..986176d942102d8fb6c9115f981523a4ed6619ad 100644 (file)
@@ -240,6 +240,9 @@ static int iwl_mvm_esr_mode_active(struct iwl_mvm *mvm,
        else
                mvmvif->primary_link = __ffs(vif->active_links);
 
+       /* Needed for tracking RSSI */
+       iwl_mvm_request_periodic_system_statistics(mvm, true);
+
        return ret;
 }
 
@@ -283,6 +286,7 @@ __iwl_mvm_mld_assign_vif_chanctx(struct iwl_mvm *mvm,
                ret = iwl_mvm_esr_mode_active(mvm, vif);
                if (ret) {
                        IWL_ERR(mvm, "failed to activate ESR mode (%d)\n", ret);
+                       iwl_mvm_request_periodic_system_statistics(mvm, false);
                        goto out;
                }
        }
@@ -406,6 +410,8 @@ static int iwl_mvm_esr_mode_inactive(struct iwl_mvm *mvm,
                        break;
        }
 
+       iwl_mvm_request_periodic_system_statistics(mvm, false);
+
        return ret;
 }
 
index 0e0b8dae52840586df2bb7e17e20f89090d66f72..050a04c185e508b08eb81a7a4162780fc7c18b75 100644 (file)
@@ -1776,6 +1776,8 @@ void iwl_mvm_handle_rx_statistics(struct iwl_mvm *mvm,
 void iwl_mvm_rx_statistics(struct iwl_mvm *mvm,
                           struct iwl_rx_cmd_buffer *rxb);
 int iwl_mvm_request_statistics(struct iwl_mvm *mvm, bool clear);
+int iwl_mvm_request_periodic_system_statistics(struct iwl_mvm *mvm,
+                                              bool enable);
 void iwl_mvm_accu_radio_stats(struct iwl_mvm *mvm);
 
 /* NVM */
index ab56ff87c6f94ecf1d7500874595ee1590e08f94..74452b2112b0da37680a5aa6194b459af5dd0259 100644 (file)
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
 /*
- * Copyright (C) 2012-2014, 2018-2023 Intel Corporation
+ * Copyright (C) 2012-2014, 2018-2024 Intel Corporation
  * Copyright (C) 2013-2014 Intel Mobile Communications GmbH
  * Copyright (C) 2015-2017 Intel Deutschland GmbH
  */
@@ -344,6 +344,26 @@ static bool iwl_wait_stats_complete(struct iwl_notif_wait_data *notif_wait,
        return true;
 }
 
+#define PERIODIC_STAT_RATE 5
+
+int iwl_mvm_request_periodic_system_statistics(struct iwl_mvm *mvm, bool enable)
+{
+       u32 flags = enable ? 0 : IWL_STATS_CFG_FLG_DISABLE_NTFY_MSK;
+       u32 type = enable ? (IWL_STATS_NTFY_TYPE_ID_OPER |
+                            IWL_STATS_NTFY_TYPE_ID_OPER_PART1) : 0;
+       struct iwl_system_statistics_cmd system_cmd = {
+               .cfg_mask = cpu_to_le32(flags),
+               .config_time_sec = cpu_to_le32(enable ?
+                                              PERIODIC_STAT_RATE : 0),
+               .type_id_mask = cpu_to_le32(type),
+       };
+
+       return iwl_mvm_send_cmd_pdu(mvm,
+                                   WIDE_ID(SYSTEM_GROUP,
+                                           SYSTEM_STATISTICS_CMD),
+                                   0, sizeof(system_cmd), &system_cmd);
+}
+
 static int iwl_mvm_request_system_statistics(struct iwl_mvm *mvm, bool clear,
                                             u8 cmd_ver)
 {