diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2008-10-09 06:13:49 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-10-31 19:00:06 -0400 |
commit | d9fe60dea7779d412b34679f1177c5ca1940ea8d (patch) | |
tree | a51e16b013f7c1d16ded502cb32c03872bcbfcaa /net/mac80211/main.c | |
parent | 40333e4fb476014cdd939d27e20eb54573172b32 (diff) |
802.11: clean up/fix HT support
This patch cleans up a number of things:
* the unusable definition of the HT capabilities/HT information
information elements
* variable names that are hard to understand
* mac80211: move ieee80211_handle_ht to ht.c and remove the unused
enable_ht parameter
* mac80211: fix bug with MCS rate 32 in ieee80211_handle_ht
* mac80211: fix bug with casting the result of ieee80211_bss_get_ie
to an information element _contents_ rather than the
whole element, add size checking (another out-of-bounds
access bug fixed!)
* mac80211: remove some unused return values in favour of BUG_ON
checking
* a few minor other things
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/main.c')
-rw-r--r-- | net/mac80211/main.c | 94 |
1 files changed, 0 insertions, 94 deletions
diff --git a/net/mac80211/main.c b/net/mac80211/main.c index c427954fe8e8..07f812755e55 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c | |||
@@ -232,100 +232,6 @@ int ieee80211_hw_config(struct ieee80211_local *local) | |||
232 | return ret; | 232 | return ret; |
233 | } | 233 | } |
234 | 234 | ||
235 | /** | ||
236 | * ieee80211_handle_ht should be used only after legacy configuration | ||
237 | * has been determined namely band, as ht configuration depends upon | ||
238 | * the hardware's HT abilities for a _specific_ band. | ||
239 | */ | ||
240 | u32 ieee80211_handle_ht(struct ieee80211_local *local, int enable_ht, | ||
241 | struct ieee80211_ht_info *req_ht_cap, | ||
242 | struct ieee80211_ht_bss_info *req_bss_cap) | ||
243 | { | ||
244 | struct ieee80211_conf *conf = &local->hw.conf; | ||
245 | struct ieee80211_supported_band *sband; | ||
246 | struct ieee80211_ht_info ht_conf; | ||
247 | struct ieee80211_ht_bss_info ht_bss_conf; | ||
248 | u32 changed = 0; | ||
249 | int i; | ||
250 | u8 max_tx_streams = IEEE80211_HT_CAP_MAX_STREAMS; | ||
251 | u8 tx_mcs_set_cap; | ||
252 | |||
253 | sband = local->hw.wiphy->bands[conf->channel->band]; | ||
254 | |||
255 | memset(&ht_conf, 0, sizeof(struct ieee80211_ht_info)); | ||
256 | memset(&ht_bss_conf, 0, sizeof(struct ieee80211_ht_bss_info)); | ||
257 | |||
258 | /* HT is not supported */ | ||
259 | if (!sband->ht_info.ht_supported) { | ||
260 | conf->flags &= ~IEEE80211_CONF_SUPPORT_HT_MODE; | ||
261 | goto out; | ||
262 | } | ||
263 | |||
264 | /* disable HT */ | ||
265 | if (!enable_ht) { | ||
266 | if (conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) | ||
267 | changed |= BSS_CHANGED_HT; | ||
268 | conf->flags &= ~IEEE80211_CONF_SUPPORT_HT_MODE; | ||
269 | conf->ht_conf.ht_supported = 0; | ||
270 | goto out; | ||
271 | } | ||
272 | |||
273 | |||
274 | if (!(conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE)) | ||
275 | changed |= BSS_CHANGED_HT; | ||
276 | |||
277 | conf->flags |= IEEE80211_CONF_SUPPORT_HT_MODE; | ||
278 | ht_conf.ht_supported = 1; | ||
279 | |||
280 | ht_conf.cap = req_ht_cap->cap & sband->ht_info.cap; | ||
281 | ht_conf.cap &= ~(IEEE80211_HT_CAP_SM_PS); | ||
282 | ht_conf.cap |= sband->ht_info.cap & IEEE80211_HT_CAP_SM_PS; | ||
283 | ht_bss_conf.primary_channel = req_bss_cap->primary_channel; | ||
284 | ht_bss_conf.bss_cap = req_bss_cap->bss_cap; | ||
285 | ht_bss_conf.bss_op_mode = req_bss_cap->bss_op_mode; | ||
286 | |||
287 | ht_conf.ampdu_factor = req_ht_cap->ampdu_factor; | ||
288 | ht_conf.ampdu_density = req_ht_cap->ampdu_density; | ||
289 | |||
290 | /* Bits 96-100 */ | ||
291 | tx_mcs_set_cap = sband->ht_info.supp_mcs_set[12]; | ||
292 | |||
293 | /* configure suppoerted Tx MCS according to requested MCS | ||
294 | * (based in most cases on Rx capabilities of peer) and self | ||
295 | * Tx MCS capabilities (as defined by low level driver HW | ||
296 | * Tx capabilities) */ | ||
297 | if (!(tx_mcs_set_cap & IEEE80211_HT_CAP_MCS_TX_DEFINED)) | ||
298 | goto check_changed; | ||
299 | |||
300 | /* Counting from 0 therfore + 1 */ | ||
301 | if (tx_mcs_set_cap & IEEE80211_HT_CAP_MCS_TX_RX_DIFF) | ||
302 | max_tx_streams = ((tx_mcs_set_cap & | ||
303 | IEEE80211_HT_CAP_MCS_TX_STREAMS) >> 2) + 1; | ||
304 | |||
305 | for (i = 0; i < max_tx_streams; i++) | ||
306 | ht_conf.supp_mcs_set[i] = | ||
307 | sband->ht_info.supp_mcs_set[i] & | ||
308 | req_ht_cap->supp_mcs_set[i]; | ||
309 | |||
310 | if (tx_mcs_set_cap & IEEE80211_HT_CAP_MCS_TX_UEQM) | ||
311 | for (i = IEEE80211_SUPP_MCS_SET_UEQM; | ||
312 | i < IEEE80211_SUPP_MCS_SET_LEN; i++) | ||
313 | ht_conf.supp_mcs_set[i] = | ||
314 | sband->ht_info.supp_mcs_set[i] & | ||
315 | req_ht_cap->supp_mcs_set[i]; | ||
316 | |||
317 | check_changed: | ||
318 | /* if bss configuration changed store the new one */ | ||
319 | if (memcmp(&conf->ht_conf, &ht_conf, sizeof(ht_conf)) || | ||
320 | memcmp(&conf->ht_bss_conf, &ht_bss_conf, sizeof(ht_bss_conf))) { | ||
321 | changed |= BSS_CHANGED_HT; | ||
322 | memcpy(&conf->ht_conf, &ht_conf, sizeof(ht_conf)); | ||
323 | memcpy(&conf->ht_bss_conf, &ht_bss_conf, sizeof(ht_bss_conf)); | ||
324 | } | ||
325 | out: | ||
326 | return changed; | ||
327 | } | ||
328 | |||
329 | void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata, | 235 | void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata, |
330 | u32 changed) | 236 | u32 changed) |
331 | { | 237 | { |