summaryrefslogtreecommitdiff
path: root/drivers/staging/cw1200/txrx.c
diff options
context:
space:
mode:
authorAjitpal.Singh <ajitpal.singh@stericsson.com>2011-09-21 16:56:14 +0530
committerPhilippe LANGLAIS <philippe.langlais@stericsson.com>2011-10-13 10:26:09 +0200
commit1cd0b078e3beff5a4c5b6dfe134e38653f4f0483 (patch)
tree16b5cdef6eb238a797a77ce8c3b7c1f47817ecf4 /drivers/staging/cw1200/txrx.c
parent744a76525819adfe1b1652d465664e5a380ce29c (diff)
cw1200: Add 2byte hole in TXreq for unaligned buf
Adds a 2 bytes hole in the WSM Transmit request when skb->data is aligned at 2 bytes.This will make the transmit request 4byte aligned. This optmisation is need for DMA. The firmware is informed about the hole by setting BIT7 in the WSM Transmit Request flags. ST-Ericsson ID: 357764 ST-Ericsson FOSS-OUT ID: NA Change-Id: Idbb60459ca645575c2afc74f2421b0fa86121cf0 Signed-off-by: Ajitpal.Singh <ajitpal.singh@stericsson.com> Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/33668 Tested-by: Dmitry TARNYAGIN <dmitry.tarnyagin@stericsson.com> Reviewed-by: Philippe LANGLAIS <philippe.langlais@stericsson.com>
Diffstat (limited to 'drivers/staging/cw1200/txrx.c')
-rw-r--r--drivers/staging/cw1200/txrx.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/drivers/staging/cw1200/txrx.c b/drivers/staging/cw1200/txrx.c
index ef5accb19a0..a03a17bb79c 100644
--- a/drivers/staging/cw1200/txrx.c
+++ b/drivers/staging/cw1200/txrx.c
@@ -508,14 +508,22 @@ cw1200_tx_h_crypt(struct cw1200_common *priv,
static int
cw1200_tx_h_align(struct cw1200_common *priv,
- struct cw1200_txinfo *t)
+ struct cw1200_txinfo *t,
+ u8 *flags)
{
size_t offset = (size_t)t->skb->data & 3;
- u8 *p;
if (!offset)
return 0;
+ if (offset & 1) {
+ wiphy_err(priv->hw->wiphy,
+ "Bug: attempt to transmit a frame "
+ "with wrong alignment: %d\n",
+ offset);
+ return -EINVAL;
+ }
+
if (skb_headroom(t->skb) < offset) {
wiphy_err(priv->hw->wiphy,
"Bug: no space allocated "
@@ -524,10 +532,11 @@ cw1200_tx_h_align(struct cw1200_common *priv,
skb_headroom(t->skb));
return -ENOMEM;
}
- p = skb_push(t->skb, offset);
- memmove(p, &p[offset], t->skb->len - offset);
- skb_trim(t->skb, t->skb->len - offset);
- cw1200_debug_tx_copy(priv);
+ skb_push(t->skb, offset);
+ t->hdrlen += offset;
+ t->txpriv.offset += offset;
+ *flags |= WSM_TX_2BYTES_SHIFT;
+ cw1200_debug_tx_align(priv);
return 0;
}
@@ -645,7 +654,7 @@ cw1200_tx_h_rate_policy(struct cw1200_common *priv,
t->txpriv.rate_id = tx_policy_get(priv,
t->tx_info->control.rates, IEEE80211_TX_MAX_RATES,
&tx_policy_renew);
- wsm->flags = t->txpriv.rate_id << 4;
+ wsm->flags |= t->txpriv.rate_id << 4;
if (tx_policy_renew) {
tx_policy_printk(KERN_DEBUG "[TX] TX policy renew.\n");
@@ -696,6 +705,7 @@ void cw1200_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
};
struct wsm_tx *wsm;
bool tid_update = 0;
+ u8 flags = 0;
int ret;
t.rate = cw1200_get_tx_rate(priv,
@@ -722,7 +732,7 @@ void cw1200_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
ret = cw1200_tx_h_crypt(priv, &t);
if (ret)
goto drop;
- ret = cw1200_tx_h_align(priv, &t);
+ ret = cw1200_tx_h_align(priv, &t, &flags);
if (ret)
goto drop;
ret = cw1200_tx_h_action(priv, &t);
@@ -733,6 +743,7 @@ void cw1200_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
ret = -ENOMEM;
goto drop;
}
+ wsm->flags |= flags;
cw1200_tx_h_bt(priv, &t, wsm);
cw1200_tx_h_rate_policy(priv, &t, wsm);