aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorArik Nemtsov <arik@wizery.com>2011-04-18 07:15:25 -0400
committerLuciano Coelho <coelho@ti.com>2011-05-02 03:31:13 -0400
commit70f474241b3d5fb633635a2ce39ea9da4afeea6c (patch)
treed2452d25284fe8a4a518c1c9986275109826140b /drivers/net
parent52dcaf577f3b6d878a337a44a99a122017c85ff6 (diff)
wl12xx: AP-mode - overhaul rate policy configuration
Use the minimal rate configured in the basic rates set as the AP broadcast and multicast rate. The minimal rate is used to ensure weak links can still communicate. When the basic rates contains at least one OFDM rate, configure all unicast TX rates to OFDM only. Unify rate configuration on initialization and on change notification into a single function. Signed-off-by: Arik Nemtsov <arik@wizery.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/wl12xx/acx.c3
-rw-r--r--drivers/net/wireless/wl12xx/conf.h22
-rw-r--r--drivers/net/wireless/wl12xx/init.c71
-rw-r--r--drivers/net/wireless/wl12xx/init.h1
-rw-r--r--drivers/net/wireless/wl12xx/main.c53
5 files changed, 65 insertions, 85 deletions
diff --git a/drivers/net/wireless/wl12xx/acx.c b/drivers/net/wireless/wl12xx/acx.c
index 6860d7e9df7..ec0156b3e27 100644
--- a/drivers/net/wireless/wl12xx/acx.c
+++ b/drivers/net/wireless/wl12xx/acx.c
@@ -841,7 +841,8 @@ int wl1271_acx_ap_rate_policy(struct wl1271 *wl, struct conf_tx_rate_class *c,
841 struct acx_ap_rate_policy *acx; 841 struct acx_ap_rate_policy *acx;
842 int ret = 0; 842 int ret = 0;
843 843
844 wl1271_debug(DEBUG_ACX, "acx ap rate policy"); 844 wl1271_debug(DEBUG_ACX, "acx ap rate policy %d rates 0x%x",
845 idx, c->enabled_rates);
845 846
846 acx = kzalloc(sizeof(*acx), GFP_KERNEL); 847 acx = kzalloc(sizeof(*acx), GFP_KERNEL);
847 if (!acx) { 848 if (!acx) {
diff --git a/drivers/net/wireless/wl12xx/conf.h b/drivers/net/wireless/wl12xx/conf.h
index 2ffbe3e0601..c0045f0b8b4 100644
--- a/drivers/net/wireless/wl12xx/conf.h
+++ b/drivers/net/wireless/wl12xx/conf.h
@@ -540,6 +540,12 @@ struct conf_rx_settings {
540 CONF_HW_BIT_RATE_36MBPS | CONF_HW_BIT_RATE_48MBPS | \ 540 CONF_HW_BIT_RATE_36MBPS | CONF_HW_BIT_RATE_48MBPS | \
541 CONF_HW_BIT_RATE_54MBPS) 541 CONF_HW_BIT_RATE_54MBPS)
542 542
543#define CONF_TX_OFDM_RATES (CONF_HW_BIT_RATE_6MBPS | \
544 CONF_HW_BIT_RATE_12MBPS | CONF_HW_BIT_RATE_24MBPS | \
545 CONF_HW_BIT_RATE_36MBPS | CONF_HW_BIT_RATE_48MBPS | \
546 CONF_HW_BIT_RATE_54MBPS)
547
548
543/* 549/*
544 * Default rates for management traffic when operating in AP mode. This 550 * Default rates for management traffic when operating in AP mode. This
545 * should be configured according to the basic rate set of the AP 551 * should be configured according to the basic rate set of the AP
@@ -705,22 +711,6 @@ struct conf_tx_settings {
705 struct conf_tx_ac_category ac_conf[CONF_TX_MAX_AC_COUNT]; 711 struct conf_tx_ac_category ac_conf[CONF_TX_MAX_AC_COUNT];
706 712
707 /* 713 /*
708 * Configuration for rate classes in AP-mode. These rate classes
709 * are for the AC TX queues
710 */
711 struct conf_tx_rate_class ap_rc_conf[CONF_TX_MAX_AC_COUNT];
712
713 /*
714 * Management TX rate class for AP-mode.
715 */
716 struct conf_tx_rate_class ap_mgmt_conf;
717
718 /*
719 * Broadcast TX rate class for AP-mode.
720 */
721 struct conf_tx_rate_class ap_bcst_conf;
722
723 /*
724 * Allow this number of TX retries to a connected station/AP before an 714 * Allow this number of TX retries to a connected station/AP before an
725 * event is triggered from FW. 715 * event is triggered from FW.
726 * In AP-mode the hlids of unreachable stations are given in the 716 * In AP-mode the hlids of unreachable stations are given in the
diff --git a/drivers/net/wireless/wl12xx/init.c b/drivers/net/wireless/wl12xx/init.c
index e0de041e38f..5d0ecd2018b 100644
--- a/drivers/net/wireless/wl12xx/init.c
+++ b/drivers/net/wireless/wl12xx/init.c
@@ -417,7 +417,7 @@ static int wl1271_sta_hw_init_post_mem(struct wl1271 *wl)
417 417
418static int wl1271_ap_hw_init(struct wl1271 *wl) 418static int wl1271_ap_hw_init(struct wl1271 *wl)
419{ 419{
420 int ret, i; 420 int ret;
421 421
422 ret = wl1271_ap_init_templates_config(wl); 422 ret = wl1271_ap_init_templates_config(wl);
423 if (ret < 0) 423 if (ret < 0)
@@ -428,23 +428,7 @@ static int wl1271_ap_hw_init(struct wl1271 *wl)
428 if (ret < 0) 428 if (ret < 0)
429 return ret; 429 return ret;
430 430
431 /* Configure initial TX rate classes */ 431 ret = wl1271_init_ap_rates(wl);
432 for (i = 0; i < wl->conf.tx.ac_conf_count; i++) {
433 ret = wl1271_acx_ap_rate_policy(wl,
434 &wl->conf.tx.ap_rc_conf[i], i);
435 if (ret < 0)
436 return ret;
437 }
438
439 ret = wl1271_acx_ap_rate_policy(wl,
440 &wl->conf.tx.ap_mgmt_conf,
441 ACX_TX_AP_MODE_MGMT_RATE);
442 if (ret < 0)
443 return ret;
444
445 ret = wl1271_acx_ap_rate_policy(wl,
446 &wl->conf.tx.ap_bcst_conf,
447 ACX_TX_AP_MODE_BCST_RATE);
448 if (ret < 0) 432 if (ret < 0)
449 return ret; 433 return ret;
450 434
@@ -486,6 +470,57 @@ static int wl1271_ap_hw_init_post_mem(struct wl1271 *wl)
486 return 0; 470 return 0;
487} 471}
488 472
473int wl1271_init_ap_rates(struct wl1271 *wl)
474{
475 int i, ret;
476 struct conf_tx_rate_class rc;
477 u32 supported_rates;
478
479 wl1271_debug(DEBUG_AP, "AP basic rate set: 0x%x", wl->basic_rate_set);
480
481 if (wl->basic_rate_set == 0)
482 return -EINVAL;
483
484 rc.enabled_rates = wl->basic_rate_set;
485 rc.long_retry_limit = 10;
486 rc.short_retry_limit = 10;
487 rc.aflags = 0;
488 ret = wl1271_acx_ap_rate_policy(wl, &rc, ACX_TX_AP_MODE_MGMT_RATE);
489 if (ret < 0)
490 return ret;
491
492 /* use the min basic rate for AP broadcast/multicast */
493 rc.enabled_rates = wl1271_tx_min_rate_get(wl);
494 rc.short_retry_limit = 10;
495 rc.long_retry_limit = 10;
496 rc.aflags = 0;
497 ret = wl1271_acx_ap_rate_policy(wl, &rc, ACX_TX_AP_MODE_BCST_RATE);
498 if (ret < 0)
499 return ret;
500
501 /*
502 * If the basic rates contain OFDM rates, use OFDM only
503 * rates for unicast TX as well. Else use all supported rates.
504 */
505 if ((wl->basic_rate_set & CONF_TX_OFDM_RATES))
506 supported_rates = CONF_TX_OFDM_RATES;
507 else
508 supported_rates = CONF_TX_AP_ENABLED_RATES;
509
510 /* configure unicast TX rate classes */
511 for (i = 0; i < wl->conf.tx.ac_conf_count; i++) {
512 rc.enabled_rates = supported_rates;
513 rc.short_retry_limit = 10;
514 rc.long_retry_limit = 10;
515 rc.aflags = 0;
516 ret = wl1271_acx_ap_rate_policy(wl, &rc, i);
517 if (ret < 0)
518 return ret;
519 }
520
521 return 0;
522}
523
489static void wl1271_check_ba_support(struct wl1271 *wl) 524static void wl1271_check_ba_support(struct wl1271 *wl)
490{ 525{
491 /* validate FW cose ver x.x.x.50-60.x */ 526 /* validate FW cose ver x.x.x.50-60.x */
diff --git a/drivers/net/wireless/wl12xx/init.h b/drivers/net/wireless/wl12xx/init.h
index 4975270a91a..0dd2414a30d 100644
--- a/drivers/net/wireless/wl12xx/init.h
+++ b/drivers/net/wireless/wl12xx/init.h
@@ -33,5 +33,6 @@ int wl1271_init_pta(struct wl1271 *wl);
33int wl1271_init_energy_detection(struct wl1271 *wl); 33int wl1271_init_energy_detection(struct wl1271 *wl);
34int wl1271_chip_specific_init(struct wl1271 *wl); 34int wl1271_chip_specific_init(struct wl1271 *wl);
35int wl1271_hw_init(struct wl1271 *wl); 35int wl1271_hw_init(struct wl1271 *wl);
36int wl1271_init_ap_rates(struct wl1271 *wl);
36 37
37#endif 38#endif
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
index 7b88dd2e85e..e9d4cf48ba3 100644
--- a/drivers/net/wireless/wl12xx/main.c
+++ b/drivers/net/wireless/wl12xx/main.c
@@ -209,44 +209,6 @@ static struct conf_drv_settings default_conf = {
209 .tx_op_limit = 1504, 209 .tx_op_limit = 1504,
210 }, 210 },
211 }, 211 },
212 .ap_rc_conf = {
213 [0] = {
214 .enabled_rates = CONF_TX_AP_ENABLED_RATES,
215 .short_retry_limit = 10,
216 .long_retry_limit = 10,
217 .aflags = 0,
218 },
219 [1] = {
220 .enabled_rates = CONF_TX_AP_ENABLED_RATES,
221 .short_retry_limit = 10,
222 .long_retry_limit = 10,
223 .aflags = 0,
224 },
225 [2] = {
226 .enabled_rates = CONF_TX_AP_ENABLED_RATES,
227 .short_retry_limit = 10,
228 .long_retry_limit = 10,
229 .aflags = 0,
230 },
231 [3] = {
232 .enabled_rates = CONF_TX_AP_ENABLED_RATES,
233 .short_retry_limit = 10,
234 .long_retry_limit = 10,
235 .aflags = 0,
236 },
237 },
238 .ap_mgmt_conf = {
239 .enabled_rates = CONF_TX_AP_DEFAULT_MGMT_RATES,
240 .short_retry_limit = 10,
241 .long_retry_limit = 10,
242 .aflags = 0,
243 },
244 .ap_bcst_conf = {
245 .enabled_rates = CONF_HW_BIT_RATE_1MBPS,
246 .short_retry_limit = 10,
247 .long_retry_limit = 10,
248 .aflags = 0,
249 },
250 .max_tx_retries = 100, 212 .max_tx_retries = 100,
251 .ap_aging_period = 300, 213 .ap_aging_period = 300,
252 .tid_conf_count = 4, 214 .tid_conf_count = 4,
@@ -2532,22 +2494,13 @@ static void wl1271_bss_info_changed_ap(struct wl1271 *wl,
2532 2494
2533 if ((changed & BSS_CHANGED_BASIC_RATES)) { 2495 if ((changed & BSS_CHANGED_BASIC_RATES)) {
2534 u32 rates = bss_conf->basic_rates; 2496 u32 rates = bss_conf->basic_rates;
2535 struct conf_tx_rate_class mgmt_rc;
2536 2497
2537 wl->basic_rate_set = wl1271_tx_enabled_rates_get(wl, rates); 2498 wl->basic_rate_set = wl1271_tx_enabled_rates_get(wl, rates);
2538 wl->basic_rate = wl1271_tx_min_rate_get(wl); 2499 wl->basic_rate = wl1271_tx_min_rate_get(wl);
2539 wl1271_debug(DEBUG_AP, "basic rates: 0x%x", 2500
2540 wl->basic_rate_set); 2501 ret = wl1271_init_ap_rates(wl);
2541
2542 /* update the AP management rate policy with the new rates */
2543 mgmt_rc.enabled_rates = wl->basic_rate_set;
2544 mgmt_rc.long_retry_limit = 10;
2545 mgmt_rc.short_retry_limit = 10;
2546 mgmt_rc.aflags = 0;
2547 ret = wl1271_acx_ap_rate_policy(wl, &mgmt_rc,
2548 ACX_TX_AP_MODE_MGMT_RATE);
2549 if (ret < 0) { 2502 if (ret < 0) {
2550 wl1271_error("AP mgmt policy change failed %d", ret); 2503 wl1271_error("AP rate policy change failed %d", ret);
2551 goto out; 2504 goto out;
2552 } 2505 }
2553 } 2506 }