aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/mlme.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-03-30 07:23:35 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-04-22 16:54:35 -0400
commitd5522e039586fdf72493225a88b944f726b69671 (patch)
treece7aa8402bd708a3cbe6b0eb82453c54fa051550 /net/mac80211/mlme.c
parentf5c38ef06e005705ef87b7a77752c183bacb94cc (diff)
mac80211: move ieee80211_enable_ht function to mlme.c
It really belongs into that file since it is only relevant for managed mode. Move 1:1, not even whitespace changes, but make it static and remove from header file. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/mlme.c')
-rw-r--r--net/mac80211/mlme.c83
1 files changed, 83 insertions, 0 deletions
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 08db02c237c9..4ce5b9c22324 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -80,6 +80,89 @@ static int ieee80211_compatible_rates(struct ieee80211_bss *bss,
80 return count; 80 return count;
81} 81}
82 82
83/*
84 * ieee80211_enable_ht should be called only after the operating band
85 * has been determined as ht configuration depends on the hw's
86 * HT abilities for a specific band.
87 */
88static u32 ieee80211_enable_ht(struct ieee80211_sub_if_data *sdata,
89 struct ieee80211_ht_info *hti,
90 u16 ap_ht_cap_flags)
91{
92 struct ieee80211_local *local = sdata->local;
93 struct ieee80211_supported_band *sband;
94 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
95 struct ieee80211_bss_ht_conf ht;
96 struct sta_info *sta;
97 u32 changed = 0;
98 bool enable_ht = true, ht_changed;
99 enum nl80211_channel_type channel_type = NL80211_CHAN_NO_HT;
100
101 sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
102
103 memset(&ht, 0, sizeof(ht));
104
105 /* HT is not supported */
106 if (!sband->ht_cap.ht_supported)
107 enable_ht = false;
108
109 /* check that channel matches the right operating channel */
110 if (local->hw.conf.channel->center_freq !=
111 ieee80211_channel_to_frequency(hti->control_chan))
112 enable_ht = false;
113
114 if (enable_ht) {
115 channel_type = NL80211_CHAN_HT20;
116
117 if (!(ap_ht_cap_flags & IEEE80211_HT_CAP_40MHZ_INTOLERANT) &&
118 (sband->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) &&
119 (hti->ht_param & IEEE80211_HT_PARAM_CHAN_WIDTH_ANY)) {
120 switch(hti->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET) {
121 case IEEE80211_HT_PARAM_CHA_SEC_ABOVE:
122 channel_type = NL80211_CHAN_HT40PLUS;
123 break;
124 case IEEE80211_HT_PARAM_CHA_SEC_BELOW:
125 channel_type = NL80211_CHAN_HT40MINUS;
126 break;
127 }
128 }
129 }
130
131 ht_changed = conf_is_ht(&local->hw.conf) != enable_ht ||
132 channel_type != local->hw.conf.channel_type;
133
134 local->oper_channel_type = channel_type;
135
136 if (ht_changed) {
137 /* channel_type change automatically detected */
138 ieee80211_hw_config(local, 0);
139
140 rcu_read_lock();
141
142 sta = sta_info_get(local, ifmgd->bssid);
143 if (sta)
144 rate_control_rate_update(local, sband, sta,
145 IEEE80211_RC_HT_CHANGED);
146
147 rcu_read_unlock();
148
149 }
150
151 /* disable HT */
152 if (!enable_ht)
153 return 0;
154
155 ht.operation_mode = le16_to_cpu(hti->operation_mode);
156
157 /* if bss configuration changed store the new one */
158 if (memcmp(&sdata->vif.bss_conf.ht, &ht, sizeof(ht))) {
159 changed |= BSS_CHANGED_HT;
160 sdata->vif.bss_conf.ht = ht;
161 }
162
163 return changed;
164}
165
83/* frame sending functions */ 166/* frame sending functions */
84 167
85static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) 168static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata)