diff options
author | Vladimir Koutny <vlado@work.ksp.sk> | 2008-03-18 16:14:07 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-03-25 16:41:57 -0400 |
commit | e2839d8f509451acf6b1f22787f25ce98383d94c (patch) | |
tree | 95888bda8ee739304939e5890a924539d9b25e1f /net/mac80211 | |
parent | 675ef586f04e3a4566c9f437790a340711be5bd2 (diff) |
mac80211: configure default wmm params correctly
Default WMM params have to be set according to beacon/probe response
information prior to authentication (or IBSS start/join); beacon queue
is configured only in IBSS. This does not affect the use of 'real' WMM
params as reported by AP.
Signed-off-by: Vladimir Koutny <vlado@ksp.sk>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r-- | net/mac80211/ieee80211_sta.c | 91 |
1 files changed, 58 insertions, 33 deletions
diff --git a/net/mac80211/ieee80211_sta.c b/net/mac80211/ieee80211_sta.c index bf130b6255ab..cf51ca6804dd 100644 --- a/net/mac80211/ieee80211_sta.c +++ b/net/mac80211/ieee80211_sta.c | |||
@@ -220,6 +220,61 @@ static int ecw2cw(int ecw) | |||
220 | return (1 << ecw) - 1; | 220 | return (1 << ecw) - 1; |
221 | } | 221 | } |
222 | 222 | ||
223 | |||
224 | static void ieee80211_sta_def_wmm_params(struct net_device *dev, | ||
225 | struct ieee80211_sta_bss *bss, | ||
226 | int ibss) | ||
227 | { | ||
228 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
229 | struct ieee80211_local *local = sdata->local; | ||
230 | int i, have_higher_than_11mbit = 0; | ||
231 | |||
232 | |||
233 | /* cf. IEEE 802.11 9.2.12 */ | ||
234 | for (i = 0; i < bss->supp_rates_len; i++) | ||
235 | if ((bss->supp_rates[i] & 0x7f) * 5 > 110) | ||
236 | have_higher_than_11mbit = 1; | ||
237 | |||
238 | if (local->hw.conf.channel->band == IEEE80211_BAND_2GHZ && | ||
239 | have_higher_than_11mbit) | ||
240 | sdata->flags |= IEEE80211_SDATA_OPERATING_GMODE; | ||
241 | else | ||
242 | sdata->flags &= ~IEEE80211_SDATA_OPERATING_GMODE; | ||
243 | |||
244 | |||
245 | if (local->ops->conf_tx) { | ||
246 | struct ieee80211_tx_queue_params qparam; | ||
247 | int i; | ||
248 | |||
249 | memset(&qparam, 0, sizeof(qparam)); | ||
250 | |||
251 | qparam.aifs = 2; | ||
252 | |||
253 | if (local->hw.conf.channel->band == IEEE80211_BAND_2GHZ && | ||
254 | !(sdata->flags & IEEE80211_SDATA_OPERATING_GMODE)) | ||
255 | qparam.cw_min = 31; | ||
256 | else | ||
257 | qparam.cw_min = 15; | ||
258 | |||
259 | qparam.cw_max = 1023; | ||
260 | qparam.txop = 0; | ||
261 | |||
262 | for (i = IEEE80211_TX_QUEUE_DATA0; i < NUM_TX_DATA_QUEUES; i++) | ||
263 | local->ops->conf_tx(local_to_hw(local), | ||
264 | i + IEEE80211_TX_QUEUE_DATA0, | ||
265 | &qparam); | ||
266 | |||
267 | if (ibss) { | ||
268 | /* IBSS uses different parameters for Beacon sending */ | ||
269 | qparam.cw_min++; | ||
270 | qparam.cw_min *= 2; | ||
271 | qparam.cw_min--; | ||
272 | local->ops->conf_tx(local_to_hw(local), | ||
273 | IEEE80211_TX_QUEUE_BEACON, &qparam); | ||
274 | } | ||
275 | } | ||
276 | } | ||
277 | |||
223 | static void ieee80211_sta_wmm_params(struct net_device *dev, | 278 | static void ieee80211_sta_wmm_params(struct net_device *dev, |
224 | struct ieee80211_if_sta *ifsta, | 279 | struct ieee80211_if_sta *ifsta, |
225 | u8 *wmm_param, size_t wmm_param_len) | 280 | u8 *wmm_param, size_t wmm_param_len) |
@@ -2302,6 +2357,8 @@ static int ieee80211_sta_join_ibss(struct net_device *dev, | |||
2302 | rates |= BIT(j); | 2357 | rates |= BIT(j); |
2303 | } | 2358 | } |
2304 | ifsta->supp_rates_bits[local->hw.conf.channel->band] = rates; | 2359 | ifsta->supp_rates_bits[local->hw.conf.channel->band] = rates; |
2360 | |||
2361 | ieee80211_sta_def_wmm_params(dev, bss, 1); | ||
2305 | } while (0); | 2362 | } while (0); |
2306 | 2363 | ||
2307 | if (skb) { | 2364 | if (skb) { |
@@ -3293,6 +3350,7 @@ static int ieee80211_sta_config_auth(struct net_device *dev, | |||
3293 | ieee80211_sta_set_ssid(dev, selected->ssid, | 3350 | ieee80211_sta_set_ssid(dev, selected->ssid, |
3294 | selected->ssid_len); | 3351 | selected->ssid_len); |
3295 | ieee80211_sta_set_bssid(dev, selected->bssid); | 3352 | ieee80211_sta_set_bssid(dev, selected->bssid); |
3353 | ieee80211_sta_def_wmm_params(dev, selected, 0); | ||
3296 | ieee80211_rx_bss_put(dev, selected); | 3354 | ieee80211_rx_bss_put(dev, selected); |
3297 | ifsta->state = IEEE80211_AUTHENTICATE; | 3355 | ifsta->state = IEEE80211_AUTHENTICATE; |
3298 | ieee80211_sta_reset_auth(dev, ifsta); | 3356 | ieee80211_sta_reset_auth(dev, ifsta); |
@@ -3467,43 +3525,10 @@ int ieee80211_sta_set_ssid(struct net_device *dev, char *ssid, size_t len) | |||
3467 | { | 3525 | { |
3468 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 3526 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
3469 | struct ieee80211_if_sta *ifsta; | 3527 | struct ieee80211_if_sta *ifsta; |
3470 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
3471 | 3528 | ||
3472 | if (len > IEEE80211_MAX_SSID_LEN) | 3529 | if (len > IEEE80211_MAX_SSID_LEN) |
3473 | return -EINVAL; | 3530 | return -EINVAL; |
3474 | 3531 | ||
3475 | /* TODO: This should always be done for IBSS, even if IEEE80211_QOS is | ||
3476 | * not defined. */ | ||
3477 | if (local->ops->conf_tx) { | ||
3478 | struct ieee80211_tx_queue_params qparam; | ||
3479 | int i; | ||
3480 | |||
3481 | memset(&qparam, 0, sizeof(qparam)); | ||
3482 | |||
3483 | qparam.aifs = 2; | ||
3484 | |||
3485 | if (local->hw.conf.channel->band == IEEE80211_BAND_2GHZ && | ||
3486 | !(sdata->flags & IEEE80211_SDATA_OPERATING_GMODE)) | ||
3487 | qparam.cw_min = 31; | ||
3488 | else | ||
3489 | qparam.cw_min = 15; | ||
3490 | |||
3491 | qparam.cw_max = 1023; | ||
3492 | qparam.txop = 0; | ||
3493 | |||
3494 | for (i = IEEE80211_TX_QUEUE_DATA0; i < NUM_TX_DATA_QUEUES; i++) | ||
3495 | local->ops->conf_tx(local_to_hw(local), | ||
3496 | i + IEEE80211_TX_QUEUE_DATA0, | ||
3497 | &qparam); | ||
3498 | |||
3499 | /* IBSS uses different parameters for Beacon sending */ | ||
3500 | qparam.cw_min++; | ||
3501 | qparam.cw_min *= 2; | ||
3502 | qparam.cw_min--; | ||
3503 | local->ops->conf_tx(local_to_hw(local), | ||
3504 | IEEE80211_TX_QUEUE_BEACON, &qparam); | ||
3505 | } | ||
3506 | |||
3507 | ifsta = &sdata->u.sta; | 3532 | ifsta = &sdata->u.sta; |
3508 | 3533 | ||
3509 | if (ifsta->ssid_len != len || memcmp(ifsta->ssid, ssid, len) != 0) | 3534 | if (ifsta->ssid_len != len || memcmp(ifsta->ssid, ssid, len) != 0) |