cfg80211: track monitor channel
authorMichal Kazior <michal.kazior@tieto.com>
Fri, 29 Jun 2012 10:47:04 +0000 (12:47 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Fri, 29 Jun 2012 11:39:17 +0000 (13:39 +0200)
Make it even more obvious we support single
monitor channel. This will allow us to remove
.get_channel.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/wireless/chan.c
net/wireless/core.c
net/wireless/core.h

index 019401b0b5e3029a994ed70233b276f8cbc4a6ef..434c56b92c3c1ea458a2e2f1a97f5e9d964fdfaf 100644 (file)
@@ -82,6 +82,7 @@ int cfg80211_set_monitor_channel(struct cfg80211_registered_device *rdev,
                                 int freq, enum nl80211_channel_type chantype)
 {
        struct ieee80211_channel *chan;
+       int err;
 
        if (!rdev->ops->set_monitor_channel)
                return -EOPNOTSUPP;
@@ -92,7 +93,13 @@ int cfg80211_set_monitor_channel(struct cfg80211_registered_device *rdev,
        if (!chan)
                return -EINVAL;
 
-       return rdev->ops->set_monitor_channel(&rdev->wiphy, chan, chantype);
+       err = rdev->ops->set_monitor_channel(&rdev->wiphy, chan, chantype);
+       if (!err) {
+               rdev->monitor_channel = chan;
+               rdev->monitor_channel_type = chantype;
+       }
+
+       return err;
 }
 
 void
index 8412da7d0f25dccd37255170f875f663dbec12af..1b5daa73b3a9347388369fe3a51cdf7391e8e81b 100644 (file)
@@ -730,9 +730,15 @@ void cfg80211_update_iface_num(struct cfg80211_registered_device *rdev,
                rdev->num_running_monitor_ifaces += num;
 
        has_monitors_only_new = cfg80211_has_monitors_only(rdev);
-       if (has_monitors_only_new != has_monitors_only_old)
+       if (has_monitors_only_new != has_monitors_only_old) {
                rdev->ops->set_monitor_enabled(&rdev->wiphy,
                                               has_monitors_only_new);
+
+               if (!has_monitors_only_new) {
+                       rdev->monitor_channel = NULL;
+                       rdev->monitor_channel_type = NL80211_CHAN_NO_HT;
+               }
+       }
 }
 
 static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
index 99acd51343b11742c020ae57ef8395596696bbef..d5efe1b0a8f7ac269eba6293bfe4eb18ed73f9fa 100644 (file)
@@ -59,6 +59,9 @@ struct cfg80211_registered_device {
        int num_running_ifaces;
        int num_running_monitor_ifaces;
 
+       struct ieee80211_channel *monitor_channel;
+       enum nl80211_channel_type monitor_channel_type;
+
        /* BSSes/scanning */
        spinlock_t bss_lock;
        struct list_head bss_list;