mac80211: refactor virtual monitor code
Use cfg80211 the new .set_monitor_enabled instead
of tracking it inside mac80211.
Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 0f02c8b..ea4b1ea 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -2990,6 +2990,16 @@
return local->oper_channel;
}
+static void ieee80211_set_monitor_enabled(struct wiphy *wiphy, bool enabled)
+{
+ struct ieee80211_local *local = wiphy_priv(wiphy);
+
+ if (enabled)
+ WARN_ON(ieee80211_add_virtual_monitor(local));
+ else
+ ieee80211_del_virtual_monitor(local);
+}
+
#ifdef CONFIG_PM
static void ieee80211_set_wakeup(struct wiphy *wiphy, bool enabled)
{
@@ -3065,6 +3075,7 @@
.probe_client = ieee80211_probe_client,
.get_channel = ieee80211_wiphy_get_channel,
.set_noack_map = ieee80211_set_noack_map,
+ .set_monitor_enabled = ieee80211_set_monitor_enabled,
#ifdef CONFIG_PM
.set_wakeup = ieee80211_set_wakeup,
#endif