aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless/chan.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2012-06-06 02:18:22 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-06-06 15:18:17 -0400
commite8c9bd5b8d807cfe6c923265969a523b1ba1e6c2 (patch)
treee36cab1a3b2fb25bdc84115e3472a19672045dbe /net/wireless/chan.c
parent7c9c46c16d2d1d232f3296924162de293477f017 (diff)
cfg80211: clarify set_channel APIs
Now that we've removed all uses of the set_channel API except for the monitor channel and in libertas, clarify this. Split the libertas mesh use into a new libertas_set_mesh_channel() operation, just to keep backward compatibility, and rename the normal set_channel() to set_monitor_channel(). Also describe the desired set_monitor_channel() semantics more clearly. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless/chan.c')
-rw-r--r--net/wireless/chan.c43
1 files changed, 5 insertions, 38 deletions
diff --git a/net/wireless/chan.c b/net/wireless/chan.c
index 20b87d895722..c1999e45a07c 100644
--- a/net/wireless/chan.c
+++ b/net/wireless/chan.c
@@ -78,50 +78,17 @@ bool cfg80211_can_beacon_sec_chan(struct wiphy *wiphy,
78} 78}
79EXPORT_SYMBOL(cfg80211_can_beacon_sec_chan); 79EXPORT_SYMBOL(cfg80211_can_beacon_sec_chan);
80 80
81int cfg80211_set_freq(struct cfg80211_registered_device *rdev, 81int cfg80211_set_monitor_channel(struct cfg80211_registered_device *rdev,
82 struct wireless_dev *wdev, int freq, 82 int freq, enum nl80211_channel_type chantype)
83 enum nl80211_channel_type channel_type)
84{ 83{
85 struct ieee80211_channel *chan; 84 struct ieee80211_channel *chan;
86 int result;
87 85
88 if (wdev && wdev->iftype == NL80211_IFTYPE_MONITOR) 86 if (!rdev->ops->set_monitor_channel)
89 wdev = NULL;
90
91 if (wdev) {
92 ASSERT_WDEV_LOCK(wdev);
93
94 if (!netif_running(wdev->netdev))
95 return -ENETDOWN;
96 }
97
98 if (!rdev->ops->set_channel)
99 return -EOPNOTSUPP; 87 return -EOPNOTSUPP;
100 88
101 chan = rdev_freq_to_chan(rdev, freq, channel_type); 89 chan = rdev_freq_to_chan(rdev, freq, chantype);
102 if (!chan) 90 if (!chan)
103 return -EINVAL; 91 return -EINVAL;
104 92
105 /* Both channels should be able to initiate communication */ 93 return rdev->ops->set_monitor_channel(&rdev->wiphy, chan, chantype);
106 if (wdev && (wdev->iftype == NL80211_IFTYPE_ADHOC ||
107 wdev->iftype == NL80211_IFTYPE_AP ||
108 wdev->iftype == NL80211_IFTYPE_AP_VLAN ||
109 wdev->iftype == NL80211_IFTYPE_MESH_POINT ||
110 wdev->iftype == NL80211_IFTYPE_P2P_GO) &&
111 !cfg80211_can_beacon_sec_chan(&rdev->wiphy, chan, channel_type)) {
112 printk(KERN_DEBUG
113 "cfg80211: Secondary channel not allowed to beacon\n");
114 return -EINVAL;
115 }
116
117 result = rdev->ops->set_channel(&rdev->wiphy,
118 wdev ? wdev->netdev : NULL,
119 chan, channel_type);
120 if (result)
121 return result;
122
123 if (wdev)
124 wdev->channel = chan;
125
126 return 0;
127} 94}