diff options
author | Arik Nemtsov <arik@wizery.com> | 2011-04-18 07:15:21 -0400 |
---|---|---|
committer | Luciano Coelho <coelho@ti.com> | 2011-05-02 03:29:20 -0400 |
commit | 5f704d180e448d05859e1cb6572822ba27dbcdc7 (patch) | |
tree | b82bf4812c6d99e0c532a71a067f8c15ecc0a4d1 | |
parent | 801f870bc0524bad7ebef9cea52d20e4d4992e4a (diff) |
wl12xx: use wiphy values for setting rts, frag thresholds on init
Use the wiphy RTS and fragmentation thresholds for initializing the FW
when possible. This mitigates a bug where previously set values are
forgotten after interface down/up.
Add checks before settings these values to ensure they are valid. Use
default values when invalid thresholds are configured.
Update the default RTS threshold to the maximum value given by the
specification.
Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
-rw-r--r-- | drivers/net/wireless/wl12xx/acx.c | 26 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/acx.h | 4 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/init.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/main.c | 6 |
4 files changed, 27 insertions, 13 deletions
diff --git a/drivers/net/wireless/wl12xx/acx.c b/drivers/net/wireless/wl12xx/acx.c index 2b5fb3d2df1b..729f72a7b912 100644 --- a/drivers/net/wireless/wl12xx/acx.c +++ b/drivers/net/wireless/wl12xx/acx.c | |||
@@ -325,12 +325,19 @@ out: | |||
325 | return ret; | 325 | return ret; |
326 | } | 326 | } |
327 | 327 | ||
328 | int wl1271_acx_rts_threshold(struct wl1271 *wl, u16 rts_threshold) | 328 | int wl1271_acx_rts_threshold(struct wl1271 *wl, u32 rts_threshold) |
329 | { | 329 | { |
330 | struct acx_rts_threshold *rts; | 330 | struct acx_rts_threshold *rts; |
331 | int ret; | 331 | int ret; |
332 | 332 | ||
333 | wl1271_debug(DEBUG_ACX, "acx rts threshold"); | 333 | /* |
334 | * If the RTS threshold is not configured or out of range, use the | ||
335 | * default value. | ||
336 | */ | ||
337 | if (rts_threshold > IEEE80211_MAX_RTS_THRESHOLD) | ||
338 | rts_threshold = wl->conf.rx.rts_threshold; | ||
339 | |||
340 | wl1271_debug(DEBUG_ACX, "acx rts threshold: %d", rts_threshold); | ||
334 | 341 | ||
335 | rts = kzalloc(sizeof(*rts), GFP_KERNEL); | 342 | rts = kzalloc(sizeof(*rts), GFP_KERNEL); |
336 | if (!rts) { | 343 | if (!rts) { |
@@ -338,7 +345,7 @@ int wl1271_acx_rts_threshold(struct wl1271 *wl, u16 rts_threshold) | |||
338 | goto out; | 345 | goto out; |
339 | } | 346 | } |
340 | 347 | ||
341 | rts->threshold = cpu_to_le16(rts_threshold); | 348 | rts->threshold = cpu_to_le16((u16)rts_threshold); |
342 | 349 | ||
343 | ret = wl1271_cmd_configure(wl, DOT11_RTS_THRESHOLD, rts, sizeof(*rts)); | 350 | ret = wl1271_cmd_configure(wl, DOT11_RTS_THRESHOLD, rts, sizeof(*rts)); |
344 | if (ret < 0) { | 351 | if (ret < 0) { |
@@ -928,12 +935,19 @@ out: | |||
928 | return ret; | 935 | return ret; |
929 | } | 936 | } |
930 | 937 | ||
931 | int wl1271_acx_frag_threshold(struct wl1271 *wl, u16 frag_threshold) | 938 | int wl1271_acx_frag_threshold(struct wl1271 *wl, u32 frag_threshold) |
932 | { | 939 | { |
933 | struct acx_frag_threshold *acx; | 940 | struct acx_frag_threshold *acx; |
934 | int ret = 0; | 941 | int ret = 0; |
935 | 942 | ||
936 | wl1271_debug(DEBUG_ACX, "acx frag threshold"); | 943 | /* |
944 | * If the fragmentation is not configured or out of range, use the | ||
945 | * default value. | ||
946 | */ | ||
947 | if (frag_threshold > IEEE80211_MAX_FRAG_THRESHOLD) | ||
948 | frag_threshold = wl->conf.tx.frag_threshold; | ||
949 | |||
950 | wl1271_debug(DEBUG_ACX, "acx frag threshold: %d", frag_threshold); | ||
937 | 951 | ||
938 | acx = kzalloc(sizeof(*acx), GFP_KERNEL); | 952 | acx = kzalloc(sizeof(*acx), GFP_KERNEL); |
939 | 953 | ||
@@ -942,7 +956,7 @@ int wl1271_acx_frag_threshold(struct wl1271 *wl, u16 frag_threshold) | |||
942 | goto out; | 956 | goto out; |
943 | } | 957 | } |
944 | 958 | ||
945 | acx->frag_threshold = cpu_to_le16(frag_threshold); | 959 | acx->frag_threshold = cpu_to_le16((u16)frag_threshold); |
946 | ret = wl1271_cmd_configure(wl, ACX_FRAG_CFG, acx, sizeof(*acx)); | 960 | ret = wl1271_cmd_configure(wl, ACX_FRAG_CFG, acx, sizeof(*acx)); |
947 | if (ret < 0) { | 961 | if (ret < 0) { |
948 | wl1271_warning("Setting of frag threshold failed: %d", ret); | 962 | wl1271_warning("Setting of frag threshold failed: %d", ret); |
diff --git a/drivers/net/wireless/wl12xx/acx.h b/drivers/net/wireless/wl12xx/acx.h index cd7548dacd59..828367d62668 100644 --- a/drivers/net/wireless/wl12xx/acx.h +++ b/drivers/net/wireless/wl12xx/acx.h | |||
@@ -1333,7 +1333,7 @@ int wl1271_acx_slot(struct wl1271 *wl, enum acx_slot_type slot_time); | |||
1333 | int wl1271_acx_group_address_tbl(struct wl1271 *wl, bool enable, | 1333 | int wl1271_acx_group_address_tbl(struct wl1271 *wl, bool enable, |
1334 | void *mc_list, u32 mc_list_len); | 1334 | void *mc_list, u32 mc_list_len); |
1335 | int wl1271_acx_service_period_timeout(struct wl1271 *wl); | 1335 | int wl1271_acx_service_period_timeout(struct wl1271 *wl); |
1336 | int wl1271_acx_rts_threshold(struct wl1271 *wl, u16 rts_threshold); | 1336 | int wl1271_acx_rts_threshold(struct wl1271 *wl, u32 rts_threshold); |
1337 | int wl1271_acx_dco_itrim_params(struct wl1271 *wl); | 1337 | int wl1271_acx_dco_itrim_params(struct wl1271 *wl); |
1338 | int wl1271_acx_beacon_filter_opt(struct wl1271 *wl, bool enable_filter); | 1338 | int wl1271_acx_beacon_filter_opt(struct wl1271 *wl, bool enable_filter); |
1339 | int wl1271_acx_beacon_filter_table(struct wl1271 *wl); | 1339 | int wl1271_acx_beacon_filter_table(struct wl1271 *wl); |
@@ -1357,7 +1357,7 @@ int wl1271_acx_ac_cfg(struct wl1271 *wl, u8 ac, u8 cw_min, u16 cw_max, | |||
1357 | int wl1271_acx_tid_cfg(struct wl1271 *wl, u8 queue_id, u8 channel_type, | 1357 | int wl1271_acx_tid_cfg(struct wl1271 *wl, u8 queue_id, u8 channel_type, |
1358 | u8 tsid, u8 ps_scheme, u8 ack_policy, | 1358 | u8 tsid, u8 ps_scheme, u8 ack_policy, |
1359 | u32 apsd_conf0, u32 apsd_conf1); | 1359 | u32 apsd_conf0, u32 apsd_conf1); |
1360 | int wl1271_acx_frag_threshold(struct wl1271 *wl, u16 frag_threshold); | 1360 | int wl1271_acx_frag_threshold(struct wl1271 *wl, u32 frag_threshold); |
1361 | int wl1271_acx_tx_config_options(struct wl1271 *wl); | 1361 | int wl1271_acx_tx_config_options(struct wl1271 *wl); |
1362 | int wl1271_acx_ap_mem_cfg(struct wl1271 *wl); | 1362 | int wl1271_acx_ap_mem_cfg(struct wl1271 *wl); |
1363 | int wl1271_acx_sta_mem_cfg(struct wl1271 *wl); | 1363 | int wl1271_acx_sta_mem_cfg(struct wl1271 *wl); |
diff --git a/drivers/net/wireless/wl12xx/init.c b/drivers/net/wireless/wl12xx/init.c index 1be656914785..060ca31818eb 100644 --- a/drivers/net/wireless/wl12xx/init.c +++ b/drivers/net/wireless/wl12xx/init.c | |||
@@ -258,7 +258,7 @@ int wl1271_init_phy_config(struct wl1271 *wl) | |||
258 | if (ret < 0) | 258 | if (ret < 0) |
259 | return ret; | 259 | return ret; |
260 | 260 | ||
261 | ret = wl1271_acx_rts_threshold(wl, wl->conf.rx.rts_threshold); | 261 | ret = wl1271_acx_rts_threshold(wl, wl->hw->wiphy->rts_threshold); |
262 | if (ret < 0) | 262 | if (ret < 0) |
263 | return ret; | 263 | return ret; |
264 | 264 | ||
@@ -614,7 +614,7 @@ int wl1271_hw_init(struct wl1271 *wl) | |||
614 | goto out_free_memmap; | 614 | goto out_free_memmap; |
615 | 615 | ||
616 | /* Default fragmentation threshold */ | 616 | /* Default fragmentation threshold */ |
617 | ret = wl1271_acx_frag_threshold(wl, wl->conf.tx.frag_threshold); | 617 | ret = wl1271_acx_frag_threshold(wl, wl->hw->wiphy->frag_threshold); |
618 | if (ret < 0) | 618 | if (ret < 0) |
619 | goto out_free_memmap; | 619 | goto out_free_memmap; |
620 | 620 | ||
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c index 5f8bb35c6475..81a0c8ed5a4a 100644 --- a/drivers/net/wireless/wl12xx/main.c +++ b/drivers/net/wireless/wl12xx/main.c | |||
@@ -163,7 +163,7 @@ static struct conf_drv_settings default_conf = { | |||
163 | .packet_detection_threshold = 0, | 163 | .packet_detection_threshold = 0, |
164 | .ps_poll_timeout = 15, | 164 | .ps_poll_timeout = 15, |
165 | .upsd_timeout = 15, | 165 | .upsd_timeout = 15, |
166 | .rts_threshold = 2347, | 166 | .rts_threshold = IEEE80211_MAX_RTS_THRESHOLD, |
167 | .rx_cca_threshold = 0, | 167 | .rx_cca_threshold = 0, |
168 | .irq_blk_threshold = 0xFFFF, | 168 | .irq_blk_threshold = 0xFFFF, |
169 | .irq_pkt_threshold = 0, | 169 | .irq_pkt_threshold = 0, |
@@ -2360,7 +2360,7 @@ static int wl1271_op_set_frag_threshold(struct ieee80211_hw *hw, u32 value) | |||
2360 | if (ret < 0) | 2360 | if (ret < 0) |
2361 | goto out; | 2361 | goto out; |
2362 | 2362 | ||
2363 | ret = wl1271_acx_frag_threshold(wl, (u16)value); | 2363 | ret = wl1271_acx_frag_threshold(wl, value); |
2364 | if (ret < 0) | 2364 | if (ret < 0) |
2365 | wl1271_warning("wl1271_op_set_frag_threshold failed: %d", ret); | 2365 | wl1271_warning("wl1271_op_set_frag_threshold failed: %d", ret); |
2366 | 2366 | ||
@@ -2388,7 +2388,7 @@ static int wl1271_op_set_rts_threshold(struct ieee80211_hw *hw, u32 value) | |||
2388 | if (ret < 0) | 2388 | if (ret < 0) |
2389 | goto out; | 2389 | goto out; |
2390 | 2390 | ||
2391 | ret = wl1271_acx_rts_threshold(wl, (u16) value); | 2391 | ret = wl1271_acx_rts_threshold(wl, value); |
2392 | if (ret < 0) | 2392 | if (ret < 0) |
2393 | wl1271_warning("wl1271_op_set_rts_threshold failed: %d", ret); | 2393 | wl1271_warning("wl1271_op_set_rts_threshold failed: %d", ret); |
2394 | 2394 | ||