@@ -4135,6 +4135,16 @@ void cfg80211_cac_event(struct net_device *netdev,
struct cfg80211_chan_def *chandef,
enum nl80211_radar_event event, gfp_t gfp);
+/**
+ * cfg80211_leave_dfs_channel - Leaving dfs channel
+ * @wiphy: the wiphy
+ * @chandef: chandef for the current channel
+ *
+ * This function is called when dfs channel is being not used for diffrent
+ * reasons. Make channel DFS USABLE again.
+ */
+void cfg80211_leave_dfs_channel(struct wiphy *wiphy,
+ struct cfg80211_chan_def *chandef);
/**
* cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer
@@ -1096,6 +1096,12 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev)
cfg80211_cac_event(sdata->dev, &chandef,
NL80211_RADAR_CAC_ABORTED,
GFP_KERNEL);
+ } else if (sdata->radar_required) {
+ /*
+ * AP stopped on DFS channel so change that channel state
+ * to NL80211_DFS_USABLE again.
+ */
+ cfg80211_leave_dfs_channel(wiphy, &sdata->vif.bss_conf.chandef);
}
drv_stop_ap(sdata->local, sdata);
@@ -797,3 +797,10 @@ void cfg80211_cac_event(struct net_device *netdev,
nl80211_radar_notify(rdev, chandef, event, netdev, gfp);
}
EXPORT_SYMBOL(cfg80211_cac_event);
+
+void cfg80211_leave_dfs_channel(struct wiphy *wiphy,
+ struct cfg80211_chan_def *chandef)
+{
+ cfg80211_set_dfs_state(wiphy, chandef, NL80211_DFS_USABLE);
+}
+EXPORT_SYMBOL(cfg80211_leave_dfs_channel);