Skip to contentSkip to conversation

wifi: iwlwifi: Use phy-ctx channel load if no ies.

PATCH Superseded [email protected] 1 participant 1 message Dec 11, 2024 Intel wireless wifi link (iwlwifi)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wifi: iwlwifi: Use phy-ctx channel load if no ies.

From: Ben Greear <[email protected]>

In case there are no IEs found that report channel load, use channel load reported by the radio firmware.

Save related information and display it in debugfs to better understand what is happening.

Improve debugging in related code.

---
 .../net/wireless/intel/iwlwifi/mvm/debugfs.c  |  43 +++++++
 drivers/net/wireless/intel/iwlwifi/mvm/link.c | 116 +++++++++++-------
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h  |  23 ++--
 drivers/net/wireless/intel/iwlwifi/mvm/rx.c   |   4 +
 4 files changed, 135 insertions(+), 51 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c +43 -0
index 91ca830a7b60..23797b1329aa 100644
@@ -1062,6 +1062,49 @@ static ssize_t iwl_dbgfs_fw_system_stats_read(struct file *file,
 			 "accu_radio_stats.tx_time %lld\n",
 			 mvm->accu_radio_stats.tx_time);
 
+	pos += scnprintf(pos, endpos - pos,
+			 "mvmvif.esr_disable_reason: 0x%x\n",
+			 mvmvif->esr_disable_reason);
+	pos += scnprintf(pos, endpos - pos,
+			 "mvmvif.link_selection_res: 0x%x\n",
+			 mvmvif->link_selection_res);
+	pos += scnprintf(pos, endpos - pos,
+			 "mvmvif.primary_link: %d\n",
+			 mvmvif->primary_link);
+	pos += scnprintf(pos, endpos - pos,
+			 "mvmvif.link_selection_primary: %d\n",
+			 mvmvif->link_selection_primary);
+	pos += scnprintf(pos, endpos - pos,
+			 "mvmvif.last_esr_exit: ts: %lu  reason: 0x%x\n",
+			 mvmvif->last_esr_exit.ts, mvmvif->last_esr_exit.reason);
+	pos += scnprintf(pos, endpos - pos,
+			 "mvmvif.esr_active: %d\n",
+			 mvmvif->esr_active);
+	pos += scnprintf(pos, endpos - pos,
+			 "mvmvif.esr_active: %d\n",
+			 mvmvif->esr_active);
+	for (i = 0; i < IEEE80211_MLD_MAX_NUM_LINKS; i++) {
+		struct iwl_mvm_link_sel_data *d = &mvm->link_sel_data[i];
+
+		if (d->link_id == -1 || !d->chandef)
+			continue;
+
+		pos += scnprintf(pos, endpos - pos,
+				 "link-sel-data[%d] link-id: %d freq: %d signal: %d grade: %d  chan-load: %d  load-by-us: %d punc-penalty: %d\n",
+				 i, d->link_id, d->center_freq1, d->signal, d->grade,
+				 d->chan_load, d->channel_load_by_us,
+				 d->puncturing_penalty);
+	}
+	for (i = 0; i < NUM_PHY_CTX; i++) {
+		if (!mvm->phy_ctxts[i].ref)
+			continue;
+		pos += scnprintf(pos, endpos - pos,
+				 "phy-ctxtx[%d] channel-load: %d  load-by-us: %d  not-by-us: %d\n",
+				 i, mvm->phy_ctxts[i].channel_load,
+				 mvm->phy_ctxts[i].channel_load_by_us,
+				 mvm->phy_ctxts[i].channel_load_not_by_us);
+	}
+
 release_send_out:
 	mutex_unlock(&mvm->mutex);
 
drivers/net/wireless/intel/iwlwifi/mvm/link.c +72 -44

254 lines not on this page · raw message

drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +16 -7
index 2ad615293c75..751d2c2bf541 100644
@@ -102,7 +102,9 @@ struct iwl_mvm_phy_ctxt {
 	/* track for RLC config command */
 	u32 center_freq1;
 	bool rlc_disabled;
+	u32 channel_load;
 	u32 channel_load_by_us;
+	u32 channel_load_not_by_us;
 };
 
 struct iwl_mvm_time_event_data {
@@ -992,6 +994,18 @@ struct iwl_mvm_acs_survey {
 	struct iwl_mvm_acs_survey_channel channels[] __counted_by(n_channels);
 };
 
+struct iwl_mvm_link_sel_data {
+	u8 link_id;
+	const struct cfg80211_chan_def *chandef;
+	/* so we don't have to reference maybe stale chandef in debugfs */
+	u32 center_freq1;
+	s32 signal;
+	u16 grade;
+	u16 chan_load; /* reported by AP BSS Load IE */
+	u16 channel_load_by_us; /* reported by firmware */
+	u16 puncturing_penalty; /* driver calculates */
+};
+
 struct iwl_mvm {
 	/* for logger access */
 	struct device *dev;
@@ -1174,6 +1188,8 @@ struct iwl_mvm {
 
 	struct ieee80211_bss_conf __rcu *link_id_to_link_conf[IWL_FW_MAX_LINK_ID + 1];
 
+	struct iwl_mvm_link_sel_data link_sel_data[IEEE80211_MLD_MAX_NUM_LINKS];
+
 	/* -1 for always, 0 for never, >0 for that many times */
 	s8 fw_restart;
 	u8 *error_recovery_buf;
@@ -2124,13 +2140,6 @@ void iwl_mvm_select_links(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
 u8 iwl_mvm_get_primary_link(struct ieee80211_vif *vif);
 u8 iwl_mvm_get_other_link(struct ieee80211_vif *vif, u8 link_id);
 
-struct iwl_mvm_link_sel_data {
-	u8 link_id;
-	const struct cfg80211_chan_def *chandef;
-	s32 signal;
-	u16 grade;
-};
-
 #if IS_ENABLED(CONFIG_IWLWIFI_KUNIT_TESTS)
 unsigned int iwl_mvm_get_link_grade(struct ieee80211_bss_conf *link_conf);
 bool iwl_mvm_mld_valid_link_pair(struct ieee80211_vif *vif,
drivers/net/wireless/intel/iwlwifi/mvm/rx.c +4 -0
index 9e72db9bab40..7f285ee49097 100644
@@ -787,8 +787,12 @@ static void iwl_mvm_handle_per_phy_stats(struct iwl_mvm *mvm,
 	for (i = 0; i < NUM_PHY_CTX; i++) {
 		if (!mvm->phy_ctxts[i].ref)
 			continue;
+		mvm->phy_ctxts[i].channel_load =
+			le32_to_cpu(per_phy[i].channel_load);
 		mvm->phy_ctxts[i].channel_load_by_us =
 			le32_to_cpu(per_phy[i].channel_load_by_us);
+		mvm->phy_ctxts[i].channel_load_not_by_us =
+			le32_to_cpu(per_phy[i].channel_load_not_by_us);
 	}
 }
 
Signature · 1 line
2.42.0