diff options
author | Lukasz KUCHARCZYK <lukasz.kucharczyk@tieto.com> | 2012-02-29 15:14:22 +0100 |
---|---|---|
committer | Philippe Langlais <philippe.langlais@stericsson.com> | 2012-05-22 11:06:37 +0200 |
commit | 8702004a664d4fd01d3626b59717a2a0198cdeee (patch) | |
tree | d5fce16a068abfe248dd78be0da5efa1cd976350 | |
parent | 99d16921d04f0a53996e6f1afbd78762064e801f (diff) |
cw1200: fix WMM AC parameters forwarding to WSM.
Pass the WMM AC / WMM ACI parameters to
WSM in a correct order.
ST-Ericsson ID: 355241, 355096, 355166, 355221, 355070
ST-Ericsson FOSS-OUT ID: NA
Signed-off-by: Lukasz Kucharczyk <lukasz.kucharczyk@tieto.com>
Signed-off-by: Piotr Nakraszewicz <piotr.nakraszewicz@tieto.com>
Change-Id: I23497fad48fda42bd731490aaac505f666a166a2
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/35063
Reviewed-by: Piotr NAKRASZEWICZ <piotr.nakraszewicz@tieto.com>
Reviewed-by: Bartosz MARKOWSKI <bartosz.markowski@tieto.com>
Reviewed-by: Lukasz KUCHARCZYK <Lukasz.kucharczyk@tieto.com>
Tested-by: Lukasz KUCHARCZYK <Lukasz.kucharczyk@tieto.com>
-rw-r--r-- | drivers/staging/cw1200/cw1200.h | 1 | ||||
-rw-r--r-- | drivers/staging/cw1200/sta.c | 27 | ||||
-rw-r--r-- | drivers/staging/cw1200/wsm.c | 30 | ||||
-rw-r--r-- | drivers/staging/cw1200/wsm.h | 30 |
4 files changed, 56 insertions, 32 deletions
diff --git a/drivers/staging/cw1200/cw1200.h b/drivers/staging/cw1200/cw1200.h index 3c3a50ce318..1852c734ce5 100644 --- a/drivers/staging/cw1200/cw1200.h +++ b/drivers/staging/cw1200/cw1200.h @@ -111,6 +111,7 @@ struct cw1200_common { struct ieee80211_channel *channel; u8 bssid[ETH_ALEN]; struct wsm_edca_params edca; + struct wsm_tx_queue_params tx_queue_params; struct wsm_association_mode association_mode; struct wsm_set_bss_params bss_params; struct cw1200_ht_info ht_info; diff --git a/drivers/staging/cw1200/sta.c b/drivers/staging/cw1200/sta.c index e5ecde6216e..6c216917d44 100644 --- a/drivers/staging/cw1200/sta.c +++ b/drivers/staging/cw1200/sta.c @@ -49,11 +49,11 @@ int cw1200_start(struct ieee80211_hw *dev) mutex_lock(&priv->conf_mutex); - /* default ECDA */ - WSM_EDCA_SET(&priv->edca, 0, 0x0002, 0x0003, 0x0007, 47, false); - WSM_EDCA_SET(&priv->edca, 1, 0x0002, 0x0007, 0x000f, 94, false); - WSM_EDCA_SET(&priv->edca, 2, 0x0003, 0x000f, 0x03ff, 0, false); - WSM_EDCA_SET(&priv->edca, 3, 0x0007, 0x000f, 0x03ff, 0, false); + /* default EDCA */ + WSM_EDCA_SET(&priv->edca, 0, 0x0002, 0x0003, 0x0007, 47, 0xc8, false); + WSM_EDCA_SET(&priv->edca, 1, 0x0002, 0x0007, 0x000f, 94, 0xc8, false); + WSM_EDCA_SET(&priv->edca, 2, 0x0003, 0x000f, 0x03ff, 0, 0xc8, false); + WSM_EDCA_SET(&priv->edca, 3, 0x0007, 0x000f, 0x03ff, 0, 0xc8, false); ret = wsm_set_edca_params(priv, &priv->edca); if (WARN_ON(ret)) goto out; @@ -539,12 +539,24 @@ int cw1200_conf_tx(struct ieee80211_hw *dev, struct ieee80211_vif *vif, if (queue < dev->queues) { old_uapsdFlags = priv->uapsd_info.uapsdFlags; + WSM_TX_QUEUE_SET(&priv->tx_queue_params, queue, 0, 0, 0); + ret = wsm_set_tx_queue_params(priv, + &priv->tx_queue_params.params[queue], queue); + if (ret) { + ret = -EINVAL; + goto out; + } + WSM_EDCA_SET(&priv->edca, queue, params->aifs, - params->cw_min, params->cw_max, params->txop, + params->cw_min, params->cw_max, params->txop, 0xc8, params->uapsd); ret = wsm_set_edca_params(priv, &priv->edca); + if (ret) { + ret = -EINVAL; + goto out; + } - if (!ret && (priv->mode == NL80211_IFTYPE_STATION)) { + if (priv->mode == NL80211_IFTYPE_STATION) { ret = cw1200_set_uapsd_param(priv, &priv->edca); if (!ret && priv->setbssparams_done && (priv->join_status == CW1200_JOIN_STATUS_STA) && @@ -554,6 +566,7 @@ int cw1200_conf_tx(struct ieee80211_hw *dev, struct ieee80211_vif *vif, } else ret = -EINVAL; +out: mutex_unlock(&priv->conf_mutex); return ret; } diff --git a/drivers/staging/cw1200/wsm.c b/drivers/staging/cw1200/wsm.c index a8c49494e49..add382d78ee 100644 --- a/drivers/staging/cw1200/wsm.c +++ b/drivers/staging/cw1200/wsm.c @@ -536,15 +536,15 @@ nomem: /* ******************************************************************** */ int wsm_set_tx_queue_params(struct cw1200_common *priv, - const struct wsm_set_tx_queue_params *arg) + const struct wsm_set_tx_queue_params *arg, u8 id) { int ret; struct wsm_buf *buf = &priv->wsm_cmd_buf; + u8 queue_id_to_wmm_aci[] = {3, 2, 0, 1}; wsm_cmd_lock(priv); - /* TODO: verify me. */ - WSM_PUT8(buf, arg->queueId); + WSM_PUT8(buf, queue_id_to_wmm_aci[id]); WSM_PUT8(buf, 0); WSM_PUT8(buf, arg->ackPolicy); WSM_PUT8(buf, 0); @@ -572,34 +572,32 @@ int wsm_set_edca_params(struct cw1200_common *priv, wsm_cmd_lock(priv); - /* TODO: verify me. */ - /* Implemented according to specification. Note that there is a - * mismatch in BK and BE mapping. */ + /* Implemented according to specification. */ + WSM_PUT16(buf, arg->params[3].cwMin); + WSM_PUT16(buf, arg->params[2].cwMin); WSM_PUT16(buf, arg->params[1].cwMin); WSM_PUT16(buf, arg->params[0].cwMin); - WSM_PUT16(buf, arg->params[2].cwMin); - WSM_PUT16(buf, arg->params[3].cwMin); + WSM_PUT16(buf, arg->params[3].cwMax); + WSM_PUT16(buf, arg->params[2].cwMax); WSM_PUT16(buf, arg->params[1].cwMax); WSM_PUT16(buf, arg->params[0].cwMax); - WSM_PUT16(buf, arg->params[2].cwMax); - WSM_PUT16(buf, arg->params[3].cwMax); + WSM_PUT8(buf, arg->params[3].aifns); + WSM_PUT8(buf, arg->params[2].aifns); WSM_PUT8(buf, arg->params[1].aifns); WSM_PUT8(buf, arg->params[0].aifns); - WSM_PUT8(buf, arg->params[2].aifns); - WSM_PUT8(buf, arg->params[3].aifns); + WSM_PUT16(buf, arg->params[3].txOpLimit); + WSM_PUT16(buf, arg->params[2].txOpLimit); WSM_PUT16(buf, arg->params[1].txOpLimit); WSM_PUT16(buf, arg->params[0].txOpLimit); - WSM_PUT16(buf, arg->params[2].txOpLimit); - WSM_PUT16(buf, arg->params[3].txOpLimit); + WSM_PUT32(buf, arg->params[3].maxReceiveLifetime); + WSM_PUT32(buf, arg->params[2].maxReceiveLifetime); WSM_PUT32(buf, arg->params[1].maxReceiveLifetime); WSM_PUT32(buf, arg->params[0].maxReceiveLifetime); - WSM_PUT32(buf, arg->params[2].maxReceiveLifetime); - WSM_PUT32(buf, arg->params[3].maxReceiveLifetime); ret = wsm_cmd_send(priv, buf, NULL, 0x0013, WSM_CMD_TIMEOUT); wsm_cmd_unlock(priv); diff --git a/drivers/staging/cw1200/wsm.h b/drivers/staging/cw1200/wsm.h index bcccd790332..635c9c7fca1 100644 --- a/drivers/staging/cw1200/wsm.h +++ b/drivers/staging/cw1200/wsm.h @@ -1035,12 +1035,6 @@ int wsm_remove_key(struct cw1200_common *priv, /* 3.34 */ struct wsm_set_tx_queue_params { - /* 0 best effort/legacy */ - /* 1 background */ - /* 2 video */ - /* 3 voice */ - u8 queueId; - /* WSM_ACK_POLICY_... */ u8 ackPolicy; @@ -1053,8 +1047,23 @@ struct wsm_set_tx_queue_params { u32 maxTransmitLifetime; }; +struct wsm_tx_queue_params { + /* NOTE: index is a linux queue id. */ + struct wsm_set_tx_queue_params params[4]; +}; + + +#define WSM_TX_QUEUE_SET(queue_params, queue, ack_policy, allowed_time,\ + max_life_time) \ +do { \ + struct wsm_set_tx_queue_params *p = &(queue_params)->params[queue]; \ + p->ackPolicy = (ack_policy); \ + p->allowedMediumTime = (allowed_time); \ + p->maxTransmitLifetime = (max_life_time); \ +} while (0) + int wsm_set_tx_queue_params(struct cw1200_common *priv, - const struct wsm_set_tx_queue_params *arg); + const struct wsm_set_tx_queue_params *arg, u8 id); /* 3.36 */ struct wsm_edca_queue_params { @@ -1084,13 +1093,16 @@ struct wsm_edca_params { struct wsm_edca_queue_params params[4]; }; -#define WSM_EDCA_SET(edca, queue, aifs, cw_min, cw_max, txop, uapsd) \ +#define TXOP_UNIT 32 +#define WSM_EDCA_SET(edca, queue, aifs, cw_min, cw_max, txop, life_time,\ + uapsd) \ do { \ struct wsm_edca_queue_params *p = &(edca)->params[queue]; \ p->cwMin = (cw_min); \ p->cwMax = (cw_max); \ p->aifns = (aifs); \ - p->txOpLimit = (txop); \ + p->txOpLimit = ((txop) * TXOP_UNIT); \ + p->maxReceiveLifetime = (life_time); \ p->uapsdEnable = (uapsd); \ } while (0) |