Rate class configuration has been split up for AP and STA modes.
Template related configuration likewise separated.
Signed-off-by: Arik Nemtsov <arik@wizery.com>
Reviewed-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
 int wl1271_acx_rate_policies(struct wl1271 *wl)
 {
        struct acx_rate_policy *acx;
-       struct conf_tx_rate_class *c = &wl->conf.tx.rc_conf;
+       struct conf_tx_rate_class *c = &wl->conf.tx.sta_rc_conf;
        int idx = 0;
        int ret = 0;
 
 
        cmd->len = cpu_to_le16(buf_len);
        cmd->template_type = template_id;
        cmd->enabled_rates = cpu_to_le32(rates);
-       cmd->short_retry_limit = wl->conf.tx.rc_conf.short_retry_limit;
-       cmd->long_retry_limit = wl->conf.tx.rc_conf.long_retry_limit;
+       cmd->short_retry_limit = wl->conf.tx.tmpl_short_retry_limit;
+       cmd->long_retry_limit = wl->conf.tx.tmpl_long_retry_limit;
        cmd->index = index;
 
        if (buf)
 
                                        CONF_HW_BIT_RATE_2MBPS)
 #define CONF_TX_RATE_RETRY_LIMIT       10
 
+/*
+ * Rates supported for data packets when operating as AP. Note the absense
+ * of the 22Mbps rate. There is a FW limitation on 12 rates so we must drop
+ * one. The rate dropped is not mandatory under any operating mode.
+ */
+#define CONF_TX_AP_ENABLED_RATES       (CONF_HW_BIT_RATE_1MBPS | \
+       CONF_HW_BIT_RATE_2MBPS | CONF_HW_BIT_RATE_5_5MBPS |      \
+       CONF_HW_BIT_RATE_6MBPS | CONF_HW_BIT_RATE_9MBPS |        \
+       CONF_HW_BIT_RATE_11MBPS | CONF_HW_BIT_RATE_12MBPS |      \
+       CONF_HW_BIT_RATE_18MBPS | 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
+ */
+#define CONF_TX_AP_DEFAULT_MGMT_RATES  (CONF_HW_BIT_RATE_1MBPS | \
+       CONF_HW_BIT_RATE_2MBPS | CONF_HW_BIT_RATE_5_5MBPS)
+
 struct conf_tx_rate_class {
 
        /*
 
        /*
         * Configuration for rate classes for TX (currently only one
-        * rate class supported.)
+        * rate class supported). Used in non-AP mode.
         */
-       struct conf_tx_rate_class rc_conf;
+       struct conf_tx_rate_class sta_rc_conf;
 
        /*
         * Configuration for access categories for TX rate control.
        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;
+
        /*
         * Configuration for TID parameters.
         */
         * Range: CONF_HW_BIT_RATE_* bit mask
         */
        u32 basic_rate_5;
+
+       /*
+        * TX retry limits for templates
+        */
+       u8 tmpl_short_retry_limit;
+       u8 tmpl_long_retry_limit;
 };
 
 enum {
 
        },
        .tx = {
                .tx_energy_detection         = 0,
-               .rc_conf                     = {
+               .sta_rc_conf                 = {
                        .enabled_rates       = 0,
                        .short_retry_limit   = 10,
                        .long_retry_limit    = 10,
-                       .aflags              = 0
+                       .aflags              = 0,
                },
                .ac_conf_count               = 4,
                .ac_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,
+               },
+
                .tid_conf_count = 4,
                .tid_conf = {
                        [CONF_TX_AC_BE] = {
                .tx_compl_threshold          = 4,
                .basic_rate                  = CONF_HW_BIT_RATE_1MBPS,
                .basic_rate_5                = CONF_HW_BIT_RATE_6MBPS,
+               .tmpl_short_retry_limit      = 10,
+               .tmpl_long_retry_limit       = 10,
        },
        .conn = {
                .wake_up_event               = CONF_WAKE_UP_EVENT_DTIM,