diff options
Diffstat (limited to 'drivers/net/wireless/wl12xx/main.c')
-rw-r--r-- | drivers/net/wireless/wl12xx/main.c | 70 |
1 files changed, 44 insertions, 26 deletions
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c index 901e43a8334b..0c43cf55f9bf 100644 --- a/drivers/net/wireless/wl12xx/main.c +++ b/drivers/net/wireless/wl12xx/main.c | |||
@@ -1837,6 +1837,11 @@ static u8 wl12xx_get_role_type(struct wl1271 *wl) | |||
1837 | return WL12XX_INVALID_ROLE_TYPE; | 1837 | return WL12XX_INVALID_ROLE_TYPE; |
1838 | } | 1838 | } |
1839 | 1839 | ||
1840 | static void wl12xx_init_vif_data(struct wl12xx_vif *wlvif) | ||
1841 | { | ||
1842 | wlvif->basic_rate_set = CONF_TX_RATE_MASK_BASIC; | ||
1843 | } | ||
1844 | |||
1840 | static int wl1271_op_add_interface(struct ieee80211_hw *hw, | 1845 | static int wl1271_op_add_interface(struct ieee80211_hw *hw, |
1841 | struct ieee80211_vif *vif) | 1846 | struct ieee80211_vif *vif) |
1842 | { | 1847 | { |
@@ -1857,6 +1862,7 @@ static int wl1271_op_add_interface(struct ieee80211_hw *hw, | |||
1857 | ret = -EBUSY; | 1862 | ret = -EBUSY; |
1858 | goto out; | 1863 | goto out; |
1859 | } | 1864 | } |
1865 | wl12xx_init_vif_data(wl12xx_vif_to_data(vif)); | ||
1860 | 1866 | ||
1861 | /* | 1867 | /* |
1862 | * in some very corner case HW recovery scenarios its possible to | 1868 | * in some very corner case HW recovery scenarios its possible to |
@@ -2163,7 +2169,8 @@ static void wl1271_op_remove_interface(struct ieee80211_hw *hw, | |||
2163 | cancel_work_sync(&wl->recovery_work); | 2169 | cancel_work_sync(&wl->recovery_work); |
2164 | } | 2170 | } |
2165 | 2171 | ||
2166 | static int wl1271_join(struct wl1271 *wl, bool set_assoc) | 2172 | static int wl1271_join(struct wl1271 *wl, struct wl12xx_vif *wlvif, |
2173 | bool set_assoc) | ||
2167 | { | 2174 | { |
2168 | int ret; | 2175 | int ret; |
2169 | bool is_ibss = (wl->bss_type == BSS_TYPE_IBSS); | 2176 | bool is_ibss = (wl->bss_type == BSS_TYPE_IBSS); |
@@ -2184,9 +2191,9 @@ static int wl1271_join(struct wl1271 *wl, bool set_assoc) | |||
2184 | set_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags); | 2191 | set_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags); |
2185 | 2192 | ||
2186 | if (is_ibss) | 2193 | if (is_ibss) |
2187 | ret = wl12xx_cmd_role_start_ibss(wl); | 2194 | ret = wl12xx_cmd_role_start_ibss(wl, wlvif); |
2188 | else | 2195 | else |
2189 | ret = wl12xx_cmd_role_start_sta(wl); | 2196 | ret = wl12xx_cmd_role_start_sta(wl, wlvif); |
2190 | if (ret < 0) | 2197 | if (ret < 0) |
2191 | goto out; | 2198 | goto out; |
2192 | 2199 | ||
@@ -2244,10 +2251,10 @@ out: | |||
2244 | return ret; | 2251 | return ret; |
2245 | } | 2252 | } |
2246 | 2253 | ||
2247 | static void wl1271_set_band_rate(struct wl1271 *wl) | 2254 | static void wl1271_set_band_rate(struct wl1271 *wl, struct wl12xx_vif *wlvif) |
2248 | { | 2255 | { |
2249 | wl->basic_rate_set = wl->bitrate_masks[wl->band]; | 2256 | wlvif->basic_rate_set = wl->bitrate_masks[wl->band]; |
2250 | wl->rate_set = wl->basic_rate_set; | 2257 | wl->rate_set = wlvif->basic_rate_set; |
2251 | } | 2258 | } |
2252 | 2259 | ||
2253 | static bool wl12xx_is_roc(struct wl1271 *wl) | 2260 | static bool wl12xx_is_roc(struct wl1271 *wl) |
@@ -2261,7 +2268,8 @@ static bool wl12xx_is_roc(struct wl1271 *wl) | |||
2261 | return true; | 2268 | return true; |
2262 | } | 2269 | } |
2263 | 2270 | ||
2264 | static int wl1271_sta_handle_idle(struct wl1271 *wl, bool idle) | 2271 | static int wl1271_sta_handle_idle(struct wl1271 *wl, struct wl12xx_vif *wlvif, |
2272 | bool idle) | ||
2265 | { | 2273 | { |
2266 | int ret; | 2274 | int ret; |
2267 | 2275 | ||
@@ -2276,7 +2284,8 @@ static int wl1271_sta_handle_idle(struct wl1271 *wl, bool idle) | |||
2276 | if (ret < 0) | 2284 | if (ret < 0) |
2277 | goto out; | 2285 | goto out; |
2278 | } | 2286 | } |
2279 | wl->rate_set = wl1271_tx_min_rate_get(wl, wl->basic_rate_set); | 2287 | wl->rate_set = wl1271_tx_min_rate_get(wl, |
2288 | wlvif->basic_rate_set); | ||
2280 | ret = wl1271_acx_sta_rate_policies(wl); | 2289 | ret = wl1271_acx_sta_rate_policies(wl); |
2281 | if (ret < 0) | 2290 | if (ret < 0) |
2282 | goto out; | 2291 | goto out; |
@@ -2310,6 +2319,8 @@ out: | |||
2310 | static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed) | 2319 | static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed) |
2311 | { | 2320 | { |
2312 | struct wl1271 *wl = hw->priv; | 2321 | struct wl1271 *wl = hw->priv; |
2322 | struct ieee80211_vif *vif = wl->vif; /* TODO: reconfig all vifs */ | ||
2323 | struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); | ||
2313 | struct ieee80211_conf *conf = &hw->conf; | 2324 | struct ieee80211_conf *conf = &hw->conf; |
2314 | int channel, ret = 0; | 2325 | int channel, ret = 0; |
2315 | bool is_ap; | 2326 | bool is_ap; |
@@ -2371,10 +2382,11 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed) | |||
2371 | * association frames and other control messages. | 2382 | * association frames and other control messages. |
2372 | */ | 2383 | */ |
2373 | if (!test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) | 2384 | if (!test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) |
2374 | wl1271_set_band_rate(wl); | 2385 | wl1271_set_band_rate(wl, wlvif); |
2375 | 2386 | ||
2376 | wl->basic_rate = | 2387 | wl->basic_rate = |
2377 | wl1271_tx_min_rate_get(wl, wl->basic_rate_set); | 2388 | wl1271_tx_min_rate_get(wl, |
2389 | wlvif->basic_rate_set); | ||
2378 | ret = wl1271_acx_sta_rate_policies(wl); | 2390 | ret = wl1271_acx_sta_rate_policies(wl); |
2379 | if (ret < 0) | 2391 | if (ret < 0) |
2380 | wl1271_warning("rate policy for channel " | 2392 | wl1271_warning("rate policy for channel " |
@@ -2387,7 +2399,7 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed) | |||
2387 | if (ret < 0) | 2399 | if (ret < 0) |
2388 | goto out_sleep; | 2400 | goto out_sleep; |
2389 | } | 2401 | } |
2390 | ret = wl1271_join(wl, false); | 2402 | ret = wl1271_join(wl, wlvif, false); |
2391 | if (ret < 0) | 2403 | if (ret < 0) |
2392 | wl1271_warning("cmd join on channel " | 2404 | wl1271_warning("cmd join on channel " |
2393 | "failed %d", ret); | 2405 | "failed %d", ret); |
@@ -2413,7 +2425,7 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed) | |||
2413 | } | 2425 | } |
2414 | 2426 | ||
2415 | if (changed & IEEE80211_CONF_CHANGE_IDLE && !is_ap) { | 2427 | if (changed & IEEE80211_CONF_CHANGE_IDLE && !is_ap) { |
2416 | ret = wl1271_sta_handle_idle(wl, | 2428 | ret = wl1271_sta_handle_idle(wl, wlvif, |
2417 | conf->flags & IEEE80211_CONF_IDLE); | 2429 | conf->flags & IEEE80211_CONF_IDLE); |
2418 | if (ret < 0) | 2430 | if (ret < 0) |
2419 | wl1271_warning("idle mode change failed %d", ret); | 2431 | wl1271_warning("idle mode change failed %d", ret); |
@@ -3207,6 +3219,7 @@ static int wl1271_bss_beacon_info_changed(struct wl1271 *wl, | |||
3207 | struct ieee80211_bss_conf *bss_conf, | 3219 | struct ieee80211_bss_conf *bss_conf, |
3208 | u32 changed) | 3220 | u32 changed) |
3209 | { | 3221 | { |
3222 | struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); | ||
3210 | bool is_ap = (wl->bss_type == BSS_TYPE_AP_BSS); | 3223 | bool is_ap = (wl->bss_type == BSS_TYPE_AP_BSS); |
3211 | int ret = 0; | 3224 | int ret = 0; |
3212 | 3225 | ||
@@ -3235,7 +3248,7 @@ static int wl1271_bss_beacon_info_changed(struct wl1271 *wl, | |||
3235 | dev_kfree_skb(beacon); | 3248 | dev_kfree_skb(beacon); |
3236 | goto out; | 3249 | goto out; |
3237 | } | 3250 | } |
3238 | min_rate = wl1271_tx_min_rate_get(wl, wl->basic_rate_set); | 3251 | min_rate = wl1271_tx_min_rate_get(wl, wlvif->basic_rate_set); |
3239 | tmpl_id = is_ap ? CMD_TEMPL_AP_BEACON : | 3252 | tmpl_id = is_ap ? CMD_TEMPL_AP_BEACON : |
3240 | CMD_TEMPL_BEACON; | 3253 | CMD_TEMPL_BEACON; |
3241 | ret = wl1271_cmd_template_set(wl, tmpl_id, | 3254 | ret = wl1271_cmd_template_set(wl, tmpl_id, |
@@ -3290,17 +3303,18 @@ static void wl1271_bss_info_changed_ap(struct wl1271 *wl, | |||
3290 | struct ieee80211_bss_conf *bss_conf, | 3303 | struct ieee80211_bss_conf *bss_conf, |
3291 | u32 changed) | 3304 | u32 changed) |
3292 | { | 3305 | { |
3306 | struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); | ||
3293 | int ret = 0; | 3307 | int ret = 0; |
3294 | 3308 | ||
3295 | if ((changed & BSS_CHANGED_BASIC_RATES)) { | 3309 | if ((changed & BSS_CHANGED_BASIC_RATES)) { |
3296 | u32 rates = bss_conf->basic_rates; | 3310 | u32 rates = bss_conf->basic_rates; |
3297 | 3311 | ||
3298 | wl->basic_rate_set = wl1271_tx_enabled_rates_get(wl, rates, | 3312 | wlvif->basic_rate_set = wl1271_tx_enabled_rates_get(wl, rates, |
3299 | wl->band); | 3313 | wl->band); |
3300 | wl->basic_rate = wl1271_tx_min_rate_get(wl, | 3314 | wl->basic_rate = wl1271_tx_min_rate_get(wl, |
3301 | wl->basic_rate_set); | 3315 | wlvif->basic_rate_set); |
3302 | 3316 | ||
3303 | ret = wl1271_init_ap_rates(wl); | 3317 | ret = wl1271_init_ap_rates(wl, wlvif); |
3304 | if (ret < 0) { | 3318 | if (ret < 0) { |
3305 | wl1271_error("AP rate policy change failed %d", ret); | 3319 | wl1271_error("AP rate policy change failed %d", ret); |
3306 | goto out; | 3320 | goto out; |
@@ -3318,7 +3332,7 @@ static void wl1271_bss_info_changed_ap(struct wl1271 *wl, | |||
3318 | if ((changed & BSS_CHANGED_BEACON_ENABLED)) { | 3332 | if ((changed & BSS_CHANGED_BEACON_ENABLED)) { |
3319 | if (bss_conf->enable_beacon) { | 3333 | if (bss_conf->enable_beacon) { |
3320 | if (!test_bit(WL1271_FLAG_AP_STARTED, &wl->flags)) { | 3334 | if (!test_bit(WL1271_FLAG_AP_STARTED, &wl->flags)) { |
3321 | ret = wl12xx_cmd_role_start_ap(wl); | 3335 | ret = wl12xx_cmd_role_start_ap(wl, wlvif); |
3322 | if (ret < 0) | 3336 | if (ret < 0) |
3323 | goto out; | 3337 | goto out; |
3324 | 3338 | ||
@@ -3366,6 +3380,7 @@ static void wl1271_bss_info_changed_sta(struct wl1271 *wl, | |||
3366 | struct ieee80211_bss_conf *bss_conf, | 3380 | struct ieee80211_bss_conf *bss_conf, |
3367 | u32 changed) | 3381 | u32 changed) |
3368 | { | 3382 | { |
3383 | struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); | ||
3369 | bool do_join = false, set_assoc = false; | 3384 | bool do_join = false, set_assoc = false; |
3370 | bool is_ibss = (wl->bss_type == BSS_TYPE_IBSS); | 3385 | bool is_ibss = (wl->bss_type == BSS_TYPE_IBSS); |
3371 | bool ibss_joined = false; | 3386 | bool ibss_joined = false; |
@@ -3480,11 +3495,12 @@ sta_not_found: | |||
3480 | * to use with control frames. | 3495 | * to use with control frames. |
3481 | */ | 3496 | */ |
3482 | rates = bss_conf->basic_rates; | 3497 | rates = bss_conf->basic_rates; |
3483 | wl->basic_rate_set = | 3498 | wlvif->basic_rate_set = |
3484 | wl1271_tx_enabled_rates_get(wl, rates, | 3499 | wl1271_tx_enabled_rates_get(wl, rates, |
3485 | wl->band); | 3500 | wl->band); |
3486 | wl->basic_rate = | 3501 | wl->basic_rate = |
3487 | wl1271_tx_min_rate_get(wl, wl->basic_rate_set); | 3502 | wl1271_tx_min_rate_get(wl, |
3503 | wlvif->basic_rate_set); | ||
3488 | if (sta_rate_set) | 3504 | if (sta_rate_set) |
3489 | wl->rate_set = wl1271_tx_enabled_rates_get(wl, | 3505 | wl->rate_set = wl1271_tx_enabled_rates_get(wl, |
3490 | sta_rate_set, | 3506 | sta_rate_set, |
@@ -3499,7 +3515,7 @@ sta_not_found: | |||
3499 | * updates it by itself when the first beacon is | 3515 | * updates it by itself when the first beacon is |
3500 | * received after a join. | 3516 | * received after a join. |
3501 | */ | 3517 | */ |
3502 | ret = wl1271_cmd_build_ps_poll(wl, wl->aid); | 3518 | ret = wl1271_cmd_build_ps_poll(wl, wlvif, wl->aid); |
3503 | if (ret < 0) | 3519 | if (ret < 0) |
3504 | goto out; | 3520 | goto out; |
3505 | 3521 | ||
@@ -3534,9 +3550,10 @@ sta_not_found: | |||
3534 | ieee80211_enable_dyn_ps(wl->vif); | 3550 | ieee80211_enable_dyn_ps(wl->vif); |
3535 | 3551 | ||
3536 | /* revert back to minimum rates for the current band */ | 3552 | /* revert back to minimum rates for the current band */ |
3537 | wl1271_set_band_rate(wl); | 3553 | wl1271_set_band_rate(wl, wlvif); |
3538 | wl->basic_rate = | 3554 | wl->basic_rate = |
3539 | wl1271_tx_min_rate_get(wl, wl->basic_rate_set); | 3555 | wl1271_tx_min_rate_get(wl, |
3556 | wlvif->basic_rate_set); | ||
3540 | ret = wl1271_acx_sta_rate_policies(wl); | 3557 | ret = wl1271_acx_sta_rate_policies(wl); |
3541 | if (ret < 0) | 3558 | if (ret < 0) |
3542 | goto out; | 3559 | goto out; |
@@ -3587,11 +3604,12 @@ sta_not_found: | |||
3587 | 3604 | ||
3588 | if (bss_conf->ibss_joined) { | 3605 | if (bss_conf->ibss_joined) { |
3589 | u32 rates = bss_conf->basic_rates; | 3606 | u32 rates = bss_conf->basic_rates; |
3590 | wl->basic_rate_set = | 3607 | wlvif->basic_rate_set = |
3591 | wl1271_tx_enabled_rates_get(wl, rates, | 3608 | wl1271_tx_enabled_rates_get(wl, rates, |
3592 | wl->band); | 3609 | wl->band); |
3593 | wl->basic_rate = | 3610 | wl->basic_rate = |
3594 | wl1271_tx_min_rate_get(wl, wl->basic_rate_set); | 3611 | wl1271_tx_min_rate_get(wl, |
3612 | wlvif->basic_rate_set); | ||
3595 | 3613 | ||
3596 | /* by default, use 11b + OFDM rates */ | 3614 | /* by default, use 11b + OFDM rates */ |
3597 | wl->rate_set = CONF_TX_IBSS_DEFAULT_RATES; | 3615 | wl->rate_set = CONF_TX_IBSS_DEFAULT_RATES; |
@@ -3634,7 +3652,7 @@ sta_not_found: | |||
3634 | } | 3652 | } |
3635 | 3653 | ||
3636 | if (do_join) { | 3654 | if (do_join) { |
3637 | ret = wl1271_join(wl, set_assoc); | 3655 | ret = wl1271_join(wl, wlvif, set_assoc); |
3638 | if (ret < 0) { | 3656 | if (ret < 0) { |
3639 | wl1271_warning("cmd join failed %d", ret); | 3657 | wl1271_warning("cmd join failed %d", ret); |
3640 | goto out; | 3658 | goto out; |
@@ -4750,6 +4768,7 @@ int wl1271_init_ieee80211(struct wl1271 *wl) | |||
4750 | SET_IEEE80211_DEV(wl->hw, wl1271_wl_to_dev(wl)); | 4768 | SET_IEEE80211_DEV(wl->hw, wl1271_wl_to_dev(wl)); |
4751 | 4769 | ||
4752 | wl->hw->sta_data_size = sizeof(struct wl1271_station); | 4770 | wl->hw->sta_data_size = sizeof(struct wl1271_station); |
4771 | wl->hw->vif_data_size = sizeof(struct wl12xx_vif); | ||
4753 | 4772 | ||
4754 | wl->hw->max_rx_aggregation_subframes = 8; | 4773 | wl->hw->max_rx_aggregation_subframes = 8; |
4755 | 4774 | ||
@@ -4824,7 +4843,6 @@ struct ieee80211_hw *wl1271_alloc_hw(void) | |||
4824 | wl->rx_counter = 0; | 4843 | wl->rx_counter = 0; |
4825 | wl->psm_entry_retry = 0; | 4844 | wl->psm_entry_retry = 0; |
4826 | wl->power_level = WL1271_DEFAULT_POWER_LEVEL; | 4845 | wl->power_level = WL1271_DEFAULT_POWER_LEVEL; |
4827 | wl->basic_rate_set = CONF_TX_RATE_MASK_BASIC; | ||
4828 | wl->basic_rate = CONF_TX_RATE_MASK_BASIC; | 4846 | wl->basic_rate = CONF_TX_RATE_MASK_BASIC; |
4829 | wl->rate_set = CONF_TX_RATE_MASK_BASIC; | 4847 | wl->rate_set = CONF_TX_RATE_MASK_BASIC; |
4830 | wl->band = IEEE80211_BAND_2GHZ; | 4848 | wl->band = IEEE80211_BAND_2GHZ; |