wl12xx: AP-mode - overhaul rate policy configuration
authorArik Nemtsov <arik@wizery.com>
Mon, 18 Apr 2011 11:15:25 +0000 (14:15 +0300)
committerLuciano Coelho <coelho@ti.com>
Mon, 2 May 2011 07:31:13 +0000 (10:31 +0300)
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>
drivers/net/wireless/wl12xx/acx.c
drivers/net/wireless/wl12xx/conf.h
drivers/net/wireless/wl12xx/init.c
drivers/net/wireless/wl12xx/init.h
drivers/net/wireless/wl12xx/main.c

index 6860d7e..ec0156b 100644 (file)
@@ -841,7 +841,8 @@ int wl1271_acx_ap_rate_policy(struct wl1271 *wl, struct conf_tx_rate_class *c,
        struct acx_ap_rate_policy *acx;
        int ret = 0;
 
-       wl1271_debug(DEBUG_ACX, "acx ap rate policy");
+       wl1271_debug(DEBUG_ACX, "acx ap rate policy %d rates 0x%x",
+                    idx, c->enabled_rates);
 
        acx = kzalloc(sizeof(*acx), GFP_KERNEL);
        if (!acx) {
index 2ffbe3e..c0045f0 100644 (file)
@@ -540,6 +540,12 @@ struct conf_rx_settings {
        CONF_HW_BIT_RATE_36MBPS | CONF_HW_BIT_RATE_48MBPS |      \
        CONF_HW_BIT_RATE_54MBPS)
 
+#define CONF_TX_OFDM_RATES (CONF_HW_BIT_RATE_6MBPS |             \
+       CONF_HW_BIT_RATE_12MBPS | CONF_HW_BIT_RATE_24MBPS |      \
+       CONF_HW_BIT_RATE_36MBPS | CONF_HW_BIT_RATE_48MBPS |      \
+       CONF_HW_BIT_RATE_54MBPS)
+
+
 /*
  * Default rates for management traffic when operating in AP mode. This
  * should be configured according to the basic rate set of the AP
@@ -704,22 +710,6 @@ struct conf_tx_settings {
        u8 ac_conf_count;
        struct conf_tx_ac_category ac_conf[CONF_TX_MAX_AC_COUNT];
 
-       /*
-        * Configuration for rate classes in AP-mode. These rate classes
-        * are for the AC TX queues
-        */
-       struct conf_tx_rate_class ap_rc_conf[CONF_TX_MAX_AC_COUNT];
-
-       /*
-        * Management TX rate class for AP-mode.
-        */
-       struct conf_tx_rate_class ap_mgmt_conf;
-
-       /*
-        * Broadcast TX rate class for AP-mode.
-        */
-       struct conf_tx_rate_class ap_bcst_conf;
-
        /*
         * Allow this number of TX retries to a connected station/AP before an
         * event is triggered from FW.
index e0de041..5d0ecd2 100644 (file)
@@ -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 */
index 4975270..0dd2414 100644 (file)
@@ -33,5 +33,6 @@ int wl1271_init_pta(struct wl1271 *wl);
 int wl1271_init_energy_detection(struct wl1271 *wl);
 int wl1271_chip_specific_init(struct wl1271 *wl);
 int wl1271_hw_init(struct wl1271 *wl);
+int wl1271_init_ap_rates(struct wl1271 *wl);
 
 #endif
index 7b88dd2..e9d4cf4 100644 (file)
@@ -209,44 +209,6 @@ static struct conf_drv_settings default_conf = {
                                .tx_op_limit = 1504,
                        },
                },
-               .ap_rc_conf                  = {
-                       [0] = {
-                               .enabled_rates = CONF_TX_AP_ENABLED_RATES,
-                               .short_retry_limit = 10,
-                               .long_retry_limit = 10,
-                               .aflags      = 0,
-                       },
-                       [1] = {
-                               .enabled_rates = CONF_TX_AP_ENABLED_RATES,
-                               .short_retry_limit = 10,
-                               .long_retry_limit = 10,
-                               .aflags      = 0,
-                       },
-                       [2] = {
-                               .enabled_rates = CONF_TX_AP_ENABLED_RATES,
-                               .short_retry_limit = 10,
-                               .long_retry_limit = 10,
-                               .aflags      = 0,
-                       },
-                       [3] = {
-                               .enabled_rates = CONF_TX_AP_ENABLED_RATES,
-                               .short_retry_limit = 10,
-                               .long_retry_limit = 10,
-                               .aflags      = 0,
-                       },
-               },
-               .ap_mgmt_conf = {
-                       .enabled_rates       = CONF_TX_AP_DEFAULT_MGMT_RATES,
-                       .short_retry_limit   = 10,
-                       .long_retry_limit    = 10,
-                       .aflags              = 0,
-               },
-               .ap_bcst_conf = {
-                       .enabled_rates       = CONF_HW_BIT_RATE_1MBPS,
-                       .short_retry_limit   = 10,
-                       .long_retry_limit    = 10,
-                       .aflags              = 0,
-               },
                .max_tx_retries = 100,
                .ap_aging_period = 300,
                .tid_conf_count = 4,
@@ -2532,22 +2494,13 @@ static void wl1271_bss_info_changed_ap(struct wl1271 *wl,
 
        if ((changed & BSS_CHANGED_BASIC_RATES)) {
                u32 rates = bss_conf->basic_rates;
-               struct conf_tx_rate_class mgmt_rc;
 
                wl->basic_rate_set = wl1271_tx_enabled_rates_get(wl, rates);
                wl->basic_rate = wl1271_tx_min_rate_get(wl);
-               wl1271_debug(DEBUG_AP, "basic rates: 0x%x",
-                            wl->basic_rate_set);
-
-               /* update the AP management rate policy with the new rates */
-               mgmt_rc.enabled_rates = wl->basic_rate_set;
-               mgmt_rc.long_retry_limit = 10;
-               mgmt_rc.short_retry_limit = 10;
-               mgmt_rc.aflags = 0;
-               ret = wl1271_acx_ap_rate_policy(wl, &mgmt_rc,
-                                               ACX_TX_AP_MODE_MGMT_RATE);
+
+               ret = wl1271_init_ap_rates(wl);
                if (ret < 0) {
-                       wl1271_error("AP mgmt policy change failed %d", ret);
+                       wl1271_error("AP rate policy change failed %d", ret);
                        goto out;
                }
        }