From: Aditya Kumar Singh Add a debugfs 'simulate_incumbent_signal_interference' which calls the function ieee80211_incumbent_signal_detected() to report that incumbent signal interference has been detected on the current 6 GHz operating channel. The written value is a bitmap of affected 20 MHz segments. Signed-off-by: Aditya Kumar Singh Signed-off-by: Amith A --- drivers/net/wireless/virtual/mac80211_hwsim.c | 33 +++++++++++++++++++ drivers/net/wireless/virtual/mac80211_hwsim.h | 2 ++ 2 files changed, 35 insertions(+) diff --git a/drivers/net/wireless/virtual/mac80211_hwsim.c b/drivers/net/wireless/virtual/mac80211_hwsim.c index 4d9f5f87e814..f1105f97504b 100644 --- a/drivers/net/wireless/virtual/mac80211_hwsim.c +++ b/drivers/net/wireless/virtual/mac80211_hwsim.c @@ -1164,6 +1164,36 @@ static int hwsim_write_simulate_radar(void *dat, u64 val) DEFINE_DEBUGFS_ATTRIBUTE(hwsim_simulate_radar, NULL, hwsim_write_simulate_radar, "%llu\n"); +static void hwsim_6ghz_chanctx_iter(struct ieee80211_hw *hw, + struct ieee80211_chanctx_conf *conf, + void *data) +{ + struct ieee80211_chanctx_conf **out = data; + + if (conf->def.chan && conf->def.chan->band == NL80211_BAND_6GHZ) + *out = conf; +} + +static int hwsim_write_simulate_incumbent_signal(void *dat, u64 val) +{ + struct mac80211_hwsim_data *data = dat; + struct ieee80211_chanctx_conf *chanctx_conf = NULL; + + ieee80211_iter_chan_contexts_atomic(data->hw, + hwsim_6ghz_chanctx_iter, + &chanctx_conf); + + if (!chanctx_conf) + return -EINVAL; + + ieee80211_incumbent_signal_detected(data->hw, chanctx_conf, (u32)val); + + return 0; +} + +DEFINE_DEBUGFS_ATTRIBUTE(hwsim_simulate_incumbent_signal, NULL, + hwsim_write_simulate_incumbent_signal, "%llu\n"); + static int hwsim_fops_group_read(void *dat, u64 *val) { struct mac80211_hwsim_data *data = dat; @@ -5832,6 +5862,9 @@ static int mac80211_hwsim_new_radio(struct genl_info *info, debugfs_create_file("dfs_simulate_radar", 0222, data->debugfs, data, &hwsim_simulate_radar); + debugfs_create_file("simulate_incumbent_signal_interference", 0200, + data->debugfs, + data, &hwsim_simulate_incumbent_signal); if (param->pmsr_capa) { data->pmsr_capa = *param->pmsr_capa; diff --git a/drivers/net/wireless/virtual/mac80211_hwsim.h b/drivers/net/wireless/virtual/mac80211_hwsim.h index c2d06cf852a5..d897aa720ec2 100644 --- a/drivers/net/wireless/virtual/mac80211_hwsim.h +++ b/drivers/net/wireless/virtual/mac80211_hwsim.h @@ -343,4 +343,6 @@ enum hwsim_rate_info_attributes { HWSIM_RATE_INFO_ATTR_MAX = NUM_HWSIM_RATE_INFO_ATTRS - 1 }; +/* no longer used - previously used for debugfs iterator */ + #endif /* __MAC80211_HWSIM_H */ -- 2.34.1