aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/chan.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211/chan.c')
-rw-r--r--net/mac80211/chan.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c
new file mode 100644
index 000000000000..08f3832661a5
--- /dev/null
+++ b/net/mac80211/chan.c
@@ -0,0 +1,57 @@
1/*
2 * mac80211 - channel management
3 */
4
5#include "ieee80211_i.h"
6
7enum ieee80211_chan_mode
8__ieee80211_get_channel_mode(struct ieee80211_local *local,
9 struct ieee80211_sub_if_data *ignore)
10{
11 struct ieee80211_sub_if_data *sdata;
12
13 WARN_ON(!mutex_is_locked(&local->iflist_mtx));
14
15 list_for_each_entry(sdata, &local->interfaces, list) {
16 if (sdata == ignore)
17 continue;
18
19 if (!ieee80211_sdata_running(sdata))
20 continue;
21
22 if (sdata->vif.type == NL80211_IFTYPE_MONITOR)
23 continue;
24
25 if (sdata->vif.type == NL80211_IFTYPE_STATION &&
26 !sdata->u.mgd.associated)
27 continue;
28
29 if (sdata->vif.type == NL80211_IFTYPE_ADHOC) {
30 if (!sdata->u.ibss.ssid_len)
31 continue;
32 if (!sdata->u.ibss.fixed_channel)
33 return CHAN_MODE_HOPPING;
34 }
35
36 if (sdata->vif.type == NL80211_IFTYPE_AP &&
37 !sdata->u.ap.beacon)
38 continue;
39
40 return CHAN_MODE_FIXED;
41 }
42
43 return CHAN_MODE_UNDEFINED;
44}
45
46enum ieee80211_chan_mode
47ieee80211_get_channel_mode(struct ieee80211_local *local,
48 struct ieee80211_sub_if_data *ignore)
49{
50 enum ieee80211_chan_mode mode;
51
52 mutex_lock(&local->iflist_mtx);
53 mode = __ieee80211_get_channel_mode(local, ignore);
54 mutex_unlock(&local->iflist_mtx);
55
56 return mode;
57}