wl1271: Add config structure for TX path parameters
[linux-2.6.git] / drivers / net / wireless / wl12xx / wl1271_acx.c
index d19d8605b9d206ede4851de0fc1818f679d34043..038203bcf447c3b1b64f0ea34e24d9c753261184 100644 (file)
@@ -198,7 +198,7 @@ int wl1271_acx_mem_map(struct wl1271 *wl, struct acx_header *mem_map,
        return 0;
 }
 
-int wl1271_acx_rx_msdu_life_time(struct wl1271 *wl, u32 life_time)
+int wl1271_acx_rx_msdu_life_time(struct wl1271 *wl)
 {
        struct acx_rx_msdu_lifetime *acx;
        int ret;
@@ -211,7 +211,7 @@ int wl1271_acx_rx_msdu_life_time(struct wl1271 *wl, u32 life_time)
                goto out;
        }
 
-       acx->lifetime = life_time;
+       acx->lifetime = wl->conf.rx.rx_msdu_life_time;
        ret = wl1271_cmd_configure(wl, DOT11_RX_MSDU_LIFE_TIME,
                                   acx, sizeof(*acx));
        if (ret < 0) {
@@ -265,7 +265,7 @@ int wl1271_acx_pd_threshold(struct wl1271 *wl)
                goto out;
        }
 
-       /* FIXME: threshold value not set */
+       pd->threshold = wl->conf.rx.packet_detection_threshold;
 
        ret = wl1271_cmd_configure(wl, ACX_PD_THRESHOLD, pd, sizeof(*pd));
        if (ret < 0) {
@@ -349,8 +349,8 @@ int wl1271_acx_service_period_timeout(struct wl1271 *wl)
 
        wl1271_debug(DEBUG_ACX, "acx service period timeout");
 
-       rx_timeout->ps_poll_timeout = RX_TIMEOUT_PS_POLL_DEF;
-       rx_timeout->upsd_timeout = RX_TIMEOUT_UPSD_DEF;
+       rx_timeout->ps_poll_timeout = wl->conf.rx.ps_poll_timeout;
+       rx_timeout->upsd_timeout = wl->conf.rx.upsd_timeout;
 
        ret = wl1271_cmd_configure(wl, ACX_SERVICE_PERIOD_TIMEOUT,
                                   rx_timeout, sizeof(*rx_timeout));
@@ -557,8 +557,8 @@ int wl1271_acx_cca_threshold(struct wl1271 *wl)
                goto out;
        }
 
-       detection->rx_cca_threshold = CCA_THRSH_DISABLE_ENERGY_D;
-       detection->tx_energy_detection = 0;
+       detection->rx_cca_threshold = wl->conf.rx.rx_cca_threshold;
+       detection->tx_energy_detection = wl->conf.tx.tx_energy_detection;
 
        ret = wl1271_cmd_configure(wl, ACX_CCA_THRESHOLD,
                                   detection, sizeof(*detection));
@@ -729,6 +729,7 @@ int wl1271_acx_statistics(struct wl1271 *wl, struct acx_statistics *stats)
 int wl1271_acx_rate_policies(struct wl1271 *wl, u32 enabled_rates)
 {
        struct acx_rate_policy *acx;
+       struct conf_tx_rate_class *c = &wl->conf.tx.rc_conf;
        int ret = 0;
 
        wl1271_debug(DEBUG_ACX, "acx rate policies");
@@ -743,9 +744,9 @@ int wl1271_acx_rate_policies(struct wl1271 *wl, u32 enabled_rates)
        /* configure one default (one-size-fits-all) rate class */
        acx->rate_class_cnt = 1;
        acx->rate_class[0].enabled_rates = enabled_rates;
-       acx->rate_class[0].short_retry_limit = ACX_RATE_RETRY_LIMIT;
-       acx->rate_class[0].long_retry_limit = ACX_RATE_RETRY_LIMIT;
-       acx->rate_class[0].aflags = 0;
+       acx->rate_class[0].short_retry_limit = c->short_retry_limit;
+       acx->rate_class[0].long_retry_limit = c->long_retry_limit;
+       acx->rate_class[0].aflags = c->aflags;
 
        ret = wl1271_cmd_configure(wl, ACX_RATE_POLICY, acx, sizeof(*acx));
        if (ret < 0) {
@@ -772,22 +773,14 @@ int wl1271_acx_ac_cfg(struct wl1271 *wl)
                goto out;
        }
 
-       /*
-        * FIXME: Configure each AC with appropriate values (most suitable
-        * values will probably be different for each AC.
-        */
-       for (i = 0; i < WL1271_ACX_AC_COUNT; i++) {
-               acx->ac = i;
-
-               /*
-                * FIXME: The following default values originate from
-                * the TI reference driver. What do they mean?
-                */
-               acx->cw_min = 15;
-               acx->cw_max = 63;
-               acx->aifsn = 3;
+       for (i = 0; i < wl->conf.tx.ac_conf_count; i++) {
+               struct conf_tx_ac_category *c = &(wl->conf.tx.ac_conf[i]);
+               acx->ac = c->ac;
+               acx->cw_min = c->cw_min;
+               acx->cw_max = c->cw_max;
+               acx->aifsn = c->aifsn;
                acx->reserved = 0;
-               acx->tx_op_limit = 0;
+               acx->tx_op_limit = c->tx_op_limit;
 
                ret = wl1271_cmd_configure(wl, ACX_AC_CFG, acx, sizeof(*acx));
                if (ret < 0) {
@@ -816,12 +809,15 @@ int wl1271_acx_tid_cfg(struct wl1271 *wl)
                goto out;
        }
 
-       /* FIXME: configure each TID with a different AC reference */
-       for (i = 0; i < WL1271_ACX_TID_COUNT; i++) {
-               acx->queue_id = i;
-               acx->tsid = WL1271_ACX_AC_BE;
-               acx->ps_scheme = WL1271_ACX_PS_SCHEME_LEGACY;
-               acx->ack_policy = WL1271_ACX_ACK_POLICY_LEGACY;
+       for (i = 0; i < wl->conf.tx.tid_conf_count; i++) {
+               struct conf_tx_tid *c = &(wl->conf.tx.tid_conf[i]);
+               acx->queue_id = c->queue_id;
+               acx->channel_type = c->channel_type;
+               acx->tsid = c->tsid;
+               acx->ps_scheme = c->ps_scheme;
+               acx->ack_policy = c->ack_policy;
+               acx->apsd_conf[0] = c->apsd_conf[0];
+               acx->apsd_conf[1] = c->apsd_conf[1];
 
                ret = wl1271_cmd_configure(wl, ACX_TID_CFG, acx, sizeof(*acx));
                if (ret < 0) {
@@ -849,7 +845,7 @@ int wl1271_acx_frag_threshold(struct wl1271 *wl)
                goto out;
        }
 
-       acx->frag_threshold = IEEE80211_MAX_FRAG_THRESHOLD;
+       acx->frag_threshold = wl->conf.tx.frag_threshold;
        ret = wl1271_cmd_configure(wl, ACX_FRAG_CFG, acx, sizeof(*acx));
        if (ret < 0) {
                wl1271_warning("Setting of frag threshold failed: %d", ret);
@@ -875,8 +871,8 @@ int wl1271_acx_tx_config_options(struct wl1271 *wl)
                goto out;
        }
 
-       acx->tx_compl_timeout = WL1271_ACX_TX_COMPL_TIMEOUT;
-       acx->tx_compl_threshold = WL1271_ACX_TX_COMPL_THRESHOLD;
+       acx->tx_compl_timeout = wl->conf.tx.tx_compl_timeout;
+       acx->tx_compl_threshold = wl->conf.tx.tx_compl_threshold;
        ret = wl1271_cmd_configure(wl, ACX_TX_CONFIG_OPT, acx, sizeof(*acx));
        if (ret < 0) {
                wl1271_warning("Setting of tx options failed: %d", ret);
@@ -929,7 +925,7 @@ int wl1271_acx_init_mem_config(struct wl1271 *wl)
                return ret;
 
        wl->target_mem_map = kzalloc(sizeof(struct wl1271_acx_mem_map),
-                                         GFP_KERNEL);
+                                    GFP_KERNEL);
        if (!wl->target_mem_map) {
                wl1271_error("couldn't allocate target memory map");
                return -ENOMEM;
@@ -966,10 +962,10 @@ int wl1271_acx_init_rx_interrupt(struct wl1271 *wl)
                goto out;
        }
 
-       rx_conf->threshold = WL1271_RX_INTR_THRESHOLD_DEF;
-       rx_conf->timeout = WL1271_RX_INTR_TIMEOUT_DEF;
-       rx_conf->mblk_threshold = USHORT_MAX; /* Disabled */
-       rx_conf->queue_type = RX_QUEUE_TYPE_RX_LOW_PRIORITY;
+       rx_conf->threshold = wl->conf.rx.irq_pkt_threshold;
+       rx_conf->timeout = wl->conf.rx.irq_timeout;
+       rx_conf->mblk_threshold = wl->conf.rx.irq_blk_threshold;
+       rx_conf->queue_type = wl->conf.rx.queue_type;
 
        ret = wl1271_cmd_configure(wl, ACX_RX_CONFIG_OPT, rx_conf,
                                   sizeof(*rx_conf));