wifi: iwlwifi: Use phy-ctx channel load if no ies.
PATCH v2 1/2 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.
Signed-off-by Ben Greear <[email protected]>
---
v2: Skip phy contexts with zero 'ref' in 2/2 patch.
.../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
@@ -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
@@ -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
@@ -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
PATCH v2 2/2 wifi: iwlwifi: Fix survey dump for be200 radios.
From: Ben Greear <[email protected]>
The old code did not assign channel, so survey dump was always empty. Instead, return the info from the phy ctxts since we can at least fake out the channel busy time with that.
Signed-off-by Ben Greear <[email protected]>
--- .../net/wireless/intel/iwlwifi/mvm/mac80211.c | 21 +++++++++++++++++++ drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | 4 ++++ drivers/net/wireless/intel/iwlwifi/mvm/rx.c | 18 ++++++++++++++++ 3 files changed, 43 insertions(+)
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +21 -0
@@ -6063,6 +6063,27 @@ int iwl_mvm_mac_get_survey(struct ieee80211_hw *hw, int idx,memset (survey,0 ,sizeof (*survey)); +if (mvm->trans->trans_cfg->device_family ==IWL_DEVICE_FAMILY_BZ ) { +/* None of the code below this if clause appears to work +* on be200 radios, primarily because 'channel' is not assigned. +* So special case this to do something useful on be200 +* radio: Return channel and busy-time for the first 3 +* phy contexts. +*/ +if (idx >2 ) +return -ENOENT ; + +if (!mvm->phy_ctxts[idx].ref) +return 0 ; + + survey->filled =SURVEY_INFO_TIME |SURVEY_INFO_TIME_BUSY ; + survey->channel = mvm->phy_ctxts[idx].channel; + + survey->time =jiffies64_to_msecs (mvm->phy_ctxts[idx].channel_time_accum); + survey->time_busy =jiffies64_to_msecs (mvm->phy_ctxts[idx].channel_busy_accum); +return 0 ; + } +if (!fw_has_capa (&mvm->fw->ucode_capa,IWL_UCODE_TLV_CAPA_RADIO_BEACON_STATS ))return -ENOENT ;
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +4 -0
@@ -105,6 +105,10 @@ struct iwl_mvm_phy_ctxt {u32 channel_load;u32 channel_load_by_us;u32 channel_load_not_by_us; + +u64 channel_time_accum;/* in jiffies */ +u64 channel_busy_accum;/* in jiffies */ +u64 last_jiffies;/* last time we accumulated the above */ };struct iwl_mvm_time_event_data {
drivers/net/wireless/intel/iwlwifi/mvm/rx.c +18 -0
@@ -783,6 +783,8 @@ static void iwl_mvm_handle_per_phy_stats(struct iwl_mvm *mvm, struct iwl_stats_ntfy_per_phy *per_phy) {int i; +unsigned long jdiff; +u64 j = jiffies_64;for (i =0 ; i <NUM_PHY_CTX ; i++) {if (!mvm->phy_ctxts[i].ref)
@@ -793,6 +795,22 @@ static void iwl_mvm_handle_per_phy_stats(struct iwl_mvm *mvm,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); + +if (mvm->phy_ctxts[i].last_jiffies) { +if (j > mvm->phy_ctxts[i].last_jiffies) + jdiff = j - mvm->phy_ctxts[i].last_jiffies; +else +/* jiffies wrapped, just count from zero, close enough. */ + jdiff = j; + +/* We know busy percentage, back convert this to total +* time and total busy time. +*/ + mvm->phy_ctxts[i].channel_time_accum += jdiff; + mvm->phy_ctxts[i].channel_busy_accum += + (jdiff * mvm->phy_ctxts[i].channel_load) /100 ; + } + mvm->phy_ctxts[i].last_jiffies = j; } }
Signature · 1 line
2.42.0