wl1251: fix 4-byte TX buffer alignment
PATCH 2/18 wl1251: fix 4-byte TX buffer alignment
In reply to a message not in the archiveThis implements TX buffer alignment for cloned or too small skb by copying and replacing the original skb.
Recent changes in wireless-testing seems to make this really necessary.
Signed-off-by David Gnedt <[email protected]>
---
Sorry for the partly broken patches, I thought I configured my client the right way. I tried to stop the mails at my mailserver, but it was mostly already too late.
--- drivers/net/wireless/wl1251/tx.c | 26 ++++++++++++++++++++------ 1 files changed, 20 insertions(+), 6 deletions(-)
drivers/net/wireless/wl1251/tx.c +20 -6
@@ -213,16 +213,30 @@ static int wl1251_tx_send_packet(struct wl1251 *wl, struct sk_buff *skb,wl1251_debug (DEBUG_TX ,"skb offset %d" , offset);/* check whether the current skb can be used */ -if (!skb_cloned (skb) && (skb_tailroom (skb) >= offset)) { -unsigned char *src = skb->data; +if (skb_cloned (skb) || (skb_tailroom (skb) < offset)) { +struct sk_buff *newskb =skb_copy_expand (skb,0 ,3 , +GFP_KERNEL ); + +if (unlikely (newskb ==NULL )) { +wl1251_error ("Can't allocate skb!" ); +return -EINVAL ; + } + + tx_hdr = (struct tx_double_buffer_desc *) newskb->data; + +dev_kfree_skb_any (skb); + wl->tx_frames[tx_hdr->id] = skb = newskb; -/* align the buffer on a 4-byte boundary */ + offset = (4 - (long )skb->data) &0x03 ; +wl1251_debug (DEBUG_TX ,"new skb offset %d" , offset); + } + +/* align the buffer on a 4-byte boundary */ +if (offset) { +unsigned char *src = skb->data;skb_reserve (skb, offset);memmove (skb->data, src, skb->len); tx_hdr = (struct tx_double_buffer_desc *) skb->data; - }else { -wl1251_info ("No handler, fixme!" ); -return -EINVAL ; } }
Signature · 1 line
1.7.0.4
Quoted 3 lines · David Gnedt
This implements TX buffer alignment for cloned or too small skb by copying and replacing the original skb.
Recent changes in wireless-testing seems to make this really necessary.
I have been hit by this as well, thanks for fixing it.
Quoted 1 line
Signed-off-by David Gnedt <[email protected]>
Acked-by Kalle Valo <[email protected]>
Signature · 1 line
Kalle Valo