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.c55
1 files changed, 44 insertions, 11 deletions
diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c
index 889c3e93e0f4..e00ce8c3e28e 100644
--- a/net/mac80211/chan.c
+++ b/net/mac80211/chan.c
@@ -3,6 +3,7 @@
3 */ 3 */
4 4
5#include <linux/nl80211.h> 5#include <linux/nl80211.h>
6#include <net/cfg80211.h>
6#include "ieee80211_i.h" 7#include "ieee80211_i.h"
7 8
8static enum ieee80211_chan_mode 9static enum ieee80211_chan_mode
@@ -20,23 +21,29 @@ __ieee80211_get_channel_mode(struct ieee80211_local *local,
20 if (!ieee80211_sdata_running(sdata)) 21 if (!ieee80211_sdata_running(sdata))
21 continue; 22 continue;
22 23
23 if (sdata->vif.type == NL80211_IFTYPE_MONITOR) 24 switch (sdata->vif.type) {
25 case NL80211_IFTYPE_MONITOR:
24 continue; 26 continue;
25 27 case NL80211_IFTYPE_STATION:
26 if (sdata->vif.type == NL80211_IFTYPE_STATION && 28 if (!sdata->u.mgd.associated)
27 !sdata->u.mgd.associated) 29 continue;
28 continue; 30 break;
29 31 case NL80211_IFTYPE_ADHOC:
30 if (sdata->vif.type == NL80211_IFTYPE_ADHOC) {
31 if (!sdata->u.ibss.ssid_len) 32 if (!sdata->u.ibss.ssid_len)
32 continue; 33 continue;
33 if (!sdata->u.ibss.fixed_channel) 34 if (!sdata->u.ibss.fixed_channel)
34 return CHAN_MODE_HOPPING; 35 return CHAN_MODE_HOPPING;
35 } 36 break;
36 37 case NL80211_IFTYPE_AP_VLAN:
37 if (sdata->vif.type == NL80211_IFTYPE_AP && 38 /* will also have _AP interface */
38 !sdata->u.ap.beacon)
39 continue; 39 continue;
40 case NL80211_IFTYPE_AP:
41 if (!sdata->u.ap.beacon)
42 continue;
43 break;
44 default:
45 break;
46 }
40 47
41 return CHAN_MODE_FIXED; 48 return CHAN_MODE_FIXED;
42 } 49 }
@@ -128,3 +135,29 @@ bool ieee80211_set_channel_type(struct ieee80211_local *local,
128 135
129 return result; 136 return result;
130} 137}
138
139/*
140 * ieee80211_get_tx_channel_type returns the channel type we should
141 * use for packet transmission, given the channel capability and
142 * whatever regulatory flags we have been given.
143 */
144enum nl80211_channel_type ieee80211_get_tx_channel_type(
145 struct ieee80211_local *local,
146 enum nl80211_channel_type channel_type)
147{
148 switch (channel_type) {
149 case NL80211_CHAN_HT40PLUS:
150 if (local->hw.conf.channel->flags &
151 IEEE80211_CHAN_NO_HT40PLUS)
152 return NL80211_CHAN_HT20;
153 break;
154 case NL80211_CHAN_HT40MINUS:
155 if (local->hw.conf.channel->flags &
156 IEEE80211_CHAN_NO_HT40MINUS)
157 return NL80211_CHAN_HT20;
158 break;
159 default:
160 break;
161 }
162 return channel_type;
163}