wifi: cfg80211/mac80211: add support to handle incumbent signal detected event
Subsystems (2)
v6 cover wifi: cfg80211/mac80211: add support to handle incumbent signal detected event
This patch series adds support to handle incumbent signal interference detected event in 6 GHz band. When an incumbent signal is detected by an AP/mesh interface operating in 6 GHz band, the AP/mesh is expected to vacate the channels affected by it.
Driver is expected to call the newly introduced API with required information to notify the interference detection. This information will be ultimately sent to user space via NL802111 command. User space is expected to process it and take further action - vacate the channel, or reduce the bandwidth.
Aditya Kumar Singh (1):
wifi: mac80211_hwsim: add incumbent signal interference detection
support
---
Changes in v6:
- Simplified chanctx iterator plumbing, tightened input length validation replaced strsep/kstrtou32 parsing with sscanf and collapsed local variables to reduce complexity.
- Removed patch "wifi: cfg80211: add support to handle incumbent signal detected event from mac80211/driver" from the series as it got accepted.
Changes in v5:
- Made chandef const in cfg80211_incumbent_signal_notify()
- Removed mac80211 wrapper ieee80211_incumbent_signal_detected(). Driver/hwsim calls cfg80211 notify directly.
- In mac80211_hwsim, switched debugfs to custom fops with .write that accepts “freq_mhz bitmap”. Now 6 GHz chanctx is selected by primary 20 MHz center.
Changes in v4:
- Restored gfp_t in cfg80211_incumbent_signal_notify().
- Dropped incumbt_sig_intf_bmap from ieee80211_chanctx_conf and passed bitmap directly.
- Updated trace/call path: api_incumbent_signal_detected() to take bitmap
- Simplified hwsim: removed helper struct.
Changes in v3:
- Removed the workqueue mechanism in ieee80211_incumbent_signal_detected(), exported the cfg80211_ function that sends the NL80211 command and called it from ieee80211_incumbent_signal_detected() directly.
- Renamed nl80211_incumbent_signal_notify() to cfg80211_incumbent_signal_notify() and removed the gfp argument from it.
Changes in v2:
- Updated the kernel doc of NL80211_ATTR_INCUMBENT_SIGNAL_INTERFERENCE_BITMAP to include details of how it interacts with puncturing.
- Rebased on ToT
--- drivers/net/wireless/virtual/mac80211_hwsim.c | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+)
base-commit: 5d048bbed1bb2bbef612dad0bb9c177c434e63a4
Signature · 1 line
2.34.1
PATCH v6 1/1 wifi: mac80211_hwsim: add incumbent signal interference detection support
From: Aditya Kumar Singh <[email protected]>
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)
--- drivers/net/wireless/virtual/mac80211_hwsim.c | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+)
drivers/net/wireless/virtual/mac80211_hwsim.c +64 -0
@@ -36,6 +36,8 @@#include <linux/virtio.h> #include <linux/virtio_ids.h> #include <linux/virtio_config.h> +#include <linux/uaccess.h> +#include <linux/string.h> #include "mac80211_hwsim.h" #define WARN_QUEUE 100
@@ -1201,6 +1203,65 @@ static const struct file_operations hwsim_background_cac_ops = { .llseek = default_llseek, }; +struct hwsim_chanctx_iter_arg { +struct ieee80211_chanctx_conf *conf; +u32 freq_mhz; +}; + +static void hwsim_6ghz_chanctx_iter (struct ieee80211_hw *hw, +struct ieee80211_chanctx_conf *conf, +void *data) +{ +struct hwsim_chanctx_iter_arg *arg = data; + +if (conf->def.chan && + conf->def.chan->band ==NL80211_BAND_6GHZ && + conf->def.chan->center_freq == arg->freq_mhz) + arg->conf = conf; +} + +static ssize_t hwsim_simulate_incumbent_signal_write (struct file *file, +const char __user *ubuf, +size_t len,loff_t *ppos) +{ +struct mac80211_hwsim_data *data = file->private_data; +struct hwsim_chanctx_iter_arg arg = {}; +u32 bitmap; +char buf[64 ]; + +if (!len || len >sizeof (buf) -1 ) +return -EINVAL ; + +if (copy_from_user (buf, ubuf, len)) +return -EFAULT ; + buf[len] ='\0' ; + +if (sscanf (buf,"%u %i" , &arg.freq_mhz, &bitmap) !=2 ) +return -EINVAL ; + +if (!arg.freq_mhz) +return -EINVAL ; + +ieee80211_iter_chan_contexts_atomic (data->hw, + hwsim_6ghz_chanctx_iter, + &arg); + +if (!arg.conf) +return -EINVAL ; + +cfg80211_incumbent_signal_notify (data->hw->wiphy, + &arg.conf->def, + bitmap, +GFP_KERNEL ); + +return len; +} + +static const struct file_operations hwsim_simulate_incumbent_signal_fops = { + .open = simple_open, + .write = hwsim_simulate_incumbent_signal_write, +}; +static int hwsim_fops_group_read (void *dat,u64 *val) {struct mac80211_hwsim_data *data = dat;
@@ -5948,6 +6009,9 @@ static int mac80211_hwsim_new_radio(struct genl_info *info,debugfs_create_file ("dfs_background_cac" ,0200 , data->debugfs, data, &hwsim_background_cac_ops); +debugfs_create_file ("simulate_incumbent_signal_interference" ,0200 , + data->debugfs, + data, &hwsim_simulate_incumbent_signal_fops);if (param->pmsr_capa) { data->pmsr_capa = *param->pmsr_capa;
Signature · 1 line
2.34.1