diff options
Diffstat (limited to 'drivers/staging/cw1200/txrx.c')
-rw-r--r-- | drivers/staging/cw1200/txrx.c | 27 |
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); |