wifi: iwlwifi: handle per-phy statistics from fw
authorMiri Korenblit <miriam.rachel.korenblit@intel.com>
Sun, 18 Feb 2024 17:51:51 +0000 (19:51 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 21 Feb 2024 14:19:05 +0000 (15:19 +0100)
In the operational statistics notifications (both old and new
API) the driver receives the statistics per phy.
currently this statistics wasn't handled because they wasn't needed.

Now the channel_load_by_us parameter in these statistics will be used
for the link grading calculation (implemented in another patch),
so store its value in phy_ctxt.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Link: https://msgid.link/20240218194912.e84f975b69ee.Ibbc7817135827e45adaaa47b796be165f9f1ca48@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
drivers/net/wireless/intel/iwlwifi/mvm/rx.c

index fcae5199ac90b2d77b271215048b13575c7e4dca..c85d9e460ad2e3989288c58c2b23ef67289faa5b 100644 (file)
@@ -106,6 +106,7 @@ struct iwl_mvm_phy_ctxt {
        /* track for RLC config command */
        u32 center_freq1;
        bool rlc_disabled;
+       u32 channel_load_by_us;
 };
 
 struct iwl_mvm_time_event_data {
index 72df41996464599c6b536641ff70caad38886a80..b1add7942c5bfd8aed1bd57c59fbcb23732579e7 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-2015 Intel Mobile Communications GmbH
  * Copyright (C) 2016-2017 Intel Deutschland GmbH
  */
@@ -752,6 +752,19 @@ iwl_mvm_update_tcm_from_stats(struct iwl_mvm *mvm, __le32 *air_time_le,
        spin_unlock(&mvm->tcm.lock);
 }
 
+static void iwl_mvm_handle_per_phy_stats(struct iwl_mvm *mvm,
+                                        struct iwl_stats_ntfy_per_phy *per_phy)
+{
+       int i;
+
+       for (i = 0; i < NUM_PHY_CTX; i++) {
+               if (!mvm->phy_ctxts[i].ref)
+                       continue;
+               mvm->phy_ctxts[i].channel_load_by_us =
+                       le32_to_cpu(per_phy[i].channel_load_by_us);
+       }
+}
+
 static void
 iwl_mvm_stats_ver_15(struct iwl_mvm *mvm,
                     struct iwl_statistics_operational_ntfy *stats)
@@ -766,6 +779,7 @@ iwl_mvm_stats_ver_15(struct iwl_mvm *mvm,
                                            IEEE80211_IFACE_ITER_NORMAL,
                                            iwl_mvm_stat_iterator_all_macs,
                                            &data);
+       iwl_mvm_handle_per_phy_stats(mvm, stats->per_phy);
 }
 
 static void
@@ -942,6 +956,7 @@ void iwl_mvm_handle_rx_system_oper_stats(struct iwl_mvm *mvm,
 
        ieee80211_iterate_stations_atomic(mvm->hw, iwl_mvm_stats_energy_iter,
                                          average_energy);
+       iwl_mvm_handle_per_phy_stats(mvm, stats->per_phy);
 }
 
 void iwl_mvm_handle_rx_system_oper_part1_stats(struct iwl_mvm *mvm,