aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorMichal Kazior <michal.kazior@tieto.com>2012-06-29 06:47:04 -0400
committerJohannes Berg <johannes.berg@intel.com>2012-06-29 07:39:17 -0400
commitb78e8ceac23655e1e06b30aa95ab11742d1ac7c0 (patch)
treeac94fc72cb01b67c1054b7c0b768a57e51800451 /net
parent4f03c1ed8901a01ad4abcef95c02c007a2d481c2 (diff)
cfg80211: track monitor channel
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>
Diffstat (limited to 'net')
-rw-r--r--net/wireless/chan.c9
-rw-r--r--net/wireless/core.c8
-rw-r--r--net/wireless/core.h3
3 files changed, 18 insertions, 2 deletions
diff --git a/net/wireless/chan.c b/net/wireless/chan.c
index 019401b0b5e3..434c56b92c3c 100644
--- a/net/wireless/chan.c
+++ b/net/wireless/chan.c
@@ -82,6 +82,7 @@ int cfg80211_set_monitor_channel(struct cfg80211_registered_device *rdev,
82 int freq, enum nl80211_channel_type chantype) 82 int freq, enum nl80211_channel_type chantype)
83{ 83{
84 struct ieee80211_channel *chan; 84 struct ieee80211_channel *chan;
85 int err;
85 86
86 if (!rdev->ops->set_monitor_channel) 87 if (!rdev->ops->set_monitor_channel)
87 return -EOPNOTSUPP; 88 return -EOPNOTSUPP;
@@ -92,7 +93,13 @@ int cfg80211_set_monitor_channel(struct cfg80211_registered_device *rdev,
92 if (!chan) 93 if (!chan)
93 return -EINVAL; 94 return -EINVAL;
94 95
95 return rdev->ops->set_monitor_channel(&rdev->wiphy, chan, chantype); 96 err = rdev->ops->set_monitor_channel(&rdev->wiphy, chan, chantype);
97 if (!err) {
98 rdev->monitor_channel = chan;
99 rdev->monitor_channel_type = chantype;
100 }
101
102 return err;
96} 103}
97 104
98void 105void
diff --git a/net/wireless/core.c b/net/wireless/core.c
index 8412da7d0f25..1b5daa73b3a9 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -730,9 +730,15 @@ void cfg80211_update_iface_num(struct cfg80211_registered_device *rdev,
730 rdev->num_running_monitor_ifaces += num; 730 rdev->num_running_monitor_ifaces += num;
731 731
732 has_monitors_only_new = cfg80211_has_monitors_only(rdev); 732 has_monitors_only_new = cfg80211_has_monitors_only(rdev);
733 if (has_monitors_only_new != has_monitors_only_old) 733 if (has_monitors_only_new != has_monitors_only_old) {
734 rdev->ops->set_monitor_enabled(&rdev->wiphy, 734 rdev->ops->set_monitor_enabled(&rdev->wiphy,
735 has_monitors_only_new); 735 has_monitors_only_new);
736
737 if (!has_monitors_only_new) {
738 rdev->monitor_channel = NULL;
739 rdev->monitor_channel_type = NL80211_CHAN_NO_HT;
740 }
741 }
736} 742}
737 743
738static int cfg80211_netdev_notifier_call(struct notifier_block *nb, 744static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
diff --git a/net/wireless/core.h b/net/wireless/core.h
index 99acd51343b1..d5efe1b0a8f7 100644
--- a/net/wireless/core.h
+++ b/net/wireless/core.h
@@ -59,6 +59,9 @@ struct cfg80211_registered_device {
59 int num_running_ifaces; 59 int num_running_ifaces;
60 int num_running_monitor_ifaces; 60 int num_running_monitor_ifaces;
61 61
62 struct ieee80211_channel *monitor_channel;
63 enum nl80211_channel_type monitor_channel_type;
64
62 /* BSSes/scanning */ 65 /* BSSes/scanning */
63 spinlock_t bss_lock; 66 spinlock_t bss_lock;
64 struct list_head bss_list; 67 struct list_head bss_list;