Search Linux Wireless

[PATCHv5 5/8] mac80211: check radar interaction with scan and roc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Scanning and remain on channel functionality must be disabled while
doing radar detection/scanning, and vice versa.

Signed-off-by: Simon Wunderlich <siwu@xxxxxxxxxxxxxxxxxx>
---
 net/mac80211/cfg.c         |   12 ++++++++++--
 net/mac80211/ieee80211_i.h |    3 +++
 net/mac80211/scan.c        |    3 +++
 3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index a9de035..9c190c5 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1019,6 +1019,7 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev)
 	skb_queue_purge(&sdata->u.ap.ps.bc_buf);
 
 	ieee80211_vif_release_channel(sdata);
+	local->radar_detect_enabled = false;
 
 	return 0;
 }
@@ -2301,7 +2302,9 @@ static int ieee80211_start_roc_work(struct ieee80211_local *local,
 	INIT_LIST_HEAD(&roc->dependents);
 
 	/* if there's one pending or we're scanning, queue this one */
-	if (!list_empty(&local->roc_list) || local->scanning)
+	if (!list_empty(&local->roc_list) ||
+	    local->scanning ||
+	    local->radar_detect_enabled)
 		goto out_check_combine;
 
 	/* if not HW assist, just queue & schedule work */
@@ -2562,6 +2565,9 @@ static int ieee80211_start_radar_detection(struct wiphy *wiphy,
 	if (!local->ops->start_radar_detection)
 		return -EOPNOTSUPP;
 
+	if (!list_empty(&local->roc_list) || local->scanning)
+		return -EBUSY;
+
 	/* whatever, but channel contexts should not complain about that one */
 	sdata->smps_mode = IEEE80211_SMPS_OFF;
 	sdata->needed_rx_chains = sdata->local->rx_chains;
@@ -2572,8 +2578,10 @@ static int ieee80211_start_radar_detection(struct wiphy *wiphy,
 		return -EBUSY;
 
 	res = drv_start_radar_detection(local, sdata, chandef->chan);
-	if (!res)
+	if (!res) {
+		local->radar_detect_enabled = true;
 		ieee80211_vif_release_channel(sdata);
+	}
 
 	return res;
 }
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 42d0d02..abb2759 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -962,6 +962,9 @@ struct ieee80211_local {
 	/* wowlan is enabled -- don't reconfig on resume */
 	bool wowlan;
 
+	/* DFS/radar detection is enabled */
+	bool radar_detect_enabled;
+
 	/* number of RX chains the hardware has */
 	u8 rx_chains;
 
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
index 8ed83dc..c058749 100644
--- a/net/mac80211/scan.c
+++ b/net/mac80211/scan.c
@@ -369,6 +369,9 @@ static int ieee80211_start_sw_scan(struct ieee80211_local *local)
 static bool ieee80211_can_scan(struct ieee80211_local *local,
 			       struct ieee80211_sub_if_data *sdata)
 {
+	if (local->radar_detect_enabled)
+		return false;
+
 	if (!list_empty(&local->roc_list))
 		return false;
 
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux