diff options
author | Eliad Peller <eliad@wizery.com> | 2011-09-19 06:51:42 -0400 |
---|---|---|
committer | Luciano Coelho <coelho@ti.com> | 2011-09-23 08:59:45 -0400 |
commit | af7fbb28efff0c0d8fc0852ad6622e5437a7611e (patch) | |
tree | 53afcd5afb6666c61c52a901b706689a1aab43d9 /drivers/net/wireless/wl12xx/main.c | |
parent | 68eaaf6ee5ac35d8e592834219cee9c9e88fdb24 (diff) |
wl12xx: implement set_bitrate_mask callback
Save the configured bitrate, and use the min allowed rate
as the basic rate (e.g. when scanning).
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
Diffstat (limited to 'drivers/net/wireless/wl12xx/main.c')
-rw-r--r-- | drivers/net/wireless/wl12xx/main.c | 79 |
1 files changed, 56 insertions, 23 deletions
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c index 02b5c007d1bf..384ba1944396 100644 --- a/drivers/net/wireless/wl12xx/main.c +++ b/drivers/net/wireless/wl12xx/main.c | |||
@@ -2099,6 +2099,8 @@ deinit: | |||
2099 | wl->time_offset = 0; | 2099 | wl->time_offset = 0; |
2100 | wl->session_counter = 0; | 2100 | wl->session_counter = 0; |
2101 | wl->rate_set = CONF_TX_RATE_MASK_BASIC; | 2101 | wl->rate_set = CONF_TX_RATE_MASK_BASIC; |
2102 | wl->bitrate_masks[IEEE80211_BAND_2GHZ] = wl->conf.tx.basic_rate; | ||
2103 | wl->bitrate_masks[IEEE80211_BAND_5GHZ] = wl->conf.tx.basic_rate_5; | ||
2102 | wl->vif = NULL; | 2104 | wl->vif = NULL; |
2103 | wl->tx_spare_blocks = TX_HW_BLOCK_SPARE_DEFAULT; | 2105 | wl->tx_spare_blocks = TX_HW_BLOCK_SPARE_DEFAULT; |
2104 | wl1271_free_ap_keys(wl); | 2106 | wl1271_free_ap_keys(wl); |
@@ -2237,14 +2239,8 @@ out: | |||
2237 | 2239 | ||
2238 | static void wl1271_set_band_rate(struct wl1271 *wl) | 2240 | static void wl1271_set_band_rate(struct wl1271 *wl) |
2239 | { | 2241 | { |
2240 | if (wl->band == IEEE80211_BAND_2GHZ) { | 2242 | wl->basic_rate_set = wl->bitrate_masks[wl->band]; |
2241 | wl->basic_rate_set = wl->conf.tx.basic_rate; | 2243 | wl->rate_set = wl->basic_rate_set; |
2242 | wl->rate_set = wl->conf.tx.basic_rate; | ||
2243 | } else { | ||
2244 | wl->basic_rate_set = wl->conf.tx.basic_rate_5; | ||
2245 | wl->rate_set = wl->conf.tx.basic_rate_5; | ||
2246 | } | ||
2247 | |||
2248 | } | 2244 | } |
2249 | 2245 | ||
2250 | static bool wl12xx_is_roc(struct wl1271 *wl) | 2246 | static bool wl12xx_is_roc(struct wl1271 *wl) |
@@ -2273,7 +2269,7 @@ static int wl1271_sta_handle_idle(struct wl1271 *wl, bool idle) | |||
2273 | if (ret < 0) | 2269 | if (ret < 0) |
2274 | goto out; | 2270 | goto out; |
2275 | } | 2271 | } |
2276 | wl->rate_set = wl1271_tx_min_rate_get(wl); | 2272 | wl->rate_set = wl1271_tx_min_rate_get(wl, wl->basic_rate_set); |
2277 | ret = wl1271_acx_sta_rate_policies(wl); | 2273 | ret = wl1271_acx_sta_rate_policies(wl); |
2278 | if (ret < 0) | 2274 | if (ret < 0) |
2279 | goto out; | 2275 | goto out; |
@@ -2370,7 +2366,8 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed) | |||
2370 | if (!test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) | 2366 | if (!test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) |
2371 | wl1271_set_band_rate(wl); | 2367 | wl1271_set_band_rate(wl); |
2372 | 2368 | ||
2373 | wl->basic_rate = wl1271_tx_min_rate_get(wl); | 2369 | wl->basic_rate = |
2370 | wl1271_tx_min_rate_get(wl, wl->basic_rate_set); | ||
2374 | ret = wl1271_acx_sta_rate_policies(wl); | 2371 | ret = wl1271_acx_sta_rate_policies(wl); |
2375 | if (ret < 0) | 2372 | if (ret < 0) |
2376 | wl1271_warning("rate policy for channel " | 2373 | wl1271_warning("rate policy for channel " |
@@ -3214,6 +3211,7 @@ static int wl1271_bss_beacon_info_changed(struct wl1271 *wl, | |||
3214 | 3211 | ||
3215 | if ((changed & BSS_CHANGED_BEACON)) { | 3212 | if ((changed & BSS_CHANGED_BEACON)) { |
3216 | struct ieee80211_hdr *hdr; | 3213 | struct ieee80211_hdr *hdr; |
3214 | u32 min_rate; | ||
3217 | int ieoffset = offsetof(struct ieee80211_mgmt, | 3215 | int ieoffset = offsetof(struct ieee80211_mgmt, |
3218 | u.beacon.variable); | 3216 | u.beacon.variable); |
3219 | struct sk_buff *beacon = ieee80211_beacon_get(wl->hw, vif); | 3217 | struct sk_buff *beacon = ieee80211_beacon_get(wl->hw, vif); |
@@ -3229,12 +3227,13 @@ static int wl1271_bss_beacon_info_changed(struct wl1271 *wl, | |||
3229 | dev_kfree_skb(beacon); | 3227 | dev_kfree_skb(beacon); |
3230 | goto out; | 3228 | goto out; |
3231 | } | 3229 | } |
3230 | min_rate = wl1271_tx_min_rate_get(wl, wl->basic_rate_set); | ||
3232 | tmpl_id = is_ap ? CMD_TEMPL_AP_BEACON : | 3231 | tmpl_id = is_ap ? CMD_TEMPL_AP_BEACON : |
3233 | CMD_TEMPL_BEACON; | 3232 | CMD_TEMPL_BEACON; |
3234 | ret = wl1271_cmd_template_set(wl, tmpl_id, | 3233 | ret = wl1271_cmd_template_set(wl, tmpl_id, |
3235 | beacon->data, | 3234 | beacon->data, |
3236 | beacon->len, 0, | 3235 | beacon->len, 0, |
3237 | wl1271_tx_min_rate_get(wl)); | 3236 | min_rate); |
3238 | if (ret < 0) { | 3237 | if (ret < 0) { |
3239 | dev_kfree_skb(beacon); | 3238 | dev_kfree_skb(beacon); |
3240 | goto out; | 3239 | goto out; |
@@ -3261,13 +3260,13 @@ static int wl1271_bss_beacon_info_changed(struct wl1271 *wl, | |||
3261 | ret = wl1271_ap_set_probe_resp_tmpl(wl, | 3260 | ret = wl1271_ap_set_probe_resp_tmpl(wl, |
3262 | beacon->data, | 3261 | beacon->data, |
3263 | beacon->len, | 3262 | beacon->len, |
3264 | wl1271_tx_min_rate_get(wl)); | 3263 | min_rate); |
3265 | else | 3264 | else |
3266 | ret = wl1271_cmd_template_set(wl, | 3265 | ret = wl1271_cmd_template_set(wl, |
3267 | CMD_TEMPL_PROBE_RESPONSE, | 3266 | CMD_TEMPL_PROBE_RESPONSE, |
3268 | beacon->data, | 3267 | beacon->data, |
3269 | beacon->len, 0, | 3268 | beacon->len, 0, |
3270 | wl1271_tx_min_rate_get(wl)); | 3269 | min_rate); |
3271 | dev_kfree_skb(beacon); | 3270 | dev_kfree_skb(beacon); |
3272 | if (ret < 0) | 3271 | if (ret < 0) |
3273 | goto out; | 3272 | goto out; |
@@ -3288,8 +3287,10 @@ static void wl1271_bss_info_changed_ap(struct wl1271 *wl, | |||
3288 | if ((changed & BSS_CHANGED_BASIC_RATES)) { | 3287 | if ((changed & BSS_CHANGED_BASIC_RATES)) { |
3289 | u32 rates = bss_conf->basic_rates; | 3288 | u32 rates = bss_conf->basic_rates; |
3290 | 3289 | ||
3291 | wl->basic_rate_set = wl1271_tx_enabled_rates_get(wl, rates); | 3290 | wl->basic_rate_set = wl1271_tx_enabled_rates_get(wl, rates, |
3292 | wl->basic_rate = wl1271_tx_min_rate_get(wl); | 3291 | wl->band); |
3292 | wl->basic_rate = wl1271_tx_min_rate_get(wl, | ||
3293 | wl->basic_rate_set); | ||
3293 | 3294 | ||
3294 | ret = wl1271_init_ap_rates(wl); | 3295 | ret = wl1271_init_ap_rates(wl); |
3295 | if (ret < 0) { | 3296 | if (ret < 0) { |
@@ -3471,12 +3472,15 @@ sta_not_found: | |||
3471 | * to use with control frames. | 3472 | * to use with control frames. |
3472 | */ | 3473 | */ |
3473 | rates = bss_conf->basic_rates; | 3474 | rates = bss_conf->basic_rates; |
3474 | wl->basic_rate_set = wl1271_tx_enabled_rates_get(wl, | 3475 | wl->basic_rate_set = |
3475 | rates); | 3476 | wl1271_tx_enabled_rates_get(wl, rates, |
3476 | wl->basic_rate = wl1271_tx_min_rate_get(wl); | 3477 | wl->band); |
3478 | wl->basic_rate = | ||
3479 | wl1271_tx_min_rate_get(wl, wl->basic_rate_set); | ||
3477 | if (sta_rate_set) | 3480 | if (sta_rate_set) |
3478 | wl->rate_set = wl1271_tx_enabled_rates_get(wl, | 3481 | wl->rate_set = wl1271_tx_enabled_rates_get(wl, |
3479 | sta_rate_set); | 3482 | sta_rate_set, |
3483 | wl->band); | ||
3480 | ret = wl1271_acx_sta_rate_policies(wl); | 3484 | ret = wl1271_acx_sta_rate_policies(wl); |
3481 | if (ret < 0) | 3485 | if (ret < 0) |
3482 | goto out; | 3486 | goto out; |
@@ -3523,7 +3527,8 @@ sta_not_found: | |||
3523 | 3527 | ||
3524 | /* revert back to minimum rates for the current band */ | 3528 | /* revert back to minimum rates for the current band */ |
3525 | wl1271_set_band_rate(wl); | 3529 | wl1271_set_band_rate(wl); |
3526 | wl->basic_rate = wl1271_tx_min_rate_get(wl); | 3530 | wl->basic_rate = |
3531 | wl1271_tx_min_rate_get(wl, wl->basic_rate_set); | ||
3527 | ret = wl1271_acx_sta_rate_policies(wl); | 3532 | ret = wl1271_acx_sta_rate_policies(wl); |
3528 | if (ret < 0) | 3533 | if (ret < 0) |
3529 | goto out; | 3534 | goto out; |
@@ -3574,9 +3579,11 @@ sta_not_found: | |||
3574 | 3579 | ||
3575 | if (bss_conf->ibss_joined) { | 3580 | if (bss_conf->ibss_joined) { |
3576 | u32 rates = bss_conf->basic_rates; | 3581 | u32 rates = bss_conf->basic_rates; |
3577 | wl->basic_rate_set = wl1271_tx_enabled_rates_get(wl, | 3582 | wl->basic_rate_set = |
3578 | rates); | 3583 | wl1271_tx_enabled_rates_get(wl, rates, |
3579 | wl->basic_rate = wl1271_tx_min_rate_get(wl); | 3584 | wl->band); |
3585 | wl->basic_rate = | ||
3586 | wl1271_tx_min_rate_get(wl, wl->basic_rate_set); | ||
3580 | 3587 | ||
3581 | /* by default, use 11b + OFDM rates */ | 3588 | /* by default, use 11b + OFDM rates */ |
3582 | wl->rate_set = CONF_TX_IBSS_DEFAULT_RATES; | 3589 | wl->rate_set = CONF_TX_IBSS_DEFAULT_RATES; |
@@ -4098,6 +4105,29 @@ out: | |||
4098 | return ret; | 4105 | return ret; |
4099 | } | 4106 | } |
4100 | 4107 | ||
4108 | static int wl12xx_set_bitrate_mask(struct ieee80211_hw *hw, | ||
4109 | struct ieee80211_vif *vif, | ||
4110 | const struct cfg80211_bitrate_mask *mask) | ||
4111 | { | ||
4112 | struct wl1271 *wl = hw->priv; | ||
4113 | int i; | ||
4114 | |||
4115 | wl1271_debug(DEBUG_MAC80211, "mac80211 set_bitrate_mask 0x%x 0x%x", | ||
4116 | mask->control[NL80211_BAND_2GHZ].legacy, | ||
4117 | mask->control[NL80211_BAND_5GHZ].legacy); | ||
4118 | |||
4119 | mutex_lock(&wl->mutex); | ||
4120 | |||
4121 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) | ||
4122 | wl->bitrate_masks[i] = | ||
4123 | wl1271_tx_enabled_rates_get(wl, | ||
4124 | mask->control[i].legacy, | ||
4125 | i); | ||
4126 | mutex_unlock(&wl->mutex); | ||
4127 | |||
4128 | return 0; | ||
4129 | } | ||
4130 | |||
4101 | static bool wl1271_tx_frames_pending(struct ieee80211_hw *hw) | 4131 | static bool wl1271_tx_frames_pending(struct ieee80211_hw *hw) |
4102 | { | 4132 | { |
4103 | struct wl1271 *wl = hw->priv; | 4133 | struct wl1271 *wl = hw->priv; |
@@ -4373,6 +4403,7 @@ static const struct ieee80211_ops wl1271_ops = { | |||
4373 | .sta_remove = wl1271_op_sta_remove, | 4403 | .sta_remove = wl1271_op_sta_remove, |
4374 | .ampdu_action = wl1271_op_ampdu_action, | 4404 | .ampdu_action = wl1271_op_ampdu_action, |
4375 | .tx_frames_pending = wl1271_tx_frames_pending, | 4405 | .tx_frames_pending = wl1271_tx_frames_pending, |
4406 | .set_bitrate_mask = wl12xx_set_bitrate_mask, | ||
4376 | CFG80211_TESTMODE_CMD(wl1271_tm_cmd) | 4407 | CFG80211_TESTMODE_CMD(wl1271_tm_cmd) |
4377 | }; | 4408 | }; |
4378 | 4409 | ||
@@ -4793,6 +4824,8 @@ struct ieee80211_hw *wl1271_alloc_hw(void) | |||
4793 | 4824 | ||
4794 | /* Apply default driver configuration. */ | 4825 | /* Apply default driver configuration. */ |
4795 | wl1271_conf_init(wl); | 4826 | wl1271_conf_init(wl); |
4827 | wl->bitrate_masks[IEEE80211_BAND_2GHZ] = wl->conf.tx.basic_rate; | ||
4828 | wl->bitrate_masks[IEEE80211_BAND_5GHZ] = wl->conf.tx.basic_rate_5; | ||
4796 | 4829 | ||
4797 | order = get_order(WL1271_AGGR_BUFFER_SIZE); | 4830 | order = get_order(WL1271_AGGR_BUFFER_SIZE); |
4798 | wl->aggr_buf = (u8 *)__get_free_pages(GFP_KERNEL, order); | 4831 | wl->aggr_buf = (u8 *)__get_free_pages(GFP_KERNEL, order); |