public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
From: Amith A <amith.a@oss.qualcomm.com>
To: johannes@sipsolutions.net
Cc: linux-wireless@vger.kernel.org, amith.a@oss.qualcomm.com,
	Aditya Kumar Singh <aditya.kumar.singh@oss.qualcomm.com>
Subject: [PATCH wireless-next v4 3/3] wifi: mac80211_hwsim: add incumbent signal interference detection support
Date: Thu,  5 Feb 2026 16:51:46 +0530	[thread overview]
Message-ID: <20260205112146.3997044-4-amith.a@oss.qualcomm.com> (raw)
In-Reply-To: <20260205112146.3997044-1-amith.a@oss.qualcomm.com>

From: Aditya Kumar Singh <aditya.kumar.singh@oss.qualcomm.com>

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 <aditya.kumar.singh@oss.qualcomm.com>
Signed-off-by: Amith A <amith.a@oss.qualcomm.com>
---
 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


  parent reply	other threads:[~2026-02-05 11:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-05 11:21 [PATCH wireless-next v4 0/3] wifi: cfg80211/mac80211: add support to handle incumbent signal detected event Amith A
2026-02-05 11:21 ` [PATCH wireless-next v4 1/3] wifi: cfg80211: add support to handle incumbent signal detected event from mac80211/driver Amith A
2026-02-05 12:22   ` Johannes Berg
2026-02-10 10:31     ` Amith A
2026-02-05 11:21 ` [PATCH wireless-next v4 2/3] wifi: mac80211: add support to handle incumbent signal detected event from driver Amith A
2026-02-05 12:21   ` Johannes Berg
2026-02-10 10:33     ` Amith A
2026-02-05 11:21 ` Amith A [this message]
2026-02-05 12:24   ` [PATCH wireless-next v4 3/3] wifi: mac80211_hwsim: add incumbent signal interference detection support Johannes Berg
2026-02-10 10:36     ` Amith A
2026-02-10 10:36       ` Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260205112146.3997044-4-amith.a@oss.qualcomm.com \
    --to=amith.a@oss.qualcomm.com \
    --cc=aditya.kumar.singh@oss.qualcomm.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox