Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

wifi: mac80211_hwsim: add incumbent signal interference detection support

Add a debugfs 'simulate_incumbent_signal_interference' with custom
file_operations and a .write that accepts "<freq_mhz> <bitmap>". The
handler selects the 6 GHz chanctx whose primary 20 MHz center matches
<freq_mhz> and reports the event via cfg80211_incumbent_signal_notify().
The bitmap marks affected 20 MHz segments within the current chandef
(lowest bit = lowest segment)

Signed-off-by: Aditya Kumar Singh <aditya.kumar.singh@oss.qualcomm.com>
Signed-off-by: Amith A <amith.a@oss.qualcomm.com>
Link: https://patch.msgid.link/20260306060927.504567-2-amith.a@oss.qualcomm.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

authored by

Aditya Kumar Singh and committed by
Johannes Berg
4e0417a0 35de87bf

+64
+64
drivers/net/wireless/virtual/mac80211_hwsim.c
··· 36 36 #include <linux/virtio.h> 37 37 #include <linux/virtio_ids.h> 38 38 #include <linux/virtio_config.h> 39 + #include <linux/uaccess.h> 40 + #include <linux/string.h> 39 41 #include "mac80211_hwsim.h" 40 42 41 43 #define WARN_QUEUE 100 ··· 1203 1201 .write = hwsim_background_cac_write, 1204 1202 .open = simple_open, 1205 1203 .llseek = default_llseek, 1204 + }; 1205 + 1206 + struct hwsim_chanctx_iter_arg { 1207 + struct ieee80211_chanctx_conf *conf; 1208 + u32 freq_mhz; 1209 + }; 1210 + 1211 + static void hwsim_6ghz_chanctx_iter(struct ieee80211_hw *hw, 1212 + struct ieee80211_chanctx_conf *conf, 1213 + void *data) 1214 + { 1215 + struct hwsim_chanctx_iter_arg *arg = data; 1216 + 1217 + if (conf->def.chan && 1218 + conf->def.chan->band == NL80211_BAND_6GHZ && 1219 + conf->def.chan->center_freq == arg->freq_mhz) 1220 + arg->conf = conf; 1221 + } 1222 + 1223 + static ssize_t hwsim_simulate_incumbent_signal_write(struct file *file, 1224 + const char __user *ubuf, 1225 + size_t len, loff_t *ppos) 1226 + { 1227 + struct mac80211_hwsim_data *data = file->private_data; 1228 + struct hwsim_chanctx_iter_arg arg = {}; 1229 + u32 bitmap; 1230 + char buf[64]; 1231 + 1232 + if (!len || len > sizeof(buf) - 1) 1233 + return -EINVAL; 1234 + 1235 + if (copy_from_user(buf, ubuf, len)) 1236 + return -EFAULT; 1237 + buf[len] = '\0'; 1238 + 1239 + if (sscanf(buf, "%u %i", &arg.freq_mhz, &bitmap) != 2) 1240 + return -EINVAL; 1241 + 1242 + if (!arg.freq_mhz) 1243 + return -EINVAL; 1244 + 1245 + ieee80211_iter_chan_contexts_atomic(data->hw, 1246 + hwsim_6ghz_chanctx_iter, 1247 + &arg); 1248 + 1249 + if (!arg.conf) 1250 + return -EINVAL; 1251 + 1252 + cfg80211_incumbent_signal_notify(data->hw->wiphy, 1253 + &arg.conf->def, 1254 + bitmap, 1255 + GFP_KERNEL); 1256 + 1257 + return len; 1258 + } 1259 + 1260 + static const struct file_operations hwsim_simulate_incumbent_signal_fops = { 1261 + .open = simple_open, 1262 + .write = hwsim_simulate_incumbent_signal_write, 1206 1263 }; 1207 1264 1208 1265 static int hwsim_fops_group_read(void *dat, u64 *val) ··· 6011 5950 debugfs_create_file("dfs_background_cac", 0200, 6012 5951 data->debugfs, 6013 5952 data, &hwsim_background_cac_ops); 5953 + debugfs_create_file("simulate_incumbent_signal_interference", 0200, 5954 + data->debugfs, 5955 + data, &hwsim_simulate_incumbent_signal_fops); 6014 5956 6015 5957 if (param->pmsr_capa) { 6016 5958 data->pmsr_capa = *param->pmsr_capa;