summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/wl12xx/init.c
diff options
context:
space:
mode:
authorArik Nemtsov <arik@wizery.com>2011-04-18 14:15:25 +0300
committerLuciano Coelho <coelho@ti.com>2011-05-02 10:31:13 +0300
commit70f474241b3d5fb633635a2ce39ea9da4afeea6c (patch)
treed2452d25284fe8a4a518c1c9986275109826140b /drivers/net/wireless/wl12xx/init.c
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/wireless/wl12xx/init.c')
-rw-r--r--drivers/net/wireless/wl12xx/init.c71
1 files changed, 53 insertions, 18 deletions
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)
static int wl1271_ap_hw_init(struct wl1271 *wl)
{
- int ret, i;
+ int ret;
ret = wl1271_ap_init_templates_config(wl);
if (ret < 0)
@@ -428,23 +428,7 @@ static int wl1271_ap_hw_init(struct wl1271 *wl)
if (ret < 0)
return ret;
- /* Configure initial TX rate classes */
- for (i = 0; i < wl->conf.tx.ac_conf_count; i++) {
- ret = wl1271_acx_ap_rate_policy(wl,
- &wl->conf.tx.ap_rc_conf[i], i);
- if (ret < 0)
- return ret;
- }
-
- ret = wl1271_acx_ap_rate_policy(wl,
- &wl->conf.tx.ap_mgmt_conf,
- ACX_TX_AP_MODE_MGMT_RATE);
- if (ret < 0)
- return ret;
-
- ret = wl1271_acx_ap_rate_policy(wl,
- &wl->conf.tx.ap_bcst_conf,
- ACX_TX_AP_MODE_BCST_RATE);
+ ret = wl1271_init_ap_rates(wl);
if (ret < 0)
return ret;
@@ -486,6 +470,57 @@ static int wl1271_ap_hw_init_post_mem(struct wl1271 *wl)
return 0;
}
+int wl1271_init_ap_rates(struct wl1271 *wl)
+{
+ int i, ret;
+ struct conf_tx_rate_class rc;
+ u32 supported_rates;
+
+ wl1271_debug(DEBUG_AP, "AP basic rate set: 0x%x", wl->basic_rate_set);
+
+ if (wl->basic_rate_set == 0)
+ return -EINVAL;
+
+ rc.enabled_rates = wl->basic_rate_set;
+ rc.long_retry_limit = 10;
+ rc.short_retry_limit = 10;
+ rc.aflags = 0;
+ ret = wl1271_acx_ap_rate_policy(wl, &rc, ACX_TX_AP_MODE_MGMT_RATE);
+ if (ret < 0)
+ return ret;
+
+ /* use the min basic rate for AP broadcast/multicast */
+ rc.enabled_rates = wl1271_tx_min_rate_get(wl);
+ rc.short_retry_limit = 10;
+ rc.long_retry_limit = 10;
+ rc.aflags = 0;
+ ret = wl1271_acx_ap_rate_policy(wl, &rc, ACX_TX_AP_MODE_BCST_RATE);
+ if (ret < 0)
+ return ret;
+
+ /*
+ * If the basic rates contain OFDM rates, use OFDM only
+ * rates for unicast TX as well. Else use all supported rates.
+ */
+ if ((wl->basic_rate_set & CONF_TX_OFDM_RATES))
+ supported_rates = CONF_TX_OFDM_RATES;
+ else
+ supported_rates = CONF_TX_AP_ENABLED_RATES;
+
+ /* configure unicast TX rate classes */
+ for (i = 0; i < wl->conf.tx.ac_conf_count; i++) {
+ rc.enabled_rates = supported_rates;
+ rc.short_retry_limit = 10;
+ rc.long_retry_limit = 10;
+ rc.aflags = 0;
+ ret = wl1271_acx_ap_rate_policy(wl, &rc, i);
+ if (ret < 0)
+ return ret;
+ }
+
+ return 0;
+}
+
static void wl1271_check_ba_support(struct wl1271 *wl)
{
/* validate FW cose ver x.x.x.50-60.x */